Reviewed-by: David Dunn <daviddunn@xxxxxxxxxx> See below. On Mon, Feb 28, 2022 at 10:04 PM Oliver Upton <oupton@xxxxxxxxxx> wrote: > > + /* > + * Re-enable vPMU in CPUID > + */ > + vcpu_set_cpuid(vm, VCPU_ID, kvm_get_supported_cpuid()); > + > + /* > + * Disable the quirk, giving userspace control of the VMX capability > + * MSRs. > + */ > + cap.cap = KVM_CAP_DISABLE_QUIRKS2; > + cap.args[0] = KVM_X86_QUIRK_TWEAK_VMX_CTRL_MSRS; > + vm_enable_cap(vm, &cap); > + > + /* > + * Test that userspace can clear these bits, even if it exposes a vPMU > + * that supports IA32_PERF_GLOBAL_CTRL. > + */ > + test_vmx_control_msr(vm, MSR_IA32_VMX_TRUE_ENTRY_CTLS, > + 0, /* set */ > + VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL, /* clear */ > + 0, /* exp_set */ > + VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL); /* exp_clear */ > + test_vmx_control_msr(vm, MSR_IA32_VMX_TRUE_EXIT_CTLS, > + 0, /* set */ > + VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL, /* clear */ > + 0, /* exp_set */ > + VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL); /* exp_clear */ > +} Appreciate the formatting change. Can you also add a test for cpuid clear while quirk is disabled? Thanks, Dave