diff mbox series

[V2,20/36] x86/pci/XEN: Use device MSI properties

Message ID 20211206210438.742297272@linutronix.de (mailing list archive)
State Superseded
Headers show
Series genirq/msi, PCI/MSI: Spring cleaning - Part 2 | expand

Commit Message

Thomas Gleixner Dec. 6, 2021, 10:39 p.m. UTC
instead of fiddling with MSI descriptors.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
---
 arch/x86/pci/xen.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Jason Gunthorpe Dec. 8, 2021, 3:53 p.m. UTC | #1
On Mon, Dec 06, 2021 at 11:39:28PM +0100, Thomas Gleixner wrote:
> instead of fiddling with MSI descriptors.
> 
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
>  arch/x86/pci/xen.c |    6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> +++ b/arch/x86/pci/xen.c
> @@ -399,9 +399,7 @@ static void xen_teardown_msi_irqs(struct
>  
>  static void xen_pv_teardown_msi_irqs(struct pci_dev *dev)
>  {
> -	struct msi_desc *msidesc = first_pci_msi_entry(dev);
> -
> -	if (msidesc->pci.msi_attrib.is_msix)
> +	if (msi_device_has_property(&dev->dev, MSI_PROP_PCI_MSIX))
>  		xen_pci_frontend_disable_msix(dev);
>  	else
>  		xen_pci_frontend_disable_msi(dev);

Same remark as for power, we have a pci_dev, so can it be dev->msix_enabled?

> @@ -417,7 +415,7 @@ static int xen_msi_domain_alloc_irqs(str
>  	if (WARN_ON_ONCE(!dev_is_pci(dev)))
>  		return -EINVAL;
>  
> -	if (first_msi_entry(dev)->pci.msi_attrib.is_msix)
> +	if (msi_device_has_property(dev, MSI_PROP_PCI_MSIX))

And this WARNS if it is not a pci_dev, so same

Jason
Thomas Gleixner Dec. 8, 2021, 5:53 p.m. UTC | #2
On Wed, Dec 08 2021 at 11:53, Jason Gunthorpe wrote:
> On Mon, Dec 06, 2021 at 11:39:28PM +0100, Thomas Gleixner wrote:
>>  static void xen_pv_teardown_msi_irqs(struct pci_dev *dev)
>>  {
>> -	struct msi_desc *msidesc = first_pci_msi_entry(dev);
>> -
>> -	if (msidesc->pci.msi_attrib.is_msix)
>> +	if (msi_device_has_property(&dev->dev, MSI_PROP_PCI_MSIX))
>>  		xen_pci_frontend_disable_msix(dev);
>>  	else
>>  		xen_pci_frontend_disable_msi(dev);
>
> Same remark as for power, we have a pci_dev, so can it be
> dev->msix_enabled?

Yes, let me rework that.
diff mbox series

Patch

--- a/arch/x86/pci/xen.c
+++ b/arch/x86/pci/xen.c
@@ -399,9 +399,7 @@  static void xen_teardown_msi_irqs(struct
 
 static void xen_pv_teardown_msi_irqs(struct pci_dev *dev)
 {
-	struct msi_desc *msidesc = first_pci_msi_entry(dev);
-
-	if (msidesc->pci.msi_attrib.is_msix)
+	if (msi_device_has_property(&dev->dev, MSI_PROP_PCI_MSIX))
 		xen_pci_frontend_disable_msix(dev);
 	else
 		xen_pci_frontend_disable_msi(dev);
@@ -417,7 +415,7 @@  static int xen_msi_domain_alloc_irqs(str
 	if (WARN_ON_ONCE(!dev_is_pci(dev)))
 		return -EINVAL;
 
-	if (first_msi_entry(dev)->pci.msi_attrib.is_msix)
+	if (msi_device_has_property(dev, MSI_PROP_PCI_MSIX))
 		type = PCI_CAP_ID_MSIX;
 	else
 		type = PCI_CAP_ID_MSI;