hw/arm: Explicit number of GIC external IRQs for Cortex A9/A15 MPCore
v2 cover hw/arm: Explicit number of GIC external IRQs for Cortex A9/A15 MPCore
Some boards based on Cortex-A9MP / Cortex-A15MP do not explicit the number of external GIC IRQs, using some (implicit) default value, not always trivial to figure out. Change that by removing the default value, requiring MPCore objects to be created with the "num-irq" set.
Since v1:
- Remove generic comments (Peter)
Philippe Mathieu-Daudé (8):
hw/arm/exynos4210: Replace magic 32 by proper 'GIC_INTERNAL'
definition
hw/arm/exynos4210: Specify explicitly the GIC has 64 external IRQs hw/arm/realview: Specify explicitly the GIC has 64 external IRQs hw/arm/xilinx_zynq: Replace IRQ_OFFSET -> GIC_INTERNAL hw/arm/xilinx_zynq: Specify explicitly the GIC has 64 external IRQs hw/arm/vexpress: Specify explicitly the GIC has 64 external IRQs hw/arm/highbank: Specify explicitly the GIC has 128 external IRQs hw/cpu/arm_mpcore: Remove default values for GIC external IRQs
hw/arm/exynos4210.c | 10 ++++++++-- hw/arm/highbank.c | 8 ++++---- hw/arm/realview.c | 11 +++++++++-- hw/arm/vexpress.c | 7 +++++-- hw/arm/xilinx_zynq.c | 43 ++++++++++++++++++++++--------------------- hw/cpu/a15mpcore.c | 18 ++++++++++++------ hw/cpu/a9mpcore.c | 18 ++++++++++++------ 7 files changed, 72 insertions(+), 43 deletions(-)
Signature · 1 line
2.47.1
PATCH v2 1/8 hw/arm/exynos4210: Replace magic 32 by proper 'GIC_INTERNAL' definition
The 32 IRQ lines skipped are the GIC internal ones. Use the GIC_INTERNAL definition for clarity. No logical change.
--- hw/arm/exynos4210.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
hw/arm/exynos4210.c +4 -2
@@ -394,7 +394,8 @@ static void exynos4210_init_board_irqs(Exynos4210State *s) }if (irq_id) {qdev_connect_gpio_out (splitter, splitin, -qdev_get_gpio_in (extgicdev, irq_id -32 )); +qdev_get_gpio_in (extgicdev, + irq_id -GIC_INTERNAL )); } }for (; n <EXYNOS4210_MAX_INT_COMBINER_IN_IRQ ; n++) {
@@ -421,7 +422,8 @@ static void exynos4210_init_board_irqs(Exynos4210State *s) s->irq_table[n] =qdev_get_gpio_in (splitter,0 );qdev_connect_gpio_out (splitter,0 ,qdev_get_gpio_in (intcdev, n));qdev_connect_gpio_out (splitter,1 , -qdev_get_gpio_in (extgicdev, irq_id -32 )); +qdev_get_gpio_in (extgicdev, + irq_id -GIC_INTERNAL )); }else { s->irq_table[n] =qdev_get_gpio_in (intcdev, n); }
Signature · 1 line
2.47.1
Re: [PATCH v2 1/8] hw/arm/exynos4210: Replace magic 32 by proper 'GIC_INTERNAL' definition
Quoted 8 lines · Philippe Mathieu-Daudé
The 32 IRQ lines skipped are the GIC internal ones. Use the
GIC_INTERNALdefinition for clarity. No logical change.Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- hw/arm/exynos4210.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
r~
PATCH v2 2/8 hw/arm/exynos4210: Specify explicitly the GIC has 64 external IRQs
In reply to Philippe Mathieu-DaudéWhen not specified, Cortex-A9MP configures its GIC with 64 external IRQs (see commit a32134aad89 "arm:make the number of GIC interrupts configurable"). Add the GIC_EXT_IRQS definition (with a comment) to make that explicit.
Except explicitly setting a property value to its same implicit value, there is no logical change intended.
--- hw/arm/exynos4210.c | 4 ++++ 1 file changed, 4 insertions(+)
hw/arm/exynos4210.c +4 -0
@@ -103,6 +103,8 @@#define EXYNOS4210_PL330_BASE1_ADDR 0x12690000#define EXYNOS4210_PL330_BASE2_ADDR 0x12850000 +#define GIC_EXT_IRQS 64/* FIXME: verify for this SoC */ +enum ExtGicId {EXT_GIC_ID_MDMA_LCD0 =66 ,EXT_GIC_ID_PDMA0 ,
@@ -588,6 +590,8 @@ static void exynos4210_realize(DeviceState *socdev, Error **errp)/* Private memory region and Internal GIC */ qdev_prop_set_uint32 (DEVICE (&s->a9mpcore),"num-cpu" ,EXYNOS4210_NCPUS ); +qdev_prop_set_uint32 (DEVICE (&s->a9mpcore),"num-irq" , +GIC_EXT_IRQS +GIC_INTERNAL ); busdev =SYS_BUS_DEVICE (&s->a9mpcore);sysbus_realize (busdev, &error_fatal);sysbus_mmio_map (busdev,0 ,EXYNOS4210_SMP_PRIVATE_BASE_ADDR );
Signature · 1 line
2.47.1
Re: [PATCH v2 2/8] hw/arm/exynos4210: Specify explicitly the GIC has 64 external IRQs
Quoted 5 lines · Philippe Mathieu-Daudé
When not specified, Cortex-A9MP configures its GIC with 64 external IRQs (see commit
a32134aad89"arm:make the number of GIC interrupts configurable"). Add theGIC_EXT_IRQSdefinition (with a comment) to make that explicit.
Quoted 7 lines
Except explicitly setting a property value to its same implicit value, there is no logical change intended.
Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- hw/arm/exynos4210.c | 4 ++++ 1 file changed, 4 insertions(+)
r~
PATCH v2 3/8 hw/arm/realview: Specify explicitly the GIC has 64 external IRQs
In reply to Philippe Mathieu-DaudéWhen not specified, Cortex-A9MP configures its GIC with 64 external IRQs (see commit a32134aad89 "arm:make the number of GIC interrupts configurable"). Add the GIC_EXT_IRQS definition (with a comment) to make that explicit.
Except explicitly setting a property value to its same implicit value, there is no logical change intended.
--- hw/arm/realview.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
hw/arm/realview.c +9 -2
@@ -35,6 +35,8 @@#define SMP_BOOT_ADDR 0xe0000000#define SMP_BOOTREG_ADDR 0x10000030 +#define GIC_EXT_IRQS 64/* Realview PBX-A9 development board */ +/* Board init. */ static struct arm_boot_info realview_binfo = {
@@ -185,7 +187,12 @@ static void realview_init(MachineState *machine,sysbus_mmio_map (SYS_BUS_DEVICE (sysctl),0 ,0x10000000 );if (is_mpcore) { - dev =qdev_new (is_pb ?TYPE_A9MPCORE_PRIV :"realview_mpcore" ); +if (is_pb) { + dev =qdev_new (TYPE_A9MPCORE_PRIV ); +qdev_prop_set_uint32 (dev,"num-irq" ,GIC_EXT_IRQS +GIC_INTERNAL ); + }else { + dev =qdev_new ("realview_mpcore" ); + }qdev_prop_set_uint32 (dev,"num-cpu" , smp_cpus); busdev =SYS_BUS_DEVICE (dev);sysbus_realize_and_unref (busdev, &error_fatal);
@@ -201,7 +208,7 @@ static void realview_init(MachineState *machine,/* For now just create the nIRQ GIC, and ignore the others. */ dev =sysbus_create_simple (TYPE_REALVIEW_GIC , gic_addr, cpu_irq[0 ]); } -for (n =0 ; n <64 ; n++) { +for (n =0 ; n <GIC_EXT_IRQS ; n++) { pic[n] =qdev_get_gpio_in (dev, n); }
Signature · 1 line
2.47.1
Re: [PATCH v2 3/8] hw/arm/realview: Specify explicitly the GIC has 64 external IRQs
Quoted 5 lines · Philippe Mathieu-Daudé
When not specified, Cortex-A9MP configures its GIC with 64 external IRQs (see commit
a32134aad89"arm:make the number of GIC interrupts configurable"). Add theGIC_EXT_IRQSdefinition (with a comment) to make that explicit.
Quoted 7 lines
Except explicitly setting a property value to its same implicit value, there is no logical change intended.
Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- hw/arm/realview.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
r~
PATCH v2 4/8 hw/arm/xilinx_zynq: Replace IRQ_OFFSET -> GIC_INTERNAL
In reply to Philippe Mathieu-DaudéWe already have a definition to distinct GIC internal IRQs versus external ones, use it. No logical changes.
--- hw/arm/xilinx_zynq.c | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-)
hw/arm/xilinx_zynq.c +16 -18
@@ -54,8 +54,6 @@ OBJECT_DECLARE_SIMPLE_TYPE(ZynqMachineState, ZYNQ_MACHINE)#define FLASH_SIZE (64 * 1024 * 1024)#define FLASH_SECTOR_SIZE (128 * 1024) -#define IRQ_OFFSET 32/* pic interrupts start from index 32 */ -#define MPCORE_PERIPHBASE 0xF8F00000#define ZYNQ_BOARD_MIDR 0x413FC090
@@ -281,12 +279,12 @@ static void zynq_init(MachineState *machine) pic[n] =qdev_get_gpio_in (dev, n); } - n =zynq_init_spi_flashes (0xE0006000 , pic[58 -IRQ_OFFSET ], false,0 ); - n =zynq_init_spi_flashes (0xE0007000 , pic[81 -IRQ_OFFSET ], false, n); - n =zynq_init_spi_flashes (0xE000D000 , pic[51 -IRQ_OFFSET ], true, n); + n =zynq_init_spi_flashes (0xE0006000 , pic[58 -GIC_INTERNAL ], false,0 ); + n =zynq_init_spi_flashes (0xE0007000 , pic[81 -GIC_INTERNAL ], false, n); + n =zynq_init_spi_flashes (0xE000D000 , pic[51 -GIC_INTERNAL ], true, n); -sysbus_create_simple (TYPE_CHIPIDEA ,0xE0002000 , pic[53 -IRQ_OFFSET ]); -sysbus_create_simple (TYPE_CHIPIDEA ,0xE0003000 , pic[76 -IRQ_OFFSET ]); +sysbus_create_simple (TYPE_CHIPIDEA ,0xE0002000 , pic[53 -GIC_INTERNAL ]); +sysbus_create_simple (TYPE_CHIPIDEA ,0xE0003000 , pic[76 -GIC_INTERNAL ]); dev =qdev_new (TYPE_CADENCE_UART ); busdev =SYS_BUS_DEVICE (dev);
@@ -295,7 +293,7 @@ static void zynq_init(MachineState *machine) qdev_get_clock_out(slcr, "uart0_ref_clk"));sysbus_realize_and_unref (busdev, &error_fatal);sysbus_mmio_map (busdev,0 ,0xE0000000 ); -sysbus_connect_irq (busdev,0 , pic[59 -IRQ_OFFSET ]); +sysbus_connect_irq (busdev,0 , pic[59 -GIC_INTERNAL ]); dev =qdev_new (TYPE_CADENCE_UART ); busdev =SYS_BUS_DEVICE (dev);qdev_prop_set_chr (dev,"chardev" ,serial_hd (1 ));
@@ -303,15 +301,15 @@ static void zynq_init(MachineState *machine) qdev_get_clock_out(slcr, "uart1_ref_clk"));sysbus_realize_and_unref (busdev, &error_fatal);sysbus_mmio_map (busdev,0 ,0xE0001000 ); -sysbus_connect_irq (busdev,0 , pic[82 -IRQ_OFFSET ]); +sysbus_connect_irq (busdev,0 , pic[82 -GIC_INTERNAL ]);sysbus_create_varargs ("cadence_ttc" ,0xF8001000 , - pic[42 -IRQ_OFFSET ], pic[43 -IRQ_OFFSET ], pic[44 -IRQ_OFFSET ],NULL ); + pic[42 -GIC_INTERNAL ], pic[43 -GIC_INTERNAL ], pic[44 -GIC_INTERNAL ],NULL );sysbus_create_varargs ("cadence_ttc" ,0xF8002000 , - pic[69 -IRQ_OFFSET ], pic[70 -IRQ_OFFSET ], pic[71 -IRQ_OFFSET ],NULL ); + pic[69 -GIC_INTERNAL ], pic[70 -GIC_INTERNAL ], pic[71 -GIC_INTERNAL ],NULL ); -gem_init (0xE000B000 , pic[54 -IRQ_OFFSET ]); -gem_init (0xE000C000 , pic[77 -IRQ_OFFSET ]); +gem_init (0xE000B000 , pic[54 -GIC_INTERNAL ]); +gem_init (0xE000C000 , pic[77 -GIC_INTERNAL ]);for (n =0 ; n <2 ; n++) {int hci_irq = n ?79 :56 ;
@@ -330,7 +328,7 @@ static void zynq_init(MachineState *machine)qdev_prop_set_uint64 (dev,"capareg" ,ZYNQ_SDHCI_CAPABILITIES );sysbus_realize_and_unref (SYS_BUS_DEVICE (dev), &error_fatal);sysbus_mmio_map (SYS_BUS_DEVICE (dev),0 , hci_addr); -sysbus_connect_irq (SYS_BUS_DEVICE (dev),0 , pic[hci_irq -IRQ_OFFSET ]); +sysbus_connect_irq (SYS_BUS_DEVICE (dev),0 , pic[hci_irq -GIC_INTERNAL ]); di =drive_get (IF_SD ,0 , n); blk = di ?blk_by_legacy_dinfo (di) :NULL ;
@@ -343,7 +341,7 @@ static void zynq_init(MachineState *machine) dev =qdev_new (TYPE_ZYNQ_XADC );sysbus_realize_and_unref (SYS_BUS_DEVICE (dev), &error_fatal);sysbus_mmio_map (SYS_BUS_DEVICE (dev),0 ,0xF8007100 ); -sysbus_connect_irq (SYS_BUS_DEVICE (dev),0 , pic[39 -IRQ_OFFSET ]); +sysbus_connect_irq (SYS_BUS_DEVICE (dev),0 , pic[39 -GIC_INTERNAL ]); dev =qdev_new ("pl330" ); object_property_set_link(OBJECT(dev), "memory",
@@ -363,15 +361,15 @@ static void zynq_init(MachineState *machine) busdev =SYS_BUS_DEVICE (dev);sysbus_realize_and_unref (busdev, &error_fatal);sysbus_mmio_map (busdev,0 ,0xF8003000 ); -sysbus_connect_irq (busdev,0 , pic[45 -IRQ_OFFSET ]);/* abort irq line */ +sysbus_connect_irq (busdev,0 , pic[45 -GIC_INTERNAL ]);/* abort irq line */ for (n =0 ; n <ARRAY_SIZE (dma_irqs); ++n) {/* event irqs */ -sysbus_connect_irq (busdev, n +1 , pic[dma_irqs[n] -IRQ_OFFSET ]); +sysbus_connect_irq (busdev, n +1 , pic[dma_irqs[n] -GIC_INTERNAL ]); } dev =qdev_new ("xlnx.ps7-dev-cfg" ); busdev =SYS_BUS_DEVICE (dev);sysbus_realize_and_unref (busdev, &error_fatal); -sysbus_connect_irq (busdev,0 , pic[40 -IRQ_OFFSET ]); +sysbus_connect_irq (busdev,0 , pic[40 -GIC_INTERNAL ]);sysbus_mmio_map (busdev,0 ,0xF8007000 );/*
Signature · 1 line
2.47.1
Re: [PATCH v2 4/8] hw/arm/xilinx_zynq: Replace IRQ_OFFSET -> GIC_INTERNAL
Quoted 8 lines · Philippe Mathieu-Daudé
We already have a definition to distinct GIC internal IRQs versus external ones, use it. No logical changes.
Signed-off-by Philippe Mathieu-Daudé<[email protected]>Reviewed-by Peter Maydell<[email protected]>--- hw/arm/xilinx_zynq.c | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-)
r~
PATCH v2 5/8 hw/arm/xilinx_zynq: Specify explicitly the GIC has 64 external IRQs
In reply to Philippe Mathieu-DaudéLooking at the Zynq 7000 SoC Technical Reference Manual (UG585 v1.14) on Appendix A: Register Details, the mpcore Interrupt Controller Type Register (ICDICTR) has the IT_Lines_Number field read-only with value 0x2, described as:
IT_Lines_Number
b00010 = the distributor provides 96 interrupts,
64 external interrupt lines.
Add a GIC_EXT_IRQS definition (with a comment) to make the number of GIC external IRQs explicit.
Except explicitly setting a property value to its same implicit value, there is no logical change intended.
--- hw/arm/xilinx_zynq.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
hw/arm/xilinx_zynq.c +6 -3
@@ -57,6 +57,8 @@ OBJECT_DECLARE_SIMPLE_TYPE(ZynqMachineState, ZYNQ_MACHINE)#define MPCORE_PERIPHBASE 0xF8F00000#define ZYNQ_BOARD_MIDR 0x413FC090 +#define GIC_EXT_IRQS 64/* Zynq 7000 SoC */ +static const int dma_irqs[8 ] = {46 ,47 ,48 ,49 ,72 ,73 ,74 ,75 };
@@ -205,7 +207,7 @@ static void zynq_init(MachineState *machine)MemoryRegion *ocm_ram =g_new (MemoryRegion,1 );DeviceState *dev, *slcr;SysBusDevice *busdev; -qemu_irq pic[64 ]; +qemu_irq pic[GIC_EXT_IRQS ];int n;unsigned int smp_cpus = machine->smp.cpus;
@@ -261,6 +263,7 @@ static void zynq_init(MachineState *machine) dev =qdev_new (TYPE_A9MPCORE_PRIV );qdev_prop_set_uint32 (dev,"num-cpu" , smp_cpus); +qdev_prop_set_uint32 (dev,"num-irq" ,GIC_EXT_IRQS +GIC_INTERNAL ); busdev =SYS_BUS_DEVICE (dev);sysbus_realize_and_unref (busdev, &error_fatal);sysbus_mmio_map (busdev,0 ,MPCORE_PERIPHBASE );
@@ -275,7 +278,7 @@ static void zynq_init(MachineState *machine) qdev_get_gpio_in(cpudev, ARM_CPU_FIQ)); } -for (n =0 ; n <64 ; n++) { +for (n =0 ; n <GIC_EXT_IRQS ; n++) { pic[n] =qdev_get_gpio_in (dev, n); }
@@ -458,7 +461,7 @@ static void zynq_machine_class_init(ObjectClass *oc, void *data) };MachineClass *mc =MACHINE_CLASS (oc);ObjectProperty *prop; - mc->desc ="Xilinx Zynq Platform Baseboard for Cortex-A9" ; + mc->desc ="Xilinx Zynq 7000 Platform Baseboard for Cortex-A9" ; mc->init = zynq_init; mc->max_cpus =ZYNQ_MAX_CPUS ; mc->no_sdcard =1 ;
Signature · 1 line
2.47.1
Re: [PATCH v2 5/8] hw/arm/xilinx_zynq: Specify explicitly the GIC has 64 external IRQs
Quoted 13 lines · Philippe Mathieu-Daudé
Looking at the Zynq 7000 SoC Technical Reference Manual (UG585 v1.14) on Appendix A: Register Details, the mpcore Interrupt Controller Type Register (ICDICTR) has the
IT_Lines_Numberfield read-only with value0x2, described as:
IT_Lines_Numberb00010 = the distributor provides 96 interrupts,
64 external interrupt lines.Add a
GIC_EXT_IRQSdefinition (with a comment) to make the number of GIC external IRQs explicit.
Quoted 7 lines
Except explicitly setting a property value to its same implicit value, there is no logical change intended.
Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- hw/arm/xilinx_zynq.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
r~
PATCH v2 6/8 hw/arm/vexpress: Specify explicitly the GIC has 64 external IRQs
In reply to Philippe Mathieu-DaudéWhen not specified, Cortex-A9MP configures its GIC with 64 external IRQs, (see commit a32134aad89 "arm:make the number of GIC interrupts configurable"), and Cortex-15MP to 128 (see commit 528622421eb "hw/cpu/a15mpcore: Correct default value for num-irq"). The Versatile Express board however expects a fixed set of 64 interrupts (see the fixed IRQ length when this board was added in commit 2055283bcc8 ("hw/vexpress: Add model of ARM Versatile Express board"). Add the GIC_EXT_IRQS definition (with a comment) to make that explicit.
Except explicitly setting a property value to its same implicit value, there is no logical change intended.
--- hw/arm/vexpress.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
hw/arm/vexpress.c +5 -2
@@ -51,6 +51,8 @@#define VEXPRESS_FLASH_SIZE (64 * 1024 * 1024)#define VEXPRESS_FLASH_SECT_SIZE (256 * 1024) +#define GIC_EXT_IRQS 64/* Versatile Express A9 development board */ +/* Number of virtio transports to create (0..8; limited by * number of available IRQ lines). */
@@ -241,6 +243,7 @@ static void init_cpus(MachineState *ms, const char *cpu_type,*/ dev =qdev_new (privdev);qdev_prop_set_uint32 (dev,"num-cpu" , smp_cpus); +qdev_prop_set_uint32 (dev,"num-irq" ,GIC_EXT_IRQS +GIC_INTERNAL ); busdev =SYS_BUS_DEVICE (dev);sysbus_realize_and_unref (busdev, &error_fatal);sysbus_mmio_map (busdev,0 , periphbase);
@@ -251,7 +254,7 @@ static void init_cpus(MachineState *ms, const char *cpu_type,* external interrupts starting from 32 (because there * are internal interrupts 0..31). */ -for (n =0 ; n <64 ; n++) { +for (n =0 ; n <GIC_EXT_IRQS ; n++) { pic[n] =qdev_get_gpio_in (dev, n); }
@@ -543,7 +546,7 @@ static void vexpress_common_init(MachineState *machine)VexpressMachineClass *vmc =VEXPRESS_MACHINE_GET_CLASS (machine);VEDBoardInfo *daughterboard = vmc->daughterboard;DeviceState *dev, *sysctl, *pl041; -qemu_irq pic[64 ]; +qemu_irq pic[GIC_EXT_IRQS ];uint32_t sys_id;DriveInfo *dinfo;PFlashCFI01 *pflash0;
Signature · 1 line
2.47.1
Re: [PATCH v2 6/8] hw/arm/vexpress: Specify explicitly the GIC has 64 external IRQs
Quoted 10 lines · Philippe Mathieu-Daudé
When not specified, Cortex-A9MP configures its GIC with 64 external IRQs, (see commit
a32134aad89"arm:make the number of GIC interrupts configurable"), and Cortex-15MP to 128 (see commit528622421eb"hw/cpu/a15mpcore: Correct default value for num-irq"). The Versatile Express board however expects a fixed set of 64 interrupts (see the fixed IRQ length when this board was added in commit2055283bcc8("hw/vexpress: Add model of ARM Versatile Express board"). Add theGIC_EXT_IRQSdefinition (with a comment) to make that explicit.
Quoted 7 lines
Except explicitly setting a property value to its same implicit value, there is no logical change intended.
Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- hw/arm/vexpress.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
r~
PATCH v2 7/8 hw/arm/highbank: Specify explicitly the GIC has 128 external IRQs
In reply to Philippe Mathieu-DaudéWhen not specified, Cortex-A9MP configures its GIC with 64 external IRQs, (see commit a32134aad89 "arm:make the number of GIC interrupts configurable"), and Cortex-15MP to 128 (see commit 528622421eb "hw/cpu/a15mpcore: Correct default value for num-irq"). The Caldexa Highbank board however expects a fixed set of 128 interrupts (see the fixed IRQ length when this board was added in commit 2488514cef2 ("arm: SoC model for Calxeda Highbank"). Add the GIC_EXT_IRQS definition (with a comment) to make that explicit.
Except explicitly setting a property value to its same implicit value, there is no logical change intended.
--- hw/arm/highbank.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
hw/arm/highbank.c +4 -4
@@ -45,7 +45,7 @@#define MVBAR_ADDR 0x200#define BOARD_SETUP_ADDR (MVBAR_ADDR + 8 * sizeof(uint32_t)) -#define NIRQ_GIC 160 +#define GIC_EXT_IRQS 128/* EnergyCore ECX-1000 & ECX-2000 */ /* Board init. */
@@ -180,7 +180,7 @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id) {DeviceState *dev =NULL ;SysBusDevice *busdev; -qemu_irq pic[128 ]; +qemu_irq pic[GIC_EXT_IRQS ];int n;unsigned int smp_cpus = machine->smp.cpus;qemu_irq cpu_irq[4 ];
@@ -260,7 +260,7 @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id)break ; }qdev_prop_set_uint32 (dev,"num-cpu" , smp_cpus); -qdev_prop_set_uint32 (dev,"num-irq" ,NIRQ_GIC ); +qdev_prop_set_uint32 (dev,"num-irq" ,GIC_EXT_IRQS +GIC_INTERNAL ); busdev =SYS_BUS_DEVICE (dev);sysbus_realize_and_unref (busdev, &error_fatal);sysbus_mmio_map (busdev,0 ,MPCORE_PERIPHBASE );
@@ -271,7 +271,7 @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id)sysbus_connect_irq (busdev, n +3 * smp_cpus, cpu_vfiq[n]); } -for (n =0 ; n <128 ; n++) { +for (n =0 ; n <GIC_EXT_IRQS ; n++) { pic[n] =qdev_get_gpio_in (dev, n); }
Signature · 1 line
2.47.1
Re: [PATCH v2 7/8] hw/arm/highbank: Specify explicitly the GIC has 128 external IRQs
Quoted 9 lines · Philippe Mathieu-Daudé
When not specified, Cortex-A9MP configures its GIC with 64 external IRQs, (see commit
a32134aad89"arm:make the number of GIC interrupts configurable"), and Cortex-15MP to 128 (see commit528622421eb"hw/cpu/a15mpcore: Correct default value for num-irq"). The Caldexa Highbank board however expects a fixed set of 128 interrupts (see the fixed IRQ length when this board was added in commit2488514cef2("arm: SoC model for Calxeda Highbank"). Add theGIC_EXT_IRQSdefinition (with a comment) to make that explicit.
Quoted 7 lines
Except explicitly setting a property value to its same implicit value, there is no logical change intended.
Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- hw/arm/highbank.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
r~
PATCH v2 8/8 hw/cpu/arm_mpcore: Remove default values for GIC external IRQs
In reply to Philippe Mathieu-DaudéImplicit default values are often hard to figure out, better be explicit. Now that all boards explicitly set the number of GIC external IRQs, remove the default values (displaying an error message if it is out of range).
--- hw/cpu/a15mpcore.c | 18 ++++++++++++------ hw/cpu/a9mpcore.c | 18 ++++++++++++------ 2 files changed, 24 insertions(+), 12 deletions(-)
hw/cpu/a15mpcore.c +12 -6
@@ -58,6 +58,11 @@ static void a15mp_priv_realize(DeviceState *dev, Error **errp)bool has_el2 = false;Object *cpuobj; +if (s->num_irq <32 || s->num_irq >256 ) { +error_setg (errp,"Property 'num-irq' must be between 32 and 256" ); +return ; + } + gicdev =DEVICE (&s->gic);qdev_prop_set_uint32 (gicdev,"num-cpu" , s->num_cpu);qdev_prop_set_uint32 (gicdev,"num-irq" , s->num_irq);
@@ -146,13 +151,14 @@ static void a15mp_priv_realize(DeviceState *dev, Error **errp)static const Property a15mp_priv_properties[] = {DEFINE_PROP_UINT32 ("num-cpu" , A15MPPrivState, num_cpu,1 ), -/* The Cortex-A15MP may have anything from 0 to 224 external interrupt -* IRQ lines (with another 32 internal). We default to 128+32, which -* is the number provided by the Cortex-A15MP test chip in the -* Versatile Express A15 development board. -* Other boards may differ and should set this property appropriately. +/* +* The Cortex-A15MP may have anything from 0 to 224 external interrupt +* lines, plus always 32 internal IRQs. This property sets the total +* of internal + external, so the valid range is from 32 to 256. +* The board model must set this to whatever the configuration +* used for the CPU on that board or SoC is. */ -DEFINE_PROP_UINT32 ("num-irq" , A15MPPrivState, num_irq,160 ), +DEFINE_PROP_UINT32 ("num-irq" , A15MPPrivState, num_irq,0 ), };static void a15mp_priv_class_init (ObjectClass *klass,void *data)
hw/cpu/a9mpcore.c +12 -6
@@ -56,6 +56,11 @@ static void a9mp_priv_realize(DeviceState *dev, Error **errp)CPUState *cpu0;Object *cpuobj; +if (s->num_irq <32 || s->num_irq >256 ) { +error_setg (errp,"Property 'num-irq' must be between 32 and 256" ); +return ; + } + cpu0 =qemu_get_cpu (0 ); cpuobj =OBJECT (cpu0);if (strcmp (object_get_typename (cpuobj),ARM_CPU_TYPE_NAME ("cortex-a9" ))) {
@@ -160,13 +165,14 @@ static void a9mp_priv_realize(DeviceState *dev, Error **errp)static const Property a9mp_priv_properties[] = {DEFINE_PROP_UINT32 ("num-cpu" , A9MPPrivState, num_cpu,1 ), -/* The Cortex-A9MP may have anything from 0 to 224 external interrupt -* IRQ lines (with another 32 internal). We default to 64+32, which -* is the number provided by the Cortex-A9MP test chip in the -* Realview PBX-A9 and Versatile Express A9 development boards. -* Other boards may differ and should set this property appropriately. +/* +* The Cortex-A9MP may have anything from 0 to 224 external interrupt +* lines, plus always 32 internal IRQs. This property sets the total +* of internal + external, so the valid range is from 32 to 256. +* The board model must set this to whatever the configuration +* used for the CPU on that board or SoC is. */ -DEFINE_PROP_UINT32 ("num-irq" , A9MPPrivState, num_irq,96 ), +DEFINE_PROP_UINT32 ("num-irq" , A9MPPrivState, num_irq,0 ), };static void a9mp_priv_class_init (ObjectClass *klass,void *data)
Signature · 1 line
2.47.1
Re: [PATCH v2 8/8] hw/cpu/arm_mpcore: Remove default values for GIC external IRQs
Quoted 10 lines · Philippe Mathieu-Daudé
Implicit default values are often hard to figure out, better be explicit. Now that all boards explicitly set the number of GIC external IRQs, remove the default values (displaying an error message if it is out of range).
Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- hw/cpu/a15mpcore.c | 18 ++++++++++++------ hw/cpu/a9mpcore.c | 18 ++++++++++++------ 2 files changed, 24 insertions(+), 12 deletions(-)
r~
Peter Maydell
AppliedQuoted 9 lines · Philippe Mathieu-Daudé
Some boards based on Cortex-A9MP / Cortex-A15MP do not explicit the number of external GIC IRQs, using some (implicit) default value, not always trivial to figure out. Change that by removing the default value, requiring MPCore objects to be created with the "num-irq" set.
Since v1:
- Remove generic comments (Peter)
Quoted 10 lines
Philippe Mathieu-Daudé (8):
hw/arm/exynos4210: Replace magic 32 by proper 'GIC_INTERNAL'
definition
hw/arm/exynos4210: Specify explicitly the GIC has 64 external IRQs hw/arm/realview: Specify explicitly the GIC has 64 external IRQs hw/arm/xilinx_zynq: ReplaceIRQ_OFFSET->GIC_INTERNALhw/arm/xilinx_zynq: Specify explicitly the GIC has 64 external IRQs hw/arm/vexpress: Specify explicitly the GIC has 64 external IRQs hw/arm/highbank: Specify explicitly the GIC has 128 external IRQs hw/cpu/arm_mpcore: Remove default values for GIC external IRQs
Applied to target-arm.next, thanks.
-- PMM