audk/MdePkg/Library/BaseIoLibIntrinsic
Min Xu 7012cb73c4 MdePkg: Probe Cc guest in BaseIoLibIntrinsicSev
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3902

Bad IO performance in SEC phase is observed after TDX features was
introduced. (after commit b6b2de8848 - "MdePkg: Support mmio for
Tdx guest in BaseIoLibIntrinsic").

This is because IsTdxGuest() will be called in each MMIO operation.
It is trying to cache the result of the probe in the efi data segment.
However, that doesn't work in SEC, because the data segment is read only
(so the write seems to succeed but a read will always return the
original value), leading to us calling TdIsEnabled() check for every
mmio we do, which is causing the slowdown because it's very expensive.

This patch is to call CcProbe instead of TdIsEnabled in IsTdxGuest.
Null instance of CcProbe always returns CCGuestTypeNonEncrypted. Its
OvmfPkg version returns the guest type in Ovmf work area.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
2022-04-19 01:26:08 +00:00
..
AArch64 MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
Arm MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
Ia32 MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
X64 MdePkg: Support IoFifo for Tdx guest in BaseIoLibIntrinsic 2022-04-02 08:15:12 +00:00
BaseIoLibIntrinsic.inf MdePkg: Support mmio for Tdx guest in BaseIoLibIntrinsic 2022-04-02 08:15:12 +00:00
BaseIoLibIntrinsic.uni MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
BaseIoLibIntrinsicArmVirt.inf MdePkg/IoLib: Filter/trace port IO/MMIO access 2021-04-08 02:02:57 +00:00
BaseIoLibIntrinsicArmVirt.uni MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
BaseIoLibIntrinsicInternal.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BaseIoLibIntrinsicSev.inf MdePkg: Probe Cc guest in BaseIoLibIntrinsicSev 2022-04-19 01:26:08 +00:00
IoHighLevel.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
IoLib.c MdePkg: Support mmio for Tdx guest in BaseIoLibIntrinsic 2022-04-02 08:15:12 +00:00
IoLibArmVirt.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
IoLibEbc.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
IoLibFifo.c MdePkg: Support IoFifo for Tdx guest in BaseIoLibIntrinsic 2022-04-02 08:15:12 +00:00
IoLibGcc.c MdePkg: Support IoRead/IoWrite for Tdx guest in BaseIoLibIntrinsic 2022-04-02 08:15:12 +00:00
IoLibInternalTdx.c MdePkg: Probe Cc guest in BaseIoLibIntrinsicSev 2022-04-19 01:26:08 +00:00
IoLibInternalTdxNull.c MdePkg: Add helper functions for Tdx guest in BaseIoLibIntrinsic 2022-04-02 08:15:12 +00:00
IoLibMmioBuffer.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
IoLibMsc.c MdePkg: Support IoRead/IoWrite for Tdx guest in BaseIoLibIntrinsic 2022-04-02 08:15:12 +00:00
IoLibNoIo.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
IoLibSev.h MdePkg: Support IoFifo for Tdx guest in BaseIoLibIntrinsic 2022-04-02 08:15:12 +00:00
IoLibTdx.h MdePkg: Add helper functions for Tdx guest in BaseIoLibIntrinsic 2022-04-02 08:15:12 +00:00