From: Jason Wang <jasowang@redhat.com>
To: Dongli Zhang <dongli.zhang@oracle.com>, qemu-devel@nongnu.org
Cc: berrange@redhat.com, ehabkost@redhat.com, mst@redhat.com,
joe.jin@oracle.com, dgilbert@redhat.com, pbonzini@redhat.com
Subject: Re: [PATCH RESEND v2 2/3] msix/hmp: add interface to dump device specific info
Date: Tue, 13 Jul 2021 12:14:22 +0800 [thread overview]
Message-ID: <d90f764f-ba01-1968-3413-61b4ebbc76fb@redhat.com> (raw)
In-Reply-To: <20210712235812.19725-3-dongli.zhang@oracle.com>
在 2021/7/13 上午7:58, Dongli Zhang 写道:
> While the previous patch is to dump the MSI-X table, sometimes we may
> need to dump device specific data, e.g., to help match the vector with
> the specific device queue.
>
> This patch is to add the PCI device specific interface to help dump
> those information. Any PCI device class may implement this
> PCIDeviceClass->msix_info interface.
>
> Cc: Jason Wang <jasowang@redhat.com>
> Cc: Joe Jin <joe.jin@oracle.com>
> Suggested-by: Jason Wang <jasowang@redhat.com>
> Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
Acked-by: Jason Wang <jasowang@redhat.com>
> ---
> hmp-commands-info.hx | 7 ++++---
> include/hw/pci/pci.h | 3 +++
> softmmu/qdev-monitor.c | 11 +++++++++++
> 3 files changed, 18 insertions(+), 3 deletions(-)
>
> diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
> index ce5c550d44..4e831d7ae4 100644
> --- a/hmp-commands-info.hx
> +++ b/hmp-commands-info.hx
> @@ -223,9 +223,10 @@ ERST
>
> {
> .name = "msix",
> - .args_type = "dev:s",
> - .params = "dev",
> - .help = "dump MSI-X information",
> + .args_type = "info:-d,dev:s",
> + .params = "[-d] dev",
> + .help = "dump MSI-X information; "
> + "(-d: show device specific info)",
> .cmd = hmp_info_msix,
> },
>
> diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
> index 6be4e0c460..4620b9e757 100644
> --- a/include/hw/pci/pci.h
> +++ b/include/hw/pci/pci.h
> @@ -129,6 +129,8 @@ typedef void PCIMapIORegionFunc(PCIDevice *pci_dev, int region_num,
> pcibus_t addr, pcibus_t size, int type);
> typedef void PCIUnregisterFunc(PCIDevice *pci_dev);
>
> +typedef void PCIMSIXInfoFunc(Monitor *mon, PCIDevice *dev, Error **errp);
> +
> typedef struct PCIIORegion {
> pcibus_t addr; /* current PCI mapping address. -1 means not mapped */
> #define PCI_BAR_UNMAPPED (~(pcibus_t)0)
> @@ -224,6 +226,7 @@ struct PCIDeviceClass {
> PCIUnregisterFunc *exit;
> PCIConfigReadFunc *config_read;
> PCIConfigWriteFunc *config_write;
> + PCIMSIXInfoFunc *msix_info;
>
> uint16_t vendor_id;
> uint16_t device_id;
> diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c
> index 7837a17d0d..7fd3fe0ada 100644
> --- a/softmmu/qdev-monitor.c
> +++ b/softmmu/qdev-monitor.c
> @@ -1011,7 +1011,9 @@ void hmp_info_msix(Monitor *mon, const QDict *qdict)
> {
> const char *name = qdict_get_str(qdict, "dev");
> DeviceState *dev = find_device_state(name, NULL);
> + bool info = qdict_get_try_bool(qdict, "info", false);
> PCIDevice *pci_dev;
> + PCIDeviceClass *pc;
> Error *err = NULL;
>
> if (!dev) {
> @@ -1027,6 +1029,15 @@ void hmp_info_msix(Monitor *mon, const QDict *qdict)
> pci_dev = PCI_DEVICE(dev);
> msix_dump_info(mon, pci_dev, &err);
>
> + if (info) {
> + pc = PCI_DEVICE_GET_CLASS(pci_dev);
> + if (pc->msix_info) {
> + pc->msix_info(mon, pci_dev, &err);
> + } else {
> + error_setg(&err, "Device specific info not supported");
> + }
> + }
> +
> exit:
> hmp_handle_error(mon, err);
> }
next prev parent reply other threads:[~2021-07-13 4:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-12 23:58 [PATCH RESEND v2 0/3] To add HMP interface to dump PCI MSI-X table/PBA Dongli Zhang
2021-07-12 23:58 ` [PATCH RESEND v2 1/3] msix/hmp: add hmp interface to dump MSI-X info Dongli Zhang
2021-07-13 4:00 ` Jason Wang
2021-07-12 23:58 ` [PATCH RESEND v2 2/3] msix/hmp: add interface to dump device specific info Dongli Zhang
2021-07-13 4:14 ` Jason Wang [this message]
2021-07-12 23:58 ` [PATCH RESEND v2 3/3] virtio-pci/hmp: implement device specific hmp interface Dongli Zhang
2021-07-13 4:16 ` Jason Wang
2021-07-13 20:59 ` [PATCH RESEND v2 0/3] To add HMP interface to dump PCI MSI-X table/PBA Michael S. Tsirkin
2021-07-13 22:30 ` Dongli Zhang
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=d90f764f-ba01-1968-3413-61b4ebbc76fb@redhat.com \
--to=jasowang@redhat.com \
--cc=berrange@redhat.com \
--cc=dgilbert@redhat.com \
--cc=dongli.zhang@oracle.com \
--cc=ehabkost@redhat.com \
--cc=joe.jin@oracle.com \
--cc=mst@redhat.com \
--cc=pbonzini@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 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).