Received: from eggs.gnu.org ([2001:4830:134:3::10]:59104) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4zze-0008II-Ov for qemu-devel@nongnu.org; Wed, 09 Jul 2014 18:05:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X4zzY-0000LJ-BR for qemu-devel@nongnu.org; Wed, 09 Jul 2014 18:05:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:1208) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4zzY-0000L0-1F for qemu-devel@nongnu.org; Wed, 09 Jul 2014 18:05:32 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s69M5VTC014441 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 9 Jul 2014 18:05:31 -0400 From: Eduardo Habkost Date: Wed, 9 Jul 2014 19:04:21 -0300 Message-Id: <1404943462-711-25-git-send-email-ehabkost@redhat.com> In-Reply-To: <1404943462-711-1-git-send-email-ehabkost@redhat.com> References: <1404943462-711-1-git-send-email-ehabkost@redhat.com> Subject: [Qemu-devel] [RFC 24/25] target-i386: Accept "host" as value for CPU vendor List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org When using vendor=host, the host CPU vendor will be used. Signed-off-by: Eduardo Habkost --- target-i386/cpu.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 406ce02..eaae1ce 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1528,8 +1528,16 @@ static void x86_cpuid_set_vendor(Object *obj, const char *value, { X86CPU *cpu = X86_CPU(obj); CPUX86State *env = &cpu->env; + char host_vendor[CPUID_VENDOR_SZ + 1]; int i; + if (!strcmp(value, "host")) { + uint32_t ebx = 0, ecx = 0, edx = 0; + host_cpuid(0, 0, NULL, &ebx, &ecx, &edx); + x86_cpu_vendor_words2str(host_vendor, ebx, edx, ecx); + value = host_vendor; + } + if (strlen(value) != CPUID_VENDOR_SZ) { error_set(errp, QERR_PROPERTY_VALUE_BAD, "", "vendor", value); @@ -1996,8 +2004,6 @@ static void x86_cpu_accel_init(X86CPU *cpu, Error **errp) static int inited; if (kvm_enabled()) { - char host_vendor[CPUID_VENDOR_SZ + 1]; - uint32_t ebx = 0, ecx = 0, edx = 0; FeatureWord w; for (w = 0; w < FEATURE_WORDS; w++) { env->features[w] |= kvm_default_features[w]; @@ -2011,9 +2017,7 @@ static void x86_cpu_accel_init(X86CPU *cpu, Error **errp) * KVM's sysenter/syscall emulation in compatibility mode and * when doing cross vendor migration */ - host_cpuid(0, 0, NULL, &ebx, &ecx, &edx); - x86_cpu_vendor_words2str(host_vendor, ebx, edx, ecx); - object_property_set_str(OBJECT(cpu), host_vendor, "vendor", errp); + object_property_set_str(OBJECT(cpu), "host", "vendor", errp); } /* init various static tables used in TCG mode */ -- 1.9.3