2021-12-10 22:19:29

by Thomas Gleixner

[permalink] [raw]
Subject: [patch V3 06/35] powerpc/pseries/msi: Use PCI device properties

From: Thomas Gleixner <[email protected]>

instead of fiddling with MSI descriptors.

Signed-off-by: Thomas Gleixner <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: [email protected]
---
V3: Use pci_dev->msix_enabled - Jason
---
arch/powerpc/platforms/pseries/msi.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

--- a/arch/powerpc/platforms/pseries/msi.c
+++ b/arch/powerpc/platforms/pseries/msi.c
@@ -448,8 +448,7 @@ static int pseries_msi_ops_prepare(struc
int nvec, msi_alloc_info_t *arg)
{
struct pci_dev *pdev = to_pci_dev(dev);
- struct msi_desc *desc = first_pci_msi_entry(pdev);
- int type = desc->pci.msi_attrib.is_msix ? PCI_CAP_ID_MSIX : PCI_CAP_ID_MSI;
+ int type = pdev->msix_enabled ? PCI_CAP_ID_MSIX : PCI_CAP_ID_MSI;

return rtas_prepare_msi_irqs(pdev, nvec, type, arg);
}



2021-12-13 14:04:35

by Jason Gunthorpe

[permalink] [raw]
Subject: Re: [patch V3 06/35] powerpc/pseries/msi: Use PCI device properties

On Fri, Dec 10, 2021 at 11:18:52PM +0100, Thomas Gleixner wrote:
> From: Thomas Gleixner <[email protected]>
>
> instead of fiddling with MSI descriptors.
>
> Signed-off-by: Thomas Gleixner <[email protected]>
> Cc: Michael Ellerman <[email protected]>
> Cc: [email protected]
> ---
> V3: Use pci_dev->msix_enabled - Jason
> ---
> arch/powerpc/platforms/pseries/msi.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)

Reviewed-by: Jason Gunthorpe <[email protected]>

> --- a/arch/powerpc/platforms/pseries/msi.c
> +++ b/arch/powerpc/platforms/pseries/msi.c
> @@ -448,8 +448,7 @@ static int pseries_msi_ops_prepare(struc
> int nvec, msi_alloc_info_t *arg)
> {
> struct pci_dev *pdev = to_pci_dev(dev);
> - struct msi_desc *desc = first_pci_msi_entry(pdev);
> - int type = desc->pci.msi_attrib.is_msix ? PCI_CAP_ID_MSIX : PCI_CAP_ID_MSI;
> + int type = pdev->msix_enabled ? PCI_CAP_ID_MSIX : PCI_CAP_ID_MSI;

Long term it probably makes sense to change the msi_domain_ops so that
it has PCI versions of the ops to use in places like this that hard
assume PCI is the only kind of MSI at all.

If the non-PCI op isn't provided then things like IMS would be denied
- and the PCI op can directly pass in a pci_dev * so we don't have all
these to_pci_devs() in drivers.

Jason

Subject: [tip: irq/msi] powerpc/pseries/msi: Use PCI device properties

The following commit has been merged into the irq/msi branch of tip:

Commit-ID: ed1533b5810141aceed2c2a3f13a17736f40e7fa
Gitweb: https://git.kernel.org/tip/ed1533b5810141aceed2c2a3f13a17736f40e7fa
Author: Thomas Gleixner <[email protected]>
AuthorDate: Fri, 10 Dec 2021 23:18:52 +01:00
Committer: Thomas Gleixner <[email protected]>
CommitterDate: Thu, 16 Dec 2021 22:16:38 +01:00

powerpc/pseries/msi: Use PCI device properties

instead of fiddling with MSI descriptors.

Signed-off-by: Thomas Gleixner <[email protected]>
Reviewed-by: Jason Gunthorpe <[email protected]>
Link: https://lore.kernel.org/r/[email protected]

---
arch/powerpc/platforms/pseries/msi.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/msi.c b/arch/powerpc/platforms/pseries/msi.c
index 8e28720..dc8cf36 100644
--- a/arch/powerpc/platforms/pseries/msi.c
+++ b/arch/powerpc/platforms/pseries/msi.c
@@ -448,8 +448,7 @@ static int pseries_msi_ops_prepare(struct irq_domain *domain, struct device *dev
int nvec, msi_alloc_info_t *arg)
{
struct pci_dev *pdev = to_pci_dev(dev);
- struct msi_desc *desc = first_pci_msi_entry(pdev);
- int type = desc->pci.msi_attrib.is_msix ? PCI_CAP_ID_MSIX : PCI_CAP_ID_MSI;
+ int type = pdev->msix_enabled ? PCI_CAP_ID_MSIX : PCI_CAP_ID_MSI;

return rtas_prepare_msi_irqs(pdev, nvec, type, arg);
}