From nobody Fri Dec 27 17:13:33 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 1502107190635198.43137612969133; Mon, 7 Aug 2017 04:59:50 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id E6D0F21DF9688; Mon, 7 Aug 2017 04:57:14 -0700 (PDT) Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0046.outbound.protection.outlook.com [104.47.33.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 A6DED21DF9676 for ; Mon, 7 Aug 2017 04:57:11 -0700 (PDT) Received: from brijesh-build-machine.amd.com (165.204.77.1) by SN1PR12MB0159.namprd12.prod.outlook.com (10.162.3.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1320.16; Mon, 7 Aug 2017 11:59: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=t2GtFiToHhVThfqghzZh+nWQY8PuD3PdbJrOUCjx+0E=; b=UUx3vB+TgTciOc3++5Owqwhx2dOTxDnlph2T8dXnSuFYsuWhHpnVvQIBQjfkCrplbXB5BLaZaHgUteNbJwAJ7RMhqR/RM0ppnsoFhesf0kkiTlGet2cVVwnDp30U1ibAEDEUTx4SseH92g2FwIFv+5XUSPa8VC2bcyBGso4NuzA= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; From: Brijesh Singh To: edk2-devel@lists.01.org Date: Mon, 7 Aug 2017 07:58:52 -0400 Message-Id: <1502107139-412-8-git-send-email-brijesh.singh@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502107139-412-1-git-send-email-brijesh.singh@amd.com> References: <1502107139-412-1-git-send-email-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: CY4PR04CA0033.namprd04.prod.outlook.com (10.172.133.19) To SN1PR12MB0159.namprd12.prod.outlook.com (10.162.3.146) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fab4c3f0-168d-49f0-3b4c-08d4dd8bc08c 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:SN1PR12MB0159; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0159; 3:bnsu3UDrmLA+vFogBW+jSc4yKVhmxQWrOSSwsPZs+DudU1V9G4rH/QjRGeGNtdAdiefObnAo2BwHH52lG1dKytp1UlQb7KJRhafyiMReUzlOIniVshWyOteyhJkN0GSTO38mZI/70IzX0EELuss0vz7r0QNtsclVVMij6H1HQCuyAIyaxc6rJDS9JQya4v6WBU66lV8eSQlZoXl8rlWKidpovt2oZPClaUKqf1dZYV8coiQrRksvLOlOr5ne73ru; 25:iu/CTrSbTQF1/E43S6sBsAdqaB76LfmkUOMOKqP+UschguTzK6aMBBfWT4xrZvp1KoTkc6eay3yADVh2shv+topN1+Y6BBfHqZpDD9xBDEIl8UESmJpyge8JmMxKdMOmYUP+LUQN9I2pAR5BSyCE4ieKQvwzpuvfr5S+bfD3N1QgwNaybAuY3cXpM1ETHo6SawTB862wh7LykdeBQJ8Wp+zV7F4dk42lhxz0xk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qN3PPdeOGVogt2gDIv2+QbVPnyab7z+MKYY/wVbd12w4AivROb6jdLJPUwpwjAy64cwN0ptow2rTSG15GGfN0k65oW6p9ft5KNvOWtcabCNn5Q/MK+a7wO9JWfL89/6nEwvMagdbc5aI8A1gMtNAYaXnfMyDlWZVTzonsblEBEgqitOX7lskmRqXijeCBlIqpodjHahZGpOU082F6Ykzjs35I1PsyrUw== 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)(100000703101)(100105400095)(93006095)(93001095)(10201501046)(3002001)(6055026)(6041248)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123558100)(20161123560025)(20161123555025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:SN1PR12MB0159; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:SN1PR12MB0159; X-Forefront-PRVS: 0392679D18 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(7370300001)(6009001)(39400400002)(39850400002)(39450400003)(39410400002)(39840400002)(39860400002)(199003)(189002)(3846002)(6116002)(5660300001)(81156014)(81166006)(54906002)(8676002)(68736007)(50466002)(53936002)(53416004)(106356001)(2950100002)(105586002)(2351001)(42186005)(86362001)(6666003)(5003940100001)(36756003)(189998001)(33646002)(6916009)(97736004)(25786009)(2906002)(478600001)(110136004)(47776003)(38730400002)(76176999)(50986999)(66066001)(4326008)(2361001)(305945005)(50226002)(48376002)(7350300001)(101416001)(6486002)(7736002); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB0159; 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; SN1PR12MB0159; 23:UPo13BshLeTcX0AQtkTTCACr+WO+Yx+rB+mV6CkCR?= =?us-ascii?Q?Njtwe4cI1MEBXc+msc0FLtx8JtZiirThsOK4jQulhk0e5c5/ajQphzCwkdRl?= =?us-ascii?Q?DMn8tMHbaX5q5FzFUl7YwutmA8Ww76Uhk7wqF3N2E8ngRBcwnvOa7SwUrgb5?= =?us-ascii?Q?8LSs1RlV72MGuOoI3PzSFa98id/yy6TnujamovBx5jQVg6BUktLOysL/JjTk?= =?us-ascii?Q?Ns4KNQfJdZTKF6J8sbYNLZGnllrallSFwJXF6o0JJixI1Y75ikPHeVM0y3ag?= =?us-ascii?Q?mmGOLifeoxYbf34ES+36H5TqFbTQLQSH66AVKBwl7EPS2w4bBpbt6+PXgWHk?= =?us-ascii?Q?3/O8vVh6T5Bqsyc8axfUtslsy6HZ6z/4CfB6VEXeBjKkVjlsfA3mjyiQA/vZ?= =?us-ascii?Q?OW/v7ZfqThvlk00PKzULSptA8mJGA3dRcf8TsS3J4u3h2fNfS0zFys6Xv3Yw?= =?us-ascii?Q?WF24zf6tnQv0u2QnEOqnxq8NvVXg2oWjardCsIzRjYbasBe8ImKXAe8GTnmI?= =?us-ascii?Q?52l8rqwTBSE6hTyIX20/p58+0yrwwH+hIkz0G8R+Y0DWSQ8OYvlMh0s0L4ul?= =?us-ascii?Q?rSupCKxNC4yOFFf8jzEVrJ6eEKg6r5TwjWF3AcdZ3jWMRI4OXfs5oeP1vYeM?= =?us-ascii?Q?CdeHPWbgJlafXl63kXDMgLc4ymj7kawIEJTUDUXuevwuLDStWxeubxjyPpBO?= =?us-ascii?Q?I4XQp4iuSuwi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b/CmRmqFUNb6YuYXjTIwakMNW7iG1vGQEhCsOo+QIW0/46CHQhnxYfLuvCpgmhVPdnEJD3y0h1dW48mIJMw==; 5:gxDYIAHkVcT/YBSa8qDNuBcmXk4drNxWkEbUHFeTcu844S81Wp2Oxmklxgl/HMw+GgN0t69t8HPj3cqUO6M6Bm/zJyHbYsij4Gl/BdXtOWlonU2a3Wro+tB00JqikDMwFaWFhwtw9KkKQQrDe6huGw==; 24:w0c58+oc6zSMb99ZN3JdJbSqPoYP0FIF1hSMoLc/5XlABVO+ebL5ikovW8/1dHPNo4zb5na41qsue0LQJ23F8GjKEjHYOSZU2X+r9+yDOMY=; 7:i7A+tXkdsdZ9TUVDLXnLljA5KIGVxpSBfK8N2MSzp8zCKFh4cPH7FV9WJlIh57h2nrBtwOYEfV9pNMSMYliQrvfssAQ6jRxPNJi77C9fzRiP80mezmCNNRyNbr4CCGZgu76fOf9TVzPviGwzGAhyF7qNLVkwDOs5w9crffAFVHoAIfs42pPKcXmJLcO/0N0NqyfVmBMl+ia9eXrbTvr4v9DRFebi0wtY4z+7b7W5YSE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0159; 20:0ihQiPymlBf5KoQUeEzF4cW7y5p6tf+Xe9a5n2dMpV1yBwj4rWk/9pM8fTtlfhOfwlv6U1CzMWe2/47JGaHXA4XqGMPvvsuB10zIot0TSFcEqgFdfFwlACZZukHsbSFtp15LJylGOwuIcPjBJiZ9ydNCvJECGJX/4BwSfcbrmDWfaBWaeWW51/oxZmJCVG0HRq3gJufWdkvQgDFam4mLeZyWvNaUq1TcaXVLzDxzPTttncIZn7BHDYP/Tx3ifpr1 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2017 11:59:26.2473 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB0159 Subject: [edk2] [PATCH v1 07/14] OvmfPkg/VirtioLib: Use AllocateShared() to allocate vring buffer 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 vring buffer is communication block between guest and hypervisor, allocate the vring buffer using AllocateSharedPages() so that it can be Map() with BusMasterCommonBufer for bi-directional access. 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 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/OvmfPkg/Library/VirtioLib/VirtioLib.c b/OvmfPkg/Library/Virtio= Lib/VirtioLib.c index 09a3f9b7f2e5..9ba64204326f 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,12 @@ 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 VirtioAllocateSharedPages (VirtIo, Ring->NumPages, &Ring->Bas= e); + if (EFI_ERROR (Status)) { return EFI_OUT_OF_RESOURCES; } SetMem (Ring->Base, RingSize, 0x00); @@ -143,7 +147,7 @@ VirtioRingUninit ( IN OUT VRING *Ring ) { - FreePages (Ring->Base, Ring->NumPages); + VirtioFreeSharedPages (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