A15 board bugfixes
cover A15 board bugfixes
This patchset fixes a couple of issues with A15 boards.
The first is a really obvious one -- running QEMU with '-M midway -cpu bang' segfaults.
The second one is a problem with running an A15 board model under KVM with "-cpu host": since the 'host' CPU object doesn't have a 'reset-cbar' QOM property we need to quietly continue in that case rather than failing. (Ideally we'd support lying to the guest about its CPU in the kernel, and then we could just say "-cpu host only makes sense for the virt machine", but we're not there right now.)
Peter Maydell (2):
hw/arm/highbank: Don't segfault on unknown CPU names hw/arm/vexpress, hw/arm/highbank: Don't insist that CPU has reset-cbar
property
hw/arm/highbank.c | 19 ++++++++++++------- hw/arm/vexpress.c | 7 +++---- 2 files changed, 15 insertions(+), 11 deletions(-)
Signature · 1 line
1.9.0
PATCH 1/2 hw/arm/highbank: Don't segfault on unknown CPU names
If the user passes an unknown CPU name via the '-cpu' option, exit with an error message rather than segfaulting.
--- hw/arm/highbank.c | 5 +++++ 1 file changed, 5 insertions(+)
hw/arm/highbank.c +5 -0
@@ -233,6 +233,11 @@ static void calxeda_init(QEMUMachineInitArgs *args, enum cxmachines machine)ARMCPU *cpu;Error *err =NULL ; +if (!oc) { +fprintf (stderr,"Unable to find CPU definition\n" ); +exit (1 ); + } + cpu =ARM_CPU (object_new (object_class_get_name (oc))); object_property_set_int(OBJECT(cpu), MPCORE_PERIPHBASE, "reset-cbar",
Signature · 1 line
1.9.0
Re: [Qemu-devel] [for-2.0 1/2] hw/arm/highbank: Don't segfault on unknown CPU names
Am 03.04.2014 15:56, schrieb Peter Maydell:
Quoted 13 lines
If the user passes an unknown CPU name via the '-cpu' option, exit with an error message rather than segfaulting.
Signed-off-by Peter Maydell <[email protected]>--- hw/arm/highbank.c | 5 +++++ 1 file changed, 5 insertions(+)hw/arm/highbank.c +0
-0
hw/arm/highbank.c static void calxeda_init(QEMUMachineInitArgs *args, enum cxmachines machine) · line 237
Quoted 5 lines
hw/arm/highbank.c +2
-0@@ -233,6 +233,11 @@ static void calxeda_init(QEMUMachineInitArgs *args, enum cxmachines machine)ARMCPU *cpu;Error *err =NULL ; +if (!oc) { +fprintf (stderr,"Unable to find CPU definition\n" );
Old habits die hard... error_report() please.
Otherwise looks good.
One side effect of the cpu_arm_init() inlining here is that it didn't get the properties support for -cpu, I note.
Regards,
Andreas
Quoted 7 lines
hw/arm/highbank.c +3
-0+exit (1 ); + } + cpu =ARM_CPU (object_new (object_class_get_name (oc))); object_property_set_int(OBJECT(cpu), MPCORE_PERIPHBASE, "reset-cbar",
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
PATCH 2/2 hw/arm/vexpress, hw/arm/highbank: Don't insist that CPU has reset-cbar property
In reply to Peter MaydellFor the machine models which can have a Cortex-A15 CPU (vexpress-a15 and midway), silently continue if the CPU object has no reset-cbar property rather than failing. This allows these boards to be used under KVM with the "-cpu host" option, since the 'host' CPU object has no reset-cbar property.
--- hw/arm/highbank.c | 14 +++++++------- hw/arm/vexpress.c | 7 +++---- 2 files changed, 10 insertions(+), 11 deletions(-)
hw/arm/highbank.c +7 -7
@@ -230,6 +230,7 @@ static void calxeda_init(QEMUMachineInitArgs *args, enum cxmachines machine)for (n =0 ; n < smp_cpus; n++) {ObjectClass *oc =cpu_class_by_name (TYPE_ARM_CPU , cpu_model); +Object *cpuobj;ARMCPU *cpu;Error *err =NULL ;
@@ -238,15 +239,14 @@ static void calxeda_init(QEMUMachineInitArgs *args, enum cxmachines machine)exit (1 ); } - cpu =ARM_CPU (object_new (object_class_get_name (oc))); + cpuobj =object_new (object_class_get_name (oc)); + cpu =ARM_CPU (cpuobj); -object_property_set_int (OBJECT (cpu),MPCORE_PERIPHBASE ,"reset-cbar" , - &err); -if (err) { -error_report ("%s" ,error_get_pretty (err)); -exit (1 ); +if (object_property_find (cpuobj,"reset-cbar" ,NULL )) { +object_property_set_int (cpuobj,MPCORE_PERIPHBASE , +"reset-cbar" , &error_abort); } -object_property_set_bool (OBJECT (cpu), true,"realized" , &err); +object_property_set_bool (cpuobj, true,"realized" , &err);if (err) {error_report ("%s" ,error_get_pretty (err));exit (1 );
hw/arm/vexpress.c +3 -4
@@ -192,10 +192,9 @@ static void init_cpus(const char *cpu_model, const char *privdev,Object *cpuobj =object_new (object_class_get_name (cpu_oc));Error *err =NULL ; -object_property_set_int (cpuobj, periphbase,"reset-cbar" , &err); -if (err) { -error_report ("%s" ,error_get_pretty (err)); -exit (1 ); +if (object_property_find (cpuobj,"reset-cbar" ,NULL )) { +object_property_set_int (cpuobj, periphbase, +"reset-cbar" , &error_abort); }object_property_set_bool (cpuobj, true,"realized" , &err);if (err) {
Signature · 1 line
1.9.0
Quoted 13 lines · Peter Maydell
This patchset fixes a couple of issues with A15 boards.
The first is a really obvious one -- running QEMU with '-M midway -cpu bang' segfaults.
The second one is a problem with running an A15 board model under KVM with "-cpu host": since the 'host' CPU object doesn't have a 'reset-cbar' QOM property we need to quietly continue in that case rather than failing. (Ideally we'd support lying to the guest about its CPU in the kernel, and then we could just say "-cpu host only makes sense for the virt machine", but we're not there right now.)
Quoted 4 lines
Peter Maydell (2):
hw/arm/highbank: Don't segfault on unknown CPU names hw/arm/vexpress, hw/arm/highbank: Don't insist that CPU has reset-cbar
property
For both: