Skip to content

Commit 28566ea

Browse files
philmdmstsirkin
authored andcommitted
hw/pci: Trace IRQ routing on PCI topology
Trace how IRQ are rooted from EP to RC. Signed-off-by: Philippe Mathieu-Daudé <[email protected]> Message-Id: <[email protected]> Reviewed-by: Michael S. Tsirkin <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]>
1 parent 9c19160 commit 28566ea

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

hw/pci/pci.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,13 @@ static void pci_change_irq_level(PCIDevice *pci_dev, int irq_num, int change)
279279
{
280280
PCIBus *bus;
281281
for (;;) {
282+
int dev_irq = irq_num;
282283
bus = pci_get_bus(pci_dev);
283284
assert(bus->map_irq);
284285
irq_num = bus->map_irq(pci_dev, irq_num);
286+
trace_pci_route_irq(dev_irq, DEVICE(pci_dev)->canonical_path, irq_num,
287+
pci_bus_is_root(bus) ? "root-complex"
288+
: DEVICE(bus->parent_dev)->canonical_path);
285289
if (bus->set_irq)
286290
break;
287291
pci_dev = bus->parent_dev;
@@ -1600,8 +1604,12 @@ PCIINTxRoute pci_device_route_intx_to_irq(PCIDevice *dev, int pin)
16001604
PCIBus *bus;
16011605

16021606
do {
1607+
int dev_irq = pin;
16031608
bus = pci_get_bus(dev);
16041609
pin = bus->map_irq(dev, pin);
1610+
trace_pci_route_irq(dev_irq, DEVICE(dev)->canonical_path, pin,
1611+
pci_bus_is_root(bus) ? "root-complex"
1612+
: DEVICE(bus->parent_dev)->canonical_path);
16051613
dev = bus->parent_dev;
16061614
} while (dev);
16071615

hw/pci/trace-events

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# pci.c
44
pci_update_mappings_del(const char *dev, uint32_t bus, uint32_t slot, uint32_t func, int bar, uint64_t addr, uint64_t size) "%s %02x:%02x.%x %d,0x%"PRIx64"+0x%"PRIx64
55
pci_update_mappings_add(const char *dev, uint32_t bus, uint32_t slot, uint32_t func, int bar, uint64_t addr, uint64_t size) "%s %02x:%02x.%x %d,0x%"PRIx64"+0x%"PRIx64
6+
pci_route_irq(int dev_irq, const char *dev_path, int parent_irq, const char *parent_path) "IRQ %d @%s -> IRQ %d @%s"
67

78
# pci_host.c
89
pci_cfg_read(const char *dev, uint32_t bus, uint32_t slot, uint32_t func, unsigned offs, unsigned val) "%s %02x:%02x.%x @0x%x -> 0x%x"

0 commit comments

Comments
 (0)