From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
To: Hans Zhang <18255117159@163.com>
Cc: tglx@linutronix.de, kw@linux.com, kwilczynski@kernel.org,
bhelgaas@google.com, cassel@kernel.org,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] genirq/msi: Add the address and data that show MSI/MSIX
Date: Thu, 27 Feb 2025 22:09:37 +0530 [thread overview]
Message-ID: <20250227163937.wv4hsucatyandde3@thinkpad> (raw)
In-Reply-To: <20250227162821.253020-1-18255117159@163.com>
On Fri, Feb 28, 2025 at 12:28:21AM +0800, Hans Zhang wrote:
> Add to view the addresses and data stored in the MSI capability or the
> addresses and data stored in the MSIX vector table.
>
> e.g.
> root@root:/sys/bus/pci/devices/<dev>/msi_irqs# ls
> 86 87 88 89
> root@root:/sys/bus/pci/devices/<dev>/msi_irqs# cat *
> msix
> address_hi: 0x00000000
> address_lo: 0x0e060040
> msg_data: 0x00000000
> msix
> address_hi: 0x00000000
> address_lo: 0x0e060040
> msg_data: 0x00000001
> msix
> address_hi: 0x00000000
> address_lo: 0x0e060040
> msg_data: 0x00000002
> msix
> address_hi: 0x00000000
> address_lo: 0x0e060040
> msg_data: 0x00000003
>
> Signed-off-by: Hans Zhang <18255117159@163.com>
> ---
> kernel/irq/msi.c | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c
> index 396a067a8a56..a37a3e535fb8 100644
> --- a/kernel/irq/msi.c
> +++ b/kernel/irq/msi.c
> @@ -503,8 +503,18 @@ static ssize_t msi_mode_show(struct device *dev, struct device_attribute *attr,
> {
> /* MSI vs. MSIX is per device not per interrupt */
> bool is_msix = dev_is_pci(dev) ? to_pci_dev(dev)->msix_enabled : false;
> + struct msi_desc *desc;
> + u32 irq;
> +
> + if (kstrtoint(attr->attr.name, 10, &irq) < 0)
> + return 0;
>
> - return sysfs_emit(buf, "%s\n", is_msix ? "msix" : "msi");
> + desc = irq_get_msi_desc(irq);
> + return sysfs_emit(
> + buf,
> + "%s\n address_hi: 0x%08x\n address_lo: 0x%08x\n msg_data: 0x%08x\n",
> + is_msix ? "msix" : "msi", desc->msg.address_hi,
> + desc->msg.address_lo, desc->msg.data);
Sysfs is an ABI. You cannot change the semantics of an attribute.
- Mani
--
மணிவண்ணன் சதாசிவம்
next prev parent reply other threads:[~2025-02-27 16:39 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-27 16:28 [PATCH] genirq/msi: Add the address and data that show MSI/MSIX Hans Zhang
2025-02-27 16:39 ` Manivannan Sadhasivam [this message]
2025-02-27 16:49 ` Hans Zhang
2025-02-27 18:03 ` Frank Li
2025-02-28 9:00 ` Hans Zhang
2025-02-27 17:51 ` Thomas Gleixner
2025-02-28 9:04 ` Hans Zhang
2025-02-28 11:26 ` Thomas Gleixner
2025-02-28 15:17 ` Hans Zhang
2025-02-28 18:14 ` Thomas Gleixner
2025-03-01 12:33 ` Hans 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=20250227163937.wv4hsucatyandde3@thinkpad \
--to=manivannan.sadhasivam@linaro.org \
--cc=18255117159@163.com \
--cc=bhelgaas@google.com \
--cc=cassel@kernel.org \
--cc=kw@linux.com \
--cc=kwilczynski@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=tglx@linutronix.de \
/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