Check that PCID is actually supported before verifying that it can be set in vmcs.HOST_CR4 for 64-bit hosts. PCID is all but ubiquitous on modern CPUs, but PCID may be hidden by the host to workaround a TLB flushing bug on Alderlake and Raptorlake. Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx> --- x86/vmx_tests.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c index 7952ccb9..226f526d 100644 --- a/x86/vmx_tests.c +++ b/x86/vmx_tests.c @@ -7625,10 +7625,12 @@ static void test_host_addr_size(void) test_vmx_vmlaunch(0); report_prefix_pop(); - vmcs_write(HOST_CR4, cr4_saved | X86_CR4_PCIDE); - report_prefix_pushf("\"CR4.PCIDE\" set"); - test_vmx_vmlaunch(0); - report_prefix_pop(); + if (this_cpu_has(X86_FEATURE_PCID)) { + vmcs_write(HOST_CR4, cr4_saved | X86_CR4_PCIDE); + report_prefix_pushf("\"CR4.PCIDE\" set"); + test_vmx_vmlaunch(0); + report_prefix_pop(); + } for (i = 32; i <= 63; i = i + 4) { tmp = rip_saved | 1ull << i; -- 2.42.0.283.g2d96d420d3-goog