From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Peter Xu <peterx@redhat.com>
Cc: "Michael S . Tsirkin" <mst@redhat.com>,
Julia Suvorova <jusual@redhat.com>,
Markus Armbruster <armbru@redhat.com>,
qemu-devel@nongnu.org,
Alex Williamson <alex.williamson@redhat.com>
Subject: Re: [PATCH] pci: Display PCI IRQ pin in "info pci"
Date: Wed, 18 Mar 2020 09:23:57 +0000 [thread overview]
Message-ID: <20200318092357.GB2850@work-vm> (raw)
In-Reply-To: <20200317203659.GC233068@xz-x1>
* Peter Xu (peterx@redhat.com) wrote:
> On Tue, Mar 17, 2020 at 08:21:17PM +0000, Dr. David Alan Gilbert wrote:
> > * Peter Xu (peterx@redhat.com) wrote:
> > > 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));
> >
> > Can we trust dev->irq_pin not to be something silly and generate a
> > non-printable?
>
> It should be strictly a value between 1-4 corresponds to irq pin A-D
> (note the has_irq check masked out the zero value, or it could be
> 0-4), so I think it should always make sense. Otherwise I see it a
> qemu bug somewhere...
OK, then
Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
for HMP.
Dave
> Thanks,
>
> --
> Peter Xu
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2020-03-18 9:24 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200318092357.GB2850@work-vm \
--to=dgilbert@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=armbru@redhat.com \
--cc=jusual@redhat.com \
--cc=mst@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.