All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH arm-midr v1 0/2] ARM-MIDR Make ARM-MIDR a property and use in Zynq
@ 2014-01-12 23:33 Alistair Francis
  2014-01-12 23:33 ` [Qemu-devel] [PATCH arm-midr v1 1/2] ARM: Convert MIDR to a property Alistair Francis
  2014-01-12 23:33 ` [Qemu-devel] [PATCH arm-midr v1 2/2] ZYNQ: Implement board MIDR control for Zynq Alistair Francis
  0 siblings, 2 replies; 5+ messages in thread
From: Alistair Francis @ 2014-01-12 23:33 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, peter.crosthwaite, afaerber


This series converts cpu->midr (the MIDR register) to a property.
This allows it to be set after init which is useful for specific
boards (such as Zynq). The change has been done in such a way that
it doesn't break compatibility with boards that don't need a
custom MIDR.


Alistair Francis (2):
  ARM: Convert MIDR to a property
  ZYNQ: Implement board MIDR control for Zynq

 hw/arm/xilinx_zynq.c |    7 +++++++
 target-arm/cpu.c     |   17 +++++++++++++++++
 2 files changed, 24 insertions(+), 0 deletions(-)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PATCH arm-midr v1 1/2] ARM: Convert MIDR to a property
  2014-01-12 23:33 [Qemu-devel] [PATCH arm-midr v1 0/2] ARM-MIDR Make ARM-MIDR a property and use in Zynq Alistair Francis
@ 2014-01-12 23:33 ` Alistair Francis
  2014-01-12 23:54   ` Andreas Färber
  2014-01-12 23:33 ` [Qemu-devel] [PATCH arm-midr v1 2/2] ZYNQ: Implement board MIDR control for Zynq Alistair Francis
  1 sibling, 1 reply; 5+ messages in thread
From: Alistair Francis @ 2014-01-12 23:33 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, peter.crosthwaite, afaerber

Convert the MIDR register to a property. This allows boards to later set
a custom MIDR value. This has been done in such a way to maintain
compatibility with all existing CPUs and boards

Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
---
I added the properties to the cpu->midr variable in a similar method to
how Peter Crosthwaite did in his 'Fix Support for ARM CBAR and
reset-hivecs' series.

 target-arm/cpu.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/target-arm/cpu.c b/target-arm/cpu.c
index 408d207..bf625b0 100644
--- a/target-arm/cpu.c
+++ b/target-arm/cpu.c
@@ -249,10 +249,14 @@ static Property arm_cpu_reset_cbar_property =
 static Property arm_cpu_reset_hivecs_property =
             DEFINE_PROP_BOOL("reset-hivecs", ARMCPU, reset_hivecs, false);
 
+static Property arm_cpu_midr_property =
+            DEFINE_PROP_UINT32("midr", ARMCPU, midr, 0);
+
 static void arm_cpu_post_init(Object *obj)
 {
     ARMCPU *cpu = ARM_CPU(obj);
     Error *err = NULL;
+    uint32_t temp = cpu->midr;
 
     if (arm_feature(&cpu->env, ARM_FEATURE_CBAR)) {
         qdev_property_add_static(DEVICE(obj), &arm_cpu_reset_cbar_property,
@@ -265,6 +269,19 @@ static void arm_cpu_post_init(Object *obj)
                                  &err);
         assert_no_error(err);
     }
+
+    /*
+     * Initialise the midr property and set it to the original CPU MIDR
+     * This is used to maintain compatibility with boards that don't set
+     * a custom MIDR
+     */
+    qdev_property_add_static(DEVICE(obj), &arm_cpu_midr_property, &err);
+    assert_no_error(err);
+    object_property_set_int(OBJECT(cpu), temp, "midr", &err);
+    if (err) {
+        error_report("%s", error_get_pretty(err));
+        exit(1);
+    }
 }
 
 static void arm_cpu_finalizefn(Object *obj)
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PATCH arm-midr v1 2/2] ZYNQ: Implement board MIDR control for Zynq
  2014-01-12 23:33 [Qemu-devel] [PATCH arm-midr v1 0/2] ARM-MIDR Make ARM-MIDR a property and use in Zynq Alistair Francis
  2014-01-12 23:33 ` [Qemu-devel] [PATCH arm-midr v1 1/2] ARM: Convert MIDR to a property Alistair Francis
@ 2014-01-12 23:33 ` Alistair Francis
  1 sibling, 0 replies; 5+ messages in thread
From: Alistair Francis @ 2014-01-12 23:33 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, peter.crosthwaite, afaerber

This patch uses the fact that the midr variable is now a property
This patch sets the midr variable to the boards custom midr

Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
---

 hw/arm/xilinx_zynq.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c
index 17251c7..e35fd07 100644
--- a/hw/arm/xilinx_zynq.c
+++ b/hw/arm/xilinx_zynq.c
@@ -37,6 +37,7 @@
 #define IRQ_OFFSET 32 /* pic interrupts start from index 32 */
 
 #define MPCORE_PERIPHBASE 0xF8F00000
+#define ZYNQ_BOARD_MIDR 0x413FC090
 
 static const int dma_irqs[8] = {
     46, 47, 48, 49, 72, 73, 74, 75
@@ -129,6 +130,12 @@ static void zynq_init(QEMUMachineInitArgs *args)
         error_report("%s", error_get_pretty(err));
         exit(1);
     }
+
+    object_property_set_int(OBJECT(cpu), ZYNQ_BOARD_MIDR, "midr", &err);
+    if (err) {
+        error_report("%s", error_get_pretty(err));
+        exit(1);
+    }
     object_property_set_bool(OBJECT(cpu), true, "realized", &err);
     if (err) {
         error_report("%s", error_get_pretty(err));
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH arm-midr v1 1/2] ARM: Convert MIDR to a property
  2014-01-12 23:33 ` [Qemu-devel] [PATCH arm-midr v1 1/2] ARM: Convert MIDR to a property Alistair Francis
@ 2014-01-12 23:54   ` Andreas Färber
  2014-01-13  0:03     ` Peter Crosthwaite
  0 siblings, 1 reply; 5+ messages in thread
From: Andreas Färber @ 2014-01-12 23:54 UTC (permalink / raw)
  To: Alistair Francis, qemu-devel; +Cc: peter.maydell, peter.crosthwaite

Am 13.01.2014 00:33, schrieb Alistair Francis:
> Convert the MIDR register to a property. This allows boards to later set
> a custom MIDR value. This has been done in such a way to maintain
> compatibility with all existing CPUs and boards
> 
> Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
> ---
> I added the properties to the cpu->midr variable in a similar method to
> how Peter Crosthwaite did in his 'Fix Support for ARM CBAR and
> reset-hivecs' series.
> 
>  target-arm/cpu.c |   17 +++++++++++++++++
>  1 files changed, 17 insertions(+), 0 deletions(-)
> 
> diff --git a/target-arm/cpu.c b/target-arm/cpu.c
> index 408d207..bf625b0 100644
> --- a/target-arm/cpu.c
> +++ b/target-arm/cpu.c
> @@ -249,10 +249,14 @@ static Property arm_cpu_reset_cbar_property =
>  static Property arm_cpu_reset_hivecs_property =
>              DEFINE_PROP_BOOL("reset-hivecs", ARMCPU, reset_hivecs, false);
>  
> +static Property arm_cpu_midr_property =
> +            DEFINE_PROP_UINT32("midr", ARMCPU, midr, 0);
> +
>  static void arm_cpu_post_init(Object *obj)
>  {
>      ARMCPU *cpu = ARM_CPU(obj);
>      Error *err = NULL;
> +    uint32_t temp = cpu->midr;
>  
>      if (arm_feature(&cpu->env, ARM_FEATURE_CBAR)) {
>          qdev_property_add_static(DEVICE(obj), &arm_cpu_reset_cbar_property,
> @@ -265,6 +269,19 @@ static void arm_cpu_post_init(Object *obj)
>                                   &err);
>          assert_no_error(err);
>      }
> +
> +    /*
> +     * Initialise the midr property and set it to the original CPU MIDR
> +     * This is used to maintain compatibility with boards that don't set
> +     * a custom MIDR
> +     */
> +    qdev_property_add_static(DEVICE(obj), &arm_cpu_midr_property, &err);

This looks wrong to me. Use dc->props to add properties that are always
present. Any qdev_* functions shouldn't spread further than necessary.

> +    assert_no_error(err);

Further, this seems to conflict with Peter C.'s work of introducing
error_abort.

Andreas

> +    object_property_set_int(OBJECT(cpu), temp, "midr", &err);
> +    if (err) {
> +        error_report("%s", error_get_pretty(err));
> +        exit(1);
> +    }
>  }
>  
>  static void arm_cpu_finalizefn(Object *obj)
> 


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH arm-midr v1 1/2] ARM: Convert MIDR to a property
  2014-01-12 23:54   ` Andreas Färber
@ 2014-01-13  0:03     ` Peter Crosthwaite
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Crosthwaite @ 2014-01-13  0:03 UTC (permalink / raw)
  To: Andreas Färber, Anthony Liguori, Luiz Capitulino
  Cc: Peter Maydell, qemu-devel@nongnu.org Developers, Alistair Francis

On Mon, Jan 13, 2014 at 9:54 AM, Andreas Färber <afaerber@suse.de> wrote:
> Am 13.01.2014 00:33, schrieb Alistair Francis:
>> Convert the MIDR register to a property. This allows boards to later set
>> a custom MIDR value. This has been done in such a way to maintain
>> compatibility with all existing CPUs and boards
>>
>> Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
>> ---
>> I added the properties to the cpu->midr variable in a similar method to
>> how Peter Crosthwaite did in his 'Fix Support for ARM CBAR and
>> reset-hivecs' series.
>>
>>  target-arm/cpu.c |   17 +++++++++++++++++
>>  1 files changed, 17 insertions(+), 0 deletions(-)
>>
>> diff --git a/target-arm/cpu.c b/target-arm/cpu.c
>> index 408d207..bf625b0 100644
>> --- a/target-arm/cpu.c
>> +++ b/target-arm/cpu.c
>> @@ -249,10 +249,14 @@ static Property arm_cpu_reset_cbar_property =
>>  static Property arm_cpu_reset_hivecs_property =
>>              DEFINE_PROP_BOOL("reset-hivecs", ARMCPU, reset_hivecs, false);
>>
>> +static Property arm_cpu_midr_property =
>> +            DEFINE_PROP_UINT32("midr", ARMCPU, midr, 0);
>> +
>>  static void arm_cpu_post_init(Object *obj)
>>  {
>>      ARMCPU *cpu = ARM_CPU(obj);
>>      Error *err = NULL;
>> +    uint32_t temp = cpu->midr;
>>
>>      if (arm_feature(&cpu->env, ARM_FEATURE_CBAR)) {
>>          qdev_property_add_static(DEVICE(obj), &arm_cpu_reset_cbar_property,
>> @@ -265,6 +269,19 @@ static void arm_cpu_post_init(Object *obj)
>>                                   &err);
>>          assert_no_error(err);
>>      }
>> +
>> +    /*
>> +     * Initialise the midr property and set it to the original CPU MIDR
>> +     * This is used to maintain compatibility with boards that don't set
>> +     * a custom MIDR
>> +     */
>> +    qdev_property_add_static(DEVICE(obj), &arm_cpu_midr_property, &err);
>
> This looks wrong to me. Use dc->props to add properties that are always
> present. Any qdev_* functions shouldn't spread further than necessary.
>

If it is always present - PMM do you have any thoughts on this? does
MIDR universally exist in the ARM universe?

>> +    assert_no_error(err);
>
> Further, this seems to conflict with Peter C.'s work of introducing
> error_abort.
>

While we are on that topic, that pull (QMP queue) is progressing
slowly. Seems to be skipped over by Anthony in latest round of pulls
for some reason?

Regards,
Peter

> Andreas
>
>> +    object_property_set_int(OBJECT(cpu), temp, "midr", &err);
>> +    if (err) {
>> +        error_report("%s", error_get_pretty(err));
>> +        exit(1);
>> +    }
>>  }
>>
>>  static void arm_cpu_finalizefn(Object *obj)
>>
>
>
> --
> SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
> GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-01-13  0:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-12 23:33 [Qemu-devel] [PATCH arm-midr v1 0/2] ARM-MIDR Make ARM-MIDR a property and use in Zynq Alistair Francis
2014-01-12 23:33 ` [Qemu-devel] [PATCH arm-midr v1 1/2] ARM: Convert MIDR to a property Alistair Francis
2014-01-12 23:54   ` Andreas Färber
2014-01-13  0:03     ` Peter Crosthwaite
2014-01-12 23:33 ` [Qemu-devel] [PATCH arm-midr v1 2/2] ZYNQ: Implement board MIDR control for Zynq Alistair Francis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.