mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-26 23:24:03 +02:00
OvmfPkg/CcExitLib: Use documented XSave area base size for SEV-SNP
Currently OVMF tries to rely on the base size advertised via the CPUID table entries corresponding to leaf 0xD, sub-leafs 0x0/0x1. This will generally work for KVM guests, but might not for other SEV-SNP hypervisor implementations. Make the handling more robust by simply using the base area size documented by the APM. Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com> Acked-by: Jiewen Yao <jiewen.yao@intel.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Michael Roth <michael.roth@amd.com>
This commit is contained in:
parent
ce781cf8bb
commit
edacc551e6
@ -1114,8 +1114,6 @@ SnpEnabled (
|
|||||||
|
|
||||||
@param[in] XFeaturesEnabled Bit-mask of enabled XSAVE features/areas as
|
@param[in] XFeaturesEnabled Bit-mask of enabled XSAVE features/areas as
|
||||||
indicated by XCR0/MSR_IA32_XSS bits
|
indicated by XCR0/MSR_IA32_XSS bits
|
||||||
@param[in] XSaveBaseSize Base/legacy XSAVE area size (e.g. when
|
|
||||||
XCR0 is 1)
|
|
||||||
@param[in, out] XSaveSize Pointer to storage for calculated XSAVE area
|
@param[in, out] XSaveSize Pointer to storage for calculated XSAVE area
|
||||||
size
|
size
|
||||||
@param[in] Compacted Whether or not the calculation is for the
|
@param[in] Compacted Whether or not the calculation is for the
|
||||||
@ -1130,7 +1128,6 @@ STATIC
|
|||||||
BOOLEAN
|
BOOLEAN
|
||||||
GetCpuidXSaveSize (
|
GetCpuidXSaveSize (
|
||||||
IN UINT64 XFeaturesEnabled,
|
IN UINT64 XFeaturesEnabled,
|
||||||
IN UINT32 XSaveBaseSize,
|
|
||||||
IN OUT UINT32 *XSaveSize,
|
IN OUT UINT32 *XSaveSize,
|
||||||
IN BOOLEAN Compacted
|
IN BOOLEAN Compacted
|
||||||
)
|
)
|
||||||
@ -1139,7 +1136,10 @@ GetCpuidXSaveSize (
|
|||||||
UINT64 XFeaturesFound = 0;
|
UINT64 XFeaturesFound = 0;
|
||||||
UINT32 Idx;
|
UINT32 Idx;
|
||||||
|
|
||||||
*XSaveSize = XSaveBaseSize;
|
//
|
||||||
|
// The base/legacy XSave size is documented to be 0x240 in the APM.
|
||||||
|
//
|
||||||
|
*XSaveSize = 0x240;
|
||||||
CpuidInfo = (SEV_SNP_CPUID_INFO *)(UINT64)PcdGet32 (PcdOvmfCpuidBase);
|
CpuidInfo = (SEV_SNP_CPUID_INFO *)(UINT64)PcdGet32 (PcdOvmfCpuidBase);
|
||||||
|
|
||||||
for (Idx = 0; Idx < CpuidInfo->Count; Idx++) {
|
for (Idx = 0; Idx < CpuidInfo->Count; Idx++) {
|
||||||
@ -1355,7 +1355,6 @@ GetCpuidFw (
|
|||||||
|
|
||||||
if (!GetCpuidXSaveSize (
|
if (!GetCpuidXSaveSize (
|
||||||
XCr0 | XssMsr.Uint64,
|
XCr0 | XssMsr.Uint64,
|
||||||
*Ebx,
|
|
||||||
&XSaveSize,
|
&XSaveSize,
|
||||||
Compacted
|
Compacted
|
||||||
))
|
))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user