Skip to content

Commit

Permalink
pci: Display PCI IRQ pin in "info pci"
Browse files Browse the repository at this point in the history
Sometimes it would be good to be able to read the pin number along
with the IRQ number allocated.  Since we'll dump the IRQ number, no
reason to not dump the pin information.  For example, the vfio-pci
device will overwrite the pin with the hardware pin number.  It would
be nice to know the pin number of one assigned device from QMP/HMP.

CC: Dr. David Alan Gilbert <[email protected]>
CC: Alex Williamson <[email protected]>
CC: Michael S. Tsirkin <[email protected]>
CC: Marcel Apfelbaum <[email protected]>
CC: Julia Suvorova <[email protected]>
CC: Markus Armbruster <[email protected]>
Signed-off-by: Peter Xu <[email protected]>
Message-Id: <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Acked-by: Dr. David Alan Gilbert <[email protected]>
Acked-by: Markus Armbruster <[email protected]>
  • Loading branch information
xzpeter authored and mstsirkin committed Jun 12, 2020
1 parent 62925fd commit 12fcf49
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions hw/pci/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -1776,6 +1776,7 @@ static PciDeviceInfo *qmp_query_pci_device(PCIDevice *dev, PCIBus *bus,
info->regions = qmp_query_pci_regions(dev);
info->qdev_id = g_strdup(dev->qdev.id ? dev->qdev.id : "");

info->irq_pin = dev->config[PCI_INTERRUPT_PIN];
if (dev->config[PCI_INTERRUPT_PIN] != 0) {
info->has_irq = true;
info->irq = dev->config[PCI_INTERRUPT_LINE];
Expand Down
3 changes: 2 additions & 1 deletion monitor/hmp-cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,8 @@ static void hmp_info_pci_device(Monitor *mon, const PciDeviceInfo *dev)
}

if (dev->has_irq) {
monitor_printf(mon, " IRQ %" PRId64 ".\n", dev->irq);
monitor_printf(mon, " IRQ %" PRId64 ", pin %c\n",
dev->irq, (char)('A' + dev->irq_pin - 1));
}

if (dev->has_pci_bridge) {
Expand Down
6 changes: 4 additions & 2 deletions qapi/misc.json
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,8 @@
#
# @irq: if an IRQ is assigned to the device, the IRQ number
#
# @irq_pin: the IRQ pin, zero means no IRQ (since 5.1)
#
# @qdev_id: the device name of the PCI device
#
# @pci_bridge: if the device is a PCI bridge, the bridge information
Expand All @@ -417,8 +419,8 @@
{ 'struct': 'PciDeviceInfo',
'data': {'bus': 'int', 'slot': 'int', 'function': 'int',
'class_info': 'PciDeviceClass', 'id': 'PciDeviceId',
'*irq': 'int', 'qdev_id': 'str', '*pci_bridge': 'PciBridgeInfo',
'regions': ['PciMemoryRegion']} }
'*irq': 'int', 'irq_pin': 'int', 'qdev_id': 'str',
'*pci_bridge': 'PciBridgeInfo', 'regions': ['PciMemoryRegion'] }}

##
# @PciInfo:
Expand Down

0 comments on commit 12fcf49

Please sign in to comment.