From nobody Fri Oct 11 21:50:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=citrix.com); dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=2; a=rsa-sha256; t=1678968542; cv=pass; d=zohomail.com; s=zohoarc; b=Nqlvr2lcOlRV9AvADvL6x9piz7TgCV2KTBfli71VQhnMLgxgwQCZTZWVqjP74qsCoVTUyfkdWm9qTVwhlyJoPinTKTBqoqNCNKKS8QNMLvtzrjPHpFLKbOW9gQ10yBqU7mfRE9lDJLAGyfVZGbiN/n/r7yVP0YhZ9WtZztXnd04= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678968542; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=vygrCmOAa37dNqvYZOTv23Q2I1fRsVZl6Nb7n0/H6p8=; b=KFvOL16eMublhGmJN0U+fvAxr6MrgBBvzTsBdMnXmWwkK2N6L2aaYiBChl8bOrc6aHDPLJsLPdRltdxvHf2DOu4wXE2rVEfJ8B3nLXzvtbWQyENdgNax76H55kytSETBPbFDWK7sFzXUB2MQSRPbrSlm1Q4CDBK36G1xsLvKswE= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=citrix.com); dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1678968542688153.0185865371293; Thu, 16 Mar 2023 05:09:02 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.510538.788356 (Exim 4.92) (envelope-from ) id 1pcmPN-0003f0-DN; Thu, 16 Mar 2023 12:08:37 +0000 Received: by outflank-mailman (output) from mailman id 510538.788356; Thu, 16 Mar 2023 12:08:37 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pcmPN-0003et-A3; Thu, 16 Mar 2023 12:08:37 +0000 Received: by outflank-mailman (input) for mailman id 510538; Thu, 16 Mar 2023 12:08:35 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pcmPL-0003eh-OC for xen-devel@lists.xenproject.org; Thu, 16 Mar 2023 12:08:35 +0000 Received: from esa3.hc3370-68.iphmx.com (esa3.hc3370-68.iphmx.com [216.71.145.155]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 44935cac-c3f3-11ed-87f5-c1b5be75604c; Thu, 16 Mar 2023 13:08:33 +0100 (CET) Received: from mail-co1nam11lp2176.outbound.protection.outlook.com (HELO NAM11-CO1-obe.outbound.protection.outlook.com) ([104.47.56.176]) by ob1.hc3370-68.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 16 Mar 2023 08:08:13 -0400 Received: from SJ0PR03MB6360.namprd03.prod.outlook.com (2603:10b6:a03:395::11) by SJ0PR03MB5934.namprd03.prod.outlook.com (2603:10b6:a03:2d7::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.33; Thu, 16 Mar 2023 12:08:11 +0000 Received: from SJ0PR03MB6360.namprd03.prod.outlook.com ([fe80::48a7:d1ab:897:acda]) by SJ0PR03MB6360.namprd03.prod.outlook.com ([fe80::48a7:d1ab:897:acda%6]) with mapi id 15.20.6178.031; Thu, 16 Mar 2023 12:08:11 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 44935cac-c3f3-11ed-87f5-c1b5be75604c DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1678968512; h=from:to:cc:subject:date:message-id: content-transfer-encoding:mime-version; bh=uXDn8J+pv+h3ndV2YGMRknmZvG+soHTVmBxKhUzTOkg=; b=N3yIDf6iBlgsUbWINaFxRAOIBnLBwRq/iHEqHEW0UFLskfaI87+C0gIZ YjCQi+5m9k//qi96Du+z4Z6IKzoPVBbSIr38CmXtm7YVtNMmulyKAM2Lp 22A3cei4vprWuEtlt20fIJt8bRlEc5RhJSDxo5XcSUg7nKpJBHUplkYRl I=; X-IronPort-RemoteIP: 104.47.56.176 X-IronPort-MID: 101105483 X-IronPort-Reputation: None X-IronPort-Listener: OutboundMail X-IronPort-SenderGroup: RELAY_O365 X-IronPort-MailFlowPolicy: $RELAYED IronPort-Data: A9a23:LKAjsaJ3dpc6PsLHFE+R0ZQlxSXFcZb7ZxGr2PjKsXjdYENShDcDm GEcUW+DMvePZmPwKIhwa4Sz/RkDvpeEzoJhGlRlqX01Q3x08seUXt7xwmUcnc+xBpaaEB84t ZV2hv3odp1coqr0/0/1WlTZhSAgk/rOHvykU7Ss1hlZHWdMUD0mhQ9oh9k3i4tphcnRKw6Ws Jb5rta31GWNglaYCUpJrfPTwP9TlK6q4mhA5QVgPa4jUGL2zBH5MrpOfcldEFOgKmVkNrbSb /rOyri/4lTY838FYj9yuu+mGqGiaue60Tmm0hK6aYD76vRxjnVaPpIAHOgdcS9qZwChxLid/ jn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L0bOkjKt4X87NwOla2XkaQzvdoPca n6IRNlXTZYQTOsNSTO5uwHzvn1ehTyYdy3ofsupaSQudXHNcnW2GO4ORUTevCb0osi6/3gKo qO0a1tcoDexBPVaOB0Ni3FKuxvwColIbkok+d+fW6yieT2DaCvntDnUZ/oVcrQ+HAfKynCPk c= X-IronPort-AV: E=Sophos;i="5.98,265,1673931600"; d="scan'208";a="101105483" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=etos+XQzQgWUOeY7/OMz75nPSOix3sh+rWEARtU6kjRRxs1DQBfanEtSjXof1y7pcM/Tz6yF88/Ln9dWEKjgHlAPxVNENgLYWJlns6iHkXWXq2A1j1IQdHJUgwG1wqmz6Tzh8EiBi0063GXGywEEAeU8de5tqEMLrXWpVEyuzP8+FGLXH3C5NdHk41hwiSDhtpwebGlXpJ/wnwECNACbYjPYIhbQUvf4H19P1p4TslxWHjhFdBm0K8y4AqHWd1DH4K0rk4zVLYZKqerPjy376mASFCW26g6E12Ugxks11CiFs2BVaFsObWB3PvCmxOHAgSQ91owEQDcAoysuGYfDOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=vygrCmOAa37dNqvYZOTv23Q2I1fRsVZl6Nb7n0/H6p8=; b=ULzpUlfv/ePb2OkMOVQ1Mw8HVzAQ9Zu4Axj3q27LbqpwlRa+OakgJLHNUR1hom/tdbFfQh37CoyAaiaZ6owaKIK+irosC9v0r76Ucs8YH2wonJgbuV2CKUY8uKkO3YAbC86KwTn5Anoo9yiMrLM4zgrhVwktFA3le8JyK2TWkENdRmfhtU0fywofyfharqh3L8UciZ5MHt0VqZj59sy1uj21UqwyYLD7AGkeXfdtcPc+lFOlGCY2rmVIazDZDq2rXofNoG++irg/yroTvR83TF4PDa0TIOClPjC35C+rA6LaVDtbdDwoRGwDWn/GIICrMhEORTYnismKfo4/lvQRuQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.onmicrosoft.com; s=selector2-citrix-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vygrCmOAa37dNqvYZOTv23Q2I1fRsVZl6Nb7n0/H6p8=; b=S+NG+EZ5qOKCpdfhtalO+POrlC7s7KQnnvwz54DgHIIqBUSTZj/Mo/zFadHgaIVHAFrZoI+I3M0ruPfw9CBmasCJe23exzihMX8FMSARutjoTDj1DljfVsXip1VKMYTxMTq/xRYQm2LwTdK3t3XzLqRZ3Wb4s88M8NlW1gmMprw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com; From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: Roger Pau Monne Subject: [PATCH v2] vpci/msix: handle accesses adjacent to the MSI-X table Date: Thu, 16 Mar 2023 13:07:10 +0100 Message-Id: <20230316120710.38817-1-roger.pau@citrix.com> X-Mailer: git-send-email 2.39.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BN0PR04CA0105.namprd04.prod.outlook.com (2603:10b6:408:ec::20) To SJ0PR03MB6360.namprd03.prod.outlook.com (2603:10b6:a03:395::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR03MB6360:EE_|SJ0PR03MB5934:EE_ X-MS-Office365-Filtering-Correlation-Id: 7dd245ae-af48-463d-4489-08db26171cd5 X-LD-Processed: 335836de-42ef-43a2-b145-348c2ee9ca5b,ExtAddr,ExtFwd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xpZH2QWE7rFKZH4cBHsxq+U0C4CiW9/JlX7ZgF3r6RhUjYIL+NSyHKh3Wq7ZgYLTFKqEjNzA/Wij8Kfy+ArJ3/Ewp5F+aEl6U7fwK9ruFYD5N+Y/2y2bp4Q/HeQWvg58meVxntvm+Lme/kJ7DASHKF8jSRKbQDiMyyXVOIiMLwnDSfTfVlDkDCiwGMzqZbIF7PzH6ufi49LVu7wjnHOERv8ybRqTI50KdCsNAuKDAQZsTjgO9T4BN7SM3LLPtmW0jM65gNLE+df8nI9hxeOB7rP/mzDtvV9mDH/21RF2DknXoQ3Qzo4FcJKBuYH8D+HBLdCM/VpPfde1kh7sabAoCpJ6hoyWU6ClDhPcvgmc1+/oz9czI8ZDgdGMDUDndDKDwE4646M6ncxYlRsrWlKR8HeJKpp0uSSnPd5f6hv9vschmbyeTobvpTI4euGmorC215YFpT+7SOdJZOtGzReYDqyg6WhwDSOrJufy/rKWtVx/gKpfz9/ukvvVG5nDz5GrcrRSFhSfEDhb+iRa9CVygndMzCInCHk0oxeaUJ9U428FvDEZ2KLb6baCRIaY6TIHi15CbkK6kt5lyZbW5NgCXRdwxRJklaq0eDylD/js//t7TVGJGZOPNKF33qPmArtyx0rBWBKmu6z7Ub8VKebZxw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ0PR03MB6360.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(366004)(39860400002)(396003)(346002)(376002)(136003)(451199018)(86362001)(38100700002)(82960400001)(36756003)(2906002)(41300700001)(30864003)(8936002)(5660300002)(2616005)(6512007)(6506007)(1076003)(26005)(186003)(4326008)(83380400001)(316002)(107886003)(66476007)(8676002)(66556008)(6916009)(6486002)(478600001)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-Chunk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Co35FroqhjxwEok+9F5t4OaKlLakUXAOrFj9oqyUlIYpoOzTFD2XZdw6Xa7Sue5TJI705fi9CrI8hVlZomz0xaUNMpWqmcP0oz4vcMUszygWFl6Ki+1wofQ7wigMkv1w3OTXUC61S2E3jvIyFkGy504GTok6Smo116KjJ7nZmdIPVe0+GmQhVXHEC5APUH6UxnaYciRkzjQP4CL8Fbot5vOd5+MdNLpFaAX7Y/kpfHwzF2JzMLcaAy1C+GvvCmH8AvsRLU6UhLESKMoGf42hp6zK7LnoHupfqIRewCK15kJTyZQ1Gj+csB63ndg+O5VWl3tw== X-OriginatorOrg: citrix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7dd245ae-af48-463d-4489-08db26171cd5 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR03MB6360.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Mar 2023 12:08:11.5568 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335836de-42ef-43a2-b145-348c2ee9ca5b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: jaw4/+GGxQM4MGExcKBCMplQmezTyFWvTx63o525jyFdIQ/96TR8EmtzUWuQ+Ot3T9mShbmgUljE+wxBB9tfNg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR03MB5934 X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1678968544431100001 The handling of the MSI-X table accesses by Xen requires that any pages part of the MSI-X related tables are not mapped into the domain physmap. As a result, any device registers in the same pages as the start or the end of the MSIX or PBA tables is not currently accessible, as the accesses are just dropped. Note the spec forbids such placing of registers, as the MSIX and PBA tables must be 4K isolated from any other registers: "If a Base Address register that maps address space for the MSI-X Table or MSI-X PBA also maps other usable address space that is not associated with MSI-X structures, locations (e.g., for CSRs) used in the other address space must not share any naturally aligned 4-KB address range with one where either MSI-X structure resides." Yet the 'Intel Wi-Fi 6 AX201' device on one of my boxes has registers in the same page as the MSIX tables, and thus won't work on a PVH dom0 without this fix. In order to cope with the behavior passthrough any accesses that fall on the same page as the MSIX tables (but don't fall in between) it to the underlying hardware. Such forwarding also takes care of the PBA accesses, so it allows to remove the code doing this handling in msix_{read,write}. Note that as a result accesses to the PBA array are no longer limited to 4 and 8 byte sizes, there's no access size restriction for PBA accesses documented in the specification. Signed-off-by: Roger Pau Monn=C3=A9 --- Changes since v1: - Properly handle the PBA also. - Merge the handlers for adjacent writes into the existing MSIX table ones. --- xen/drivers/vpci/msix.c | 329 +++++++++++++++++++++++++++++----------- xen/drivers/vpci/vpci.c | 7 +- xen/include/xen/vpci.h | 8 +- 3 files changed, 255 insertions(+), 89 deletions(-) diff --git a/xen/drivers/vpci/msix.c b/xen/drivers/vpci/msix.c index bea0cc7aed..060b74d62b 100644 --- a/xen/drivers/vpci/msix.c +++ b/xen/drivers/vpci/msix.c @@ -27,6 +27,11 @@ ((addr) >=3D vmsix_table_addr(vpci, nr) && = \ (addr) < vmsix_table_addr(vpci, nr) + vmsix_table_size(vpci, nr)) =20 +#define VMSIX_ADDR_SAME_PAGE(addr, vpci, nr) \ + (PFN_DOWN(addr) >=3D PFN_DOWN(vmsix_table_addr(vpci, nr)) && = \ + PFN_DOWN((addr)) < PFN_UP(vmsix_table_addr(vpci, nr) + \ + vmsix_table_size(vpci, nr) - 1)) + static uint32_t cf_check control_read( const struct pci_dev *pdev, unsigned int reg, void *data) { @@ -149,7 +154,7 @@ static struct vpci_msix *msix_find(const struct domain = *d, unsigned long addr) =20 for ( i =3D 0; i < ARRAY_SIZE(msix->tables); i++ ) if ( bars[msix->tables[i] & PCI_MSIX_BIRMASK].enabled && - VMSIX_ADDR_IN_RANGE(addr, msix->pdev->vpci, i) ) + VMSIX_ADDR_SAME_PAGE(addr, msix->pdev->vpci, i) ) return msix; } =20 @@ -182,93 +187,201 @@ static struct vpci_msix_entry *get_entry(struct vpci= _msix *msix, return &msix->entries[(addr - start) / PCI_MSIX_ENTRY_SIZE]; } =20 -static void __iomem *get_pba(struct vpci *vpci) +static void __iomem *get_table(struct vpci *vpci, unsigned int slot) { struct vpci_msix *msix =3D vpci->msix; /* - * PBA will only be unmapped when the device is deassigned, so access = it - * without holding the vpci lock. + * Regions will only be unmapped when the device is deassigned, so acc= ess + * them without holding the vpci lock. */ - void __iomem *pba =3D read_atomic(&msix->pba); + void __iomem *table =3D read_atomic(&msix->table[slot]); + paddr_t addr =3D 0; =20 - if ( likely(pba) ) - return pba; + if ( likely(table) ) + return table; =20 - pba =3D ioremap(vmsix_table_addr(vpci, VPCI_MSIX_PBA), - vmsix_table_size(vpci, VPCI_MSIX_PBA)); - if ( !pba ) - return read_atomic(&msix->pba); + switch ( slot ) + { + case VPCI_MSIX_TBL_TAIL: + addr =3D vmsix_table_size(vpci, VPCI_MSIX_TABLE); + fallthrough; + case VPCI_MSIX_TBL_HEAD: + addr +=3D vmsix_table_addr(vpci, VPCI_MSIX_TABLE); + break; + + case VPCI_MSIX_PBA_TAIL: + addr =3D vmsix_table_size(vpci, VPCI_MSIX_PBA); + fallthrough; + case VPCI_MSIX_PBA_HEAD: + addr +=3D vmsix_table_addr(vpci, VPCI_MSIX_PBA); + break; + } + + table =3D ioremap(round_pgdown(addr), PAGE_SIZE); + if ( !table ) + return read_atomic(&msix->table[slot]); =20 spin_lock(&vpci->lock); - if ( !msix->pba ) + if ( !msix->table[slot] ) { - write_atomic(&msix->pba, pba); + write_atomic(&msix->table[slot], table); spin_unlock(&vpci->lock); } else { spin_unlock(&vpci->lock); - iounmap(pba); + iounmap(table); } =20 - return read_atomic(&msix->pba); + return read_atomic(&msix->table[slot]); } =20 -static int cf_check msix_read( - struct vcpu *v, unsigned long addr, unsigned int len, unsigned long *d= ata) +unsigned int get_slot(const struct vpci *vpci, unsigned long addr) { - const struct domain *d =3D v->domain; - struct vpci_msix *msix =3D msix_find(d, addr); - const struct vpci_msix_entry *entry; - unsigned int offset; + unsigned long pfn =3D PFN_DOWN(addr); =20 - *data =3D ~0ul; + /* + * The logic below relies on having the tables identity mapped to the = guest + * address space, or for the `addr` parameter to be translated into its + * host physical memory address equivalent. + */ =20 - if ( !msix ) - return X86EMUL_RETRY; + if ( pfn =3D=3D PFN_DOWN(vmsix_table_addr(vpci, VPCI_MSIX_TABLE)) ) + return VPCI_MSIX_TBL_HEAD; + if ( pfn =3D=3D PFN_DOWN(vmsix_table_addr(vpci, VPCI_MSIX_TABLE) + + vmsix_table_size(vpci, VPCI_MSIX_TABLE) - 1) ) + return VPCI_MSIX_TBL_TAIL; + if ( pfn =3D=3D PFN_DOWN(vmsix_table_addr(vpci, VPCI_MSIX_PBA)) ) + return VPCI_MSIX_PBA_HEAD; + if ( pfn =3D=3D PFN_DOWN(vmsix_table_addr(vpci, VPCI_MSIX_PBA) + + vmsix_table_size(vpci, VPCI_MSIX_PBA) - 1) ) + return VPCI_MSIX_PBA_TAIL; + + ASSERT_UNREACHABLE(); + return -1; +} =20 - if ( !access_allowed(msix->pdev, addr, len) ) - return X86EMUL_OKAY; +static bool adjacent_handle(const struct vpci_msix *msix, unsigned long ad= dr) +{ + unsigned int i; =20 if ( VMSIX_ADDR_IN_RANGE(addr, msix->pdev->vpci, VPCI_MSIX_PBA) ) + return true; + + if ( VMSIX_ADDR_IN_RANGE(addr, msix->pdev->vpci, VPCI_MSIX_TABLE) ) + return false; + + for ( i =3D 0; i < ARRAY_SIZE(msix->tables); i++ ) + if ( VMSIX_ADDR_SAME_PAGE(addr, msix->pdev->vpci, i) ) + return true; + + return false; +} + +static int adjacent_read(const struct domain *d, const struct vpci_msix *m= six, + unsigned long addr, unsigned int len, + unsigned long *data) +{ + const void __iomem *mem; + struct vpci *vpci =3D msix->pdev->vpci; + unsigned int slot; + + *data =3D ~0ul; + + if ( !adjacent_handle(msix, addr + len - 1) ) + return X86EMUL_OKAY; + + if ( addr & (len - 1) ) { - struct vpci *vpci =3D msix->pdev->vpci; - unsigned int idx =3D addr - vmsix_table_addr(vpci, VPCI_MSIX_PBA); - const void __iomem *pba =3D get_pba(vpci); + unsigned int i; + + gprintk(XENLOG_DEBUG, "%pp: unaligned read to MSI-X related page\n= ", + &msix->pdev->sbdf); =20 /* - * Access to PBA. + * Split unaligned accesses into byte sized ones. Shouldn't happen= in + * the first place, but devices shouldn't have registers in the sa= me 4K + * page as the MSIX tables either. * - * TODO: note that this relies on having the PBA identity mapped t= o the - * guest address space. If this changes the address will need to be - * translated. + * It's unclear whether this could cause issues if a guest expects= a + * registers to be accessed atomically, it better use an aligned a= ccess + * if it has such expectations. */ - if ( !pba ) - { - gprintk(XENLOG_WARNING, - "%pp: unable to map MSI-X PBA, report all pending\n", - &msix->pdev->sbdf); - return X86EMUL_OKAY; - } =20 - switch ( len ) + for ( i =3D 0; i < len; i++ ) { - case 4: - *data =3D readl(pba + idx); - break; + unsigned long partial =3D ~0ul; + int rc =3D adjacent_read(d, msix, addr + i, 1, &partial); =20 - case 8: - *data =3D readq(pba + idx); - break; + if ( rc !=3D X86EMUL_OKAY ) + return rc; =20 - default: - ASSERT_UNREACHABLE(); - break; + *data &=3D ~(0xfful << (i * 8)); + *data |=3D ((uint8_t)partial) << (i * 8); } =20 return X86EMUL_OKAY; } =20 + slot =3D get_slot(vpci, addr); + if ( slot >=3D ARRAY_SIZE(msix->table) ) + return X86EMUL_OKAY; + + mem =3D get_table(vpci, slot); + if ( !mem ) + { + gprintk(XENLOG_WARNING, + "%pp: unable to map MSI-X page, returning all bits set\n", + &msix->pdev->sbdf); + return X86EMUL_OKAY; + } + + switch ( len ) + { + case 1: + *data =3D readb(mem + PAGE_OFFSET(addr)); + break; + + case 2: + *data =3D readw(mem + PAGE_OFFSET(addr)); + break; + + case 4: + *data =3D readl(mem + PAGE_OFFSET(addr)); + break; + + case 8: + *data =3D readq(mem + PAGE_OFFSET(addr)); + break; + + default: + ASSERT_UNREACHABLE(); + } + + return X86EMUL_OKAY; +} + +static int cf_check msix_read( + struct vcpu *v, unsigned long addr, unsigned int len, unsigned long *d= ata) +{ + const struct domain *d =3D v->domain; + struct vpci_msix *msix =3D msix_find(d, addr); + const struct vpci_msix_entry *entry; + struct vpci *vpci; + unsigned int offset; + + *data =3D ~0ul; + + if ( !msix ) + return X86EMUL_RETRY; + + if ( adjacent_handle(msix, addr) ) + return adjacent_read(d, msix, addr, len, data); + + vpci =3D msix->pdev->vpci; + if ( !access_allowed(msix->pdev, addr, len) ) + return X86EMUL_OKAY; + spin_lock(&msix->pdev->vpci->lock); entry =3D get_entry(msix, addr); offset =3D addr & (PCI_MSIX_ENTRY_SIZE - 1); @@ -303,57 +416,103 @@ static int cf_check msix_read( return X86EMUL_OKAY; } =20 -static int cf_check msix_write( - struct vcpu *v, unsigned long addr, unsigned int len, unsigned long da= ta) +static int adjacent_write(const struct domain *d, const struct vpci_msix *= msix, + unsigned long addr, unsigned int len, + unsigned long data) { - const struct domain *d =3D v->domain; - struct vpci_msix *msix =3D msix_find(d, addr); - struct vpci_msix_entry *entry; - unsigned int offset; + void __iomem *mem; + struct vpci *vpci =3D msix->pdev->vpci; + unsigned int slot; =20 - if ( !msix ) - return X86EMUL_RETRY; + if ( !adjacent_handle(msix, addr + len - 1) ) + return X86EMUL_OKAY; =20 - if ( !access_allowed(msix->pdev, addr, len) ) + /* + * Only check start and end of the access because the size of the PBA = is + * assumed to be equal or bigger (8 bytes) than the length of any acce= ss + * handled here. + */ + if ( (VMSIX_ADDR_IN_RANGE(addr, vpci, VPCI_MSIX_PBA) || + VMSIX_ADDR_IN_RANGE(addr + len - 1, vpci, VPCI_MSIX_PBA)) && + !is_hardware_domain(d) ) + /* Ignore writes to PBA for DomUs, it's undefined behavior. */ return X86EMUL_OKAY; =20 - if ( VMSIX_ADDR_IN_RANGE(addr, msix->pdev->vpci, VPCI_MSIX_PBA) ) + if ( addr & (len - 1) ) { - struct vpci *vpci =3D msix->pdev->vpci; - unsigned int idx =3D addr - vmsix_table_addr(vpci, VPCI_MSIX_PBA); - const void __iomem *pba =3D get_pba(vpci); + unsigned int i; =20 - if ( !is_hardware_domain(d) ) - /* Ignore writes to PBA for DomUs, it's behavior is undefined.= */ - return X86EMUL_OKAY; + gprintk(XENLOG_DEBUG, "%pp: unaligned write to MSI-X related page\= n", + &msix->pdev->sbdf); =20 - if ( !pba ) + for ( i =3D 0; i < len; i++ ) { - /* Unable to map the PBA, ignore write. */ - gprintk(XENLOG_WARNING, - "%pp: unable to map MSI-X PBA, write ignored\n", - &msix->pdev->sbdf); - return X86EMUL_OKAY; - } + int rc =3D adjacent_write(d, msix, addr + i, 1, data >> (i * 8= )); =20 - switch ( len ) - { - case 4: - writel(data, pba + idx); - break; + if ( rc !=3D X86EMUL_OKAY ) + return rc; + } =20 - case 8: - writeq(data, pba + idx); - break; + return X86EMUL_OKAY; + } =20 - default: - ASSERT_UNREACHABLE(); - break; - } + slot =3D get_slot(vpci, addr); + if ( slot >=3D ARRAY_SIZE(msix->table) ) + return X86EMUL_OKAY; =20 + mem =3D get_table(vpci, slot); + if ( !mem ) + { + gprintk(XENLOG_WARNING, + "%pp: unable to map MSI-X page, dropping write\n", + &msix->pdev->sbdf); return X86EMUL_OKAY; } =20 + switch ( len ) + { + case 1: + writeb(data, mem + PAGE_OFFSET(addr)); + break; + + case 2: + writew(data, mem + PAGE_OFFSET(addr)); + break; + + case 4: + writel(data, mem + PAGE_OFFSET(addr)); + break; + + case 8: + writeq(data, mem + PAGE_OFFSET(addr)); + break; + + default: + ASSERT_UNREACHABLE(); + } + + return X86EMUL_OKAY; +} + +static int cf_check msix_write( + struct vcpu *v, unsigned long addr, unsigned int len, unsigned long da= ta) +{ + const struct domain *d =3D v->domain; + struct vpci_msix *msix =3D msix_find(d, addr); + struct vpci_msix_entry *entry; + struct vpci *vpci; + unsigned int offset; + + if ( !msix ) + return X86EMUL_RETRY; + + if ( adjacent_handle(msix, addr) ) + return adjacent_write(d, msix, addr, len, data); + + vpci =3D msix->pdev->vpci; + if ( !access_allowed(msix->pdev, addr, len) ) + return X86EMUL_OKAY; + spin_lock(&msix->pdev->vpci->lock); entry =3D get_entry(msix, addr); offset =3D addr & (PCI_MSIX_ENTRY_SIZE - 1); diff --git a/xen/drivers/vpci/vpci.c b/xen/drivers/vpci/vpci.c index 6d48d496bb..652807a4a4 100644 --- a/xen/drivers/vpci/vpci.c +++ b/xen/drivers/vpci/vpci.c @@ -54,9 +54,12 @@ void vpci_remove_device(struct pci_dev *pdev) spin_unlock(&pdev->vpci->lock); if ( pdev->vpci->msix ) { + unsigned int i; + list_del(&pdev->vpci->msix->next); - if ( pdev->vpci->msix->pba ) - iounmap(pdev->vpci->msix->pba); + for ( i =3D 0; i < ARRAY_SIZE(pdev->vpci->msix->table); i++ ) + if ( pdev->vpci->msix->table[i] ) + iounmap(pdev->vpci->msix->table[i]); } xfree(pdev->vpci->msix); xfree(pdev->vpci->msi); diff --git a/xen/include/xen/vpci.h b/xen/include/xen/vpci.h index d8acfeba8a..0b8a2a3c74 100644 --- a/xen/include/xen/vpci.h +++ b/xen/include/xen/vpci.h @@ -133,8 +133,12 @@ struct vpci { bool enabled : 1; /* Masked? */ bool masked : 1; - /* PBA map */ - void __iomem *pba; + /* Partial table map. */ +#define VPCI_MSIX_TBL_HEAD 0 +#define VPCI_MSIX_TBL_TAIL 1 +#define VPCI_MSIX_PBA_HEAD 2 +#define VPCI_MSIX_PBA_TAIL 3 + void __iomem *table[4]; /* Entries. */ struct vpci_msix_entry { uint64_t addr; --=20 2.39.0