mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jason Andryuk <jason.andryuk@amd.com>
To: Juergen Gross <jgross@suse.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>,
	Jiqian Chen <Jiqian.Chen@amd.com>, Huang Rui <ray.huang@amd.com>
Cc: Jason Andryuk <jason.andryuk@amd.com>, <stable@vger.kernel.org>,
	<xen-devel@lists.xenproject.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH] xen/pciback: Make missing GSI non-fatal
Date: Wed, 26 Feb 2025 15:01:34 -0500	[thread overview]
Message-ID: <20250226200134.29759-1-jason.andryuk@amd.com> (raw)

A PCI may not have a legacy IRQ.  In that case, do not fail assigning
to the pciback stub.  Instead just skip xen_pvh_setup_gsi().

This will leave psdev->gsi == -1.  In that case, when reading the value
via IOCTL_PRIVCMD_PCIDEV_GET_GSI, return -ENOENT.  Userspace can used
this to distinquish from other errors.

Fixes: b166b8ab4189 ("xen/pvh: Setup gsi for passthrough device")
Cc: stable@vger.kernel.org
Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
---
 drivers/xen/acpi.c                 |  4 ++--
 drivers/xen/xen-pciback/pci_stub.c | 17 ++++++++++-------
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/xen/acpi.c b/drivers/xen/acpi.c
index d2ee605c5ca1..d6ab0cb3ba3f 100644
--- a/drivers/xen/acpi.c
+++ b/drivers/xen/acpi.c
@@ -101,7 +101,7 @@ int xen_acpi_get_gsi_info(struct pci_dev *dev,
 
 	pin = dev->pin;
 	if (!pin)
-		return -EINVAL;
+		return -ENOENT;
 
 	entry = acpi_pci_irq_lookup(dev, pin);
 	if (entry) {
@@ -116,7 +116,7 @@ int xen_acpi_get_gsi_info(struct pci_dev *dev,
 		gsi = -1;
 
 	if (gsi < 0)
-		return -EINVAL;
+		return -ENOENT;
 
 	*gsi_out = gsi;
 	*trigger_out = trigger;
diff --git a/drivers/xen/xen-pciback/pci_stub.c b/drivers/xen/xen-pciback/pci_stub.c
index b616b7768c3b..9715c2f70586 100644
--- a/drivers/xen/xen-pciback/pci_stub.c
+++ b/drivers/xen/xen-pciback/pci_stub.c
@@ -240,6 +240,9 @@ static int pcistub_get_gsi_from_sbdf(unsigned int sbdf)
 	if (!psdev)
 		return -ENODEV;
 
+	if (psdev->gsi == -1)
+		return -ENOENT;
+
 	return psdev->gsi;
 }
 #endif
@@ -475,14 +478,14 @@ static int pcistub_init_device(struct pcistub_device *psdev)
 #ifdef CONFIG_XEN_ACPI
 	if (xen_initial_domain() && xen_pvh_domain()) {
 		err = xen_acpi_get_gsi_info(dev, &gsi, &trigger, &polarity);
-		if (err) {
-			dev_err(&dev->dev, "Fail to get gsi info!\n");
-			goto config_release;
+		if (err && err != -ENOENT) {
+			dev_err(&dev->dev, "Failed to get gsi info! %d\n", err);
+		} else if (!err) {
+			err = xen_pvh_setup_gsi(gsi, trigger, polarity);
+			if (err)
+				goto config_release;
+			psdev->gsi = gsi;
 		}
-		err = xen_pvh_setup_gsi(gsi, trigger, polarity);
-		if (err)
-			goto config_release;
-		psdev->gsi = gsi;
 	}
 #endif
 
-- 
2.34.1


             reply	other threads:[~2025-02-26 20:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-26 20:01 Jason Andryuk [this message]
2025-02-27  3:36 ` Chen, Jiqian
2025-02-27 14:57   ` Jason Andryuk
2025-02-27  8:23 ` Jan Beulich
2025-02-27 15:19   ` Jason Andryuk

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=20250226200134.29759-1-jason.andryuk@amd.com \
    --to=jason.andryuk@amd.com \
    --cc=Jiqian.Chen@amd.com \
    --cc=jgross@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleksandr_tyshchenko@epam.com \
    --cc=ray.huang@amd.com \
    --cc=sstabellini@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=xen-devel@lists.xenproject.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

all inboxes | Powered by JetHome®