Skip to contentSkip to conversation

pci-assign: Use proper pin number for INTx-to-IRQ routing

PATCH In review Jan Kiszka 2 participants 2 messages Aug 29, 2012 KVM

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 pci-assign: Use proper pin number for INTx-to-IRQ routing

Broken by commit e21f28b497.

---
 hw/kvm/pci-assign.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
hw/kvm/pci-assign.c +1 -1
index 9cce02c..fea05b4 100644
@@ -892,7 +892,7 @@ static int assign_intx(AssignedDevice *dev)
     pci_device_set_intx_routing_notifier(&dev->dev,
                                          assigned_dev_update_irq_routing);
 
-    intx_route = pci_device_route_intx_to_irq(&dev->dev, 0);
+    intx_route = pci_device_route_intx_to_irq(&dev->dev, dev->intpin);
     assert(intx_route.mode != PCI_INTX_INVERTED);
 
     if (dev->intx_route.mode == intx_route.mode &&
Signature · 1 line
1.7.3.4
#1 lore raw
Quoted 12 lines · Jan Kiszka

Broken by commit e21f28b497.

---
 hw/kvm/pci-assign.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
hw/kvm/pci-assign.c +0 -0
index 9cce02c..fea05b4 100644

hw/kvm/pci-assign.c static int assign_intx(AssignedDevice *dev) · line 898

Quoted 8 lines
hw/kvm/pci-assign.c +1 -1
@@ -892,7 +892,7 @@ static int assign_intx(AssignedDevice *dev)
     pci_device_set_intx_routing_notifier(&dev->dev,
                                          assigned_dev_update_irq_routing);
 
-    intx_route = pci_device_route_intx_to_irq(&dev->dev, 0);
+    intx_route = pci_device_route_intx_to_irq(&dev->dev, dev->intpin);
     assert(intx_route.mode != PCI_INTX_INVERTED);
 
     if (dev->intx_route.mode == intx_route.mode &&

Hmm but looking at it, I see a different problem:

   /* handle interrupt routing */
    e_intx = dev->dev.config[0x3d] - 1;
    dev->intpin = e_intx;

PCI spec however says:

PCI defines one interrupt line for a single function device and up to four interrupt lines for a multi-function6 device or connector. For a single function device, only INTA# may be used while the other three interrupt lines have no meaning.

And:
When several independent functions are integrated into a single device, it will be referred to as a multi-
function device. Each function on a multi-function device has its own configuration space.

So this is not easily virtualizeable.
I think in practice it should be only legal to assign VFs or all functions of a physical device in one go.

In last case, we can then make sure function numbers match.

Alex?

Quoted 2 lines
Signature · 1 line
1.7.3.4