qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pci: Display PCI IRQ pin in "info pci"
@ 2020-03-17 19:59 Peter Xu
  2020-03-17 20:02 ` Eric Blake
                   ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: Peter Xu @ 2020-03-17 19:59 UTC (permalink / raw)
  To: qemu-devel
  Cc: Michael S . Tsirkin, Julia Suvorova, Dr . David Alan Gilbert,
	peterx, Markus Armbruster, Alex Williamson

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 <dgilbert@redhat.com>
CC: Alex Williamson <alex.williamson@redhat.com>
CC: Michael S. Tsirkin <mst@redhat.com>
CC: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
CC: Julia Suvorova <jusual@redhat.com>
CC: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
---

This helped me to debug an IRQ sharing issue, so may good to have it
in master too.
---
 hw/pci/pci.c       | 1 +
 monitor/hmp-cmds.c | 3 ++-
 qapi/misc.json     | 6 ++++--
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index e1ed6677e1..7ebf532ac9 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -1769,6 +1769,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];
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index 58724031ea..04c86bbb03 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -680,7 +680,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) {
diff --git a/qapi/misc.json b/qapi/misc.json
index c18fe681fb..f8d33ddb4e 100644
--- a/qapi/misc.json
+++ b/qapi/misc.json
@@ -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
@@ -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:
-- 
2.24.1



^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2020-06-09 18:12 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-17 19:59 [PATCH] pci: Display PCI IRQ pin in "info pci" Peter Xu
2020-03-17 20:02 ` Eric Blake
2020-03-17 20:11   ` Peter Xu
2020-03-18 17:06     ` Philippe Mathieu-Daudé
2020-06-09 15:49       ` Michael S. Tsirkin
2020-06-09 16:13         ` Peter Xu
2020-06-09 16:18           ` Philippe Mathieu-Daudé
2020-06-09 17:53             ` Peter Xu
2020-06-09 18:09               ` Michael S. Tsirkin
2020-03-17 20:21 ` Dr. David Alan Gilbert
2020-03-17 20:36   ` Peter Xu
2020-03-18  9:23     ` Dr. David Alan Gilbert
2020-05-23 20:34 ` Peter Xu
2020-05-25  8:19 ` Markus Armbruster
2020-05-25 14:14   ` Peter Xu
2020-05-26  8:27     ` Markus Armbruster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).