public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Duran, Leo" <leo.duran@amd.com>
To: 'Jiewen Yao' <jiewen.yao@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>, "Singh, Brijesh" <brijesh.singh@amd.com>
Subject: Re: [RFC] [PATCH 0/3] Add IOMMU support.
Date: Mon, 27 Mar 2017 19:50:30 +0000	[thread overview]
Message-ID: <DM5PR12MB1243115174823D1C9C5AA2D3F9330@DM5PR12MB1243.namprd12.prod.outlook.com> (raw)
In-Reply-To: <1490434122-16200-1-git-send-email-jiewen.yao@intel.com>

Hi Yao,

This patch-set, in its current form, does not address all of the required SEV functionality for PcIHostBridgeIo.
Basically, we need to intercept all 4 I/O Operations:
- IoMap()
- IoUnmap()
- IoAllocateBuffer()
- IoFreeBuffer()

SEV I/O intercepts would do this:
1) IoMap()
- Allocate an accessible bounce buffer (AllocateType depends on consumer's capabilities).
- Clear SEV mask on retuned mapped DMA buffer
- On DMA Read: CopyMem() from consumer buffer to mapped buffer (bounce operation)

2) IoUnmap()
- On DMA Write: CopyMem() from mapped buffer to consumer buffer (bounce operation)
- Restore SEV mask on mapped DMA buffer

3) IoAllocateBuffer()
- Allocate an accessible buffer (AllocateType depends on consumer's capabilities).
- Clear SEV mask on allocated buffer
- return allocated buffer

4) IoFreeBuffer()
- Restore SEV mask on allocated buffer
- Free allocated buffer

For an sample on how we've intercepted BmDmaLib operations, please refer to the patch-sets posted by Brijesh:
https://lists.01.org/pipermail/edk2-devel/2017-March/008838.html
https://lists.01.org/pipermail/edk2-devel/2017-March/008840.html

Thanks,
Leo

> -----Original Message-----
> From: Jiewen Yao [mailto:jiewen.yao@intel.com]
> Sent: Saturday, March 25, 2017 4:29 AM
> To: edk2-devel@lists.01.org
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>; Duran, Leo <leo.duran@amd.com>;
> Singh, Brijesh <brijesh.singh@amd.com>
> Subject: [RFC] [PATCH 0/3] Add IOMMU support.
> 
> This patch series adds IOMMU protocol and updates the consumer to
> support IOMMU based DMA access in UEFI.
> 
> This patch series can support the BmDmaLib request for AMD SEV.
> submitted by Duran, Leo <leo.duran@amd.com> and Brijesh Singh
> <brijesh.ksingh@gmail.com>.
> https://lists.01.org/pipermail/edk2-devel/2017-March/008109.html, and
> https://lists.01.org/pipermail/edk2-devel/2017-March/008820.html.
> We can have an AMD SEV specific IOMMU driver to produce IOMMU
> protocol, and clear SEV in IOMMU->SetAttribute().
> 
> This patch series can also support Intel VTd based DMA protection,
> requested by Jiewen Yao <jiewen.yao@intel.com>, discussed in
> https://lists.01.org/pipermail/edk2-devel/2017-March/008157.html.
> We can have an Intel VTd specific IOMMU driver to produce IOMMU
> protocol, and update VTd engine to grant or deny access in IOMMU-
> >SetAttribute().
> 
> This patch series does not provide a full Intel VTd driver, which will be
> provide in other patch in the future.
> 
> The purpose of this patch series to review if this IOMMU protocol design can
> meet all DMA access and management requirement.
> 
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Leo Duran <leo.duran@amd.com>
> Cc: Brijesh Singh <brijesh.singh@amd.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
> 
> 
> Jiewen Yao (3):
>   MdeModulePkg/Include: Add IOMMU protocol definition.
>   MdeModulePkg/PciHostBridge: Add IOMMU support.
>   MdeModulePkg/PciBus: Add IOMMU support.
> 
>  MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.c                    |  12 ++
>  MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.h                    |  10 ++
>  MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf               |   1 +
>  MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c                     | 100 ++++++++++++
>  MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c      |   3 +
>  MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf |   1 +
>  MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridge.h      |   7 +
>  MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c    | 172
> +++++++++++++++++++-
>  MdeModulePkg/Include/Protocol/IoMmu.h                      | 132
> +++++++++++++++
>  MdeModulePkg/MdeModulePkg.dec                              |   3 +
>  10 files changed, 436 insertions(+), 5 deletions(-)  create mode 100644
> MdeModulePkg/Include/Protocol/IoMmu.h
> 
> --
> 2.7.4.windows.1



  parent reply	other threads:[~2017-03-27 19:50 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-25  9:28 [RFC] [PATCH 0/3] Add IOMMU support Jiewen Yao
2017-03-25  9:28 ` [PATCH 1/3] MdeModulePkg/Include: Add IOMMU protocol definition Jiewen Yao
2017-03-28 22:38   ` Ard Biesheuvel
2017-03-28 23:02     ` Kinney, Michael D
2017-03-28 23:45       ` Yao, Jiewen
2017-03-29 14:22         ` Ard Biesheuvel
2017-03-30 12:37           ` Yao, Jiewen
2017-03-30 13:54             ` Ard Biesheuvel
2017-03-25  9:28 ` [RFC] [PATCH 2/3] MdeModulePkg/PciHostBridge: Add IOMMU support Jiewen Yao
2017-03-27  5:31   ` Ni, Ruiyu
2017-03-27  6:01     ` Yao, Jiewen
2017-03-27  6:18       ` Ni, Ruiyu
2017-03-27  6:23         ` Yao, Jiewen
2017-03-27  6:25           ` Ni, Ruiyu
2017-03-25  9:28 ` [RFC] [PATCH 3/3] MdeModulePkg/PciBus: " Jiewen Yao
2017-03-27  5:39   ` Ni, Ruiyu
2017-03-27  6:15     ` Yao, Jiewen
2017-03-27  6:23       ` Ni, Ruiyu
2017-03-27 19:50 ` Duran, Leo [this message]
2017-03-28  1:40   ` [RFC] [PATCH 0/3] " Yao, Jiewen
2017-03-28  1:54     ` Yao, Jiewen
2017-03-28  2:24       ` Ni, Ruiyu
2017-03-28  2:32         ` Yao, Jiewen

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=DM5PR12MB1243115174823D1C9C5AA2D3F9330@DM5PR12MB1243.namprd12.prod.outlook.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