From patchwork Fri Feb 25 15:39:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 12760497 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 32B7BC433F5 for ; Fri, 25 Feb 2022 15:40:35 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.279469.477197 (Exim 4.92) (envelope-from ) id 1nNchi-0007sq-Hc; Fri, 25 Feb 2022 15:40:22 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 279469.477197; Fri, 25 Feb 2022 15:40:22 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nNchi-0007sR-AT; Fri, 25 Feb 2022 15:40:22 +0000 Received: by outflank-mailman (input) for mailman id 279469; Fri, 25 Feb 2022 15:40:20 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nNchg-0005ID-5Q for xen-devel@lists.xenproject.org; Fri, 25 Feb 2022 15:40:20 +0000 Received: from esa2.hc3370-68.iphmx.com (esa2.hc3370-68.iphmx.com [216.71.145.153]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 3b7dea83-9651-11ec-8539-5f4723681683; Fri, 25 Feb 2022 16:40:19 +0100 (CET) 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: 3b7dea83-9651-11ec-8539-5f4723681683 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1645803618; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=PKNPsUAVRvnP0bndWK3m9763yhv4YFhHq5tw/1e77Uw=; b=LE0klMiuiM0cxmffbjhfr0/IKogmaichF5Bhd97yEDDKNFWxMkjQxTeA yJNtqqM1zENPiXOEwUwB9CnBxgRT3jBp+5YuAW7WdG3wiZOOTdHel/L8F 33H1dwW25plkOcTHJgYxiZFgspybm5R35209K9iK+B68VfPW0NeVLUAdz o=; Authentication-Results: esa2.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com X-SBRS: 5.1 X-MesageID: 65002456 X-Ironport-Server: esa2.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:iLo4PqPVS7KXPh/vrR2Bl8FynXyQoLVcMsEvi/4bfWQNrUp00GRWy GFKXGGCaaqLMWv2e9x1bo3i8ksFu5WHy9BjSAto+SlhQUwRpJueD7x1DKtR0wB+jCHnZBg6h ynLQoCYdKjYdleF+lH1dOKJQUBUjclkfJKlYAL/En03FFcMpBsJ00o5wbZj2NMw27BVPivW0 T/Mi5yHULOa82Yc3lI8s8pvfzs24ZweEBtB1rAPTagjUG32zhH5P7pGTU2FFFPqQ5E8IwKPb 72rIIdVXI/u10xF5tuNyt4Xe6CRK1LYFVDmZnF+A8BOjvXez8CbP2lS2Pc0MC9qZzu1c99Z1 fBziaCrciUTfaTNls44VglWGgcvBPgTkFPHCSDXXc27ykTHdz3nwul0DVFwNoodkgp1KTgQr 7pCcmlLN03dwbLtqF64YrAEasALNs7kMZlZonh95TrYEewnUdbIRKCiCdpwgmpo3poSQKi2i 8wxcBVpXgz6O15zHko7V54ujdeH3UChbGgNwL6SjfVuuDWCpOBr65DvOt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WDY3ZzlRhtqnk27rT4JiugIlUFSVoMYdft4sZEfxkVIC50NdRiKpLzPKN MeTf002cwmMW9zNxvizypSKZ2XLzkO9y69MwY/Upf/6UkVoJh7p3FosPD30E1wsa7VcKM0lN gsAp4Y5I2mcfVmH56VfN1xOfdfKla9Ny4kY1jiaGgOKsk8SgfwQtjMkfEI2N0= X-IronPort-AV: E=Sophos;i="5.90,136,1643691600"; d="scan'208";a="65002456" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lwcSFqdMIJhPibQL3kKzcBIiWcSyFaZbsukoEYGlWaUp9c0+k5xE34SvUJwqshuqgb8o5CppxWbKBCZfxmc3QxaEYFqSLflGFWCbT+G+DaLE0rYCdLOpXXFcFVjwqYqL/2pCxeuXPFHvkWv+2gd/jFzXLQVYjRiYbE9Miz+pd2PQ3dQJ6UfSpYHXTX0L8cOk+08JXKdbQ+Zc6BSyqntH7bK/boCqpIACoxPf/gKH3B5jv8FXFITEgLs5JWkXqj796ZT/Zdg35BEL2nJLViCD6Lw8nOBkyLrCRwhpPaWd+OtdnTqOB1uN01/BfLUXYurNdUDifiK0iBuK3wqQ2uJlLA== 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=NQfSCOTOAbixao4uPBP8gOpZAnH8IT6a2fwSzdK0eqA=; b=itGqQrbV0vRP+wppWeoQ4NH2DrfYbptbjFdF4XF4lYSBm00O9FyhZdNqjOFrfT8aTovP1A1AsLkKFcxwyGPu1tD8TMmVbXPGHss4bS1714pzhaSMa5HYQiihnJqEsoRFhy1ZwR62xqyGrDcqLl7TT4nUY8BtKnHiiMjAPx8issFXcUr2RUtT9pzO324EMJEFTSwCN1XInRNV59NL51WZRtMqy7hNNZ6vsHF2UmnrHPIh8h2QFFPvqH1sQz0hmN31q85dIYixWMqqgJS8zxhel/AEtLuwoaKnclE2w0NpfQMliIH4+wOUeVX01OEHZq8Tk2SAFGt92HkDLhezVz4O6A== 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=NQfSCOTOAbixao4uPBP8gOpZAnH8IT6a2fwSzdK0eqA=; b=S6DqQWhnAmORM976B9ASfaW+nMf7T2ewscm+xpRHmukanZz/4rXAe6yemSfmxeYCCvLOQpce98UsrYrkxD4aH8gaPRPHABvmr6v0yBAGm5z8O207rZ/F4mpD0wlD7/MsAIMGzM2eo5ufNdE22I7SFFw/ryfGs2nyrst1lBe6RzA= From: Roger Pau Monne To: CC: Alex Olson , Roger Pau Monne , Jan Beulich Subject: [PATCH v2 2/2] vpci/msix: fix PBA accesses Date: Fri, 25 Feb 2022 16:39:56 +0100 Message-ID: <20220225153956.1078-3-roger.pau@citrix.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220225153956.1078-1-roger.pau@citrix.com> References: <20220225153956.1078-1-roger.pau@citrix.com> X-ClientProxiedBy: LO4P123CA0131.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:193::10) To DS7PR03MB5608.namprd03.prod.outlook.com (2603:10b6:5:2c9::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8f0a5903-821e-46e2-66ee-08d9f8751dc4 X-MS-TrafficTypeDiagnostic: SN6PR03MB3982:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Wbt13kLn8Fwcd0NK4EL8ek8xPH0MHAhU04pR0ay1DStH9FyNX1A2fGCCnT/YwWylAF8h1Ka/WsJKfbqsud9WHLWQmmpQyZkflCBLY67iKTRIykvB50CUjrNIyxO5FV4qcsbON60DPAlg54+gNOG0DYF3rX25Hwh9/wGAhbqKC+rVCSj+6SUJkXz9KlSlJ3kHFDst+yOK/ZaNPNw3oEfypM8e8iz97EKlSJ0wkg36iSbTMxvxuKSniYKAt0ITxxK82PsRubG5/g15BbGBxd85AU97xnI8GA8zYzI96zZMGF+SsgYVidNhJtY4Qy1TYyHzIwsivNgjzAfeD1IsFMv0MYKgTRU1Cx/D98veHLwwBAHbmsa8ASgOzzM5GUWXZUV5IVsZE27Qf/pDH9NLN/MEAgPRHJeloR/JZ4iiW8fIRq3D7TpNk07LTIsoMvQNzc6m9Vqwg4iQFcRMFbzU3DR9t75G27fA8SxLKTEj5J8bT1ZBjeYQrxBXt4YhGg5oWmHYzNq0gP56/SPzvDexZpHzVvdJ+wXdT6eukNX2+4+SLaX/ZZRHF406F+p62/c/+wJRsQuOYhGQffDsCKtqpWebi0L3Tk+n3aCxdcUIDaA6AyN4otgL9yIuAHhC1Le5lo+HIcAjZQtLHtDaaa/EbV59PA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR03MB5608.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(38100700002)(1076003)(82960400001)(6916009)(83380400001)(6666004)(54906003)(86362001)(2906002)(26005)(8936002)(186003)(36756003)(316002)(6486002)(66476007)(66556008)(5660300002)(508600001)(2616005)(8676002)(6506007)(66946007)(4326008)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?KbQqbX4qJ+Pz3bGmFVy0KnFWphSv?= =?utf-8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ygjS0ZY3Kh5d1puGgGsQzmh5z5us2eucEAXCVz5Iz/cFLkBtcAFJo5HKeLVyhHv?= =?utf-8?q?kP52zOh3AJwnNXnbLT+M7BUtfT74OARmHu4IJRZD+c/r6AeQlPQcOsrdpNPmzCgZX?= =?utf-8?q?zAAQUIvA+VSHAlBk5VndXoKaLaBLStf7k5SFhzrnaPPciOKycYeReHu+ewU4kFDcc?= =?utf-8?q?rLMPwiajEvluFq6sRhusXS7xoJ2hkVgKoKOXy8j5D9ZfW4bIJ2NuB2RELcam45t4Y?= =?utf-8?q?HTcs1CUzLbNq6apu7ySna0XdFm3f6Ie4TsHfmy4CZGwVK5rG1WB8dla7Byo4EKcs0?= =?utf-8?q?Wl0y83iKRldNdv/3V1SCxJaEGIvlBlAesGsHJVichhDO83eeDIrws/C+oDqEoqFoo?= =?utf-8?q?4TeqiR787VaCyf7QlHWJMnquI9Y8z0k9Q0E2J4v77y0hcfYUr0ltDumI5h9IZaZo0?= =?utf-8?q?Qv7LnxkMWIiZvk/Up0U4nVFSkmHc7nuJ0FKF038R335JJqUQIsIkMYN7RXc77VAvo?= =?utf-8?q?K4vOD+H2nmNCLxUVDYs+YyUPT7zVxEN6qWlPTqhSV/VluY8jngw+aclYmGVsJtOba?= =?utf-8?q?0FJcyEuLVYkUwtmOy/OI/Pp4pQ3n0KGjuwAPsrnvBI33DjOg+irej05r2TnIXV3KB?= =?utf-8?q?TOuAQg+4WnRlYsx8yaWDZ/Tic+R9AyVchI2pmLaJN4Gjy8G4njuKai4=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 8f0a5903-821e-46e2-66ee-08d9f8751dc4 X-MS-Exchange-CrossTenant-AuthSource: DS7PR03MB5608.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Feb 2022 15:40:14.5002 (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: hFxBudelBJC3FU9hBW/E82GLXa5kjgP2QlxAIoja7rDGvZADcHof/qVQK9bASV7vN+DmmYGU70HmahFdAVJYhQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR03MB3982 X-OriginatorOrg: citrix.com Map the PBA in order to access it from the MSI-X read and write handlers. Note that previously the handlers would pass the physical host address into the {read,write}{l,q} handlers, which is wrong as those expect a linear address. Map the PBA using ioremap when the first access is performed. Note that 32bit arches might want to abstract the call to ioremap into a vPCI arch handler, so they can use a fixmap range to map the PBA. Reported-by: Jan Beulich Signed-off-by: Roger Pau Monné --- Cc: Alex Olson --- Changes since v1: - Also handle writes. I don't seem to have a box with a driver that will try to access the PBA, so I would consider this specific code path only build tested. At least it doesn't seem to regress the current state of vPCI. --- xen/drivers/vpci/msix.c | 55 +++++++++++++++++++++++++++++++++++++---- xen/drivers/vpci/vpci.c | 2 ++ xen/include/xen/vpci.h | 2 ++ 3 files changed, 54 insertions(+), 5 deletions(-) diff --git a/xen/drivers/vpci/msix.c b/xen/drivers/vpci/msix.c index a1fa7a5f13..9fbc111ecc 100644 --- a/xen/drivers/vpci/msix.c +++ b/xen/drivers/vpci/msix.c @@ -198,8 +198,13 @@ static int cf_check msix_read( if ( !access_allowed(msix->pdev, addr, len) ) return X86EMUL_OKAY; + spin_lock(&msix->pdev->vpci->lock); if ( VMSIX_ADDR_IN_RANGE(addr, msix->pdev->vpci, VPCI_MSIX_PBA) ) { + struct vpci *vpci = msix->pdev->vpci; + paddr_t base = vmsix_table_addr(vpci, VPCI_MSIX_PBA); + unsigned int idx = addr - base; + /* * Access to PBA. * @@ -207,25 +212,43 @@ static int cf_check msix_read( * guest address space. If this changes the address will need to be * translated. */ + + if ( !msix->pba ) + { + msix->pba = ioremap(base, vmsix_table_size(vpci, VPCI_MSIX_PBA)); + if ( !msix->pba ) + { + /* + * If unable to map the PBA return all 1s (all pending): it's + * likely better to trigger spurious events than drop them. + */ + spin_unlock(&vpci->lock); + gprintk(XENLOG_WARNING, + "%pp: unable to map MSI-X PBA, report all pending\n", + msix->pdev); + return X86EMUL_OKAY; + } + } + switch ( len ) { case 4: - *data = readl(addr); + *data = readl(msix->pba + idx); break; case 8: - *data = readq(addr); + *data = readq(msix->pba + idx); break; default: ASSERT_UNREACHABLE(); break; } + spin_unlock(&vpci->lock); return X86EMUL_OKAY; } - spin_lock(&msix->pdev->vpci->lock); entry = get_entry(msix, addr); offset = addr & (PCI_MSIX_ENTRY_SIZE - 1); @@ -273,27 +296,49 @@ static int cf_check msix_write( if ( !access_allowed(msix->pdev, addr, len) ) return X86EMUL_OKAY; + spin_lock(&msix->pdev->vpci->lock); if ( VMSIX_ADDR_IN_RANGE(addr, msix->pdev->vpci, VPCI_MSIX_PBA) ) { + struct vpci *vpci = msix->pdev->vpci; + paddr_t base = vmsix_table_addr(vpci, VPCI_MSIX_PBA); + unsigned int idx = addr - base; if ( !is_hardware_domain(d) ) + { /* Ignore writes to PBA for DomUs, it's behavior is undefined. */ + spin_unlock(&vpci->lock); return X86EMUL_OKAY; + } + + if ( !msix->pba ) + { + msix->pba = ioremap(base, vmsix_table_size(vpci, VPCI_MSIX_PBA)); + if ( !msix->pba ) + { + /* Unable to map the PBA, ignore write. */ + spin_unlock(&vpci->lock); + gprintk(XENLOG_WARNING, + "%pp: unable to map MSI-X PBA, write ignored\n", + msix->pdev); + return X86EMUL_OKAY; + } + } switch ( len ) { case 4: - writel(data, addr); + writel(data, msix->pba + idx); break; case 8: - writeq(data, addr); + writeq(data, msix->pba + idx); break; default: ASSERT_UNREACHABLE(); break; } + spin_unlock(&vpci->lock); return X86EMUL_OKAY; } diff --git a/xen/drivers/vpci/vpci.c b/xen/drivers/vpci/vpci.c index f3b32d66cb..9fb3c05b2b 100644 --- a/xen/drivers/vpci/vpci.c +++ b/xen/drivers/vpci/vpci.c @@ -51,6 +51,8 @@ void vpci_remove_device(struct pci_dev *pdev) xfree(r); } spin_unlock(&pdev->vpci->lock); + if ( pdev->vpci->msix && pdev->vpci->msix->pba ) + iounmap(pdev->vpci->msix->pba); xfree(pdev->vpci->msix); xfree(pdev->vpci->msi); xfree(pdev->vpci); diff --git a/xen/include/xen/vpci.h b/xen/include/xen/vpci.h index bcad1516ae..c399b101ee 100644 --- a/xen/include/xen/vpci.h +++ b/xen/include/xen/vpci.h @@ -127,6 +127,8 @@ struct vpci { bool enabled : 1; /* Masked? */ bool masked : 1; + /* PBA map */ + void *pba; /* Entries. */ struct vpci_msix_entry { uint64_t addr;