[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <b192632a-7b30-4227-96b8-84a587c45fa2@csgroup.eu>
Date: Tue, 25 Mar 2025 08:13:35 +0100
From: Christophe Leroy <christophe.leroy@...roup.eu>
To: Shivaprasad G Bhat <sbhat@...ux.ibm.com>, alex.williamson@...hat.com,
jgg@...pe.ca, kevin.tian@...el.com
Cc: linux-kernel@...r.kernel.org, kvm@...r.kernel.org, yi.l.liu@...el.com,
Yunxiang.Li@....com, pstanner@...hat.com, maddy@...ux.ibm.com,
linuxppc-dev@...ts.ozlabs.org
Subject: Re: [PATCH] vfio: pci: Advertise INTx only if LINE is connected
Le 18/03/2025 à 18:29, Shivaprasad G Bhat a écrit :
> On POWER systems, when the device is behind the io expander,
> not all PCI slots would have the PCI_INTERRUPT_LINE connected.
> The firmware assigns a valid PCI_INTERRUPT_PIN though. In such
> configuration, the irq_info ioctl currently advertizes the
> irq count as 1 as the PCI_INTERRUPT_PIN is valid.
>
> The patch adds the additional check[1] if the irq is assigned
> for the PIN which is done iff the LINE is connected.
>
> [1]: https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.kernel.org%2Fqemu-devel%2F20250131150201.048aa3bf.alex.williamson%40redhat.com%2F&data=05%7C02%7Cchristophe.leroy2%40cs-soprasteria.com%7Ce0fb1d4bf2064e115ce408dd6642796b%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C638779157886704638%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=egZuT5CZsC6S%2Bd7bZTuO4RcKL8IJREPbxIMGZZkZeMQ%3D&reserved=0
>
> Signed-off-by: Shivaprasad G Bhat <sbhat@...ux.ibm.com>
> Suggested-By: Alex Williamson <alex.williamson@...hat.com>
> ---
> drivers/vfio/pci/vfio_pci_core.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c
> index 586e49efb81b..4ce70f05b4a8 100644
> --- a/drivers/vfio/pci/vfio_pci_core.c
> +++ b/drivers/vfio/pci/vfio_pci_core.c
> @@ -734,6 +734,10 @@ static int vfio_pci_get_irq_count(struct vfio_pci_core_device *vdev, int irq_typ
> return 0;
>
> pci_read_config_byte(vdev->pdev, PCI_INTERRUPT_PIN, &pin);
> +#if IS_ENABLED(CONFIG_PPC64)
> + if (!vdev->pdev->irq)
> + pin = 0;
> +#endif
I see no reason for #ifdef here, please instead do:
if (IS_ENABLED(CONFIG_PPC64) && !vdev->pdev->irq)
See
https://docs.kernel.org/process/coding-style.html#conditional-compilation
>
> return pin ? 1 : 0;
> } else if (irq_type == VFIO_PCI_MSI_IRQ_INDEX) {
>
>
>
Powered by blists - more mailing lists