David Woodhouse <dwmw2@xxxxxxxxxxxxx> writes: >>> @@ -3001,6 +3001,9 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, >>struct msr_data *msr_info) >>> u32 msr = msr_info->index; >>> u64 data = msr_info->data; >>> >>> + if (msr && (msr == vcpu->kvm->arch.xen_hvm_config.msr)) >>> + return xen_hvm_config(vcpu, data); >>> + >> >>Can we generalize this maybe? E.g. before handling KVM and >>architectural >>MSRs we check that the particular MSR is not overriden by an emulated >>hypervisor, >> >>e.g. >> if (kvm_emulating_hyperv(kvm) && kvm_hyperv_msr_overriden(kvm,msr) >> return kvm_hyperv_handle_msr(kvm, msr); >> if (kvm_emulating_xen(kvm) && kvm_xen_msr_overriden(kvm,msr) >> return kvm_xen_handle_msr(kvm, msr); > > That smells a bit like overengineering. As I said, I did have a play > with "improving" Joao's original patch but nothing I tried actually > made more sense to me than this once the details were ironed out. This actually looks more or less like hypercall distinction from after PATCH3: if (kvm_xen_hypercall_enabled(vcpu->kvm)) return kvm_xen_hypercall(vcpu); if (kvm_hv_hypercall_enabled(vcpu->kvm)) return kvm_hv_hypercall(vcpu); .... so my idea was why not do the same for MSRs? -- Vitaly