From nobody Fri Dec 27 01:42:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1502710635221722.8944897931233; Mon, 14 Aug 2017 04:37:15 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id C96E221D1825B; Mon, 14 Aug 2017 04:34:46 -0700 (PDT) Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0046.outbound.protection.outlook.com [104.47.40.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 8C5FA21D18237 for ; Mon, 14 Aug 2017 04:34:45 -0700 (PDT) Received: from brijesh-build-machine.amd.com (165.204.77.1) by BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1341.21; Mon, 14 Aug 2017 11:37:05 +0000 X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=QQhnnK9XNnufPRwWViBOeMljEzaPwe/H5VhuIjrWrMI=; b=4rsU2ZRp2rY8AiBZP9uuDRcINXddErPIg5bHAZ/l7RRUIhTMaQdXOtCM21FoiTl8z8OsEGcs8c0xysMSIdufUzcQOVjgm2QAlHHCxD9dZlqId+Y6xJeM9XrkhA2mt/eINKH1edyu38H5ypm5vO6iwsgjzh4IK9qSLH49lNZL5z4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; From: Brijesh Singh To: edk2-devel@lists.01.org Date: Mon, 14 Aug 2017 07:36:23 -0400 Message-Id: <1502710605-8058-2-git-send-email-brijesh.singh@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> References: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: MWHPR15CA0043.namprd15.prod.outlook.com (10.173.226.157) To BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 32243f22-7e8c-457e-326a-08d4e308ca71 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BY2PR12MB0145; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 3:V4TKlvmUR71HROVbww6aWNc+xyJ50H5omCsa5JxfqkbHLOxrRWVcwqz0mRpd4mVhYTPnmt8OZE4mGM8osD8yKgbJMpS1pz2+UiNhtAF0KRKtMDdV/FKNLD3iw4XIzNk3MZvbkhP+I+R7YiSRYQ5YO5RoBRN6ThfZZ9eqMgxmUgJ2AR4lt6ts9uV3tNoEATxCCyujTMiVF4zO/6NuPCW0zI95iFIMGC1Bl2LtIo7xmpOXKXeaMQEIBZ4v7tNFvMVq; 25:K5d2t4gNCNM8dYExY8nWB7FK1zTRtDlGhEvvLxrTbmaYa8Ys2oLhQU9npPWafNxWjWI6uQABbYCSUa6NOjE20GWrB0GJw9gshQZ1pQUC9h5K2BztIG7vqEu08v2wVNqGLMirX/1HX6DBkvQ2x0KlOS9O6E2QujcgUG6/Cuin9kHelI6Lg3ZaxVANbC7ZyeuXBDj76C/02E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vBEzIHYmYe2IjYGgGjcXLIQSn+GlHrB74zCpRwNXAVjfwRZVUjo9w/fFZjFPGvvyf2bHPY/Vi3Vb9jboAZ6B4OVopH6qFTNzX3xJ9DSh5BQZHfn+eAtEwOhu3eURk8Xzy1VrwBj0mNBhEhrr2ZmYywfPJmDP2gUaddwz+vD6ldUKYsl261HFxkUcEgaYQv7DFX91fJ1ZE+ngZ5q5GpQs0Wugf8b8LH5OM5W80pxb1YQFw== X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(228905959029699); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(3002001)(6055026)(6041248)(20161123558100)(20161123560025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BY2PR12MB0145; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BY2PR12MB0145; X-Forefront-PRVS: 039975700A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(7370300001)(4630300001)(6009001)(39860400002)(199003)(189002)(54906002)(5003940100001)(6116002)(3846002)(53936002)(97736004)(86362001)(36756003)(81156014)(81166006)(110136004)(8676002)(189998001)(50986999)(76176999)(5660300001)(2361001)(25786009)(2351001)(50226002)(4326008)(7350300001)(33646002)(478600001)(53416004)(42186005)(2906002)(105586002)(7736002)(305945005)(106356001)(48376002)(50466002)(47776003)(66066001)(6486002)(6916009)(2950100002)(6666003)(68736007)(101416001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR12MB0145; H:brijesh-build-machine.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR12MB0145; 23:Yvj+gExv5XJe5AetWPYbI/FWhkXZe2ou5UHsOVbMq?= =?us-ascii?Q?1Psc/zn5iIzfTY5ydRw9VNcch/6lzdvm5121ptyUCw3JfR85DHfZ2Bvd27ku?= =?us-ascii?Q?3y/F+gk+H4am3RiWDeG+oWzyG3PkK+71YhW7mo5bAtZXdjToHBcMKg67g+yW?= =?us-ascii?Q?97qqqBWsSKbQh7+k1QNVTzT93JDYJc6FUzoQ+pX8Fyehz7tzvYju0BxfBr4s?= =?us-ascii?Q?c3NIvfcnh/X+FUAkIppEguqXi+2MJrS7xYCJsC96C/rLDsmXOZ/kaLMbJdGj?= =?us-ascii?Q?HMj6y9I6Bh7pVykXnjnXo2ij7DLLTkrOOufHFf3PtJ+cOXsV9Gbp12jLs2lr?= =?us-ascii?Q?/ujgn7fHeMpM5OpDTIWtp1qSrj3Q8M12M9X6tsNdw5U/Di3FIgJVYtoMBXsE?= =?us-ascii?Q?aw9cgKuIRlP0rbi2DqDtFmut3wdlTDjXjrBonsU723RsnvIWB0V+IUITplVF?= =?us-ascii?Q?Rn14DQoFfznP0r6/qzmJRDFhigaJDJjEivMGg217g17qvULeYH/BPwO0Vls5?= =?us-ascii?Q?7cbyVRNFB5PfF+xo87H64IDVijaqkaOzd+lu7ID0Q3nxxbqnKoDMI6PQrmsT?= =?us-ascii?Q?XQVjISPXpyy4T/Pi8/mpqDYZL3bjjjgZ1NswgJMlZVjkhXKVS5yqHS+kt/z4?= =?us-ascii?Q?o5uZ7qHNFgwL5HFLQOLsNFACYfYgARwEWEijnTwzmXeewV/h7GAqrTE1C7MK?= =?us-ascii?Q?9F4WphgEk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H3IAXLiy5fVroukiONwSUjcfOKnwJto4uhr7w4U39+PW8XOv9L/p4YdAN5SxiUcMGg3KIR30WoxBd6fox6otjXqRJj75s2n5gQ=; 7:G6IrzYV7Y72NssrOo34UQBSP5tFdqZe28c5fW/eYr/+8Xe+s5Mtg3Vpu8E8s2lOQTSu2Y1f0szuuimShgDNy/ZqyGdIb43pEVyxmwnQMAicUkN/lCRuSzj7HFNzIWDIuwl2cZvmxi1sZUOk9udm/tJ6PrKS8lYpU9f4i2BP6GNumeKBK5ESMcq/Pz5Z7WFN8lwv43jxMm01hfKwSkHbarFnL1ZXuYq4+HWilwUQyJ+c= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 20:1EEadsy9niyPnbF5okNQtneso2BGacDTBeYIKMgyVNJyW8J314PCLaOHPrgLxd6Asm/D8U8l3p9tjrvzgiMhzBP9HKxdUWxAa7elOe6u6vYS47IvMV2quOO9IzGu89hTunDWFDDriekmVoA2YZKCzpSq4AC0B3zNUVSvZiB2JgNYY2E/AWn6zto7iZCH20EZ/zQBTNRezMqvJ7z6/uiYQKf7HYhg2/BlBZfzBQV9m6s+4mJFsRD9BxAb1wmNJ0TK X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2017 11:37:05.5492 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0145 Subject: [edk2] [PATCH v2 01/23] OvmfPkg/VirtioPciDeviceDxe: supply missing BUS_MASTER attribute X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen , Tom Lendacky , Laszlo Ersek , Ard Biesheuvel Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Suggested-by: Laszlo Ersek Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Tom Lendacky Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Brijesh Singh Reviewed-by: Laszlo Ersek --- OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.c b/OvmfPkg/VirtioP= ciDeviceDxe/VirtioPciDevice.c index bc4f6fe8bfa3..e41730456471 100644 --- a/OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.c +++ b/OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.c @@ -460,7 +460,9 @@ VirtioPciDeviceBindingStart ( =20 Status =3D Device->PciIo->Attributes (Device->PciIo, EfiPciIoAttributeOperationEnable, - EFI_PCI_IO_ATTRIBUTE_IO, NULL); + (EFI_PCI_IO_ATTRIBUTE_IO | + EFI_PCI_IO_ATTRIBUTE_BUS_MASTER), + NULL); if (EFI_ERROR (Status)) { goto ClosePciIo; } --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Fri Dec 27 01:42:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1502710632630508.2773143348278; Mon, 14 Aug 2017 04:37:12 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 8C29F21D18256; Mon, 14 Aug 2017 04:34:46 -0700 (PDT) Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0046.outbound.protection.outlook.com [104.47.40.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 6F3D421D18236 for ; Mon, 14 Aug 2017 04:34:45 -0700 (PDT) Received: from brijesh-build-machine.amd.com (165.204.77.1) by BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1341.21; Mon, 14 Aug 2017 11:37:06 +0000 X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=kcPIYEngvZJFEUSaVUD5fhoI1tbo5NvJxAoy7KmnpQk=; b=JKOtUXVnjlwPMtHYQ0aoIXinPmmyz4A+eQXrHGie3b6+XbWBB9U922i3JPwZ8/eQtdC3QdWEwU0x7WdMwKV9yzjFUCEw/Tz+nvOuZYeY19CQayPDOx/HfkPtvCznjU+zTnY8uzhDq98IFLLK0cca1qfygmCP6i7WuV/Pq3xnVME= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; From: Brijesh Singh To: edk2-devel@lists.01.org Date: Mon, 14 Aug 2017 07:36:24 -0400 Message-Id: <1502710605-8058-3-git-send-email-brijesh.singh@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> References: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: MWHPR15CA0043.namprd15.prod.outlook.com (10.173.226.157) To BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c2a9d2f7-2464-46be-8dd3-08d4e308cb0e X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BY2PR12MB0145; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 3:q7+ZVA7QojkROA4N7D+iCGCsNBISRvDZQb5HjJCbvNqrxFESq7bLLrDcpIyfpVUrmYvPsgBdFDr1j7c6FhiD+2CDSI2zMecFitXkfN3/saqUEeZXVgG4ZfTh2blCbXHFkl1Rn0hrdIxO9Ba8hIHl1qV/SHVuQgjK0F4lyZjssz0Hq+0ayvOet89qm2hYFnt1qkU24uJwnmfXTQMNE4PWpPZ3yZ8K7dLzTfS/Gemp+G6JtsqwGbnOf5WzKZlGicZ+; 25:qxVOR3OIOy03txAaUr+VQKn5UUy3ysGfZgRiZ3bPUq46KgK3f7Qj6P4/6bJCnLKpQYzXrWUXmN0DuAPYSKpD8NqCXPEvUdkrWB2XJesr+xSZqzdFlzNhAYDKC/TxaCMLRDDW4AOE4hx1x9m1enTRiAPJ3CSRsXWK81YB1JINNcL5+GzbxcK3XjVcrH/sxME1aHCZGwO1qDOcMkhLpDuUubKRIuStZ1OhO+G32N4BWNRgB2/apSb/EaPHJDNDvvtUaYz4htPQHQo3AW1aEG2uX+uvmg3aVb7xHIdzyaG2/nDNWsZOD3Zkm7yOIGjgucN6Z7b4U+lWNxfixlYgeAdqgQ==; 31:huZnkxLRhxt72R6I2tCG+BsUxKViMQ3IWuzBIJCyIkWTvuUUcDTHzaG8iV3ruQWvosFLKfayjIVkhbdjfGFQw6EpjguCOn1fpkJwe3FUZHwUsJHbkogRPuzvWMNeg1BUeT5x5uhqeV7NuvbXeHZItWTsApQOASE9nCiPKYSLuejFUtoGl0SpkgMTJ6cgmLrZu/9w5/WdMzuGfNRq8n5vyCUdr4e3TedP11665PyeC4s= X-MS-TrafficTypeDiagnostic: BY2PR12MB0145: X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 20:3e3DwdEFCMumdcn3qiWjWzEbt3Xz2uz1dISxxes5BYtrCM1Wd62hLhRVF6C1atmwmPhTiuEN5v++pwjPLPXzlHWByJ5uWW1iF4FoPnl0yWJw3H0a33eTt1U6uF+I7imI3N/GbOf2EqpHFFVvtzwIto1mQOSmCyFsXwPt90Ga7QtuK0P8fscVFbqEypOhzfKLOzh/9MaEtU6nnR/MBrkAfHXAk8PGGcmP2o8tUOEK0sHDy9OHQ7jKREhooUCi/l+cEfHH3f8mH4FbH9Znus3o1hxBs3YxbVSlmjcCT9qSvOpPQf8UhDDe7gF1fgViO29SW0YDhf6O5hB1aOsF09GSvEra+HlBV/V99lwyG+HzBnRGA9nhANHM24CyZs7DD5NHrq88SE5L8aRKG/Zy5UpaW4uTkY5+LaYTiLgrQPNtGxiPI9243cCwHfGT4WAxcCuiZQ6F373pUYY8MAeSn3fEgu9GNfQ3Vr+w7u3YtWoah2CpZjDALH2pt2zhK/kcBdfs; 4:TIat+mLPda+nnvVQc3qklpAhgLXOM0V1a+LqXVqHXdavW6Ms/SWoSHBSjgvh9NcarAhjT7rVwjiUQN1KQMzPbJTFvdQXZVXBfbQtSvHrEGpwq33Z5/w6TTX+XIqjKrH5WO2G5hpFW2mwTaAgYHgoNULlD4wS1c08fsfnD5Uxl0VaR2b8rcK7jyyIONR8QggCVF4t4dZhzipgjV8Pm+YyL1Tn94KZbfeQ6o9ZhItcxCKz+2Jj6RnNkEogN8GskSl1UzsqeOSG//25m6rSX1vKNu5SGUNlPMKBjH2rv8BObkeNavf5A6pSenJH+TKMq+1HehW797QICQlgoWyrhx8wRg== X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(228905959029699); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(3002001)(6055026)(6041248)(20161123558100)(20161123560025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BY2PR12MB0145; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BY2PR12MB0145; X-Forefront-PRVS: 039975700A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(7370300001)(4630300001)(6009001)(39860400002)(199003)(189002)(54906002)(5003940100001)(6116002)(3846002)(53936002)(97736004)(86362001)(36756003)(81156014)(81166006)(110136004)(8676002)(189998001)(50986999)(76176999)(5660300001)(2361001)(25786009)(2351001)(50226002)(4326008)(7350300001)(33646002)(478600001)(53416004)(42186005)(2906002)(105586002)(7736002)(305945005)(106356001)(48376002)(50466002)(47776003)(66066001)(6486002)(6916009)(2950100002)(6666003)(68736007)(101416001)(19627235001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR12MB0145; H:brijesh-build-machine.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR12MB0145; 23:l/vGE6PjJ9hWy2nQrc+yq/Rj8pbhfP8Xe/Whvvq27?= =?us-ascii?Q?eb37LFQjKi2UsA3TOtsaUwa8emRWn76L9Hg2enHpZhld0cmsDpLCtMaT5W4g?= =?us-ascii?Q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Q8wm/6l0GgXK4h0mpu+xnKH3tbHslqHoX6xdCzJWED8ABuRIMofKJi+rGE9sc5fBlVphYAF6kAyg/EE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 20:90GGz67zFgJniEZ0HqVMRHlk4Ui+2TgoIgHmn8oNsSE1daA2kc2vExpilRo6PCG0bphz/L+PqW6FLXFwq1oz252JerSao5sii2rcoSR578eh+fJ4LrUGFGke5IDbH8TVizpBagdOytNxRuQcA7ZhgbnKVt5EfOl2IEbMg4ZpSo6B4Fz3Cto/VF1PY6702t5E2v0URzFu5GwaCRC5MWymn00VlwhLMKf7LebmFXo/F1c5knCgR3vJiy7w4cOaXbqu X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2017 11:37:06.6117 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0145 Subject: [edk2] [PATCH v2 02/23] OvmfPkg/Virtio10Dxe: supply missing BUS_MASTER attribute X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen , Tom Lendacky , Laszlo Ersek , Ard Biesheuvel Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Suggested-by: Laszlo Ersek Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Tom Lendacky Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Brijesh Singh Reviewed-by: Laszlo Ersek --- OvmfPkg/Virtio10Dxe/Virtio10.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OvmfPkg/Virtio10Dxe/Virtio10.c b/OvmfPkg/Virtio10Dxe/Virtio10.c index a8a6a58c3f1d..43dcfd7cb2a4 100644 --- a/OvmfPkg/Virtio10Dxe/Virtio10.c +++ b/OvmfPkg/Virtio10Dxe/Virtio10.c @@ -906,7 +906,7 @@ Virtio10BindingStart ( goto ClosePciIo; } =20 - SetAttributes =3D 0; + SetAttributes =3D EFI_PCI_IO_ATTRIBUTE_BUS_MASTER; UpdateAttributes (&Device->CommonConfig, &SetAttributes); UpdateAttributes (&Device->NotifyConfig, &SetAttributes); UpdateAttributes (&Device->SpecificConfig, &SetAttributes); --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Fri Dec 27 01:42:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1502710649329813.8909911669869; Mon, 14 Aug 2017 04:37:29 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id D72962095E008; Mon, 14 Aug 2017 04:34:52 -0700 (PDT) Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0063.outbound.protection.outlook.com [104.47.40.63]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 0397721D1825F for ; Mon, 14 Aug 2017 04:34:49 -0700 (PDT) Received: from brijesh-build-machine.amd.com (165.204.77.1) by BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1341.21; Mon, 14 Aug 2017 11:37:07 +0000 X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=s3MeDPfRf2sRR7SuJHyJ+cWnIA2antP2O2KW6/C2Tzk=; b=nDgARn6JdvFE0qEIGOJ8cihFMNiP/C3MywrZBgOPVVzg6b3QIKRHaQKiZ5R+tkrQYYk4LMbHAB+NI37UtIG4LaoDHB1D/55pYnx9ozrTepyWLZkDp+7bRSbHMztOb/NMmqnftp7Xq0lEWyy1u92qyNPMKYFF7pwVlMvu2/YAc4k= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; From: Brijesh Singh To: edk2-devel@lists.01.org Date: Mon, 14 Aug 2017 07:36:25 -0400 Message-Id: <1502710605-8058-4-git-send-email-brijesh.singh@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> References: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: MWHPR15CA0043.namprd15.prod.outlook.com (10.173.226.157) To BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e9f2d5a9-b637-491a-ac98-08d4e308cbcf X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BY2PR12MB0145; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 3:I0wOQtGIncBYCCl+UOUz9JTZSJiRdbEnAu9h4GMw6jZGMPRYghootI4DSYIlL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dkbDHnb7cnaWcFHITe6njmRn5AKX5HEr2EE1uafr2i/gRE8ixmpdI+cPhIzeiQ80+paa/7taAQ8QrZzBJHNvmQv50SaW5Zqf92fnlmrZ7wUm7IBhnaq+38N9vCYFeAjSXA04Z7jqfyAzjCXmzinq0mLTQDGa6pohALNkMxeeqHg2Fsip0A9a4KyXAgVqvR0wXz31QWl3n+SEcgplRE5lv9ssfG6Mjian8jtBPD9+UT+GvGXNEWS882RQ7tJJcqzxqwo1mJF8lcA+fo8qdXDvlfWW; 4:pY2szpOb2guW89qt/26qC23kVCylFglHegE99KJFNp4z2OrXS1ZsliqMGyUfOHKdc5YHXrIwvAqkXLCfsXslswamwPtZMkqtyvE0OBmvfqY6wCzYpPAfL8gD6BDoeYUiTIxXSsV2FkIPBIkL4NukLboCPKYjLBEr4p3BDaa86KSKZeB6Q6lmf0FkZW7BgxvxpbPmi44CbSOz2Vg2NuAtPxeJ/vaqAQcbLugpVrmH08A6zjgFRmu9GqO5bF6hEBldxLhQ07aNglPJolXjXTC+oGwjjdtqKNRbGE0HGsMePCc70rfgH7YyDSEnk9wsk7L7LoE5YB1XrO5dL0c04u41Zw== X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(228905959029699); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(3002001)(6055026)(6041248)(20161123558100)(20161123560025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BY2PR12MB0145; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BY2PR12MB0145; X-Forefront-PRVS: 039975700A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(7370300001)(4630300001)(6009001)(39860400002)(199003)(189002)(54906002)(5003940100001)(6116002)(3846002)(53936002)(97736004)(575784001)(86362001)(36756003)(81156014)(81166006)(110136004)(8676002)(189998001)(50986999)(76176999)(5660300001)(2361001)(25786009)(2351001)(50226002)(4326008)(7350300001)(33646002)(478600001)(53416004)(42186005)(2906002)(105586002)(7736002)(305945005)(106356001)(48376002)(50466002)(47776003)(66066001)(6486002)(6916009)(2950100002)(6666003)(68736007)(101416001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR12MB0145; H:brijesh-build-machine.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR12MB0145; 23:l2VDlHO1AcYOZ/BYc903laUsXAW5K8BQIUI9mksBq?= =?us-ascii?Q?N71tuLs9GlfgdCTwi8iMUZZ6DQKGcJfQ5flQblsHytwq4uOJFq2VP+GhyGbs?= =?us-ascii?Q?KYIKWibN34ZeyqEfe1wVaWeO6arAWbEmOH0GRFX0R2SguV14slayAX2FTujP?= =?us-ascii?Q?kvZ9Z0Pf3+DxDDYr35dGdHOvUd4aRH7HKex2UCjgMGzXdDjoiQhj9EhvivlN?= =?us-ascii?Q?9ioJ5bhzooXIuM7MlhATZfYOOqCNgSdDFdIuaxcZ3y2B2rdyE/L6ehXleoAR?= =?us-ascii?Q?cjWE7jL8kGvBbcmTA+May9scARfqF5hoAL2wE3Ycw/sQWs9royak4I3HQeYf?= =?us-ascii?Q?wrFe0ssir565qgxZsT+aSeTLbxr9zJo3PpFBOb5I9tY/enaOqJZ4KR4wreFA?= =?us-ascii?Q?VrDb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Clz8dw4He2WpsoLdVnMlsK/CZVamEIcKNFunCbZSJmZicoQL8D9iiNW1 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2017 11:37:07.8617 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0145 Subject: [edk2] [PATCH v2 03/23] OvmfPkg/VirtioPciDeviceDxe: add missing IN and OUT decoration X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen , Tom Lendacky , Laszlo Ersek , Ard Biesheuvel Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Tom Lendacky Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Brijesh Singh Reviewed-by: Laszlo Ersek --- OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.h | 24 ++++++++++---------- OvmfPkg/VirtioPciDeviceDxe/VirtioPciFunctions.c | 24 ++++++++++---------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.h b/OvmfPkg/VirtioP= ciDeviceDxe/VirtioPciDevice.h index 8f17a16c88f5..6f51f816ef0f 100644 --- a/OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.h +++ b/OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.h @@ -96,15 +96,15 @@ VirtioPciGetQueueSize ( EFI_STATUS EFIAPI VirtioPciSetQueueAlignment ( - VIRTIO_DEVICE_PROTOCOL *This, - UINT32 Alignment + IN VIRTIO_DEVICE_PROTOCOL *This, + IN UINT32 Alignment ); =20 EFI_STATUS EFIAPI VirtioPciSetPageSize ( - VIRTIO_DEVICE_PROTOCOL *This, - UINT32 PageSize + IN VIRTIO_DEVICE_PROTOCOL *This, + IN UINT32 PageSize ); =20 EFI_STATUS @@ -131,29 +131,29 @@ VirtioPciSetQueueAddress ( EFI_STATUS EFIAPI VirtioPciSetQueueSel ( - VIRTIO_DEVICE_PROTOCOL *This, - UINT16 Sel + IN VIRTIO_DEVICE_PROTOCOL *This, + IN UINT16 Sel ); =20 EFI_STATUS EFIAPI VirtioPciSetQueueNotify ( - VIRTIO_DEVICE_PROTOCOL *This, - UINT16 Index + IN VIRTIO_DEVICE_PROTOCOL *This, + IN UINT16 Index ); =20 EFI_STATUS EFIAPI VirtioPciSetQueueSize ( - VIRTIO_DEVICE_PROTOCOL *This, - UINT16 Size + IN VIRTIO_DEVICE_PROTOCOL *This, + IN UINT16 Size ); =20 EFI_STATUS EFIAPI VirtioPciSetDeviceStatus ( - VIRTIO_DEVICE_PROTOCOL *This, - UINT8 DeviceStatus + IN VIRTIO_DEVICE_PROTOCOL *This, + IN UINT8 DeviceStatus ); =20 #endif // _VIRTIO_PCI_DEVICE_DXE_H_ diff --git a/OvmfPkg/VirtioPciDeviceDxe/VirtioPciFunctions.c b/OvmfPkg/Virt= ioPciDeviceDxe/VirtioPciFunctions.c index 243aa14c2421..5f86914265ea 100644 --- a/OvmfPkg/VirtioPciDeviceDxe/VirtioPciFunctions.c +++ b/OvmfPkg/VirtioPciDeviceDxe/VirtioPciFunctions.c @@ -196,8 +196,8 @@ VirtioPciSetQueueAddress ( EFI_STATUS EFIAPI VirtioPciSetQueueSel ( - VIRTIO_DEVICE_PROTOCOL *This, - UINT16 Sel + IN VIRTIO_DEVICE_PROTOCOL *This, + IN UINT16 Sel ) { VIRTIO_PCI_DEVICE *Dev; @@ -211,8 +211,8 @@ VirtioPciSetQueueSel ( EFI_STATUS EFIAPI VirtioPciSetQueueAlignment ( - VIRTIO_DEVICE_PROTOCOL *This, - UINT32 Alignment + IN VIRTIO_DEVICE_PROTOCOL *This, + IN UINT32 Alignment ) { return EFI_SUCCESS; @@ -221,8 +221,8 @@ VirtioPciSetQueueAlignment ( EFI_STATUS EFIAPI VirtioPciSetPageSize ( - VIRTIO_DEVICE_PROTOCOL *This, - UINT32 PageSize + IN VIRTIO_DEVICE_PROTOCOL *This, + IN UINT32 PageSize ) { return (PageSize =3D=3D EFI_PAGE_SIZE) ? EFI_SUCCESS : EFI_UNSUPPORTED; @@ -231,8 +231,8 @@ VirtioPciSetPageSize ( EFI_STATUS EFIAPI VirtioPciSetQueueNotify ( - VIRTIO_DEVICE_PROTOCOL *This, - UINT16 Index + IN VIRTIO_DEVICE_PROTOCOL *This, + IN UINT16 Index ) { VIRTIO_PCI_DEVICE *Dev; @@ -246,8 +246,8 @@ VirtioPciSetQueueNotify ( EFI_STATUS EFIAPI VirtioPciSetQueueSize ( - VIRTIO_DEVICE_PROTOCOL *This, - UINT16 Size + IN VIRTIO_DEVICE_PROTOCOL *This, + IN UINT16 Size ) { // @@ -260,8 +260,8 @@ VirtioPciSetQueueSize ( EFI_STATUS EFIAPI VirtioPciSetDeviceStatus ( - VIRTIO_DEVICE_PROTOCOL *This, - UINT8 DeviceStatus + IN VIRTIO_DEVICE_PROTOCOL *This, + IN UINT8 DeviceStatus ) { VIRTIO_PCI_DEVICE *Dev; --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Fri Dec 27 01:42:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1502710641673709.129777732269; Mon, 14 Aug 2017 04:37:21 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 55D1521C9127F; Mon, 14 Aug 2017 04:34:49 -0700 (PDT) Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0055.outbound.protection.outlook.com [104.47.40.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 0882621C9127F for ; Mon, 14 Aug 2017 04:34:47 -0700 (PDT) Received: from brijesh-build-machine.amd.com (165.204.77.1) by BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1341.21; Mon, 14 Aug 2017 11:37:08 +0000 X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=fg+owZSIvnHfYVHPr90V/j+BBF/LhWRopweATGd26ng=; b=uoc8iSdSm889JkGZ7igx3MxTyd7Qe1185gJzifOqXLAZAV0VOG8eD/UV5BIxmctGSOfNo5VoE2Eo6uXFLP6khNQntEX8ay7DB/OEOTImJlxT0rErVpgnqvrbiCbTTYsgsxUhUF7hBsh4sP7BtmyP/Izy+D6DkrpGVY9WYUzbzZg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; From: Brijesh Singh To: edk2-devel@lists.01.org Date: Mon, 14 Aug 2017 07:36:26 -0400 Message-Id: <1502710605-8058-5-git-send-email-brijesh.singh@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> References: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: MWHPR15CA0043.namprd15.prod.outlook.com (10.173.226.157) To BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b773b026-c490-4aa7-7ea1-08d4e308cc63 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BY2PR12MB0145; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 3:UKCDz0gnBvUL+5TUFrLvaY/DcB+c/3YNDx4JnF9atXLEx0gCuAuwpU3XZWEV0XfNLYgOW76VJUjCkC8JoQ03UG/vIlBZRN1a90fzZ5vQXc2U0CQch4wjMxn+VYWCtZwIn0BUXiR4Sw1NWPghYvhrbtQKCLuepZwoi8YGRmd3v9lelkFiXuy0DWzAxrQF1IYhSTaXoG5h5zp9D1aD4xEML1Gg6ObIJJXgdfVXhg7hsVfFDxBrAN7vM1xFHEKMaQFU; 25:aVXDWzjOBmshtSgSCqbf7WukL179RoptdItpHXsSOqXJytv+UHONHX02dannMcW48QRqVZhH0mg9IV36o03zEV0yimuX7hd6FRFesPwXCtX1u+2XEqeuMscjrMr3cFwhcvSH1sDmoiVp6K3sxgFtG/mz6HCt3PaPNgs71SNhIgOB2Od7sU/YKAy1MYexmXur8MtVBIADX/TDUMCpfMVYHt8VGWCQ7Mijdc5L3ZAN5nkyijF4l469mU4R0cPMaQ5SPKJt7T6ZQkwPtsxNm8YCSG+CI0OG/ekgoesL/0vmitz11WUWuaI3I9UrCXWlrEzqK7jAGCGFTw8HmWDd3rjn7g==; 31:0NyOe2rX9vkdE0T1H0AY/qE0ROoq4cwHrP0JByWGo+SNEGgZfs9omZVYCNXVfQ+fJih8vdq6RAB7s4wPfxFgvG2RE5w9Q3FaKQKVmvyEMWGXY5GhHrPDHGJp5/Js/+O4muTLbng9QWM1WZ6NqeDxGcmONgEQmNRhEnqkcArz70Ga/Dxb7r5xy+YscHzAUNuEvTlaSLW4Sbk78l70J2tIQRNMrM42yTs9+fYDRlum3WA= X-MS-TrafficTypeDiagnostic: BY2PR12MB0145: X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 20:M3nfKFHau/i3y6hv01ulxYl+fiZsrlcLCI99RStQ2zmKwl+0TTnLOzO1Hom0a4cUGb2BtJZ4D1grJ6+CHQFmxGhToandBAjLzh5VcecGlRqgqEKSBl1zN8wZ2dRJG//Wd6Shy+cXcbzSnlFgGy9qg9tuvE0BMmcD8jNHwrebRkM/iaZ2u0rdZ7HA5fjREuLis6WzuL2mUX7peqlZ380E+KZ53KPxj9Rh7uq2+lmV8oZPSx0bXzqJm7Eon2aieZaQwtJj/huU31OJysyIxT9+3RQnAptbsJZ2YPW2wxojW06LCqm78mJTLAPJfhSf4ZmFBpZOmLPdEWYFwWjmswH71cfmnDTjCj0Z/TbETeQe20nQ7mLx2Qt9v3ApCg7B7W5UjJC2j8ShTgwmaNUri3Ntwtvn39Lz3Sqs/3av4kJralrHFbnm6VgDVWsHbD0CUi24KNBJfNPkc85ig7NpfzrJZ7uxTsRYIby1rmYsYnfl+Whqb6oXD09/OUbDEsfyntxt; 4:C1DzZyI3Ng+fZf4oMWk58ZrNY1p4k2DCHKNoy0N9JbVaa2w/ORGvkcA4JrtzcgtUezxTzesIqq3hmHz8AIaRkEBqVnhxpoU22itTt2xE54F2hCYMp8oWdtUeItxn7d0z2/RhWrS/3cfveFvWUg+D2r8colJF3/vlaaU3ajpf0rrWSRX3P8czbcrT4ACxRj+Ao2whYW6jfB0l9L5DsaBYgIUkYzSvWcsAfnlF6257luyLvbNy4/THilmfXlMd2kPicOlekTuoterQefNBo0TB+GQluAzJdukughf+ZRjhFbAA9AexJ/s0SnWu5JbDQywuuJD+Y5V1UjmV2vOQp2e68w== X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(228905959029699); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(3002001)(6055026)(6041248)(20161123558100)(20161123560025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BY2PR12MB0145; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BY2PR12MB0145; X-Forefront-PRVS: 039975700A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(7370300001)(4630300001)(6009001)(39860400002)(199003)(189002)(54906002)(5003940100001)(6116002)(3846002)(53936002)(97736004)(86362001)(36756003)(81156014)(81166006)(110136004)(8676002)(189998001)(50986999)(76176999)(5660300001)(2361001)(25786009)(2351001)(50226002)(4326008)(7350300001)(33646002)(478600001)(53416004)(42186005)(2906002)(105586002)(7736002)(305945005)(106356001)(48376002)(50466002)(47776003)(66066001)(6486002)(6916009)(2950100002)(6666003)(68736007)(101416001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR12MB0145; H:brijesh-build-machine.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR12MB0145; 23:X1id8aVrQ3IRc080BD4Yg98R3Lj3uwqkO6RLl8+QZ?= =?us-ascii?Q?gMiRPaUTQFOkMnAKj4wdiST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xHKt9QHN2u2B4TPuk3QeIAaGgDK/JvDGL9m2/9y3Ryl8wsn88k= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 20:+etX+3M27B0yJ3v4desl+tn+E6SQz5MDEVE7cNrIxm2JSdMkJDZji+U9kPAK4E/A2dFb4tmkLaJ0uRs3fDx+JTmr0hLV8LHBTrZ6YYEb6Veoxssu6sG6MIi6DhULCI/T7U8vfnJ9sWFxDgbBM251qzYeJ6kOjoBZoIGjfa4rrlipq+JaRdlW6pL1/S63mCQW3rwBpb2PjTplvsKw4zeD+gCAM6bQoABvMyhe4O1uChpMs0LLZ/QC2mm53Rq57UgN X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2017 11:37:08.8461 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0145 Subject: [edk2] [PATCH v2 04/23] OvmfPkg/VirtioMmioDeviceLib: add missing IN and OUT decoration X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen , Tom Lendacky , Laszlo Ersek , Ard Biesheuvel Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Tom Lendacky Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Brijesh Singh Reviewed-by: Laszlo Ersek --- OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.h | 28 +++++= +++++---------- OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceFunctions.c | 28 +++++= +++++---------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.h b/OvmfP= kg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.h index 4130dbc043df..bedd635e1a86 100644 --- a/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.h +++ b/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.h @@ -85,29 +85,29 @@ VirtioMmioGetDeviceStatus ( EFI_STATUS EFIAPI VirtioMmioSetQueueSize ( - VIRTIO_DEVICE_PROTOCOL *This, - UINT16 QueueSize + IN VIRTIO_DEVICE_PROTOCOL *This, + IN UINT16 QueueSize ); =20 EFI_STATUS EFIAPI VirtioMmioSetDeviceStatus ( - VIRTIO_DEVICE_PROTOCOL *This, - UINT8 DeviceStatus + IN VIRTIO_DEVICE_PROTOCOL *This, + IN UINT8 DeviceStatus ); =20 EFI_STATUS EFIAPI VirtioMmioSetQueueNotify ( - VIRTIO_DEVICE_PROTOCOL *This, - UINT16 QueueNotify + IN VIRTIO_DEVICE_PROTOCOL *This, + IN UINT16 QueueNotify ); =20 EFI_STATUS EFIAPI VirtioMmioSetQueueSel ( - VIRTIO_DEVICE_PROTOCOL *This, - UINT16 Sel + IN VIRTIO_DEVICE_PROTOCOL *This, + IN UINT16 Sel ); =20 EFI_STATUS @@ -119,22 +119,22 @@ VirtioMmioSetQueueAddress ( EFI_STATUS EFIAPI VirtioMmioSetQueueAlignment ( - VIRTIO_DEVICE_PROTOCOL *This, - UINT32 Alignment + IN VIRTIO_DEVICE_PROTOCOL *This, + IN UINT32 Alignment ); =20 EFI_STATUS EFIAPI VirtioMmioSetPageSize ( - VIRTIO_DEVICE_PROTOCOL *This, - UINT32 PageSize + IN VIRTIO_DEVICE_PROTOCOL *This, + IN UINT32 PageSize ); =20 EFI_STATUS EFIAPI VirtioMmioSetGuestFeatures ( - VIRTIO_DEVICE_PROTOCOL *This, - UINT64 Features + IN VIRTIO_DEVICE_PROTOCOL *This, + IN UINT64 Features ); =20 #endif // _VIRTIO_MMIO_DEVICE_INTERNAL_H_ diff --git a/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceFunctions.= c b/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceFunctions.c index 53c734f6b1af..9142d4a162c0 100644 --- a/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceFunctions.c +++ b/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceFunctions.c @@ -81,8 +81,8 @@ VirtioMmioGetDeviceStatus ( EFI_STATUS EFIAPI VirtioMmioSetQueueSize ( - VIRTIO_DEVICE_PROTOCOL *This, - UINT16 QueueSize + IN VIRTIO_DEVICE_PROTOCOL *This, + IN UINT16 QueueSize ) { VIRTIO_MMIO_DEVICE *Device; @@ -97,8 +97,8 @@ VirtioMmioSetQueueSize ( EFI_STATUS EFIAPI VirtioMmioSetDeviceStatus ( - VIRTIO_DEVICE_PROTOCOL *This, - UINT8 DeviceStatus + IN VIRTIO_DEVICE_PROTOCOL *This, + IN UINT8 DeviceStatus ) { VIRTIO_MMIO_DEVICE *Device; @@ -113,8 +113,8 @@ VirtioMmioSetDeviceStatus ( EFI_STATUS EFIAPI VirtioMmioSetQueueNotify ( - VIRTIO_DEVICE_PROTOCOL *This, - UINT16 QueueNotify + IN VIRTIO_DEVICE_PROTOCOL *This, + IN UINT16 QueueNotify ) { VIRTIO_MMIO_DEVICE *Device; @@ -129,8 +129,8 @@ VirtioMmioSetQueueNotify ( EFI_STATUS EFIAPI VirtioMmioSetQueueAlignment ( - VIRTIO_DEVICE_PROTOCOL *This, - UINT32 Alignment + IN VIRTIO_DEVICE_PROTOCOL *This, + IN UINT32 Alignment ) { VIRTIO_MMIO_DEVICE *Device; @@ -145,8 +145,8 @@ VirtioMmioSetQueueAlignment ( EFI_STATUS EFIAPI VirtioMmioSetPageSize ( - VIRTIO_DEVICE_PROTOCOL *This, - UINT32 PageSize + IN VIRTIO_DEVICE_PROTOCOL *This, + IN UINT32 PageSize ) { VIRTIO_MMIO_DEVICE *Device; @@ -165,8 +165,8 @@ VirtioMmioSetPageSize ( EFI_STATUS EFIAPI VirtioMmioSetQueueSel ( - VIRTIO_DEVICE_PROTOCOL *This, - UINT16 Sel + IN VIRTIO_DEVICE_PROTOCOL *This, + IN UINT16 Sel ) { VIRTIO_MMIO_DEVICE *Device; @@ -197,8 +197,8 @@ VirtioMmioSetQueueAddress ( EFI_STATUS EFIAPI VirtioMmioSetGuestFeatures ( - VIRTIO_DEVICE_PROTOCOL *This, - UINT64 Features + IN VIRTIO_DEVICE_PROTOCOL *This, + IN UINT64 Features ) { VIRTIO_MMIO_DEVICE *Device; --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Fri Dec 27 01:42:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1502710645262686.2203829447465; Mon, 14 Aug 2017 04:37:25 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 94AFD2095E003; Mon, 14 Aug 2017 04:34:52 -0700 (PDT) Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0063.outbound.protection.outlook.com [104.47.40.63]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id DD3FD21D1825E for ; Mon, 14 Aug 2017 04:34:48 -0700 (PDT) Received: from brijesh-build-machine.amd.com (165.204.77.1) by BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1341.21; Mon, 14 Aug 2017 11:37:09 +0000 X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=LlPnCK4JYjMftdlAwBgWWA/U/IfuWDHqikOlzdayk80=; b=g6D97Fi8weVIBYzEROdnDNeoz3D5YJDqb/6DrbDSZBvKy0ywTC116+QBSMMnadLQN0BgYIaz1R8Ef1W1sHTrLPfd3JLXI+cbR8LA9x2ZmZ73izDa8j8nSofmcVlchLMPNqDymGym7j6s4kynru704A5b9ftNkcRc6I5oCgKR7sw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; From: Brijesh Singh To: edk2-devel@lists.01.org Date: Mon, 14 Aug 2017 07:36:27 -0400 Message-Id: <1502710605-8058-6-git-send-email-brijesh.singh@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> References: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: MWHPR15CA0043.namprd15.prod.outlook.com (10.173.226.157) To BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e2cb417b-b855-4fe4-50a4-08d4e308ccf7 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BY2PR12MB0145; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 3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AbZEh7G576RmTO2JsasV6Qc4qtgMkeTAUX/BoenZrfEyg+E/W1H1Csc/g9hTrBFMiE3wZdCOGnzeKWA/NPP/YFmRDwAZewAxqevM1wH4TVI3UfNOvcOGfHJo+RTsmZq/AmxSo4Ox/+f4EEde9vcAC+vnnzo3r+HwK538v9RJr5Uu/kaRUCwhN4T6HzHLS664Mge/EqVvv5czSlNnmyH3UqlgaKBzSwFCPPJjIGwOJ/atvXeMHpyqt8l01olpKEppmkRJyJZ/dRjPOFSt9vGEFK6Kb5LRJqz0o9dnx3uWlGOpOz9eKeMpMRUQE+qpncEnSvTzOZzAWLYj/mWYyOkLxLznn4ikFr; 4:HXLO8mm+9ijGKlRKplCrVNFFMniJguQ3hInvRzrXI7t4ndRZRv0PyZMmrocJ0AKUTIWnx9sAiZAdl8SP3gf8/yRfwFZumcdfqO/YOBN2E4Eyj4JSD4hQWy1T05IF1UI8N+8Ur7BMO3zcS8I43JT2ZMyLsgo4JZVKUcAb9UYE2AIwIx/cmWD/biEp6+dZY592I3sBe4IlTk26bebxF/28itPnwoLju3m6C8icRfbuXI1v3UzcQem89jVl2ALzuHQA8ruDyC++qRATAZosNd3zrM/Z743tQQ8F8uK1eUyyyoIN+iv7fjQHeCagiARdN+SS7W77n7Cksgc7Btg0nFfdfg== X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(228905959029699); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(3002001)(6055026)(6041248)(20161123558100)(20161123560025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BY2PR12MB0145; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BY2PR12MB0145; X-Forefront-PRVS: 039975700A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(7370300001)(4630300001)(6009001)(39860400002)(38564003)(199003)(189002)(54906002)(5003940100001)(6116002)(3846002)(53936002)(97736004)(86362001)(36756003)(81156014)(81166006)(110136004)(8676002)(189998001)(50986999)(76176999)(5660300001)(2361001)(25786009)(2351001)(50226002)(4326008)(7350300001)(33646002)(478600001)(53416004)(42186005)(2906002)(105586002)(7736002)(305945005)(106356001)(48376002)(50466002)(47776003)(66066001)(6486002)(6916009)(2950100002)(6666003)(68736007)(101416001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR12MB0145; H:brijesh-build-machine.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR12MB0145; 23:dRItmbY/XYItNv/2/FtFgodNSWiTpRe50WKCPEfcE?= =?us-ascii?Q?+sWbi35bikutz8rcDC4dLdbfyaxC40P37pX7goG8HMcoc5jYuTwrXrCDVrP/?= =?us-ascii?Q?DjASB9CzzKSt2of5pALrIhST+SGjkqU75vh5uJPGquj4AYYbnlSVpMJDRq2N?= =?us-ascii?Q?CDE9kYl1kFxDCnUPPhNcZ8i5ujUb/YpOQFkvh/MYNfiQD2GmdYhCInDXZPDG?= =?us-ascii?Q?EvF7vWBGFuMB42ddFV9ldCoPY83z12jc3S4iChrr1k9AiEl/sX5NQp8VT8/L?= =?us-ascii?Q?kTj68UUB2cOFjfIcp+Y5bfLsTFxm4MDPOrKDbJhmZR+Uh6r9B+35tc0GJ5EC?= =?us-ascii?Q?Jus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: 1; BY2PR12MB0145; 6:rCjPNA5LiItaJ5B5nF3AjO2HGeY863HQ1zHLB7kbGks6C8+o5OOpw6i3hG386SDEtc8/ahf4eag2xCYMVMonmf+JrhejHhKNb+PQmXMy1RWMiW/54uNaFM1287Qi/CvpfsVqx8UfA4/ovjLs9yG8Up1Obc+m81l+3GzPGO/ctw1V5GmSQPU3GnGxBhH4Hc5Kt388KEyWlWJiz+FlGUzskIXRG/VNsM2zOHjqh/UWdzQB0OA7hL6Tpu7PNYbs9OM4Hrh1qZUwgeSt4zvoM/TjFyMmlMCT5zMVvrTrYY3HJmrCpWnmrWFg5+aklrP3qxKN7brhvJddiDui2qOp4d961Q==; 5:honRfN2Aak43DBdoFuefI8RyH9gZz67pwhC9P1rd5MytmBTire29TTWDTj1yG/UsOBryh+SYyEQIuRErqpG0mvp5Lu2tURYte0/EaWm8TR6lTvEG7HnvGqBHBYMLmCMX5b6Bgt1pg6HqlPkDxS1j1Q==; 24:uJMOuUTswN5/liOfWdDvJKVQUeMjrcf9HmRxKLJPvzay9W7yis24V+XnPGlkBez+MK+hvxoYfjhMbtXuxRIMUeJsefCXTuPUasAdHtjMoSM=; 7:NjzgGEPhCf2ge2AuXvrvAzrF1FwQR5rdwPWGjUHJm+fqECkB6gJ12UUcZaOcYrUP1DhCVUozsuX68GUKwYVK76cWLm1HF80+hoXSsUUFUI2RW8TUMEZswOSaM8gWChPsMjj3M869bouqkqijVM9iP4au8fb0BmlNLrr052/zYaOb6CYL2XvhUXooyk32MgsVkNxtLpFEWvTcdOzTgnfch77uOqUrui7tXcwlTV57+e4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 20:vwY+4rjwnzI98WZBtoRKSEQerjx6QUASrN8zq48Z3DZgcXoJpx6UGIS/h190PU5NoDDOqGBrdBLyXdMwGtRDUAXId7LGd9kNveXmEC90Mgw+eVnWiQohUA1JpYUXOvXpqPS70ryQtoVyN+egPJgJtqgEQRPRmQT4sA1yaIDD5KuVyH1L0BsG/n47e0fcLIDpX0qACQBPjCpq4nAoFc4VjfKjgdv0JBFunmZjnPBCdNWyqC/9YzRfK4CmRg+HWYBN X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2017 11:37:09.7992 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0145 Subject: [edk2] [PATCH v2 05/23] OvmfPkg/Virtio: fix comment style X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen , Tom Lendacky , Laszlo Ersek , Ard Biesheuvel Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Tom Lendacky Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Brijesh Singh Reviewed-by: Laszlo Ersek --- OvmfPkg/Include/Protocol/VirtioDevice.h | 22 +++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/OvmfPkg/Include/Protocol/VirtioDevice.h b/OvmfPkg/Include/Prot= ocol/VirtioDevice.h index 910a4866e7ac..edb20c18822c 100644 --- a/OvmfPkg/Include/Protocol/VirtioDevice.h +++ b/OvmfPkg/Include/Protocol/VirtioDevice.h @@ -320,16 +320,22 @@ EFI_STATUS ); =20 =20 -/// -/// This protocol provides an abstraction over the VirtIo transport layer -/// -/// DISCLAIMER: this protocol is a work in progress, and should not be us= ed -/// outside of the EDK II tree. -/// +/** + + This protocol provides an abstraction over the VirtIo transport layer + + DISCLAIMER: this protocol is a work in progress, and should not be used + outside of the EDK II tree. +**/ + struct _VIRTIO_DEVICE_PROTOCOL { - /// VirtIo Specification Revision encoded with VIRTIO_SPEC_REVISION() + // + // VirtIo Specification Revision encoded with VIRTIO_SPEC_REVISION() + // UINT32 Revision; - /// From the Virtio Spec + // + // From the Virtio Spec + // INT32 SubSystemDeviceId; =20 VIRTIO_GET_DEVICE_FEATURES GetDeviceFeatures; --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Fri Dec 27 01:42:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1502710653219156.63292605943957; Mon, 14 Aug 2017 04:37:33 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 1CA1A21D0A244; Mon, 14 Aug 2017 04:34:53 -0700 (PDT) Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0085.outbound.protection.outlook.com [104.47.40.85]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7952921D0A242 for ; Mon, 14 Aug 2017 04:34:50 -0700 (PDT) Received: from brijesh-build-machine.amd.com (165.204.77.1) by BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1341.21; Mon, 14 Aug 2017 11:37:10 +0000 X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=OxthZJKK85zslsvijNEY9TAblgLjeHRmIKxU3uyg4cA=; b=VTERjGB5jFKdtr4/28gbdbmEBozc/tEaj5ALADZ2fBNp0jwglyQo07XyM+aCsu5aqwQ0etzYjNueFcxGglfyJJeZf+mj8k3anlre3UYYWDtPR8qdprVMZL/TXN7BvQ8gQNgjOv7jOVelO7Jv5sEmTK+I5qvL0LfKrAXG65oM+CY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; From: Brijesh Singh To: edk2-devel@lists.01.org Date: Mon, 14 Aug 2017 07:36:28 -0400 Message-Id: <1502710605-8058-7-git-send-email-brijesh.singh@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> References: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: MWHPR15CA0043.namprd15.prod.outlook.com (10.173.226.157) To BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e219579d-46c2-4e02-5c81-08d4e308cda5 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BY2PR12MB0145; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 3:AOyrnLWRFMNwF5om8/qxVI2qVlHbXX/bLLupmCmvOIbmy95lSOl6c0Vq9Hc3KhTkUWP+ZHRrozanpEGE0xbNTu2UoENlIc6c0onlolYyDopTKrQeA8Djy1sQ6aZ3jOzqHrGTwJozNO/DnBIWTJsIW9vJPFdvsZ3E/uQj8UQzCpmwiH/42fpgcqoUn42C+4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Tklp5My3f+j6PbzXdLaMqXQHMqSvEP3DAH1qwUK4bHw/I2jxNrVMMEMzV9GtfE700WInO+mDpyRVdWUMfM1hsVY6Gm/kzWkwS8p5dg+UHFSTLhX89NKTBOV0nVWg6XlGnx3BS/8xVL7kCP/EJNEtKr4wYAu; 4:XXj+ThP9MCqdPJVYZXvXgOwgWZZIqyQWIvTredv20Kp+oGicuuUwpOgnlLJ001Je8ZfrycLQgRKXwxnFzg5UDS0SgURV9us87AoLTeKOriBDqiJUpKdf7Em3VcbCqHewnsUSx+9lE4Ao16BDaFlBg05npDOMahJdEIEMewY9o2PMN9Qit1Z4S2G0syj+fOUznauwe8ks/cVxW8uy6UKR72u6M1CZGCFVoCiGkhmNUGFhRnOO7A500y5R6xtXVFkWOptaL654A9jtq7yfS00Joq4mGIfdI2zmomlAH1GQj3mPHtSHi6zIacZqFMC9Zl+VBuUQhGliGluglyxwClmv5A== X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(228905959029699); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(3002001)(6055026)(6041248)(20161123558100)(20161123560025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BY2PR12MB0145; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BY2PR12MB0145; X-Forefront-PRVS: 039975700A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(7370300001)(4630300001)(6009001)(39860400002)(199003)(189002)(54906002)(5003940100001)(6116002)(3846002)(53936002)(97736004)(575784001)(86362001)(36756003)(81156014)(81166006)(110136004)(8676002)(189998001)(50986999)(76176999)(5660300001)(2361001)(25786009)(2351001)(50226002)(4326008)(7350300001)(33646002)(478600001)(53416004)(42186005)(2906002)(105586002)(7736002)(305945005)(106356001)(48376002)(50466002)(47776003)(66066001)(6486002)(6916009)(2950100002)(6666003)(68736007)(101416001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR12MB0145; H:brijesh-build-machine.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR12MB0145; 23:u7zlM7WMWb1/ORqfVZdukOuwwSHXCHmcH8cfvvAXb?= =?us-ascii?Q?3S3OWV9JbJqELMowIXyxGOI7aBk+vzm6f26Tf1dxyDWUUggEFfYFitD6v21C?= =?us-ascii?Q?Bv+mw0lToxTEI4kxSm9Wye4DXJ6bDMnMed1hZDQdxPeQbMq1gxU1/yS5WBt9?= =?us-ascii?Q?rK10P1+/Ui7uR9rzOy5rbnn44ALXZlcu4wnLOBelq9IR7nF6fKAYlLBbXZhC?= =?us-ascii?Q?1pj3OfP0mWURgYlM8PJ03zueVXSOHFF5l2umJ21MvzKC4sg1wDFiFNaY07Cl?= =?us-ascii?Q?cHr1jsrnZ/iEXcWSa/edw25CgN4NXB6gFcVL2ZtsxqaLUhlN5bOFd1CebEle?= =?us-ascii?Q?6IK96q1hyYpo0/L+6ngbsbRzlZexG7z/eARzZNczdPd5WKpw6uBZl2kN3d3k?= =?us-ascii?Q?XzaznZXJ3dnzSlvBTDuRjzMTOtc0G/wYaJ87tHq2vnLI6EFFnVckODsMTQqo?= =?us-ascii?Q?qw90bJwHft/IkD3aig5SB9jvexB1VHLI/KFvVUG1ense81uRlqByY8lX8Ok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u454HKRIGIZ1WmqsC1vF5S52sjFRIeRxtbp2W7QHXsOwjTNedRCvnJoool1mdg0poLmvu/if9LHqW4K1uyUfZyOIQ/HCOKf/5FsZyPgAFs991xp+Q4IHXob4S2h9qWPNi6s50JJPuD1C6hW+JDMfu8NyQ==; 5:ua9BQ0Kx9HjqinJ4KBJR6UA/fR3dP5hgn7pyFhTBbSmxrQFB2MnA0g+HlR5TlKlbGhKrLrIXnNhNlkajBLL63GA+EGv9XA+SHXfQaXYCBmurct1ZEaiicuadgRBAK8wGOoRhBvSTOi21o4Vo6e7ACg==; 24:agTg1vlODeaFm54eXlKfPWWp1BIojKUX176RT9st7c7wyXKCp2wbGpFmheKud+EeWG+haoySC6lYZXRclGFlT6tlKru9SP19HZ25+/i7bJQ=; 7:6cJ1IBcC0bjjQO1Xs6Em7tb80SP3oXvXiMTV3zg9Dv4fYvNCb57P/yFCPMHdt7BiIVyDn1UdI37tyLI1+tJH4+4rp0H5+z/oVn8HkDwRKNhNtSfxGTHigjVy7ZeaqTvyaKalBb1uSlBB11qYLqWcM2JDA1c1z9kJ8GIDZuLfKzaxqBY9AdzclGpmy0OXPR/C3FzPatSs5wrhCQGtotuluWnmQ4I0MjJaCupMw8ttJYM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 20:fH31yVHUVUEBGLEStjIy16Ob3/2F2kc1V3hEYcziKZb9ODvEKBaZWtgEt1bfqjSCmLppSeAl3IOes6HECI4U0Q2S0hpqyT6pFw4VW+bVOLFE5yKZllyoQXJGNNzumhqQPmi7KO72mYVq8WM5ozwqsfh9/rzWz/8apXkqivQT+3ELDF9zHwgn3egz9+QpjN/6Nve7ol0MlPIgqNmnEF7EPVjBHBzztSR5JXTQWySJL3RppjDj5noOV9F3wipbn5l8 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2017 11:37:10.9554 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0145 Subject: [edk2] [PATCH v2 06/23] OvmfPkg/Virtio: introduce IOMMU-like member functions to VIRTIO_DEVICE_PROTOCOL X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen , Tom Lendacky , Laszlo Ersek , Ard Biesheuvel Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The patch extends VIRTIO_DEVICE_PROTOCOL to provide the following new member functions: - AllocateSharedPages : allocate a memory region suitable for sharing between guest and hypervisor (e.g ring buffer). - FreeSharedPages: free the memory allocated using AllocateSharedPages (). - MapSharedBuffer: map a host address to device address suitable to share with device for bus master operations. - UnmapSharedBuffer: unmap the device address obtained through the MapSharedBuffer(). Suggested-by: Laszlo Ersek Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Tom Lendacky Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Brijesh Singh --- OvmfPkg/Include/Protocol/VirtioDevice.h | 143 ++++++++++++++++++++ 1 file changed, 143 insertions(+) diff --git a/OvmfPkg/Include/Protocol/VirtioDevice.h b/OvmfPkg/Include/Prot= ocol/VirtioDevice.h index edb20c18822c..14f980d7bf0a 100644 --- a/OvmfPkg/Include/Protocol/VirtioDevice.h +++ b/OvmfPkg/Include/Protocol/VirtioDevice.h @@ -5,6 +5,7 @@ and should not be used outside of the EDK II tree. =20 Copyright (c) 2013, ARM Ltd. All rights reserved.
+ Copyright (c) 2017, AMD Inc, All rights reserved.
=20 This program and the accompanying materials are licensed and made availa= ble under the terms and conditions of the BSD License which accompanies this @@ -31,6 +32,25 @@ =20 typedef struct _VIRTIO_DEVICE_PROTOCOL VIRTIO_DEVICE_PROTOCOL; =20 +// +// VIRTIO Operation for VIRTIO_MAP_SHARED +// +typedef enum { + // + // A read operation from system memory by a bus master + // + VirtioOperationBusMasterRead, + // + // A write operation to system memory by a bus master + // + VirtioOperationBusMasterWrite, + // + // Provides both read and write access to system memory by both the + // processor and a bus master + // + VirtioOperationBusMasterCommonBuffer, +} VIRTIO_MAP_OPERATION; + /** =20 Read a word from the device-specific I/O region of the Virtio Header. @@ -319,6 +339,121 @@ EFI_STATUS IN UINT8 DeviceStatus ); =20 +/** + + Allocates pages that are suitable for an VirtioOperationBusMasterCommonB= uffer + mapping. This means that the buffer allocated by this function supports + simultaneous access by both the processor and the bus master. The device + address that the bus master uses to access the buffer must be retrieved = with + a call to VIRTIO_MAP_SHARED. + + @param[in] This The protocol instance pointer. + + @param[in] Pages The number of pages to allocate. + + @param[in,out] HostAddress A pointer to store the system memory b= ase + address of the allocated range. + + @retval EFI_SUCCESS The requested memory pages were alloca= ted. + @retval EFI_OUT_OF_RESOURCES The memory pages could not be allocate= d. + +**/ +typedef +EFI_STATUS +(EFIAPI *VIRTIO_ALLOCATE_SHARED)( + IN VIRTIO_DEVICE_PROTOCOL *This, + IN UINTN Pages, + IN OUT VOID **HostAddress + ); + +/** + Frees memory that was allocated with VIRTIO_ALLOCATE_SHARED. + + @param[in] This The protocol instance pointer. + + @param[in] Pages The number of pages to free. + + @param[in] HostAddress The system memory base address of the allocat= ed + range. + +**/ +typedef +VOID +(EFIAPI *VIRTIO_FREE_SHARED)( + IN VIRTIO_DEVICE_PROTOCOL *This, + IN UINTN Pages, + IN VOID *HostAddress + ); + +/** + Provides the virtio device address required to access system memory from= a + DMA bus master. + + The interface follows the same usage pattern as defined in UEFI spec 2.6 + (Section 13.2 PCI Root Bridge I/O Protocol) + + @param[in] This The protocol instance pointer. + + @param[in] Operation Indicates if the bus master is going to + read or write to system memory. + + @param[in] HostAddress The system memory address to map to shar= ed + buffer address. + + @param[in,out] NumberOfBytes On input the number of bytes to map. + On output the number of bytes that were + mapped. + + @param[out] DeviceAddress The resulting shared map address for the + bus master to access the hosts HostAddre= ss. + + @param[out] Mapping A resulting taken to pass to + VIRTIO_UNMAP_SHARED. + + @retval EFI_SUCCESS The range was mapped for the returned + NumberOfBytes. + @retval EFI_UNSUPPORTED The HostAddress cannot be mapped as a + common buffer. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_OUT_OF_RESOURCES The request could not be completed due to + a lack of resources. + @retval EFI_DEVICE_ERROR The system hardware could not map the + requested address. +**/ + +typedef +EFI_STATUS +(EFIAPI *VIRTIO_MAP_SHARED) ( + IN VIRTIO_DEVICE_PROTOCOL *This, + IN VIRTIO_MAP_OPERATION Operation, + IN VOID *HostAddress, + IN OUT UINTN *NumberOfBytes, + OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, + OUT VOID **Mapping + ); + +/** + Completes the VIRTIO_MAP_SHARED operation and releases any corresponding + resources. + + @param[in] This The protocol instance pointer. + + @param[in] Mapping The mapping token returned from + VIRTIO_MAP_SHARED. + + @retval EFI_SUCCESS The range was unmapped. + @retval EFI_INVALID_PARAMETER Mapping is not a value that was returned = by + VIRTIO_MAP_SHARED. Passing an invalid Map= ping + token can cause undefined behavior. + @retval EFI_DEVICE_ERROR The data was not committed to the target + system memory. +**/ +typedef +EFI_STATUS +(EFIAPI *VIRTIO_UNMAP_SHARED)( + IN VIRTIO_DEVICE_PROTOCOL *This, + IN VOID *Mapping + ); =20 /** =20 @@ -359,6 +494,14 @@ struct _VIRTIO_DEVICE_PROTOCOL { // Functions to read/write Device Specific headers VIRTIO_DEVICE_WRITE WriteDevice; VIRTIO_DEVICE_READ ReadDevice; + + // + // Functions to allocate, free, map and unmap shared buffer + // + VIRTIO_ALLOCATE_SHARED AllocateSharedPages; + VIRTIO_FREE_SHARED FreeSharedPages; + VIRTIO_MAP_SHARED MapSharedBuffer; + VIRTIO_UNMAP_SHARED UnmapSharedBuffer; }; =20 extern EFI_GUID gVirtioDeviceProtocolGuid; --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Fri Dec 27 01:42:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 15027106575541003.0354152876017; Mon, 14 Aug 2017 04:37:37 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 57BA42095E01C; Mon, 14 Aug 2017 04:34:53 -0700 (PDT) Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0046.outbound.protection.outlook.com [104.47.40.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 883D921D0A242 for ; Mon, 14 Aug 2017 04:34:51 -0700 (PDT) Received: from brijesh-build-machine.amd.com (165.204.77.1) by BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1341.21; Mon, 14 Aug 2017 11:37:12 +0000 X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=t0OUvlY+0NHBYeHnhh1BKX9snhqZro5fHkxO3GHNXEA=; b=om5zk1ZAdIekP6R82dZD61NJ/OHRu1lYYCAeowMK4D8cIpHVtlhS437/huUXakChESMU71JfxMho/fhWxb/eAr44MbnMD+1l7/Pz7GQHtFUmZ6DB/+LQ1VAGHWSVvVKqV4J+LqKYRnG4Ej/w9mlJKm345qqtviQgOduofjYz45A= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; From: Brijesh Singh To: edk2-devel@lists.01.org Date: Mon, 14 Aug 2017 07:36:29 -0400 Message-Id: <1502710605-8058-8-git-send-email-brijesh.singh@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> References: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: MWHPR15CA0043.namprd15.prod.outlook.com (10.173.226.157) To BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c24a384c-6a22-48e6-cac7-08d4e308ce55 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BY2PR12MB0145; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 3:gf4iDTm8Vrij18Lyabku0ujCM640bckUsEpQ/srLzCMH4kh7FRGESI3RhrZzD3WLE02WllEBPXSqBPmNh+nVJDPfjhPS6K6ziAyOU8dazMJynSuPUdmkANCfYHntRgaQ79B8NTmqOfHVztbrN1wPSgFSyQE8IsezkfQHW0e7GBVQQtTBKKos63zLZdPSqjUcaoDmRQy7qgjLl0Otmzl+joif+Jvt7KhwaPEIUw2GhkB75MzrpmuZn2h9/B29W/Rq; 25:fNNanbmwk3caLGu7a7CQsfXi8aWcFPndcRnUus+jFWxSECcSWn9motSDC/mKba3bfMAUqLzg8bJCl/RZBVwKWWZGH6uO2nlkgzon/Pf3UW6JkBK13B54sjSy3Xy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GaB/Zd8LihaTH/rvbZ9Zr8VHuSXv8uYW3FCtzvmE6pOT2onuLfw2ZVW4e518jKKKHOuwElgD7E1fDGE61xnbfJSet0D2ocTHF1FKk/2LeSXtjWeTJV86ULea0C6jBaOXvaOfT5pwRX0sHkLz9KHxRLBKhyY4lBJWBG1tHK5gGa5lY7nQuQFS1TvxY4dgDdEFENYqXFUQogAwP/jd7wDigSGQB2H402hseJ1qbFVjBIrVQvZy0xluogMdHhVmLIMXMuZR9hq6Ib35o/dTwZNmK1Uegk54J+AZFnh0wpogBYHVueMAg== X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(228905959029699); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(3002001)(6055026)(6041248)(20161123558100)(20161123560025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BY2PR12MB0145; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BY2PR12MB0145; X-Forefront-PRVS: 039975700A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(7370300001)(4630300001)(6009001)(39860400002)(199003)(189002)(54906002)(5003940100001)(6116002)(3846002)(53936002)(97736004)(86362001)(36756003)(81156014)(81166006)(110136004)(8676002)(189998001)(50986999)(76176999)(5660300001)(2361001)(25786009)(2351001)(50226002)(4326008)(7350300001)(33646002)(478600001)(53416004)(42186005)(2906002)(105586002)(7736002)(305945005)(106356001)(48376002)(50466002)(47776003)(66066001)(6486002)(6916009)(2950100002)(6666003)(68736007)(101416001)(19627235001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR12MB0145; H:brijesh-build-machine.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR12MB0145; 23:tuOi90aCeTXaBUhO4mzZo5zh6nv967JM/Q92RJP7W?= =?us-ascii?Q?G9/ixLh00aw3AQbkEBLXEfDl/yInGrFuIj7JmclyWZXJlR44zeqRZ8dhkF+u?= =?us-ascii?Q?I7xJ70TUuYngLBrwjDfTxmOTWDMmEAvtDvYNb7MOp+5HEjo4NF4Pbx+WRHEn?= =?us-ascii?Q?HLPd3myPWuqnYN4e6LC0CrNDBsSXlyHGf5JzdP4sHPs0+eHrnSblv24t67pv?= =?us-ascii?Q?GD8DP0o0dmGe6Bt1ZMuuxVUTZxcg8zXwqaMGkD58r0fyvOhN5Tspm5M/fwTQ?= =?us-ascii?Q?PlXcG1OtZTOzAtit4tr9srNXisyrKfqZWbd4KW150gGQ7Wdor+PkOjoQlZZ3?= =?us-ascii?Q?eK6JWz9SaXWiftXCWUidVWOP7+o68mTi5QSJwwf6++MOSxUHnY68t+vSOgOI?= =?us-ascii?Q?yQxgDubhXfIvCq93Ee3ijmRZObBXniHacphVf3WfQpg2CdtRXZsMhgSp1Vlh?= =?us-ascii?Q?W5u0IctVKOktKHSegQzjwcP3+F9SlqdnoXZ52r+ODC3RcbF0NAJcuWwDGaLx?= =?us-ascii?Q?wsitcgQwlsTrtRsbL/ZMD1iuyzYIMKWweZtLHt/bZBqBoZImnVFwYcU0m2Sa?= =?us-ascii?Q?m7AOeXTK+ACQeUpB4raI0KL1fcIooq+UH2J8zbRFR7zsOH0IeiQAAbVU4TCy?= =?us-ascii?Q?MIsG4lwsKcdEfFYMG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kNBxcEnSSgX3kk7jiW/eBI2kg7ReK7hLvvamIivH9wU524z70XAUN0OkOb5JaRvIeUG0mcra0iRlOblJ7++n5LHL+/GyF+qlb4EfBrmQ98h/AHLgo9rUpj2lRFJ/wsEw==; 24:BY3fFGDJg4WVY88FgQ64PctL7fUqSBd0IpaWDCRilWdTH/zvAUUTdZtPTvx2rKl5Am7bxviaY2fPeyCSPfpHjDp187uDb0uCxRkTEX31S5Q=; 7:Q0/bi7s5DnTf690bDf4tB6LflKXLMKImlVahxs8bG+pv64ZwiVtUFv82QKf5fgJ5BRO1OSVZBqRqKNbGlrYz1/unyppZMWnEAbXuI6ZJ0+hDoDCEWcdLEeGxYejEdz5JM5QTI984UMcI23lwpbEgom0c68H58evV5zAd7JPN7ftvm7ih7OV8kB/tSuylaWpBB5IfBSvvZes23HVO2L9Yxm/6JKpXvUvKyXty9pCBs7Y= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 20:IjhyE83s2QLnGzXxx0QPosGryqFhCaeuwHKMBKMl5Wz7Gc/Zvo12bT98USe48K8r6E5soRYil68/wItfXJlxtxLW0JR9xWOD5PQd34hCMsEj7aIAxqbycWQkoBxrXcmaVAeEkWetsAKT15I771hWGJBPU4hQHdFWDAyEyzdGgjUj4Srds+8TF5k0nmicQf6brDiJ/QBzXzaDf0svVGwBmRgcL5b3p4vcfAaTtWOXs7h31h0rdPEZ8AXiVD89vI+Y X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2017 11:37:12.0961 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0145 Subject: [edk2] [PATCH v2 07/23] OvmfPkg/Virtio10Dxe: implement IOMMU-like member functions X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen , Tom Lendacky , Laszlo Ersek , Ard Biesheuvel Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The patch implements the newly added IOMMU-like member functions by respectively delegating the job to: - VIRTIO_DEVICE_PROTOCOL.AllocateSharedPages() -> EFI_PCI_IO_PROTOCOL.AllocateBuffer() - VIRTIO_DEVICE_PROTOCOL.FreeSharedPages() -> EFI_PCI_IO_PROTOCOL.FreeBuffer() - VIRTIO_DEVICE_PROTOCOL.MapSharedBuffer() -> EFI_PCI_IO_PROTOCOL.Map() - VIRTIO_DEVICE_PROTOCOL.UnmapSharedBuffer() -> EFI_PCI_IO_PROTOCOL.Unmap() Suggested-by: Laszlo Ersek Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Tom Lendacky Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Brijesh Singh --- OvmfPkg/Virtio10Dxe/Virtio10.c | 121 +++++++++++++++++++- 1 file changed, 119 insertions(+), 2 deletions(-) diff --git a/OvmfPkg/Virtio10Dxe/Virtio10.c b/OvmfPkg/Virtio10Dxe/Virtio10.c index 43dcfd7cb2a4..413ffa06cf35 100644 --- a/OvmfPkg/Virtio10Dxe/Virtio10.c +++ b/OvmfPkg/Virtio10Dxe/Virtio10.c @@ -2,6 +2,7 @@ A non-transitional driver for VirtIo 1.0 PCI devices. =20 Copyright (C) 2016, Red Hat, Inc. + Copyright (C) 2017, AMD Inc, All rights reserved.
=20 This program and the accompanying materials are licensed and made availa= ble under the terms and conditions of the BSD License which accompanies this @@ -15,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -772,6 +774,117 @@ Virtio10ReadDevice ( return Status; } =20 +STATIC +EFI_STATUS +EFIAPI +Virtio10AllocateSharedPages ( + IN VIRTIO_DEVICE_PROTOCOL *This, + IN UINTN Pages, + IN OUT VOID **HostAddress + ) +{ + VIRTIO_1_0_DEV *Dev; + EFI_STATUS Status; + + Dev =3D VIRTIO_1_0_FROM_VIRTIO_DEVICE (This); + + Status =3D Dev->PciIo->AllocateBuffer ( + Dev->PciIo, + AllocateAnyPages, + EfiBootServicesData, + Pages, + HostAddress, + EFI_PCI_ATTRIBUTE_MEMORY_CACHED + ); + return Status; +} + +STATIC +VOID +EFIAPI +Virtio10FreeSharedPages ( + IN VIRTIO_DEVICE_PROTOCOL *This, + IN UINTN Pages, + IN VOID *HostAddress + ) +{ + VIRTIO_1_0_DEV *Dev; + + Dev =3D VIRTIO_1_0_FROM_VIRTIO_DEVICE (This); + + Dev->PciIo->FreeBuffer ( + Dev->PciIo, + Pages, + HostAddress + ); +} + +STATIC +EFI_STATUS +EFIAPI +Virtio10MapSharedBuffer ( + IN VIRTIO_DEVICE_PROTOCOL *This, + IN VIRTIO_MAP_OPERATION Operation, + IN VOID *HostAddress, + IN OUT UINTN *NumberOfBytes, + OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, + OUT VOID **Mapping + ) +{ + EFI_STATUS Status; + VIRTIO_1_0_DEV *Dev; + EFI_PCI_IO_PROTOCOL_OPERATION PciIoOperation; + + Dev =3D VIRTIO_1_0_FROM_VIRTIO_DEVICE (This); + + // + // Map VIRTIO_MAP_OPERATION to EFI_PCI_IO_PROTOCOL_OPERATION + // + switch (Operation) { + case VirtioOperationBusMasterRead: + PciIoOperation =3D EfiPciIoOperationBusMasterRead; + break; + case VirtioOperationBusMasterWrite: + PciIoOperation =3D EfiPciIoOperationBusMasterWrite; + break; + case VirtioOperationBusMasterCommonBuffer: + PciIoOperation =3D EfiPciIoOperationBusMasterCommonBuffer; + break; + default: + return EFI_INVALID_PARAMETER; + } + + Status =3D Dev->PciIo->Map ( + Dev->PciIo, + PciIoOperation, + HostAddress, + NumberOfBytes, + DeviceAddress, + Mapping + ); + return Status; +} + +STATIC +EFI_STATUS +EFIAPI +Virtio10UnmapSharedBuffer ( + IN VIRTIO_DEVICE_PROTOCOL *This, + IN VOID *Mapping + ) +{ + EFI_STATUS Status; + VIRTIO_1_0_DEV *Dev; + + Dev =3D VIRTIO_1_0_FROM_VIRTIO_DEVICE (This); + + Status =3D Dev->PciIo->Unmap ( + Dev->PciIo, + Mapping + ); + + return Status; +} =20 STATIC CONST VIRTIO_DEVICE_PROTOCOL mVirtIoTemplate =3D { VIRTIO_SPEC_REVISION (1, 0, 0), @@ -788,7 +901,11 @@ STATIC CONST VIRTIO_DEVICE_PROTOCOL mVirtIoTemplate = =3D { Virtio10GetDeviceStatus, Virtio10SetDeviceStatus, Virtio10WriteDevice, - Virtio10ReadDevice + Virtio10ReadDevice, + Virtio10AllocateSharedPages, + Virtio10FreeSharedPages, + Virtio10MapSharedBuffer, + Virtio10UnmapSharedBuffer }; =20 =20 @@ -906,7 +1023,7 @@ Virtio10BindingStart ( goto ClosePciIo; } =20 - SetAttributes =3D EFI_PCI_IO_ATTRIBUTE_BUS_MASTER; + SetAttributes =3D EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE; UpdateAttributes (&Device->CommonConfig, &SetAttributes); UpdateAttributes (&Device->NotifyConfig, &SetAttributes); UpdateAttributes (&Device->SpecificConfig, &SetAttributes); --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Fri Dec 27 01:42:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1502710661115973.760368857344; Mon, 14 Aug 2017 04:37:41 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 901D321D0A24E; Mon, 14 Aug 2017 04:34:53 -0700 (PDT) Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0046.outbound.protection.outlook.com [104.47.40.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id A2D5E21D0A243 for ; Mon, 14 Aug 2017 04:34:51 -0700 (PDT) Received: from brijesh-build-machine.amd.com (165.204.77.1) by BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1341.21; Mon, 14 Aug 2017 11:37:13 +0000 X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=K8AsxvSHyxbLDJje/IMqQqXw3Ndrrh1LWYM5AVJ3xCs=; b=RgV9q5sMlIor1jk8GifQrU7MJYFF/SGErax9HLN8okzti1A9xNC2xAoldS7TocwOZw5XTETgIg3l2uirPtuNdcZAjYSnHyl4vaW65k5w1oWeKDWhIQS7Ua6TivK8+Uyx79gwSAO+bw6YPfm8tgmB95ulJWQMP/IdDSXXiKsKnjY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; From: Brijesh Singh To: edk2-devel@lists.01.org Date: Mon, 14 Aug 2017 07:36:30 -0400 Message-Id: <1502710605-8058-9-git-send-email-brijesh.singh@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> References: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: MWHPR15CA0043.namprd15.prod.outlook.com (10.173.226.157) To BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 20f02736-2f7f-4bc5-9cd0-08d4e308cee9 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BY2PR12MB0145; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 3:1bV1C38x8oRO65PZo22ACW5+NhIKkfvW5oSmq21Vt6YGSDtcQQj5Ye9Tvqu9hGV8iS7qWpPX8nk/h2xAIlH94ieGqBB7vDP9MkZ/MXCkN00psiSBwf3/JRP1vet/IRYAOVy35ti4SSWM+GsHN9PJ2gE64tKmUn50VvZg9CukJB7c3mSdZg2wCi8Sn4Qr0HPn4wwsB5107mj5z2tNTb2fKNwtT2WCusZut9nFiE8oMugpRD1npYElxq79fcvye6Ls; 25:6YcCrtfumMI+uTs7zEFunVYMsxydzO0w37Y5pvMtxDwMIT3/9e4bq77LcWPcXjRULAJ7HTZlcwFOR2oprJKjaZxILu846krEIgcKooMg0mbm/e8QJWIddMnhKU6vf6perWYG9/6YJ6+bcD3DLC7qTFHLpbvoOeKIYnGm6+JoISi4Fm8yOreIPbZZ/iwldgsiSGatUG15pUlEMd6wA3tHAgiJHJLfdyMjD6uHvGBpxNF1TdREeMUc1z8gAzSc5vLHmJ+J6m4NnRHEoi7jnRUycy+873JMMqPdPOSmG8q6jBv8FyY7HLexZb/Oku6Lb0m+LaChDHq3zjF2kips5QFqmQ==; 31:v0VhoS0Rr8iUuFdV0vS1vchA05VxsZFbSZ/7OHJcVy3Y8otCrgQIg225zw1ItpshYcEqNALLnbwB2BPBsv19NxxLjyEeJ8kIHbWBkMXbDm/VfB7zEBmyfZkj4qFnXuBr1Lx63KfrzlKCGq1VA854ybgyapNwOD+JlHFQgmizRth0WoBQ4lDl/2pw6xKKkbjW5mBJ0zs5obVKv6fFMsIrw3HfsUAEo5l+5+eSGkmkLE4= X-MS-TrafficTypeDiagnostic: BY2PR12MB0145: X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 20:fqsWaFhGbB1cYzFbVCBg3fhTGwZKqNz42XwIY5rIhAsqQG+rEbNPSRDoTjuwJ5DTvYptsRiTUDBA8rWfKSMrBbyJZF+W0oBGMPsTjja6srW1PfCcdRFqCDnu3Qp51tqJd0735l+TCUL5XhMjuVxvXcypj+0tQIKcWAk3HaJF6jg+a+fVfUxqgAfLAOhSIYsWdcQmbXMkjTX6Q3KzqQ5oeV+5CNz3CvwMkDBS2CR4n7Nk+kkiiL9LQC9OFBam2lIHXrQX7KDulBmNNuiQMQfZNNzziQb/11OyQZ3/4FCD862oL/ifuJD5AUYLQS3pFajotUO1Jzx/nZADVebcFstIFTBCJCRy2ov6aK3yJqlhXCAEcyzReJY+FwFS6r+QhRw+y5RAbe03O3itkMbHMloKOxrfvK5KjS9E3ODXJgRl283J/B6KejhpUvgYGEaSqkgBBi7GiqN6er5nPWN32UoDa8n1S9WvoKNFOIA1sTao20rdr9cmGnZXTop4TETA8qXQ; 4:LYEtlgCWni+PuAVpT5tQ3MC+0d9jbOSruQEZBI2BTxqOfPiTywZJie2klC2hAJmyx3wdQk81UI4yxsyJCD+YXECTJpoB8cjVtrFJweznbE+I0qEOdaPyQoNZer5N3TdR436p90ZB30L0gqySMrmnOm0C8dIgVBmKKwmYejwczO/ZfLcw0/SgWq5F5cR+r2BVqVCmPndyFiRr+MlD+4g794q+cHa+EZpB7i1tD96yIBBuNQremmaYNqc1Ko7XutMmSilLh2Er1WgTeHuiy0VvnXuzr9fQoI+WukaZRTbTvHXK2ZXz15pT09xxpBZoKy/MqrbggDTqbqz0mrgYeSs1lQ== X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(228905959029699); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(3002001)(6055026)(6041248)(20161123558100)(20161123560025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BY2PR12MB0145; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BY2PR12MB0145; X-Forefront-PRVS: 039975700A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(7370300001)(4630300001)(6009001)(39860400002)(199003)(189002)(54906002)(5003940100001)(6116002)(3846002)(53936002)(97736004)(575784001)(86362001)(36756003)(81156014)(81166006)(110136004)(8676002)(189998001)(50986999)(76176999)(5660300001)(2361001)(25786009)(2351001)(50226002)(4326008)(7350300001)(33646002)(478600001)(53416004)(42186005)(2906002)(105586002)(7736002)(305945005)(106356001)(48376002)(50466002)(47776003)(66066001)(6486002)(6916009)(2950100002)(6666003)(68736007)(101416001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR12MB0145; H:brijesh-build-machine.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR12MB0145; 23:b2krrIvBquZad+VFHBs8evzJLniwwvgS55YEr7xcQ?= =?us-ascii?Q?gOldyn15i+VR2ZhuWpK444VjKjXEk8K+av35iHjkxb2I3Pm37zcfg/Y0AO0I?= =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Io0KbNArMQBzhEAXK1dzWuDynlHbmeJ12oHHtebXKCNBc9F3IDBS+pJ0MUpc3nr7rm2Iq3qSeeAhUFXt1LggRRPUsGE1Eg= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 20:4the0YcpYVoNvfLTqulUbcPLZiturKuAYCZ7d1JLaFztns8dTMxj1TJrFVBLcb9zZELDkeTtbZp8CKYNDEEuj5pG3asXDDBbuBrsgZjKwnYO/VKHZFcLQdXBSrMK8Nod89PJRIU+KWa6lves84ioOoQuZk1qSbWDQgAuBY3qdlQ4wvCJb4pho8fMpb7afGHzMHOIkdB7Ah1396NuzJKsY8ZxT4NwnZumR3v2IF7hw0dxOhIoTFXvCleHpzgCqD/X X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2017 11:37:13.0648 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0145 Subject: [edk2] [PATCH v2 08/23] OvmfPkg/VirtioPciDeviceDxe: implement IOMMU-like member functions X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen , Tom Lendacky , Laszlo Ersek , Ard Biesheuvel Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The patch implements the newly added IOMMU-like member functions by respectively delegating the job to: - VIRTIO_DEVICE_PROTOCOL.AllocateSharedPages () -> MemoryAllocationLib.AllocatePages() - VIRTIO_DEVICE_PROTOCOL.FreeSharedPages () -> MemoryAllocationLib.FreePages () - VIRTIO_DEVICE_PROTOCOL.MapSharedBuffer () -> no-op - VIRTIO_DEVICE_PROTOCOL.UnmapSharedBuffer () -> no-op Suggested-by: Laszlo Ersek Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Tom Lendacky Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Brijesh Singh --- OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.h | 34 ++++++++++++ OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.c | 7 ++- OvmfPkg/VirtioPciDeviceDxe/VirtioPciFunctions.c | 58 ++++++++++++++++++++ 3 files changed, 98 insertions(+), 1 deletion(-) diff --git a/OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.h b/OvmfPkg/VirtioP= ciDeviceDxe/VirtioPciDevice.h index 6f51f816ef0f..41df5a98e560 100644 --- a/OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.h +++ b/OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.h @@ -3,6 +3,7 @@ Internal definitions for the VirtIo PCI Device driver =20 Copyright (C) 2013, ARM Ltd + Copyright (c) 2017, AMD Inc, All rights reserved.
=20 This program and the accompanying materials are licensed and made availa= ble under the terms and conditions of the BSD License which accompanies this @@ -156,4 +157,37 @@ VirtioPciSetDeviceStatus ( IN UINT8 DeviceStatus ); =20 +EFI_STATUS +EFIAPI +VirtioPciAllocateSharedPages ( + IN VIRTIO_DEVICE_PROTOCOL *This, + IN UINTN NumPages, + OUT VOID **HostAddress + ); + +VOID +EFIAPI +VirtioPciFreeSharedPages ( + IN VIRTIO_DEVICE_PROTOCOL *This, + IN UINTN NumPages, + IN VOID *HostAddress + ); + +EFI_STATUS +EFIAPI +VirtioPciMapSharedBuffer ( + IN VIRTIO_DEVICE_PROTOCOL *This, + IN VIRTIO_MAP_OPERATION Operation, + IN VOID *HostAddress, + IN OUT UINTN *NumberOfBytes, + OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, + OUT VOID **Mapping + ); + +EFI_STATUS +EFIAPI +VirtioPciUnmapSharedBuffer ( + IN VIRTIO_DEVICE_PROTOCOL *This, + IN VOID *Mapping + ); #endif // _VIRTIO_PCI_DEVICE_DXE_H_ diff --git a/OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.c b/OvmfPkg/VirtioP= ciDeviceDxe/VirtioPciDevice.c index e41730456471..b847f3c02528 100644 --- a/OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.c +++ b/OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.c @@ -5,6 +5,7 @@ Copyright (C) 2012, Red Hat, Inc. Copyright (c) 2012 - 2016, Intel Corporation. All rights reserved.
Copyright (C) 2013, ARM Ltd. + Copyright (C) 2017, AMD Inc, All rights reserved.
=20 This program and the accompanying materials are licensed and made availa= ble under the terms and conditions of the BSD License which accompanies this @@ -40,7 +41,11 @@ STATIC VIRTIO_DEVICE_PROTOCOL mDeviceProtocolTemplate = =3D { VirtioPciGetDeviceStatus, // GetDeviceStatus VirtioPciSetDeviceStatus, // SetDeviceStatus VirtioPciDeviceWrite, // WriteDevice - VirtioPciDeviceRead // ReadDevice + VirtioPciDeviceRead, // ReadDevice + VirtioPciAllocateSharedPages, // AllocateSharedPages + VirtioPciFreeSharedPages, // FreeSharedPages + VirtioPciMapSharedBuffer, // MapSharedBuffer + VirtioPciUnmapSharedBuffer, // UnmapSharedBuffer }; =20 /** diff --git a/OvmfPkg/VirtioPciDeviceDxe/VirtioPciFunctions.c b/OvmfPkg/Virt= ioPciDeviceDxe/VirtioPciFunctions.c index 5f86914265ea..4597095deb78 100644 --- a/OvmfPkg/VirtioPciDeviceDxe/VirtioPciFunctions.c +++ b/OvmfPkg/VirtioPciDeviceDxe/VirtioPciFunctions.c @@ -5,6 +5,7 @@ Copyright (C) 2012, Red Hat, Inc. Copyright (c) 2012, Intel Corporation. All rights reserved.
Copyright (C) 2013, ARM Ltd. + Copyright (C) 2017, AMD Inc, All rights reserved.
=20 This program and the accompanying materials are licensed and made availa= ble under the terms and conditions of the BSD License which accompanies this @@ -271,3 +272,60 @@ VirtioPciSetDeviceStatus ( return VirtioPciIoWrite (Dev, VIRTIO_PCI_OFFSET_QUEUE_DEVICE_STATUS, sizeof (UINT8), DeviceStatus); } + +EFI_STATUS +EFIAPI +VirtioPciAllocateSharedPages ( + IN VIRTIO_DEVICE_PROTOCOL *This, + IN UINTN NumPages, + OUT VOID **HostAddress + ) +{ + VOID *Buffer; + + Buffer =3D AllocatePages (NumPages); + if (Buffer =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + *HostAddress =3D Buffer; + return EFI_SUCCESS; +} + +VOID +EFIAPI +VirtioPciFreeSharedPages ( + IN VIRTIO_DEVICE_PROTOCOL *This, + IN UINTN NumPages, + IN VOID *HostAddress + ) +{ + FreePages (HostAddress, NumPages); +} + +EFI_STATUS +EFIAPI +VirtioPciMapSharedBuffer ( + IN VIRTIO_DEVICE_PROTOCOL *This, + IN VIRTIO_MAP_OPERATION Operation, + IN VOID *HostAddress, + IN OUT UINTN *NumberOfBytes, + OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, + OUT VOID **Mapping + ) +{ + *DeviceAddress =3D (EFI_PHYSICAL_ADDRESS) (UINTN) HostAddress; + *Mapping =3D NULL; + + return EFI_SUCCESS; +} + +EFI_STATUS +EFIAPI +VirtioPciUnmapSharedBuffer ( + IN VIRTIO_DEVICE_PROTOCOL *This, + OUT VOID *Mapping + ) +{ + return EFI_SUCCESS; +} --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Fri Dec 27 01:42:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1502710664852775.3364344669767; Mon, 14 Aug 2017 04:37:44 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id C813821D0A252; Mon, 14 Aug 2017 04:34:55 -0700 (PDT) Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0040.outbound.protection.outlook.com [104.47.40.40]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 011692095E014 for ; Mon, 14 Aug 2017 04:34:53 -0700 (PDT) Received: from brijesh-build-machine.amd.com (165.204.77.1) by BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1341.21; Mon, 14 Aug 2017 11:37:14 +0000 X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=6tFmjlf9nQ3L3nwtnb5rTNUfSrzUL1PbMEK2FgUTM28=; b=LsKJTMzVwRtVhxdbFt7rokho73jW0qqEfn1eRVTm6eUUmK23pIyjlZ+BxXNhMuh7VZ1nBIrIWkop4+naCAL2qkiP5/0pntb/U6rTFTpOLfjI7FI36baoPjiObt2selpCVdk1AVXgueEjCVM5LvGjAnya/kmxce9F8H588kHo+sY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; From: Brijesh Singh To: edk2-devel@lists.01.org Date: Mon, 14 Aug 2017 07:36:31 -0400 Message-Id: <1502710605-8058-10-git-send-email-brijesh.singh@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> References: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: MWHPR15CA0043.namprd15.prod.outlook.com (10.173.226.157) To BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8061bf9f-3405-4cb1-d12b-08d4e308cf7f X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BY2PR12MB0145; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 3:wExDgtN1WwwsQ8DmUh8YgYgSaDDCZToUbRFmKlb198ELEQ9gOSNosU8QrDFami04HX7aq5yF2E4iwPtaXSXkv7DKyLhPR1yIkaxRlToHH6R/F12yLdymkd03/dYWajurvcW0K0Dv+7dCiYJ6eq8FoBsjkV9htjmocCwQJQcJozXygbc02XYS5RU40h6foQO8R3puLH4aESsG7+si+tIE3bw31fZCwYpYhX1239V9ptZ6MPI0HrdVr0cl7EjldNd7; 25:wefnDnMCGV4snjMf1D5Wcrc4+bFJ+UVXqPLPK8akRRlIl2eOgReT/ciHiKpOtqv3pb21FhlNQJKikqw/M2vp6YzfUxZs6t6AD6SjBZUHuw9xCGtPT1P+ECt4wvso+63r4kQu47IcmPp0RYjIJfi17AKlJS3R1Uar8PERt5MzBKkic68sTXY/yM0orZExRCM2bm5n0VuuR7J89z3IvSG3L4DdTgzCNX9gGgnipec2XAmN30ZiuawbdwOSARB8iMwpZJLt8MgL/TCcPyiKXCSLgggzADlBHUPBGSSc5zx/YVqjFBlqhXLMjjFpwFPajupIMj+EaoVY8cv8TzbVsH/CqQ==; 31:k9b/dk+8GPcttS7Zmja0o4ibuwOeQpOLMbbepaonaRmJVeg0jdcphxTDvihe9NjITy6vcL2XZSlOkZnyqQFdi3klz2bJ58L6gnGq75y01c8dnb27+rSuL4poTSNbXIehrSD4cfk1ZK3+J7h0INGvqicDlUJ+t8mcJUXL/cDusMNIJegh/uq0MbvWE6H+4GfBy5mPdn8n1fKdagaRp8YJ0/RgFNlO6TvfW/Sq8Q8beA4= X-MS-TrafficTypeDiagnostic: BY2PR12MB0145: X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 20:SRbBl6vxqedos7HYihea/aoFzCANZP3QoJ9yrco8F5LFyEslqgCOCVbPffo/4eX21KSPOEAorvqqqEQLGEh8SLQB+GZt5LA/ICbcoxFnExusLonAKvkGyreszHI/Y5csNTHYBDzOhv4aqJ3m6E33MCd87qwzrDBeni600eS7CiPD8bXl+u1kBdc0ZniS6kE9ehoDUOj+WW1xAOrzdClKgs8S9WbaAEap5zC5kQyNroypixzGj9aE0LbwRlZsV43g3npiY8gPZYfAxfnd01gTuYlvatQ5HPj/1m8k+hYXvDya3/ZIiZ56w2p6qZeQ+sT+umRTlLYgYEDahjlfw/VbXul8TtbOHEJCPnMZtTIvJvhvIgE7OXL53mW/E8Q/W9jaSw5mHagQNx7/mPPSD6Opoek0DU9yjX5v133fuErD1S3oYmqFqa2VOsp583qEEGNT42VX+DACzPsVX35V1arSb7q6R9P3yF7WjH57S3LAEn/TNsE7cGRS4rlEYI0LAnfT; 4:Vd9BKLZRg6UNKu9lJZROgdCfz6OyqipxxHAELM+4J/CW/QRq6vY3OivyPPGuvAoCbFWolTPDuH8bzTxvK9Gzk8VCBYcrWuaY2a6Us25qIZld6x/PZEBj7cKSXCtn7uSat/kuhzRgbmII/8u36or/wPp/pYOHyWxldCy1egqXelZbTAqlNA/lvbh6+2g9KsX0hbMZtv2R6+o2oGx9sntQ+X7vCTlgl4u9U2tOJrYMuNdgCGwK+jpLDqrXy+zdCvY8eADv94KPin+IwWypOxxeC+udXPnjg1TrbJoBEnL8AD1qL0zOyw4zM8a4DkFyi54VrH9B57xltNVqr4hnBDi1Ow== X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(228905959029699); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(3002001)(6055026)(6041248)(20161123558100)(20161123560025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BY2PR12MB0145; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BY2PR12MB0145; X-Forefront-PRVS: 039975700A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(7370300001)(4630300001)(979002)(6009001)(39860400002)(199003)(189002)(54906002)(5003940100001)(6116002)(3846002)(53936002)(97736004)(86362001)(36756003)(81156014)(81166006)(110136004)(8676002)(189998001)(50986999)(76176999)(5660300001)(2361001)(25786009)(2351001)(50226002)(4326008)(7350300001)(33646002)(478600001)(53416004)(42186005)(2906002)(105586002)(7736002)(305945005)(106356001)(48376002)(50466002)(47776003)(66066001)(6486002)(6916009)(2950100002)(6666003)(68736007)(101416001)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR12MB0145; H:brijesh-build-machine.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR12MB0145; 23:Y5HHv+BNXWGkygmn7nw7aLMNr9d+H2tDTiZytPGQu?= =?us-ascii?Q?61IIxEW8zLQZX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vwhS2ZUNewrxq5RaG1DD8wssWEuRbsIc6ZTjymy2dSPkmqYICIPscGtYNT6f22qMZxnCQcThgGFJzZuazaonswuSY3j9v5Ml6s+eutX0GMTge6tOej5/Xnymu+2OynFmrFW+Z0YjpjUq+d9p8B+eISiP307inTzgh31xvwVcezLVt4daVCJYJI/4bYxwEyV8GnqkctC3yyec2lt64UG/NFKQPP8Cm5U= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 20:M0XP3Pqiu6ND84NBydn7mQEVLs6pw4VbzPcLE3/EaVixbD5facGKcT91KwJXQadgkZGwksd2h9OOCpQm3wJkESnI+6sk59TwbLrsWxkn8Fu5s37JO7DQ3BuKKvYzlsC2QmY5LaYtb/NZyBvrKIxOzRqi4GsL9Gy3Z+RmUSKP2CRdPdrqg7R7C4eXf4ACVlcUzhlKDdgr+mX8amnhhfqxaumOo1O8aAf1kRC1cxY5dQKueQdFJWnKL+IlsvVBVtrg X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2017 11:37:14.0492 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0145 Subject: [edk2] [PATCH v2 09/23] OvmfPkg/VirtioMmioDeviceLib: implement IOMMU-like member functions X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen , Tom Lendacky , Laszlo Ersek , Ard Biesheuvel Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The patch implements the newly added IOMMU-like member functions by respectively delegating the job to: - VIRTIO_DEVICE_PROTOCOL.AllocateSharedPages () -> MemoryAllocationLib.AllocatePages() - VIRTIO_DEVICE_PROTOCOL.FreeSharedPages () -> MemoryAllocationLib.FreePages () - VIRTIO_DEVICE_PROTOCOL.MapSharedBuffer () -> no-op - VIRTIO_DEVICE_PROTOCOL.UnmapSharedBuffer () -> no-op Suggested-by: Laszlo Ersek Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Tom Lendacky Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Brijesh Singh --- OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.h | 34 +++++= ++++++ OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceFunctions.c | 59 +++++= +++++++++++++++ 2 files changed, 93 insertions(+) diff --git a/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.h b/OvmfP= kg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.h index bedd635e1a86..b69f6d7b7a85 100644 --- a/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.h +++ b/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.h @@ -137,4 +137,38 @@ VirtioMmioSetGuestFeatures ( IN UINT64 Features ); =20 +EFI_STATUS +EFIAPI +VirtioMmioAllocateSharedPages ( + IN VIRTIO_DEVICE_PROTOCOL *This, + IN UINTN NumPages, + OUT VOID **HostAddress + ); + +VOID +EFIAPI +VirtioMmioFreeSharedPages ( + IN VIRTIO_DEVICE_PROTOCOL *This, + IN UINTN NumPages, + IN VOID *HostAddress + ); + +EFI_STATUS +EFIAPI +VirtioMmioMapSharedBuffer ( + IN VIRTIO_DEVICE_PROTOCOL *This, + IN VIRTIO_MAP_OPERATION Operation, + IN VOID *HostAddress, + IN OUT UINTN *NumberOfBytes, + OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, + OUT VOID **Mapping + ); + +EFI_STATUS +EFIAPI +VirtioMmioUnmapSharedBuffer ( + IN VIRTIO_DEVICE_PROTOCOL *This, + IN VOID *Mapping + ); + #endif // _VIRTIO_MMIO_DEVICE_INTERNAL_H_ diff --git a/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceFunctions.= c b/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceFunctions.c index 9142d4a162c0..f3f69f324c6c 100644 --- a/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceFunctions.c +++ b/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceFunctions.c @@ -16,6 +16,8 @@ =20 **/ =20 +#include + #include "VirtioMmioDevice.h" =20 EFI_STATUS @@ -293,3 +295,60 @@ VirtioMmioDeviceRead ( =20 return EFI_SUCCESS; } + +EFI_STATUS +EFIAPI +VirtioMmioAllocateSharedPages ( + IN VIRTIO_DEVICE_PROTOCOL *This, + IN UINTN NumPages, + OUT VOID **HostAddress + ) +{ + VOID *Buffer; + + Buffer =3D AllocatePages (NumPages); + if (Buffer =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + *HostAddress =3D Buffer; + return EFI_SUCCESS; +} + +VOID +EFIAPI +VirtioMmioFreeSharedPages ( + IN VIRTIO_DEVICE_PROTOCOL *This, + IN UINTN NumPages, + IN VOID *HostAddress + ) +{ + FreePages (HostAddress, NumPages); +} + +EFI_STATUS +EFIAPI +VirtioMmioMapSharedBuffer ( + IN VIRTIO_DEVICE_PROTOCOL *This, + IN VIRTIO_MAP_OPERATION Operation, + IN VOID *HostAddress, + IN OUT UINTN *NumberOfBytes, + OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, + OUT VOID **Mapping + ) +{ + *DeviceAddress =3D (EFI_PHYSICAL_ADDRESS) (UINTN) HostAddress; + *Mapping =3D NULL; + + return EFI_SUCCESS; +} + +EFI_STATUS +EFIAPI +VirtioMmioUnmapSharedBuffer ( + IN VIRTIO_DEVICE_PROTOCOL *This, + OUT VOID *Mapping + ) +{ + return EFI_SUCCESS; +} --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Fri Dec 27 01:42:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1502710668443670.6367762253209; Mon, 14 Aug 2017 04:37:48 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 1296921D0A243; Mon, 14 Aug 2017 04:34:56 -0700 (PDT) Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0076.outbound.protection.outlook.com [104.47.40.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 9AB2821D0A251 for ; Mon, 14 Aug 2017 04:34:54 -0700 (PDT) Received: from brijesh-build-machine.amd.com (165.204.77.1) by BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1341.21; Mon, 14 Aug 2017 11:37:15 +0000 X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=L2M1R/jaYsd5XNiYEJ2+gsYbuV395Nbq6Kx4lKuVTd8=; b=WsMSAuwB0H29vMx8Z5YKKcZjjXXqv14NVFaFbTU1+dBR67PunORCOW3sKhcZhCOTUFknfGOT29sWLe86cdljaMEOKK+AcfJn6f/9X5G2bkr6BB8xbINKCEs1fT7qTbYz1IR9fiV2o2hyeVdUx9w6HDncmOlV1fQbYerE6+2w+vo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; From: Brijesh Singh To: edk2-devel@lists.01.org Date: Mon, 14 Aug 2017 07:36:32 -0400 Message-Id: <1502710605-8058-11-git-send-email-brijesh.singh@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> References: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: MWHPR15CA0043.namprd15.prod.outlook.com (10.173.226.157) To BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 690804ef-0ec6-4a74-524e-08d4e308d043 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BY2PR12MB0145; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 3:kJXyLEgCtOkzPe6i5QRkH8P3axXMT1E5ixFgDeWJo+9hEvryw6AnCETWHjz9jd7XVHm/sbUG4PDBrJ1wwc0UOR10rZRccQqpvz1E5/MZovNi3YhgTEibIZvMTxDFuVIcQif5Lj5bKNCUqiqW65DgqW/vOq2rJVr7cRWMgUg1TVxJK9iLEVGqxt6C7czYTfjLbWO8QTUUPaTXn3C7nLmnVd+8IHq8ckeDFFDhB1m1ZAlmOIVwWMjoEUGCtgIwztF0; 25:0G7IOLy8jMw3ffg27tV6LN5E0h90eT05YUNoSo9zoRqTYV72sRZ2+znLI6Yn2YhZh+lzvU2W36qMp8/Qei0Bewgc9feVIQC6Qf16SfzB20IeeGSFdNjAdj0oowvOSP19mf3qa6M3jyf+6WsPRzzSSV9YK7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IqAhjdO5mQ16fW9NlT3CkV1WFj3hC/2Hs3OWfbkFVmtcEMJrf4JIStth6Rp89O0YqltcAPMddpWRkNI2dEZ2m9KQ6QRHxnkOFJW5fU8Zo8pIyCNaX72YYdFWFvLuNejVA5Gq3HZqYphzzORKy9uCgb41fjS0BWApUSzdvJkAG8wXjmaiMQEvpCvXLxszGLfdax1MBCfFvY7Atv/73l/GDfOjICtuEcBT3EPkG0qqkpdiUU76pOqwUwFjozowwmShnMbQlcFb+HPA5ZfGfw== X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(228905959029699); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(3002001)(6055026)(6041248)(20161123558100)(20161123560025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BY2PR12MB0145; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BY2PR12MB0145; X-Forefront-PRVS: 039975700A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(7370300001)(4630300001)(6029001)(6009001)(39860400002)(199003)(189002)(54906002)(5003940100001)(6116002)(3846002)(53936002)(97736004)(575784001)(86362001)(36756003)(81156014)(81166006)(110136004)(8676002)(189998001)(50986999)(76176999)(5660300001)(2361001)(25786009)(2351001)(50226002)(4326008)(7350300001)(33646002)(478600001)(53416004)(42186005)(2906002)(105586002)(7736002)(305945005)(106356001)(48376002)(50466002)(47776003)(66066001)(6486002)(6916009)(2950100002)(6666003)(68736007)(101416001)(19627235001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR12MB0145; H:brijesh-build-machine.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR12MB0145; 23:dCXaXZVJcqFaW0xH9WpGfbpoOlKhjc/vD5nKlEZCx?= =?us-ascii?Q?r725p0Ks42UmWQayUHk8v71kxFh/KOERAeoZwWumgID9F2YkZkpDCnf5pbJS?= =?us-ascii?Q?NrQAoFVuzsWPhAi1SxnHmSZZjMtQspo9/evZlV/Ys/MXMuIFLJ2wfkkHbtE3?= =?us-ascii?Q?FErN5X80kQE8bySnnbVF1mp1EoGL1xCMqoJtUOBugMRGvbMw3dDnC8v3jRnT?= =?us-ascii?Q?uUUVvexva440uwI9NxJedvHAoaauS1Rud33p9je1GAAt11aBVUmrG09Vcwf/?= =?us-ascii?Q?XLJ8aaLq2ME48nOZU8QA1wWNQjLGHymC1TM1KzaoPhywLhANjdM/ufbigA1z?= =?us-ascii?Q?fiymEKT5QpGzh53GYK+qsUSAtDPC3nGk4Tp5DeypmNmTv/Fr8r5CWf0Vijvx?= =?us-ascii?Q?7cxRGdi1djUzoyAGc5lb1vZps1RUFF5QRceUXG2EC+fedt9KON20G3rOq/2U?= =?us-ascii?Q?lNMZ31ENxQ781Pa1DhC24yitJttg/3s36qQXKg/ruJTOoACcSrIW5gz6yq/p?= =?us-ascii?Q?/Z7lGs9BtybwvdyYhhYVxR8K+t2ig1/U44h8I1Ckm2L9qIH7FfXxgiDdk56e?= =?us-ascii?Q?pFVS7J+3U0Gis1PpNRaRH7vnZEKSHoIeXnY3gNP5hDVzmZ6XWPx8aSIbqjEq?= =?us-ascii?Q?wTPzWaI/ZoN++nlRqhDS2Lpi94bKA51gfCjLbmXC5EYYB4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XcSZsdiHGkw==; 5:lF6WYGElSSHI8wuKdFywPJgulxTDpNlg1IMa6mo7EwUqBdxvJWQHbNybnkKGFmuPeWR32eSf6yWvzXOeGCv61pyCWvIQOdl/2TBIcTOQ1HXj4YmA4zWXBCNg0MZH3lY469qGhV/2V+cIdYFndbMCUw==; 24:sfkse1Lng6aYN7si9KAMJw6jLgHBm05jcJbTsUZth0VbbQsWnjgqTBrSrTpy47aYUUQZTPm34jVSF7yNwUT5MTHVYoVGp6XV/Ge3AChMdSQ=; 7:IrTlKMd47bRw9DAscpcHa8vj+r27wc/I8k2kFwVAetnVWmbOMyEKbtaPjb/7Lj9y32YbvC7QU7P8jPaWjaUFz/uPW7NrvtjZPEBR2qQuu2qNlUVP1l6XYN0f9WNME+kHTm0Arpr8mM3cHlCoTwyRuEw6mExwjUw+1bJaTs5bUN3gcfWSFevhqqHgsfCFd8FB7Oi0cSq6OFXEJISVpUBkLRr5tC2cK3b0v+6AGkLSLCk= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 20:V5i+7nP5ddbwbePIJCgdtYoo/1zintDCqPYkB1N0aUuPQV66XFom1LNKk08gRYBzILjbB20eCoEDLk7jb3WA7h6t1CJLeUYcebxpt0LOF0fk7/a4Oloa6OEoWF3AvR1rqUecvTZ85DcXuo7IxohIDW0UMk1VvdIrNVaDCaFqDZd0X3E7XkqIOvdMdn2CswSSUeQNlfsMEEhiUQ6e/Iw9uukjrXdwozOWRlaW++ypfmEy6ODldaSicg7GhnDHPNht X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2017 11:37:15.3305 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0145 Subject: [edk2] [PATCH v2 10/23] OvmfPkg/VirtioLib: add VirtioMapAllBytesInSharedBuffer() helper function X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen , Tom Lendacky , Laszlo Ersek , Ard Biesheuvel Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The function can be used for mapping the system physical address to virtio device address using VIRTIO_DEVICE_PROTOCOL.MapSharedBuffer (). The function helps centralizing error handling, and it allows caller to pass in constant or other evaluated expression for NumberOfBytes. Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Tom Lendacky Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Brijesh Singh --- OvmfPkg/Include/Library/VirtioLib.h | 44 +++++++++++ OvmfPkg/Library/VirtioLib/VirtioLib.c | 78 ++++++++++++++++++++ 2 files changed, 122 insertions(+) diff --git a/OvmfPkg/Include/Library/VirtioLib.h b/OvmfPkg/Include/Library/= VirtioLib.h index 5badfb32917f..d8f24a5d68b1 100644 --- a/OvmfPkg/Include/Library/VirtioLib.h +++ b/OvmfPkg/Include/Library/VirtioLib.h @@ -3,6 +3,7 @@ Declarations of utility functions used by virtio device drivers. =20 Copyright (C) 2012-2016, Red Hat, Inc. + Copyright (C) 2017, AMD Inc, All rights reserved.
=20 This program and the accompanying materials are licensed and made availa= ble under the terms and conditions of the BSD License which accompanies this @@ -235,4 +236,47 @@ Virtio10WriteFeatures ( IN OUT UINT8 *DeviceStatus ); =20 +/** + Provides the virtio device address required to access system memory from= a + DMA bus master. + + @param[in] This The protocol instance pointer. + + @param[in] Operation Indicates if the bus master is going to + read or write to system memory. + + @param[in] HostAddress The system memory address to map to shar= ed + buffer address. + + @param[in,out] NumberOfBytes On input the number of bytes to map. + On output the number of bytes that were + mapped. + + @param[out] DeviceAddress The resulting shared map address for the + bus master to access the hosts HostAddre= ss. + + @param[out] Mapping A resulting taken to pass to + VIRTIO_UNMAP_SHARED. + + + @retval EFI_SUCCESS The range was mapped for the returned + NumberOfBytes. + @retval EFI_UNSUPPORTED The HostAddress cannot be mapped as a + common buffer. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_OUT_OF_RESOURCES The request could not be completed due to + a lack of resources. + @retval EFI_DEVICE_ERROR The system hardware could not map the + requested address. +**/ +EFI_STATUS +EFIAPI +VirtioMapAllBytesInSharedBuffer ( + IN VIRTIO_DEVICE_PROTOCOL *VirtIo, + IN VIRTIO_MAP_OPERATION Operation, + IN VOID *HostAddress, + IN UINTN NumberOfBytes, + OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, + OUT VOID **Mapping + ); #endif // _VIRTIO_LIB_H_ diff --git a/OvmfPkg/Library/VirtioLib/VirtioLib.c b/OvmfPkg/Library/Virtio= Lib/VirtioLib.c index 845f206369a3..ac0ae97f3692 100644 --- a/OvmfPkg/Library/VirtioLib/VirtioLib.c +++ b/OvmfPkg/Library/VirtioLib/VirtioLib.c @@ -4,6 +4,7 @@ =20 Copyright (C) 2012-2016, Red Hat, Inc. Portion of Copyright (C) 2013, ARM Ltd. + Copyright (C) 2017, AMD Inc, All rights reserved.
=20 This program and the accompanying materials are licensed and made availa= ble under the terms and conditions of the BSD License which accompanies this @@ -414,3 +415,80 @@ Virtio10WriteFeatures ( =20 return Status; } + +/** + Provides the virtio device address required to access system memory from= a + DMA bus master. + + @param[in] This The protocol instance pointer. + + @param[in] Operation Indicates if the bus master is going to + read or write to system memory. + + @param[in] HostAddress The system memory address to map to shar= ed + buffer address. + + @param[in,out] NumberOfBytes On input the number of bytes to map. + On output the number of bytes that were + mapped. + + @param[out] DeviceAddress The resulting shared map address for the + bus master to access the hosts HostAddre= ss. + + @param[out] Mapping A resulting taken to pass to + VIRTIO_UNMAP_SHARED. + + + @retval EFI_SUCCESS The range was mapped for the returned + NumberOfBytes. + @retval EFI_UNSUPPORTED The HostAddress cannot be mapped as a + common buffer. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_OUT_OF_RESOURCES The request could not be completed due to + a lack of resources. + @retval EFI_DEVICE_ERROR The system hardware could not map the + requested address. +**/ +EFI_STATUS +EFIAPI +VirtioMapAllBytesInSharedBuffer ( + IN VIRTIO_DEVICE_PROTOCOL *VirtIo, + IN VIRTIO_MAP_OPERATION Operation, + IN VOID *HostAddress, + IN UINTN NumberOfBytes, + OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, + OUT VOID **Mapping + ) +{ + EFI_STATUS Status; + VOID *MapInfo; + UINTN Size; + EFI_PHYSICAL_ADDRESS PhysicalAddress; + + Size =3D NumberOfBytes; + Status =3D VirtIo->MapSharedBuffer ( + VirtIo, + Operation, + HostAddress, + &Size, + &PhysicalAddress, + &MapInfo + ); + if (EFI_ERROR (Status)) { + return Status; + } + + if (Size < NumberOfBytes) { + goto Failed; + } + + *Mapping =3D MapInfo; + *DeviceAddress =3D PhysicalAddress; + + return EFI_SUCCESS; + +Failed: + VirtIo->UnmapSharedBuffer (VirtIo, MapInfo); + *Mapping =3D NULL; + return EFI_OUT_OF_RESOURCES; +} --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Fri Dec 27 01:42:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1502710672182571.2036752422781; Mon, 14 Aug 2017 04:37:52 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 4C02121D0A25C; Mon, 14 Aug 2017 04:34:56 -0700 (PDT) Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0076.outbound.protection.outlook.com [104.47.40.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id B67BA21D0A252 for ; Mon, 14 Aug 2017 04:34:54 -0700 (PDT) Received: from brijesh-build-machine.amd.com (165.204.77.1) by BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1341.21; Mon, 14 Aug 2017 11:37:16 +0000 X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=EZCx28wx2X4AteNCeUPuKegiRd6y7+8XhcrOMrfaPus=; b=HxGo37oBtyIlUDDyHYuy0a+FNmMiRAQdhfOl7GiRyiMDg50LbrekctC4Zd01IzFyy+iRB6Nj1D+2Cd+TYS0cxu6i8+DELzmpeX5ETF6QB1nICtu948V/s1MfH9r9Gp2ck5JG5EFSYcA6L6YXTrx8w/WcftIiaBPsWmiPC8+wme0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; From: Brijesh Singh To: edk2-devel@lists.01.org Date: Mon, 14 Aug 2017 07:36:33 -0400 Message-Id: <1502710605-8058-12-git-send-email-brijesh.singh@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> References: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: MWHPR15CA0043.namprd15.prod.outlook.com (10.173.226.157) To BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a0b94979-c713-4cc4-c1f9-08d4e308d0d4 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BY2PR12MB0145; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 3:kOl1k7vdkFW2Z0qN6vceNwio2tSkegjyKaM1o5hEETaJokLZJHghYVvUqtOvqpOC71G5C+2MOsjd3OxPwh/W2W94RY03VK4szcVlfiAzLIBgkzHj2xvGZic+I8ZIN1kPTtbhGkHA3zml4ShfGI7uLyXEO3NwfXzLpH+EdH3OLm8JZQGFwU9/icrIiSlUAlwleMNCW/6EGsDtyWIjTFmJ3cVJPxSwchj2saU/SjO/Xyl5Tcp84fUGw4UrZBrtWgiq; 25:+PnJRoWjY+sIVjdhBicbHfDQI8RJw3kjNBG/nGI2DLxbm5ryxa7mXVEmBud490S94J+o09Lj4PP0flo1OUn56Sz7PUUUjGCgRbGwdxsSwbWvKEe8FZ4A0KUGBdZb1xG04M+dmU+qUQ1LstnQ/g3koO/0SveEdA3193FkzLIRMLqLgyT4f8d18rfhqQCnEOitUdyV/kuhCdk7fjttpDWsvbpJWw2jkSWFf+auVMHkzYJBRIV8TQ0WQgHJbgO/xnqX5jyUQJ9+q45T7eYvTpCDf3xY7f6JH/0eBGgEJtkQWN1mQDuJ7Xz1OzawPm3dFWWwnQGXRYtgAcjoj/KhcJNeUQ==; 31:FCeuQXsFoV/egqb+bX+IGwjcoW6BcbEznU4d5iqIfryuVGe55uX1SToazLtMI4KK35P0JnyNWCQPl34kvrN9PfExXOJHcLfbpBs1bczu4i34e6JNOymaUKzyVwhXu3cmbk7lLCt3xBPx/tT8bmE0J8ZwirY0F4y3PfogfdBDE5ReiPnonyCkHdMFl673G+79TnyxAU9j4kNPY6h4QJDdm8V0mG+f1eQLesAfIzLnwiU= X-MS-TrafficTypeDiagnostic: BY2PR12MB0145: X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 20:ciMN280a5uv5pxFPVSM3kPRVp9d6e9uo2eTsVCFAeMVa1Xvf3QteRNisCwe8Iv5phkN9h1eny1Ec+BbaXM5zwV6+4wp8FnYfTmGIAebcqQOHiOvJ52iwqQRa2Wt4xIfq4SQYZFUhJeXLoySbIpkbGPBGsUrg9HWCZAgAXc3heL/1tHdDsGeH0oHzoZ26TXhUIrG5BwOM4qHi/NBYzx5K9g3u9RHwDxQeCukEfbdG7ZOMj2AZBn6ol+GHFPGJaiqDWHJizZFFYpSisB9R+hhyN+O1Ca5uyHBdVm8yD4cAVgoKYwdA0WHSZdTFc2YtqKhXI0YOZ+vpurF1ZzIeJGYl00Gwu3kzG35iy5k1xloBh3L/wSnUa9CWrvgbAwMyA85s1Ys+c86KEJWcnOKpq67zW6IKX0Gxs3viexzLnPUXDRd/MkidPsOo1f3MMJIYQSv4oqlKeLJvbjHgKfAA/1SzZFXq2u8dLQaOU+HOWQ7GueOzUkNkOz4UXmOd7MOKKBU/; 4:VPaZwxAB+J9/BzBGgktLPKl90YvqpIJ3IqGxxCtf13pkwIDut7E0JFshNckXrYhtS75gAvseZjGQzFQQ3+WLstiz8c31jM2vJtZk6QY5o6LObFpEb9dlvMLPvPiCW+J9OzC616FvtEiDzJjok8nNcwKAx5U7osR1acCLggk3NTmr7GvZCNycU188Zt7zaet7L8ukd9vAiJ3vhKhGfUjDkTCMMeaTd2Qi+TNmVCRb4zpVTebo1K/5cEppnU8Et2hIMgI8HmTzKE7C8GoIEjA1lRAjkE7rDJLa3fzJOmwEEniN5g39plh/ghx3pONu56Gur5DaNtVuQ1bKpG09IM5bwA== X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(228905959029699); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(3002001)(6055026)(6041248)(20161123558100)(20161123560025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BY2PR12MB0145; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BY2PR12MB0145; X-Forefront-PRVS: 039975700A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(7370300001)(4630300001)(6009001)(39860400002)(199003)(189002)(51234002)(54906002)(5003940100001)(6116002)(3846002)(53936002)(97736004)(575784001)(86362001)(36756003)(81156014)(81166006)(110136004)(8676002)(189998001)(50986999)(76176999)(5660300001)(2361001)(25786009)(2351001)(50226002)(4326008)(7350300001)(33646002)(478600001)(53416004)(42186005)(2906002)(105586002)(7736002)(305945005)(106356001)(48376002)(50466002)(47776003)(66066001)(6486002)(6916009)(2950100002)(6666003)(68736007)(101416001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR12MB0145; H:brijesh-build-machine.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR12MB0145; 23:KucaFOz7ogw/8wXhIdpUfGyZ8KBZQ6ZAxXO8+CqTC?= =?us-ascii?Q?kHK/ZjQFLcUHoiN84KQXy653zPeOIj3t3NkbB0MFgXcfIFDbteRZ5hB6MEpb?= =?us-ascii?Q?gt2BHK3XcmtiEyImXyYu0+MX4monFSTHNIC+9wH6E4MW29sKerq1v2lgYSP7?= =?us-ascii?Q?kejVgSoQrp8QX/THOzSCnywxH2VZhnj7ol7BMBKEY5b2xliRdNixu81Zu35f?= =?us-ascii?Q?BirabDcmlV7qFDls5mXsLpQJjjMaXMVuPXRZbejhSJC5VLQV6hq2CiCqzwx/?= =?us-ascii?Q?kyAuNxg6LNd26RccHVma6fxIioK7q48WXCSSB52UiaWuKulNXebdYtfIYndy?= =?us-ascii?Q?KRGTTC5dOAd1Ovjzz61h3217DBLza9IaezO3PZxWld19L35gAfMftpuru70J?= =?us-ascii?Q?l0BriT4cCgzuobvFPtVw634vE2PlXvQ5GEa3KqQTFxu4somPrdBUCl03UEhr?= =?us-ascii?Q?2vjGS9DfoI3f6hSDgjcoId7o8QCEKSWVsJS9mohxb2OaqCNP5GYPp65yAO14?= =?us-ascii?Q?4TqqlG2EWcJ1x4VY7vMElp3TK+EddXQ+jCYfFoeFm8GyfG5kbYXzlyNSY6aB?= =?us-ascii?Q?JgxubiURUQCj1FIqZvVU6Mt9THM+vKGddtAVrRxMW7rAazXS4XtyJkacn0Ti?= =?us-ascii?Q?wJWvm1psTDx0GrMsFVGjUT8lFA1TIWyLLvsOi9gx7C0Kqan0URFqeNDGlJex?= =?us-ascii?Q?ihu9rJ9bSO1xo20czJfvpB5+4m2XPfEkfb86jGN6tCNTE6GrSutXRHz6w+Ag?= =?us-ascii?Q?k329ufO64PE9AempFW++ko9qNsmyVwo2MiRGB/xlsPUb6A3NQMQrsQ2RSDNx?= =?us-ascii?Q?BPZV+EvOlFsYNYxlTz96c9afjlEQQbTMcTgv6jPe8ttRJeFUviwRbsnOREDe?= =?us-ascii?Q?YG/62ko3Ijq+rlk4H+TExFxVygA82XttF20iwxy4eO5otz8kUUmnJEGLlzYy?= =?us-ascii?Q?jARoYfqv8G+ZLSa6/q4MkKiqHPKaVAQ6huDmfQu8d7/xfmVsODAJ5+Fr01wS?= =?us-ascii?Q?+fOe1IiVCB75vQdGdXbv7sU+Fo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BjQyLY+Of36sXX6Fv3Vg/+Xv9Lws1P8CqzZtxC50= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 20:jdOnqVOby3QwkhSNaBv4wPsNcfC2vED5ImCUDuP0v3Qs6TtDShLVOu7drB0sFLI6TxJm/hSXP1XH16kBeT3LRWa6wyxiak//D9DlGNTaKrk0gW8YCPEFdaPEc2cSwPgvkvdUdgL8md5ActCke7KnS8herVuskdo7yxmxOWtGVcmfBly5kSJN62e2OSymuQyuEu1CjvoANhne98pLD12KKHLKtAPsfRvscHsfnN7tNY9CH4v10Sb+8sMhEPllL4Q9 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2017 11:37:16.2992 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0145 Subject: [edk2] [PATCH v2 11/23] OvmfPkg/VirtioLib: take VirtIo instance in VirtioRingInit/VirtioRingUninit X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen , Tom Lendacky , Laszlo Ersek , Ard Biesheuvel Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Passing the VirtIo protocol instance will allow the vring to use VIRTIO_DEVICE_PROTOCOL.AllocateSharedPages () to allocate vring buffer. Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Tom Lendacky Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Brijesh Singh Reviewed-by: Laszlo Ersek --- OvmfPkg/Include/Library/VirtioLib.h | 14 ++++++++++---- OvmfPkg/Library/VirtioLib/VirtioLib.c | 14 ++++++++++---- OvmfPkg/VirtioBlkDxe/VirtioBlk.c | 7 ++++--- OvmfPkg/VirtioGpuDxe/Commands.c | 7 ++++--- OvmfPkg/VirtioNetDxe/SnpInitialize.c | 9 +++++---- OvmfPkg/VirtioNetDxe/SnpShutdown.c | 5 +++-- OvmfPkg/VirtioRngDxe/VirtioRng.c | 7 ++++--- OvmfPkg/VirtioScsiDxe/VirtioScsi.c | 7 ++++--- 8 files changed, 44 insertions(+), 26 deletions(-) diff --git a/OvmfPkg/Include/Library/VirtioLib.h b/OvmfPkg/Include/Library/= VirtioLib.h index d8f24a5d68b1..ca0b217a04eb 100644 --- a/OvmfPkg/Include/Library/VirtioLib.h +++ b/OvmfPkg/Include/Library/VirtioLib.h @@ -35,6 +35,8 @@ - 1.1 Virtqueues, - 2.3 Virtqueue Configuration. =20 + @param[in] VirtIo The virtio device which will use the ring. + @param[in] The number of descriptors to allocate for = the virtio ring, as requested by the host. =20 @@ -52,8 +54,9 @@ EFI_STATUS EFIAPI VirtioRingInit ( - IN UINT16 QueueSize, - OUT VRING *Ring + IN VIRTIO_DEVICE_PROTOCOL *VirtIo, + IN UINT16 QueueSize, + OUT VRING *Ring ); =20 =20 @@ -65,13 +68,16 @@ VirtioRingInit ( invoking this function: the VSTAT_DRIVER_OK bit must be clear in VhdrDeviceStatus. =20 - @param[out] Ring The virtio ring to clean up. + @param[in] VirtIo The virtio device which was using the ring. + + @param[out] Ring The virtio ring to clean up. =20 **/ VOID EFIAPI VirtioRingUninit ( - IN OUT VRING *Ring + IN VIRTIO_DEVICE_PROTOCOL *VirtIo, + IN OUT VRING *Ring ); =20 =20 diff --git a/OvmfPkg/Library/VirtioLib/VirtioLib.c b/OvmfPkg/Library/Virtio= Lib/VirtioLib.c index ac0ae97f3692..5b64d18a8d6f 100644 --- a/OvmfPkg/Library/VirtioLib/VirtioLib.c +++ b/OvmfPkg/Library/VirtioLib/VirtioLib.c @@ -37,6 +37,8 @@ - 1.1 Virtqueues, - 2.3 Virtqueue Configuration. =20 + @param[in] VirtIo The virtio device which will use the ring. + @param[in] The number of descriptors to allocate for = the virtio ring, as requested by the host. =20 @@ -54,8 +56,9 @@ EFI_STATUS EFIAPI VirtioRingInit ( - IN UINT16 QueueSize, - OUT VRING *Ring + IN VIRTIO_DEVICE_PROTOCOL *VirtIo, + IN UINT16 QueueSize, + OUT VRING *Ring ) { UINTN RingSize; @@ -128,13 +131,16 @@ VirtioRingInit ( invoking this function: the VSTAT_DRIVER_OK bit must be clear in VhdrDeviceStatus. =20 - @param[out] Ring The virtio ring to clean up. + @param[in] VirtIo The virtio device which was using the ring. + + @param[out] Ring The virtio ring to clean up. =20 **/ VOID EFIAPI VirtioRingUninit ( - IN OUT VRING *Ring + IN VIRTIO_DEVICE_PROTOCOL *VirtIo, + IN OUT VRING *Ring ) { FreePages (Ring->Base, Ring->NumPages); diff --git a/OvmfPkg/VirtioBlkDxe/VirtioBlk.c b/OvmfPkg/VirtioBlkDxe/Virtio= Blk.c index 3ce72281c204..61b9cab4ff02 100644 --- a/OvmfPkg/VirtioBlkDxe/VirtioBlk.c +++ b/OvmfPkg/VirtioBlkDxe/VirtioBlk.c @@ -12,6 +12,7 @@ =20 Copyright (C) 2012, Red Hat, Inc. Copyright (c) 2012 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2017, AMD Inc, All rights reserved.
=20 This program and the accompanying materials are licensed and made availa= ble under the terms and conditions of the BSD License which accompanies this @@ -722,7 +723,7 @@ VirtioBlkInit ( goto Failed; } =20 - Status =3D VirtioRingInit (QueueSize, &Dev->Ring); + Status =3D VirtioRingInit (Dev->VirtIo, QueueSize, &Dev->Ring); if (EFI_ERROR (Status)) { goto Failed; } @@ -811,7 +812,7 @@ VirtioBlkInit ( return EFI_SUCCESS; =20 ReleaseQueue: - VirtioRingUninit (&Dev->Ring); + VirtioRingUninit (Dev->VirtIo, &Dev->Ring); =20 Failed: // @@ -848,7 +849,7 @@ VirtioBlkUninit ( // Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, 0); =20 - VirtioRingUninit (&Dev->Ring); + VirtioRingUninit (Dev->VirtIo, &Dev->Ring); =20 SetMem (&Dev->BlockIo, sizeof Dev->BlockIo, 0x00); SetMem (&Dev->BlockIoMedia, sizeof Dev->BlockIoMedia, 0x00); diff --git a/OvmfPkg/VirtioGpuDxe/Commands.c b/OvmfPkg/VirtioGpuDxe/Command= s.c index 962087cfec97..c2e4d72feb67 100644 --- a/OvmfPkg/VirtioGpuDxe/Commands.c +++ b/OvmfPkg/VirtioGpuDxe/Commands.c @@ -3,6 +3,7 @@ VirtIo GPU initialization, and commands (primitives) for the GPU device. =20 Copyright (C) 2016, Red Hat, Inc. + Copyright (c) 2017, AMD Inc, All rights reserved.
=20 This program and the accompanying materials are licensed and made availa= ble under the terms and conditions of the BSD License which accompanies this @@ -127,7 +128,7 @@ VirtioGpuInit ( // // [...] population of virtqueues [...] // - Status =3D VirtioRingInit (QueueSize, &VgpuDev->Ring); + Status =3D VirtioRingInit (VgpuDev->VirtIo, QueueSize, &VgpuDev->Ring); if (EFI_ERROR (Status)) { goto Failed; } @@ -148,7 +149,7 @@ VirtioGpuInit ( return EFI_SUCCESS; =20 ReleaseQueue: - VirtioRingUninit (&VgpuDev->Ring); + VirtioRingUninit (VgpuDev->VirtIo, &VgpuDev->Ring); =20 Failed: // @@ -183,7 +184,7 @@ VirtioGpuUninit ( // configuration. // VgpuDev->VirtIo->SetDeviceStatus (VgpuDev->VirtIo, 0); - VirtioRingUninit (&VgpuDev->Ring); + VirtioRingUninit (VgpuDev->VirtIo, &VgpuDev->Ring); } =20 /** diff --git a/OvmfPkg/VirtioNetDxe/SnpInitialize.c b/OvmfPkg/VirtioNetDxe/Sn= pInitialize.c index 430670a980f2..6d9b81a9f939 100644 --- a/OvmfPkg/VirtioNetDxe/SnpInitialize.c +++ b/OvmfPkg/VirtioNetDxe/SnpInitialize.c @@ -5,6 +5,7 @@ =20 Copyright (C) 2013, Red Hat, Inc. Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+ Copyright (c) 2017, AMD Inc, All rights reserved.
=20 This program and the accompanying materials are licensed and made availa= ble under the terms and conditions of the BSD License which accompanies this @@ -73,7 +74,7 @@ VirtioNetInitRing ( if (QueueSize < 2) { return EFI_UNSUPPORTED; } - Status =3D VirtioRingInit (QueueSize, Ring); + Status =3D VirtioRingInit (Dev->VirtIo, QueueSize, Ring); if (EFI_ERROR (Status)) { return Status; } @@ -103,7 +104,7 @@ VirtioNetInitRing ( return EFI_SUCCESS; =20 ReleaseQueue: - VirtioRingUninit (Ring); + VirtioRingUninit (Dev->VirtIo, Ring); =20 return Status; } @@ -509,10 +510,10 @@ AbortDevice: Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, 0); =20 ReleaseTxRing: - VirtioRingUninit (&Dev->TxRing); + VirtioRingUninit (Dev->VirtIo, &Dev->TxRing); =20 ReleaseRxRing: - VirtioRingUninit (&Dev->RxRing); + VirtioRingUninit (Dev->VirtIo, &Dev->RxRing); =20 DeviceFailed: // diff --git a/OvmfPkg/VirtioNetDxe/SnpShutdown.c b/OvmfPkg/VirtioNetDxe/SnpS= hutdown.c index 01409c0ce714..5e84191fbbdd 100644 --- a/OvmfPkg/VirtioNetDxe/SnpShutdown.c +++ b/OvmfPkg/VirtioNetDxe/SnpShutdown.c @@ -4,6 +4,7 @@ =20 Copyright (C) 2013, Red Hat, Inc. Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+ Copyright (c) 2017, AMD Inc, All rights reserved.
=20 This program and the accompanying materials are licensed and made availa= ble under the terms and conditions of the BSD License which accompanies this @@ -66,8 +67,8 @@ VirtioNetShutdown ( Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, 0); VirtioNetShutdownRx (Dev); VirtioNetShutdownTx (Dev); - VirtioRingUninit (&Dev->TxRing); - VirtioRingUninit (&Dev->RxRing); + VirtioRingUninit (Dev->VirtIo, &Dev->TxRing); + VirtioRingUninit (Dev->VirtIo, &Dev->RxRing); =20 Dev->Snm.State =3D EfiSimpleNetworkStarted; Status =3D EFI_SUCCESS; diff --git a/OvmfPkg/VirtioRngDxe/VirtioRng.c b/OvmfPkg/VirtioRngDxe/Virtio= Rng.c index 1a186d04082a..e20602ac7225 100644 --- a/OvmfPkg/VirtioRngDxe/VirtioRng.c +++ b/OvmfPkg/VirtioRngDxe/VirtioRng.c @@ -6,6 +6,7 @@ =20 Copyright (C) 2012, Red Hat, Inc. Copyright (c) 2012 - 2014, Intel Corporation. All rights reserved.
+ Copyright (c) 2017, AMD Inc, All rights reserved.
=20 This driver: =20 @@ -275,7 +276,7 @@ VirtioRngInit ( goto Failed; } =20 - Status =3D VirtioRingInit (QueueSize, &Dev->Ring); + Status =3D VirtioRingInit (Dev->VirtIo, QueueSize, &Dev->Ring); if (EFI_ERROR (Status)) { goto Failed; } @@ -331,7 +332,7 @@ VirtioRngInit ( return EFI_SUCCESS; =20 ReleaseQueue: - VirtioRingUninit (&Dev->Ring); + VirtioRingUninit (Dev->VirtIo, &Dev->Ring); =20 Failed: // @@ -358,7 +359,7 @@ VirtioRngUninit ( // the old comms area. // Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, 0); - VirtioRingUninit (&Dev->Ring); + VirtioRingUninit (Dev->VirtIo, &Dev->Ring); } =20 // diff --git a/OvmfPkg/VirtioScsiDxe/VirtioScsi.c b/OvmfPkg/VirtioScsiDxe/Vir= tioScsi.c index c080404330e5..c2f6f412ff40 100644 --- a/OvmfPkg/VirtioScsiDxe/VirtioScsi.c +++ b/OvmfPkg/VirtioScsiDxe/VirtioScsi.c @@ -27,6 +27,7 @@ =20 Copyright (C) 2012, Red Hat, Inc. Copyright (c) 2012 - 2014, Intel Corporation. All rights reserved.
+ Copyright (c) 2017, AMD Inc, All rights reserved.
=20 This program and the accompanying materials are licensed and made availa= ble under the terms and conditions of the BSD License which accompanies this @@ -832,7 +833,7 @@ VirtioScsiInit ( goto Failed; } =20 - Status =3D VirtioRingInit (QueueSize, &Dev->Ring); + Status =3D VirtioRingInit (Dev->VirtIo, QueueSize, &Dev->Ring); if (EFI_ERROR (Status)) { goto Failed; } @@ -926,7 +927,7 @@ VirtioScsiInit ( return EFI_SUCCESS; =20 ReleaseQueue: - VirtioRingUninit (&Dev->Ring); + VirtioRingUninit (Dev->VirtIo, &Dev->Ring); =20 Failed: // @@ -964,7 +965,7 @@ VirtioScsiUninit ( Dev->MaxLun =3D 0; Dev->MaxSectors =3D 0; =20 - VirtioRingUninit (&Dev->Ring); + VirtioRingUninit (Dev->VirtIo, &Dev->Ring); =20 SetMem (&Dev->PassThru, sizeof Dev->PassThru, 0x00); SetMem (&Dev->PassThruMode, sizeof Dev->PassThruMode, 0x00); --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Fri Dec 27 01:42:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 150271067577244.351599789325746; Mon, 14 Aug 2017 04:37:55 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 84BD821D0A265; Mon, 14 Aug 2017 04:34:58 -0700 (PDT) Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0066.outbound.protection.outlook.com [104.47.40.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id DF46321D1825A for ; Mon, 14 Aug 2017 04:34:55 -0700 (PDT) Received: from brijesh-build-machine.amd.com (165.204.77.1) by BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1341.21; Mon, 14 Aug 2017 11:37:17 +0000 X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=s0+FDnWlwvBJm8s6W2LCBAzPSmGw+q868/dOXAVRR6w=; b=Ljc6yOUFxdIfUCoILq/JeOXliskO1B3YOIDBo+3HsuR8YUQEBptCTBY5e/YhpyQ7OyNEgcOO0DIuUqlMLjcGXpb6LIl753OGfHSCBTxDrITkRy3DpPitQFSd1wfRSi7sM1bfTgma2or/AbL7p3j8n/zyL8w20brw7pawLAtrxD8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; From: Brijesh Singh To: edk2-devel@lists.01.org Date: Mon, 14 Aug 2017 07:36:34 -0400 Message-Id: <1502710605-8058-13-git-send-email-brijesh.singh@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> References: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: MWHPR15CA0043.namprd15.prod.outlook.com (10.173.226.157) To BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 18232cdc-117b-42cf-58b8-08d4e308d16d X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BY2PR12MB0145; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 3:rRJ4/jnNq8i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Zxz7tdguGcu66YvtC5UQlC0YS2rtb/QnieLSxVDzjL5ETmw5i6op3vQ8koilaN0OPgg69QZqU9a2kKLB63ONIcYmwaKVX9r/QSZnxZbIvmPjIiC2bqLa4Qp1D22/rFTaSdiK6JjEYS9ONIg5yTxJcshrDciuUTtqcX5YJ5lUkMljQNiltnEvpc3I8pbDADvmHK50608K7GeWs9n4VQz/3ANCG9E6Wj7AwW4ytpYWgyKpeQwb1a2EQKMLyoulxELAIEaPcLHLSKFR2dj8z8tEkWFlOoo5Z5umYDgCzCsmWkr1PuU5Abx5EmGBJwYq/10FspfWikSpJNkDeJBHWUY; 4:AfO/s56tVQJJxTAheugX6WQRdqgg2kvTVhf9vDGRsUKJVWK8AJOUXIKUXgZ8wtGfLxDUwoIWx0qVkjwptGdW7DqgxXUbG6J+ycg6BgdIgR0TiKrFTWn7CgwDOlOPmhqIniu+BNLofHHm5HSgMKdgqDIclIibDP5vUbt4XLibekS2acgt2DcZoZxJp+/a/iawbY7E2pOPWsFHlVKdf9pd5kN0va7bzp5+3rsjxNqKtAiQYvD3Rvg5fCJKEJ1Ck4hZhFyayHmUTc8gjz5jSnWqow2BHHGzU9F2LTrvfckl9mPJDVnBR4YmIjLJkYl407Bv1EUckAg3LxFpxK7uF9e70w== X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(228905959029699); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(3002001)(6055026)(6041248)(20161123558100)(20161123560025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BY2PR12MB0145; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BY2PR12MB0145; X-Forefront-PRVS: 039975700A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(7370300001)(4630300001)(6009001)(39860400002)(199003)(189002)(54906002)(5003940100001)(6116002)(3846002)(53936002)(97736004)(575784001)(86362001)(36756003)(81156014)(81166006)(110136004)(8676002)(189998001)(50986999)(76176999)(5660300001)(2361001)(25786009)(2351001)(50226002)(4326008)(7350300001)(33646002)(478600001)(53416004)(42186005)(2906002)(105586002)(7736002)(305945005)(106356001)(48376002)(50466002)(47776003)(66066001)(6486002)(6916009)(2950100002)(6666003)(68736007)(101416001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR12MB0145; H:brijesh-build-machine.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR12MB0145; 23:NVyz2GIIsfqu+O2xoldsHADV9Krofx6XlrLBzrc9T?= =?us-ascii?Q?FQQyATQdGYnw9yIUgnt8xwimozjeRMFJFoICj5iIq1QNu+BGkX7ZEzlDUrrp?= =?us-ascii?Q?Ri+G0m/FafMBZz+i2ucexaH0+BLzOAH9dcsiOmKwr9gODcjFAi2wujsRfZiS?= =?us-ascii?Q?gbfcwZXxbLxyrkYiTVoJGYWIa5NwuvbDy2/OcK+SD3vTDc+UnTgYh5cY6eyQ?= =?us-ascii?Q?QemAFofygYMarHUTPR6x6c5LccN/5C5QhSokbJihTcsWi0aPPoryrCYT2tj7?= =?us-ascii?Q?+OFF5jXcT4JX3wPfsvgyX3c/QNg8e6ZOwhwp+bf7Po5fo7CpKBnqXnCzwRKZ?= =?us-ascii?Q?GVlMN702L657s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clQDJRpPrFyXvupk+ZRcgyIlqDpyHvD74vuEXXj/iwN50vyc8FXfE28H5falK1EqnXKC1909hOcNo2pFJo4wVtkRG1NulMx3Q/LphZkd X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2017 11:37:17.2992 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0145 Subject: [edk2] [PATCH v2 12/23] OvmfPkg/VirtioLib: add functions to map/unmap VRING X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen , Tom Lendacky , Laszlo Ersek , Ard Biesheuvel Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add functions to map and unmap the ring buffer with BusMasterCommonBuffer so that ring can be accessed by both guest and hypervisor. Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Tom Lendacky Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Brijesh Singh --- OvmfPkg/Include/Library/VirtioLib.h | 25 +++++++++++ OvmfPkg/Library/VirtioLib/VirtioLib.c | 44 ++++++++++++++++++++ 2 files changed, 69 insertions(+) diff --git a/OvmfPkg/Include/Library/VirtioLib.h b/OvmfPkg/Include/Library/= VirtioLib.h index ca0b217a04eb..1efb02a68cf1 100644 --- a/OvmfPkg/Include/Library/VirtioLib.h +++ b/OvmfPkg/Include/Library/VirtioLib.h @@ -62,6 +62,31 @@ VirtioRingInit ( =20 /** =20 + Map the ring buffer so that it can be accessed equally by both guest + and hypervisor. + + @param[in] VirtIo The virtio device instance. + + @param[in] Ring The virtio ring to map. + + @param[out] RingBaseShift =20 + + @param[out] Mapping A resulting token to pass to + VirtIo->UnmapSharedBuffer(). + + @return Status from VirtIo->MapSharedBuffer() +**/ +EFI_STATUS +EFIAPI +VirtioRingMap ( + IN VIRTIO_DEVICE_PROTOCOL *VirtIo, + IN VRING *Ring, + OUT UINT64 *RingBaseShift, + OUT VOID **Mapping + ); + +/** + Tear down the internal resources of a configured virtio ring. =20 The caller is responsible to stop the host from using this ring before diff --git a/OvmfPkg/Library/VirtioLib/VirtioLib.c b/OvmfPkg/Library/Virtio= Lib/VirtioLib.c index 5b64d18a8d6f..7d07dcc09d3d 100644 --- a/OvmfPkg/Library/VirtioLib/VirtioLib.c +++ b/OvmfPkg/Library/VirtioLib/VirtioLib.c @@ -498,3 +498,47 @@ Failed: *Mapping =3D NULL; return EFI_OUT_OF_RESOURCES; } + +/** + + Map the ring buffer so that it can be accessed equally by both guest + and hypervisor. + + @param[in] VirtIo The virtio device instance. + + @param[in] Ring The virtio ring to map. + + @param[out] RingBaseShift RingBaseShift + + @param[out] Mapping A resulting token to pass to + VirtIo->UnmapSharedBuffer(). + + @return Status code from VirtIo->MapSharedBuffer() +**/ +EFI_STATUS +EFIAPI +VirtioRingMap ( + IN VIRTIO_DEVICE_PROTOCOL *VirtIo, + IN VRING *Ring, + OUT UINT64 *RingBaseShift, + OUT VOID **Mapping + ) +{ + EFI_STATUS Status; + PHYSICAL_ADDRESS DeviceAddress; + + Status =3D VirtioMapAllBytesInSharedBuffer ( + VirtIo, + VirtioOperationBusMasterCommonBuffer, + Ring->Base, + EFI_PAGES_TO_SIZE (Ring->NumPages), + &DeviceAddress, + Mapping + ); + if (EFI_ERROR (Status)) { + return Status; + } + + *RingBaseShift =3D DeviceAddress - (UINT64)(UINTN)Ring->Base; + return EFI_SUCCESS; +} --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Fri Dec 27 01:42:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1502710679654437.3689197740009; Mon, 14 Aug 2017 04:37:59 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id BEBB521D0A270; Mon, 14 Aug 2017 04:34:58 -0700 (PDT) Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0089.outbound.protection.outlook.com [104.47.40.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 04A9621D1825A for ; Mon, 14 Aug 2017 04:34:57 -0700 (PDT) Received: from brijesh-build-machine.amd.com (165.204.77.1) by BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1341.21; Mon, 14 Aug 2017 11:37:18 +0000 X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=DwJN2SZb+h8CsxoQN2/Y+4/j3q72TkT1RgwDxyMjSN4=; b=KcdOSrnhwVJvsVkx8JGOZCIiK+qKn7ZfoWNPq9t0k0c3ScDNUwtIlC4vys2bxzHLXB5wr/L3iE2xZXr+pLTCfwmRptadjiRew8gblJ7dligM+wJB8BB5sUVjJ6QMJ93pdTh7rO1MLGXFcJ532m5W5bk3xy8HGItTHLvLlnbGC5Y= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; From: Brijesh Singh To: edk2-devel@lists.01.org Date: Mon, 14 Aug 2017 07:36:35 -0400 Message-Id: <1502710605-8058-14-git-send-email-brijesh.singh@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> References: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: MWHPR15CA0043.namprd15.prod.outlook.com (10.173.226.157) To BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 77fad79b-586f-47e2-ef71-08d4e308d205 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BY2PR12MB0145; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 3:Y+PyjHcemvxltsgLX4XU22KtFqAQhUQqcjd8vL/64KxohtUEhzUMQdFjMc4ELl98PP04Ocz6Jgh9h0Csuj1NHO29x42rDoTbt/flSNggwEzUz8uysxDixjpnG3w74JxffFkXR6CaD9hbJhuu+hVNc2MfO/RFE1k14K5TflZY3Gnj8uqqx5NxG7OnLxI71W/L0BoRjUJKhr9WOnuwF024Wk5hxtYLtzrbQWIhwq/bp74Thfpcd40cBKXSaRWDe1m+; 25:E2i/Z1ziCts0EZFxhZ4VYdrAO+PRiZaWxDSDFneRVpSfFjun5luSbYdZfbaorfqN7pQ1xuwUyKGzkhDkwqM8I1R8ODTZ4IzsC34t2M6U7G/bTqkQpRXW1ivKds591rpXv9BkbgLK8WPem3TzCCvFNbqGV+GXJ6wjIkuLMXjsljUaRDtBziXs7Pe1cQwA7+OC2VX2Rkq6lYdneW98Ex78+rM7BTZDSJKQq4cNQIBVxZSsh6n86PLh+W75tbGJjUOg0Vy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iDcn60OZ+CUGJe6OWn4/ATptixhO0RoabmIDSrYYtnQTabKGacrCMuujwiw8q4Pb1kyBVdKpESwZAWh98NodPr1rOElKAa7aWtPd99y+EoEk/qGKHpm6MpqRZuy2Y3iORjT+/TOslmUlksVogjwrDqlmriifv+CCAwTBJi6vr7mrTR/LyiQL5+TBXukUBKxng== X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(228905959029699); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(3002001)(6055026)(6041248)(20161123558100)(20161123560025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BY2PR12MB0145; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BY2PR12MB0145; X-Forefront-PRVS: 039975700A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(7370300001)(4630300001)(6009001)(39860400002)(199003)(189002)(54906002)(5003940100001)(6116002)(3846002)(53936002)(97736004)(575784001)(86362001)(36756003)(81156014)(81166006)(110136004)(8676002)(189998001)(50986999)(76176999)(5660300001)(2361001)(25786009)(2351001)(50226002)(4326008)(7350300001)(33646002)(478600001)(53416004)(42186005)(2906002)(105586002)(7736002)(305945005)(106356001)(48376002)(50466002)(47776003)(66066001)(6486002)(6916009)(2950100002)(6666003)(68736007)(101416001)(19627235001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR12MB0145; H:brijesh-build-machine.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR12MB0145; 23:JUf22kGWkRAtfFncyFIJihWU046ZHdpJa5TBgXfX7?= =?us-ascii?Q?NJW+f61bBvIxL7Eoi+9az9Lu90P8xxOrET96+VE4iBs8Cc6mLaXjdWIsi+0V?= =?us-ascii?Q?ZHb9yn69Fi9RisYwVsK0QiDk8eLH98J2RyRxopgPRKvfdgc3ZJDVaipoiAkF?= =?us-ascii?Q?e5g0B6fGjPLKDZemeSV7agRuUoJ+ccDlT1n7aiTOF/J3j+vYoJjwbvwarBsB?= =?us-ascii?Q?rkZdWB1JI/FWC2VZPC/89Bg44iZTv4QN0XD1bFQ1QaxFchRllptGxmCx2fqX?= =?us-ascii?Q?+ocRKBbNBCn9gn8cOjj4lzW/jJP1OAI0EfVqLc1rr+KMXhPdriW+ZKsBbfCE?= =?us-ascii?Q?sfAjGY51H/zPr/Z1glyCIqJuZKxOnUBEw4sd33vtHsukeO7nVPRKz6HAkOc9?= =?us-ascii?Q?ewAdWUA67KFSARcvcKNYwlD+HClxyvvNDiARV0VbqcY7AfuYTJlorPXRtVx3?= =?us-ascii?Q?IrlvQK1wbr4/sjOLh3zkjaKSEBJDOCs8mKknq+5dSKijWm5TN4pl2WXgeN/G?= =?us-ascii?Q?bJrAKExxm8h7w4ZJzm+72CgzPvJtk3tIjcXWxlIZccm299qHOI+lTRF56hWg?= =?us-ascii?Q?8cYDxl4HuiuaMZafbtfvaj1t4+boiwGuAdeANz8MWkDVh3lOAWt4ShVPxdbv?= =?us-ascii?Q?JVnsxA8BRvdMKZCZSi66ZktFDYRyduQ/DUZZuv0+mtbMEqBfBW/g2gMIwm0F?= =?us-ascii?Q?heI3Yf8SdZsQhzUp6lEb/RAt23nNN5DqXwu4mwBaQ44QZpNrD5i5cDIekWkJ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PiNNQlUKHvbht+Brepa3Lg0JmU3IJA==; 24:Oa25ZMG3zgVJ5qNHZENIzCQmXqdPVc5nMirSxVM7NASeDrBcvBxWjNyZBKKJXLUZhtEJRF3i7vncbYIBZsKJJL5Tf57aFi1wDifW6UgXfYE=; 7:/XyW39UoydpBXy363XPtUgXxaTHzhghAErDQTiV1yfiBvcWHWcJhgAiqnjsI0MZMzhWkzzWNZv4ahtNLBeROHOrkWOPT6iPQMuGHOYkpAAcI9hIJ4hnRI05DmmV88p9UzoWYxjXk4BOsNV2SGOoYmqNXHCbkqmvtmd9u95EUhvw9BfCKtnAhGuC6nQ9s26ymaB+bVsTDu5PwNtgvRXUC8k5kZu2rFfua5h28Q8b1LOA= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 20:C393i33zdPj8t2antRSNmPtAl5X0O/zSI7/xTINPZuBQdCY0IyMAtIsOTytJ1CmpzngdR7ocSIyQgl8skcZNx6DJfX3Df3BGYmBGGrVYPBW9C3tjA4EfbXaiSQYc9niN19qlOYy6GwgqfXCeIF38GwWFkRHT12kvkopbP2Oiq+ov/FU0qXepjdO46eh7vh0sD9/gllMGWFL53GnPlxvhgXaBeQ9/8FcDNzgbkK/sIVdym+KjXjIA8yUa7U3ndG1R X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2017 11:37:18.2680 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0145 Subject: [edk2] [PATCH v2 13/23] OvmfPkg/Virtio: take RingBaseShift in VirtioSetQueueAddress() X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen , Tom Lendacky , Laszlo Ersek , Ard Biesheuvel Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" VirtioRingMap() maps the ring buffer system physical to a bus address. When an IOMMU is used for translating the address then bus address can start at a different offset from the system physical address. - MMIO and legacy virtio device does not use IOMMU to translate the addresses hence RingBaseShift will always be set to zero. - modern virtio device use IOMMU to translate the address, in next patch we will update the Virtio10Dxe to use RingBaseShift offset. Suggested-by: Laszlo Ersek Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Tom Lendacky Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Brijesh Singh --- OvmfPkg/Include/Protocol/VirtioDevice.h | 5 ++++- OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.h | 3 ++- OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.h | 3 ++- OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceFunctions.c | 5 ++++- OvmfPkg/Virtio10Dxe/Virtio10.c | 5 ++++- OvmfPkg/VirtioBlkDxe/VirtioBlk.c | 2 +- OvmfPkg/VirtioGpuDxe/Commands.c | 3 ++- OvmfPkg/VirtioNetDxe/SnpInitialize.c | 2 +- OvmfPkg/VirtioPciDeviceDxe/VirtioPciFunctions.c | 5 ++++- OvmfPkg/VirtioRngDxe/VirtioRng.c | 2 +- OvmfPkg/VirtioScsiDxe/VirtioScsi.c | 2 +- 11 files changed, 26 insertions(+), 11 deletions(-) diff --git a/OvmfPkg/Include/Protocol/VirtioDevice.h b/OvmfPkg/Include/Prot= ocol/VirtioDevice.h index 14f980d7bf0a..25fd73b847a5 100644 --- a/OvmfPkg/Include/Protocol/VirtioDevice.h +++ b/OvmfPkg/Include/Protocol/VirtioDevice.h @@ -156,6 +156,8 @@ EFI_STATUS @param[in] Ring The initialized VRING object to take the addresses from. =20 + @param[in] RingBaseShift The offset for the Ring Base address. + @retval EFI_SUCCESS The data was written successfully. @retval EFI_UNSUPPORTED The underlying IO device doesn't support the provided address offset and write size. @@ -164,7 +166,8 @@ typedef EFI_STATUS (EFIAPI *VIRTIO_SET_QUEUE_ADDRESS) ( IN VIRTIO_DEVICE_PROTOCOL *This, - IN VRING *Ring + IN VRING *Ring, + IN UINT64 RingBaseShift ); =20 /** diff --git a/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.h b/OvmfP= kg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.h index b69f6d7b7a85..b5cc091fe820 100644 --- a/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.h +++ b/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.h @@ -113,7 +113,8 @@ VirtioMmioSetQueueSel ( EFI_STATUS VirtioMmioSetQueueAddress ( IN VIRTIO_DEVICE_PROTOCOL *This, - IN VRING *Ring + IN VRING *Ring, + IN UINT64 RingBaseShift ); =20 EFI_STATUS diff --git a/OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.h b/OvmfPkg/VirtioP= ciDeviceDxe/VirtioPciDevice.h index 41df5a98e560..1f0dc45d501e 100644 --- a/OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.h +++ b/OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.h @@ -126,7 +126,8 @@ EFI_STATUS EFIAPI VirtioPciSetQueueAddress ( IN VIRTIO_DEVICE_PROTOCOL *This, - IN VRING *Ring + IN VRING *Ring, + IN UINT64 RingBaseShift ); =20 EFI_STATUS diff --git a/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceFunctions.= c b/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceFunctions.c index f3f69f324c6c..3d14b1035e91 100644 --- a/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceFunctions.c +++ b/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceFunctions.c @@ -183,11 +183,14 @@ VirtioMmioSetQueueSel ( EFI_STATUS VirtioMmioSetQueueAddress ( IN VIRTIO_DEVICE_PROTOCOL *This, - IN VRING *Ring + IN VRING *Ring, + IN UINT64 RingBaseShift ) { VIRTIO_MMIO_DEVICE *Device; =20 + ASSERT (RingBaseShift =3D=3D 0); + Device =3D VIRTIO_MMIO_DEVICE_FROM_VIRTIO_DEVICE (This); =20 VIRTIO_CFG_WRITE (Device, VIRTIO_MMIO_OFFSET_QUEUE_PFN, diff --git a/OvmfPkg/Virtio10Dxe/Virtio10.c b/OvmfPkg/Virtio10Dxe/Virtio10.c index 413ffa06cf35..d102e1fd8551 100644 --- a/OvmfPkg/Virtio10Dxe/Virtio10.c +++ b/OvmfPkg/Virtio10Dxe/Virtio10.c @@ -489,7 +489,8 @@ EFI_STATUS EFIAPI Virtio10SetQueueAddress ( IN VIRTIO_DEVICE_PROTOCOL *This, - IN VRING *Ring + IN VRING *Ring, + IN UINT64 RingBaseShift ) { VIRTIO_1_0_DEV *Dev; @@ -497,6 +498,8 @@ Virtio10SetQueueAddress ( UINT64 Address; UINT16 Enable; =20 + ASSERT (RingBaseShift =3D=3D 0); + Dev =3D VIRTIO_1_0_FROM_VIRTIO_DEVICE (This); =20 Address =3D (UINTN)Ring->Desc; diff --git a/OvmfPkg/VirtioBlkDxe/VirtioBlk.c b/OvmfPkg/VirtioBlkDxe/Virtio= Blk.c index 61b9cab4ff02..bff15fe3add1 100644 --- a/OvmfPkg/VirtioBlkDxe/VirtioBlk.c +++ b/OvmfPkg/VirtioBlkDxe/VirtioBlk.c @@ -745,7 +745,7 @@ VirtioBlkInit ( // // step 4c -- Report GPFN (guest-physical frame number) of queue. // - Status =3D Dev->VirtIo->SetQueueAddress (Dev->VirtIo, &Dev->Ring); + Status =3D Dev->VirtIo->SetQueueAddress (Dev->VirtIo, &Dev->Ring, 0); if (EFI_ERROR (Status)) { goto ReleaseQueue; } diff --git a/OvmfPkg/VirtioGpuDxe/Commands.c b/OvmfPkg/VirtioGpuDxe/Command= s.c index c2e4d72feb67..df8ded99edff 100644 --- a/OvmfPkg/VirtioGpuDxe/Commands.c +++ b/OvmfPkg/VirtioGpuDxe/Commands.c @@ -132,7 +132,8 @@ VirtioGpuInit ( if (EFI_ERROR (Status)) { goto Failed; } - Status =3D VgpuDev->VirtIo->SetQueueAddress (VgpuDev->VirtIo, &VgpuDev->= Ring); + Status =3D VgpuDev->VirtIo->SetQueueAddress (VgpuDev->VirtIo, + &VgpuDev->Ring, 0); if (EFI_ERROR (Status)) { goto ReleaseQueue; } diff --git a/OvmfPkg/VirtioNetDxe/SnpInitialize.c b/OvmfPkg/VirtioNetDxe/Sn= pInitialize.c index 6d9b81a9f939..0ecfe044a977 100644 --- a/OvmfPkg/VirtioNetDxe/SnpInitialize.c +++ b/OvmfPkg/VirtioNetDxe/SnpInitialize.c @@ -96,7 +96,7 @@ VirtioNetInitRing ( // // step 4c -- report GPFN (guest-physical frame number) of queue // - Status =3D Dev->VirtIo->SetQueueAddress (Dev->VirtIo, Ring); + Status =3D Dev->VirtIo->SetQueueAddress (Dev->VirtIo, Ring, 0); if (EFI_ERROR (Status)) { goto ReleaseQueue; } diff --git a/OvmfPkg/VirtioPciDeviceDxe/VirtioPciFunctions.c b/OvmfPkg/Virt= ioPciDeviceDxe/VirtioPciFunctions.c index 4597095deb78..86f752e1651f 100644 --- a/OvmfPkg/VirtioPciDeviceDxe/VirtioPciFunctions.c +++ b/OvmfPkg/VirtioPciDeviceDxe/VirtioPciFunctions.c @@ -183,11 +183,14 @@ EFI_STATUS EFIAPI VirtioPciSetQueueAddress ( IN VIRTIO_DEVICE_PROTOCOL *This, - IN VRING *Ring + IN VRING *Ring, + IN UINT64 RingBaseShift ) { VIRTIO_PCI_DEVICE *Dev; =20 + ASSERT (RingBaseShift =3D=3D 0); + Dev =3D VIRTIO_PCI_DEVICE_FROM_VIRTIO_DEVICE (This); =20 return VirtioPciIoWrite (Dev, VIRTIO_PCI_OFFSET_QUEUE_ADDRESS, sizeof (U= INT32), diff --git a/OvmfPkg/VirtioRngDxe/VirtioRng.c b/OvmfPkg/VirtioRngDxe/Virtio= Rng.c index e20602ac7225..0abca488e6cd 100644 --- a/OvmfPkg/VirtioRngDxe/VirtioRng.c +++ b/OvmfPkg/VirtioRngDxe/VirtioRng.c @@ -298,7 +298,7 @@ VirtioRngInit ( // // step 4c -- Report GPFN (guest-physical frame number) of queue. // - Status =3D Dev->VirtIo->SetQueueAddress (Dev->VirtIo, &Dev->Ring); + Status =3D Dev->VirtIo->SetQueueAddress (Dev->VirtIo, &Dev->Ring, 0); if (EFI_ERROR (Status)) { goto ReleaseQueue; } diff --git a/OvmfPkg/VirtioScsiDxe/VirtioScsi.c b/OvmfPkg/VirtioScsiDxe/Vir= tioScsi.c index c2f6f412ff40..a983b3df7b9c 100644 --- a/OvmfPkg/VirtioScsiDxe/VirtioScsi.c +++ b/OvmfPkg/VirtioScsiDxe/VirtioScsi.c @@ -855,7 +855,7 @@ VirtioScsiInit ( // // step 4c -- Report GPFN (guest-physical frame number) of queue. // - Status =3D Dev->VirtIo->SetQueueAddress (Dev->VirtIo, &Dev->Ring); + Status =3D Dev->VirtIo->SetQueueAddress (Dev->VirtIo, &Dev->Ring, 0); if (EFI_ERROR (Status)) { goto ReleaseQueue; } --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Fri Dec 27 01:42:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 15027106836221015.3758158876432; Mon, 14 Aug 2017 04:38:03 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 085B221D0A25B; Mon, 14 Aug 2017 04:34:59 -0700 (PDT) Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0089.outbound.protection.outlook.com [104.47.40.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 86ED321D1825A for ; Mon, 14 Aug 2017 04:34:57 -0700 (PDT) Received: from brijesh-build-machine.amd.com (165.204.77.1) by BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1341.21; Mon, 14 Aug 2017 11:37:19 +0000 X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=ZdmHGGaJFdaOtdPYVJs7dYEJhly6MVrJZ6W8OkXEdWQ=; b=RvA3QZHkkdnyRQfG64sh4ah2/eKBWU7eYBKgghvZgELtjEX9JhnfkJ6FA1JVgP7KbbK9niC/OglVGaJi2HL5+p2KgrxbOTBniD69XjqCRI0eiK3npzskjDaONcQP7pbOnUB9RKBi0OapfMAGk5e/i21z/K9590BQyBGA70TiDvE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; From: Brijesh Singh To: edk2-devel@lists.01.org Date: Mon, 14 Aug 2017 07:36:36 -0400 Message-Id: <1502710605-8058-15-git-send-email-brijesh.singh@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> References: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: MWHPR15CA0043.namprd15.prod.outlook.com (10.173.226.157) To BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 03968a26-f3a0-4755-5f16-08d4e308d297 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BY2PR12MB0145; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 3:h7yVshdiPiY1yNzLmHn7iQFKcEgraUqvBHnGHISwnbT8q20+o/MuRUK0DvnYOD/V99IU1mJUBhU9EWstARs0UkaB7mFcLIKYkI0U0x5y7vkIk5HNMr+kflEhRdjrAzlOcpN8+alCQBb8SliNNqFAy3ZfOSCMGAjOlsZJC/BnvF5Bsl1QdfcA3u8wBEsAvcptJC0oDiy0bO428r87zi8QmqZCLACBKRCzcX6Kheu6W7N9fJZcaMJA7g0SH4SOfrt6; 25:xxrREy54qGFIDx2sTNaslQkuz3hFoEmgdutkWGLCA3zX82xYgYEDsOJHpQirhIfmR+0Iwq4JC2TZdRkU4tv0GRrJioYZzNHWTzDwYXnqUlpuqS1EDjUWmBY4eDQzxugi+4VPdU0aGlYFbs/RnaiCM449XvxNhhdnSiXrWtYXEe46K/gdwLSRekknVHr69eMwI+m2xpCit8NYPfr/SLZCfYg1judvcU4SyU0Q4B3r1+4oc3eYzhUqG85TbRUi1ew5erbvrAmEQRSe0/UiEdIgqbhVIWl1gIZ3LrdjGipC4+ll6GC3wO8V5Fw5n+u6i2uotKKFlaK4BrwFwWykL9dqIA==; 31:j4UKveDJckZfxPhaOE1H1KRvWd07DI1DrDh7iMdZbEAR9VBuXuH+1axhopBqlGjx1lKKkXQMe5h6OjFueoZrI2cdh2iKQ8lXa76V4xdb6VDcL5DdeA1qGjzd9xS7sttYjXZ+yUHcd5IDIVLHNePvzdopEKQJvVgfkAJmh5KsgYKV8Q25z3A3+borPkdOUbTQ9kAf57wAtEceBcC0ScdJdqMaMayw2zEj8kKBB1qpDtU= X-MS-TrafficTypeDiagnostic: BY2PR12MB0145: X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 20:JK5VnfJTlVRNw2QJRKq5RDIGs5/+iNkYtjcOjR1XTQQxKR1k4h1sDiYep+jkfPYuAwlw6YQadHdEb2Eqq/weV30sCel+pG/fu5TbaOdekY6h+R7yQEqeeUOCcKnsivYGE0aPNegzAvh4fONQD0pJWgQZAN9LR4NVF58zMP9wym7OiMvgcwbTI3BQZkermMW0FCFyDKKWp5Q3tQlSAxJXULACDLJFQouidmQX0h+hk0rivd4EZOnjf2PT7hmVhEyx/7wVXOqLCqXONw92gG/3odUkl7nOKM9TW2gIQAwQSFJofa+jK9edmCFK8Dfd8uXwGH26zDbYIpi7RyXL87wUYMMlH/Vl7l1qMOnSUoWLmgTLjbgjlNnW/eSSKnSmAGGd/uhAyaeiEld2cpAB9W1fAbzbqk2YyHlmRMlU1JJHdGas8nyjPSUHS7jwv12iQ6/yPj7oOHZnicbipZ3Gznts3tA5+d8DjKZGzgmr6VlAJi+hCYnUn/595cqLhP8G6uMo; 4:AIX2Ujt21UJRYUfFW+Laqubv2i6q/lk52FQ8a2HXdb8/6rzkjI+AcXIiiqwiUglBM69i3OOa0z0XRmEKev4noW+xEFTEp5+ax+Ly1UMpDJ9lYkjOQJTyVkVBq3SYp4ZQCOerM40Nu9helrACHEiBYZbpZ1U90r5tJ4SgcdnD7x4Iipd4rg5Ng1k574psImsEvlbWi4CVFH+yTJNRIVy0TLbqVkO3KNjGyzhAbqXwM78gubN8j9Hwq6pIup2CkWFz/NUfaItc/KF0pyezT0oM5JGY002zBipJPWhUXigTmsiob1nelZFlTs6Xi8V0MkQYgdrrzH9NaB3KeoT5DNHFwQ== X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(228905959029699); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(3002001)(6055026)(6041248)(20161123558100)(20161123560025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BY2PR12MB0145; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BY2PR12MB0145; X-Forefront-PRVS: 039975700A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(7370300001)(4630300001)(6009001)(39860400002)(199003)(189002)(54906002)(5003940100001)(6116002)(3846002)(53936002)(97736004)(86362001)(36756003)(81156014)(81166006)(110136004)(8676002)(189998001)(50986999)(76176999)(5660300001)(2361001)(25786009)(2351001)(50226002)(4326008)(7350300001)(33646002)(478600001)(53416004)(42186005)(2906002)(105586002)(7736002)(305945005)(106356001)(48376002)(50466002)(47776003)(66066001)(6486002)(6916009)(2950100002)(6666003)(68736007)(101416001)(19627235001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR12MB0145; H:brijesh-build-machine.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR12MB0145; 23:/Ucht6NEsP2j3+5exSXVGekUjLbNfrRfF/B3De4L9?= =?us-ascii?Q?x4rNpqS1Uzzos0UZ2tEwU7R1Ww8DSdlwAjh+4vhU+CkkCVupPaJ4PKGPDJyi?= =?us-ascii?Q?hgJPyyFndl1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VyJFUgrTc8M1QLHo/5ark2y3TM+SRlHlCr/ofz0T/Zv1PK+BPsC2BoECPKwd/lkFhv+9WF5ZHlQFA/ClEqy28aO0s= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 20:62LJmR1j+JIL2N4UbstTSF/heNzwHf98DL+dfQJEoPtEa8C/WafIEl6cmtBo7P6mOk54Isi0UbjjlaXVC+vkiedpaBgJCJSZRwYquyLSg7FoNm/P0uovRI5G1X4fFQljfs0wS1gvud8nQXi9fTpC+7Fbv+xrAfHdrDsF2c9fXTCHfARKDaZTacyqTB8MbGz5foW3XW9/wKHpgY5+tnI19FkSoz0hX/lt70NikQhuhMDV/KUu7ZZIeH0SPZ5qXy6T X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2017 11:37:19.2524 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0145 Subject: [edk2] [PATCH v2 14/23] OvmfPkg/Virtio10Dxe: add the RingBaseShift offset X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen , Tom Lendacky , Laszlo Ersek , Ard Biesheuvel Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" virtio drivers uses VirtioRingMap() to map the ring buffer host address to a device address. If an IOMMU is present then RingBaseShift contains the offset from the host address. Suggested-by: Laszlo Ersek Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Tom Lendacky Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Brijesh Singh --- OvmfPkg/Virtio10Dxe/Virtio10.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/OvmfPkg/Virtio10Dxe/Virtio10.c b/OvmfPkg/Virtio10Dxe/Virtio10.c index d102e1fd8551..e9041dec91a4 100644 --- a/OvmfPkg/Virtio10Dxe/Virtio10.c +++ b/OvmfPkg/Virtio10Dxe/Virtio10.c @@ -498,11 +498,10 @@ Virtio10SetQueueAddress ( UINT64 Address; UINT16 Enable; =20 - ASSERT (RingBaseShift =3D=3D 0); - Dev =3D VIRTIO_1_0_FROM_VIRTIO_DEVICE (This); =20 Address =3D (UINTN)Ring->Desc; + Address +=3D RingBaseShift; Status =3D Virtio10Transfer (Dev->PciIo, &Dev->CommonConfig, TRUE, OFFSET_OF (VIRTIO_PCI_COMMON_CFG, QueueDesc), sizeof Address, &Address); @@ -511,6 +510,7 @@ Virtio10SetQueueAddress ( } =20 Address =3D (UINTN)Ring->Avail.Flags; + Address +=3D RingBaseShift; Status =3D Virtio10Transfer (Dev->PciIo, &Dev->CommonConfig, TRUE, OFFSET_OF (VIRTIO_PCI_COMMON_CFG, QueueAvail), sizeof Address, &Address); @@ -519,6 +519,7 @@ Virtio10SetQueueAddress ( } =20 Address =3D (UINTN)Ring->Used.Flags; + Address +=3D RingBaseShift; Status =3D Virtio10Transfer (Dev->PciIo, &Dev->CommonConfig, TRUE, OFFSET_OF (VIRTIO_PCI_COMMON_CFG, QueueUsed), sizeof Address, &Address); --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Fri Dec 27 01:42:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1502710689533195.2627323516989; Mon, 14 Aug 2017 04:38:09 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 5C2A1208F7AC7; Mon, 14 Aug 2017 04:35:01 -0700 (PDT) Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0044.outbound.protection.outlook.com [104.47.40.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 44A4821D1825F for ; Mon, 14 Aug 2017 04:34:58 -0700 (PDT) Received: from brijesh-build-machine.amd.com (165.204.77.1) by BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1341.21; Mon, 14 Aug 2017 11:37:20 +0000 X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=zGDOtHMzhiriSkzHqQf2Ff3nIj+27o5IH1vesrxoGoM=; b=QGtzmA7r+SfhPPdUCoyfm1QuaBXRbOqVT0gNrTO+WFHPxiwq5OI6o94V/lGwewmMmzfaMrzwdidmxh7hflNyCUfo7yQosYv3u3KLc3hR1vd/BCCyanwCidLeszDHmIihHSahpoJbVzD0+QRGJoCXqlTMnOZooT8K2ToxKH4Mozw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; From: Brijesh Singh To: edk2-devel@lists.01.org Date: Mon, 14 Aug 2017 07:36:37 -0400 Message-Id: <1502710605-8058-16-git-send-email-brijesh.singh@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> References: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: MWHPR15CA0043.namprd15.prod.outlook.com (10.173.226.157) To BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bdb440fd-e20f-49ee-3114-08d4e308d32b X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BY2PR12MB0145; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 3:7OP3zkzwjrtrBw0GZTu3E5URu4/vD0OhvtOj0ZUgvi1gaXZk2BpIlafGgHGU0H3qCPWJTq1nCQH8TgiT9b2JHGgeaSUtABak6KrfAomvzjjj/rcCvqzc6WqHCXCPrTrxP7JsjCwxegdQvTOQaBBhdkknW5b3CqZyLxlNbmBD00CCJ3EvupmpPI1yVHt4eD7e4hB4VbyEPJb7xfCms1BOu1jBuvqAz8cloiCmneLKuMUDwS9ZKQbp33Ybn5Y5JA3F; 25:5SEwTKZL2VLb6j0YE9MKMt2Ge0Z3C71aeaecliyZG5xKDqrwk1vu/vHztZ/k/whwZa6iyi/oAW95xpXj34f6LnacO7VQEGuqv46HTotxvQcZ++69wNQdaQWfY/aBX9I0U2p5ED+lFg7iw4yfFvE1CFTVuSIaTC7shhzyvnK9NSULl+ASiFISXrZaK4uPH2oK8SaKoAOrZeg1n4WQ5wlRtSgFIMbjKBraXoI/J5KznoodmSKhEyahbxZBj8Nv8UZLmEcqoEVIVYVg1pA7Mz1KpqZtrzkQubxniUPAL+6KMOs9Hvc/ecONWXW3xUxp1myr8JKbZDV7OGUtz2mBI5FxcA==; 31:p3oTx3RRePGqAnavmkaZLFVu3SYnkK51Gkz/fUBiH6SuBPFAUhYDVTwMtX8mYOHbjxXWGF5jrz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FjTM7uLNXrEalA== X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(228905959029699); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(3002001)(6055026)(6041248)(20161123558100)(20161123560025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BY2PR12MB0145; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BY2PR12MB0145; X-Forefront-PRVS: 039975700A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(7370300001)(4630300001)(6009001)(39860400002)(199003)(189002)(54906002)(5003940100001)(6116002)(3846002)(53936002)(97736004)(86362001)(36756003)(81156014)(81166006)(110136004)(8676002)(189998001)(50986999)(76176999)(5660300001)(2361001)(25786009)(2351001)(50226002)(4326008)(7350300001)(33646002)(478600001)(53416004)(42186005)(2906002)(105586002)(7736002)(305945005)(106356001)(48376002)(50466002)(47776003)(66066001)(6486002)(6916009)(2950100002)(6666003)(68736007)(101416001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR12MB0145; H:brijesh-build-machine.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR12MB0145; 23:FtpSyl75XYzubUw8rDHIvClLjbXXpabFq4ccbT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OEaRqSATSdawUh/iSyDS2GuZLGoxZSRsTlceuNcsWsrAwcmHAam9AZ+1o6p0CAjvJxlMVwg4qfOU6Pl3CAnqLaWmO7etr2Frj9G+dU8PjsHXvj9o2lTk= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 20:BxzvQ9x8RLu3bIOLi5re3ritOzrZiX1mHyfUWrNHfKx3wyO1+DTMBWbvAvbrDUKmADow8zXT7GVPuKfAVLhULSd0ansDRdOaJ7PYqf0MLgIoppAb50i7zEsBUZFZgmDdyTg2G7ONpw/HjPQp+tEpMsuXs0Uyx7EWbikyO3R6nqR8TI7PtGJkLHJnocxJr38c8vqeXdadeejNFZ785CgBIQiYIsp9YQLwhXJJeUw1GrpciJfgmym4GGvf2DO3z2QB X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2017 11:37:20.2211 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0145 Subject: [edk2] [PATCH v2 15/23] OvmfPkg/VirtioLib: alloc vring buffer with AllocateSharedPages() X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen , Tom Lendacky , Laszlo Ersek , Ard Biesheuvel Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Tom Lendacky Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Brijesh Singh --- OvmfPkg/Library/VirtioLib/VirtioLib.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/OvmfPkg/Library/VirtioLib/VirtioLib.c b/OvmfPkg/Library/Virtio= Lib/VirtioLib.c index 7d07dcc09d3d..8010b5cf4735 100644 --- a/OvmfPkg/Library/VirtioLib/VirtioLib.c +++ b/OvmfPkg/Library/VirtioLib/VirtioLib.c @@ -61,6 +61,7 @@ VirtioRingInit ( OUT VRING *Ring ) { + EFI_STATUS Status; UINTN RingSize; volatile UINT8 *RingPagesPtr; =20 @@ -79,9 +80,16 @@ VirtioRingInit ( sizeof *Ring->Used.AvailEvent, EFI_PAGE_SIZE); =20 + // + // Allocate a shared ring buffer + // Ring->NumPages =3D EFI_SIZE_TO_PAGES (RingSize); - Ring->Base =3D AllocatePages (Ring->NumPages); - if (Ring->Base =3D=3D NULL) { + Status =3D VirtIo->AllocateSharedPages ( + VirtIo, + Ring->NumPages, + &Ring->Base + ); + if (EFI_ERROR (Status)) { return EFI_OUT_OF_RESOURCES; } SetMem (Ring->Base, RingSize, 0x00); @@ -143,7 +151,7 @@ VirtioRingUninit ( IN OUT VRING *Ring ) { - FreePages (Ring->Base, Ring->NumPages); + VirtIo->FreeSharedPages (VirtIo, Ring->NumPages, Ring->Base); SetMem (Ring, sizeof *Ring, 0x00); } =20 --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Fri Dec 27 01:42:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1502710700873772.4283208493683; Mon, 14 Aug 2017 04:38:20 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id E0F3421D4911E; Mon, 14 Aug 2017 04:35:03 -0700 (PDT) Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0049.outbound.protection.outlook.com [104.47.40.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 2A78D21D1825F for ; Mon, 14 Aug 2017 04:35:01 -0700 (PDT) Received: from brijesh-build-machine.amd.com (165.204.77.1) by BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1341.21; Mon, 14 Aug 2017 11:37:21 +0000 X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=vFDz9BS5WE906YFtz8yBbeF6Xai9IMvKDbL0+vIYCto=; b=F2LiLejeIhyouQqFY7zxNbhSokhZ0e9l8qYN/L4Wd4vaUV7uabrKcr8xhvIqqtDuudhVvAW/SyHS5TGibITfAhYe1oKhvvAnf91BxV0t99E+kzKciONK+6PhUSnAMWgURIeD+apjlAAMOWmCFAB2h8qcryGUGGp3KRSSqV8JlYk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; From: Brijesh Singh To: edk2-devel@lists.01.org Date: Mon, 14 Aug 2017 07:36:38 -0400 Message-Id: <1502710605-8058-17-git-send-email-brijesh.singh@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> References: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: MWHPR15CA0043.namprd15.prod.outlook.com (10.173.226.157) To BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1a90b9ee-a0a0-4637-a0bf-08d4e308d3bc X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BY2PR12MB0145; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 3:KHooZpJXI/XKYVhW4nKzxYx4XW7oXgu+XXHZ9r3BzbPSKeyUPzCjWNqV1oGvYmud+Lq+YE7M+u3iH9ZlGEnpCdWBzlVmca7qPWGhLeqAmIYrtz1iOZYN16mqlHnVejFDGYH82eUlBfO2eektDppRJD6Pnzz1xWS7fk8pklYPOQTma77dQ4iVsYn2Jb71ZhRTnCwdSffPdVhcCw1Cvxip6qo0KY1J464vpdYRYwpUOmcgihRnzc6vlewMrTDi7cVk; 25:5P426GdHRwCJEFeWzEF1OnlbNZbfVfLDUSN5N9Xkc7/5iIhCp/rz6nmSTMCC4NwBg9Cs3CyW+gKjB3FxoJ1Xo473EHR8eJU94j0UrhtWQtKpB1Ib887/JTPAib4FkeYX1rK7M+b2WitiLWxWvoNdrPlCyZUfRzHhtLlqA2J/NISW6Ok4cXyX3nPEtcSYcSUYbf1ic84mTfTNl4jp1E3wCL+dTlRUMiCdWeUu9Pcv2VzXEUiEzjajcQEy+Z0dtAJpXCxBj0lgTHEaYg45BOU3aGsRJrMH2ExJ1MqIRXhqg9q1Ye3xoPjqZe88JiI/G7H7YiSvvY7htGGczHAOsliI3Q==; 31:Si/9UoZHn6L7ZvdX/6UXZHqeqQKIdyvii06V5QFeagpgd+YwnXPYNLGU7Z7uWCHHL2fOuR28VOcG7jy3USfs10v3H6Z90udvSQ57Bq6FEvoNs6SwlvgI0ctOydsKBngPBNwqyfbMHMGcnQzXPA9Zyl7p6F1HchtoM0DgClRRFMx8eUNElvMPiq+A0YRmpByOTvlLckzfAosnBxC8VsKi6Y+suiTJY6xLk1ODSLBUP14= X-MS-TrafficTypeDiagnostic: BY2PR12MB0145: X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 20:IyZ89ssKh1ZGmWMZr/YxeWjzSgk/I3JjjGy7Hthzgaehqm2aWK/rQ8T+A7/ODSg32mPU7uN8Rn91+djUYAJMwZCB1+wPHYb0/anwUL3CGXcKUCQP10WYBuQZg15Y/WvcyFoFje5raQqduj4VCIiyFwmU7hEvRp1noscvMVfKWEAdd8ZLP2J1joOBXY7Tieu+Yk5LyKW9oRRl/UuphutmNNJ0yazqFdJ+44PGPMvwAsA7saCiDS921IwRnd4pRFh+cUAqvpMyJBKK6eX1o/R0kYhhn0pVPpTuHo8uNw0DBGe4d+I3Q+m7qTMNf+LQ8f0fYenDEMYVORl4S/9nWriE2j7QbFnMOaT/nQU0C5g1JpxyXp6MsSlPQ3Tca3KZX1WCeeKTuA11/mreky8a3XC0++Xa8Ob92JRq381SS7Oz9U0GGUnSvxMvx+2A3qjcsJjRkqWh6UqmcJJxarKv0dETArf1UEzpV2UlfyofcZ9VSKJzLpT0i0tyCk0PyHNKzIjT; 4:3/N6LVjqtdRiWAEF/gBNagnisAp0Mnz2CnQFY8ufK6rb6SHhwO5dSei1/2Jz/N8BvwDgEY9TpvhPz0qmgH3njUUj9TVZvZJeBI/A+YFKgwV8eYv86EzocvQPIafLdnwedxbf2VNCmrtJtbzG5+INJB69HgH8DOEqYwfQ1fZxFxJfnweQg06qb63jgKeYs1BJ/gNELTZnfX5/ZtwA35RvzU04+NqMYfsSWTwt9QlieR38wsYcaxI8EzQ8lyX1ixWrpFD18dUSRN7Qgo8arO7OeuT54qThygKH+zWPhXY4f7t2sJVCWDeD1DC5ySrGCI4Mi5VIvF3DlNbujRUzhlk2JQ== X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(228905959029699); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(3002001)(6055026)(6041248)(20161123558100)(20161123560025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BY2PR12MB0145; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BY2PR12MB0145; X-Forefront-PRVS: 039975700A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(7370300001)(4630300001)(6009001)(39860400002)(199003)(189002)(51234002)(54906002)(5003940100001)(6116002)(3846002)(53936002)(97736004)(86362001)(36756003)(81156014)(81166006)(110136004)(8676002)(189998001)(50986999)(76176999)(5660300001)(2361001)(25786009)(2351001)(50226002)(4326008)(7350300001)(33646002)(478600001)(53416004)(42186005)(2906002)(105586002)(7736002)(305945005)(106356001)(48376002)(50466002)(47776003)(66066001)(6486002)(6916009)(2950100002)(6666003)(68736007)(101416001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR12MB0145; H:brijesh-build-machine.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR12MB0145; 23:mkNtNphE3aoVJ2m3nhpgwLc0+DjGPZvmYQoPItHc7?= =?us-ascii?Q?pK+DWm3feV3dgcbPvmvJGeAXVYI+4C5sovitXk5TmZLvdEuk0XGN6GIQAH+I?= =?us-ascii?Q?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R5OqyTCyzzoTWPCTI56yXEbmfLk7+SbQhmC+TOFnymGUCJPCifDfbYUJBrhLXnHzZg= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 20:Ro1k0x+hYGS3eYUIdHb3iWffev5fMezROwLIMx4oHa24L3boBGmqFo+iWAe+OQWmknGdNJ/94uE5WKAWyQk3kAQiqFIha2j5CoBFJsSIHUBAKS6slM8GMiqAJHryGO2IwPBrtu7qe50vdJgu1xVMSY5cH0uvbmZcSdmrcQHdE7AKaeM8ZmCw+sFzbie/uSUKpg8booP30vicl2kKpR9jecFhTCFVkpLW91azJBzk9oQYuowxRUkPhPmFSxxiaudO X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2017 11:37:21.1586 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0145 Subject: [edk2] [PATCH v2 16/23] OvmfPkg/VirtioRngDxe: map host address to device address X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen , Tom Lendacky , Laszlo Ersek , Ard Biesheuvel Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" patch maps the host address to a device address for buffers (including rings, device specifc request and response pointed by vring descriptor, and any further memory reference by those request and response). Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Tom Lendacky Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Brijesh Singh --- OvmfPkg/VirtioRngDxe/VirtioRng.h | 1 + OvmfPkg/VirtioRngDxe/VirtioRng.c | 65 +++++++++++++++++--- 2 files changed, 58 insertions(+), 8 deletions(-) diff --git a/OvmfPkg/VirtioRngDxe/VirtioRng.h b/OvmfPkg/VirtioRngDxe/Virtio= Rng.h index 998f9fae48c2..b372d84c1ebc 100644 --- a/OvmfPkg/VirtioRngDxe/VirtioRng.h +++ b/OvmfPkg/VirtioRngDxe/VirtioRng.h @@ -38,6 +38,7 @@ typedef struct { EFI_EVENT ExitBoot; // DriverBindingStart 0 VRING Ring; // VirtioRingInit 2 EFI_RNG_PROTOCOL Rng; // VirtioRngInit 1 + VOID *RingMap; // VirtioRngInit 1 } VIRTIO_RNG_DEV; =20 #define VIRTIO_ENTROPY_SOURCE_FROM_RNG(RngPointer) \ diff --git a/OvmfPkg/VirtioRngDxe/VirtioRng.c b/OvmfPkg/VirtioRngDxe/Virtio= Rng.c index 0abca488e6cd..fc01f1996654 100644 --- a/OvmfPkg/VirtioRngDxe/VirtioRng.c +++ b/OvmfPkg/VirtioRngDxe/VirtioRng.c @@ -140,6 +140,8 @@ VirtioRngGetRNG ( UINT32 Len; UINT32 BufferSize; EFI_STATUS Status; + EFI_PHYSICAL_ADDRESS DeviceAddress; + VOID *Mapping; =20 if (This =3D=3D NULL || RNGValueLength =3D=3D 0 || RNGValue =3D=3D NULL)= { return EFI_INVALID_PARAMETER; @@ -159,6 +161,20 @@ VirtioRngGetRNG ( } =20 Dev =3D VIRTIO_ENTROPY_SOURCE_FROM_RNG (This); + // + // Map the Buffers system phyiscal address to device address + // + Status =3D VirtioMapAllBytesInSharedBuffer ( + Dev->VirtIo, + VirtioOperationBusMasterWrite, + (VOID *)Buffer, + RNGValueLength, + &DeviceAddress, + &Mapping + ); + if (EFI_ERROR (Status)) { + goto FreeBuffer; + } =20 // // The Virtio RNG device may return less data than we asked it to, and c= an @@ -170,7 +186,7 @@ VirtioRngGetRNG ( =20 VirtioPrepare (&Dev->Ring, &Indices); VirtioAppendDesc (&Dev->Ring, - (UINTN)Buffer + Index, + (UINTN)DeviceAddress + Index, BufferSize, VRING_DESC_F_WRITE, &Indices); @@ -178,17 +194,30 @@ VirtioRngGetRNG ( if (VirtioFlush (Dev->VirtIo, 0, &Dev->Ring, &Indices, &Len) !=3D EFI_SUCCESS) { Status =3D EFI_DEVICE_ERROR; - goto FreeBuffer; + goto UnmapBuffer; } ASSERT (Len > 0); ASSERT (Len <=3D BufferSize); } =20 + // + // Unmap the device buffer before accesing it. + // + Dev->VirtIo->UnmapSharedBuffer (Dev->VirtIo, Mapping); + for (Index =3D 0; Index < RNGValueLength; Index++) { RNGValue[Index] =3D Buffer[Index]; } Status =3D EFI_SUCCESS; =20 + // + // Buffer is already Unmaped(), goto free it. + // + goto FreeBuffer; + +UnmapBuffer: + Dev->VirtIo->UnmapSharedBuffer (Dev->VirtIo, Mapping); + FreeBuffer: FreePool ((VOID *)Buffer); return Status; @@ -205,6 +234,7 @@ VirtioRngInit ( EFI_STATUS Status; UINT16 QueueSize; UINT64 Features; + UINT64 RingBaseShift; =20 // // Execute virtio-0.9.5, 2.2.1 Device Initialization Sequence. @@ -281,26 +311,33 @@ VirtioRngInit ( goto Failed; } =20 + Status =3D VirtioRingMap (Dev->VirtIo, &Dev->Ring, &RingBaseShift, + &Dev->RingMap); + if (EFI_ERROR (Status)) { + goto ReleaseQueue; + } + // // Additional steps for MMIO: align the queue appropriately, and set the // size. If anything fails from here on, we must release the ring resour= ces. // Status =3D Dev->VirtIo->SetQueueNum (Dev->VirtIo, QueueSize); if (EFI_ERROR (Status)) { - goto ReleaseQueue; + goto UnmapQueue; } =20 Status =3D Dev->VirtIo->SetQueueAlign (Dev->VirtIo, EFI_PAGE_SIZE); if (EFI_ERROR (Status)) { - goto ReleaseQueue; + goto UnmapQueue; } =20 // // step 4c -- Report GPFN (guest-physical frame number) of queue. // - Status =3D Dev->VirtIo->SetQueueAddress (Dev->VirtIo, &Dev->Ring, 0); + Status =3D Dev->VirtIo->SetQueueAddress (Dev->VirtIo, &Dev->Ring, + RingBaseShift); if (EFI_ERROR (Status)) { - goto ReleaseQueue; + goto UnmapQueue; } =20 // @@ -310,7 +347,7 @@ VirtioRngInit ( Features &=3D ~(UINT64)VIRTIO_F_VERSION_1; Status =3D Dev->VirtIo->SetGuestFeatures (Dev->VirtIo, Features); if (EFI_ERROR (Status)) { - goto ReleaseQueue; + goto UnmapQueue; } } =20 @@ -320,7 +357,7 @@ VirtioRngInit ( NextDevStat |=3D VSTAT_DRIVER_OK; Status =3D Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, NextDevStat); if (EFI_ERROR (Status)) { - goto ReleaseQueue; + goto UnmapQueue; } =20 // @@ -331,6 +368,9 @@ VirtioRngInit ( =20 return EFI_SUCCESS; =20 +UnmapQueue: + Dev->VirtIo->UnmapSharedBuffer (Dev->VirtIo, Dev->RingMap); + ReleaseQueue: VirtioRingUninit (Dev->VirtIo, &Dev->Ring); =20 @@ -359,6 +399,9 @@ VirtioRngUninit ( // the old comms area. // Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, 0); + + Dev->VirtIo->UnmapSharedBuffer (Dev->VirtIo, Dev->RingMap); + VirtioRingUninit (Dev->VirtIo, &Dev->Ring); } =20 @@ -385,6 +428,12 @@ VirtioRngExitBoot ( // Dev =3D Context; Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, 0); + + // + // Umap the ring buffer so that hypervisor will not able to get readable= data + // after device reset. + // + Dev->VirtIo->UnmapSharedBuffer (Dev->VirtIo, Dev->RingMap); } =20 =20 --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Fri Dec 27 01:42:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1502710695642917.8717660841207; Mon, 14 Aug 2017 04:38:15 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id A51DA21D2DD0F; Mon, 14 Aug 2017 04:35:03 -0700 (PDT) Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0049.outbound.protection.outlook.com [104.47.40.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 0FA9021D1825A for ; Mon, 14 Aug 2017 04:35:01 -0700 (PDT) Received: from brijesh-build-machine.amd.com (165.204.77.1) by BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1341.21; Mon, 14 Aug 2017 11:37:22 +0000 X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=p9OxY2xlComcqIpb691fEXWBFGkw+lWw+KKDLgtStO4=; b=TYQFfFpqlYsAwWJUX8Wm0UHYVzw0E3mW9u0pwcw1eprILSmpCTf1fPlSDihAu6XrjCR2CU3dU/gdmrHphygeLF0a5/2+vzpzhyHiK1DO3thANkYpeB9UzoaR8IOZ5N8T0x4x7kOxpNP+1C80N9Cp+n+mLBTtY4cnHucwio4WoxY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; From: Brijesh Singh To: edk2-devel@lists.01.org Date: Mon, 14 Aug 2017 07:36:39 -0400 Message-Id: <1502710605-8058-18-git-send-email-brijesh.singh@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> References: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: MWHPR15CA0043.namprd15.prod.outlook.com (10.173.226.157) To BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 04f1c4ae-5a04-43e1-3778-08d4e308d455 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BY2PR12MB0145; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 3:JcqhfX1QYMn0MMWUGqhYIbhesA4nYcvnlL1ttxkcWFq9uUNhPn77AIfQbEdiv4jyE/cATvj6YWvo2S5Rhje+jTOLLso26v/hFCg3zmFMH1hFEUTR1utdfZ7lwdADLfI1WEdllb34XOcMs8EmtPR2TBq2LvZObRSbGXg/F2THJmbzhFDOw4RoAwfPw50dMPwnXQ0utcJW9ONrA+7zf+QwDbIER96Pxen8/IPecVGjhA5C6nsg06oatYFjoB8/L/x6; 25:YqEfwjjzWMPGBhRVRIKfpZ+blT+cy3CshsR2N0pmHqW/2vlpXT2IM2eIs8Sk15lkn9rSAHvNyagcuCga6SAtedL+w9I21f85QNEU0S6cNLzkKm8azyEOrLytLItyMoFd10zz0htoO/5lIbwFcOPItr8Zku7Pch5nrspcrD/VzHw2N69xf407HJNah7lfxOMpJY8IjhmBo4l74dydr7L+UGvbs0zbjLIuQR2ihLxumc438lgemTpxwhO9dY4iYaYQSlTQB22KQ7KOcz1GXKUPUu2ZKLtmx/8jhdyptRjKF7nVhAscnYGrMB8YPZcuLcxH7U+DbjBZEci2QuF0QgFpLQ==; 31:4neqV+puFj+8NB4GnltFRURjZ3niJ6VLkuc1LxQY4ugNgOt/CfsZvRyOmmyL8i0VqZ+EAfuMAyMRskwVbaLvoUuGpup2bQJ14qWX8OuDm2uzTN+6Z23Xla/KBKj90hMvVVfoSOMB3L/45B/+ULCqSAiKNfRiF+dtlCiypfWPaeIjqv7NYduQRpiutgyGp27DHNheI/NY50HW0znODY1KbPNBu68nPGQou/JraAhpDeM= X-MS-TrafficTypeDiagnostic: BY2PR12MB0145: X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 20:HL2Vz1BQPXOANqF6MdK0RvmbepcfKG4BayoNQV52L/bJ2HAKK2BoHr95g1jwslN/sQkBbYElOY2pfeT1fuZKxbJLZL4Tob3XXAueQouhYimhYzpbJEEzCFw8LkndYydrN7XByLnjt0qMG10GuKZOudTkTnUQWHmcwTP5uaGp4Kkfhf+8ZiWzrwPrULW++682Dr7FuIqh7+Fgb0K/5rIqvT2lGhxZ6TflIInHQZK1/FimT+d4abSYndlnarcXTvGMokLgqqfq+n4jJe+Q3dcx8iVNeS2E/a73B7UiDf+jh3It5aImRuREUT44MWmSSzEgEvEqormHjGzCNvzV+tYnoKlAmT8zM5pkjv8p+4wd9lcVEN4aNnh/pquna67GxWQE4rBd0mT6ylFEXRZ+q26U5A31kpIzK7vvS/0NNSxSgGtj2QhGc+kQPeacd04EaBKoH15YRqwkc8iSXSf+wcf9SFxtcmsb+yAc8nriPD5rU8kn45WELLdth0H6ztHrduV4; 4:kgcn8OHax5rDRwDKyI8mFFCFbN8OVZNCAI8C04Wvc/+Y/4EBrtzzrbALj9LGALdA8GV1NRZfQEl+0+gpiXBrZDVWPLTcCFDtr0rV0W7KfO9vrBK/HHQlk1Ou3A/07TXF6vC2Pq/RaYd6iOFKa0kmZt2y09xvLhIu5/DHX8a47cXPzsUMwh8z56ZOLad2TlRqbzVvrFqzGkRgRBJ8fuPq9BO6Ux12BJfTFO2nGUoRT78O7zk71AXtP72n11EbdakytX6xyVGBPStejwkyn/wf05F86UeWLApnFf6inmsWWheNUHCNy2tNadkvaXYEV/BoVdQvUBqo4tjEyfhHyKtVkVcS5x66/MS04klsGkx8OWo= X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(228905959029699)(17755550239193); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(3002001)(6055026)(6041248)(20161123558100)(20161123560025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BY2PR12MB0145; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BY2PR12MB0145; X-Forefront-PRVS: 039975700A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(7370300001)(4630300001)(6009001)(39860400002)(199003)(189002)(51234002)(54906002)(5003940100001)(6116002)(3846002)(53936002)(97736004)(86362001)(36756003)(81156014)(81166006)(110136004)(8676002)(189998001)(50986999)(76176999)(5660300001)(2361001)(25786009)(2351001)(50226002)(4326008)(7350300001)(33646002)(478600001)(53416004)(42186005)(2906002)(105586002)(7736002)(305945005)(106356001)(48376002)(50466002)(47776003)(66066001)(6486002)(6916009)(2950100002)(6666003)(68736007)(101416001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR12MB0145; H:brijesh-build-machine.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR12MB0145; 23:A8js3ms2YprkQSxikbNNnSpkaPFXFkPKxmk/N+XhZ?= =?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InYwHDVRNFqZ7J9XEKAOo1B7bOP/xALJGS4WZKnVCFaW8H4j57n58+RU3bpL+7KuNBodl7j5vTTfzWZOmnZDZMyzpkRlLr7GWPkWgcfUL7pdszyoCJiJay3Id66lBatsLyyzR93yJ86Xy6CdHDpWP7spXBgRAh+FaDw8ie88= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 20:YvSPPILFjgG/AMUC8N7aM8bXm9J10HDnSPL5PFp3yhfHeJvpOiMWKi/p/F71O5RfJsW5p3UHHd5IeU+RUn3KIU+Zw8bxpA3ow1zfF88YIoDgNS3PFMIPumh1bXhbJlUhJAw7HauVvqbLg/8qJ5hLBTNlG6A2DsbQQWZygdBKbyRGWVw3Q2N5ghSQmpa+4CCJm9a72qPpIGcuIHxjNdRTDukbuvmHdTPAZ0VxgsgXTN0tBYZaINfDThzpTXsG5bly X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2017 11:37:22.1586 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0145 Subject: [edk2] [PATCH v2 17/23] OvmfPkg/VirtioBlkDxe: map host address to device address X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen , Tom Lendacky , Laszlo Ersek , Ard Biesheuvel Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The SynchronousRequest(), programs the vring descriptor with the buffers pointed-by virtio-blk requests, status and memory that is referenced inside the request header. The patch uses VIRTIO_DEVICE_PROTOCOL.MapSharedBuffer() function to map host address to device address and programs the vring descriptor with device addresses. Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Tom Lendacky Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Brijesh Singh --- OvmfPkg/VirtioBlkDxe/VirtioBlk.h | 1 + OvmfPkg/VirtioBlkDxe/VirtioBlk.c | 121 +++++++++++++++++--- 2 files changed, 109 insertions(+), 13 deletions(-) diff --git a/OvmfPkg/VirtioBlkDxe/VirtioBlk.h b/OvmfPkg/VirtioBlkDxe/Virtio= Blk.h index 6c402ca88ea4..612994d261bc 100644 --- a/OvmfPkg/VirtioBlkDxe/VirtioBlk.h +++ b/OvmfPkg/VirtioBlkDxe/VirtioBlk.h @@ -41,6 +41,7 @@ typedef struct { VRING Ring; // VirtioRingInit 2 EFI_BLOCK_IO_PROTOCOL BlockIo; // VirtioBlkInit 1 EFI_BLOCK_IO_MEDIA BlockIoMedia; // VirtioBlkInit 1 + VOID *RingMapping; // VirtioBlkInit 1 } VBLK_DEV; =20 #define VIRTIO_BLK_FROM_BLOCK_IO(BlockIoPointer) \ diff --git a/OvmfPkg/VirtioBlkDxe/VirtioBlk.c b/OvmfPkg/VirtioBlkDxe/Virtio= Blk.c index bff15fe3add1..57baceb20a19 100644 --- a/OvmfPkg/VirtioBlkDxe/VirtioBlk.c +++ b/OvmfPkg/VirtioBlkDxe/VirtioBlk.c @@ -251,6 +251,11 @@ SynchronousRequest ( volatile VIRTIO_BLK_REQ Request; volatile UINT8 HostStatus; DESC_INDICES Indices; + VOID *RequestMapping; + VOID *StatusMapping; + VOID *BufferMapping; + EFI_PHYSICAL_ADDRESS DeviceAddress; + EFI_STATUS Status; =20 BlockSize =3D Dev->BlockIoMedia.BlockSize; =20 @@ -289,14 +294,30 @@ SynchronousRequest ( ASSERT (Dev->Ring.QueueSize >=3D 3); =20 // + // Map virtio-blk request header + // + Status =3D VirtioMapAllBytesInSharedBuffer ( + Dev->VirtIo, + VirtioOperationBusMasterRead, + (VOID *) &Request, + sizeof Request, + &DeviceAddress, + &RequestMapping + ); + if (EFI_ERROR (Status)) { + return Status; + } + + // // virtio-blk header in first desc // - VirtioAppendDesc (&Dev->Ring, (UINTN) &Request, sizeof Request, + VirtioAppendDesc (&Dev->Ring, (UINTN) DeviceAddress, sizeof Request, VRING_DESC_F_NEXT, &Indices); =20 // // data buffer for read/write in second desc // + BufferMapping =3D NULL; if (BufferSize > 0) { // // From virtio-0.9.5, 2.3.2 Descriptor Table: @@ -309,29 +330,86 @@ SynchronousRequest ( ASSERT (BufferSize <=3D SIZE_1GB); =20 // + // Map data buffer + // + if (RequestIsWrite) { + Status =3D VirtioMapAllBytesInSharedBuffer ( + Dev->VirtIo, + VirtioOperationBusMasterRead, + (VOID *) Buffer, + BufferSize, + &DeviceAddress, + &BufferMapping + ); + } else { + Status =3D VirtioMapAllBytesInSharedBuffer ( + Dev->VirtIo, + VirtioOperationBusMasterWrite, + (VOID *) Buffer, + BufferSize, + &DeviceAddress, + &BufferMapping + ); + } + + if (EFI_ERROR (Status)) { + goto Unmap_Request_Buffer; + } + + // // VRING_DESC_F_WRITE is interpreted from the host's point of view. // - VirtioAppendDesc (&Dev->Ring, (UINTN) Buffer, (UINT32) BufferSize, + VirtioAppendDesc (&Dev->Ring, (UINTN) DeviceAddress, (UINT32) BufferSi= ze, VRING_DESC_F_NEXT | (RequestIsWrite ? 0 : VRING_DESC_F_WRITE), &Indices); } =20 // + // Map virtio-blk status header + // + Status =3D VirtioMapAllBytesInSharedBuffer ( + Dev->VirtIo, + VirtioOperationBusMasterWrite, + (VOID *) &HostStatus, + sizeof HostStatus, + &DeviceAddress, + &StatusMapping + ); + if (EFI_ERROR (Status)) { + goto Unmap_Data_Buffer; + } + + // // host status in last (second or third) desc // - VirtioAppendDesc (&Dev->Ring, (UINTN) &HostStatus, sizeof HostStatus, + VirtioAppendDesc (&Dev->Ring, (UINTN) DeviceAddress, sizeof HostStatus, VRING_DESC_F_WRITE, &Indices); =20 // // virtio-blk's only virtqueue is #0, called "requestq" (see Appendix D). // - if (VirtioFlush (Dev->VirtIo, 0, &Dev->Ring, &Indices, - NULL) =3D=3D EFI_SUCCESS && + if (VirtioFlush (Dev->VirtIo, 0, &Dev->Ring, &Indices, NULL) !=3D EFI_SU= CCESS) { + Status =3D EFI_DEVICE_ERROR; + } + + // + // Unmap the HostStatus buffer before accessing it + // + Dev->VirtIo->UnmapSharedBuffer (Dev->VirtIo, StatusMapping); + + if (Status !=3D EFI_DEVICE_ERROR && HostStatus =3D=3D VIRTIO_BLK_S_OK) { - return EFI_SUCCESS; + Status =3D EFI_SUCCESS; + } else { + Status =3D EFI_DEVICE_ERROR; } =20 - return EFI_DEVICE_ERROR; +Unmap_Data_Buffer: + Dev->VirtIo->UnmapSharedBuffer (Dev->VirtIo, BufferMapping); +Unmap_Request_Buffer: + Dev->VirtIo->UnmapSharedBuffer (Dev->VirtIo, RequestMapping); + + return Status; } =20 =20 @@ -601,6 +679,7 @@ VirtioBlkInit ( UINT8 AlignmentOffset; UINT32 OptIoSize; UINT16 QueueSize; + UINT64 RingBaseShift; =20 PhysicalBlockExp =3D 0; AlignmentOffset =3D 0; @@ -728,26 +807,33 @@ VirtioBlkInit ( goto Failed; } =20 + Status =3D VirtioRingMap (Dev->VirtIo, &Dev->Ring, &RingBaseShift, + &Dev->RingMapping); + if (EFI_ERROR (Status)) { + goto ReleaseQueue; + } + // // Additional steps for MMIO: align the queue appropriately, and set the // size. If anything fails from here on, we must release the ring resour= ces. // Status =3D Dev->VirtIo->SetQueueNum (Dev->VirtIo, QueueSize); if (EFI_ERROR (Status)) { - goto ReleaseQueue; + goto UnmapQueue; } =20 Status =3D Dev->VirtIo->SetQueueAlign (Dev->VirtIo, EFI_PAGE_SIZE); if (EFI_ERROR (Status)) { - goto ReleaseQueue; + goto UnmapQueue; } =20 // // step 4c -- Report GPFN (guest-physical frame number) of queue. // - Status =3D Dev->VirtIo->SetQueueAddress (Dev->VirtIo, &Dev->Ring, 0); + Status =3D Dev->VirtIo->SetQueueAddress (Dev->VirtIo, &Dev->Ring, + RingBaseShift); if (EFI_ERROR (Status)) { - goto ReleaseQueue; + goto UnmapQueue; } =20 =20 @@ -758,7 +844,7 @@ VirtioBlkInit ( Features &=3D ~(UINT64)VIRTIO_F_VERSION_1; Status =3D Dev->VirtIo->SetGuestFeatures (Dev->VirtIo, Features); if (EFI_ERROR (Status)) { - goto ReleaseQueue; + goto UnmapQueue; } } =20 @@ -768,7 +854,7 @@ VirtioBlkInit ( NextDevStat |=3D VSTAT_DRIVER_OK; Status =3D Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, NextDevStat); if (EFI_ERROR (Status)) { - goto ReleaseQueue; + goto UnmapQueue; } =20 // @@ -811,7 +897,10 @@ VirtioBlkInit ( } return EFI_SUCCESS; =20 +UnmapQueue: + Dev->VirtIo->UnmapSharedBuffer (Dev->VirtIo, Dev->RingMapping); ReleaseQueue: + VirtioRingUninit (Dev->VirtIo, &Dev->Ring); =20 Failed: @@ -885,6 +974,12 @@ VirtioBlkExitBoot ( // Dev =3D Context; Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, 0); + + // + // Unmap the ring buffer so that hypervisor can not get a readable data + // after device is reset. + // + Dev->VirtIo->UnmapSharedBuffer (Dev->VirtIo, Dev->RingMapping); } =20 /** --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Fri Dec 27 01:42:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 150271070619023.382436907903184; Mon, 14 Aug 2017 04:38:26 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 2F4E121DFC862; Mon, 14 Aug 2017 04:35:04 -0700 (PDT) Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0065.outbound.protection.outlook.com [104.47.40.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id D35F121D0A251 for ; Mon, 14 Aug 2017 04:35:01 -0700 (PDT) Received: from brijesh-build-machine.amd.com (165.204.77.1) by BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1341.21; Mon, 14 Aug 2017 11:37:23 +0000 X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=/Ikaa8wk/A/7xCr3PGSpNQggOWsNPHQ+Ccqquq0oXyQ=; b=YiF47NyA2MHAzaaWBUTFJnj+Pc/vPnqoqkSeR6Q4TEm7Ex+n6gIk4Z5o41B/L7MuBU1KNdpULw2JzfFZtOmDEkU672ZGGJQ5gesmG5pnSijlwZJ9sraj5UcFYw56pYBf3NVd3qdCLjehoyCvVchDGXCMxewUBnpKL9h89E9jpeI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; From: Brijesh Singh To: edk2-devel@lists.01.org Date: Mon, 14 Aug 2017 07:36:40 -0400 Message-Id: <1502710605-8058-19-git-send-email-brijesh.singh@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> References: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: MWHPR15CA0043.namprd15.prod.outlook.com (10.173.226.157) To BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 13abbb4a-efe9-482e-3089-08d4e308d4f0 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BY2PR12MB0145; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 3:yXcMV9CciElkJsQWdmJ1o7QLdJiISdo3hE6qSQV7yG2jhbhXN1Dvbh4SHbC33VEOnXqoMCppRqY4U1dEmKiDvjX4jZR+XmUe23UlQ+QRRfbmdnD6Zf4Cw4PF1oMQofVTlBKR91zbb4C4z3RSsAfc7y+c8CUQJPNjHdyhgk9oe8pbI8hwR8nrue5JYKn4GAvu9RqR5lNogjgB/YArpa4znV7WT0znoWX/78TtUn4cz3kofP2nb1WqIC5Jsocq/sqQ; 25:KPw/8gFA9UrGMlaIradfwBvxEy6g/80P3P9RagocIZrEid367Xir/4oqKbScF3ub+VbOFWQvt00uEQiFjnpIlgzvDCSblO3Q4AX8EVAk6YwLI2vdYWYcqHIkt4hlksrKpdUhdxIgalR1+qPI1PKOCKR4N4YUnv4rVTaoaMEo9T5NUSTEuizN+fFQVHwEICiDm0SowD+tlrP0WvJ+DNVV39xFl2x0AdHkKpr2XJxPtQmZ2u01GD+B8Bb+eeO2XbhXpbOoLT+x5wlxOziglN0zpk9H0OSk0ZUrzAhzQ05RvtFDaLsRMvAd+GY3QiHluo1CNnmRB+UIMgB9vBjzHtYdIQ==; 31:ui6aB/Y2mnzXJfUNyt7ZSjENt2ryzrWYg0EhC+Lso5CRntmVJHAZFRd1WHGPMF6uS7x/Qv6+P3eP8fiRCRH+mQtzFZ05qeW4tVB7G9YFDWzWo+JyZhvmE2M/Lm3qTXFwpY16UOxDpjS9+txM47IC0FoZV/42Rme4i/lvhOokhQqnDEKuT88ObRz2wutaoRf1Su3Ka6lWSZwos20+ukPICSNTWwWFDl2d+zkc05IBpqA= X-MS-TrafficTypeDiagnostic: BY2PR12MB0145: X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 20:ZlpxkOTdcQ+dkMr3VyVJnpmEArV+D7Bo1C/mRJasvyg+OkvyfbqZL7XohaG2d1xAbdfaxXScQR1MiuHqsq2+SxJs4wgZ0gBEBfoDRl/PWVdxD6Ly22efa//BMpVCLWCiObS2ON64HtRRlnlXvTfZf1u+Hx/s1AyUFTPgo4bsOH0wA1Hf0ZGUKWFNjEnWHlKiWUABH10OJfGZxuu3tp+DimqlOl4xPvOTrZZZpWAbFcWOZuP1wmUYJuSO9jj9Dh4/TU+bAUG2rGBuM3TzdYUs8jxskIET9iEZ5DWdXCl1K6X0QocLRC/Fs4v9IRwAOQKqT3/0sG4ao+WqcUPD9nxH4klGGILJrZw+sUP3TM8+fdLJxj4y82GAO539CxFz9m6OLvZ3fci0w/LWbJeVU8bt+pwhqoEBBtuupRIDtYfwgWl7p6ARM8QaP1zF70KoGLZBMv5Kx2uAwmH0KojqDhzkeIql7ER3gWWHvAiplOiYwbqycebPhpb8cuwTGddjaBDv; 4:7Z9UbRcZVT7ht5Z9OEi4V47zllYF3Tf9BmtOufJCNQCBnAL7QQyAEMTzVT9ZwXVGFcpH7raVqr5RYE1f6kicL5Y67TuEnMBMliqnajvzTBfbifQp/N/x13F4ZO4vFTTCJf0zNAi7zN3HaqmFN2ZtThTKc0KgN30i+T8CcIAbXICSVDlrfp5uBnX7PyljQalhzFY4SZ8tcnJtNCFFYkvsYwE0vCrA4vzKbVJCHBm+9I0j/mxlgZrGWzjmzh8xtA5eh6b99skeFtMPeC774G++D5zbuG7nUpcJ6ebw4tPBKrGWfWsaEw4hlPCnO1SUaGvXMrUBlniWtxw1ZIfDTS/5orIyEfXjAneF7FD0He78aRQ= X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(228905959029699)(17755550239193); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(3002001)(6055026)(6041248)(20161123558100)(20161123560025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BY2PR12MB0145; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BY2PR12MB0145; X-Forefront-PRVS: 039975700A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(7370300001)(4630300001)(6009001)(39860400002)(199003)(189002)(51234002)(54906002)(5003940100001)(6116002)(3846002)(53936002)(97736004)(86362001)(36756003)(81156014)(81166006)(110136004)(8676002)(189998001)(50986999)(76176999)(5660300001)(2361001)(25786009)(2351001)(50226002)(4326008)(7350300001)(33646002)(478600001)(53416004)(42186005)(2906002)(105586002)(7736002)(305945005)(106356001)(48376002)(50466002)(47776003)(66066001)(6486002)(6916009)(2950100002)(6666003)(68736007)(101416001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR12MB0145; H:brijesh-build-machine.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR12MB0145; 23:nrs30Rnd44INqUHFeBMfcrW39sQSKn2emc94NTWuI?= =?us-ascii?Q?ilKdDeD3wi29nImLFFiUwynFV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6EBy5/mk3NmbLyVne229qujS1J4wShClU1+i0leYKSkNO+RV/OgbSG5gnyD9b+0ugZv8nA/MVHZ+3NsCgI0rWwCzdyOHu2bqN/CwnERdHPESaZX6GDwM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 20:MW/V7lG94wYVzOUjQEwYFskMdDD8WZ3Oyp2MqWXEc2VEpZiZEXshdu1XbtFk9rxB6wXGlAfbURzhYHUjKyvZCx8o+dyC9CdEyrFRhyrxqb4g2PZVPGHxGPFRMkAPEUGh1IDZPRjPcC1/uMlFEsZJlarcSFExZMVB+E8QQyUTguS/Cgn0nC+n9Goeo/vZ7Fb2l62gsMAxHib4PzbIRF1tHXmo7apOWwuUjAu13sW8lnuS34pOfQyp+clNK+dBstbj X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2017 11:37:23.1743 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0145 Subject: [edk2] [PATCH v2 18/23] OvmfPkg/VirtioScsiDxe: Use DeviceAddresses in vring descriptors X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen , Tom Lendacky , Laszlo Ersek , Ard Biesheuvel Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The VirtioScsiPassThru(), programs the vring descriptor using the host addresses pointed-by virtio-scsi request, response and memory that is referenced inside the request and response header. The patch uses newly introduced VIRTIO_DEVICE_PROTOCOL.MapSharedBuffer() function to map system memory to device address and programs the vring descriptors with device addresses. Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Tom Lendacky Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Brijesh Singh --- OvmfPkg/VirtioScsiDxe/VirtioScsi.h | 1 + OvmfPkg/VirtioScsiDxe/VirtioScsi.c | 148 +++++++++++++++++--- 2 files changed, 133 insertions(+), 16 deletions(-) diff --git a/OvmfPkg/VirtioScsiDxe/VirtioScsi.h b/OvmfPkg/VirtioScsiDxe/Vir= tioScsi.h index 6d00567e8cb8..bb1c5c70ef74 100644 --- a/OvmfPkg/VirtioScsiDxe/VirtioScsi.h +++ b/OvmfPkg/VirtioScsiDxe/VirtioScsi.h @@ -60,6 +60,7 @@ typedef struct { VRING Ring; // VirtioRingInit 2 EFI_EXT_SCSI_PASS_THRU_PROTOCOL PassThru; // VirtioScsiInit 1 EFI_EXT_SCSI_PASS_THRU_MODE PassThruMode; // VirtioScsiInit 1 + VOID *RingBufMapping;// VirtioScsiInit 1 } VSCSI_DEV; =20 #define VIRTIO_SCSI_FROM_PASS_THRU(PassThruPointer) \ diff --git a/OvmfPkg/VirtioScsiDxe/VirtioScsi.c b/OvmfPkg/VirtioScsiDxe/Vir= tioScsi.c index a983b3df7b9c..65e9bda0827a 100644 --- a/OvmfPkg/VirtioScsiDxe/VirtioScsi.c +++ b/OvmfPkg/VirtioScsiDxe/VirtioScsi.c @@ -409,8 +409,13 @@ VirtioScsiPassThru ( UINT16 TargetValue; EFI_STATUS Status; volatile VIRTIO_SCSI_REQ Request; - volatile VIRTIO_SCSI_RESP Response; + VIRTIO_SCSI_RESP *Response; DESC_INDICES Indices; + VOID *RequestMapping; + VOID *ResponseMapping; + VOID *InDataMapping; + VOID *OutDataMapping; + EFI_PHYSICAL_ADDRESS DeviceAddress; =20 ZeroMem ((VOID*) &Request, sizeof (Request)); ZeroMem ((VOID*) &Response, sizeof (Response)); @@ -418,9 +423,41 @@ VirtioScsiPassThru ( Dev =3D VIRTIO_SCSI_FROM_PASS_THRU (This); CopyMem (&TargetValue, Target, sizeof TargetValue); =20 + Response =3D NULL; + ResponseMapping =3D NULL; + RequestMapping =3D NULL; + InDataMapping =3D NULL; + OutDataMapping =3D NULL; + + // + // Response header is bi-direction (we preset with host status and expec= t the + // device to update it). Allocate a response buffer which can be mapped = to + // access equally by both processor and device. + // + Status =3D Dev->VirtIo->AllocateSharedPages ( + Dev->VirtIo, + EFI_SIZE_TO_PAGES (sizeof *Response), + (VOID *) &Response + ); + if (EFI_ERROR (Status)) { + return Status; + } + + Status =3D VirtioMapAllBytesInSharedBuffer ( + Dev->VirtIo, + VirtioOperationBusMasterCommonBuffer, + (VOID *) Response, + sizeof (*Response), + &DeviceAddress, + &ResponseMapping + ); + if (EFI_ERROR (Status)) { + goto Free_Response_Buffer; + } + Status =3D PopulateRequest (Dev, TargetValue, Lun, Packet, &Request); if (EFI_ERROR (Status)) { - return Status; + goto Unmap_Response_Buffer; } =20 VirtioPrepare (&Dev->Ring, &Indices); @@ -428,7 +465,7 @@ VirtioScsiPassThru ( // // preset a host status for ourselves that we do not accept as success // - Response.Response =3D VIRTIO_SCSI_S_FAILURE; + Response->Response =3D VIRTIO_SCSI_S_FAILURE; =20 // // ensured by VirtioScsiInit() -- this predicate, in combination with the @@ -437,23 +474,51 @@ VirtioScsiPassThru ( ASSERT (Dev->Ring.QueueSize >=3D 4); =20 // + // Map the scsi-blk request header HostAddress to DeviceAddress + // + Status =3D VirtioMapAllBytesInSharedBuffer ( + Dev->VirtIo, + VirtioOperationBusMasterRead, + (VOID *) &Request, + sizeof Request, + &DeviceAddress, + &RequestMapping); + if (EFI_ERROR (Status)) { + goto Unmap_Response_Buffer; + } + + // // enqueue Request // - VirtioAppendDesc (&Dev->Ring, (UINTN) &Request, sizeof Request, + VirtioAppendDesc (&Dev->Ring, (UINTN) DeviceAddress, sizeof Request, VRING_DESC_F_NEXT, &Indices); =20 // // enqueue "dataout" if any // if (Packet->OutTransferLength > 0) { - VirtioAppendDesc (&Dev->Ring, (UINTN) Packet->OutDataBuffer, + // + // Map the buffer address to a device address + // + Status =3D VirtioMapAllBytesInSharedBuffer ( + Dev->VirtIo, + VirtioOperationBusMasterRead, + Packet->OutDataBuffer, + Packet->OutTransferLength, + &DeviceAddress, + &OutDataMapping + ); + if (EFI_ERROR (Status)) { + goto Unmap_Request_Buffer; + } + VirtioAppendDesc (&Dev->Ring, (UINTN) DeviceAddress, Packet->OutTransferLength, VRING_DESC_F_NEXT, &Indices); } =20 // // enqueue Response, to be written by the host // - VirtioAppendDesc (&Dev->Ring, (UINTN) &Response, sizeof Response, + VirtioAppendDesc (&Dev->Ring, (UINTN) Response, sizeof *Response, VRING_DESC_F_WRITE | (Packet->InTransferLength > 0 ? VRING_DESC_F_NEXT : 0), &Indices); @@ -462,7 +527,22 @@ VirtioScsiPassThru ( // enqueue "datain" if any, to be written by the host // if (Packet->InTransferLength > 0) { - VirtioAppendDesc (&Dev->Ring, (UINTN) Packet->InDataBuffer, + // + // Map the buffer address to a device address + // + Status =3D VirtioMapAllBytesInSharedBuffer ( + Dev->VirtIo, + VirtioOperationBusMasterWrite, + Packet->InDataBuffer, + Packet->InTransferLength, + &DeviceAddress, + &InDataMapping + ); + if (EFI_ERROR (Status)) { + goto Unmap_Out_Buffer; + } + + VirtioAppendDesc (&Dev->Ring, (UINTN) DeviceAddress, Packet->InTransferLength, VRING_DESC_F_WRITE, &Indices); } =20 @@ -480,7 +560,29 @@ VirtioScsiPassThru ( return EFI_DEVICE_ERROR; } =20 - return ParseResponse (Packet, &Response); + Status =3D ParseResponse (Packet, Response); + + if (Packet->InTransferLength > 0) { + Dev->VirtIo->UnmapSharedBuffer (Dev->VirtIo, InDataMapping); + } + +Unmap_Out_Buffer: + if (Packet->OutTransferLength > 0) { + Dev->VirtIo->UnmapSharedBuffer (Dev->VirtIo, OutDataMapping); + } + +Unmap_Request_Buffer: + Dev->VirtIo->UnmapSharedBuffer (Dev->VirtIo, RequestMapping); +Unmap_Response_Buffer: + Dev->VirtIo->UnmapSharedBuffer (Dev->VirtIo, ResponseMapping); +Free_Response_Buffer: + Dev->VirtIo->FreeSharedPages ( + Dev->VirtIo, + EFI_SIZE_TO_PAGES (sizeof *Response), + (VOID *) Response + ); + + return Status; } =20 =20 @@ -707,7 +809,7 @@ VirtioScsiInit ( { UINT8 NextDevStat; EFI_STATUS Status; - + UINT64 RingBaseShift; UINT64 Features; UINT16 MaxChannel; // for validation only UINT32 NumQueues; // for validation only @@ -838,18 +940,24 @@ VirtioScsiInit ( goto Failed; } =20 + Status =3D VirtioRingMap (Dev->VirtIo, &Dev->Ring, &RingBaseShift, + &Dev->RingBufMapping); + if (EFI_ERROR (Status)) { + goto ReleaseQueue; + } + // // Additional steps for MMIO: align the queue appropriately, and set the // size. If anything fails from here on, we must release the ring resour= ces. // Status =3D Dev->VirtIo->SetQueueNum (Dev->VirtIo, QueueSize); if (EFI_ERROR (Status)) { - goto ReleaseQueue; + goto UnmapQueue; } =20 Status =3D Dev->VirtIo->SetQueueAlign (Dev->VirtIo, EFI_PAGE_SIZE); if (EFI_ERROR (Status)) { - goto ReleaseQueue; + goto UnmapQueue; } =20 // @@ -857,7 +965,7 @@ VirtioScsiInit ( // Status =3D Dev->VirtIo->SetQueueAddress (Dev->VirtIo, &Dev->Ring, 0); if (EFI_ERROR (Status)) { - goto ReleaseQueue; + goto UnmapQueue; } =20 // @@ -867,7 +975,7 @@ VirtioScsiInit ( Features &=3D ~(UINT64)VIRTIO_F_VERSION_1; Status =3D Dev->VirtIo->SetGuestFeatures (Dev->VirtIo, Features); if (EFI_ERROR (Status)) { - goto ReleaseQueue; + goto UnmapQueue; } } =20 @@ -877,11 +985,11 @@ VirtioScsiInit ( // Status =3D VIRTIO_CFG_WRITE (Dev, CdbSize, VIRTIO_SCSI_CDB_SIZE); if (EFI_ERROR (Status)) { - goto ReleaseQueue; + goto UnmapQueue; } Status =3D VIRTIO_CFG_WRITE (Dev, SenseSize, VIRTIO_SCSI_SENSE_SIZE); if (EFI_ERROR (Status)) { - goto ReleaseQueue; + goto UnmapQueue; } =20 // @@ -890,7 +998,7 @@ VirtioScsiInit ( NextDevStat |=3D VSTAT_DRIVER_OK; Status =3D Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, NextDevStat); if (EFI_ERROR (Status)) { - goto ReleaseQueue; + goto UnmapQueue; } =20 // @@ -926,6 +1034,8 @@ VirtioScsiInit ( =20 return EFI_SUCCESS; =20 +UnmapQueue: + Dev->VirtIo->UnmapSharedBuffer (Dev->VirtIo, Dev->RingBufMapping); ReleaseQueue: VirtioRingUninit (Dev->VirtIo, &Dev->Ring); =20 @@ -995,6 +1105,12 @@ VirtioScsiExitBoot ( // Dev =3D Context; Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, 0); + + // + // If Ring buffer mapping exist then unmap it so that hypervisor can + // not get readable data after device reset. + // + Dev->VirtIo->UnmapSharedBuffer (Dev->VirtIo, Dev->RingBufMapping); } =20 =20 --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Fri Dec 27 01:42:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1502710712578183.789748039031; Mon, 14 Aug 2017 04:38:32 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 68A8421DFC882; Mon, 14 Aug 2017 04:35:04 -0700 (PDT) Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0052.outbound.protection.outlook.com [104.47.40.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 6CCD721D0A277 for ; Mon, 14 Aug 2017 04:35:02 -0700 (PDT) Received: from brijesh-build-machine.amd.com (165.204.77.1) by BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1341.21; Mon, 14 Aug 2017 11:37:24 +0000 X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=jBfgK1GkNHw1yM0dwjEJX1T/P7DaaaVQzyvFOrFvRds=; b=sTqKwJLSKv9tXxW2UAT0HQohFbhgUU8b65LxGpWmnoX8KCyAwSYFrFLaBY2TJNoVLR0/ky9pELSZo6xS2WKGpHbuS3nhbCXqCi8e+Dq8TRr4Gpwh7xH5CPNvD7sg4xWruA277pJSEBvP8lzQUaBd16xt3ez15wgWSJ3QQFbBqqQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; From: Brijesh Singh To: edk2-devel@lists.01.org Date: Mon, 14 Aug 2017 07:36:41 -0400 Message-Id: <1502710605-8058-20-git-send-email-brijesh.singh@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> References: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: MWHPR15CA0043.namprd15.prod.outlook.com (10.173.226.157) To BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 383a7a89-6cb2-45f0-64ea-08d4e308d586 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BY2PR12MB0145; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 3:aGw4tmdf3bj6VUYZAN8xktwaH8oGzznOE+WbxXUYQE8GrV1OIhw6JJtez6xJWKZW08hF5R2Rh0RsaREhWtYKM0Jaz+lmRkT7iAm9AKMKqAtTemGhRzNrJSHGoTYlwa9apPx2kAq7P0I2cYc8W9EvNVJ5nXWUUgxK3Lor8iYBZmVQNSc/Pb0jnSxZZXV9QqeyzToUOyI3SKOofr0x/ASW0NjCq1ZbClvGwR46wshUeyL10y/WD9ExKIN/IrFYJZrP; 25:tTJC3vwTZwECFgG/4PJzMHxH+avMTsgLCZ4/K0TPHm79676b/pnM7ol4mLUo1UxYlxILOF7mZDB85fw4oBPrnA8/W56As0PmcEmebP7Fc64V1T9Tfjs3Cd2gGHI4U1sMSs4gUjYDaIbJ3w7Y9tFCiLUmzJKpCWqlp0k8I2Av54nX8xf8pTI1gbQtsAaK9DsgO6biQhdfv4Cy0q5nWfcYOe8ZiZ3S7xEM1Wmcx2i9KL+XFAi73gDPwnbYyAmJthwEq32xsrrfSare3BTDHM8/k9dopNc9djod5SWIlDTsrOEQp7iPosQgNvQHV9j88TjSY2VXax9D7YbZ8B7LOXsWTQ==; 31:+squoLxYMeFkuNQlhPix6pDE0VcNMjPICMJwkw8tiFpNelcRQXzBUKCutNywlgWAB+m7x0jHv4SwHhdQsnKHY1bqO7oaKlriUSdlGARr/q3X1pPmtQAXIPzZleXV03kEeu1anJPCE5pwP3sVrOCEh2FanNtmYPP6w0nYID89IikgICDns3FaRbYIBsLom+kU6InqbQSsNpuyjCYJXxH/VZldwvCzGBWd0OvwmT+k8Xk= X-MS-TrafficTypeDiagnostic: BY2PR12MB0145: X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 20:OlbucGhrXrWiX44s3aI6aDP/5vSJChM8HDNDzcXuC5jk+fwZhraVwpSqnbtdwoTAw3eZy0X+UCX1e/vdOooZ2t4hEfnFqTmr6Of1QwgTZ0LUxqv/yikPwRdytAB4Hp6oPl1YLXF90E0eYC35GYX24dqAUuf/znLe3V+1inWcGdc3VpMx9UXuNygvlHCznkvw3r3DQu4OzF3OM5aakKZ6U0XuN7f41Qtuazwpy4arj453RMjYKxc92mGjs1ZFy1EghrNc9ODhKJQ7iGQLskgTsS9ndA7saayUc7NpkJWhBZ4SXXF1BVPGIqDwzos256sxm/qGm7CyR58SYqmUKSg2w+wOv0vBM2Z7fdTaRtL+oMWcHdcTGCARbHX1qxrbsvXElhrMB+SC3AMXyxevmsjhh3OJJ+2OHjDbt4IVDphPMtI1qcTZMpbNMlftP5c10g9OTSqmgonGms5Mk1TLBFpFUe9xgMx340H0wk99JZZU5IiBvPbKW8w7AyfFFLGNoYY9; 4:kArnQpWuSu3Niy2nLJLhkjce/Hou1DE34+t7ZavoQ79RFEOubbQRvRHycVwkdMmIAVF1HVPEPdhiwJbkynDHEfYX+GrJcTqNx/3az8GaHmn0953gaqIxnD4TfXYxJLiholeysgVt746U61Zo31GbnZILx6WmVu6Xg1b1cpZ4rgyu86xgQ9F5frGmNgh3OnxVn4ge3fjtBQ/5kAMxlZiqXMI1chFLcapI0Li9aTW0ohCDtbYDMzeomUpveYxd+FgMYdynhu30y7eq6iuKe7+opKTbWriXDC7+Sa8VWyNpxetO1wV/CaarpDtV8/yzd7vk11mdZ04EVDFJ1NcxJgJV0Z0p3UsPYgH/ngmFKHO1aTs= X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(228905959029699)(17755550239193); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(3002001)(6055026)(6041248)(20161123558100)(20161123560025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BY2PR12MB0145; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BY2PR12MB0145; X-Forefront-PRVS: 039975700A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(7370300001)(4630300001)(6009001)(39860400002)(199003)(189002)(51234002)(54906002)(5003940100001)(6116002)(3846002)(53936002)(97736004)(86362001)(36756003)(81156014)(81166006)(110136004)(8676002)(189998001)(50986999)(76176999)(5660300001)(2361001)(25786009)(2351001)(50226002)(4326008)(7350300001)(33646002)(478600001)(53416004)(42186005)(2906002)(105586002)(7736002)(305945005)(106356001)(48376002)(50466002)(47776003)(66066001)(6486002)(6916009)(2950100002)(6666003)(68736007)(101416001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR12MB0145; H:brijesh-build-machine.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR12MB0145; 23:FNPa9V3BmZtOVzwFcbkUUn7C6xL9k/kUtyoVs0Kuc?= =?us-ascii?Q?wKMpMUy8osY3GqdP+RybGVbxcjvss9kHyIWJk4b6EnJHTqH9XU6C+uion9+i?= =?us-ascii?Q?4yCVmFOAMFmGJMNgsS0evrmCe3a7UjzNhtMXcslbbTcMS6E9ISDJ9RkaDJzh?= =?us-ascii?Q?B1oG8n+fGnphyEbSeLvomYnFYrp89H+/frhRcM/wfF+21YH9T1J0Mf5cxNgj?= =?us-ascii?Q?rtVn1tlaTh7dxjZ1f6KE+NJ4D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/hjpqdEnlWMwq9yU3gV3XgL991Wtlh/HvA8/pAsoMWXwGXXyU7zVdoQWM+ERXg45GJaI3CZgZX0Prb02B6ltvh2Co5IgZLZtWQP3lhvAD330ofM3sclhWtrABVMRyAbHBSE0NCPRz1PYTwcOFfKahMv4RlO2vkk+pvWiWX6tD3utDDXjNxQp5YrvjkNMpocCnR9u3ltmuxz9hzbRsKy+W3xhH4DHWvMG8vrFvEZXj6CmsKBleC8TRfb X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2017 11:37:24.1586 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0145 Subject: [edk2] [PATCH v2 19/23] OvmfPkg/VirtioNetDxe: alloc Tx and Rx rings using AllocateSharedPage() X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen , Tom Lendacky , Laszlo Ersek , Ard Biesheuvel Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The Tx and Rx rings are accessed by both guest and hypervisor, allocate the rings using newly added VirtIo->AllocateSharedPages() and map it with BusMasterCommonBuffer so that it can be accessed by both guest and hypervisor. Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Tom Lendacky Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Brijesh Singh --- OvmfPkg/VirtioNetDxe/VirtioNet.h | 2 ++ OvmfPkg/VirtioNetDxe/Events.c | 7 +++++ OvmfPkg/VirtioNetDxe/SnpInitialize.c | 28 +++++++++++++++----- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/OvmfPkg/VirtioNetDxe/VirtioNet.h b/OvmfPkg/VirtioNetDxe/Virtio= Net.h index 710859bc6115..2964c946e26e 100644 --- a/OvmfPkg/VirtioNetDxe/VirtioNet.h +++ b/OvmfPkg/VirtioNetDxe/VirtioNet.h @@ -82,10 +82,12 @@ typedef struct { EFI_HANDLE MacHandle; // VirtioNetDriverBinding= Start =20 VRING RxRing; // VirtioNetInitRing + VOID *RxRingMap; // VirtioNetInitRing UINT8 *RxBuf; // VirtioNetInitRx UINT16 RxLastUsed; // VirtioNetInitRx =20 VRING TxRing; // VirtioNetInitRing + VOID *TxRingMap; // VirtioNetInitRing UINT16 TxMaxPending; // VirtioNetInitTx UINT16 TxCurPending; // VirtioNetInitTx UINT16 *TxFreeStack; // VirtioNetInitTx diff --git a/OvmfPkg/VirtioNetDxe/Events.c b/OvmfPkg/VirtioNetDxe/Events.c index 5be1af6ffbee..e832d40f7be4 100644 --- a/OvmfPkg/VirtioNetDxe/Events.c +++ b/OvmfPkg/VirtioNetDxe/Events.c @@ -88,4 +88,11 @@ VirtioNetExitBoot ( if (Dev->Snm.State =3D=3D EfiSimpleNetworkInitialized) { Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, 0); } + + // + // Unmap Tx and Rx rings so that hypervisor can not get readable data + // after device is reset. + // + Dev->VirtIo->UnmapSharedBuffer (Dev->VirtIo, Dev->TxRingMap); + Dev->VirtIo->UnmapSharedBuffer (Dev->VirtIo, Dev->RxRingMap); } diff --git a/OvmfPkg/VirtioNetDxe/SnpInitialize.c b/OvmfPkg/VirtioNetDxe/Sn= pInitialize.c index 0ecfe044a977..be2761d3d068 100644 --- a/OvmfPkg/VirtioNetDxe/SnpInitialize.c +++ b/OvmfPkg/VirtioNetDxe/SnpInitialize.c @@ -35,6 +35,7 @@ the network device. @param[out] Ring The virtio-ring inside the VNET_DEV structure, corresponding to Selector. + @param[out] Mapping A token return from the Map. =20 @retval EFI_UNSUPPORTED The queue size reported by the virtio-net devic= e is too small. @@ -49,11 +50,13 @@ EFIAPI VirtioNetInitRing ( IN OUT VNET_DEV *Dev, IN UINT16 Selector, - OUT VRING *Ring + OUT VRING *Ring, + OUT VOID **Mapping ) { EFI_STATUS Status; UINT16 QueueSize; + UINT64 RingBaseShift; =20 // // step 4b -- allocate selected queue @@ -79,30 +82,37 @@ VirtioNetInitRing ( return Status; } =20 + Status =3D VirtioRingMap (Dev->VirtIo, Ring, &RingBaseShift, Mapping); + if (EFI_ERROR (Status)) { + goto ReleaseQueue; + } + // // Additional steps for MMIO: align the queue appropriately, and set the // size. If anything fails from here on, we must release the ring resour= ces. // Status =3D Dev->VirtIo->SetQueueNum (Dev->VirtIo, QueueSize); if (EFI_ERROR (Status)) { - goto ReleaseQueue; + goto UnmapQueue; } =20 Status =3D Dev->VirtIo->SetQueueAlign (Dev->VirtIo, EFI_PAGE_SIZE); if (EFI_ERROR (Status)) { - goto ReleaseQueue; + goto UnmapQueue; } =20 // // step 4c -- report GPFN (guest-physical frame number) of queue // - Status =3D Dev->VirtIo->SetQueueAddress (Dev->VirtIo, Ring, 0); + Status =3D Dev->VirtIo->SetQueueAddress (Dev->VirtIo, Ring, RingBaseShif= t); if (EFI_ERROR (Status)) { - goto ReleaseQueue; + goto UnmapQueue; } =20 return EFI_SUCCESS; =20 +UnmapQueue: + Dev->VirtIo->UnmapSharedBuffer (Dev->VirtIo, Mapping); ReleaseQueue: VirtioRingUninit (Dev->VirtIo, Ring); =20 @@ -456,12 +466,14 @@ VirtioNetInitialize ( // // step 4b, 4c -- allocate and report virtqueues // - Status =3D VirtioNetInitRing (Dev, VIRTIO_NET_Q_RX, &Dev->RxRing); + Status =3D VirtioNetInitRing (Dev, VIRTIO_NET_Q_RX, &Dev->RxRing, + &Dev->RxRingMap); if (EFI_ERROR (Status)) { goto DeviceFailed; } =20 - Status =3D VirtioNetInitRing (Dev, VIRTIO_NET_Q_TX, &Dev->TxRing); + Status =3D VirtioNetInitRing (Dev, VIRTIO_NET_Q_TX, &Dev->TxRing, + &Dev->TxRingMap); if (EFI_ERROR (Status)) { goto ReleaseRxRing; } @@ -510,9 +522,11 @@ AbortDevice: Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, 0); =20 ReleaseTxRing: + Dev->VirtIo->UnmapSharedBuffer (Dev->VirtIo, Dev->TxRingMap); VirtioRingUninit (Dev->VirtIo, &Dev->TxRing); =20 ReleaseRxRing: + Dev->VirtIo->UnmapSharedBuffer (Dev->VirtIo, Dev->RxRingMap); VirtioRingUninit (Dev->VirtIo, &Dev->RxRing); =20 DeviceFailed: --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Fri Dec 27 01:42:53 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1502710716792820.1067570112906; Mon, 14 Aug 2017 04:38:36 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id A3BB521D0A27E; Mon, 14 Aug 2017 04:35:06 -0700 (PDT) Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0069.outbound.protection.outlook.com [104.47.40.69]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 6F10221DFC88C for ; Mon, 14 Aug 2017 04:35:04 -0700 (PDT) Received: from brijesh-build-machine.amd.com (165.204.77.1) by BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1341.21; Mon, 14 Aug 2017 11:37:25 +0000 X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=KksIGPtCcAIaP75hcZIFXBQ5igkYj2dU6PJKij4zii8=; b=j0MePgu9p6y8CTatU6n2rvNuuN0jjrJOqwXyToarbg3rjcX3WgHln3oqcixGqbfbXY0X2M6DnOeBHRolpBxCb6az/SRRxiXFrB9tgtJnqEUrAFmbXsPswG5AZtCTiMxFUY09Ta1yJ7ritpx5hNZZux9X5kAHGFnZoeYarDb2GjA= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; From: Brijesh Singh To: edk2-devel@lists.01.org Date: Mon, 14 Aug 2017 07:36:42 -0400 Message-Id: <1502710605-8058-21-git-send-email-brijesh.singh@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> References: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: MWHPR15CA0043.namprd15.prod.outlook.com (10.173.226.157) To BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 09640648-08b8-4be0-36ed-08d4e308d61a X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BY2PR12MB0145; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 3:pXsz4BwuCaabipk/KrBLNu0DvO4wk1cmHXjfKHAwOGmNm8YtJjliFvIKOEzexCKZL6J732KnyM5xqGJC4JezNK7QwLSMDQ020yvpOPLSJCGZ4uX8z/OURx/G0hFRFZ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t4c6HnnxQrqYscumv9ahMCz8s/TPZFy2szmQuoPg6fKVNXMGpLbZ7oHrqPmdGAPFyvNiYLOJD9r9YwLLAxThzv/Z2kMFp3uNfZeBH3YI1rsxIlHshDJX8UTRum4CvoFt1FvL/c23y+pEraRWNvaZ/3ghjyPB9kgARDWXSwo+TjvEOrjtBnu6xluUyv+Osoq+T4TY7RuSB/DyP+fi1QJR35; 4:l00g/Ma6hXxR9Xi/2mI7gjyKQWhjFaOwCmwoIPx8p12yzTGj0RDSR7syOCqCQVhMfzq/HRBnR77bvUflxqdStdoghgt3pAQ2LTFx4SmVMX7BCVyQy5ujWwAiv4M0+UoMJoOmISYtKcCmF7hjcuhk/7g1hPGyw6+9ilkiKAPufLVLf5Jg7cZhsM3jaslEMTRedHAWUCP6wpV2v1Tqm3ltnA7VuvCLtF8T73EnlzfOPmudb+kGEVOd7oGUDH68r4U9izCKY/TPCkuHlLbesuXj90RZ4L0Lq6EocgZv2uaUJMmZtA54+Jhd8yqbAQwrkX6AEYgw/6rD5PzBGXNMrR4OyA== X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(228905959029699); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(3002001)(6055026)(6041248)(20161123558100)(20161123560025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BY2PR12MB0145; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BY2PR12MB0145; X-Forefront-PRVS: 039975700A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(7370300001)(4630300001)(6029001)(6009001)(39860400002)(199003)(189002)(54906002)(5003940100001)(6116002)(3846002)(53936002)(97736004)(86362001)(36756003)(81156014)(81166006)(110136004)(8676002)(189998001)(50986999)(76176999)(5660300001)(2361001)(25786009)(2351001)(50226002)(4326008)(7350300001)(33646002)(478600001)(53416004)(42186005)(2906002)(105586002)(7736002)(305945005)(106356001)(48376002)(50466002)(47776003)(66066001)(6486002)(6916009)(2950100002)(6666003)(68736007)(101416001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR12MB0145; H:brijesh-build-machine.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR12MB0145; 23:M8GNU9MsAO2gYeDa0wwgJOzm0xmolduA8P381/low?= =?us-ascii?Q?1Xyvuafwssjd7VGY0SW6dZwylDh0i5+BkZEDtDGez5jJ2GzXQox1ABShLLb7?= =?us-ascii?Q?vwh7KRHz5zt9Q3Edgfz4Sri/u8wZjhTOswmHsXLlK8GYgGeooqKj23oC15eV?= =?us-ascii?Q?L8xdSha9tBDRN5Agkno62qBChEf34986wIoSgyk1ybWEd9y2SNzfbwaSGWh/?= =?us-ascii?Q?zFxaXC3kovcpeDVVi0PFNxoIVyVsQBE56PtzuWknYRfAqzWlwcSaTW//OSzO?= =?us-ascii?Q?AG6hxDS8Yz2zwyV+ThQXIVq3jiyyBP17Q0MQW9veg/gOiUPI7YMjcJu6WqH4?= =?us-ascii?Q?Gnbfboo0btUow42Rg18hBrF12mbac4rVR+fURwPX2fEfB8t2u3/saGVsUVCS?= =?us-ascii?Q?9tCQlwW67poG6u8XVKnBOnKGvI0iUDQIV7Ubpygq+livsuJNcblt+1y6p9RP?= =?us-ascii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XvUj8x9MNxBLGXDCHzdmGZPNVmdkYkD2/688oZic9HYBwaXYuwOov1k7HvFSHPk8FAlvXmdkzBi9j6eRz9tay0VCqHPmmmhNtHqNDq6f5nFgV0/IKu533nnwOZ1QVcZsu/esOD/p53xOjJercRzn3y6PcSzkLsGpksNNLX04C53rhjfQbvAA==; 5:iyxcsUJeUCWxrYL4HhRn34OIK0/4QCS0gKLuEh47uGNgm7noIqrLnLlwhYbg1wNtSJkiNVLqtgGrFrmzI5lEII6gEmH9jzo/U6BdRwxXBr2fuOctC+HQwkDTaIq9rpSoRX2GofddzEUNJlgoJJwJwA==; 24:MN3vmWX1JrOyAVne3TkwzaprN1zG95P9MJQIsimcXil/9fYAdIrhAEvIFkO/5V534yeBTFtkcqbbqcp12EPh/MkZg18tsWqRkSBiV2sfGj8=; 7:WVJnOaZzEc7BIGx9igAoQk3qMqHzVybG74YFHojMBYJSyUbGjio5zohDZMQ11jcaNzKXB8DXt0ComIpgCtnwHCgQMWFDmoVFxJtLJAaw29ZHSctHoRbu+ALhOK/yGNZJ67xnUwmJRZp2M9evBUaEv6zUvljp8L4kxVp6t43BhrwTCQdnQE8nykap0DbpWggAJw21dSPlFSnSn8eUM51ET2qiX+qUKYOO0X8xygHG3UY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 20:4ACCcHZTgIn/XIifJIvuNgjW/n6DrovzZjxU3BQZ8dlMjWxN+jvief80CP7jRxC2gH7t5sBCpnUANSYNx85S/1mscYKEVo+/c6YPe7rtbZxARnWwhvLZP3f9BpdRwzl9LaynsoVGLE73KOQ3DlI6OaJ9543X7n2qvHoQYVSrVcChY7i4AwfubTA2E+zfp2mQ8dY5GurpqBqH3KU3vDnt0DCTs+u1NbpobnP+W68TqZbdbsQoJtwVB9Ih7BbjPALf X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2017 11:37:25.1274 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0145 Subject: [edk2] [PATCH v2 20/23] OvmfPkg/VirtioNetDxe: alloc RxBuf using AllocateSharedPages() X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen , Tom Lendacky , Laszlo Ersek , Ard Biesheuvel Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" RxBuf is shared between guest and hypervisor, use AllocateSharedPages() to allocate this memory region and map it with BusMasterCommonBuffer operation so that it can be accessed by guest and hypervisor. Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Tom Lendacky Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Brijesh Singh --- OvmfPkg/VirtioNetDxe/VirtioNet.h | 3 + OvmfPkg/VirtioNetDxe/Events.c | 6 ++ OvmfPkg/VirtioNetDxe/SnpInitialize.c | 68 ++++++++++++++++---- OvmfPkg/VirtioNetDxe/SnpSharedHelpers.c | 6 +- 4 files changed, 69 insertions(+), 14 deletions(-) diff --git a/OvmfPkg/VirtioNetDxe/VirtioNet.h b/OvmfPkg/VirtioNetDxe/Virtio= Net.h index 2964c946e26e..a4661bd5d2fe 100644 --- a/OvmfPkg/VirtioNetDxe/VirtioNet.h +++ b/OvmfPkg/VirtioNetDxe/VirtioNet.h @@ -4,6 +4,7 @@ Protocol instances for virtio-net devices. =20 Copyright (C) 2013, Red Hat, Inc. + Copyright (c) 2017, AMD Inc, All rights reserved.
=20 This program and the accompanying materials are licensed and made availa= ble under the terms and conditions of the BSD License which accompanies this @@ -85,6 +86,8 @@ typedef struct { VOID *RxRingMap; // VirtioNetInitRing UINT8 *RxBuf; // VirtioNetInitRx UINT16 RxLastUsed; // VirtioNetInitRx + UINTN RxBufNoPages; // VirtioNetInitRx + VOID *RxBufMap; // VirtioNetInitRx =20 VRING TxRing; // VirtioNetInitRing VOID *TxRingMap; // VirtioNetInitRing diff --git a/OvmfPkg/VirtioNetDxe/Events.c b/OvmfPkg/VirtioNetDxe/Events.c index e832d40f7be4..2f61da6aece4 100644 --- a/OvmfPkg/VirtioNetDxe/Events.c +++ b/OvmfPkg/VirtioNetDxe/Events.c @@ -95,4 +95,10 @@ VirtioNetExitBoot ( // Dev->VirtIo->UnmapSharedBuffer (Dev->VirtIo, Dev->TxRingMap); Dev->VirtIo->UnmapSharedBuffer (Dev->VirtIo, Dev->RxRingMap); + + // + // Unmap Rx buffer so that hypervisor can not get readable data after + // device is reset. + // + Dev->VirtIo->UnmapSharedBuffer (Dev->VirtIo, Dev->RxBufMap); } diff --git a/OvmfPkg/VirtioNetDxe/SnpInitialize.c b/OvmfPkg/VirtioNetDxe/Sn= pInitialize.c index be2761d3d068..db2314446bbb 100644 --- a/OvmfPkg/VirtioNetDxe/SnpInitialize.c +++ b/OvmfPkg/VirtioNetDxe/SnpInitialize.c @@ -247,13 +247,16 @@ VirtioNetInitRx ( IN OUT VNET_DEV *Dev ) { - EFI_STATUS Status; - UINTN VirtioNetReqSize; - UINTN RxBufSize; - UINT16 RxAlwaysPending; - UINTN PktIdx; - UINT16 DescIdx; - UINT8 *RxPtr; + EFI_STATUS Status; + UINTN VirtioNetReqSize; + UINTN RxBufSize; + UINT16 RxAlwaysPending; + UINTN PktIdx; + UINT16 DescIdx; + UINT8 *RxPtr; + UINTN NumBytes; + EFI_PHYSICAL_ADDRESS DeviceAddress; + UINT64 BufBaseShift; =20 // // In VirtIo 1.0, the NumBuffers field is mandatory. In 0.9.5, it depend= s on @@ -278,11 +281,37 @@ VirtioNetInitRx ( // RxAlwaysPending =3D (UINT16) MIN (Dev->RxRing.QueueSize / 2, VNET_MAX_PE= NDING); =20 - Dev->RxBuf =3D AllocatePool (RxAlwaysPending * RxBufSize); - if (Dev->RxBuf =3D=3D NULL) { - return EFI_OUT_OF_RESOURCES; + // + // The RxBuf is shared between guest and hypervisor, use SharedPages() to + // allocate this memory region and Map() it using BusMasterCommonBuffer + // operation so that it can be accessed equally by both guest and + // hypervisor. + // + NumBytes =3D RxAlwaysPending * RxBufSize; + Dev->RxBufNoPages =3D EFI_SIZE_TO_PAGES (NumBytes); + Status =3D Dev->VirtIo->AllocateSharedPages ( + Dev->VirtIo, + Dev->RxBufNoPages, + (VOID *) &Dev->RxBuf + ); + if (EFI_ERROR (Status)) { + return Status; } =20 + Status =3D VirtioMapAllBytesInSharedBuffer ( + Dev->VirtIo, + VirtioOperationBusMasterCommonBuffer, + Dev->RxBuf, + NumBytes, + &DeviceAddress, + &Dev->RxBufMap + ); + if (EFI_ERROR (Status)) { + goto FreeSharedBuffer; + } + + BufBaseShift =3D (UINT64) (UINTN)Dev->RxBuf - (UINT64) DeviceAddress; + // // virtio-0.9.5, 2.4.2 Receiving Used Buffers From the Device // @@ -304,6 +333,11 @@ VirtioNetInitRx ( DescIdx =3D 0; RxPtr =3D Dev->RxBuf; for (PktIdx =3D 0; PktIdx < RxAlwaysPending; ++PktIdx) { + UINT64 Address; + + Address =3D (UINTN) RxPtr; + Address +=3D BufBaseShift; + // // virtio-0.9.5, 2.4.1.2 Updating the Available Ring // invisible to the host until we update the Index Field @@ -313,13 +347,13 @@ VirtioNetInitRx ( // // virtio-0.9.5, 2.4.1.1 Placing Buffers into the Descriptor Table // - Dev->RxRing.Desc[DescIdx].Addr =3D (UINTN) RxPtr; + Dev->RxRing.Desc[DescIdx].Addr =3D (UINTN) Address; Dev->RxRing.Desc[DescIdx].Len =3D (UINT32) VirtioNetReqSize; Dev->RxRing.Desc[DescIdx].Flags =3D VRING_DESC_F_WRITE | VRING_DESC_F_= NEXT; Dev->RxRing.Desc[DescIdx].Next =3D (UINT16) (DescIdx + 1); RxPtr +=3D Dev->RxRing.Desc[DescIdx++].Len; =20 - Dev->RxRing.Desc[DescIdx].Addr =3D (UINTN) RxPtr; + Dev->RxRing.Desc[DescIdx].Addr =3D (UINTN) Address; Dev->RxRing.Desc[DescIdx].Len =3D (UINT32) (RxBufSize - VirtioNetReq= Size); Dev->RxRing.Desc[DescIdx].Flags =3D VRING_DESC_F_WRITE; RxPtr +=3D Dev->RxRing.Desc[DescIdx++].Len; @@ -343,10 +377,18 @@ VirtioNetInitRx ( Status =3D Dev->VirtIo->SetQueueNotify (Dev->VirtIo, VIRTIO_NET_Q_RX); if (EFI_ERROR (Status)) { Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, 0); - FreePool (Dev->RxBuf); + goto UnmapSharedBuffer; } =20 return Status; + +UnmapSharedBuffer: + Dev->VirtIo->UnmapSharedBuffer (Dev->VirtIo, Dev->RxBufMap); + +FreeSharedBuffer: + Dev->VirtIo->FreeSharedPages (Dev->VirtIo, Dev->RxBufNoPages, + (VOID *) Dev->RxBuf); + return Status; } =20 =20 diff --git a/OvmfPkg/VirtioNetDxe/SnpSharedHelpers.c b/OvmfPkg/VirtioNetDxe= /SnpSharedHelpers.c index 9fedb72fdbd4..ec8e63ebdc32 100644 --- a/OvmfPkg/VirtioNetDxe/SnpSharedHelpers.c +++ b/OvmfPkg/VirtioNetDxe/SnpSharedHelpers.c @@ -39,7 +39,11 @@ VirtioNetShutdownRx ( IN OUT VNET_DEV *Dev ) { - FreePool (Dev->RxBuf); + Dev->VirtIo->FreeSharedPages ( + Dev->VirtIo, + Dev->RxBufNoPages, + (VOID *) Dev->RxBuf + ); } =20 =20 --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Fri Dec 27 01:42:53 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 150271072197578.87126140014584; Mon, 14 Aug 2017 04:38:41 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id E388821DFE937; Mon, 14 Aug 2017 04:35:06 -0700 (PDT) Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0052.outbound.protection.outlook.com [104.47.40.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5BF7221DFE91B for ; Mon, 14 Aug 2017 04:35:05 -0700 (PDT) Received: from brijesh-build-machine.amd.com (165.204.77.1) by BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1341.21; Mon, 14 Aug 2017 11:37:26 +0000 X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=6a+koTsBzvw4AqRrbSYGW9aqPzE0gVbxslLGe+Ph+ts=; b=l3otnNKrRYSH7kho3ZyJH4hvZ13ylOzK6GpaXbcPR+gI4fMun0xH3lWwq62uDCTul9GYEUifSMQCRfEjS9q05sJU377y3eIHkn107fJCIa19Ll2hFD2dHpVEJC2MGoMVHO65d/0VGkxvGP1KxcGO72JlJBHDVKi4PcEgZK+S7ok= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; From: Brijesh Singh To: edk2-devel@lists.01.org Date: Mon, 14 Aug 2017 07:36:43 -0400 Message-Id: <1502710605-8058-22-git-send-email-brijesh.singh@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> References: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: MWHPR15CA0043.namprd15.prod.outlook.com (10.173.226.157) To BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 60ab2009-4ed1-46a6-6b4e-08d4e308d6b0 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BY2PR12MB0145; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 3:1dFHaWeOLxe2KnFLEZiiifuVUJYwxguSQwxE9pxoahlkZsPBJof9+mzrdJH0dRzy9m/bXIP4+q3s+WiaZD8AwWLnXdqP9NN1wAvZO5YY2Kpm9HGw6TsM4lQSHwAemE2Som+Yu7suxSHAnuEnGd+JKJHo5T7CjK/jZ3IoTPnA724FmHFOEIcUBcyCEQ1qQ5KCRwOP03Ot+EYZRn1XHqhRl5mvOmTlXb3qx7TIMLZXAV9zjMIRhfcSuOqFvT92m0hG; 25:sSWiVZ5pE2ug0424yGqc9+DFXKxEMIjMMptZEUYlGybrTeBOdGNvJLOtuqNmfx+HUuMDKz6Qu6c61VM7pFLH3SfpJXGWOnDmeCGHugyZpYOs6TqrNHbWhvRdEayY3sNhh251l4xxz45KfYDx/Ofe5Wo66argArvmkEFcxQ+xC8O/fZFMH6BSbcVLsskBwSNbiaPYeHAejton6+zFjuI6adnyopyCQLpqKnUDNzeA2M17x0a4WiVqGsjmYYn7cXkLedL2KEs6tzrxOYiHLw2kygwnj4x6zCs+Jc4auOBB8t1mrO3LIXd2ENQCJOJzUvQ7xY6BZO9U2q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MBRf3WohX4Am5Mq31yDpnpo7TRfJbxCQE3tfuEnUKLj2Ek0JAmTPnVu+DSgPS/3qpmrPPpV8DI/6BjozpgHFj8rKA== X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(228905959029699); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(3002001)(6055026)(6041248)(20161123558100)(20161123560025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BY2PR12MB0145; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BY2PR12MB0145; X-Forefront-PRVS: 039975700A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(7370300001)(4630300001)(6009001)(39860400002)(199003)(189002)(54906002)(5003940100001)(6116002)(3846002)(53936002)(97736004)(86362001)(36756003)(81156014)(81166006)(110136004)(8676002)(189998001)(50986999)(76176999)(5660300001)(2361001)(25786009)(2351001)(50226002)(4326008)(7350300001)(33646002)(478600001)(53416004)(42186005)(2906002)(105586002)(7736002)(305945005)(106356001)(48376002)(50466002)(47776003)(66066001)(6486002)(6916009)(2950100002)(6666003)(68736007)(101416001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR12MB0145; H:brijesh-build-machine.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR12MB0145; 23:VOZtuj5BVgsUbn0DGJu9KiEcbtd81wy4irx4XPYTW?= =?us-ascii?Q?XbL3fOVYWmCAbdo7vi/XGKxwfSFk/gviJrUXC7qKIouJoWbHDCxFYdp45RDf?= =?us-ascii?Q?TzZEOn5IrIEktLoDmrlVBeli/jRvWaDd5lzthUUA4qoLDuNlliRAbBljfkEu?= =?us-ascii?Q?irwrpBUAVD/BIRW3Yr615ZoFnwp+/j5eDpCt7cpmc8tqiKBcgdTCo7KGdWOA?= =?us-ascii?Q?RwSs48DL6EAmdNmz5xdZpCdVBWfKAp6CArNIHDKVU60nR6z8P1gSEHZK5my6?= =?us-ascii?Q?VF0P+VOdqVsVGy5qrO8B/+O2hzW7QXJshEMBHNYlzaBLJA5ksqibbL2cm1Wc?= =?us-ascii?Q?W4A7O8FuNnh1gIvLZacbGSz6Fn5uWUpc5ZD5j/3MiXwbdg/HrJtnwmAK6lLO?= =?us-ascii?Q?Y73AEVsafTaTaXsBVG3pP60QxRxbOyJr6pFzIa/fDyS8ze+8qf4KuCnCykUg?= =?us-ascii?Q?61F+BX2X+3NFuskM8XLRG/uwP6x54gfhDfYpxxV44qtQFP15L++8sXE4qHfZ?= =?us-ascii?Q?LcePknXqOESY2t0/1kBsQPysm2MzXhuvhqaF5iLlXwrPltIZeNnTj7B/ZKeK?= =?us-ascii?Q?2CTOm9payXfUadLOD5Utx1Gt3wAwDfLX+vdtCt+jxwOBYAjIB616YQvhqCk8?= =?us-ascii?Q?iDbewefCYrcxgCMrVYvPAquvSO3nZP3yibixvJAANoFu8lp2s/bmirjxfNS7?= =?us-ascii?Q?gyDxYXQ2S8y4qclxL9oNVsN9o0LxalC5lSt4JsLtm5/dbp4wsVzynelRm2yc?= =?us-ascii?Q?0k4pLZI1RdW/N3ci/3h8zV6lBN/0tDMNRhYfmeeXDhm77NhcAd6XWhYqEViz?= =?us-ascii?Q?9K/xyNpyfOlnJr25Cwc9b81p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m+Qv9P8+GEwPvFRltI6OuM+6cWhllS6eKoryOHbZVtFHI5QEPNV4Q3JAidCDtotbsHHtfLz9evYVLXGLrDOjZtAMnesbTUwB+K0kLWcphnFYLJkUri8dZFdrz3sMHRihWjCTl1FgBPWoO6Edzwu3WQSfX7uvKKKjFLG4pk0UaesnsQTymdA/2jwNGw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 20:0Bnjs5bcoFgEiUkFyLkRcihxs6i1f1kSr9iRdzGWLwBN5I7eE/pdBwMve4Mwg2PfPMpFaT0pwU+3Uc5u7Jhh2VUzQHMFwqWRPSMlpHiRgDH66b6zQ6pQEsl2VJ4YHf/XaTpWZNqwmIpfPdNqwi1025ShYCtItomBy7v5Ijw4ElyprqzD21GYohAIpLl4YBlY8C3U/DMGPOOeDxKtC1uEC9eS0FfRZh4fOv8jFCYP+NaK4e2euOt9wQbG/7fVthJb X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2017 11:37:26.1118 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0145 Subject: [edk2] [PATCH v2 21/23] OvmfPkg/VirtioNetDxe: dynamically alloc transmit header X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen , Tom Lendacky , Laszlo Ersek , Ard Biesheuvel Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" A network packets are transmitted by placing then into a transmit queue, each packet is preceded by a VIRTIO_1_0_NET_REQ header. VirtioNetInitTx(), builds the header once and fills the vring descriptors with the system physical address of header. The patch uses VirtIo->AllocateSharedPages() to allocate the header buffer and map it with BusMasterCommonBuffer so that it can be equally accessed by both processor and device. We could map it with BusMasterRead but since the header pointer is used after it was added into vring hence I choose to dynamically allocate it and map it with BusMasterCommonBuffer to avoid the code complexity. Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Tom Lendacky Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Brijesh Singh --- OvmfPkg/VirtioNetDxe/VirtioNet.h | 3 +- OvmfPkg/VirtioNetDxe/Events.c | 6 ++ OvmfPkg/VirtioNetDxe/SnpInitialize.c | 60 +++++++++++++++++--- OvmfPkg/VirtioNetDxe/SnpSharedHelpers.c | 6 ++ 4 files changed, 66 insertions(+), 9 deletions(-) diff --git a/OvmfPkg/VirtioNetDxe/VirtioNet.h b/OvmfPkg/VirtioNetDxe/Virtio= Net.h index a4661bd5d2fe..873069e9de82 100644 --- a/OvmfPkg/VirtioNetDxe/VirtioNet.h +++ b/OvmfPkg/VirtioNetDxe/VirtioNet.h @@ -94,7 +94,8 @@ typedef struct { UINT16 TxMaxPending; // VirtioNetInitTx UINT16 TxCurPending; // VirtioNetInitTx UINT16 *TxFreeStack; // VirtioNetInitTx - VIRTIO_1_0_NET_REQ TxSharedReq; // VirtioNetInitTx + VIRTIO_1_0_NET_REQ *TxSharedReq; // VirtioNetInitTx + VOID *TxSharedReqMap; // VirtioNetInitTx UINT16 TxLastUsed; // VirtioNetInitTx } VNET_DEV; =20 diff --git a/OvmfPkg/VirtioNetDxe/Events.c b/OvmfPkg/VirtioNetDxe/Events.c index 2f61da6aece4..21468f44a3f0 100644 --- a/OvmfPkg/VirtioNetDxe/Events.c +++ b/OvmfPkg/VirtioNetDxe/Events.c @@ -101,4 +101,10 @@ VirtioNetExitBoot ( // device is reset. // Dev->VirtIo->UnmapSharedBuffer (Dev->VirtIo, Dev->RxBufMap); + + // + // Unmap shared Tx request mapping so that hypervisor can not get readab= le + // data after device is reset. + // + Dev->VirtIo->UnmapSharedBuffer (Dev->VirtIo, Dev->TxSharedReqMap); } diff --git a/OvmfPkg/VirtioNetDxe/SnpInitialize.c b/OvmfPkg/VirtioNetDxe/Sn= pInitialize.c index db2314446bbb..9bac19f8e3d1 100644 --- a/OvmfPkg/VirtioNetDxe/SnpInitialize.c +++ b/OvmfPkg/VirtioNetDxe/SnpInitialize.c @@ -18,6 +18,7 @@ **/ =20 #include +#include #include #include =20 @@ -149,8 +150,11 @@ VirtioNetInitTx ( IN OUT VNET_DEV *Dev ) { - UINTN TxSharedReqSize; - UINTN PktIdx; + UINTN TxSharedReqSize; + UINTN PktIdx; + EFI_STATUS Status; + EFI_PHYSICAL_ADDRESS DeviceAddress; + UINT64 BufBaseShift; =20 Dev->TxMaxPending =3D (UINT16) MIN (Dev->TxRing.QueueSize / 2, VNET_MAX_PENDING); @@ -162,24 +166,57 @@ VirtioNetInitTx ( } =20 // + // Allocate TxSharedReq header and map with BusMasterCommonBuffer so tha= t it + // can be accessed equally by both processor and device. + // + Status =3D Dev->VirtIo->AllocateSharedPages ( + Dev->VirtIo, + EFI_SIZE_TO_PAGES (sizeof *(Dev->TxSharedReq)), + (VOID *) &Dev->TxSharedReq + ); + if (EFI_ERROR (Status)) { + return Status; + } + + Status =3D VirtioMapAllBytesInSharedBuffer ( + Dev->VirtIo, + VirtioOperationBusMasterCommonBuffer, + (VOID *) Dev->TxSharedReq, + sizeof *(Dev->TxSharedReq), + &DeviceAddress, + &Dev->TxSharedReqMap + ); + if (EFI_ERROR (Status)) { + goto FreeBuffer; + } + + BufBaseShift =3D (UINT64) (UINTN)Dev->TxSharedReq - (UINT64) DeviceAddre= ss; + + ZeroMem ((VOID *) Dev->TxSharedReq, sizeof *(Dev->TxSharedReq)); + + // // In VirtIo 1.0, the NumBuffers field is mandatory. In 0.9.5, it depend= s on // VIRTIO_NET_F_MRG_RXBUF, which we never negotiate. // TxSharedReqSize =3D (Dev->VirtIo->Revision < VIRTIO_SPEC_REVISION (1, 0,= 0)) ? - sizeof Dev->TxSharedReq.V0_9_5 : - sizeof Dev->TxSharedReq; + sizeof ((Dev->TxSharedReq)->V0_9_5) : + sizeof *(Dev->TxSharedReq); =20 for (PktIdx =3D 0; PktIdx < Dev->TxMaxPending; ++PktIdx) { UINT16 DescIdx; + UINT64 Address; =20 DescIdx =3D (UINT16) (2 * PktIdx); Dev->TxFreeStack[PktIdx] =3D DescIdx; =20 + Address =3D (UINTN) Dev->TxSharedReq; + Address +=3D BufBaseShift; + // // For each possibly pending packet, lay out the descriptor for the co= mmon // (unmodified by the host) virtio-net request header. // - Dev->TxRing.Desc[DescIdx].Addr =3D (UINTN) &Dev->TxSharedReq; + Dev->TxRing.Desc[DescIdx].Addr =3D (UINTN) Address; Dev->TxRing.Desc[DescIdx].Len =3D (UINT32) TxSharedReqSize; Dev->TxRing.Desc[DescIdx].Flags =3D VRING_DESC_F_NEXT; Dev->TxRing.Desc[DescIdx].Next =3D (UINT16) (DescIdx + 1); @@ -194,13 +231,13 @@ VirtioNetInitTx ( // // virtio-0.9.5, Appendix C, Packet Transmission // - Dev->TxSharedReq.V0_9_5.Flags =3D 0; - Dev->TxSharedReq.V0_9_5.GsoType =3D VIRTIO_NET_HDR_GSO_NONE; + Dev->TxSharedReq->V0_9_5.Flags =3D 0; + Dev->TxSharedReq->V0_9_5.GsoType =3D VIRTIO_NET_HDR_GSO_NONE; =20 // // For VirtIo 1.0 only -- the field exists, but it is unused // - Dev->TxSharedReq.NumBuffers =3D 0; + Dev->TxSharedReq->NumBuffers =3D 0; =20 // // virtio-0.9.5, 2.4.2 Receiving Used Buffers From the Device @@ -215,6 +252,13 @@ VirtioNetInitTx ( *Dev->TxRing.Avail.Flags =3D (UINT16) VRING_AVAIL_F_NO_INTERRUPT; =20 return EFI_SUCCESS; +FreeBuffer: + Dev->VirtIo->FreeSharedPages ( + Dev->VirtIo, + EFI_SIZE_TO_PAGES (sizeof *(Dev->TxSharedReq)), + (VOID *) Dev->TxSharedReq + ); + return Status; } =20 =20 diff --git a/OvmfPkg/VirtioNetDxe/SnpSharedHelpers.c b/OvmfPkg/VirtioNetDxe= /SnpSharedHelpers.c index ec8e63ebdc32..6e7166144f2d 100644 --- a/OvmfPkg/VirtioNetDxe/SnpSharedHelpers.c +++ b/OvmfPkg/VirtioNetDxe/SnpSharedHelpers.c @@ -53,5 +53,11 @@ VirtioNetShutdownTx ( IN OUT VNET_DEV *Dev ) { + Dev->VirtIo->FreeSharedPages ( + Dev->VirtIo, + EFI_SIZE_TO_PAGES (sizeof *(Dev->TxSharedReq)), + (VOID *) Dev->TxSharedReq + ); + FreePool (Dev->TxFreeStack); } --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Fri Dec 27 01:42:53 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1502710727022585.1850334978794; Mon, 14 Aug 2017 04:38:47 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 2BD0821E0C2F7; Mon, 14 Aug 2017 04:35:08 -0700 (PDT) Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0068.outbound.protection.outlook.com [104.47.40.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 15AED21D0A277 for ; Mon, 14 Aug 2017 04:35:07 -0700 (PDT) Received: from brijesh-build-machine.amd.com (165.204.77.1) by BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1341.21; Mon, 14 Aug 2017 11:37:27 +0000 X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=AdG9CClAiaKFx+VBu53mqO5txZGQUB/+gMsc6f+/Dis=; b=cXjbCbWprt5IIEC8pP74+3EevuxEOKYFFLurll/V1ylMOoOp2H7wR8vP5shNWM2Dmewt2ikSCXUMf8IkiWE/tVTtjIl1HzjpMX6vCBnRsF1uyKm4l9AW6Gg7HTBHWcXLamAMEq3Plv7Cy7nz+MqxfyX7rzU1Cmt8jHQJ+P5KxCo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; From: Brijesh Singh To: edk2-devel@lists.01.org Date: Mon, 14 Aug 2017 07:36:44 -0400 Message-Id: <1502710605-8058-23-git-send-email-brijesh.singh@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> References: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: MWHPR15CA0043.namprd15.prod.outlook.com (10.173.226.157) To BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7e84edf0-fc1e-46a6-9a1a-08d4e308d7c2 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BY2PR12MB0145; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 3:4QfoGxbcabrHaPZBN3Nb9dZIxoZ741G3ope/PYH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72Kq+cuBO59+iHMHZriHT90t/Al5I9qfb4FjpMkQK56dfsZauRcUd3ZlGSJ5BGEGynOcxE4npMUVGxOw/oCvxy5BDuw9Ijn8nFfPzhJI59fCjuDdz5vbr8kJCcH8jsdT5wiRIJ0qJNgF378XV1F9EpuK99MRCgCdb68K4LrJUq3CFhF2kUx0tQqedaq0wHPAVxWdeVrpGSXFcIFpGbgG131ZNIwl9D1JhaP912ZDp2urdwI8hk/XjNm7Hh07jKvmxpFYiZ7b++ZSwTOpFTs/D4Id4+/9u+yj8VQoXEewW1VtRwngzbb1R85+f9ZnVAik; 4:VVD0KSM3xvNXHPK5UIn9qqClXd/7Fquo3uVxZ8syKyxv/dCEqJ7GdRbmAlke3zsS8NSZc25FSnPNG0ToyR45cLZ53crBW6TMpi3htb/bYF1vEMf2u6/YWeptcv2jWBE+JNwTKeJ4jfl/+Okr+DnR/Nwr23lzdb1jwe0XpcCKXgQrH0tAo3upzKL1ZkgXN0UFmjBkYa4+2Ga6s5TFz6itFyHMtxhVtUwt7eQnZ49b3fF0HI9uh868z+3iljFHFzwp/DGzqr9+JUp90s/EorlByFZRGd4cUz3FogJyIYtIgwjC5frgGesYsiK30NsHIGxK2Fei4EFZ7HBntFvMQZA8Cb6nO5LSEaEyDZRRD/5rX7A= X-Exchange-Antispam-Report-Test: UriScan:(20558992708506)(767451399110)(228905959029699); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(3002001)(6055026)(6041248)(20161123558100)(20161123560025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BY2PR12MB0145; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BY2PR12MB0145; X-Forefront-PRVS: 039975700A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(7370300001)(4630300001)(6009001)(39860400002)(199003)(189002)(54906002)(5003940100001)(6116002)(3846002)(53936002)(97736004)(86362001)(36756003)(81156014)(81166006)(110136004)(8676002)(189998001)(50986999)(76176999)(5660300001)(2361001)(25786009)(2351001)(50226002)(4326008)(7350300001)(33646002)(478600001)(53416004)(42186005)(2906002)(105586002)(7736002)(305945005)(106356001)(48376002)(50466002)(47776003)(66066001)(6486002)(6916009)(2950100002)(6666003)(68736007)(101416001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR12MB0145; H:brijesh-build-machine.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR12MB0145; 23:SQE30cPOIPIcaDIp2jXP16IOfUMS8Goqm/FlRfb9n?= =?us-ascii?Q?CYSAgex4MlvhOahnI+2dImKXHfelT/nrHzZwRgHTNN+sFY+0kQ2aEmY9Rj19?= =?us-ascii?Q?MN3YkBM4q9zEBx9xoMEoGgXmuLFs2xNLlDJu8pnC4mFYbCRrYai4ZGov7ovh?= =?us-ascii?Q?8SrLQHjfd9uQLhO33sDGo1dZtz0mftUVv2Q3/XrHxhagKQocBE64PuSQECBu?= =?us-ascii?Q?/pwZjnEkhW6yoAAhC7tn0LwzL2vjyDxbchQDtO3NWgf+OcL2i1ChMoK0PMRL?= =?us-ascii?Q?6zxlLxOHYLtFbmZeIjjvJZMv3B3k+D508THEcyJy0SWtDAuflljeEs84N3dD?= =?us-ascii?Q?tbBov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RJvr8EvcIMjWko50A/RVYpFxTQVFNswcnwt6U8UOgKBCv5n2h9Wq7kNS X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2017 11:37:27.8930 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0145 Subject: [edk2] [PATCH v2 22/23] OvmfPkg/VirtioNetDxe: map transmit buffer host address to device address X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen , Tom Lendacky , Laszlo Ersek , Ard Biesheuvel Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Update VirtioNetTransmit() to map the callers transmit buffer to a device address and use the DeviceAddress in vring descriptors. Since the transmit buffers are returned back to caller in VirtioNetGetStatus() hence we maintain a simple list to map DeviceAddress to HostAddress. The list is used for mapping to HostAddress after the data is succesfully transmitted. Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Tom Lendacky Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Brijesh Singh --- OvmfPkg/VirtioNetDxe/VirtioNet.h | 17 +++ OvmfPkg/VirtioNetDxe/SnpGetStatus.c | 19 +++- OvmfPkg/VirtioNetDxe/SnpSharedHelpers.c | 115 ++++++++++++++++++++ OvmfPkg/VirtioNetDxe/SnpTransmit.c | 26 ++++- OvmfPkg/VirtioRngDxe/VirtioRng.c | 2 +- 5 files changed, 169 insertions(+), 10 deletions(-) diff --git a/OvmfPkg/VirtioNetDxe/VirtioNet.h b/OvmfPkg/VirtioNetDxe/Virtio= Net.h index 873069e9de82..6c5129f178cd 100644 --- a/OvmfPkg/VirtioNetDxe/VirtioNet.h +++ b/OvmfPkg/VirtioNetDxe/VirtioNet.h @@ -269,6 +269,23 @@ VirtioNetShutdownTx ( IN OUT VNET_DEV *Dev ); =20 +EFI_STATUS +EFIAPI +VirtioMapTxBuf ( + IN VNET_DEV *Dev, + IN EFI_PHYSICAL_ADDRESS HostAddress, + IN UINTN NumberOfBytes, + OUT EFI_PHYSICAL_ADDRESS *DeviceAddress + ); + +EFI_STATUS +EFIAPI +VirtioUnmapTxBuf ( + IN VNET_DEV *Dev, + OUT EFI_PHYSICAL_ADDRESS *HostAddress, + IN EFI_PHYSICAL_ADDRESS DeviceAddress + ); + // // event callbacks // diff --git a/OvmfPkg/VirtioNetDxe/SnpGetStatus.c b/OvmfPkg/VirtioNetDxe/Snp= GetStatus.c index 694940ea1d97..ddea29e65d57 100644 --- a/OvmfPkg/VirtioNetDxe/SnpGetStatus.c +++ b/OvmfPkg/VirtioNetDxe/SnpGetStatus.c @@ -5,6 +5,7 @@ =20 Copyright (C) 2013, Red Hat, Inc. Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+ Copyright (c) 2017, AMD Inc, All rights reserved.
=20 This program and the accompanying materials are licensed and made availa= ble under the terms and conditions of the BSD License which accompanies this @@ -126,8 +127,10 @@ VirtioNetGetStatus ( *TxBuf =3D NULL; } else { - UINT16 UsedElemIdx; - UINT32 DescIdx; + UINT16 UsedElemIdx; + UINT32 DescIdx; + EFI_PHYSICAL_ADDRESS DeviceAddress; + EFI_PHYSICAL_ADDRESS HostAddress; =20 // // fetch the first descriptor among those that the hypervisor reports @@ -141,9 +144,19 @@ VirtioNetGetStatus ( ASSERT (DescIdx < (UINT32) (2 * Dev->TxMaxPending - 1)); =20 // + // Unmap the DeviceAddress + // + DeviceAddress =3D Dev->TxRing.Desc[DescIdx + 1].Addr; + Status =3D VirtioUnmapTxBuf (Dev, &HostAddress, DeviceAddress); + if (EFI_ERROR (Status)) { + goto Exit; + } + + // + // // report buffer address to caller that has been enqueued by caller // - *TxBuf =3D (VOID *)(UINTN) Dev->TxRing.Desc[DescIdx + 1].Addr; + *TxBuf =3D (VOID *)(UINTN) HostAddress; =20 // // now this descriptor can be used again to enqueue a transmit buffer diff --git a/OvmfPkg/VirtioNetDxe/SnpSharedHelpers.c b/OvmfPkg/VirtioNetDxe= /SnpSharedHelpers.c index 6e7166144f2d..3dbfc272980a 100644 --- a/OvmfPkg/VirtioNetDxe/SnpSharedHelpers.c +++ b/OvmfPkg/VirtioNetDxe/SnpSharedHelpers.c @@ -14,10 +14,29 @@ =20 **/ =20 +#include #include =20 #include "VirtioNet.h" =20 +#define PRIVATE_TXBUF_SIGNATURE SIGNATURE_32 ('t', 'x', 'b', 'f') +typedef struct { + UINT32 Signature; + LIST_ENTRY Link; + EFI_PHYSICAL_ADDRESS HostAddress; + EFI_PHYSICAL_ADDRESS DeviceAddress; + VOID *Mapping; +} PRIVATE_TXBUF_ENTRY; +#define PRIVATE_TXBUF_FROM_LINK(a) CR (a, PRIVATE_TXBUF_ENTRY, Link, \ + PRIVATE_TXBUF_SIGNATURE) + +// +// List of Txbuf queued +// +STATIC LIST_ENTRY mTxBufMapList =3D INITIALIZE_LIST_HEAD_VARIABLE ( + mTxBufMapList + ); + /** Release RX and TX resources on the boundary of the EfiSimpleNetworkInitialized state. @@ -61,3 +80,99 @@ VirtioNetShutdownTx ( =20 FreePool (Dev->TxFreeStack); } + +EFI_STATUS +EFIAPI +VirtioMapTxBuf ( + IN VNET_DEV *Dev, + IN EFI_PHYSICAL_ADDRESS HostAddress, + IN UINTN NumberOfBytes, + OUT EFI_PHYSICAL_ADDRESS *DeviceAddress + ) +{ + EFI_STATUS Status; + PRIVATE_TXBUF_ENTRY *Private; + + Private =3D AllocatePool (sizeof (*Private)); + if (Private =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + Private->Signature =3D PRIVATE_TXBUF_SIGNATURE; + Private->HostAddress =3D HostAddress; + + Status =3D VirtioMapAllBytesInSharedBuffer ( + Dev->VirtIo, + VirtioOperationBusMasterRead, + (VOID *) (UINTN) Private->HostAddress, + NumberOfBytes, + &Private->DeviceAddress, + &Private->Mapping + ); + if (EFI_ERROR (Status)) { + goto FreePool; + } + + *DeviceAddress =3D Private->DeviceAddress; + + // + // Add the mapping information into internal list so that we can retrieve + // the HostAddress from Unmap(). + // + InsertTailList (&mTxBufMapList, &Private->Link); + + return EFI_SUCCESS; + +FreePool: + FreePool (Private); + return Status; +} + +EFI_STATUS +EFIAPI +VirtioUnmapTxBuf ( + IN VNET_DEV *Dev, + OUT EFI_PHYSICAL_ADDRESS *HostAddress, + IN EFI_PHYSICAL_ADDRESS DeviceAddress + ) +{ + EFI_STATUS Status; + PRIVATE_TXBUF_ENTRY *Private; + LIST_ENTRY *Link; + BOOLEAN Found; + + Found =3D FALSE; + + // + // Iterate through internal txbuf list to find mapping for a given + // DeviceAddress. + // + for (Link =3D GetFirstNode (&mTxBufMapList) + ; !IsNull (&mTxBufMapList, Link) + ; Link =3D GetNextNode (&mTxBufMapList, Link) + ) { + Private =3D PRIVATE_TXBUF_FROM_LINK (Link); + if (Private->DeviceAddress =3D=3D DeviceAddress) { + Found =3D TRUE; + break; + } + } + + // + // We failed to find mapping for the given DeviceAddress + // (this should never happen) + // + ASSERT (Found); + + Status =3D Dev->VirtIo->UnmapSharedBuffer (Dev->VirtIo, Private->Mapping= ); + if (EFI_ERROR (Status)) { + return Status; + } + + *HostAddress =3D Private->HostAddress; + + RemoveEntryList (&Private->Link); + FreePool (Private); + + return EFI_SUCCESS; +} diff --git a/OvmfPkg/VirtioNetDxe/SnpTransmit.c b/OvmfPkg/VirtioNetDxe/SnpT= ransmit.c index 7ca40d5d0650..9d7d017d5a6f 100644 --- a/OvmfPkg/VirtioNetDxe/SnpTransmit.c +++ b/OvmfPkg/VirtioNetDxe/SnpTransmit.c @@ -73,11 +73,12 @@ VirtioNetTransmit ( IN UINT16 *Protocol OPTIONAL ) { - VNET_DEV *Dev; - EFI_TPL OldTpl; - EFI_STATUS Status; - UINT16 DescIdx; - UINT16 AvailIdx; + VNET_DEV *Dev; + EFI_TPL OldTpl; + EFI_STATUS Status; + UINT16 DescIdx; + UINT16 AvailIdx; + EFI_PHYSICAL_ADDRESS DeviceAddress; =20 if (This =3D=3D NULL || BufferSize =3D=3D 0 || Buffer =3D=3D NULL) { return EFI_INVALID_PARAMETER; @@ -144,10 +145,23 @@ VirtioNetTransmit ( } =20 // + // Map the transmit buffer HostAddress to a DeviceAddress + // + Status =3D VirtioMapTxBuf ( + Dev, + (EFI_PHYSICAL_ADDRESS) (UINTN) Buffer, + BufferSize, + &DeviceAddress + ); + if (EFI_ERROR (Status)) { + goto Exit; + } + + // // virtio-0.9.5, 2.4.1 Supplying Buffers to The Device // DescIdx =3D Dev->TxFreeStack[Dev->TxCurPending++]; - Dev->TxRing.Desc[DescIdx + 1].Addr =3D (UINTN) Buffer; + Dev->TxRing.Desc[DescIdx + 1].Addr =3D (UINTN) DeviceAddress; Dev->TxRing.Desc[DescIdx + 1].Len =3D (UINT32) BufferSize; =20 // diff --git a/OvmfPkg/VirtioRngDxe/VirtioRng.c b/OvmfPkg/VirtioRngDxe/Virtio= Rng.c index fc01f1996654..b19d90901430 100644 --- a/OvmfPkg/VirtioRngDxe/VirtioRng.c +++ b/OvmfPkg/VirtioRngDxe/VirtioRng.c @@ -162,7 +162,7 @@ VirtioRngGetRNG ( =20 Dev =3D VIRTIO_ENTROPY_SOURCE_FROM_RNG (This); // - // Map the Buffers system phyiscal address to device address + // Map the Buffer host address to device address // Status =3D VirtioMapAllBytesInSharedBuffer ( Dev->VirtIo, --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Fri Dec 27 01:42:53 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1502710731937523.449288309162; Mon, 14 Aug 2017 04:38:51 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 6059121E2571D; Mon, 14 Aug 2017 04:35:08 -0700 (PDT) Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0068.outbound.protection.outlook.com [104.47.40.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 3066821D0A27A for ; Mon, 14 Aug 2017 04:35:07 -0700 (PDT) Received: from brijesh-build-machine.amd.com (165.204.77.1) by BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1341.21; Mon, 14 Aug 2017 11:37:28 +0000 X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=O/aLbizKpfD7uKPXxGM+Zm7DcNoyNcpe8K+dPfslmew=; b=W5V4A6PfrHpaN9UAZ8db+kH2q8iZ8KxIMGXmwuyyQnKNTIMmx5y5PIouD1Z2sSt1hRnMYwoXSKj4uQPce78NBqrW3L+iQYXjMn9y0lDsRMBjLjNk+eMvSnReADYGkAWU3lbkfHgsKZuPQCSqRNK0KVRk6qwSvmaq+99SpyYbvTU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; From: Brijesh Singh To: edk2-devel@lists.01.org Date: Mon, 14 Aug 2017 07:36:45 -0400 Message-Id: <1502710605-8058-24-git-send-email-brijesh.singh@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> References: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: MWHPR15CA0043.namprd15.prod.outlook.com (10.173.226.157) To BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7c47f10f-d9c5-4198-f589-08d4e308d85f X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BY2PR12MB0145; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 3:7g4x1TundQYeCPFme05kiqwa8eyPjbef14FXi5QfOargaT75XTlLz3dzsVsorey4nPhOuPDvWaZfDFHxI8he8eYPKbH9vJUbOfj0Uzs+K6507/XIIqB+gB+V6wMDP47/CNjKN46CA58H7xJzGt8kwWQxSYe3z3bi/Jrii8kPBjuBY9q0sZ5qSPKfZdmbTtQ/iFobNJmXNp/JDg+LoqvFnk1FZDFCusMPo6FXtIl+VDBKvmATEgPb3o9p4wKga4Bh; 25:PnHCb0CLUGP/iG1xbtTzlosJUCtE3RqwC42Rq+vXXcgK1akACIGSqAMqPLgJRbFDbC7+gC77y7i+skuz/LAD3BEVq3e/s8G9lCKhi7mwEBbEUa8y2onCgmxgyLA4gj/0GzXbTpyXqjk+0k30sUbVTRBrGcySwgVIWDWmGGSsPRWPGduKrc7QOoD4HH8GKKiizboJiYfsT/KmWQ2QXAUZP18x1gXJ3XjsnP9CqCHZ4/5GHYQbJNv+Uh1nukI1kpharjnINtV+Pf77dXpvcqAKm4o4izgkNpbo7NCerTe72uVKb8o6FNiALjfgnhSzh8tSAJeEqp/H7f9CnIHz0vfLmA==; 31:jviPw9mzWXnh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qYFRoBcBCgzeURJNhH8oL1KxcWqtb8sSEA3pS7r9oQTG4WrOQEjm1jKXcSI+LBjcm1Xy5tdrdZN+OPkpQ== X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(228905959029699); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(3002001)(6055026)(6041248)(20161123558100)(20161123560025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BY2PR12MB0145; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BY2PR12MB0145; X-Forefront-PRVS: 039975700A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(7370300001)(4630300001)(6009001)(39860400002)(199003)(189002)(54906002)(5003940100001)(6116002)(3846002)(53936002)(97736004)(575784001)(86362001)(36756003)(81156014)(81166006)(110136004)(8676002)(6306002)(189998001)(50986999)(966005)(76176999)(5660300001)(2361001)(25786009)(2351001)(50226002)(4326008)(7350300001)(33646002)(478600001)(53416004)(42186005)(2906002)(105586002)(7736002)(305945005)(106356001)(48376002)(50466002)(47776003)(66066001)(6486002)(6916009)(2950100002)(6666003)(68736007)(101416001)(19627235001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR12MB0145; H:brijesh-build-machine.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR12MB0145; 23:B2aI0xR76bCRmYrR8k2xA/+TAtjD91NWBQXyPZUI5?= =?us-ascii?Q?n3DPCmorXnA8cwFUJ3MeEDupI/aA29icbpXD1cWCsEP1uhgooZtwAo8dHfsL?= =?us-ascii?Q?QJQ9K6T3dgrISLWfur3SmI3J+b/3oPYWpGVj+fz40ZW4zUV3dLdQ+aCspG9b?= =?us-ascii?Q?qWWESRaNPGZaCFm0n8UO05jcZWm2TizBhBmOlQKimMk49/KQb+1g+OQ1Jwty?= =?us-ascii?Q?2Rt4CTYY5behYFvdKHbY9KqtUyTPdFWiQN0Jtf26kimyJvK6CMp4dfET+3U3?= =?us-ascii?Q?1A0NPFP/mY8c2Uhr/EiFi/616BS8jJBtskRfUhqvuLRBzlRpdLw7XGIQOqWn?= =?us-ascii?Q?4h/0HGqO6nH/DIhjo/BVcjAhbhDLMLSMBd+O8l8HElwJLBXw6unhhGKR3XMB?= =?us-ascii?Q?4rzFPPSLLH8nDWT87vU2dpuudFTQX8ButzTrOu1zhbia97BiDohmhNbgZAd9?= =?us-ascii?Q?IC22sJnNuHgbn2591Ppxs1sipe2xxwiGoKqQduZo8QqEbGvUHvNFxJxX4JMu?= =?us-ascii?Q?q32kmSwvToZ/5PcWrjK5sUlpF4aUe5qdEnG0l4qlJ9aD9dEwQtxWv2jHUjXu?= =?us-ascii?Q?LyegmSD69+Ptc57GPsK9asvo1+MWqYpkVn7rFgEKKlisgFkYV7E8jyF4Y2FQ?= =?us-ascii?Q?9ZTf3pSzL+r2vJcI3WnbqynkW4PZ6KIdy6WDWO2valG0iRFx3seRHOm0ocJC?= =?us-ascii?Q?aympfE0BYKj59D5zImFAqz673RYJV5bzCN8If+kC9b1UkgpsMQN7q249XBQc?= =?us-ascii?Q?6Ml230lCFgySUC5tOyEdaYUP6L6YeWdFPBVtFQnIvWrnXKXQtD1kQ4Ig14C5?= =?us-ascii?Q?zua9JDoAc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2Jji5JoJnQhKCtqPpMjamoSddPvock//UkaaJVVxUjZRQnX/51CGjkmc0AjnsCL7OMqB3Awra6NXfrFp2O/uw=; 7:SUuVsExm8lrdrkRN/wezFxUFae6tQBUNsjXs74dXW56JZJVD1iVJlghAJhBNW2plT0cWMQWQjZc2WtqPIBfDlA2cFgzMGxOzNfFVzGN5iZJqDJBwnjvRTIEDtugZ6X9G7QccdkP2+UdR8zEVv4jhOoPBKlwhXEvVD886zl4mKqAvaexgmbPXaZOSQEXCWoIOdmrlNvzbmP+Ev8TKqHnW1Srv/TMRjCofvKuJG/VKoKI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 20:Rz9j0RDkahIzOKHyDalL3IzuYRJKsIdopSViZkaJuDyyXUWmzQbAC6EmPqKGIqfVsMro+nDFOVPlJGqC9CwFWAGZUWc0512a8b03OdpRHJXek8OS6M+7QLzGU040z7fEUaSvK3lAn8TSBguDUSnBAUYI4b90UDJJKcX2Ftj9L3fe2rIP+/5ILYdcqITQEG1L/0PZB6HNTJST/V5O0cYFQKpeyNldEj3pe+fcQivhI8+oqqKsSVWLb1S1d8c8hlpq X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2017 11:37:28.9555 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0145 Subject: [edk2] [PATCH v2 23/23] OvmfPkg/Virtio: define VIRITO_F_IOMMU_PLATFORM feature bit X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen , Tom Lendacky , Laszlo Ersek , Ard Biesheuvel Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This feature indicates that the device is behind an IOMMU that translates bus addresses from the device into physical addresses in memory. If this feature bit is set to 0, then the device emits physical addresses which are not translated further, even though an IOMMU may be present. see [1] for more infromation [1] https://lists.oasis-open.org/archives/virtio-dev/201610/msg00121.html In previous patches, we have implemented IOMMU-like member functions in VIRTIO_DEVICE_PROTOCOL to translate the physical address to bus address and virtio drivers are updated to use those member functions. We do not need to do anything special when VIRTIO_F_IOMMU_PLATFORM bit is present hence treat it in parallel with VIRTIO_F_VERSION_1. Suggested-by: Laszlo Ersek Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Tom Lendacky Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Brijesh Singh --- OvmfPkg/Include/IndustryStandard/Virtio10.h | 5 +++++ OvmfPkg/VirtioBlkDxe/VirtioBlk.c | 3 ++- OvmfPkg/VirtioNetDxe/SnpInitialize.c | 3 ++- OvmfPkg/VirtioRngDxe/VirtioRng.c | 2 +- OvmfPkg/VirtioScsiDxe/VirtioScsi.c | 3 ++- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/OvmfPkg/Include/IndustryStandard/Virtio10.h b/OvmfPkg/Include/= IndustryStandard/Virtio10.h index 4c9b62a3cf59..c62429d94432 100644 --- a/OvmfPkg/Include/IndustryStandard/Virtio10.h +++ b/OvmfPkg/Include/IndustryStandard/Virtio10.h @@ -83,4 +83,9 @@ typedef struct { // #define VIRTIO_F_VERSION_1 BIT32 =20 +// +// VirtIo 1.0 reserved iommu platform feature bits +// +#define VIRTIO_F_IOMMU_PLATFORM BIT33 + #endif // _VIRTIO_1_0_H_ diff --git a/OvmfPkg/VirtioBlkDxe/VirtioBlk.c b/OvmfPkg/VirtioBlkDxe/Virtio= Blk.c index 57baceb20a19..a78ec0df9c7b 100644 --- a/OvmfPkg/VirtioBlkDxe/VirtioBlk.c +++ b/OvmfPkg/VirtioBlkDxe/VirtioBlk.c @@ -773,7 +773,8 @@ VirtioBlkInit ( } =20 Features &=3D VIRTIO_BLK_F_BLK_SIZE | VIRTIO_BLK_F_TOPOLOGY | VIRTIO_BLK= _F_RO | - VIRTIO_BLK_F_FLUSH | VIRTIO_F_VERSION_1; + VIRTIO_BLK_F_FLUSH | VIRTIO_F_VERSION_1 | + VIRTIO_F_IOMMU_PLATFORM; =20 // // In virtio-1.0, feature negotiation is expected to complete before que= ue diff --git a/OvmfPkg/VirtioNetDxe/SnpInitialize.c b/OvmfPkg/VirtioNetDxe/Sn= pInitialize.c index 9bac19f8e3d1..b389f6243661 100644 --- a/OvmfPkg/VirtioNetDxe/SnpInitialize.c +++ b/OvmfPkg/VirtioNetDxe/SnpInitialize.c @@ -536,7 +536,8 @@ VirtioNetInitialize ( ASSERT (Dev->Snm.MediaPresentSupported =3D=3D !!(Features & VIRTIO_NET_F_STATUS)); =20 - Features &=3D VIRTIO_NET_F_MAC | VIRTIO_NET_F_STATUS | VIRTIO_F_VERSION_= 1; + Features &=3D VIRTIO_NET_F_MAC | VIRTIO_NET_F_STATUS | VIRTIO_F_VERSION_= 1 | + VIRTIO_F_IOMMU_PLATFORM; =20 // // In virtio-1.0, feature negotiation is expected to complete before que= ue diff --git a/OvmfPkg/VirtioRngDxe/VirtioRng.c b/OvmfPkg/VirtioRngDxe/Virtio= Rng.c index b19d90901430..81d8c7facc10 100644 --- a/OvmfPkg/VirtioRngDxe/VirtioRng.c +++ b/OvmfPkg/VirtioRngDxe/VirtioRng.c @@ -273,7 +273,7 @@ VirtioRngInit ( goto Failed; } =20 - Features &=3D VIRTIO_F_VERSION_1; + Features &=3D VIRTIO_F_VERSION_1 | VIRTIO_F_IOMMU_PLATFORM; =20 // // In virtio-1.0, feature negotiation is expected to complete before que= ue diff --git a/OvmfPkg/VirtioScsiDxe/VirtioScsi.c b/OvmfPkg/VirtioScsiDxe/Vir= tioScsi.c index 65e9bda0827a..286b005c994c 100644 --- a/OvmfPkg/VirtioScsiDxe/VirtioScsi.c +++ b/OvmfPkg/VirtioScsiDxe/VirtioScsi.c @@ -903,7 +903,8 @@ VirtioScsiInit ( goto Failed; } =20 - Features &=3D VIRTIO_SCSI_F_INOUT | VIRTIO_F_VERSION_1; + Features &=3D VIRTIO_SCSI_F_INOUT | VIRTIO_F_VERSION_1 | + VIRTIO_F_IOMMU_PLATFORM; =20 // // In virtio-1.0, feature negotiation is expected to complete before que= ue --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel