Branch: refs/heads/master
  Home:   https://github.com/tianocore/edk2
  Commit: c4e76d2fbaa2a79be881df90aa185990acc7bf54
      
https://github.com/tianocore/edk2/commit/c4e76d2fbaa2a79be881df90aa185990acc7bf54
  Author: Min M Xu <min.m...@intel.com>
  Date:   2022-12-18 (Sun, 18 Dec 2022)

  Changed paths:
    M OvmfPkg/IoMmuDxe/AmdSevIoMmu.c
    A OvmfPkg/IoMmuDxe/IoMmuBuffer.c
    M OvmfPkg/IoMmuDxe/IoMmuDxe.inf
    A OvmfPkg/IoMmuDxe/IoMmuInternal.h

  Log Message:
  -----------
  OvmfPkg/IoMmuDxe: Reserve shared memory region for DMA operation

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4171

A typical QEMU fw_cfg read bytes with IOMMU for td guest is that:
(QemuFwCfgReadBytes@QemuFwCfgLib.c is the example)
1) Allocate DMA Access buffer
2) Map actual data buffer
3) start the transfer and wait for the transfer to complete
4) Free DMA Access buffer
5) Un-map actual data buffer

In step 1/2, Private memories are allocated, converted to shared memories.
In Step 4/5 the shared memories are converted to private memories and
accepted again. The final step is to free the pages.

This is time-consuming and impacts td guest's boot perf (both direct boot
and grub boot) badly.

In a typical grub boot, there are about 5000 calls of page allocation and
private/share conversion. Most of page size is less than 32KB.

This patch allocates a memory region and initializes it into pieces of
memory with different sizes. A piece of such memory consists of 2 parts:
the first page is of private memory, and the other pages are shared
memory. This is to meet the layout of common buffer.

When allocating bounce buffer in IoMmuMap(), IoMmuAllocateBounceBuffer()
is called to allocate the buffer. Accordingly when freeing bounce buffer
in IoMmuUnmapWorker(), IoMmuFreeBounceBuffer() is called to free the
bounce buffer. CommonBuffer is allocated by IoMmuAllocateCommonBuffer
and accordingly freed by IoMmuFreeCommonBuffer.

This feature is tested in Intel TDX pre-production platform. It saves up
to hundreds of ms in a grub boot.

Cc: Erdem Aktas <erdemak...@google.com>
Cc: James Bottomley <j...@linux.ibm.com>
Cc: Jiewen Yao <jiewen....@intel.com>
Cc: Tom Lendacky <thomas.lenda...@amd.com>
Cc: Gerd Hoffmann <kra...@redhat.com>
Reviewed-by: Jiewen Yao <jiewen....@intel.com>
Signed-off-by: Min Xu <min.m...@intel.com>
Reviewed-by: Tom Lendacky <thomas.lenda...@amd.com>


  Commit: 09f01d4efb50de51c720723748c6be4f7d308a56
      
https://github.com/tianocore/edk2/commit/09f01d4efb50de51c720723748c6be4f7d308a56
  Author: Min M Xu <min.m...@intel.com>
  Date:   2022-12-18 (Sun, 18 Dec 2022)

  Changed paths:
    R OvmfPkg/IoMmuDxe/AmdSevIoMmu.c
    R OvmfPkg/IoMmuDxe/AmdSevIoMmu.h
    A OvmfPkg/IoMmuDxe/CcIoMmu.c
    A OvmfPkg/IoMmuDxe/CcIoMmu.h
    M OvmfPkg/IoMmuDxe/IoMmuDxe.c
    M OvmfPkg/IoMmuDxe/IoMmuDxe.inf

  Log Message:
  -----------
  OvmfPkg/IoMmuDxe: Rename AmdSevIoMmu to CcIoMmu

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4171

IoMmuDxe once was designed to support DMA operation when SEV is enabled.
After TDX is enabled in IoMmuDxe, some files' name in IoMmuDxe need to
be more general. So this patch rename:
  AmdSevIoMmu.h -> CcIoMmu.h
  AmdSevIoMmu.c -> CcIoMmu.c

Accordingly there are some udates in IoMmuDxe.c and IoMmuDxe.inf.

Cc: Erdem Aktas <erdemak...@google.com>
Cc: James Bottomley <j...@linux.ibm.com>
Cc: Jiewen Yao <jiewen....@intel.com>
Cc: Tom Lendacky <thomas.lenda...@amd.com>
Cc: Gerd Hoffmann <kra...@redhat.com>
Reviewed-by: Jiewen Yao <jiewen....@intel.com>
Signed-off-by: Min Xu <min.m...@intel.com>
Reviewed-by: Tom Lendacky <thomas.lenda...@amd.com>


  Commit: 47b9521513fd56a9aa0b56dbe15c349325f56bfa
      
https://github.com/tianocore/edk2/commit/47b9521513fd56a9aa0b56dbe15c349325f56bfa
  Author: Tom Lendacky <thomas.lenda...@amd.com>
  Date:   2022-12-18 (Sun, 18 Dec 2022)

  Changed paths:
    M OvmfPkg/IoMmuDxe/CcIoMmu.c
    M OvmfPkg/IoMmuDxe/IoMmuBuffer.c

  Log Message:
  -----------
  OvmfPkg/IoMmuDxe: Add SEV support for reserved shared memory

Add support to use the reserved shared memory within the IoMmu library.
This improves boot times for all SEV guests, with SEV-SNP benefiting the
most as it avoids the page state change call to the hypervisor.

Cc: Erdem Aktas <erdemak...@google.com>
Cc: James Bottomley <j...@linux.ibm.com>
Cc: Jiewen Yao <jiewen....@intel.com>
Cc: Min Xu <min.m...@intel.com>
Cc: Gerd Hoffmann <kra...@redhat.com>
Acked-by: Jiewen Yao <jiewen....@intel.com>
Signed-off-by: Tom Lendacky <thomas.lenda...@amd.com>


  Commit: 4dd7b865565aea4d28bea1b8d57d62620f6015a9
      
https://github.com/tianocore/edk2/commit/4dd7b865565aea4d28bea1b8d57d62620f6015a9
  Author: Min M Xu <min.m...@intel.com>
  Date:   2022-12-18 (Sun, 18 Dec 2022)

  Changed paths:
    M Maintainers.txt

  Log Message:
  -----------
  Maintainers: Update OvmfPkg/IoMmuDxe

https://bugzilla.tianocore.org/show_bug.cgi?id=4171

AmdSevIoMmu.* is renamed as CcIoMmu*. The related section in
Maintainers.txt should be updated as well.

Cc: Michael D Kinney <michael.d.kin...@intel.com>
Cc: Liming Gao <gaolim...@byosoft.com.cn>
Cc: Erdem Aktas <erdemak...@google.com>
Cc: Gerd Hoffmann <kra...@redhat.com>
Cc: James Bottomley <j...@linux.ibm.com>
Cc: Jiewen Yao <jiewen....@intel.com>
Cc: Tom Lendacky <thomas.lenda...@amd.com>
Reviewed-by: Jiewen Yao <jiewen....@intel.com>
Signed-off-by: Min Xu <min.m...@intel.com>
Reviewed-by: Tom Lendacky <thomas.lenda...@amd.com>


Compare: https://github.com/tianocore/edk2/compare/316e6df435af...4dd7b865565a


_______________________________________________
edk2-commits mailing list
edk2-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to