kvm: Allow the Hyper-V vendor ID to be specified
PATCH RESEND 1/1 kvm: Allow the Hyper-V vendor ID to be specified
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
---
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(-)
target-i386/cpu-qom.h +1 -0
@@ -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;
target-i386/cpu.c +1 -0
@@ -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() };
target-i386/kvm.c +13 -1
@@ -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 (); + } +memset (signature,0 ,12 ); +memcpy (signature, cpu->hyperv_vendor_id, len); + } c->eax =HYPERV_CPUID_MIN ; c->ebx = signature[0 ]; c->ecx = signature[1 ];
Paolo Bonzini
maintainerQuoted 53 lines · Alex Williamson
According to Microsoft documentation, the signature in the standard hypervisor CPUID leaf at
0x40000000identifies 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
Signed-off-by Alex Williamson <[email protected]>---
Cc'ing
get_maintainersthis time. Any takers? Thanks, Alextarget-i386/cpu-qom.h | 1 + target-i386/cpu.c | 1 + target-i386/kvm.c | 14 +++++++++++++- 3 files changed, 15 insertions(+), 1 deletion(-)target-i386/cpu-qom.h +1
-0@@ -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;target-i386/cpu.c +1
-0@@ -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() };target-i386/kvm.c +0
-0@@ -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 ;
target-i386/kvm.c int kvm_arch_init_vcpu(CPUState *cs) · line 501
Quoted 10 lines
target-i386/kvm.c +9
-1-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
Quoted 13 lines
target-i386/kvm.c +4
-1+ } +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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 60 lines · Paolo Bonzini
Quoted 58 lines · Alex Williamson
According to Microsoft documentation, the signature in the standard hypervisor CPUID leaf at
0x40000000identifies 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
Signed-off-by Alex Williamson <[email protected]>---
Cc'ing
get_maintainersthis time. Any takers? Thanks, Alextarget-i386/cpu-qom.h | 1 + target-i386/cpu.c | 1 + target-i386/kvm.c | 14 +++++++++++++- 3 files changed, 15 insertions(+), 1 deletion(-)target-i386/cpu-qom.h +1
-0@@ -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;target-i386/cpu.c +1
-0@@ -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() };target-i386/kvm.c +4
-1@@ -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);
Quoted 8 lines
target-i386/kvm.c int kvm_arch_init_vcpu(CPUState *cs) · line 501
Quoted 5 lines
target-i386/kvm.c +5
-0+ +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.
If we don't abort then we should really set len = 12 here. Thanks,
Alex
Quoted 17 lines
Quoted 9 lines
target-i386/kvm.c +4
-1+ } +memset (signature,0 ,12 ); +memcpy (signature, cpu->hyperv_vendor_id, len); + } c->eax =HYPERV_CPUID_MIN ; c->ebx = signature[0 ]; c->ecx = signature[1 ]; --Quoted 4 lines
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 70 lines · On Fri, 16 Oct 2015 08:26:14 -0600 Alex Williamson…
Quoted 60 lines · Paolo Bonzini
Quoted 58 lines · Alex Williamson
According to Microsoft documentation, the signature in the standard hypervisor CPUID leaf at
0x40000000identifies 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
Signed-off-by Alex Williamson <[email protected]>---
Cc'ing
get_maintainersthis time. Any takers? Thanks, Alextarget-i386/cpu-qom.h | 1 + target-i386/cpu.c | 1 + target-i386/kvm.c | 14 +++++++++++++- 3 files changed, 15 insertions(+), 1 deletion(-)target-i386/cpu-qom.h +1
-0@@ -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;target-i386/cpu.c +1
-0@@ -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() };target-i386/kvm.c +4
-1@@ -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);Quoted 8 lines
target-i386/kvm.c int kvm_arch_init_vcpu(CPUState *cs) · line 501
Quoted 5 lines
target-i386/kvm.c +5
-0+ +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.
Quoted 1 line
If we don't abort then we should really set len = 12 here. Thanks,
or make custom property setter that will check value validity, so it could safely fail CPU creation during hotplug.
Quoted 24 lines
Alex
Quoted 17 lines
Quoted 9 lines
target-i386/kvm.c +4
-1+ } +memset (signature,0 ,12 ); +memcpy (signature, cpu->hyperv_vendor_id, len); + } c->eax =HYPERV_CPUID_MIN ; c->ebx = signature[0 ]; c->ecx = signature[1 ]; --Quoted 4 lines
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html