Re: [Qemu-devel] [PATCH qom-cpu for-1.4] target-arm: Rename CPU types

2013-01-30 Thread Peter Maydell
On 29 January 2013 12:00, Andreas Färber afaer...@suse.de wrote:
 Am 29.01.2013 12:03, schrieb Peter Maydell:
 I assume you're going to submit this via the qom subtree.

 It applies to master now and is an arm-internal leaf patch. Since you
 have another target-arm.next patch that Blue didn't pick up so far, feel
 free to send a pull for both. But I'm fine taking it through my tree if
 you prefer.

OK, I put it in my target-arm pullreq.

-- PMM



Re: [Qemu-devel] [PATCH qom-cpu for-1.4] target-arm: Rename CPU types

2013-01-29 Thread Peter Maydell
On 27 January 2013 16:30, Andreas Färber afaer...@suse.de wrote:
 In the initial conversion of CPU models to QOM types, model names were
 mapped 1:1 to type names. As a side effect this gained us a type any,
 which is now a device.

 To avoid -device any silliness and to pave the way for compiling
 multiple targets into one executable, adopt a name-arch-cpu scheme.
 This leads to names like arm926-arm-cpu but is easiest to handle.

 No functional changes for -cpu arguments or -cpu ? output.

 Suggested-by: Eduardo Habkost ehabk...@redhat.com
 Signed-off-by: Andreas Färber afaer...@suse.de

Acked-by: Peter Maydell peter.mayd...@linaro.org

I assume you're going to submit this via the qom subtree.

-- PMM



Re: [Qemu-devel] [PATCH qom-cpu for-1.4] target-arm: Rename CPU types

2013-01-29 Thread Andreas Färber
Am 29.01.2013 12:03, schrieb Peter Maydell:
 On 27 January 2013 16:30, Andreas Färber afaer...@suse.de wrote:
 In the initial conversion of CPU models to QOM types, model names were
 mapped 1:1 to type names. As a side effect this gained us a type any,
 which is now a device.

 To avoid -device any silliness and to pave the way for compiling
 multiple targets into one executable, adopt a name-arch-cpu scheme.
 This leads to names like arm926-arm-cpu but is easiest to handle.

 No functional changes for -cpu arguments or -cpu ? output.

 Suggested-by: Eduardo Habkost ehabk...@redhat.com
 Signed-off-by: Andreas Färber afaer...@suse.de
 
 Acked-by: Peter Maydell peter.mayd...@linaro.org

I just re-reviewed this: env-cpu_model_str is set in cpu_arm_init(), so
this patch is good to go (unlike unicore32).

 I assume you're going to submit this via the qom subtree.

It applies to master now and is an arm-internal leaf patch. Since you
have another target-arm.next patch that Blue didn't pick up so far, feel
free to send a pull for both. But I'm fine taking it through my tree if
you prefer.

Thanks,
Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg



[Qemu-devel] [PATCH qom-cpu for-1.4] target-arm: Rename CPU types

2013-01-27 Thread Andreas Färber
In the initial conversion of CPU models to QOM types, model names were
mapped 1:1 to type names. As a side effect this gained us a type any,
which is now a device.

To avoid -device any silliness and to pave the way for compiling
multiple targets into one executable, adopt a name-arch-cpu scheme.
This leads to names like arm926-arm-cpu but is easiest to handle.

No functional changes for -cpu arguments or -cpu ? output.

Suggested-by: Eduardo Habkost ehabk...@redhat.com
Signed-off-by: Andreas Färber afaer...@suse.de
---
 target-arm/cpu.c|8 ++--
 target-arm/helper.c |   11 ---
 2 Dateien geändert, 14 Zeilen hinzugefügt(+), 5 Zeilen entfernt(-)

diff --git a/target-arm/cpu.c b/target-arm/cpu.c
index d1a4c82..1c6a628 100644
--- a/target-arm/cpu.c
+++ b/target-arm/cpu.c
@@ -204,12 +204,15 @@ void arm_cpu_realize(ARMCPU *cpu)
 static ObjectClass *arm_cpu_class_by_name(const char *cpu_model)
 {
 ObjectClass *oc;
+char *typename;
 
 if (!cpu_model) {
 return NULL;
 }
 
-oc = object_class_by_name(cpu_model);
+typename = g_strdup_printf(%s- TYPE_ARM_CPU, cpu_model);
+oc = object_class_by_name(typename);
+g_free(typename);
 if (!oc || !object_class_dynamic_cast(oc, TYPE_ARM_CPU) ||
 object_class_is_abstract(oc)) {
 return NULL;
@@ -789,14 +792,15 @@ static void arm_cpu_class_init(ObjectClass *oc, void 
*data)
 static void cpu_register(const ARMCPUInfo *info)
 {
 TypeInfo type_info = {
-.name = info-name,
 .parent = TYPE_ARM_CPU,
 .instance_size = sizeof(ARMCPU),
 .instance_init = info-initfn,
 .class_size = sizeof(ARMCPUClass),
 };
 
+type_info.name = g_strdup_printf(%s- TYPE_ARM_CPU, info-name);
 type_register(type_info);
+g_free((void *)type_info.name);
 }
 
 static const TypeInfo arm_cpu_type_info = {
diff --git a/target-arm/helper.c b/target-arm/helper.c
index 7a10fdd..eb7b291 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -1303,9 +1303,9 @@ static gint arm_cpu_list_compare(gconstpointer a, 
gconstpointer b)
 
 name_a = object_class_get_name(class_a);
 name_b = object_class_get_name(class_b);
-if (strcmp(name_a, any) == 0) {
+if (strcmp(name_a, any- TYPE_ARM_CPU) == 0) {
 return 1;
-} else if (strcmp(name_b, any) == 0) {
+} else if (strcmp(name_b, any- TYPE_ARM_CPU) == 0) {
 return -1;
 } else {
 return strcmp(name_a, name_b);
@@ -1316,9 +1316,14 @@ static void arm_cpu_list_entry(gpointer data, gpointer 
user_data)
 {
 ObjectClass *oc = data;
 CPUListState *s = user_data;
+const char *typename;
+char *name;
 
+typename = object_class_get_name(oc);
+name = g_strndup(typename, strlen(typename) - strlen(- TYPE_ARM_CPU));
 (*s-cpu_fprintf)(s-file,   %s\n,
-  object_class_get_name(oc));
+  name);
+g_free(name);
 }
 
 void arm_cpu_list(FILE *f, fprintf_function cpu_fprintf)
-- 
1.7.10.4