diff mbox

[4/4] virt: Set reset-cbar on CPUs

Message ID 1393273442-20736-5-git-send-email-peter.maydell@linaro.org
State Superseded
Headers show

Commit Message

Peter Maydell Feb. 24, 2014, 8:24 p.m. UTC
Set the reset-cbar property on CPUs used by the virt board,
if they have it. This isn't necessary for correct functioning
under Linux (since the A9 isn't a valid CPU for the virt board),
but it is the correct behaviour.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/arm/virt.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Peter Maydell Feb. 26, 2014, 5:05 p.m. UTC | #1
On 25 February 2014 08:23, Peter Crosthwaite
<peter.crosthwaite@xilinx.com> wrote:
> On Tue, Feb 25, 2014 at 6:24 AM, Peter Maydell <peter.maydell@linaro.org> wrote:
>> Set the reset-cbar property on CPUs used by the virt board,
>> if they have it. This isn't necessary for correct functioning
>> under Linux (since the A9 isn't a valid CPU for the virt board),
>> but it is the correct behaviour.
>>
>> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
>> ---
>>  hw/arm/virt.c | 11 +++++++++++
>>  1 file changed, 11 insertions(+)
>>
>> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
>> index 517f2fe..b418b77 100644
>> --- a/hw/arm/virt.c
>> +++ b/hw/arm/virt.c
>> @@ -379,6 +379,7 @@ static void machvirt_init(QEMUMachineInitArgs *args)
>>      for (n = 0; n < smp_cpus; n++) {
>>          ObjectClass *oc = cpu_class_by_name(TYPE_ARM_CPU, cpu_model);
>>          Object *cpuobj;
>> +        Error *err = NULL;
>>
>>          if (!oc) {
>>              fprintf(stderr, "Unable to find CPU definition\n");
>> @@ -390,6 +391,16 @@ static void machvirt_init(QEMUMachineInitArgs *args)
>>          if (n > 0) {
>>              object_property_set_bool(cpuobj, true, "start-powered-off", NULL);
>>          }
>> +
>> +        if (object_property_find(cpuobj, "reset-cbar", NULL)) {
>> +            object_property_set_int(cpuobj, vbi->memmap[VIRT_CPUPERIPHS].base,
>> +                                    "reset-cbar", &err);
>> +            if (err) {
>> +                error_report("%s", error_get_pretty(err));
>> +                exit(1);
>> +            }
>
> If the property exists (as enforced by the if), and you cant set it,
> its probably a fatal and candidate for error_abort.

Yeah. It was rather unclear to me what the right error handling
behaviour for these was.

thanks
-- PMM
diff mbox

Patch

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 517f2fe..b418b77 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -379,6 +379,7 @@  static void machvirt_init(QEMUMachineInitArgs *args)
     for (n = 0; n < smp_cpus; n++) {
         ObjectClass *oc = cpu_class_by_name(TYPE_ARM_CPU, cpu_model);
         Object *cpuobj;
+        Error *err = NULL;
 
         if (!oc) {
             fprintf(stderr, "Unable to find CPU definition\n");
@@ -390,6 +391,16 @@  static void machvirt_init(QEMUMachineInitArgs *args)
         if (n > 0) {
             object_property_set_bool(cpuobj, true, "start-powered-off", NULL);
         }
+
+        if (object_property_find(cpuobj, "reset-cbar", NULL)) {
+            object_property_set_int(cpuobj, vbi->memmap[VIRT_CPUPERIPHS].base,
+                                    "reset-cbar", &err);
+            if (err) {
+                error_report("%s", error_get_pretty(err));
+                exit(1);
+            }
+        }
+
         object_property_set_bool(cpuobj, true, "realized", NULL);
     }
     fdt_add_cpu_nodes(vbi);