Skip to contentSkip to conversation

hw/arm/sbsa-ref : Fix SMMUv3 Initialisation

PATCH In review Graeme Gregory 3 participants 4 messages Sep 25, 2020 – Sep 28, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/arm/sbsa-ref : Fix SMMUv3 Initialisation

SMMUv3 has an error in previous patch where a i was transposed to a 1 meaning interrupts would not have been correctly assigned to the SMMUv3 instance.

The code also contained an error in that the IRQs were never allocated in the irqmap.

Fixes 48ba18e6d3f3 ("hw/arm/sbsa-ref: Simplify by moving the gic in the machine state")
---
 hw/arm/sbsa-ref.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/arm/sbsa-ref.c +2 -1
index 257ada9425..9109fb58be 100644
@@ -138,6 +138,7 @@ static const int sbsa_ref_irqmap[] = {
     [SBSA_SECURE_UART_MM] = 9,
     [SBSA_AHCI] = 10,
     [SBSA_EHCI] = 11,
+    [SBSA_SMMU] = 12, /* ... to 15 */
 };
 
 static uint64_t sbsa_ref_cpu_mp_affinity(SBSAMachineState *sms, int idx)
@@ -530,7 +531,7 @@ static void create_smmu(const SBSAMachineState *sms, PCIBus *bus)
     sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base);
     for (i = 0; i < NUM_SMMU_IRQS; i++) {
         sysbus_connect_irq(SYS_BUS_DEVICE(dev), i,
-                           qdev_get_gpio_in(sms->gic, irq + 1));
+                           qdev_get_gpio_in(sms->gic, irq + i));
     }
 }
 
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw

Hi Gregory,

Quoted 9 lines · Graeme Gregory

SMMUv3 has an error in previous patch where a i was transposed to a 1 meaning interrupts would not have been correctly assigned to the SMMUv3 instance.

The code also contained an error in that the IRQs were never allocated in the irqmap.

Fixes 48ba18e6d3f3 ("hw/arm/sbsa-ref: Simplify by moving the gic in the machine state")

Thanks

Eric

Quoted 26 lines
---
 hw/arm/sbsa-ref.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/arm/sbsa-ref.c +2 -1
index 257ada9425..9109fb58be 100644
@@ -138,6 +138,7 @@ static const int sbsa_ref_irqmap[] = {
     [SBSA_SECURE_UART_MM] = 9,
     [SBSA_AHCI] = 10,
     [SBSA_EHCI] = 11,
+    [SBSA_SMMU] = 12, /* ... to 15 */
 };
 
 static uint64_t sbsa_ref_cpu_mp_affinity(SBSAMachineState *sms, int idx)
@@ -530,7 +531,7 @@ static void create_smmu(const SBSAMachineState *sms, PCIBus *bus)
     sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base);
     for (i = 0; i < NUM_SMMU_IRQS; i++) {
         sysbus_connect_irq(SYS_BUS_DEVICE(dev), i,
-                           qdev_get_gpio_in(sms->gic, irq + 1));
+                           qdev_get_gpio_in(sms->gic, irq + i));
     }
 }
 
#2 lore raw

Hi Gregory,

Quoted 6 lines · Auger Eric

Hi Gregory,

Quoted 3 lines · Graeme Gregory

SMMUv3 has an error in previous patch where a i was transposed to a 1 meaning interrupts would not have been correctly assigned to the SMMUv3 instance.

This is a first issue, fixing 48ba18e6d3f3.

Quoted 3 lines
Quoted 3 lines

The code also contained an error in that the IRQs were never allocated in the irqmap.

This is another issue, not well explained. IIUC IRQs *are* allocated as IRQ #0, right?

This fixes commit e9fdf453240 ("hw/arm: Add arm SBSA reference machine, devices part"). Can you split this in another patch please? Eventually Cc'ing [email protected] as suggested by Peter.

Quoted 24 lines
Quoted 3 lines
Fixes 48ba18e6d3f3 ("hw/arm/sbsa-ref: Simplify by moving the gic in the machine state")

Thanks

Eric

Quoted 15 lines
---
 hw/arm/sbsa-ref.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/arm/sbsa-ref.c +1 -0
index 257ada9425..9109fb58be 100644
@@ -138,6 +138,7 @@ static const int sbsa_ref_irqmap[] = {
     [SBSA_SECURE_UART_MM] = 9,
     [SBSA_AHCI] = 10,
     [SBSA_EHCI] = 11,
+    [SBSA_SMMU] = 12, /* ... to 15 */
 };
 
Quoted 7 lines

hw/arm/sbsa-ref.c static void create_smmu(const SBSAMachineState *sms, PCIBus *bus) · line 534

Quoted 7 lines
hw/arm/sbsa-ref.c +1 -1
 static uint64_t sbsa_ref_cpu_mp_affinity(SBSAMachineState *sms, int idx)
@@ -530,7 +531,7 @@ static void create_smmu(const SBSAMachineState *sms, PCIBus *bus)
     sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base);
     for (i = 0; i < NUM_SMMU_IRQS; i++) {
         sysbus_connect_irq(SYS_BUS_DEVICE(dev), i,
-                           qdev_get_gpio_in(sms->gic, irq + 1));
+                           qdev_get_gpio_in(sms->gic, irq + i));

BTW this fix is already in Peter's queue:
https://www.mail-archive.com/[email protected]/msg732819.html

Thanks,

Phil.

Quoted 5 lines
Quoted 4 lines
hw/arm/sbsa-ref.c +0 -0
     }
 }
 
#3 lore raw
Quoted 16 lines · Philippe Mathieu-Daudé

Hi Gregory,

Quoted 6 lines · Auger Eric

Hi Gregory,

Quoted 3 lines · Graeme Gregory

SMMUv3 has an error in previous patch where a i was transposed to a 1 meaning interrupts would not have been correctly assigned to the SMMUv3 instance.

This is a first issue, fixing 48ba18e6d3f3.

Quoted 3 lines
Quoted 3 lines

The code also contained an error in that the IRQs were never allocated in the irqmap.

Quoted 7 lines

This is another issue, not well explained. IIUC IRQs *are* allocated as IRQ #0, right?

This fixes commit e9fdf453240 ("hw/arm: Add arm SBSA reference machine, devices part"). Can you split this in another patch please? Eventually Cc'ing [email protected] as suggested by Peter.

Ok I will split and issue v2 ASAP

Thanks

Graeme

Quoted 45 lines
Quoted 24 lines
Quoted 3 lines
Fixes 48ba18e6d3f3 ("hw/arm/sbsa-ref: Simplify by moving the gic in the machine state")

Thanks

Eric

Quoted 15 lines
---
 hw/arm/sbsa-ref.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/arm/sbsa-ref.c +1 -0
index 257ada9425..9109fb58be 100644
@@ -138,6 +138,7 @@ static const int sbsa_ref_irqmap[] = {
     [SBSA_SECURE_UART_MM] = 9,
     [SBSA_AHCI] = 10,
     [SBSA_EHCI] = 11,
+    [SBSA_SMMU] = 12, /* ... to 15 */
 };
 
Quoted 7 lines

hw/arm/sbsa-ref.c static void create_smmu(const SBSAMachineState *sms, PCIBus *bus) · line 534

Quoted 7 lines
hw/arm/sbsa-ref.c +1 -1
 static uint64_t sbsa_ref_cpu_mp_affinity(SBSAMachineState *sms, int idx)
@@ -530,7 +531,7 @@ static void create_smmu(const SBSAMachineState *sms, PCIBus *bus)
     sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base);
     for (i = 0; i < NUM_SMMU_IRQS; i++) {
         sysbus_connect_irq(SYS_BUS_DEVICE(dev), i,
-                           qdev_get_gpio_in(sms->gic, irq + 1));
+                           qdev_get_gpio_in(sms->gic, irq + i));

BTW this fix is already in Peter's queue:
https://www.mail-archive.com/[email protected]/msg732819.html

Thanks,

Phil.

Quoted 5 lines
Quoted 4 lines
hw/arm/sbsa-ref.c +0 -0
     }
 }