Re: [PATCH RFC 01/39] KVM: x86: fix Xen hypercall page msr handling

From: Paolo Bonzini
Date: Mon Nov 30 2020 - 06:05:05 EST


On 30/11/20 11:39, David Woodhouse wrote:
... except that's a bit icky because that trick of falling through to
the default case only works for *one* case statement. And more to the
point, the closest thing I can find to a 'kvm_hyperv_enabled()' flag is
what we do for setting the HV_X64_MSR_HYPERCALL_ENABLE flag... which is
based on whether the hv_guest_os_id is set, which in turn is done by
writing one of these MSRs

You can use CPUID too (search for Hv#1 in leaf 0x40000000)?

Paolo

I suppose we could disable them just by letting Xen take precedence, if
kvm->arch.xen_hvm_config.msr == HV_X64_MSR_GUEST_OS_ID. But that's
basically what Joao's patch already does. It doesn't disable the
*other* Hyper-V MSRs except for the one Xen 'conflicts' with, but I
don't think that matters.