From nobody Fri Dec 27 18:43:50 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/yM0orZExRCM2bm5n0VuuR7J89z3IvSG3L4DdTgzCNX9gGgnipec2XAmN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y1egqXelZbTAqlNA/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?61IIxEW8zLQZXRxL+PIXVLXxuZSdLUutfHneQoxonMxagZLPF8mmalEGXJnF?= =?us-ascii?Q?3tj/gonp4LXO5XB/wOgjyKkdu6EX65+BR43MrAYifxYqE935CbWGufJzLXBN?= =?us-ascii?Q?tmYNmIa89qRcnTyP3ZsuyaolG8BG+dfxf1DO9lTrODULiIuoXgZh2OyrKS+4?= =?us-ascii?Q?mWe1YgAK0N1kMSp89Rzs01hfK1JVsdAQxKupbfD8P0NI5db93VKHkN2sUih9?= =?us-ascii?Q?FwMJMBqSIVo99w5PPh4JIueY0rZ/TvNU78PRFD7wFoF8SAiwtylUnHtSNsSt?= =?us-ascii?Q?swQReCuQWuGLjLiGnustoZ6MOOQr/9K3z3Q8rXLkccyya6idJ7rHunY+0cVX?= =?us-ascii?Q?zrj/2RqxVGq9EZQ6d8rhqBs1/yLDRLQfnA9D8uP7HtsP/WvRTEB0H/uav8sh?= =?us-ascii?Q?42Kj+E5yUMI/yMQolMThzVtDNIxZ9De2cEv8lvLoGgpRBstOQfFGtn5qEr7A?= =?us-ascii?Q?ZGlhMWoTjtkvQm4r8ekT37tEiswfLhiH4ed3iIUkt8oK0k6sEA0ss6Z600n6?= =?us-ascii?Q?wxOBpVVeseHHB0OorHVgb1jWIDvd8Y9DAZ2TV+41Oz5epzASENvDYpKC8ILk?= =?us-ascii?Q?ejqGp4IK2GMtc3hZ3Cux31P2a03cyhFTEMV+saEpGm3xnXyiT+HSkbuUDYzn?= =?us-ascii?Q?7W7z7ixUkGz9w2pqbDCCCWLOzSQvviiME6MSa+I9sGLdaYMdfEG0a7Qyg0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qt7+7n0UgeH7bDgwCLcLUWL/ZgluvPdovCCV5docLxaBR2a9aKmJCiSeYVOmiOE3kAaqWMwjeaAdNfMrmQcCyby/J7ncVA==; 24:hel368tKoCon9nZUcQRswwevRG4nVw9kf++g7AyJEFuDJ+sfA3L5nYXzsfRQD5ixo/PEmJx3PfBT2QuY0P4Szq6Cuo3TvNP/Jlc/6TWFB5I=; 7:9Te2bQtRwi+BvwhS2ZUNewrxq5RaG1DD8wssWEuRbsIc6ZTjymy2dSPkmqYICIPscGtYNT6f22qMZxnCQcThgGFJzZuazaonswuSY3j9v5Ml6s+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