2022-11-11 15:20:39

by Thomas Gleixner

[permalink] [raw]
Subject: [patch 14/39] PCI/MSI: Let the MSI core free descriptors

From: Ahmed S. Darwish <[email protected]>

Let the core do the freeing of descriptors and just keep it around for the
legacy case.

Signed-off-by: Ahmed S. Darwish <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
---
drivers/pci/msi/irqdomain.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

--- a/drivers/pci/msi/irqdomain.c
+++ b/drivers/pci/msi/irqdomain.c
@@ -24,11 +24,12 @@ void pci_msi_teardown_msi_irqs(struct pc
struct irq_domain *domain;

domain = dev_get_msi_domain(&dev->dev);
- if (domain && irq_domain_is_hierarchy(domain))
+ if (domain && irq_domain_is_hierarchy(domain)) {
msi_domain_free_irqs_descs_locked(domain, &dev->dev);
- else
+ } else {
pci_msi_legacy_teardown_msi_irqs(dev);
- msi_free_msi_descs(&dev->dev);
+ msi_free_msi_descs(&dev->dev);
+ }
}

/**
@@ -170,6 +171,9 @@ struct irq_domain *pci_msi_create_irq_do
if (info->flags & MSI_FLAG_USE_DEF_CHIP_OPS)
pci_msi_domain_update_chip_ops(info);

+ /* Let the core code free MSI descriptors when freeing interrupts */
+ info->flags |= MSI_FLAG_FREE_MSI_DESCS;
+
info->flags |= MSI_FLAG_ACTIVATE_EARLY | MSI_FLAG_DEV_SYSFS;
if (IS_ENABLED(CONFIG_GENERIC_IRQ_RESERVATION_MODE))
info->flags |= MSI_FLAG_MUST_REACTIVATE;



2022-11-16 16:32:12

by Bjorn Helgaas

[permalink] [raw]
Subject: Re: [patch 14/39] PCI/MSI: Let the MSI core free descriptors

On Fri, Nov 11, 2022 at 02:54:37PM +0100, Thomas Gleixner wrote:
> From: Ahmed S. Darwish <[email protected]>
>
> Let the core do the freeing of descriptors and just keep it around for the
> legacy case.
>
> Signed-off-by: Ahmed S. Darwish <[email protected]>
> Signed-off-by: Thomas Gleixner <[email protected]>

Acked-by: Bjorn Helgaas <[email protected]>

> ---
> drivers/pci/msi/irqdomain.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> --- a/drivers/pci/msi/irqdomain.c
> +++ b/drivers/pci/msi/irqdomain.c
> @@ -24,11 +24,12 @@ void pci_msi_teardown_msi_irqs(struct pc
> struct irq_domain *domain;
>
> domain = dev_get_msi_domain(&dev->dev);
> - if (domain && irq_domain_is_hierarchy(domain))
> + if (domain && irq_domain_is_hierarchy(domain)) {
> msi_domain_free_irqs_descs_locked(domain, &dev->dev);
> - else
> + } else {
> pci_msi_legacy_teardown_msi_irqs(dev);
> - msi_free_msi_descs(&dev->dev);
> + msi_free_msi_descs(&dev->dev);
> + }
> }
>
> /**
> @@ -170,6 +171,9 @@ struct irq_domain *pci_msi_create_irq_do
> if (info->flags & MSI_FLAG_USE_DEF_CHIP_OPS)
> pci_msi_domain_update_chip_ops(info);
>
> + /* Let the core code free MSI descriptors when freeing interrupts */
> + info->flags |= MSI_FLAG_FREE_MSI_DESCS;
> +
> info->flags |= MSI_FLAG_ACTIVATE_EARLY | MSI_FLAG_DEV_SYSFS;
> if (IS_ENABLED(CONFIG_GENERIC_IRQ_RESERVATION_MODE))
> info->flags |= MSI_FLAG_MUST_REACTIVATE;
>

2022-11-16 19:14:09

by Jason Gunthorpe

[permalink] [raw]
Subject: Re: [patch 14/39] PCI/MSI: Let the MSI core free descriptors

On Fri, Nov 11, 2022 at 02:54:37PM +0100, Thomas Gleixner wrote:
> From: Ahmed S. Darwish <[email protected]>
>
> Let the core do the freeing of descriptors and just keep it around for the
> legacy case.
>
> Signed-off-by: Ahmed S. Darwish <[email protected]>
> Signed-off-by: Thomas Gleixner <[email protected]>
> ---
> drivers/pci/msi/irqdomain.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> --- a/drivers/pci/msi/irqdomain.c
> +++ b/drivers/pci/msi/irqdomain.c
> @@ -24,11 +24,12 @@ void pci_msi_teardown_msi_irqs(struct pc
> struct irq_domain *domain;
>
> domain = dev_get_msi_domain(&dev->dev);
> - if (domain && irq_domain_is_hierarchy(domain))
> + if (domain && irq_domain_is_hierarchy(domain)) {
> msi_domain_free_irqs_descs_locked(domain, &dev->dev);
> - else
> + } else {
> pci_msi_legacy_teardown_msi_irqs(dev);
> - msi_free_msi_descs(&dev->dev);
> + msi_free_msi_descs(&dev->dev);
> + }
> }
>
> /**
> @@ -170,6 +171,9 @@ struct irq_domain *pci_msi_create_irq_do
> if (info->flags & MSI_FLAG_USE_DEF_CHIP_OPS)
> pci_msi_domain_update_chip_ops(info);
>
> + /* Let the core code free MSI descriptors when freeing interrupts */
> + info->flags |= MSI_FLAG_FREE_MSI_DESCS;

Comment repeats the one on the enum declaration?

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

Jason

Subject: [tip: irq/core] PCI/MSI: Let the MSI core free descriptors

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

Commit-ID: b2bdda205c0c256d6483231d0afe58a6d68fd3ed
Gitweb: https://git.kernel.org/tip/b2bdda205c0c256d6483231d0afe58a6d68fd3ed
Author: Ahmed S. Darwish <[email protected]>
AuthorDate: Fri, 11 Nov 2022 14:54:37 +01:00
Committer: Thomas Gleixner <[email protected]>
CommitterDate: Thu, 17 Nov 2022 15:15:19 +01:00

PCI/MSI: Let the MSI core free descriptors

Let the core do the freeing of descriptors and just keep it around for the
legacy case.

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

---
drivers/pci/msi/irqdomain.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/msi/irqdomain.c b/drivers/pci/msi/irqdomain.c
index 7766fa6..edd0cc2 100644
--- a/drivers/pci/msi/irqdomain.c
+++ b/drivers/pci/msi/irqdomain.c
@@ -24,11 +24,12 @@ void pci_msi_teardown_msi_irqs(struct pci_dev *dev)
struct irq_domain *domain;

domain = dev_get_msi_domain(&dev->dev);
- if (domain && irq_domain_is_hierarchy(domain))
+ if (domain && irq_domain_is_hierarchy(domain)) {
msi_domain_free_irqs_descs_locked(domain, &dev->dev);
- else
+ } else {
pci_msi_legacy_teardown_msi_irqs(dev);
- msi_free_msi_descs(&dev->dev);
+ msi_free_msi_descs(&dev->dev);
+ }
}

/**
@@ -170,6 +171,9 @@ struct irq_domain *pci_msi_create_irq_domain(struct fwnode_handle *fwnode,
if (info->flags & MSI_FLAG_USE_DEF_CHIP_OPS)
pci_msi_domain_update_chip_ops(info);

+ /* Let the core code free MSI descriptors when freeing interrupts */
+ info->flags |= MSI_FLAG_FREE_MSI_DESCS;
+
info->flags |= MSI_FLAG_ACTIVATE_EARLY | MSI_FLAG_DEV_SYSFS;
if (IS_ENABLED(CONFIG_GENERIC_IRQ_RESERVATION_MODE))
info->flags |= MSI_FLAG_MUST_REACTIVATE;