BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4654
Similar to the Page State Change optimization added previously, also take into account the possiblity of using the SVSM for PVALIDATE instructions. Conditionally adjust the maximum number of entries based on how many entries the SVSM calling area can support. Cc: Ard Biesheuvel <ardb+tianoc...@kernel.org> Cc: Erdem Aktas <erdemak...@google.com> Cc: Gerd Hoffmann <kra...@redhat.com> Cc: Jiewen Yao <jiewen....@intel.com> Cc: Laszlo Ersek <ler...@redhat.com> Cc: Michael Roth <michael.r...@amd.com> Cc: Min Xu <min.m...@intel.com> Acked-by: Gerd Hoffmann <kra...@redhat.com> Signed-off-by: Tom Lendacky <thomas.lenda...@amd.com> --- OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c index c8c0c4ef0e95..e073f3937c41 100644 --- a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c +++ b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c @@ -18,6 +18,7 @@ #include <Register/Amd/Ghcb.h> #include <Register/Amd/Msr.h> +#include <Register/Amd/Svsm.h> #include "SnpPageStateChange.h" @@ -78,6 +79,7 @@ BuildPageStateBuffer ( UINTN Index; UINTN IndexMax; UINTN PscIndexMax; + UINTN SvsmIndexMax; // Clear the page state structure SetMem (Info, InfoSize, 0); @@ -96,6 +98,11 @@ BuildPageStateBuffer ( IndexMax = MIN (IndexMax, PscIndexMax); } + SvsmIndexMax = (IndexMax / SVSM_PVALIDATE_MAX_ENTRY) * SVSM_PVALIDATE_MAX_ENTRY; + if (SvsmIndexMax > 0) { + IndexMax = MIN (IndexMax, SvsmIndexMax); + } + // // Populate the page state entry structure // -- 2.43.2 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#116545): https://edk2.groups.io/g/devel/message/116545 Mute This Topic: https://groups.io/mt/104810737/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-