Skip to contentSkip to conversation

Make ARM-MIDR a property and use in Zynq

PATCH Applied Alistair Francis 4 participants 7 messages Jan 20, 2014 – Jan 27, 2014 Arm/Zynq architecture

lore
Share & tools
lore
#0 lore raw

v3 cover Make ARM-MIDR a property and use in Zynq

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.

V3: Removed the initialisation of the MIDR property from arm_cpu_post_init as it is no longer needed
V2: Use dc->props to avoid using qdev_*

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     |    1 +
 2 files changed, 8 insertions(+), 0 deletions(-)
#1 lore raw

PATCH v3 1/2 ARM: Convert MIDR to a property

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

---
I originally 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.
V3: Removed the initialisation of the MIDR property from arm_cpu_post_init as it is no longer needed
V2: Use dc->props to avoid using qdev_*

 target-arm/cpu.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
target-arm/cpu.c +1 -0
index 52efd5d..45ad7f0 100644
@@ -982,6 +982,7 @@ static const ARMCPUInfo arm_cpus[] = {
 
 static Property arm_cpu_properties[] = {
     DEFINE_PROP_BOOL("start-powered-off", ARMCPU, start_powered_off, false),
+    DEFINE_PROP_UINT32("midr", ARMCPU, midr, 0),
     DEFINE_PROP_END_OF_LIST()
 };
 
Signature · 1 line
1.7.1
Reviewed-by on v3 1/2
#2 lore raw

Re: [Qemu-devel] [PATCH arm-midr v3 1/2] ARM: Convert MIDR to a property

Quoted 5 lines · 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

Quoted 27 lines

---
I originally 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.
V3: Removed the initialisation of the MIDR property from arm_cpu_post_init as it is no longer needed
V2: Use dc->props to avoid using qdev_*

 target-arm/cpu.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
target-arm/cpu.c +1 -1
index 52efd5d..45ad7f0 100644
@@ -982,6 +982,7 @@ static const ARMCPUInfo arm_cpus[] = {
 
 static Property arm_cpu_properties[] = {
     DEFINE_PROP_BOOL("start-powered-off", ARMCPU, start_powered_off, false),
+    DEFINE_PROP_UINT32("midr", ARMCPU, midr, 0),
     DEFINE_PROP_END_OF_LIST()
 };
 
--

1.7.1

#3 lore raw

Re: [Qemu-devel] [PATCH arm-midr v3 1/2] ARM: Convert MIDR to a property

Am 23.01.2014 14:08, schrieb Peter Crosthwaite:

Quoted 7 lines
Quoted 5 lines · 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

Please use consistent subject prefixes as seen in Git history, in this case "target-arm", not "ARM".

Andreas

Quoted 30 lines
Quoted 27 lines

---
I originally 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.
V3: Removed the initialisation of the MIDR property from arm_cpu_post_init as it is no longer needed
V2: Use dc->props to avoid using qdev_*

 target-arm/cpu.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
target-arm/cpu.c +1 -1
index 52efd5d..45ad7f0 100644
@@ -982,6 +982,7 @@ static const ARMCPUInfo arm_cpus[] = {
 
 static Property arm_cpu_properties[] = {
     DEFINE_PROP_BOOL("start-powered-off", ARMCPU, start_powered_off, false),
+    DEFINE_PROP_UINT32("midr", ARMCPU, midr, 0),
     DEFINE_PROP_END_OF_LIST()
 };
 
--

1.7.1

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
#4 lore raw

PATCH v3 2/2 ZYNQ: Implement board MIDR control for Zynq

In reply to Alistair Francis

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

---

 hw/arm/xilinx_zynq.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
hw/arm/xilinx_zynq.c +7 -0
index 98e0958..9ee21e7 100644
@@ -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
@@ -125,6 +126,12 @@ static void zynq_init(QEMUMachineInitArgs *args)
 
     cpu = ARM_CPU(object_new(object_class_get_name(cpu_oc)));
 
+    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_int(OBJECT(cpu), MPCORE_PERIPHBASE, "reset-cbar", &err);
     if (err) {
         error_report("%s", error_get_pretty(err));
Signature · 1 line
1.7.1
#5 lore raw

Re: [Qemu-devel] [PATCH arm-midr v3 2/2] ZYNQ: Implement board MIDR control for Zynq

You should add an "arm:" arch prefix to the patch subject. We also tend not to use all caps for "Zynq" in-tree.

Quoted 14 lines · Alistair Francis

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

---

 hw/arm/xilinx_zynq.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
hw/arm/xilinx_zynq.c +0 -0
index 98e0958..9ee21e7 100644

hw/arm/xilinx_zynq.c line 40

Quoted 4 lines
hw/arm/xilinx_zynq.c +1 -0
@@ -37,6 +37,7 @@
 #define IRQ_OFFSET 32 /* pic interrupts start from index 32 */
 
 #define MPCORE_PERIPHBASE 0xF8F00000
+#define ZYNQ_BOARD_MIDR 0x413FC090

It's not really a "BOARD" thing. Zynq is a SoC (and this is really a reference board). I think all you need to do here is drop the "BOARD" to simply make "ZYNQ_MIDR".

Regards,
Peter

Quoted 20 lines
hw/arm/xilinx_zynq.c +6 -1
 static const int dma_irqs[8] = {
     46, 47, 48, 49, 72, 73, 74, 75
@@ -125,6 +126,12 @@ static void zynq_init(QEMUMachineInitArgs *args)
 
     cpu = ARM_CPU(object_new(object_class_get_name(cpu_oc)));
 
+    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_int(OBJECT(cpu), MPCORE_PERIPHBASE, "reset-cbar", &err);
     if (err) {
         error_report("%s", error_get_pretty(err));
--

1.7.1

#6 lore raw
In reply to Alistair Francis
Quoted 5 lines · Alistair Francis

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.

Thanks, applied to target-arm.next.

-- PMM