From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54032) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VvRZt-0005KC-Bd for qemu-devel@nongnu.org; Tue, 24 Dec 2013 07:59:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VvRZi-00041Q-DE for qemu-devel@nongnu.org; Tue, 24 Dec 2013 07:59:17 -0500 Received: from cantor2.suse.de ([195.135.220.15]:51997 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VvRZi-00040y-7C for qemu-devel@nongnu.org; Tue, 24 Dec 2013 07:59:06 -0500 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Tue, 24 Dec 2013 13:58:59 +0100 Message-Id: <1387889941-9896-9-git-send-email-afaerber@suse.de> In-Reply-To: <1387889941-9896-1-git-send-email-afaerber@suse.de> References: <1387889941-9896-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 08/10] target-i386: Convert 'check' and 'enforce' to static properties List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Igor Mammedov , =?UTF-8?q?Andreas=20F=C3=A4rber?= From: Igor Mammedov * Additionally convert check_cpuid & enforce_cpuid to bool and make them members of X86CPU * Make 'enforce' feature independent from 'check' Signed-off-by: Igor Mammedov Signed-off-by: Andreas F=C3=A4rber --- target-i386/cpu-qom.h | 2 ++ target-i386/cpu.c | 13 ++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/target-i386/cpu-qom.h b/target-i386/cpu-qom.h index dbe3e29..d1751a4 100644 --- a/target-i386/cpu-qom.h +++ b/target-i386/cpu-qom.h @@ -69,6 +69,8 @@ typedef struct X86CPU { bool hyperv_vapic; bool hyperv_relaxed_timing; int hyperv_spinlock_attempts; + bool check_cpuid; + bool enforce_cpuid; =20 /* if true the CPUID code directly forward host cache leaves to the = guest */ bool cache_info_passthrough; diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 39c57f8..6055035 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -354,9 +354,6 @@ typedef struct model_features_t { FeatureWord feat_word; } model_features_t; =20 -int check_cpuid =3D 0; -int enforce_cpuid =3D 0; - static uint32_t kvm_default_features =3D (1 << KVM_FEATURE_CLOCKSOURCE) = | (1 << KVM_FEATURE_NOP_IO_DELAY) | (1 << KVM_FEATURE_CLOCKSOURCE2) | @@ -1772,9 +1769,9 @@ static void cpu_x86_parse_featurestr(X86CPU *cpu, c= har *features, Error **errp) goto out; } } else if (!strcmp(featurestr, "check")) { - check_cpuid =3D 1; + object_property_parse(OBJECT(cpu), "on", featurestr, errp); } else if (!strcmp(featurestr, "enforce")) { - check_cpuid =3D enforce_cpuid =3D 1; + object_property_parse(OBJECT(cpu), "on", featurestr, errp); } else if (!strcmp(featurestr, "hv_relaxed")) { object_property_parse(OBJECT(cpu), "on", "hv-relaxed", errp)= ; } else if (!strcmp(featurestr, "hv_vapic")) { @@ -2608,8 +2605,8 @@ static void x86_cpu_realizefn(DeviceState *dev, Err= or **errp) env->features[FEAT_8000_0001_ECX] &=3D TCG_EXT3_FEATURES; env->features[FEAT_SVM] &=3D TCG_SVM_FEATURES; } else { - if (check_cpuid && kvm_check_features_against_host(cpu) - && enforce_cpuid) { + if ((cpu->check_cpuid || cpu->enforce_cpuid) + && kvm_check_features_against_host(cpu) && cpu->enforce_cpui= d) { error_setg(&local_err, "Host's CPU doesn't support requested features"); goto out; @@ -2771,6 +2768,8 @@ static Property x86_cpu_properties[] =3D { { .name =3D "hv-spinlocks", .info =3D &qdev_prop_spinlocks }, DEFINE_PROP_BOOL("hv-relaxed", X86CPU, hyperv_relaxed_timing, false)= , DEFINE_PROP_BOOL("hv-vapic", X86CPU, hyperv_vapic, false), + DEFINE_PROP_BOOL("check", X86CPU, check_cpuid, false), + DEFINE_PROP_BOOL("enforce", X86CPU, enforce_cpuid, false), DEFINE_PROP_END_OF_LIST() }; =20 --=20 1.8.4