[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 12/29] target-i386: Introduce feat2prop() for CPU pr
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [PATCH 12/29] target-i386: Introduce feat2prop() for CPU properties |
Date: |
Thu, 2 May 2013 15:35:38 +0200 |
From: Igor Mammedov <address@hidden>
This helper replaces '_' with '-' in a uniform way.
As a side effect, even custom mappings must use '-' now.
Signed-off-by: Igor Mammedov <address@hidden>
[AF: Split off; operate on NUL-terminated string rather than '=' delimiter]
Signed-off-by: Andreas Färber <address@hidden>
---
target-i386/cpu.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index f34ba23..697848d 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1307,6 +1307,16 @@ static int cpu_x86_find_by_name(x86_def_t *x86_cpu_def,
const char *name)
return -1;
}
+/* Convert all '_' in a feature string option name to '-', to make feature
+ * name conform to QOM property naming rule, which uses '-' instead of '_'.
+ */
+static inline void feat2prop(char *s)
+{
+ while ((s = strchr(s, '_'))) {
+ *s = '-';
+ }
+}
+
/* Parse "+feature,-feature,feature=foo" CPU feature string
*/
static void cpu_x86_parse_featurestr(X86CPU *cpu, char *features, Error **errp)
@@ -1329,6 +1339,7 @@ static void cpu_x86_parse_featurestr(X86CPU *cpu, char
*features, Error **errp)
add_flagname_to_bitmaps(featurestr + 1, minus_features);
} else if ((val = strchr(featurestr, '='))) {
*val = 0; val++;
+ feat2prop(featurestr);
if (!strcmp(featurestr, "family")) {
object_property_parse(OBJECT(cpu), val, featurestr, errp);
} else if (!strcmp(featurestr, "model")) {
@@ -1355,9 +1366,9 @@ static void cpu_x86_parse_featurestr(X86CPU *cpu, char
*features, Error **errp)
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, "model-id", errp);
- } else if (!strcmp(featurestr, "tsc_freq")) {
+ } 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;
char num[32];
@@ -1370,7 +1381,7 @@ static void cpu_x86_parse_featurestr(X86CPU *cpu, char
*features, Error **errp)
}
snprintf(num, sizeof(num), "%" PRId64, tsc_freq);
object_property_parse(OBJECT(cpu), num, "tsc-frequency", errp);
- } else if (!strcmp(featurestr, "hv_spinlocks")) {
+ } else if (!strcmp(featurestr, "hv-spinlocks")) {
char *err;
numvalue = strtoul(val, &err, 0);
if (!*val || *err) {
--
1.8.1.4
- [Qemu-devel] [PULL for-1.5 00/29] QOM CPUState patch queue 2013-05-02, Andreas Färber, 2013/05/02
- [Qemu-devel] [PATCH 02/29] cpu: Call cpu_synchronize_post_init() from DeviceClass::realize(), Andreas Färber, 2013/05/02
- [Qemu-devel] [PATCH 01/29] cpu: Make kvm-stub.o available outside softmmu, Andreas Färber, 2013/05/02
- [Qemu-devel] [PATCH 10/29] cpu: Add helper cpu_exists(), to check if CPU with specified id exists, Andreas Färber, 2013/05/02
- [Qemu-devel] [PATCH 12/29] target-i386: Introduce feat2prop() for CPU properties,
Andreas Färber <=
- [Qemu-devel] [PATCH 13/29] target-i386: Introduce apic-id CPU property, Andreas Färber, 2013/05/02
- [Qemu-devel] [PATCH 05/29] cpu: Introduce CPU hot-plug notifier, Andreas Färber, 2013/05/02
- [Qemu-devel] [PATCH 09/29] cpus: Use qemu_for_each_cpu() in TCG thread, Andreas Färber, 2013/05/02
- [Qemu-devel] [PATCH 04/29] cpu: Resume CPU from DeviceClass::realize() if hot-plugged, Andreas Färber, 2013/05/02
- [Qemu-devel] [PATCH 08/29] cpu: Add qemu_for_each_cpu(), Andreas Färber, 2013/05/02
- [Qemu-devel] [PATCH 21/29] Add hot_add_cpu hook to QEMUMachine, Andreas Färber, 2013/05/02
- [Qemu-devel] [PATCH 14/29] target-i386: Do not allow to set apic-id once CPU is realized, Andreas Färber, 2013/05/02
- [Qemu-devel] [PATCH 03/29] cpu: Introduce cpu_resume(), for single CPU, Andreas Färber, 2013/05/02
- [Qemu-devel] [PATCH 11/29] acpi_piix4: Add infrastructure to send CPU hot-plug GPE to guest, Andreas Färber, 2013/05/02
- [Qemu-devel] [PATCH 06/29] pc: Update rtc_cmos on CPU hot-plug, Andreas Färber, 2013/05/02