public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Yao, Jiewen" <jiewen.yao@intel.com>
To: "Ni, Ruiyu" <ruiyu.ni@intel.com>, Leo Duran <leo.duran@amd.com>,
	"edk2-devel@ml01.01.org" <edk2-devel@ml01.01.org>
Cc: "Yao, Jiewen" <jiewen.yao@intel.com>
Subject: Re: [PATCH v4 0/6] DxeBmDmaLib (BmDmaLib class) library
Date: Fri, 3 Mar 2017 06:12:49 +0000	[thread overview]
Message-ID: <74D8A39837DF1E4DA445A8C0B3885C503A8F8D82@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <734D49CCEBEEF84792F5B80ED585239D5B8BE9E0@SHSMSX104.ccr.corp.intel.com>

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 not 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 ?


2) Back to the API, I have a little concern on having "DmaAbove4GB" in BmDmaMap() and BmDmaAllocateBuffer().

Per my understanding:
- The PciHostBridgeDxe driver is the core module.
- The PciHostBridgeLib is the silicon hardware layout abstraction. The producer 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 in UEFI spec.

I discussed with Ruiyu, and we have some idea to eliminate "DmaAbove4GB" and make API consistent with UEFI spec.

3) I am not sure if BmDmaLib API need a way to distinguish which PCI_ROOT_BRIDGE_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 <leo.duran@amd.com>; edk2-devel@ml01.01.org
Cc: Yao, Jiewen <jiewen.yao@intel.com>
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 similar 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 general 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<mailto:edk2-devel@ml01.01.org>
>Cc: Leo Duran <leo.duran@amd.com<mailto:leo.duran@amd.com>>
>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 then
>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=linux-mm&m=147190814023863&w=2
>
>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<mailto:edk2-devel@lists.01.org>
>https://lists.01.org/mailman/listinfo/edk2-devel


  reply	other threads:[~2017-03-03  6:12 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-02 18:46 [PATCH v4 0/6] DxeBmDmaLib (BmDmaLib class) library Leo Duran
2017-03-02 18:46 ` [PATCH v4 1/6] MdeModulePkg: Add " Leo Duran
2017-03-02 18:46 ` [PATCH v4 2/6] ArmVirtPkg: Resolve BmDmaLib class for PciHostBridgeDxe driver Leo Duran
2017-03-02 18:46 ` [PATCH v4 3/6] CorebootPayloadPkg: " Leo Duran
2017-03-02 18:46 ` [PATCH v4 4/6] MdeModulePkg: " Leo Duran
2017-03-02 18:46 ` [PATCH v4 5/6] OvmfPkg: " Leo Duran
2017-03-02 18:46 ` [PATCH v4 6/6] MdeModulePkg: Modify PciHostBridgeDxe to use new BmDmaLib class library Leo Duran
2017-03-03  2:04 ` [PATCH v4 0/6] DxeBmDmaLib (BmDmaLib class) library Ni, Ruiyu
2017-03-03  6:12   ` Yao, Jiewen [this message]
2017-03-03 15:18     ` Duran, Leo
2017-03-03 16:03       ` Yao, Jiewen
2017-03-07 14:03         ` Yao, Jiewen
2017-03-08  0:57           ` Ni, Ruiyu
2017-03-08  1:21             ` Yao, Jiewen
2017-03-08  2:05               ` Ni, Ruiyu
2017-03-08  2:06                 ` Yao, Jiewen
2017-03-08  1:02           ` Ni, Ruiyu
2017-03-08 16:04             ` Duran, Leo
2017-03-14 21:21               ` Duran, Leo
2017-03-24 14:03                 ` Yao, Jiewen
2017-03-03 15:06   ` Duran, Leo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=74D8A39837DF1E4DA445A8C0B3885C503A8F8D82@shsmsx102.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox