target-arm: Move reset handling to arm_cpu_reset
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Am 14.04.2012 18:42, schrieb Peter Maydell:
Quoted 9 lines
Now that
cpu_reset_model_id()has gone we can move the reset code over to the class reset function and havecpu_state_resetsimply do a reset on the CPU QOM object.Signed-off-by Peter Maydell <[email protected]>--- target-arm/cpu.c | 94 +++++++++++++++++++++++++++++++++++++++++++++++-- target-arm/helper.c | 97 +-------------------------------------------------- 2 files changed, 92 insertions(+), 99 deletions(-)
This forgot to update helper.c:cpu_arm_init() by calling cpu_reset().
I'll fix in my cross-target CPUState series.
Andreas
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [Qemu-devel] [PATCH v2 01/14] target-arm: Add QOM subclasses for each ARM cpu implementation
Sorry for replying to a patch 7 months later, but I just have a question related to how we will handle CPU model classes on all targets:
Quoted 22 lines · Peter Maydell
Register subclasses for each ARM CPU implementation (with the exception of "pxa270", which is an alias for "pxa270-a0").
Let
arm_cpu_list()enumerate CPU subclasses in alphabetical order, except for special value "any".Replace cpu_arm_find_by_name()'s string -> CPUID lookup by storing the CPUID (aka MIDR, Main ID Register) value in the class.
Signed-off-by Andreas Färber <[email protected]>Signed-off-by Peter Maydell <[email protected]>--- target-arm/cpu-qom.h | 12 +++ target-arm/cpu.c | 226 +++++++++++++++++++++++++++++++++++++++++++++++++- target-arm/helper.c | 109 ++++++++++-------------- 3 files changed, 282 insertions(+), 65 deletions(-)target-arm/cpu-qom.h +0
-0@@ -58,6 +58,18 @@ typedef struct ARMCPU {
[...]
Quoted 6 lines
target-arm/cpu-qom.h +6
-0+typedef struct ARMCPUInfo { +const char *name; +void (*initfn)(Object *obj); +}ARMCPUInfo ; + +static const ARMCPUInfo arm_cpus[] = {
[...]
target-arm/cpu-qom.h
Quoted 3 lines
target-arm/cpu-qom.h +3
-0+ { .name = "any", .initfn = arm_any_initfn }, +}; +
Do we really want to use "any" as the class name? Maybe we should use "cpu-<model>" as the namespace for the CPU model class names? Or maybe try "cpu-<model>" first, and then "<model>" as a fallback (making sure that the class we found is a subclass of TYPE_<arch>_CPU).
I guess we will want address this before qdevifying the CPU class, as the qdevification will make the CPU class names visible through the monitor.
Quoted 42 lines
static void
arm_cpu_class_init(ObjectClass *oc, void *data){ ARMCPUClass *acc = ARM_CPU_CLASS(oc);target-arm/cpu-qom.h +20
-1@@ -43,18 +248,37 @@ static void arm_cpu_class_init(ObjectClass *oc, void *data) cc->reset = arm_cpu_reset; } +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_register_static (&type_info); +} +static const TypeInfo arm_cpu_type_info = { .name =TYPE_ARM_CPU , .parent =TYPE_CPU , .instance_size =sizeof (ARMCPU ), - .abstract = false, + .instance_init = arm_cpu_initfn, + .abstract = true, .class_size =sizeof (ARMCPUClass), .class_init = arm_cpu_class_init, };static void arm_cpu_register_types (void ) { +int i; +type_register_static (&arm_cpu_type_info); +for (i =0 ; i <ARRAY_SIZE (arm_cpus); i++) { +cpu_register (&arm_cpus[i]); + } }type_init (arm_cpu_register_types)
Signature · 1 line
Eduardo
Re: [Qemu-devel] [PATCH v2 01/14] target-arm: Add QOM subclasses for each ARM cpu implementation
Quoted 35 lines · Eduardo Habkost
Sorry for replying to a patch 7 months later, but I just have a question related to how we will handle CPU model classes on all targets:
Quoted 22 lines · Peter Maydell
Register subclasses for each ARM CPU implementation (with the exception of "pxa270", which is an alias for "pxa270-a0").
Let
arm_cpu_list()enumerate CPU subclasses in alphabetical order, except for special value "any".Replace cpu_arm_find_by_name()'s string -> CPUID lookup by storing the CPUID (aka MIDR, Main ID Register) value in the class.
Signed-off-by Andreas Färber <[email protected]>Signed-off-by Peter Maydell <[email protected]>--- target-arm/cpu-qom.h | 12 +++ target-arm/cpu.c | 226 +++++++++++++++++++++++++++++++++++++++++++++++++- target-arm/helper.c | 109 ++++++++++-------------- 3 files changed, 282 insertions(+), 65 deletions(-)target-arm/cpu-qom.h +0
-0@@ -58,6 +58,18 @@ typedef struct ARMCPU {[...]
Quoted 6 lines
target-arm/cpu-qom.h +6
-0+typedef struct ARMCPUInfo { +const char *name; +void (*initfn)(Object *obj); +}ARMCPUInfo ; + +static const ARMCPUInfo arm_cpus[] = {[...]
Quoted 5 lines
target-arm/cpu-qom.h
Quoted 3 lines
target-arm/cpu-qom.h +3
-0+ { .name = "any", .initfn = arm_any_initfn }, +}; +Do we really want to use "any" as the class name?
Probably not, since it would make it tricky to (in some future utopia) have a QEMU which supported more than one CPU architecture in the same binary if they all wanted to use "any"...
Quoted 2 lines
Maybe we should use
"cpu-<model>" as the namespace for the CPU model class names?
Sounds reasonable.
-- PMM
Re: [Qemu-devel] [PATCH v2 01/14] target-arm: Add QOM subclasses for each ARM cpu implementation
Quoted 42 lines · Peter Maydell
Quoted 35 lines · Eduardo Habkost
Sorry for replying to a patch 7 months later, but I just have a question related to how we will handle CPU model classes on all targets:
Quoted 22 lines · Peter Maydell
Register subclasses for each ARM CPU implementation (with the exception of "pxa270", which is an alias for "pxa270-a0").
Let
arm_cpu_list()enumerate CPU subclasses in alphabetical order, except for special value "any".Replace cpu_arm_find_by_name()'s string -> CPUID lookup by storing the CPUID (aka MIDR, Main ID Register) value in the class.
Signed-off-by Andreas Färber <[email protected]>Signed-off-by Peter Maydell <[email protected]>--- target-arm/cpu-qom.h | 12 +++ target-arm/cpu.c | 226 +++++++++++++++++++++++++++++++++++++++++++++++++- target-arm/helper.c | 109 ++++++++++-------------- 3 files changed, 282 insertions(+), 65 deletions(-)target-arm/cpu-qom.h +0
-0@@ -58,6 +58,18 @@ typedef struct ARMCPU {[...]
Quoted 6 lines
target-arm/cpu-qom.h +6
-0+typedef struct ARMCPUInfo { +const char *name; +void (*initfn)(Object *obj); +}ARMCPUInfo ; + +static const ARMCPUInfo arm_cpus[] = {[...]
Quoted 5 lines
target-arm/cpu-qom.h
Quoted 3 lines
target-arm/cpu-qom.h +3
-0+ { .name = "any", .initfn = arm_any_initfn }, +}; +Do we really want to use "any" as the class name?
Quoted 3 lines
Probably not, since it would make it tricky to (in some future utopia) have a QEMU which supported more than one CPU architecture in the same binary if they all wanted to use "any"...
In that case, "cpu-any" wouldn't work, either. What about "<arch>-cpu-<model>"?
Quoted 7 lines
Quoted 3 lines
Maybe we should use
"cpu-<model>" as the namespace for the CPU model class names?Sounds reasonable.
-- PMM
Signature · 1 line
Eduardo
Re: [Qemu-devel] [PATCH v2 01/14] target-arm: Add QOM subclasses for each ARM cpu implementation
Am 12.11.2012 23:33, schrieb Eduardo Habkost:
Quoted 11 lines · Peter Maydell
Quoted 10 lines · Eduardo Habkost
Quoted 8 lines · Peter Maydell
Quoted 1 line
+static const ARMCPUInfo arm_cpus[] = {
[...]
Review
Quoted 3 lines
(quoted diff) +3
-0+ { .name = "any", .initfn = arm_any_initfn }, +}; +Do we really want to use "any" as the class name?
Quoted 6 lines
Quoted 3 lines
Probably not, since it would make it tricky to (in some future utopia) have a QEMU which supported more than one CPU architecture in the same binary if they all wanted to use "any"...
In that case, "cpu-any" wouldn't work, either. What about "<arch>-cpu-<model>"?
Fine with me. However, keep in mind the previous approach was used for command line compatibility: I would like to continue using -cpu cortex-a9 rather than -cpu arm-cpu-cortex-a9. :)
If we introduce a more complex command-line-to-class mapping, can't we drop these ominous "any" CPUs altogether? For my understanding they were used as wildcard CPUs for *-user. We could do the same by instantiating a real CPU like "cortex-a15" and possibly enabling some additional features afterwards.
Andreas
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
Maybe we should use
"cpu-<model>" as the namespace for the CPU model class names?Sounds reasonable.
-- PMM
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Re: [Qemu-devel] [PATCH v2 01/14] target-arm: Add QOM subclasses for each ARM cpu implementation
Quoted 7 lines · Andreas Färber
Am 12.11.2012 23:33, schrieb Eduardo Habkost:
Quoted 2 lines
In that case, "cpu-any" wouldn't work, either. What about "<arch>-cpu-<model>"?
Fine with me. However, keep in mind the previous approach was used for command line compatibility: I would like to continue using -cpu cortex-a9 rather than -cpu arm-cpu-cortex-a9. :)
Yes, we need to maintain the command line names as-is.
Quoted 5 lines
If we introduce a more complex command-line-to-class mapping, can't we drop these ominous "any" CPUs altogether? For my understanding they were used as wildcard CPUs for *-user. We could do the same by instantiating a real CPU like "cortex-a15" and possibly enabling some additional features afterwards.
I don't see what that gains us. The easiest way to say "it's a cpu with all the feature bits turned on" is to define it as a cpu with all the feature bits turned on :-)
-- PMM
Re: [Qemu-devel] [PATCH v2 01/14] target-arm: Add QOM subclasses for each ARM cpu implementation
Quoted 10 lines · Peter Maydell
Quoted 7 lines · Andreas Färber
Am 12.11.2012 23:33, schrieb Eduardo Habkost:
Quoted 2 lines
In that case, "cpu-any" wouldn't work, either. What about "<arch>-cpu-<model>"?
Fine with me. However, keep in mind the previous approach was used for command line compatibility: I would like to continue using -cpu cortex-a9 rather than -cpu arm-cpu-cortex-a9. :)
Yes, we need to maintain the command line names as-is.
ACK.
Quoted 10 lines
Quoted 6 lines
If we introduce a more complex command-line-to-class mapping, can't we drop these ominous "any" CPUs altogether? For my understanding they were used as wildcard CPUs for *-user. We could do the same by instantiating a real CPU like "cortex-a15" and possibly enabling some additional features afterwards.
I don't see what that gains us. The easiest way to say "it's a cpu with all the feature bits turned on" is to define it as a cpu with all the feature bits turned on :-)
This sounds similar to "-cpu host" on x86. The difference is that on x86 with KVM, we depend on host capabilities to know which features can be enabled (so on x86 it's not "a cpu with all the feature bits turned on", but "a cpu with all the feature bits _we can safely enable_ turned on").
Quoted 2 lines
-- PMM
Signature · 1 line
Eduardo
Re: [Qemu-devel] [PATCH v2 01/14] target-arm: Add QOM subclasses for each ARM cpu implementation
In reply to Andreas FärberQuoted 16 lines · Andreas Färber
Am 12.11.2012 23:33, schrieb Eduardo Habkost:
Quoted 15 lines · Peter Maydell
Quoted 13 lines · Eduardo Habkost
Quoted 8 lines · Peter Maydell
Quoted 1 line
+static const ARMCPUInfo arm_cpus[] = {
[...]
Review
Quoted 3 lines
(quoted diff) +3
-0+ { .name = "any", .initfn = arm_any_initfn }, +}; +Do we really want to use "any" as the class name?
Probably not, since it would make it tricky to (in some future utopia) have a QEMU which supported more than one CPU architecture in the same binary if they all wanted to use "any"...
Quoted 6 lines
Quoted 2 lines
In that case, "cpu-any" wouldn't work, either. What about "<arch>-cpu-<model>"?
Fine with me. However, keep in mind the previous approach was used for command line compatibility: I would like to continue using -cpu cortex-a9 rather than -cpu arm-cpu-cortex-a9. :)
Me too. We need keep "-cpu SandyBridge" working, instead of requiring "-cpu x86_64-cpu-SandyBridge".
"-cpu FOO" could first try a class named "<arch>-cpu-FOO" (for compatibility), then fallback to "FOO".
Quoted 6 lines
If we introduce a more complex command-line-to-class mapping, can't we drop these ominous "any" CPUs altogether? For my understanding they were used as wildcard CPUs for *-user. We could do the same by instantiating a real CPU like "cortex-a15" and possibly enabling some additional features afterwards.
I didn't look so deeply at the code, to understand what "any" does, and why it exists. But whatever we do, I suppose we need to keep "-cpu any" working, for compatibility.
Quoted 13 lines
Andreas
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
Maybe we should use
"cpu-<model>" as the namespace for the CPU model class names?Sounds reasonable.
-- PMM
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Signature · 1 line
Eduardo