From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [RESEND PATCH] kvm: Allow the Hyper-V vendor ID to be specified Date: Fri, 16 Oct 2015 09:30:43 +0200 Message-ID: <5620A7A3.4060703@redhat.com> References: <20151015221556.31645.81905.stgit@gimli.home> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: ehabkost@redhat.com, rth@twiddle.net To: Alex Williamson , qemu-devel@nongnu.org, kvm@vger.kernel.org Return-path: Received: from mail-lb0-f182.google.com ([209.85.217.182]:35220 "EHLO mail-lb0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752378AbbJPHar (ORCPT ); Fri, 16 Oct 2015 03:30:47 -0400 Received: by lbbes7 with SMTP id es7so3053258lbb.2 for ; Fri, 16 Oct 2015 00:30:45 -0700 (PDT) In-Reply-To: <20151015221556.31645.81905.stgit@gimli.home> Sender: kvm-owner@vger.kernel.org List-ID: On 16/10/2015 00:16, Alex Williamson wrote: > According to Microsoft documentation, the signature in the standard > hypervisor CPUID leaf at 0x40000000 identifies the Vendor ID and is > for reporting and diagnostic purposes only. We can therefore allow > the user to change it to whatever they want, within the 12 character > limit. Add a new hyperv-vendor-id option to the -cpu flag to allow > for this, ex: > > -cpu host,hv_time,hv_vendor_id=KeenlyKVM > > Link: http://msdn.microsoft.com/library/windows/hardware/hh975392 > Signed-off-by: Alex Williamson > --- > > Cc'ing get_maintainers this time. Any takers? Thanks, > Alex > > target-i386/cpu-qom.h | 1 + > target-i386/cpu.c | 1 + > target-i386/kvm.c | 14 +++++++++++++- > 3 files changed, 15 insertions(+), 1 deletion(-) > > diff --git a/target-i386/cpu-qom.h b/target-i386/cpu-qom.h > index c35b624..6c1eaaa 100644 > --- a/target-i386/cpu-qom.h > +++ b/target-i386/cpu-qom.h > @@ -88,6 +88,7 @@ typedef struct X86CPU { > bool hyperv_vapic; > bool hyperv_relaxed_timing; > int hyperv_spinlock_attempts; > + char *hyperv_vendor_id; > bool hyperv_time; > bool hyperv_crash; > bool check_cpuid; > diff --git a/target-i386/cpu.c b/target-i386/cpu.c > index 05d7f26..71df546 100644 > --- a/target-i386/cpu.c > +++ b/target-i386/cpu.c > @@ -3146,6 +3146,7 @@ static Property x86_cpu_properties[] = { > DEFINE_PROP_UINT32("level", X86CPU, env.cpuid_level, 0), > DEFINE_PROP_UINT32("xlevel", X86CPU, env.cpuid_xlevel, 0), > DEFINE_PROP_UINT32("xlevel2", X86CPU, env.cpuid_xlevel2, 0), > + DEFINE_PROP_STRING("hv-vendor-id", X86CPU, hyperv_vendor_id), > DEFINE_PROP_END_OF_LIST() > }; > > diff --git a/target-i386/kvm.c b/target-i386/kvm.c > index 80d1a7e..5e3ab22 100644 > --- a/target-i386/kvm.c > +++ b/target-i386/kvm.c > @@ -490,7 +490,19 @@ int kvm_arch_init_vcpu(CPUState *cs) > if (hyperv_enabled(cpu)) { > c = &cpuid_data.entries[cpuid_i++]; > c->function = HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS; > - memcpy(signature, "Microsoft Hv", 12); > + if (!cpu->hyperv_vendor_id) { > + memcpy(signature, "Microsoft Hv", 12); > + } else { > + size_t len = strlen(cpu->hyperv_vendor_id); > + > + if (len > 12) { > + fprintf(stderr, > + "hyperv-vendor-id too long, limited to 12 charaters"); > + abort(); I'm removing this abort and queueing the patch. I'll send a pull request today. Paolo > + } > + memset(signature, 0, 12); > + memcpy(signature, cpu->hyperv_vendor_id, len); > + } > c->eax = HYPERV_CPUID_MIN; > c->ebx = signature[0]; > c->ecx = signature[1]; > > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49356) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmzTV-0008UV-P4 for qemu-devel@nongnu.org; Fri, 16 Oct 2015 03:30:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZmzTS-0000mL-Hk for qemu-devel@nongnu.org; Fri, 16 Oct 2015 03:30:49 -0400 Received: from mail-lb0-x22c.google.com ([2a00:1450:4010:c04::22c]:33884) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmzTS-0000ls-98 for qemu-devel@nongnu.org; Fri, 16 Oct 2015 03:30:46 -0400 Received: by lbbwb3 with SMTP id wb3so31353929lbb.1 for ; Fri, 16 Oct 2015 00:30:45 -0700 (PDT) Sender: Paolo Bonzini References: <20151015221556.31645.81905.stgit@gimli.home> From: Paolo Bonzini Message-ID: <5620A7A3.4060703@redhat.com> Date: Fri, 16 Oct 2015 09:30:43 +0200 MIME-Version: 1.0 In-Reply-To: <20151015221556.31645.81905.stgit@gimli.home> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RESEND PATCH] kvm: Allow the Hyper-V vendor ID to be specified List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alex Williamson , qemu-devel@nongnu.org, kvm@vger.kernel.org Cc: ehabkost@redhat.com, rth@twiddle.net On 16/10/2015 00:16, Alex Williamson wrote: > According to Microsoft documentation, the signature in the standard > hypervisor CPUID leaf at 0x40000000 identifies the Vendor ID and is > for reporting and diagnostic purposes only. We can therefore allow > the user to change it to whatever they want, within the 12 character > limit. Add a new hyperv-vendor-id option to the -cpu flag to allow > for this, ex: > > -cpu host,hv_time,hv_vendor_id=KeenlyKVM > > Link: http://msdn.microsoft.com/library/windows/hardware/hh975392 > Signed-off-by: Alex Williamson > --- > > Cc'ing get_maintainers this time. Any takers? Thanks, > Alex > > target-i386/cpu-qom.h | 1 + > target-i386/cpu.c | 1 + > target-i386/kvm.c | 14 +++++++++++++- > 3 files changed, 15 insertions(+), 1 deletion(-) > > diff --git a/target-i386/cpu-qom.h b/target-i386/cpu-qom.h > index c35b624..6c1eaaa 100644 > --- a/target-i386/cpu-qom.h > +++ b/target-i386/cpu-qom.h > @@ -88,6 +88,7 @@ typedef struct X86CPU { > bool hyperv_vapic; > bool hyperv_relaxed_timing; > int hyperv_spinlock_attempts; > + char *hyperv_vendor_id; > bool hyperv_time; > bool hyperv_crash; > bool check_cpuid; > diff --git a/target-i386/cpu.c b/target-i386/cpu.c > index 05d7f26..71df546 100644 > --- a/target-i386/cpu.c > +++ b/target-i386/cpu.c > @@ -3146,6 +3146,7 @@ static Property x86_cpu_properties[] = { > DEFINE_PROP_UINT32("level", X86CPU, env.cpuid_level, 0), > DEFINE_PROP_UINT32("xlevel", X86CPU, env.cpuid_xlevel, 0), > DEFINE_PROP_UINT32("xlevel2", X86CPU, env.cpuid_xlevel2, 0), > + DEFINE_PROP_STRING("hv-vendor-id", X86CPU, hyperv_vendor_id), > DEFINE_PROP_END_OF_LIST() > }; > > diff --git a/target-i386/kvm.c b/target-i386/kvm.c > index 80d1a7e..5e3ab22 100644 > --- a/target-i386/kvm.c > +++ b/target-i386/kvm.c > @@ -490,7 +490,19 @@ int kvm_arch_init_vcpu(CPUState *cs) > if (hyperv_enabled(cpu)) { > c = &cpuid_data.entries[cpuid_i++]; > c->function = HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS; > - memcpy(signature, "Microsoft Hv", 12); > + if (!cpu->hyperv_vendor_id) { > + memcpy(signature, "Microsoft Hv", 12); > + } else { > + size_t len = strlen(cpu->hyperv_vendor_id); > + > + if (len > 12) { > + fprintf(stderr, > + "hyperv-vendor-id too long, limited to 12 charaters"); > + abort(); I'm removing this abort and queueing the patch. I'll send a pull request today. Paolo > + } > + memset(signature, 0, 12); > + memcpy(signature, cpu->hyperv_vendor_id, len); > + } > c->eax = HYPERV_CPUID_MIN; > c->ebx = signature[0]; > c->ecx = signature[1]; > > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html >