From nobody Fri Dec 27 18:47:54 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 1502107173867470.3564644376115; Mon, 7 Aug 2017 04:59:33 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 892D621DF9663; Mon, 7 Aug 2017 04:57:09 -0700 (PDT) Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0057.outbound.protection.outlook.com [104.47.33.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 656BE21DF37A1 for ; Mon, 7 Aug 2017 04:57:08 -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: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=okGeaJV2vdA7NydpaxbzPvye0pDgNMCQgkZ/tdPyNXo=; b=pwtsOKyOfLD/sMfmbQBPzT/ZIWUL3kp5wKzcyoCzzp/4dry1xnYcPFFi9+eoxBbN2OZcXYnthzNbA7DK+stKljd+ORWOManxDuIcN5BE2Y4Syby0xsgISJp8WwV17et1IUhk7PlsydFa1ZUZurhVWOHZ6G0J7qJIU5dR1/qZnUA= 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:47 -0400 Message-Id: <1502107139-412-3-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: cebd8a7f-6360-4f94-9fbf-08d4dd8bbe71 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:nXWPWjoLxYgFPiw85WcLVgqMHaUB6i7LoGVl0JsEMXmmdw0+mPOg99h2Vo+G2IAjxp3q3dACx+zr8sfXa/5JGYYE2FyKppbmO7T9/Q6AJ1Oks1qjAEh926679TfKRkNtfgvl14B/qvK38ytsDPsUDo7+lwavtppV6pdHC1HU2evf/IwtPCN56SWlzYj0gBYW+ZJlKHvTR2sYuXUfnW6o3azdDx2JEEar7tB540GXlkiqTNH58mopL32133fzJlRv; 25:snQgx3nf14YgOR3Sp83s7ZvQczGmrWrH+G3ZFk8ZawFtZ8nSAs/I2fT6KwlbPIvOQWJukhJsQSqXUZLG4q98jFB09bmGLu7U6aAC5IGQSfz9iNZBoAiTFwyxoBzbaoZotNijL4Awhosr+dYd5DErkqrIGVSF4hlkZpo3/g4m8DqJAkX2gwFXKKclW28Rv47o0tDDM7QmF+p6Uf9AfCqKTQ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eZTDNa5ebp52TGgzezUOi8i6jKV5j1B46cSYAQ0JYLZZ+Sq/FfNo5e9S7MexoylvC3G+vEHDwno8oSys+1z55dtIe2yNaIj+NvsOR26weabgfsJvcUowWpxjo5Rm86WCH62J60TxUlcH9tl02W684Iz98Eumbwjm3+OpG2LWU/07kWlD0PO2b+4itdioVf+j6KwH3bURIpZ6+rFIqTJdwzw== 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)(19627235001); 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:ZkbVnyqRdXYpGvNy54xpbK3LEguYa46ezSX1hRSL8?= =?us-ascii?Q?Sh3Dg78sSuYWgYUILV8UwgScYLTpFRsEeVFlULhLESFcdxbz5T4apaAd9Wyv?= =?us-ascii?Q?sVHfHoDp1pC9x/waqc/f7byIybGeWtxFxqLIN/MUuo/bNJgLBdWtc1VXM1fe?= =?us-ascii?Q?bhzKzsN9INW1skPty59ounCh4yv+BWPd47B/sQYtuCnJdpASmlproVM2O62x?= =?us-ascii?Q?CvggSaSPQtzlUZxvTE3cY4GUjHW9j7TasZ3XKu5FDK6CZqpHeGZF2xXhq2Ys?= =?us-ascii?Q?aKTEUDYFxsV5uyemnCAtLJZnsfGLOnNlNnxvr3cyPUYkvmoiZrl0y52uX4vy?= =?us-ascii?Q?ky8F6WB9MhKmMSw7lhwhLo1ruMfoPSFNBWXIBoQTydSuNwM6mvRWuQl5wCr/?= =?us-ascii?Q?hXHEBf33+se0MXiaxVRz+gIHRJIJP3Z/Z5GbRKa9I7pypIfsbFnWpHeheBxi?= =?us-ascii?Q?8k2prp97BhZ4wmTHybe9t7T8B3rPgLrk2Axos1caQ53oTP6kNTe4fv1cwzo0?= =?us-ascii?Q?RabhdY59uMWUFln8p2iCanwJ2HZt0F7la0A5q/y/E+tAEEndkG5ko4+dlTFB?= =?us-ascii?Q?gkjtL4MbDw3rpnwUuUeURxpx5+NdLfGcf7F5IK7ok0nwtufwufkSz8z00C89?= =?us-ascii?Q?jCJs7YfmDQhZOYlrqWxjQP+jO6soSO97MRi5Eg1K21NiwrkHmamT06mzKKT+?= =?us-ascii?Q?qhHGiBjBKr9ss6PhjKKI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jStJc1MwrSsiO4t5wfyyk8pacYLFM7Cm/jxEqoujoNFJgUXBS6Wrr219p53ZzOvA==; 5:IcG8hQUtUPnUg2eQ7LVsS2MPLgYHT+A2xTqT0SlyTSIAZri/0QUl0nkqUfJHTWKctOimdvWz7gIBd2Bq0JwA17zDlQwS5EwjCjsisuU0gVp3GpKgfV2WxW//SIvLaMiwKNjGJWrMdGimRh71rLypCg==; 24:mfgWYQE2qNGXolCgHi++I4xd7y8VB8plZzWJ8oD/t4euIiebPtuzuVh9fh6SHIGoKFOLcTBqNTdtMzdBzfzKTdIVlXtGzvrRL85aehzrwOE=; 7:tZlIzOKLCP/YxYnTKmR4w/Atepjv976kFoFOcIcovQQKlhxeehaaXImCy6clNkAsfLLApWbtjKfBlW4mPoGM8K48zyqbBM+KXX/13dZF6zAcCPcf3FFXrppuRs9zl4uR3ddre23CdHJyHwa/zcdMfiILye76Q4q1vVr0rdk/baZxHRJhUjIAKF6U+S5exQqCPKz8JpfW6hWiHZqbiJ4sjXKtOOyfReJV43qf1JUbJTs= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0159; 20:MGN/WAtAwoE/0+6xn6SMBT1icX1TGjQHb++oTQv3pvACxTFBjgBgyCBWb14cD3fsEbXClDHlKWHgIHPEIqIvGd6qAG2U0zxhU99BL9Kuf3IyrM+isK6fCohty2br9tv94w3C+7/AYjklK/rsFnuOgETjikjgpLfhRSsM2bphEALEQ6TQsT/bwRw/YfZnguVryiDWqWjMtrj27pBSWjfpbg7mvHI77D2Q7D01W9qWWewwctOahkV+Mk77mSKxANal X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2017 11:59:22.7175 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB0159 Subject: [edk2] [PATCH v1 02/14] OvmfPkg/Virtio10Dxe: Implement new 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 member functions by respectively delegating the job to: - EFI_PCI_IO_PROTOCOL.AllocateBuffer() -- with BootServicesData - EFI_PCI_IO_PROTOCOL.FreeBuffer() - EFI_PCI_IO_PROTOCOL.Map() - 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 | 114 +++++++++++++++++++- 1 file changed, 113 insertions(+), 1 deletion(-) diff --git a/OvmfPkg/Virtio10Dxe/Virtio10.c b/OvmfPkg/Virtio10Dxe/Virtio10.c index a8a6a58c3f1d..5bc8f1c7ee27 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 @@ -772,6 +773,113 @@ 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, + 0 + ); + 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 + // + if (Operation =3D=3D EfiVirtIoOperationBusMasterRead) { + PciIoOperation =3D EfiPciIoOperationBusMasterRead; + } else if (Operation =3D=3D EfiVirtIoOperationBusMasterWrite) { + PciIoOperation =3D EfiPciIoOperationBusMasterWrite; + } else if (Operation =3D=3D EfiVirtIoOperationBusMasterCommonBuffer) { + PciIoOperation =3D EfiPciIoOperationBusMasterCommonBuffer; + } else { + return EFI_UNSUPPORTED; + } + + 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 +896,11 @@ STATIC CONST VIRTIO_DEVICE_PROTOCOL mVirtIoTemplate = =3D { Virtio10GetDeviceStatus, Virtio10SetDeviceStatus, Virtio10WriteDevice, - Virtio10ReadDevice + Virtio10ReadDevice, + Virtio10AllocateSharedPages, + Virtio10FreeSharedPages, + Virtio10MapSharedBuffer, + Virtio10UnmapSharedBuffer }; =20 =20 --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel