Skip to contentSkip to conversation

xio3130: Add map_irq functions

PATCH In review Alex Williamson 2 participants 6 messages Mar 7, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xio3130: Add map_irq functions

Just like root ports, I think these are supposed to be direct mapped.

---
 hw/xio3130_downstream.c |    7 +++++++
 hw/xio3130_upstream.c   |    7 +++++++
 2 files changed, 14 insertions(+)
hw/xio3130_downstream.c +7 -0
index 7f00bc8..c484770 100644
@@ -54,6 +54,11 @@ static void xio3130_downstream_reset(DeviceState *qdev)
     pci_bridge_reset(qdev);
 }
 
+static int xio3130_downstream_map_irq(PCIDevice *pci_dev, int irq_num)
+{
+    return irq_num;
+}
+
 static int xio3130_downstream_initfn(PCIDevice *d)
 {
     PCIBridge* br = DO_UPCAST(PCIBridge, dev, d);
@@ -61,6 +66,8 @@ static int xio3130_downstream_initfn(PCIDevice *d)
     PCIESlot *s = DO_UPCAST(PCIESlot, port, p);
     int rc;
 
+    pci_bridge_map_irq(br, NULL, xio3130_downstream_map_irq);
+
     rc = pci_bridge_initfn(d);
     if (rc < 0) {
         return rc;
hw/xio3130_upstream.c +7 -0
index 70b15d3..c233a43 100644
@@ -51,12 +51,19 @@ static void xio3130_upstream_reset(DeviceState *qdev)
     pcie_cap_deverr_reset(d);
 }
 
+static int xio3130_upstream_map_irq(PCIDevice *pci_dev, int irq_num)
+{
+    return irq_num;
+}
+
 static int xio3130_upstream_initfn(PCIDevice *d)
 {
     PCIBridge* br = DO_UPCAST(PCIBridge, dev, d);
     PCIEPort *p = DO_UPCAST(PCIEPort, br, br);
     int rc;
 
+    pci_bridge_map_irq(br, NULL, xio3130_upstream_map_irq);
+
     rc = pci_bridge_initfn(d);
     if (rc < 0) {
         return rc;
#1 lore raw
Quoted 3 lines · Alex Williamson

Just like root ports, I think these are supposed to be direct mapped.

Hmm, very strange. Why not using standard pci bridge logic? Any idea?

Quoted 54 lines
---
 hw/xio3130_downstream.c |    7 +++++++
 hw/xio3130_upstream.c   |    7 +++++++
 2 files changed, 14 insertions(+)
hw/xio3130_downstream.c +7 -0
index 7f00bc8..c484770 100644
@@ -54,6 +54,11 @@ static void xio3130_downstream_reset(DeviceState *qdev)
     pci_bridge_reset(qdev);
 }
 
+static int xio3130_downstream_map_irq(PCIDevice *pci_dev, int irq_num)
+{
+    return irq_num;
+}
+
 static int xio3130_downstream_initfn(PCIDevice *d)
 {
     PCIBridge* br = DO_UPCAST(PCIBridge, dev, d);
@@ -61,6 +66,8 @@ static int xio3130_downstream_initfn(PCIDevice *d)
     PCIESlot *s = DO_UPCAST(PCIESlot, port, p);
     int rc;
 
+    pci_bridge_map_irq(br, NULL, xio3130_downstream_map_irq);
+
     rc = pci_bridge_initfn(d);
     if (rc < 0) {
         return rc;
hw/xio3130_upstream.c +7 -0
index 70b15d3..c233a43 100644
@@ -51,12 +51,19 @@ static void xio3130_upstream_reset(DeviceState *qdev)
     pcie_cap_deverr_reset(d);
 }
 
+static int xio3130_upstream_map_irq(PCIDevice *pci_dev, int irq_num)
+{
+    return irq_num;
+}
+
 static int xio3130_upstream_initfn(PCIDevice *d)
 {
     PCIBridge* br = DO_UPCAST(PCIBridge, dev, d);
     PCIEPort *p = DO_UPCAST(PCIEPort, br, br);
     int rc;
 
+    pci_bridge_map_irq(br, NULL, xio3130_upstream_map_irq);
+
     rc = pci_bridge_initfn(d);
     if (rc < 0) {
         return rc;
#2 lore raw
Quoted 7 lines · Michael S. Tsirkin
Quoted 3 lines · Alex Williamson

Just like root ports, I think these are supposed to be direct mapped.

Hmm, very strange. Why not using standard pci bridge logic? Any idea?

Where is it supposed to get set for a bridge? I see:

int pci_bridge_initfn(PCIDevice *dev)
{
...

    sec_bus->map_irq = br->map_irq;

But nobody is calling pci_bridge_map_irq() to set that, so that's what I added. Thanks,

Alex

Quoted 54 lines
Quoted 54 lines
---
 hw/xio3130_downstream.c |    7 +++++++
 hw/xio3130_upstream.c   |    7 +++++++
 2 files changed, 14 insertions(+)
hw/xio3130_downstream.c +7 -0
index 7f00bc8..c484770 100644
@@ -54,6 +54,11 @@ static void xio3130_downstream_reset(DeviceState *qdev)
     pci_bridge_reset(qdev);
 }
 
+static int xio3130_downstream_map_irq(PCIDevice *pci_dev, int irq_num)
+{
+    return irq_num;
+}
+
 static int xio3130_downstream_initfn(PCIDevice *d)
 {
     PCIBridge* br = DO_UPCAST(PCIBridge, dev, d);
@@ -61,6 +66,8 @@ static int xio3130_downstream_initfn(PCIDevice *d)
     PCIESlot *s = DO_UPCAST(PCIESlot, port, p);
     int rc;
 
+    pci_bridge_map_irq(br, NULL, xio3130_downstream_map_irq);
+
     rc = pci_bridge_initfn(d);
     if (rc < 0) {
         return rc;
hw/xio3130_upstream.c +7 -0
index 70b15d3..c233a43 100644
@@ -51,12 +51,19 @@ static void xio3130_upstream_reset(DeviceState *qdev)
     pcie_cap_deverr_reset(d);
 }
 
+static int xio3130_upstream_map_irq(PCIDevice *pci_dev, int irq_num)
+{
+    return irq_num;
+}
+
 static int xio3130_upstream_initfn(PCIDevice *d)
 {
     PCIBridge* br = DO_UPCAST(PCIBridge, dev, d);
     PCIEPort *p = DO_UPCAST(PCIEPort, br, br);
     int rc;
 
+    pci_bridge_map_irq(br, NULL, xio3130_upstream_map_irq);
+
     rc = pci_bridge_initfn(d);
     if (rc < 0) {
         return rc;
#3 lore raw
Quoted 14 lines · Alex Williamson
Quoted 7 lines · Michael S. Tsirkin
Quoted 3 lines · Alex Williamson

Just like root ports, I think these are supposed to be direct mapped.

Hmm, very strange. Why not using standard pci bridge logic? Any idea?

Where is it supposed to get set for a bridge? I see:

int pci_bridge_initfn(PCIDevice *dev)
{
...

Quoted 6 lines
    sec_bus->map_irq = br->map_irq;

But nobody is calling pci_bridge_map_irq() to set that, so that's what I added. Thanks,

Alex

Yes but shouldn't this be using standard PCI mapping, like pci_bridge_dev_map_irq_fn in pci_bridge_dev?

We really should make it the default if nothing is set ...

Quoted 56 lines
Quoted 54 lines
Quoted 54 lines
---
 hw/xio3130_downstream.c |    7 +++++++
 hw/xio3130_upstream.c   |    7 +++++++
 2 files changed, 14 insertions(+)
hw/xio3130_downstream.c +7 -0
index 7f00bc8..c484770 100644
@@ -54,6 +54,11 @@ static void xio3130_downstream_reset(DeviceState *qdev)
     pci_bridge_reset(qdev);
 }
 
+static int xio3130_downstream_map_irq(PCIDevice *pci_dev, int irq_num)
+{
+    return irq_num;
+}
+
 static int xio3130_downstream_initfn(PCIDevice *d)
 {
     PCIBridge* br = DO_UPCAST(PCIBridge, dev, d);
@@ -61,6 +66,8 @@ static int xio3130_downstream_initfn(PCIDevice *d)
     PCIESlot *s = DO_UPCAST(PCIESlot, port, p);
     int rc;
 
+    pci_bridge_map_irq(br, NULL, xio3130_downstream_map_irq);
+
     rc = pci_bridge_initfn(d);
     if (rc < 0) {
         return rc;
hw/xio3130_upstream.c +7 -0
index 70b15d3..c233a43 100644
@@ -51,12 +51,19 @@ static void xio3130_upstream_reset(DeviceState *qdev)
     pcie_cap_deverr_reset(d);
 }
 
+static int xio3130_upstream_map_irq(PCIDevice *pci_dev, int irq_num)
+{
+    return irq_num;
+}
+
 static int xio3130_upstream_initfn(PCIDevice *d)
 {
     PCIBridge* br = DO_UPCAST(PCIBridge, dev, d);
     PCIEPort *p = DO_UPCAST(PCIEPort, br, br);
     int rc;
 
+    pci_bridge_map_irq(br, NULL, xio3130_upstream_map_irq);
+
     rc = pci_bridge_initfn(d);
     if (rc < 0) {
         return rc;
#4 lore raw
Quoted 20 lines · Michael S. Tsirkin
Quoted 19 lines · Alex Williamson
Quoted 7 lines · Michael S. Tsirkin
Quoted 3 lines · Alex Williamson

Just like root ports, I think these are supposed to be direct mapped.

Hmm, very strange. Why not using standard pci bridge logic? Any idea?

Where is it supposed to get set for a bridge? I see:

int pci_bridge_initfn(PCIDevice *dev)
{
...

    sec_bus->map_irq = br->map_irq;

But nobody is calling pci_bridge_map_irq() to set that, so that's what I added. Thanks,

Quoted 6 lines
Quoted 1 line

Alex

Yes but shouldn't this be using standard PCI mapping, like pci_bridge_dev_map_irq_fn in pci_bridge_dev?

We really should make it the default if nothing is set ...

Ok, I'll try using that if not set, the swizzle may well be the correct function. I take it you haven't applied the ioh3420 patch doing the same yet then either? Thanks,

Alex

Quoted 56 lines
Quoted 56 lines
Quoted 54 lines
Quoted 54 lines
---
 hw/xio3130_downstream.c |    7 +++++++
 hw/xio3130_upstream.c   |    7 +++++++
 2 files changed, 14 insertions(+)
hw/xio3130_downstream.c +7 -0
index 7f00bc8..c484770 100644
@@ -54,6 +54,11 @@ static void xio3130_downstream_reset(DeviceState *qdev)
     pci_bridge_reset(qdev);
 }
 
+static int xio3130_downstream_map_irq(PCIDevice *pci_dev, int irq_num)
+{
+    return irq_num;
+}
+
 static int xio3130_downstream_initfn(PCIDevice *d)
 {
     PCIBridge* br = DO_UPCAST(PCIBridge, dev, d);
@@ -61,6 +66,8 @@ static int xio3130_downstream_initfn(PCIDevice *d)
     PCIESlot *s = DO_UPCAST(PCIESlot, port, p);
     int rc;
 
+    pci_bridge_map_irq(br, NULL, xio3130_downstream_map_irq);
+
     rc = pci_bridge_initfn(d);
     if (rc < 0) {
         return rc;
hw/xio3130_upstream.c +7 -0
index 70b15d3..c233a43 100644
@@ -51,12 +51,19 @@ static void xio3130_upstream_reset(DeviceState *qdev)
     pcie_cap_deverr_reset(d);
 }
 
+static int xio3130_upstream_map_irq(PCIDevice *pci_dev, int irq_num)
+{
+    return irq_num;
+}
+
 static int xio3130_upstream_initfn(PCIDevice *d)
 {
     PCIBridge* br = DO_UPCAST(PCIBridge, dev, d);
     PCIEPort *p = DO_UPCAST(PCIEPort, br, br);
     int rc;
 
+    pci_bridge_map_irq(br, NULL, xio3130_upstream_map_irq);
+
     rc = pci_bridge_initfn(d);
     if (rc < 0) {
         return rc;
#5 lore raw
Quoted 26 lines · Alex Williamson
Quoted 25 lines · Michael S. Tsirkin
Quoted 14 lines · Alex Williamson
Quoted 7 lines · Michael S. Tsirkin
Quoted 3 lines · Alex Williamson

Just like root ports, I think these are supposed to be direct mapped.

Hmm, very strange. Why not using standard pci bridge logic? Any idea?

Where is it supposed to get set for a bridge? I see:

int pci_bridge_initfn(PCIDevice *dev)
{
...

Quoted 6 lines
    sec_bus->map_irq = br->map_irq;

But nobody is calling pci_bridge_map_irq() to set that, so that's what I added. Thanks,

Alex

Yes but shouldn't this be using standard PCI mapping, like pci_bridge_dev_map_irq_fn in pci_bridge_dev?

Quoted 7 lines
Quoted 1 line

We really should make it the default if nothing is set ...

Ok, I'll try using that if not set, the swizzle may well be the correct function. I take it you haven't applied the ioh3420 patch doing the same yet then either? Thanks,

Alex

Nope.

Quoted 58 lines
Quoted 56 lines
Quoted 56 lines
Quoted 54 lines
Quoted 54 lines
---
 hw/xio3130_downstream.c |    7 +++++++
 hw/xio3130_upstream.c   |    7 +++++++
 2 files changed, 14 insertions(+)
hw/xio3130_downstream.c +7 -0
index 7f00bc8..c484770 100644
@@ -54,6 +54,11 @@ static void xio3130_downstream_reset(DeviceState *qdev)
     pci_bridge_reset(qdev);
 }
 
+static int xio3130_downstream_map_irq(PCIDevice *pci_dev, int irq_num)
+{
+    return irq_num;
+}
+
 static int xio3130_downstream_initfn(PCIDevice *d)
 {
     PCIBridge* br = DO_UPCAST(PCIBridge, dev, d);
@@ -61,6 +66,8 @@ static int xio3130_downstream_initfn(PCIDevice *d)
     PCIESlot *s = DO_UPCAST(PCIESlot, port, p);
     int rc;
 
+    pci_bridge_map_irq(br, NULL, xio3130_downstream_map_irq);
+
     rc = pci_bridge_initfn(d);
     if (rc < 0) {
         return rc;
hw/xio3130_upstream.c +7 -0
index 70b15d3..c233a43 100644
@@ -51,12 +51,19 @@ static void xio3130_upstream_reset(DeviceState *qdev)
     pcie_cap_deverr_reset(d);
 }
 
+static int xio3130_upstream_map_irq(PCIDevice *pci_dev, int irq_num)
+{
+    return irq_num;
+}
+
 static int xio3130_upstream_initfn(PCIDevice *d)
 {
     PCIBridge* br = DO_UPCAST(PCIBridge, dev, d);
     PCIEPort *p = DO_UPCAST(PCIEPort, br, br);
     int rc;
 
+    pci_bridge_map_irq(br, NULL, xio3130_upstream_map_irq);
+
     rc = pci_bridge_initfn(d);
     if (rc < 0) {
         return rc;