[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 09/10] target-i386: cleanup 'foo=val' feature handli
From: |
Igor Mammedov |
Subject: |
[Qemu-devel] [PATCH 09/10] target-i386: cleanup 'foo=val' feature handling |
Date: |
Mon, 25 Feb 2013 02:03:08 +0100 |
features family, model, stepping, level, hv_spinlocks are treated similarly
when passed from command line, so it's not necessary to handle each of them
individually. Collapse them to one catch-all branch which will treat
any not explicitly handled feature in format 'foo=val'.
PS:
Any unknown feature will be rejected by property setter so there is no
need to check for unknown feature in cpu_x86_parse_featurestr(), therefore
it's replaced by above mentioned catch-all handler.
Signed-off-by: Igor Mammedov <address@hidden>
---
v2:
- style fixes
---
target-i386/cpu.c | 17 ++---------------
1 files changed, 2 insertions(+), 15 deletions(-)
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 1073bdc..6a0d5d3 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1423,15 +1423,7 @@ static void cpu_x86_parse_featurestr(X86CPU *cpu, char
*features, Error **errp)
} else if ((val = strchr(featurestr, '='))) {
feat2prop(featurestr);
*val = 0; val++;
- if (!strcmp(featurestr, "family")) {
- object_property_parse(OBJECT(cpu), val, featurestr, errp);
- } else if (!strcmp(featurestr, "model")) {
- object_property_parse(OBJECT(cpu), val, featurestr, errp);
- } else if (!strcmp(featurestr, "stepping")) {
- object_property_parse(OBJECT(cpu), val, featurestr, errp);
- } else if (!strcmp(featurestr, "level")) {
- object_property_parse(OBJECT(cpu), val, featurestr, errp);
- } else if (!strcmp(featurestr, "xlevel")) {
+ if (!strcmp(featurestr, "xlevel")) {
char *err;
char num[32];
@@ -1447,10 +1439,6 @@ static void cpu_x86_parse_featurestr(X86CPU *cpu, char
*features, Error **errp)
}
snprintf(num, sizeof(num), "%" PRIu32, numvalue);
object_property_parse(OBJECT(cpu), num, featurestr, errp);
- } else if (!strcmp(featurestr, "vendor")) {
- object_property_parse(OBJECT(cpu), val, featurestr, errp);
- } else if (!strcmp(featurestr, "model-id")) {
- object_property_parse(OBJECT(cpu), val, featurestr, errp);
} else if (!strcmp(featurestr, "tsc-freq")) {
int64_t tsc_freq;
char *err;
@@ -1482,8 +1470,7 @@ static void cpu_x86_parse_featurestr(X86CPU *cpu, char
*features, Error **errp)
snprintf(num, sizeof(num), "%" PRId32, numvalue);
object_property_parse(OBJECT(cpu), num, featurestr, errp);
} else {
- error_setg(errp, "unrecognized feature %s", featurestr);
- goto out;
+ object_property_parse(OBJECT(cpu), val, featurestr, errp);
}
} else {
feat2prop(featurestr);
--
1.7.1
- [Qemu-devel] [PATCH qom-cpu-next 00/10 v7] target-i386: convert CPU features into properties, Igor Mammedov, 2013/02/24
- [Qemu-devel] [PATCH 01/10] qdev: add qdev property for bool type, Igor Mammedov, 2013/02/24
- [Qemu-devel] [PATCH 03/10] target-i386: move hyperv_* static globals to CPUState, Igor Mammedov, 2013/02/24
- [Qemu-devel] [PATCH 02/10] target-i386: cpu: convert existing dynamic properties into static properties, Igor Mammedov, 2013/02/24
- [Qemu-devel] [PATCH 07/10] target-i386: convert 'check' and 'enforce' to static properties, Igor Mammedov, 2013/02/24
- [Qemu-devel] [PATCH 05/10] target-i386: convert 'hv_relaxed' to static property, Igor Mammedov, 2013/02/24
- [Qemu-devel] [PATCH 08/10] target-i386: cleanup 'foo' feature handling', Igor Mammedov, 2013/02/24
- [Qemu-devel] [PATCH 04/10] target-i386: convert 'hv_spinlocks' to static property, Igor Mammedov, 2013/02/24
- [Qemu-devel] [PATCH 06/10] target-i386: convert 'hv_vapic' to static property, Igor Mammedov, 2013/02/24
- [Qemu-devel] [PATCH 09/10] target-i386: cleanup 'foo=val' feature handling,
Igor Mammedov <=
- [Qemu-devel] [PATCH 10/10] target-i386: set [+-]feature using static properties, Igor Mammedov, 2013/02/24