mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Jason Andryuk <jason.andryuk@amd.com>
Cc: stable@vger.kernel.org, xen-devel@lists.xenproject.org,
	linux-kernel@vger.kernel.org, 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>
Subject: Re: [PATCH] xen/pciback: Make missing GSI non-fatal
Date: Thu, 27 Feb 2025 09:23:35 +0100	[thread overview]
Message-ID: <22a46f43-d60c-465d-9ae7-4d84ca9108d4@suse.com> (raw)
In-Reply-To: <20250226200134.29759-1-jason.andryuk@amd.com>

On 26.02.2025 21:01, Jason Andryuk wrote:
> A PCI may not have a legacy IRQ.  In that case, do not fail assigning

Nit: Missing "device".

> 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

Nit: "use".

> this to distinquish from other errors.

Nit: "distinguish".

> --- 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) {

While I can understand this change, ...

> @@ -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;

... I'd expect this needs to keep using an error code other than ENOENT.
Aiui this path means the device has a pin-based interrupt, just that it's
not configured correctly. In which case we'd better not allow the device
to be handed to a guest. Unless there's logic in place (somewhere) to
make sure it then would get to see a device without pin-based interrupt.

> --- 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;

This may, aiui, mean either of the two situations above. They would then
need distinguishing, too, if user space is intended to derive decisions
from the error code it gets.

Jan

  parent reply	other threads:[~2025-02-27  8:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-26 20:01 Jason Andryuk
2025-02-27  3:36 ` Chen, Jiqian
2025-02-27 14:57   ` Jason Andryuk
2025-02-27  8:23 ` Jan Beulich [this message]
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=22a46f43-d60c-465d-9ae7-4d84ca9108d4@suse.com \
    --to=jbeulich@suse.com \
    --cc=Jiqian.Chen@amd.com \
    --cc=jason.andryuk@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®