[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 13/16] target-i386: use static properties in check_f
From: |
Igor Mammedov |
Subject: |
[Qemu-devel] [PATCH 13/16] target-i386: use static properties in check_features_against_host() to print CPUID feature names |
Date: |
Wed, 27 Nov 2013 23:28:53 +0100 |
Signed-off-by: Igor Mammedov <address@hidden>
---
target-i386/cpu.c | 33 ++++++++++++++-------------------
1 file changed, 14 insertions(+), 19 deletions(-)
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 1503e9a..5c3455f 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1119,24 +1119,6 @@ static void kvm_cpu_fill_host(x86_def_t *x86_cpu_def)
#endif /* CONFIG_KVM */
}
-static int unavailable_host_feature(FeatureWordInfo *f, uint32_t mask)
-{
- int i;
-
- for (i = 0; i < 32; ++i)
- if (1 << i & mask) {
- const char *reg = get_register_name_32(f->cpuid_reg);
- assert(reg);
- fprintf(stderr, "warning: host doesn't support requested feature: "
- "CPUID.%02XH:%s%s%s [bit %d]\n",
- f->cpuid_eax, reg,
- f->feat_names[i] ? "." : "",
- f->feat_names[i] ? f->feat_names[i] : "", i);
- break;
- }
- return 0;
-}
-
/* Check if all requested cpu flags are making their way to the guest
*
* Returns 0 if all flags are supported by the host, non-zero otherwise.
@@ -1175,6 +1157,7 @@ static int kvm_check_features_against_host(X86CPU *cpu)
&host_def.features[FEAT_KVM],
FEAT_KVM },
};
+ const DeviceClass *dc = DEVICE_CLASS(object_get_class(OBJECT(cpu)));
assert(kvm_enabled());
@@ -1182,10 +1165,22 @@ static int kvm_check_features_against_host(X86CPU *cpu)
for (rv = 0, i = 0; i < ARRAY_SIZE(ft); ++i) {
FeatureWord w = ft[i].feat_word;
FeatureWordInfo *wi = &feature_word_info[w];
+ int offset = (char *)&((X86CPU *)0)->env.features[w] - (char *)0;
for (mask = 1; mask; mask <<= 1) {
if (*ft[i].guest_feat & mask &&
!(*ft[i].host_feat & mask)) {
- unavailable_host_feature(wi, mask);
+ int bitnr = ffsl(mask) - 1;
+ const Property *prop = qdev_prop_find_bit(dc, offset, bitnr);
+ const char *name = prop ? prop->name : NULL;
+ const char *reg = get_register_name_32(wi->cpuid_reg);
+
+ assert(reg);
+ fprintf(stderr, "warning: host doesn't support requested"
+ "feature: CPUID.%02XH:%s%s%s [bit %d]\n",
+ wi->cpuid_eax,
+ reg, name ? "." : "",
+ name ? name : "",
+ bitnr);
rv = 1;
}
}
--
1.8.3.1
- [Qemu-devel] [PATCH 02/16] target-i386: cleanup 'foo=val' feature handling, (continued)
- [Qemu-devel] [PATCH 02/16] target-i386: cleanup 'foo=val' feature handling, Igor Mammedov, 2013/11/27
- [Qemu-devel] [PATCH 05/16] target-i386: cpu: convert 'family' to static property, Igor Mammedov, 2013/11/27
- [Qemu-devel] [PATCH 03/16] target-i386: cpu: convert 'level' to static property, Igor Mammedov, 2013/11/27
- [Qemu-devel] [PATCH 04/16] target-i386: cpu: convert 'xlevel' to static property, Igor Mammedov, 2013/11/27
- [Qemu-devel] [PATCH 06/16] target-i386: cpu: convert 'model' to static property, Igor Mammedov, 2013/11/27
- [Qemu-devel] [PATCH 07/16] target-i386: cpu: convert 'stepping' to static property, Igor Mammedov, 2013/11/27
- [Qemu-devel] [PATCH 08/16] target-i386: cpu: convert 'vendor' to static property, Igor Mammedov, 2013/11/27
- [Qemu-devel] [PATCH 11/16] target-i386: set [+-]feature using static properties, Igor Mammedov, 2013/11/27
- [Qemu-devel] [PATCH 09/16] target-i386: cpu: convert 'model-id' to static property, Igor Mammedov, 2013/11/27
- [Qemu-devel] [PATCH 10/16] target-i386: cpu: convert 'tsc-frequency' to static property, Igor Mammedov, 2013/11/27
- [Qemu-devel] [PATCH 13/16] target-i386: use static properties in check_features_against_host() to print CPUID feature names,
Igor Mammedov <=
- [Qemu-devel] [PATCH 14/16] target-i386: use static properties to list CPUID features, Igor Mammedov, 2013/11/27
- [Qemu-devel] [PATCH 12/16] qdev: introduce qdev_prop_find_bit(), Igor Mammedov, 2013/11/27
- [Qemu-devel] [PATCH 16/16] target-i386: cpu: fix invalid use of error_is_set(errp) if errp == NULL, Igor Mammedov, 2013/11/27
- [Qemu-devel] [PATCH 15/16] target-i386: remove unused *_feature_name arrays, Igor Mammedov, 2013/11/27