[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/2] x86: hv_evmcs CPU flag support
From: |
Roman Kagan |
Subject: |
Re: [Qemu-devel] [PATCH 2/2] x86: hv_evmcs CPU flag support |
Date: |
Mon, 22 Oct 2018 14:33:59 +0000 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
On Fri, Oct 19, 2018 at 01:14:32PM +0200, Vitaly Kuznetsov wrote:
> --- a/target/i386/kvm.c
> +++ b/target/i386/kvm.c
> @@ -798,6 +798,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
> uint32_t unused;
> struct kvm_cpuid_entry2 *c;
> uint32_t signature[3];
> + uint16_t evmcs_version;
> int kvm_base = KVM_CPUID_SIGNATURE;
> int r;
> Error *local_err = NULL;
> @@ -841,7 +842,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
> memset(signature, 0, 12);
> memcpy(signature, cpu->hyperv_vendor_id, len);
> }
> - c->eax = HV_CPUID_MIN;
> + c->eax = cpu->hyperv_evmcs ? HV_CPUID_MIN_NESTED : HV_CPUID_MIN;
I think these two aren't meant to be used on the hypervisor side. My
understanding is that HV_CPUID_MIN is only there as a reminder that the
real Hyper-V exposes at least that many hypervisor-specific leaves so
the guest can rely on that. So I'd rather use directly
HV_CPUID_IMPLEMENT_LIMITS : HV_CPUID_NESTED_FEATURES, and not introduce
HV_CPUID_MIN_NESTED. Maybe better yet is to update this field with the
maximum value while populating HV_* leaves:
if (hyperv_enabled(cpu)) {
uint32_t *cpuid_40000000_eax;
c = &cpuid_data.entries[cpuid_i++];
c->function = HV_CPUID_VENDOR_AND_MAX_FUNCTIONS;
cpuid_40000000_eax = &c->eax;
*cpuid_40000000_eax = c->function;
....
c = &cpuid_data.entries[cpuid_i++];
c->function = HV_CPUID_...;
*cpuid_40000000_eax = max(*cpuid_40000000_eax, c->function);
but I think it can be done later and doesn't need to hold this patch.
Another question related to this: are the guests OK with leaves
0x40000006..0x40000009 missing?
Thanks,
Roman.