>+static void svm_recalc_msr_intercepts(struct kvm_vcpu *vcpu) >+{ >+ struct vcpu_svm *svm = to_svm(vcpu); >+ >+ svm_vcpu_init_msrpm(vcpu); >+ >+ if (lbrv) >+ svm_recalc_lbr_msr_intercepts(vcpu); >+ >+ if (boot_cpu_has(X86_FEATURE_IBPB)) >+ svm_set_intercept_for_msr(vcpu, MSR_IA32_PRED_CMD, MSR_TYPE_W, >+ !guest_has_pred_cmd_msr(vcpu)); >+ >+ if (boot_cpu_has(X86_FEATURE_FLUSH_L1D)) >+ svm_set_intercept_for_msr(vcpu, MSR_IA32_FLUSH_CMD, MSR_TYPE_W, >+ !guest_cpu_cap_has(vcpu, X86_FEATURE_FLUSH_L1D)); >+ >+ /* >+ * Unconditionally disable interception of SPEC_CTRL if V_SPEC_CTRL is >+ * supported, i.e. if VMRUN/#VMEXIT context switch MSR_IA32_SPEC_CTRL. >+ */ >+ if (boot_cpu_has(X86_FEATURE_V_SPEC_CTRL)) >+ svm_disable_intercept_for_msr(vcpu, MSR_IA32_SPEC_CTRL, MSR_TYPE_RW); I think there is a bug in the original code. KVM should inject #GP when guests try to access unsupported MSRs. Specifically, a guest w/o spec_ctrl support should get #GP when it tries to access the MSR regardless of V_SPEC_CTRL support on the host. So, here should be if (boot_cpu_has(X86_FEATURE_V_SPEC_CTRL)) svm_set_intercept_for_msr(vcpu, MSR_IA32_SPEC_CTRL, MSR_TYPE_RW, !guest_has_spec_ctrl_msr(vcpu));