Skip to contentSkip to conversation

hw/pci-host/mv64361: Reuse pci_swizzle_map_irq_fn

PATCH Applied Bernhard Beschow 4 participants 5 messages Jan 6, 2023 – Jan 24, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/pci-host/mv64361: Reuse pci_swizzle_map_irq_fn

mv64361_pcihost_map_irq() is a reimplementation of pci_swizzle_map_irq_fn(). Resolve this redundancy.

---
Testing done:

* `qemu-system-ppc -machine pegasos2 \
                   -rtc base=localtime \
                   -device ati-vga,guest_hwcursor=true,romfile="" \
                   -cdrom morphos-3.17.iso \
                   -kernel morphos-3.17/boot.img`
---
 hw/pci-host/mv64361.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
hw/pci-host/mv64361.c +1 -6
index cc9c4d6d3b..70db142ec3 100644
@@ -72,11 +72,6 @@ struct MV64361PCIState {
     uint64_t remap[5];
 };
 
-static int mv64361_pcihost_map_irq(PCIDevice *pci_dev, int n)
-{
-    return (n + PCI_SLOT(pci_dev->devfn)) % PCI_NUM_PINS;
-}
-
 static void mv64361_pcihost_set_irq(void *opaque, int n, int level)
 {
     MV64361PCIState *s = opaque;
@@ -97,7 +92,7 @@ static void mv64361_pcihost_realize(DeviceState *dev, Error **errp)
     g_free(name);
     name = g_strdup_printf("pci.%d", s->index);
     h->bus = pci_register_root_bus(dev, name, mv64361_pcihost_set_irq,
-                                   mv64361_pcihost_map_irq, dev,
+                                   pci_swizzle_map_irq_fn, dev,
                                    &s->mem, &s->io, 0, 4, TYPE_PCI_BUS);
     g_free(name);
     pci_create_simple(h->bus, 0, TYPE_MV64361_PCI_BRIDGE);
Signature · 1 line
2.39.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Bernhard Beschow

mv64361_pcihost_map_irq() is a reimplementation of pci_swizzle_map_irq_fn(). Resolve this redundancy.

---
Testing done:

Quoted 8 lines
* `qemu-system-ppc -machine pegasos2 \
                    -rtc base=localtime \
                    -device ati-vga,guest_hwcursor=true,romfile="" \
                    -cdrom morphos-3.17.iso \
                    -kernel morphos-3.17/boot.img`
---
  hw/pci-host/mv64361.c | 7 +------
  1 file changed, 1 insertion(+), 6 deletions(-)
Reviewed-by on v1 1/1
#2 lore raw
In reply to Bernhard Beschow
Quoted 4 lines · Bernhard Beschow

mv64361_pcihost_map_irq() is a reimplementation of pci_swizzle_map_irq_fn(). Resolve this redundancy.

Quoted 37 lines

---
Testing done:

* `qemu-system-ppc -machine pegasos2 \
                  -rtc base=localtime \
                  -device ati-vga,guest_hwcursor=true,romfile="" \
                  -cdrom morphos-3.17.iso \
                  -kernel morphos-3.17/boot.img`
---
hw/pci-host/mv64361.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
hw/pci-host/mv64361.c +1 -6
index cc9c4d6d3b..70db142ec3 100644
@@ -72,11 +72,6 @@ struct MV64361PCIState {
    uint64_t remap[5];
 };
 
-static int mv64361_pcihost_map_irq(PCIDevice *pci_dev, int n)
-{
-    return (n + PCI_SLOT(pci_dev->devfn)) % PCI_NUM_PINS;
-}
-
 static void mv64361_pcihost_set_irq(void *opaque, int n, int level)
 {
    MV64361PCIState *s = opaque;
@@ -97,7 +92,7 @@ static void mv64361_pcihost_realize(DeviceState *dev, Error **errp)
    g_free(name);
    name = g_strdup_printf("pci.%d", s->index);
    h->bus = pci_register_root_bus(dev, name, mv64361_pcihost_set_irq,
-                                   mv64361_pcihost_map_irq, dev,
+                                   pci_swizzle_map_irq_fn, dev,
                                   &s->mem, &s->io, 0, 4, TYPE_PCI_BUS);
    g_free(name);
    pci_create_simple(h->bus, 0, TYPE_MV64361_PCI_BRIDGE);
#3 lore raw
In reply to Bernhard Beschow

Am 6. Januar 2023 11:39:27 UTC schrieb Bernhard Beschow <[email protected]>:

Quoted 4 lines

mv64361_pcihost_map_irq() is a reimplementation of pci_swizzle_map_irq_fn(). Resolve this redundancy.

Ping

Patch is reviewed. Who will queue it? Daniel?

Best regards,
Bernhard

Quoted 36 lines

---
Testing done:

* `qemu-system-ppc -machine pegasos2 \
                  -rtc base=localtime \
                  -device ati-vga,guest_hwcursor=true,romfile="" \
                  -cdrom morphos-3.17.iso \
                  -kernel morphos-3.17/boot.img`
---
hw/pci-host/mv64361.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
hw/pci-host/mv64361.c +1 -6
index cc9c4d6d3b..70db142ec3 100644
@@ -72,11 +72,6 @@ struct MV64361PCIState {
    uint64_t remap[5];
 };
 
-static int mv64361_pcihost_map_irq(PCIDevice *pci_dev, int n)
-{
-    return (n + PCI_SLOT(pci_dev->devfn)) % PCI_NUM_PINS;
-}
-
 static void mv64361_pcihost_set_irq(void *opaque, int n, int level)
 {
    MV64361PCIState *s = opaque;
@@ -97,7 +92,7 @@ static void mv64361_pcihost_realize(DeviceState *dev, Error **errp)
    g_free(name);
    name = g_strdup_printf("pci.%d", s->index);
    h->bus = pci_register_root_bus(dev, name, mv64361_pcihost_set_irq,
-                                   mv64361_pcihost_map_irq, dev,
+                                   pci_swizzle_map_irq_fn, dev,
                                   &s->mem, &s->io, 0, 4, TYPE_PCI_BUS);
    g_free(name);
    pci_create_simple(h->bus, 0, TYPE_MV64361_PCI_BRIDGE);
#4 lore raw
Quoted 11 lines · Bernhard Beschow

Am 6. Januar 2023 11:39:27 UTC schrieb Bernhard Beschow <[email protected]>:

Quoted 4 lines

mv64361_pcihost_map_irq() is a reimplementation of pci_swizzle_map_irq_fn(). Resolve this redundancy.

Ping

Patch is reviewed. Who will queue it? Daniel?

Queued in gitlab.com/danielhb/qemu/tree/ppc-next. Thanks,

Daniel

Quoted 41 lines

Best regards,
Bernhard

Quoted 36 lines

---
Testing done:

* `qemu-system-ppc -machine pegasos2 \
                   -rtc base=localtime \
                   -device ati-vga,guest_hwcursor=true,romfile="" \
                   -cdrom morphos-3.17.iso \
                   -kernel morphos-3.17/boot.img`
---
hw/pci-host/mv64361.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
hw/pci-host/mv64361.c +1 -6
index cc9c4d6d3b..70db142ec3 100644
@@ -72,11 +72,6 @@ struct MV64361PCIState {
     uint64_t remap[5];
 };
 
-static int mv64361_pcihost_map_irq(PCIDevice *pci_dev, int n)
-{
-    return (n + PCI_SLOT(pci_dev->devfn)) % PCI_NUM_PINS;
-}
-
 static void mv64361_pcihost_set_irq(void *opaque, int n, int level)
 {
     MV64361PCIState *s = opaque;
@@ -97,7 +92,7 @@ static void mv64361_pcihost_realize(DeviceState *dev, Error **errp)
     g_free(name);
     name = g_strdup_printf("pci.%d", s->index);
     h->bus = pci_register_root_bus(dev, name, mv64361_pcihost_set_irq,
-                                   mv64361_pcihost_map_irq, dev,
+                                   pci_swizzle_map_irq_fn, dev,
                                    &s->mem, &s->io, 0, 4, TYPE_PCI_BUS);
     g_free(name);
     pci_create_simple(h->bus, 0, TYPE_MV64361_PCI_BRIDGE);