svm: Fix MBZ reserved bits of AMD CR4 register
PATCH 1/1 svm: Fix MBZ reserved bits of AMD CR4 register
According to AMD APM, Volume 2: System Programming (Rev. 3.37, March 2021), CR4 register is defined to have the following MBZ reserved bits:
* Bit 12 - 15
* Bit 19
* Bit 24 - 63
Additionally Bit 12 will be used by LA57 in future CPUs. Fix the CR4 reserved bit definition to match with APM and prevent potential test_cr4() failures.
--- x86/svm.h | 4 ++-- x86/svm_tests.c | 6 +----- 2 files changed, 3 insertions(+), 7 deletions(-)
x86/svm.h +2 -2
@@ -352,8 +352,8 @@ struct __attribute__ ((__packed__)) vmcb {#define SVM_CR3_LONG_MBZ_MASK 0xfff0000000000000U#define SVM_CR3_LONG_RESERVED_MASK 0x0000000000000fe7U#define SVM_CR3_PAE_LEGACY_RESERVED_MASK 0x0000000000000007U -#define SVM_CR4_LEGACY_RESERVED_MASK 0xff88f000U -#define SVM_CR4_RESERVED_MASK 0xffffffffff88f000U +#define SVM_CR4_LEGACY_RESERVED_MASK 0xff08e000U +#define SVM_CR4_RESERVED_MASK 0xffffffffff08e000U#define SVM_DR6_RESERVED_MASK 0xffffffffffff1ff0U#define SVM_DR7_RESERVED_MASK 0xffffffff0000cc00U#define SVM_EFER_RESERVED_MASK 0xffffffffffff0200U
x86/svm_tests.c +1 -5
@@ -2383,13 +2383,9 @@ skip_npt_only: vmcb->save.cr4 = cr4_saved; } +/* Test CR4 MBZ bits based on legacy or long modes */ static void test_cr4 (void ) { -/* -* CR4 MBZ bits based on different modes: -* [15:12], 17, 19, [31:22] - legacy mode -* [15:12], 17, 19, [63:22] - long mode -*/ u64 cr4_saved = vmcb->save.cr4;u64 efer_saved = vmcb->save.efer;u64 efer = efer_saved;
Signature · 1 line
2.31.1
Paolo Bonzini
maintainerQuoted 8 lines · Wei Huang
According to AMD APM, Volume 2: System Programming (Rev. 3.37, March 2021), CR4 register is defined to have the following MBZ reserved bits:
* Bit 12 - 15
* Bit 19
* Bit 24 - 63
Additionally Bit 12 will be used by LA57 in future CPUs. Fix the CR4 reserved bit definition to match with APM and prevent potentialtest_cr4()failures.
So the difference is LA57 and CET. Queued, thanks!
Paolo
Quoted 2 lines
x86/svm.h +1
-1-#define SVM_CR4_LEGACY_RESERVED_MASK 0xff88f000U +#define SVM_CR4_LEGACY_RESERVED_MASK 0xff08e000U