2022-11-11 13:58:24

by Thomas Gleixner

[permalink] [raw]
Subject: [patch 13/39] PCI/MSI: Use msi_domain_info::bus_token

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

Set the bus token in the msi_domain_info structure and let the core code
handle the update.

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

--- a/drivers/pci/msi/irqdomain.c
+++ b/drivers/pci/msi/irqdomain.c
@@ -162,8 +162,6 @@ struct irq_domain *pci_msi_create_irq_do
struct msi_domain_info *info,
struct irq_domain *parent)
{
- struct irq_domain *domain;
-
if (WARN_ON(info->flags & MSI_FLAG_LEVEL_CAPABLE))
info->flags &= ~MSI_FLAG_LEVEL_CAPABLE;

@@ -178,13 +176,10 @@ struct irq_domain *pci_msi_create_irq_do

/* PCI-MSI is oneshot-safe */
info->chip->flags |= IRQCHIP_ONESHOT_SAFE;
+ /* Let the core update the bus token */
+ info->bus_token = DOMAIN_BUS_PCI_MSI;

- domain = msi_create_irq_domain(fwnode, info, parent);
- if (!domain)
- return NULL;
-
- irq_domain_update_bus_token(domain, DOMAIN_BUS_PCI_MSI);
- return domain;
+ return msi_create_irq_domain(fwnode, info, parent);
}
EXPORT_SYMBOL_GPL(pci_msi_create_irq_domain);




2022-11-16 16:22:38

by Bjorn Helgaas

[permalink] [raw]
Subject: Re: [patch 13/39] PCI/MSI: Use msi_domain_info::bus_token

On Fri, Nov 11, 2022 at 02:54:35PM +0100, Thomas Gleixner wrote:
> From: Ahmed S. Darwish <[email protected]>
>
> Set the bus token in the msi_domain_info structure and let the core code
> handle the update.
>
> 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 | 11 +++--------
> 1 file changed, 3 insertions(+), 8 deletions(-)
>
> --- a/drivers/pci/msi/irqdomain.c
> +++ b/drivers/pci/msi/irqdomain.c
> @@ -162,8 +162,6 @@ struct irq_domain *pci_msi_create_irq_do
> struct msi_domain_info *info,
> struct irq_domain *parent)
> {
> - struct irq_domain *domain;
> -
> if (WARN_ON(info->flags & MSI_FLAG_LEVEL_CAPABLE))
> info->flags &= ~MSI_FLAG_LEVEL_CAPABLE;
>
> @@ -178,13 +176,10 @@ struct irq_domain *pci_msi_create_irq_do
>
> /* PCI-MSI is oneshot-safe */
> info->chip->flags |= IRQCHIP_ONESHOT_SAFE;
> + /* Let the core update the bus token */
> + info->bus_token = DOMAIN_BUS_PCI_MSI;
>
> - domain = msi_create_irq_domain(fwnode, info, parent);
> - if (!domain)
> - return NULL;
> -
> - irq_domain_update_bus_token(domain, DOMAIN_BUS_PCI_MSI);
> - return domain;
> + return msi_create_irq_domain(fwnode, info, parent);
> }
> EXPORT_SYMBOL_GPL(pci_msi_create_irq_domain);
>
>

2022-11-16 19:11:12

by Jason Gunthorpe

[permalink] [raw]
Subject: Re: [patch 13/39] PCI/MSI: Use msi_domain_info::bus_token

On Fri, Nov 11, 2022 at 02:54:35PM +0100, Thomas Gleixner wrote:
> From: Ahmed S. Darwish <[email protected]>
>
> Set the bus token in the msi_domain_info structure and let the core code
> handle the update.
>
> Signed-off-by: Ahmed S. Darwish <[email protected]>
> Signed-off-by: Thomas Gleixner <[email protected]>
> ---
> drivers/pci/msi/irqdomain.c | 11 +++--------
> 1 file changed, 3 insertions(+), 8 deletions(-)
>
> --- a/drivers/pci/msi/irqdomain.c
> +++ b/drivers/pci/msi/irqdomain.c
> @@ -162,8 +162,6 @@ struct irq_domain *pci_msi_create_irq_do
> struct msi_domain_info *info,
> struct irq_domain *parent)
> {
> - struct irq_domain *domain;
> -
> if (WARN_ON(info->flags & MSI_FLAG_LEVEL_CAPABLE))
> info->flags &= ~MSI_FLAG_LEVEL_CAPABLE;
>
> @@ -178,13 +176,10 @@ struct irq_domain *pci_msi_create_irq_do
>
> /* PCI-MSI is oneshot-safe */
> info->chip->flags |= IRQCHIP_ONESHOT_SAFE;
> + /* Let the core update the bus token */
> + info->bus_token = DOMAIN_BUS_PCI_MSI;

comment seems a bit obvious

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

Should the callers be updated to set this in their "struct
msi_domain_info" ?

Jason

2022-11-16 23:07:39

by Thomas Gleixner

[permalink] [raw]
Subject: Re: [patch 13/39] PCI/MSI: Use msi_domain_info::bus_token

On Wed, Nov 16 2022 at 13:51, Jason Gunthorpe wrote:
> On Fri, Nov 11, 2022 at 02:54:35PM +0100, Thomas Gleixner wrote:
>> /* PCI-MSI is oneshot-safe */
>> info->chip->flags |= IRQCHIP_ONESHOT_SAFE;
>> + /* Let the core update the bus token */
>> + info->bus_token = DOMAIN_BUS_PCI_MSI;
>
> comment seems a bit obvious

:)

> Reviewed-by: Jason Gunthorpe <[email protected]>
>
> Should the callers be updated to set this in their "struct
> msi_domain_info" ?

For PCI/MSI we can handle that in the core for all of them. :)

The other msi_domain_info usage in various places needs obviously
special care.

Thanks,

tglx

Subject: [tip: irq/core] PCI/MSI: Use msi_domain_info:: Bus_token

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

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

PCI/MSI: Use msi_domain_info:: Bus_token

Set the bus token in the msi_domain_info structure and let the core code
handle the update.

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 | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/pci/msi/irqdomain.c b/drivers/pci/msi/irqdomain.c
index e9cf318..7766fa6 100644
--- a/drivers/pci/msi/irqdomain.c
+++ b/drivers/pci/msi/irqdomain.c
@@ -162,8 +162,6 @@ struct irq_domain *pci_msi_create_irq_domain(struct fwnode_handle *fwnode,
struct msi_domain_info *info,
struct irq_domain *parent)
{
- struct irq_domain *domain;
-
if (WARN_ON(info->flags & MSI_FLAG_LEVEL_CAPABLE))
info->flags &= ~MSI_FLAG_LEVEL_CAPABLE;

@@ -178,13 +176,10 @@ struct irq_domain *pci_msi_create_irq_domain(struct fwnode_handle *fwnode,

/* PCI-MSI is oneshot-safe */
info->chip->flags |= IRQCHIP_ONESHOT_SAFE;
+ /* Let the core update the bus token */
+ info->bus_token = DOMAIN_BUS_PCI_MSI;

- domain = msi_create_irq_domain(fwnode, info, parent);
- if (!domain)
- return NULL;
-
- irq_domain_update_bus_token(domain, DOMAIN_BUS_PCI_MSI);
- return domain;
+ return msi_create_irq_domain(fwnode, info, parent);
}
EXPORT_SYMBOL_GPL(pci_msi_create_irq_domain);