[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH qom-cpu v2 01/10] target-i386: Simplify reporting of
From: |
Eduardo Habkost |
Subject: |
[Qemu-devel] [PATCH qom-cpu v2 01/10] target-i386: Simplify reporting of unavailable features |
Date: |
Mon, 17 Mar 2014 16:44:58 -0300 |
Instead of checking and calling unavailable_host_feature() once for each
bit, simply call the function (now renamed to
report_unavailable_features()) once for each feature word.
Signed-off-by: Eduardo Habkost <address@hidden>
---
Changes v1 -> v2:
* Rebase to latest qom-cpu (commit 90c5d39c)
---
target-i386/cpu.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index e7e62c5..239ab8c 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1230,11 +1230,11 @@ static const TypeInfo host_x86_cpu_type_info = {
#endif
-static int unavailable_host_feature(FeatureWordInfo *f, uint32_t mask)
+static int report_unavailable_features(FeatureWordInfo *f, uint32_t mask)
{
int i;
- for (i = 0; i < 32; ++i)
+ for (i = 0; i < 32; ++i) {
if (1 << i & mask) {
const char *reg = get_register_name_32(f->cpuid_reg);
assert(reg);
@@ -1243,8 +1243,8 @@ static int unavailable_host_feature(FeatureWordInfo *f,
uint32_t mask)
f->cpuid_eax, reg,
f->feat_names[i] ? "." : "",
f->feat_names[i] ? f->feat_names[i] : "", i);
- break;
}
+ }
return 0;
}
@@ -1268,12 +1268,10 @@ static int kvm_check_features_against_host(KVMState *s,
X86CPU *cpu)
uint32_t host_feat = kvm_arch_get_supported_cpuid(s, wi->cpuid_eax,
wi->cpuid_ecx,
wi->cpuid_reg);
- uint32_t mask;
- for (mask = 1; mask; mask <<= 1) {
- if (guest_feat & mask && !(host_feat & mask)) {
- unavailable_host_feature(wi, mask);
- rv = 1;
- }
+ uint32_t unavailable_features = guest_feat & ~host_feat;
+ if (unavailable_features) {
+ report_unavailable_features(wi, unavailable_features);
+ rv = 1;
}
}
return rv;
--
1.8.5.3
- [Qemu-devel] [PATCH qom-cpu v2 00/10] target-i386: Support check/enforce flags in TCG mode, too, Eduardo Habkost, 2014/03/17
- [Qemu-devel] [PATCH qom-cpu v2 02/10] target-i386: Merge feature filtering/checking functions, Eduardo Habkost, 2014/03/17
- [Qemu-devel] [PATCH qom-cpu v2 04/10] target-i386: Isolate KVM-specific code on CPU feature filtering logic, Eduardo Habkost, 2014/03/17
- [Qemu-devel] [PATCH qom-cpu v2 03/10] target-i386: Pass FeatureWord argument to report_unavailable_features(), Eduardo Habkost, 2014/03/17
- [Qemu-devel] [PATCH qom-cpu v2 05/10] target-i386: Make TCG feature filtering more readable, Eduardo Habkost, 2014/03/17
- [Qemu-devel] [PATCH qom-cpu v2 06/10] target-i386: Filter FEAT_7_0_EBX TCG features too, Eduardo Habkost, 2014/03/17
- [Qemu-devel] [PATCH qom-cpu v2 07/10] target-i386: Filter KVM and 0xC0000001 features on TCG, Eduardo Habkost, 2014/03/17
- [Qemu-devel] [PATCH qom-cpu v2 08/10] target-i386: Define TCG_*_FEATURES earlier on cpu.c, Eduardo Habkost, 2014/03/17
- [Qemu-devel] [PATCH qom-cpu v2 09/10] target-i386: Loop-based feature word filtering in TCG mode, Eduardo Habkost, 2014/03/17
- [Qemu-devel] [PATCH qom-cpu v2 10/10] target-i386: Support check/enforce flags in TCG mode, too, Eduardo Habkost, 2014/03/17
- [Qemu-devel] [PATCH qom-cpu v2 01/10] target-i386: Simplify reporting of unavailable features,
Eduardo Habkost <=