From patchwork Fri Feb 25 15:39:55 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: 12760496 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 42E60C433EF for ; Fri, 25 Feb 2022 15:40:29 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.279468.477185 (Exim 4.92) (envelope-from ) id 1nNche-0007Yu-5R; Fri, 25 Feb 2022 15:40:18 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 279468.477185; Fri, 25 Feb 2022 15:40:18 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nNche-0007Yn-1l; Fri, 25 Feb 2022 15:40:18 +0000 Received: by outflank-mailman (input) for mailman id 279468; Fri, 25 Feb 2022 15:40:16 +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 1nNchc-0005ID-JM for xen-devel@lists.xenproject.org; Fri, 25 Feb 2022 15:40:16 +0000 Received: from esa3.hc3370-68.iphmx.com (esa3.hc3370-68.iphmx.com [216.71.145.155]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 391bd44e-9651-11ec-8539-5f4723681683; Fri, 25 Feb 2022 16:40:15 +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: 391bd44e-9651-11ec-8539-5f4723681683 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1645803615; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=8CnV1YFo7Tb5Y161XjRmYx5MERlsmjdyjjYLhh+ReR8=; b=W2gANz99Pq1EQMyZHvwrg+fqJZx4GoEDkLrcQ7g2ycW3xStfSbfFol2H 46usqkvRJu659J5tjs843Nb8JS5EvL8TOKXBGQYZ7cgTYxsL0KxJUsSg7 Wzx1eVVEJx3o8Y6WZ3vTxD0UuDd/CNSPANpnju8oQNhbA7o0EQZwgqf9x s=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com X-SBRS: 5.1 X-MesageID: 65000615 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:Olo6a6Igte+8JZNxFE+R2pUlxSXFcZb7ZxGr2PjKsXjdYENShDFTz WFKWGrVMveOYGSme9t2aNu2/BgHsMTXxtJjQQJlqX01Q3x08seUXt7xwmUcns+xwm8vaGo9s q3yv/GZdJhcokf0/0vrav67xZVF/fngqoDUUYYoAQgsA148IMsdoUg7wbRh2NQ12YLR7z6l4 rseneWOYDdJ5BYsWo4kw/rrRMRH5amaVJsw5zTSVNgT1LPsvyB94KE3fMldG0DQUIhMdtNWc s6YpF2PEsE1yD92Yj+tuu6TnkTn2dc+NyDW4pZdc/DKbhSvOkXee0v0XRYRQR4/ttmHozx+4 MxQiI2ibS0xApDngu4geUd9OSZeB5QTrdcrIVDn2SCS50jPcn+qyPRyFkAme4Yf/46bA0kXq 6ZecmpUKEne2aTmm9pXScE17ignBNPsM44F/Glp0BnSDOo8QICFSKLPjTNd9Glt3pgWQ6+DD yYfQSdKVQzCQxFxBmgOS5w6vsiF3liuKAQN/Tp5ooJoujOOn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ha0m6P5VYym+8aiHJSFaEEbqVKkIAZ9ERJVL8dASPB7pw9Gu UGNrCS2B9vSyLbU5nlhBgt/DT1NU5DXCtuA3Jy9vB96gIm3UyQlCAjtYkidnRpzuNLd3AL3Z WBDk1SrsA9ciYnV9MPOA4/e7rDNoW0e2O2DIuzGyWvKEhVAQOEl3bIiI9FkN1CPqZ4i6cPpA == X-IronPort-AV: E=Sophos;i="5.90,136,1643691600"; d="scan'208";a="65000615" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jeReTPUdOael0apFxFejlRkY4U3ONSJp1KAgTpV3S1LL4deGgIzdNzPM4cjM3j1X+xSsYCklBCwudF8vUVeW1KfCff8UcneTnCt9l8kdHSf/qMHRxFDASw/knFpxYc9e+zkysmzBwYLxFtRvNQSoR3C1CDohPJY2f0rgveKokS9yWYJ8d8FXKGLK9OzXXp7AvRfNntDk+QtzrErUuRtVjeSDXy23ON5tAORPc5/HLmqtL3fFf59XwDPFBLITY1Xv/razPSg8a14AcbGUqZxU8D4ZIUHp1xqwU9GIE3FBEcozaIArVIEvul6xspmdJLLWyZlFtgAgIhpJaGI5wJKHbg== 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=6xQx3p2gIUoOaj3d39MS75urWwINz7VNe9IUM3IGjb4=; b=GfnsmJ7mXOiBfypO4BPJ/ujEsTqW2eefbBeM3we05cJRFcsqzKAIgDB3b4cb9I/a7JlEtPyyUM5BPextIeEbzXq+o56eFYsgJHcrdzamXVmu6nzZArpZbc6yRPNe/J0HWKWaS3AEcxUuVyGwzTc8cO0VuRgDFGCV3ojJKeER7VoOgiz6Zya8uR3gqMf3LRA7wDpkiipKexgonb+AQKgxmy/a/ayipUGURki0kuw8o42s4eQkYy3dNhJZcD1cpYEzDwRuHONc7U0bYLaMxfuvrNj9rIKacVMs71UKmgeDMA0f4HW+F142GfG3g5nbq1tUikoT6RuhWFruCbzDHndKNw== 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=6xQx3p2gIUoOaj3d39MS75urWwINz7VNe9IUM3IGjb4=; b=GidsEg8DFSXjBL1Tol9f9BWi1b8hc5h8ZT8exLV7/5Cf+etkDxAlgOL4yCehOrox0sLjhSfRNJFmbQZfsdfD+KQbBdYVeVTlVAWzFERrc/gF9ZyX96VR5xEhrokdLERiRXxvur+p4xa+fW/Icw/TxPl66y7r0tRmbnx5e5HwhpA= From: Roger Pau Monne To: CC: Alex Olson , Roger Pau Monne Subject: [PATCH v2 1/2] vpci/msix: reduce indentation in msix_write PBA handling Date: Fri, 25 Feb 2022 16:39:55 +0100 Message-ID: <20220225153956.1078-2-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: LO4P123CA0324.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:197::23) 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: 019e133d-9591-4d66-7409-08d9f8751a94 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: S47bMAshBVi46FtOzdks/NOl01WwW67ADrmZD5p7cKYx2HDGU1nfSc/5EhC1+NA+Ak36baT7sGKyeFySNLUCurOk0iTgj68+zgaUYRvxWhjK5urDkjQhk236kr8m3tre8fsJ/sg+/lIGPR4ULC7/7u014f35g6RYpE1Eu7kqWYyw40SExhCbFKIi+aYHDUVZ7gjiHhCHFFwWZjs8SuQ9xRclJAMz9N2Hpn4De+puIf0yM75l476QeUKX0a3/Bo6NOzVqV0l27E/0ycQAuqfO24kffl86BJoLhJDMf1epcTRf5mZ4oDVZuZqSpi9F3yTEvAH5I8gVnkP71n2up2UXK1YDs2qH7cfUzG/R/4poBEBUDcHr0yHQUz2L9HY1nsTktJ/qa8WEaHCD120emdDnLVDaIkHdbZqa6QGasNmUWN+hh2Qy4RK/mP24NZaZOpA03el+I3nFEN53ANXG8+wLNU29GiaBNz0St3cbuP4w4JqPXpslvkP5uvPPil5FHqKJpJCRLQkwhl8bI0imUnsiGeuLDw7HtYDtgIq8SUQ0liLptdWwr2i0kZ5VmxhCnAUTmBZkFC0edZanrL4/fV1YSeY1e/Hm7Yw963xkPGqKb/IreQfdY3MFKShHEA19q6wXCqf/szbfVKqNAa6eTB/ZGg== 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)(107886003)(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?rApIIJ1HMt2agcyhrE7/1z4/4KHk?= =?utf-8?q?oB4Jl9ORkiIwDrZP7w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azZk+yRg7bKycTftHZj+dVAL+kOVn8+GVSs0pSYaGgtHHdr?= =?utf-8?q?dsb1pWqlKy4qqLWrRVCgIlzsMgnHmAVyaQZSKzDj83GRNEZWLcGVarDrS4cxVFSfP?= =?utf-8?q?57Z2PuQvqAOxIjuyqXDEj02lhIu/XNYAaAz3lTmkuWCRe9bD+RIULNi8l6ejFPIjb?= =?utf-8?q?2yYnxRazgeyIqE5rBuaKLlMb2SoHV/8pUh51vNj9SPlAGAbWyQa2r9/72/O56u2a3?= =?utf-8?q?C0j2ChaG7qkUemxUuVIFzZoD6jBtb8y8AfXQopDS5iFetTRs3aDfVvh52kmdgJAvw?= =?utf-8?q?h69T0RY8/IUQuZHIAu2DHB2URDCYiYeZOXat5EAHUGGqBOvVHxF26EeJfH+bO51A/?= =?utf-8?q?XInS2G5F00b+okt/p1bZDDFIj39w0rt7cvC7QDhIRU9R3lYYXES0tRYt9tdtKkuge?= =?utf-8?q?buhweCFIufvah7Gzrhs5jkaSxnm0ilQxJyynH+uvepasKOTx93Q9VS53HUY5ZNmos?= =?utf-8?q?JzrpdDmGMB0YBbqPOAA9MF58YQ2mGh07xvsrvDwM+Tsk70B9JJeWOq/ToSeFqXa1w?= =?utf-8?q?j9L9E12DUXtFyyjlH4fB40P0G8iSWGXhei2k4N7Fy2gxY00tVcdsVstVECNha05ZR?= =?utf-8?q?ZxD6V/3bzQjY8gDsNcEucNP1KFND+8C69RQqnJbfl3VnyCS3zyGSFzk=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 019e133d-9591-4d66-7409-08d9f8751a94 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:09.2009 (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: h3/FX7Q4cgDwcv4otIBIBF6NVElerJVn7GaIDjzqhYSEAZmlo+dY9SR6DPpHH9GJjj/HgLKLGlH0w25Uaz7Cjg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR03MB3982 X-OriginatorOrg: citrix.com No functional change. Signed-off-by: Roger Pau Monné Acked-by: Jan Beulich --- xen/drivers/vpci/msix.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/xen/drivers/vpci/msix.c b/xen/drivers/vpci/msix.c index 2ab4079412..a1fa7a5f13 100644 --- a/xen/drivers/vpci/msix.c +++ b/xen/drivers/vpci/msix.c @@ -275,23 +275,24 @@ static int cf_check msix_write( if ( VMSIX_ADDR_IN_RANGE(addr, msix->pdev->vpci, VPCI_MSIX_PBA) ) { - /* Ignore writes to PBA for DomUs, it's behavior is undefined. */ - if ( is_hardware_domain(d) ) + + if ( !is_hardware_domain(d) ) + /* Ignore writes to PBA for DomUs, it's behavior is undefined. */ + return X86EMUL_OKAY; + + switch ( len ) { - switch ( len ) - { - case 4: - writel(data, addr); - break; + case 4: + writel(data, addr); + break; - case 8: - writeq(data, addr); - break; + case 8: + writeq(data, addr); + break; - default: - ASSERT_UNREACHABLE(); - break; - } + default: + ASSERT_UNREACHABLE(); + break; } return X86EMUL_OKAY; 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 8wxcBVpXgz6O15zHko7V54ujdeH3UChbGgNwL6SjfVuuDWCpOBr65DvOtfIft2BRe1Og12V4 GnB+gzRHhEbL5qe0nyMqna3gennkibyWYZUH7q9ntZ6jVvWymENBRk+UVqgveL/mkO4Q8hYK UEf5mwpt6dayaCwZoCjBVvi+ifC50NCHYoLewEn1O2T4rfx3TqlHVMmdH1IadIMkcomSzUMh 2bcyrsFGgdTmLGSTHuc8JKdojWzJTUZIAc+WMMUcecWy4K9+d9u13ojWv4mSffo1YOtRVkc1 hjX9HBWulkFsSIcO0xXF3jjiinkmJXGRxVdCu7/DjP8tVMRiGJIiuWVBbnnARRocNfxorqp5 iFsdy2iAAYmV8DleMulGrhlIV1Rz6zZWAAweHY2d3Xbyxyj+mS4Yadb6yxkKUFiP64sIGG1P RCP4F8MvMcLZBNGiJObharrWqzGKoC6SLzYug38NIISMvCdiifdlM2RWaJg9z+0yxV9+U3OE ZyabdytHR4n5VdPl1KLqxMm+eZznEgWnDqLLbiilkjP+efONRa9FOZeWHPTP79R0U9xiFiMm zqpH5DRkEs3vSyXSnS/zLP/2nhRdSlrXc2t8pcPHgNBSyI/cFwc5zbq6epJU6RunrhPl/eO+ Xe4W0RCz0H4i2GBIgKPAk2Popu1NXqjhRrX5RARAGs= IronPort-HdrOrdr: A9a23:pjBg+a8doP2Nw4QSlyluk+E6db1zdoMgy1knxilNoENuHfBwxv rDoB1E73LJYVYqOU3Jmbi7Sc29qBTnhOJICOgqTMqftWzd1ldAQ7sSi7cKrweQeREWs9Qtrp uIEJIOeeEYb2IK9PoSiTPQe71LoKjlzEnrv5al854Ed3AVV0gK1XYfNu/0KDwSeOEQbqBJa6 Z0q/A37waISDAyVICWF3MFV+/Mq5nik4/nWwcPA1oC5BOVhT2lxbbmG1zAty1uGQ9n8PMHyy zoggb57qKsv7WSzQLd7Xba69BzlMH6wtVOKcSQgow+KynqiCyveIN9Mofy9wwdkaWK0hIHgd PMqxAvM4Ba7G7QRHi8pV/X1wzpwF8Vmgjf4G7dpUGmjd3yRTo8BcYEr5leaAHl500pu8w5+L 5X3kqC3qAnQi/orWDY3ZzlRhtqnk27rT4JiugIlUFSVoMYdft4sZEfxkVIC50NdRiKpLzPKN 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?q?DNc+CejyE568YUC8QiUPgelXRaDTo4JxP71qMIgL/BPUlvzZxWeWfmDUmpWiuok2j?= =?utf-8?q?K3mP9ksO0Um/HHWFVUEnC1XWJAWQ7lQblH4v0a33ElL7vqJLxERwZixbVcLg5/7i8?= =?utf-8?q?N7cOCkeZ3+gWG0x+L+6lPOtTiwgDMbzG3z0hza4EvqnEw7OiY2CD8o/zD77BZHFKE?= =?utf-8?q?LzRRMuFD9bnGeERbwlmPy0Pde35Tz/PoXzkOlnILXWCY0Pz6IxKOUQPWhMhNM8/hQ?= =?utf-8?q?2FgHQ/9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apu7ySna0XdFm3f6Ie4TsHfmy4CZGwVK5rG1WB8dla7Byo4EKcs0?= =?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;