From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0623.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe45::623]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id DE2C78221B for ; Fri, 3 Mar 2017 07:18:36 -0800 (PST) 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=rOs1Qt9rbSKe5S2Sz60TfBrZR72RKqIQQ7kFbpFYMMI=; b=HG3jHzu6GR8b1KdshDOq0tWJukTNORLcDU2j833iP6CHU6BFy9uHv8AJg/35IssOlcOuFftZnGlbAsZbWYWGXIevBXZ2Stq8tpJU3wZVCSM/8ggSU0sCN4zVBlxq8oq9598cE/HPC8xTW91ahg0GkYXMsba+KET7k+YZSBGnhno= Received: from DM5PR12MB1243.namprd12.prod.outlook.com (10.168.237.22) by DM5PR12MB1242.namprd12.prod.outlook.com (10.168.237.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.947.12; Fri, 3 Mar 2017 15:18:35 +0000 Received: from DM5PR12MB1243.namprd12.prod.outlook.com ([10.168.237.22]) by DM5PR12MB1243.namprd12.prod.outlook.com ([10.168.237.22]) with mapi id 15.01.0947.015; Fri, 3 Mar 2017 15:18:35 +0000 From: "Duran, Leo" To: "'Yao, Jiewen'" , "Ni, Ruiyu" , "edk2-devel@ml01.01.org" Thread-Topic: [edk2] [PATCH v4 0/6] DxeBmDmaLib (BmDmaLib class) library Thread-Index: AQHSk4VZhWPDQ+EoT0Cs/UJDr3mKoKGCXeyAgABFZ4CAAJVVQA== Date: Fri, 3 Mar 2017 15:18:35 +0000 Message-ID: References: <1488480396-32358-1-git-send-email-leo.duran@amd.com> <734D49CCEBEEF84792F5B80ED585239D5B8BE9E0@SHSMSX104.ccr.corp.intel.com> <74D8A39837DF1E4DA445A8C0B3885C503A8F8D82@shsmsx102.ccr.corp.intel.com> In-Reply-To: <74D8A39837DF1E4DA445A8C0B3885C503A8F8D82@shsmsx102.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=amd.com; x-originating-ip: [165.204.77.1] x-ms-office365-filtering-correlation-id: 9e470056-aa90-4356-b9a6-08d462488fab x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565401081); SRVR:DM5PR12MB1242; x-microsoft-exchange-diagnostics: 1; DM5PR12MB1242; 7:F4j8hWmkUqQS3tMnqz6n9YkqCX6CKfCNZ7aVKVC1F9IGZO4AwC+5Dsex9XRwclQn/+DsD00TtUn6pYSylDxCVfUuc7YsCuy2Fx0X9vitu1wyTTnjAcY6mdWQTsxMyRqWwzz+AalM6mrXKnHaLNX9f9MQJTE8QqudS9Y601U0PIdjoUwVRfp5JyeOhVY2oLRnzJoTg8FRkBdGxK7749tf/zRcunlWnSDQ/mOOkc5LbNUGKeWNx1YYR/A+iHunItgnSaY/3A7EVwAxMbLuP4EmwuQCDvvYmpN6429pamQLqSSvmdIm4UZ6l1+9rkZKSKGIj9+Rd2EhDuvnnxFieCkS7w==; 20:dzGtSDd0pXGcePbdL9qraVr+dCtH+Ex79jZ631HWo0jNdTL+ybWEQLBlQ8TtYJQcWI3iJNU7wPPyenJxEKlv/op6BW+Ofu7d2AKHrxIWD5AvNV/BEUXOhdfdxkLAKUjG63Y5miFEksf7DeUpCwXNe+QS1WkP+buLbe/dYWCDKYYUWleFRxf9Y7JKYiLB0U3S+X3AQFefydN2iyXWCnsT1usDehc1USYA13QoF2tQDs6egRkdXof1dXMh8or4MjcI x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(767451399110)(162533806227266)(21748063052155)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026)(6041248)(20161123558025)(20161123560025)(20161123555025)(20161123562025)(20161123564025)(6072148); SRVR:DM5PR12MB1242; BCL:0; PCL:0; RULEID:; SRVR:DM5PR12MB1242; x-forefront-prvs: 0235CBE7D0 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6029001)(7916002)(39860400002)(39410400002)(39850400002)(39450400003)(39840400002)(209900001)(13464003)(377454003)(53376002)(3846002)(102836003)(53546006)(6116002)(790700001)(54356999)(50986999)(86362001)(76176999)(189998001)(2900100001)(66066001)(106116001)(122556002)(229853002)(55016002)(99286003)(92566002)(2950100002)(6246003)(236005)(54896002)(9686003)(53936002)(38730400002)(5660300001)(6436002)(7696004)(606005)(25786008)(6506006)(77096006)(3280700002)(6306002)(7906003)(74316002)(81166006)(8936002)(3660700001)(7736002)(9326002)(8676002)(33656002)(2501003)(2906002)(6606295002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR12MB1242; H:DM5PR12MB1243.namprd12.prod.outlook.com; FPR:; SPF:None; MLV:sfv; LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Mar 2017 15:18:35.1724 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1242 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 Subject: Re: [PATCH v4 0/6] DxeBmDmaLib (BmDmaLib class) library X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Mar 2017 15:18:37 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Yao, Please me replies inline below. Leo From: Yao, Jiewen [mailto:jiewen.yao@intel.com] Sent: Friday, March 03, 2017 12:13 AM To: Ni, Ruiyu ; Duran, Leo ; edk2-de= vel@ml01.01.org Cc: Yao, Jiewen Subject: RE: [edk2] [PATCH v4 0/6] DxeBmDmaLib (BmDmaLib class) library Hi Thanks for your patient. 1) I think it is good to abstract the DMA operation. However, the problem on doing this in PciHostBridge driver is that: We lose= the information on which PCI device submits the Map/Ummap() request. For example, we can allocate one DMA memory for an ATA device, and we do no= t want USB device access this DMA memory. For Intel VTd, we need this information. Is that possible to share your feature code to help me understand how this = API is used on your side? Or if it is hard to share the code, is that possible to help us evaluate if= we can move this library or hook to the PciBus driver ? [Duran, Leo] The intent is to allow override of BmDmalib, so that we may se= t or clear the SEV mask as DMA buffers are allocated or free'ed. 2) Back to the API, I have a little concern on having "DmaAbove4GB" in BmDm= aMap() and BmDmaAllocateBuffer(). [Duran, Leo] The intent of the flag is to determine the need for a bounce b= uffer if the bus-master device is not capable of accessing memory above 4GB= 's. Point being, when a bounce buffer is used for DMA we also need to manage th= e SEV mask on that buffer. Per my understanding: - The PciHostBridgeDxe driver is the core module. - The PciHostBridgeLib is the silicon hardware layout abstraction. The prod= ucer should be silicon driver. - The BmDmaLib is the PCI feature abstraction. The producer could be a core= module or a platform module. I think we had better make the BmDmaLib API be similar to the API defined i= n UEFI spec. [Duran, Leo] Can you please point me to the pertinent reference in the UEFI= spec? I discussed with Ruiyu, and we have some idea to eliminate "DmaAbove4GB" an= d make API consistent with UEFI spec. 3) I am not sure if BmDmaLib API need a way to distinguish which PCI_ROOT_B= RIDGE_IO it is handling. That is an open question. Thank you Yao Jiewen From: Ni, Ruiyu Sent: Friday, March 3, 2017 10:04 AM To: Leo Duran >; edk2-devel@ml0= 1.01.org Cc: Yao, Jiewen > Subject: RE: [edk2] [PATCH v4 0/6] DxeBmDmaLib (BmDmaLib class) library Leo, I talked with Jiewen in office today. He felt that Intel might have a simil= ar need of such layer of abstraction (BmDmaLib). We are investigating it. Can you please wait for several days? We'd like to review the current interfaces of BmDmaLib to make sure it's ge= neral enough to meet any potential needs. Sorry about the delay. Regards, Ray >-----Original Message----- >From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Leo= Duran >Sent: Friday, March 3, 2017 2:47 AM >To: edk2-devel@ml01.01.org >Cc: Leo Duran > >Subject: [edk2] [PATCH v4 0/6] DxeBmDmaLib (BmDmaLib class) library > >This series provides an abstraction layer for Bus-master DMA operations as >currently implemented by the PciHostBridgeDxe driver. The intent is to the= n >allow override of this library as may be required by specific hardware >implementations, such as AMD's Secure Encrypted Virtualization (SEV). > >Please refer to the RFC discussion for SEV here: >http://marc.info/?l=3Dlinux-mm&m=3D147190814023863&w=3D2 > >This new BmDmaLib class library is cloned from the existing DmaLib with >an additional DmaAbove4GB (BOOLEAN) parameter for the Map and Allocate >interfaces, so that decisions can be made about the need to allocate DMA >buffers below the 4GB boundary. > >NOTE: The abstraction layer is intended for Bus-master (DMA capable) >devices, and not restricted to the PCI Root-Bridge use-case. Thus the >rationale for not using EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_OPERATION types. > >Changes since v3: >- Add copyright notice on changed files. >- Re-order parameters on BmDmaFreeBuffer(), consistent with gBS->FreePages= (). > >Leo Duran (6): > MdeModulePkg: Add DxeBmDmaLib (BmDmaLib class) library > ArmVirtPkg: Resolve BmDmaLib class for PciHostBridgeDxe driver > CorebootPayloadPkg: Resolve BmDmaLib class for PciHostBridgeDxe driver > MdeModulePkg: Resolve BmDmaLib class for PciHostBridgeDxe driver > OvmfPkg: Resolve BmDmaLib class for PciHostBridgeDxe driver > MdeModulePkg: Modify PciHostBridgeDxe to use new BmDmaLib class > library > > ArmVirtPkg/ArmVirtQemu.dsc | 2 + > ArmVirtPkg/ArmVirtQemuKernel.dsc | 2 + > CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc | 3 + > CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc | 3 + > .../Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf | 1 + > .../Bus/Pci/PciHostBridgeDxe/PciRootBridge.h | 15 +- > .../Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c | 274 ++++------------ > MdeModulePkg/Include/Library/BmDmaLib.h | 161 ++++++++++ > MdeModulePkg/Library/DxeBmDmaLib/DxeBmDmaLib.c | 351 ++++++++++++++++= +++++ > MdeModulePkg/Library/DxeBmDmaLib/DxeBmDmaLib.inf | 41 +++ > MdeModulePkg/MdeModulePkg.dsc | 3 + > OvmfPkg/OvmfPkgIa32.dsc | 2 + > OvmfPkg/OvmfPkgIa32X64.dsc | 2 + > OvmfPkg/OvmfPkgX64.dsc | 2 + > 14 files changed, 642 insertions(+), 220 deletions(-) > create mode 100644 MdeModulePkg/Include/Library/BmDmaLib.h > create mode 100644 MdeModulePkg/Library/DxeBmDmaLib/DxeBmDmaLib.c > create mode 100644 MdeModulePkg/Library/DxeBmDmaLib/DxeBmDmaLib.inf > >-- >2.7.4 > >_______________________________________________ >edk2-devel mailing list >edk2-devel@lists.01.org >https://lists.01.org/mailman/listinfo/edk2-devel