i386: Enable NPT and NRIPSAVE for AMD CPUs
PATCH 1/1 i386: Enable NPT and NRIPSAVE for AMD CPUs
Modern AMD CPUs support NPT and NRIPSAVE features and KVM exposes these when present. NRIPSAVE apeared somewhere in Opteron_G3 lifetime (e.g. QuadCore AMD Opteron 2378 has is but QuadCore AMD Opteron HE 2344 doesn't), NPT was introduced a bit earlier.
Add the FEAT_SVM leaf to Opteron_G4/G5 and EPYC/EPYC-IBPB cpu models.
--- target/i386/cpu.c | 8 ++++++++ 1 file changed, 8 insertions(+)
target/i386/cpu.c +8 -0
@@ -2766,6 +2766,8 @@ static X86CPUDefinition builtin_x86_defs[] = {CPUID_EXT3_3DNOWPREFETCH |CPUID_EXT3_MISALIGNSSE |CPUID_EXT3_SSE4A |CPUID_EXT3_ABM |CPUID_EXT3_SVM | CPUID_EXT3_LAHF_LM, + .features[FEAT_SVM ] = + CPUID_SVM_NPT | CPUID_SVM_NRIPSAVE,/* no xsaveopt! */ .xlevel = 0x8000001A, .model_id = "AMD Opteron 62xx class CPU",
@@ -2797,6 +2799,8 @@ static X86CPUDefinition builtin_x86_defs[] = {CPUID_EXT3_3DNOWPREFETCH |CPUID_EXT3_MISALIGNSSE |CPUID_EXT3_SSE4A |CPUID_EXT3_ABM |CPUID_EXT3_SVM | CPUID_EXT3_LAHF_LM, + .features[FEAT_SVM ] = + CPUID_SVM_NPT | CPUID_SVM_NRIPSAVE,/* no xsaveopt! */ .xlevel = 0x8000001A, .model_id = "AMD Opteron 63xx class CPU",
@@ -2843,6 +2847,8 @@ static X86CPUDefinition builtin_x86_defs[] = { CPUID_XSAVE_XGETBV1, .features[FEAT_6_EAX ] = CPUID_6_EAX_ARAT, + .features[FEAT_SVM ] = + CPUID_SVM_NPT | CPUID_SVM_NRIPSAVE, .xlevel = 0x8000001E, .model_id = "AMD EPYC Processor", .cache_info = &epyc_cache_info,
@@ -2891,6 +2897,8 @@ static X86CPUDefinition builtin_x86_defs[] = { CPUID_XSAVE_XGETBV1, .features[FEAT_6_EAX ] = CPUID_6_EAX_ARAT, + .features[FEAT_SVM ] = + CPUID_SVM_NPT | CPUID_SVM_NRIPSAVE, .xlevel = 0x8000001E, .model_id = "AMD EPYC Processor (with IBPB)", .cache_info = &epyc_cache_info,
Signature · 1 line
2.20.1
Quoted 17 lines · Vitaly Kuznetsov
Modern AMD CPUs support NPT and NRIPSAVE features and KVM exposes these when present. NRIPSAVE apeared somewhere in
Opteron_G3lifetime (e.g. QuadCore AMD Opteron 2378 has is but QuadCore AMD Opteron HE 2344 doesn't), NPT was introduced a bit earlier.Add the
FEAT_SVMleaf to Opteron_G4/G5 and EPYC/EPYC-IBPB cpu models.Signed-off-by Vitaly Kuznetsov <[email protected]>--- target/i386/cpu.c | 8 ++++++++ 1 file changed, 8 insertions(+)target/i386/cpu.c +0
-0
target/i386/cpu.c static X86CPUDefinition builtin_x86_defs[] = { · line 2770
Quoted 5 lines
target/i386/cpu.c +2
-0@@ -2766,6 +2766,8 @@ static X86CPUDefinition builtin_x86_defs[] = {CPUID_EXT3_3DNOWPREFETCH |CPUID_EXT3_MISALIGNSSE |CPUID_EXT3_SSE4A |CPUID_EXT3_ABM |CPUID_EXT3_SVM | CPUID_EXT3_LAHF_LM, + .features[FEAT_SVM ] = + CPUID_SVM_NPT | CPUID_SVM_NRIPSAVE,
Same issue as the previous EPYC patch: you need npt=off and nrip-save=off on pc_compat_3_1.
(Sorry again for taking so long to review this)
Quoted 1 line
[...]
Signature · 1 line
Eduardo