irqchip: MSI cleanup and conversion to MSI parent domain
Subsystems (12)
cover irqchip: MSI cleanup and conversion to MSI parent domain
The initial implementation of PCI/MSI interrupt domains in the hierarchical interrupt domain model used a shortcut by providing a global PCI/MSI domain.
This works because the PCI/MSI[X] hardware is standardized and uniform, but it violates the basic design principle of hierarchical interrupt domains:
Each hardware block involved in the interrupt delivery chain should have a separate interrupt domain.
For PCI/MSI[X], the interrupt controller is per PCI device and not a global made-up entity.
Unsurprisingly, the shortcut turned out to have downsides as it does not allow dynamic allocation of interrupt vectors after initialization and it prevents supporting IMS on PCI. For further details, see:
https://lore.kernel.org/lkml/[email protected]/
The solution is implementing per device MSI domains, this means the entities which provide global PCI/MSI domain so far have to implement MSI parent domain functionality instead.
Aside from that, the creation of MSI parent domains has been simplified by new helper functions, which are not yet used by all drivers.
This series addresses this by:
- Converting the remaining global PCI/MSI domain providers to MSI parent domains
- Converting the existing MSI parent domain implementations to the simplified setup function
drivers/irqchip/Kconfig | 3 + drivers/irqchip/irq-alpine-msi.c | 155 ++++++++------------- drivers/irqchip/irq-armada-370-xp.c | 48 ++++--- drivers/irqchip/irq-bcm2712-mip.c | 20 +-- drivers/irqchip/irq-imx-mu-msi.c | 14 +- drivers/irqchip/irq-loongson-pch-msi.c | 25 ++-- drivers/irqchip/irq-ls-scfg-msi.c | 49 +++---- drivers/irqchip/irq-riscv-imsic-platform.c | 12 +- drivers/irqchip/irq-sg2042-msi.c | 20 ++- include/linux/irqdomain.h | 2 + include/linux/msi.h | 2 + kernel/irq/irqdomain.c | 1 + kernel/irq/msi.c | 3 +- 13 files changed, 155 insertions(+), 199 deletions(-)
Signature · 1 line
2.39.5
PATCH 1/12 irqdomain: Add device pointer to irq_domain_info and msi_domain_info
From: Thomas Gleixner <[email protected]>
Add device pointer to irq_domain_info and msi_domain_info, so that device can be specified at domain creation.
--- include/linux/irqdomain.h | 2 ++ include/linux/msi.h | 2 ++ kernel/irq/irqdomain.c | 1 + kernel/irq/msi.c | 3 ++- 4 files changed, 7 insertions(+), 1 deletion(-)
include/linux/irqdomain.h +2 -0
@@ -279,6 +279,7 @@ struct irq_domain_chip_generic_info;* domains are added using same fwnode * @ops: Domain operation callbacks * @host_data: Controller private data pointer +* @dev: Device which creates the domain * @dgc_info: Geneneric chip information structure pointer used to * create generic chips for the domain if not NULL. * @init: Function called when the domain is created.
@@ -298,6 +299,7 @@ struct irq_domain_info {const char *name_suffix;const struct irq_domain_ops *ops;void *host_data; +struct device *dev;#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY /** * @parent: Pointer to the parent irq domain used in a hierarchy domain
include/linux/msi.h +2 -0
@@ -488,6 +488,7 @@ struct msi_domain_ops {* gets initialized to the maximum software index limit * by the domain creation code. * @ops: The callback data structure +* @dev: Device which creates the domain * @chip: Optional: associated interrupt chip * @chip_data: Optional: associated interrupt chip data * @handler: Optional: associated interrupt flow handler
@@ -501,6 +502,7 @@ struct msi_domain_info {enum irq_domain_bus_token bus_token;unsigned int hwsize;struct msi_domain_ops *ops; +struct device *dev;struct irq_chip *chip;void *chip_data;irq_flow_handler_t handler;
kernel/irq/irqdomain.c +1 -0
@@ -317,6 +317,7 @@ static struct irq_domain *__irq_domain_instantiate(const struct irq_domain_info domain->flags |= info->domain_flags; domain->exit = info->exit; + domain->dev = info->dev;#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY if (info->parent) {
kernel/irq/msi.c +2 -1
@@ -889,6 +889,7 @@ static struct irq_domain *__msi_create_irq_domain(struct fwnode_handle *fwnode,if (domain) {irq_domain_update_bus_token (domain, info->bus_token); + domain->dev = info->dev;if (info->flags &MSI_FLAG_PARENT_PM_DEV ) domain->pm_dev = parent->pm_dev; }
@@ -1051,6 +1052,7 @@ bool msi_create_device_irq_domain(struct device *dev, unsigned int domid, bundle->info.data = domain_data; bundle->info.chip_data = chip_data; bundle->info.alloc_data = &bundle->alloc_info; + bundle->info.dev = dev; pops = parent->msi_parent_ops; snprintf(bundle->name, sizeof(bundle->name), "%s%s-%s",
@@ -1089,7 +1091,6 @@ bool msi_create_device_irq_domain(struct device *dev, unsigned int domid,if (!domain)return false; - domain->dev = dev; dev->msi.data->__domains[domid].domain = domain;if (msi_domain_prepare_irqs (domain, dev, hwsize, &bundle->alloc_info)) {
Signature · 1 line
2.39.5
PATCH 2/12 irqchip/bcm2712-mip: Switch to msi_create_parent_irq_domain()
In reply to Nam CaoFrom: Thomas Gleixner <[email protected]>
Switch to use the concise helper to create an MSI parent domain.
--- drivers/irqchip/irq-bcm2712-mip.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/irqchip/irq-bcm2712-mip.c +10 -10
@@ -172,18 +172,18 @@ static const struct msi_parent_ops mip_msi_parent_ops = {static int mip_init_domains (struct mip_priv *mip,struct device_node *np) { -struct irq_domain *middle; - - middle =irq_domain_create_hierarchy (mip->parent,0 , mip->num_msis,of_fwnode_handle (np), - &mip_middle_domain_ops, mip); -if (!middle) +struct irq_domain_info info = { + .fwnode =of_fwnode_handle (np), + .ops = &mip_middle_domain_ops, + .host_data = mip, + .size = mip->num_msis, + .parent = mip->parent, + .dev = mip->dev, + }; + +if (!msi_create_parent_irq_domain (&info, &mip_msi_parent_ops))return -ENOMEM ; -irq_domain_update_bus_token (middle,DOMAIN_BUS_GENERIC_MSI ); - middle->dev = mip->dev; - middle->flags |=IRQ_DOMAIN_FLAG_MSI_PARENT ; - middle->msi_parent_ops = &mip_msi_parent_ops; -/* * All MSI-X unmasked for the host, masked for the VPU, and edge-triggered. */
Signature · 1 line
2.39.5
Re: [PATCH 02/12] irqchip/bcm2712-mip: Switch to msi_create_parent_irq_domain()
Quoted 6 lines · Nam Cao
From: Thomas Gleixner <[email protected]>
Switch to use the concise helper to create an MSI parent domain.
Signed-off-by Thomas Gleixner <[email protected]>Signed-off-by Nam Cao <[email protected]>
^ oops, that's not my email
I will send v2, but let's wait for a few days if there is something else I should fix.
Nam
PATCH 3/12 irqchip/riscv-imsic: Convert to msi_create_parent_irq_domain() helper
In reply to Nam CaoFrom: Marc Zyngier <[email protected]>
Now that we have a concise helper to create an MSI parent domain, switch the RISC-V letter soup over to that.
---
Cc: Anup Patel <[email protected]>
Cc: Paul Walmsley <[email protected]>
Cc: Palmer Dabbelt <[email protected]>
Cc: Albert Ou <[email protected]>
Cc: Alexandre Ghiti <[email protected]>
Cc: [email protected]
Cc: [email protected]
--- drivers/irqchip/irq-riscv-imsic-platform.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/irqchip/irq-riscv-imsic-platform.c +6 -6
@@ -307,6 +307,11 @@ static const struct msi_parent_ops imsic_msi_parent_ops = {int imsic_irqdomain_init (void ) { +struct irq_domain_info info = { + .fwnode = imsic->fwnode, + .ops = &imsic_base_domain_ops, + .host_data = imsic, + };struct imsic_global_config *global;if (!imsic || !imsic->fwnode) {
@@ -320,16 +325,11 @@ int imsic_irqdomain_init(void) }/* Create Base IRQ domain */ - imsic->base_domain =irq_domain_create_tree (imsic->fwnode, - &imsic_base_domain_ops, imsic); + imsic->base_domain =msi_create_parent_irq_domain (&info, &imsic_msi_parent_ops);if (!imsic->base_domain) {pr_err ("%pfwP: failed to create IMSIC base domain\n" , imsic->fwnode);return -ENOMEM ; } - imsic->base_domain->flags |=IRQ_DOMAIN_FLAG_MSI_PARENT ; - imsic->base_domain->msi_parent_ops = &imsic_msi_parent_ops; - -irq_domain_update_bus_token (imsic->base_domain,DOMAIN_BUS_NEXUS ); global = &imsic->global; pr_info("%pfwP: hart-index-bits: %d, guest-index-bits: %d\n",
Signature · 1 line
2.39.5
PATCH 4/12 irqchip/imx-mu-msi: Convert to msi_create_parent_irq_domain() helper
In reply to Nam CaoFrom: Marc Zyngier <[email protected]>
Now that we have a concise helper to create an MSI parent domain, switch the IMX letter soup over to that.
---
Cc: Shawn Guo <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: Pengutronix Kernel Team <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: [email protected]
Cc: [email protected]
--- drivers/irqchip/irq-imx-mu-msi.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/irqchip/irq-imx-mu-msi.c +7 -7
@@ -223,21 +223,21 @@ static const struct msi_parent_ops imx_mu_msi_parent_ops = {static int imx_mu_msi_domains_init (struct imx_mu_msi *msi_data,struct device *dev) { -struct fwnode_handle *fwnodes =dev_fwnode (dev); +struct irq_domain_info info = { + .ops = &imx_mu_msi_domain_ops, + .fwnode =dev_fwnode (dev), + .size =IMX_MU_CHANS , + .host_data = msi_data, + };struct irq_domain *parent;/* Initialize MSI domain parent */ - parent =irq_domain_create_linear (fwnodes,IMX_MU_CHANS , - &imx_mu_msi_domain_ops, msi_data); + parent =msi_create_parent_irq_domain (&info, &imx_mu_msi_parent_ops);if (!parent) {dev_err (dev,"failed to create IRQ domain\n" );return -ENOMEM ; } - -irq_domain_update_bus_token (parent,DOMAIN_BUS_NEXUS ); parent->dev = parent->pm_dev = dev; - parent->flags |=IRQ_DOMAIN_FLAG_MSI_PARENT ; - parent->msi_parent_ops = &imx_mu_msi_parent_ops;return 0 ; }
Signature · 1 line
2.39.5
Re: [PATCH 04/12] irqchip/imx-mu-msi: Convert to msi_create_parent_irq_domain() helper
Quoted 8 lines · Nam Cao
From: Marc Zyngier <[email protected]>
Now that we have a concise helper to create an MSI parent domain, switch the IMX letter soup over to that.
Signed-off-by Marc Zyngier <[email protected]>Signed-off-by Thomas Gleixner <[email protected]>
Quoted 47 lines
---
Cc: Shawn Guo <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: Pengutronix Kernel Team <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: [email protected]
Cc: [email protected]--- drivers/irqchip/irq-imx-mu-msi.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)drivers/irqchip/irq-imx-mu-msi.c +7
-8@@ -223,21 +223,21 @@ static const struct msi_parent_ops imx_mu_msi_parent_ops = {static int imx_mu_msi_domains_init (struct imx_mu_msi *msi_data,struct device *dev) { -struct fwnode_handle *fwnodes =dev_fwnode (dev); +struct irq_domain_info info = { + .ops = &imx_mu_msi_domain_ops, + .fwnode =dev_fwnode (dev), + .size =IMX_MU_CHANS , + .host_data = msi_data, + };struct irq_domain *parent;/* Initialize MSI domain parent */ - parent =irq_domain_create_linear (fwnodes,IMX_MU_CHANS , - &imx_mu_msi_domain_ops, msi_data); + parent =msi_create_parent_irq_domain (&info, &imx_mu_msi_parent_ops);if (!parent) {dev_err (dev,"failed to create IRQ domain\n" );return -ENOMEM ; } - -irq_domain_update_bus_token (parent,DOMAIN_BUS_NEXUS ); parent->dev = parent->pm_dev = dev; - parent->flags |=IRQ_DOMAIN_FLAG_MSI_PARENT ; - parent->msi_parent_ops = &imx_mu_msi_parent_ops;return 0 ; } --2.39.5
PATCH 5/12 irqchip/loongson-pch-msi.c: Switch to msi_create_parent_irq_domain()
In reply to Nam CaoFrom: Thomas Gleixner <[email protected]>
Switch to use the concise helper to create an MSI parent domain.
---
Cc: Huacai Chen <[email protected]>
Cc: Jiaxun Yang <[email protected]>
Cc: [email protected]
--- drivers/irqchip/irq-loongson-pch-msi.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-)
drivers/irqchip/irq-loongson-pch-msi.c +10 -15
@@ -153,26 +153,21 @@ static struct msi_parent_ops pch_msi_parent_ops = { .init_dev_msi_info = msi_lib_init_dev_msi_info, }; -static int pch_msi_init_domains (struct pch_msi_data *priv, -struct irq_domain *parent, +static int pch_msi_init_domains (struct pch_msi_data *priv,struct irq_domain *parent,struct fwnode_handle *domain_handle) { -struct irq_domain *middle_domain; - - middle_domain =irq_domain_create_hierarchy (parent,0 , priv->num_irqs, - domain_handle, - &pch_msi_middle_domain_ops, - priv); -if (!middle_domain) { +struct irq_domain_info info = { + .ops = &pch_msi_middle_domain_ops, + .size = priv->num_irqs, + .parent = parent, + .host_data = priv, + .fwnode = domain_handle, + }; + +if (!msi_create_parent_irq_domain (&info, &pch_msi_parent_ops)) {pr_err ("Failed to create the MSI middle domain\n" );return -ENOMEM ; } - -irq_domain_update_bus_token (middle_domain,DOMAIN_BUS_NEXUS ); - - middle_domain->flags |=IRQ_DOMAIN_FLAG_MSI_PARENT ; - middle_domain->msi_parent_ops = &pch_msi_parent_ops; -return 0 ; }
Signature · 1 line
2.39.5
PATCH 6/12 irqchip/sg2042-msi: Switch to msi_create_parent_irq_domain()
In reply to Nam CaoFrom: Thomas Gleixner <[email protected]>
Switch to use the concise helper to create an MSI parent domain.
--- drivers/irqchip/irq-sg2042-msi.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-)
drivers/irqchip/irq-sg2042-msi.c +9 -11
@@ -219,20 +219,18 @@ static const struct msi_parent_ops sg2044_msi_parent_ops = {static int sg204x_msi_init_domains (struct sg204x_msi_chipdata *data,struct irq_domain *plic_domain,struct device *dev) { -struct fwnode_handle *fwnode =dev_fwnode (dev); -struct irq_domain *middle_domain; - - middle_domain =irq_domain_create_hierarchy (plic_domain,0 , data->num_irqs, fwnode, - &sg204x_msi_middle_domain_ops, data); -if (!middle_domain) { +struct irq_domain_info info = { + .ops = &sg204x_msi_middle_domain_ops, + .parent = plic_domain, + .size = data->num_irqs, + .fwnode =dev_fwnode (dev), + .host_data = data, + }; + +if (!msi_create_parent_irq_domain (&info, data->chip_info->parent_ops)) {pr_err ("Failed to create the MSI middle domain\n" );return -ENOMEM ; } - -irq_domain_update_bus_token (middle_domain,DOMAIN_BUS_NEXUS ); - - middle_domain->flags |=IRQ_DOMAIN_FLAG_MSI_PARENT ; - middle_domain->msi_parent_ops = data->chip_info->parent_ops;return 0 ; }
Signature · 1 line
2.39.5
Re: [PATCH 06/12] irqchip/sg2042-msi: Switch to msi_create_parent_irq_domain()
Quoted 6 lines · Nam Cao
From: Thomas Gleixner <[email protected]>
Switch to use the concise helper to create an MSI parent domain.
Signed-off-by Thomas Gleixner <[email protected]>Signed-off-by Nam Cao <[email protected]>
Adding Inochi and cc sophgo maillist
Hi, Inocho, can you please review the same and have a test with SG2044 board?
Thanks.
Chen
Quoted 38 lines
--- drivers/irqchip/irq-sg2042-msi.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-)drivers/irqchip/irq-sg2042-msi.c +9
-11@@ -219,20 +219,18 @@ static const struct msi_parent_ops sg2044_msi_parent_ops = {static int sg204x_msi_init_domains (struct sg204x_msi_chipdata *data,struct irq_domain *plic_domain,struct device *dev) { -struct fwnode_handle *fwnode =dev_fwnode (dev); -struct irq_domain *middle_domain; - - middle_domain =irq_domain_create_hierarchy (plic_domain,0 , data->num_irqs, fwnode, - &sg204x_msi_middle_domain_ops, data); -if (!middle_domain) { +struct irq_domain_info info = { + .ops = &sg204x_msi_middle_domain_ops, + .parent = plic_domain, + .size = data->num_irqs, + .fwnode =dev_fwnode (dev), + .host_data = data, + }; + +if (!msi_create_parent_irq_domain (&info, data->chip_info->parent_ops)) {pr_err ("Failed to create the MSI middle domain\n" );return -ENOMEM ; } - -irq_domain_update_bus_token (middle_domain,DOMAIN_BUS_NEXUS ); - - middle_domain->flags |=IRQ_DOMAIN_FLAG_MSI_PARENT ; - middle_domain->msi_parent_ops = data->chip_info->parent_ops;return 0 ; }
PATCH 7/12 irqchip/alpine-msi: Clean up whitespace style
In reply to Nam CaoFrom: Thomas Gleixner <[email protected]>
Tidy up the code style. Whitespace changes only.
---
Cc: Antoine Tenart <[email protected]>
Cc: [email protected]
--- drivers/irqchip/irq-alpine-msi.c | 37 +++++++++++--------------------- 1 file changed, 13 insertions(+), 24 deletions(-)
drivers/irqchip/irq-alpine-msi.c +13 -24
@@ -29,11 +29,11 @@#define ALPINE_MSIX_SPI_TARGET_CLUSTER0 BIT(16)struct alpine_msix_data { -spinlock_t msi_map_lock; -phys_addr_t addr; -u32 spi_first;/* The SGI number that MSIs start */ -u32 num_spis;/* The number of SGIs for MSIs */ -unsigned long *msi_map; +spinlock_t msi_map_lock; +phys_addr_t addr; +u32 spi_first;/* The SGI number that MSIs start */ +u32 num_spis;/* The number of SGIs for MSIs */ +unsigned long *msi_map; };static void alpine_msix_mask_msi_irq (struct irq_data *d)
@@ -76,8 +76,7 @@ static int alpine_msix_allocate_sgi(struct alpine_msix_data *priv, int num_req)return priv->spi_first + first; } -static void alpine_msix_free_sgi (struct alpine_msix_data *priv,unsigned sgi, -int num_req) +static void alpine_msix_free_sgi (struct alpine_msix_data *priv,unsigned int sgi,int num_req) {int first = sgi - priv->spi_first;
@@ -88,14 +87,12 @@ static void alpine_msix_free_sgi(struct alpine_msix_data *priv, unsigned sgi,spin_unlock (&priv->msi_map_lock); } -static void alpine_msix_compose_msi_msg (struct irq_data *data, -struct msi_msg *msg) +static void alpine_msix_compose_msi_msg (struct irq_data *data,struct msi_msg *msg) {struct alpine_msix_data *priv =irq_data_get_irq_chip_data (data);phys_addr_t msg_addr = priv->addr; msg_addr |= (data->hwirq <<3 ); - msg->address_hi =upper_32_bits (msg_addr); msg->address_lo =lower_32_bits (msg_addr); msg->data =0 ;
@@ -116,8 +113,7 @@ static struct irq_chip middle_irq_chip = { .irq_compose_msi_msg = alpine_msix_compose_msi_msg, }; -static int alpine_msix_gic_domain_alloc (struct irq_domain *domain, -unsigned int virq,int sgi) +static int alpine_msix_gic_domain_alloc (struct irq_domain *domain,unsigned int virq,int sgi) {struct irq_fwspec fwspec;struct irq_data *d;
@@ -138,12 +134,10 @@ static int alpine_msix_gic_domain_alloc(struct irq_domain *domain, d =irq_domain_get_irq_data (domain->parent, virq); d->chip->irq_set_type (d,IRQ_TYPE_EDGE_RISING ); -return 0 ; } -static int alpine_msix_middle_domain_alloc (struct irq_domain *domain, -unsigned int virq, +static int alpine_msix_middle_domain_alloc (struct irq_domain *domain,unsigned int virq,unsigned int nr_irqs,void *args) {struct alpine_msix_data *priv = domain->host_data;
@@ -161,7 +155,6 @@ static int alpine_msix_middle_domain_alloc(struct irq_domain *domain,irq_domain_set_hwirq_and_chip (domain, virq + i, sgi + i, &middle_irq_chip, priv); } -return 0 ; err_sgi:
@@ -170,8 +163,7 @@ static int alpine_msix_middle_domain_alloc(struct irq_domain *domain,return err; } -static void alpine_msix_middle_domain_free (struct irq_domain *domain, -unsigned int virq, +static void alpine_msix_middle_domain_free (struct irq_domain *domain,unsigned int virq,unsigned int nr_irqs) {struct irq_data *d =irq_domain_get_irq_data (domain, virq);
@@ -186,8 +178,7 @@ static const struct irq_domain_ops alpine_msix_middle_domain_ops = { .free = alpine_msix_middle_domain_free, }; -static int alpine_msix_init_domains (struct alpine_msix_data *priv, -struct device_node *node) +static int alpine_msix_init_domains (struct alpine_msix_data *priv,struct device_node *node) {struct irq_domain *middle_domain, *msi_domain, *gic_domain;struct device_node *gic_node;
@@ -224,8 +215,7 @@ static int alpine_msix_init_domains(struct alpine_msix_data *priv,return 0 ; } -static int alpine_msix_init (struct device_node *node, -struct device_node *parent) +static int alpine_msix_init (struct device_node *node,struct device_node *parent) {struct alpine_msix_data *priv;struct resource res;
@@ -271,8 +261,7 @@ static int alpine_msix_init(struct device_node *node, goto err_priv; } -pr_debug ("Registering %d msixs, starting at %d\n" , - priv->num_spis, priv->spi_first); +pr_debug ("Registering %d msixs, starting at %d\n" , priv->num_spis, priv->spi_first); ret =alpine_msix_init_domains (priv, node);if (ret)
Signature · 1 line
2.39.5
PATCH 8/12 irqchip/alpine-msi: Convert to lock guards
In reply to Nam CaoFrom: Thomas Gleixner <[email protected]>
Convert lock/unlock pairs to guards and tidy up the code.
No functional change.
---
Cc: Antoine Tenart <[email protected]>
Cc: [email protected]
--- drivers/irqchip/irq-alpine-msi.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-)
drivers/irqchip/irq-alpine-msi.c +4 -14
@@ -60,19 +60,12 @@ static int alpine_msix_allocate_sgi(struct alpine_msix_data *priv, int num_req) {int first; -spin_lock (&priv->msi_map_lock); - - first =bitmap_find_next_zero_area (priv->msi_map, priv->num_spis,0 , - num_req,0 ); -if (first >= priv->num_spis) { -spin_unlock (&priv->msi_map_lock); +guard (spinlock)(&priv->msi_map_lock); + first =bitmap_find_next_zero_area (priv->msi_map, priv->num_spis,0 , num_req,0 ); +if (first >= priv->num_spis)return -ENOSPC ; - }bitmap_set (priv->msi_map, first, num_req); - -spin_unlock (&priv->msi_map_lock); -return priv->spi_first + first; }
@@ -80,11 +73,8 @@ static void alpine_msix_free_sgi(struct alpine_msix_data *priv, unsigned int sgi {int first = sgi - priv->spi_first; -spin_lock (&priv->msi_map_lock); - +guard (spinlock)(&priv->msi_map_lock);bitmap_clear (priv->msi_map, first, num_req); - -spin_unlock (&priv->msi_map_lock); }static void alpine_msix_compose_msi_msg (struct irq_data *data,struct msi_msg *msg)
Signature · 1 line
2.39.5
PATCH 9/12 irqchip/alpine-msi: Convert to __free
In reply to Nam CaoFrom: Thomas Gleixner <[email protected]>
Tidy up the code with __free. No functional change.
---
Cc: Antoine Tenart <[email protected]>
Cc: [email protected]
--- drivers/irqchip/irq-alpine-msi.c | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-)
drivers/irqchip/irq-alpine-msi.c +12 -19
@@ -207,11 +207,10 @@ static int alpine_msix_init_domains(struct alpine_msix_data *priv, struct devicestatic int alpine_msix_init (struct device_node *node,struct device_node *parent) { -struct alpine_msix_data *priv; + struct alpine_msix_data *priv __free(kfree) = kzalloc(sizeof(*priv), GFP_KERNEL);struct resource res;int ret; - priv =kzalloc (sizeof (*priv),GFP_KERNEL );if (!priv)return -ENOMEM ;
@@ -220,7 +219,7 @@ static int alpine_msix_init(struct device_node *node, struct device_node *parent ret =of_address_to_resource (node,0 , &res);if (ret) {pr_err ("Failed to allocate resource\n" ); - goto err_priv; +return ret; }/*
@@ -235,34 +234,28 @@ static int alpine_msix_init(struct device_node *node, struct device_node *parentif (of_property_read_u32 (node,"al,msi-base-spi" , &priv->spi_first)) {pr_err ("Unable to parse MSI base\n" ); - ret = -EINVAL ; - goto err_priv; +return -EINVAL ; }if (of_property_read_u32 (node,"al,msi-num-spis" , &priv->num_spis)) {pr_err ("Unable to parse MSI numbers\n" ); - ret = -EINVAL ; - goto err_priv; +return -EINVAL ; } - priv->msi_map =bitmap_zalloc (priv->num_spis,GFP_KERNEL ); -if (!priv->msi_map) { - ret = -ENOMEM ; - goto err_priv; - } + unsigned long *msi_map __free(kfree) = bitmap_zalloc(priv->num_spis, GFP_KERNEL); + +if (!msi_map) +return -ENOMEM ; + priv->msi_map = msi_map;pr_debug ("Registering %d msixs, starting at %d\n" , priv->num_spis, priv->spi_first); ret =alpine_msix_init_domains (priv, node);if (ret) - goto err_map; +return ret; +retain_and_null_ptr (priv); +retain_and_null_ptr (msi_map);return 0 ; - -err_map: -bitmap_free (priv->msi_map); -err_priv: -kfree (priv); -return ret; }IRQCHIP_DECLARE (alpine_msix,"al,alpine-msix" , alpine_msix_init);
Signature · 1 line
2.39.5
PATCH 10/12 irqchip/alpine-msi: Switch to msi_create_parent_irq_domain()
In reply to Nam CaoFrom: Thomas Gleixner <[email protected]>
Move away from the legacy MSI domain setup, switch to use msi_create_parent_irq_domain().
---
Cc: Antoine Tenart <[email protected]>
Cc: [email protected]
--- drivers/irqchip/Kconfig | 1 + drivers/irqchip/irq-alpine-msi.c | 69 +++++++++++++------------------- 2 files changed, 28 insertions(+), 42 deletions(-)
drivers/irqchip/Kconfig +1 -0
@@ -85,6 +85,7 @@ config ALPINE_MSI bool depends on PCI select PCI_MSI + select IRQ_MSI_LIB select GENERIC_IRQ_CHIP config AL_FIC
drivers/irqchip/irq-alpine-msi.c +27 -42
113 lines not on this page · raw message
Signature · 1 line
2.39.5
PATCH 11/12 irqchip/armada-370-xp: Switch to msi_create_parent_irq_domain()
In reply to Nam CaoMove away from the legacy MSI domain setup, switch to use msi_create_parent_irq_domain().
---
Cc: Andrew Lunn <[email protected]>
Cc: Gregory Clement <[email protected]>
Cc: Sebastian Hesselbarth <[email protected]>
Cc: [email protected]
--- drivers/irqchip/Kconfig | 1 + drivers/irqchip/irq-armada-370-xp.c | 48 +++++++++++++++-------------- 2 files changed, 26 insertions(+), 23 deletions(-)
drivers/irqchip/Kconfig +1 -0
@@ -79,6 +79,7 @@ config ARMADA_370_XP_IRQ bool select GENERIC_IRQ_CHIP select PCI_MSI if PCI + select IRQ_MSI_LIB if PCI select GENERIC_IRQ_EFFECTIVE_AFF_MASK if SMP config ALPINE_MSI
drivers/irqchip/irq-armada-370-xp.c +25 -23
92 lines not on this page · raw message
Signature · 1 line
2.39.5
PATCH 12/12 irqchip/ls-scfg-msi: Switch to use msi_create_parent_irq_domain()
In reply to Nam CaoMove away from the legacy MSI domain setup, switch to use msi_create_parent_irq_domain().
--- drivers/irqchip/Kconfig | 1 + drivers/irqchip/irq-ls-scfg-msi.c | 49 ++++++++++++++----------------- 2 files changed, 23 insertions(+), 27 deletions(-)
drivers/irqchip/Kconfig +1 -0
@@ -436,6 +436,7 @@ config LS_SCFG_MSI def_bool y if SOC_LS1021A || ARCH_LAYERSCAPE select IRQ_MSI_IOMMU depends on PCI_MSI + select IRQ_MSI_LIB config PARTITION_PERCPU bool
drivers/irqchip/irq-ls-scfg-msi.c +22 -27
86 lines not on this page · raw message
Signature · 1 line
2.39.5
This series was applied to riscv/linux.git (fixes) by Thomas Gleixner <[email protected]>:
Hello:
This series was applied to riscv/linux.git (fixes) by Thomas Gleixner <[email protected]>:
Quoted 10 lines · On Thu, 26 Jun 2025 16:48:57 +0200 you wrote:
The initial implementation of PCI/MSI interrupt domains in the hierarchical interrupt domain model used a shortcut by providing a global PCI/MSI domain.
This works because the PCI/MSI[X] hardware is standardized and uniform, but it violates the basic design principle of hierarchical interrupt domains:
Each hardware block involved in the interrupt delivery chain should have a separate interrupt domain.[...]
Here is the summary with links:
- [01/12] irqdomain: Add device pointer to irq_domain_info and msi_domain_info
https://git.kernel.org/riscv/c/858e65af9135 - [02/12] irqchip/bcm2712-mip: Switch to msi_create_parent_irq_domain() https://git.kernel.org/riscv/c/91650ca5efcf - [03/12] irqchip/riscv-imsic: Convert to msi_create_parent_irq_domain() helper https://git.kernel.org/riscv/c/59422904dd98 - [04/12] irqchip/imx-mu-msi: Convert to msi_create_parent_irq_domain() helper https://git.kernel.org/riscv/c/c7cc7b122a4c - [05/12] irqchip/loongson-pch-msi.c: Switch to msi_create_parent_irq_domain() https://git.kernel.org/riscv/c/7f91d608cc43 - [06/12] irqchip/sg2042-msi: Switch to msi_create_parent_irq_domain() https://git.kernel.org/riscv/c/7c0dbd80de03 - [07/12] irqchip/alpine-msi: Clean up whitespace style https://git.kernel.org/riscv/c/6e44ac411255 - [08/12] irqchip/alpine-msi: Convert to lock guards https://git.kernel.org/riscv/c/71476f915f92 - [09/12] irqchip/alpine-msi: Convert to __free https://git.kernel.org/riscv/c/f7c2dd9f4c2d - [10/12] irqchip/alpine-msi: Switch to msi_create_parent_irq_domain() https://git.kernel.org/riscv/c/7a91ad7ebd61 - [11/12] irqchip/armada-370-xp: Switch to msi_create_parent_irq_domain() https://git.kernel.org/riscv/c/bafb2901317f - [12/12] irqchip/ls-scfg-msi: Switch to use msi_create_parent_irq_domain() https://git.kernel.org/riscv/c/94b59d5f567a
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
Quoted 4 lines · patchwork-bot
Hello:
This series was applied to riscv/linux.git (fixes) by Thomas Gleixner <[email protected]>:
...
Quoted 3 lines
Here is the summary with links:
- [01/12] irqdomain: Add device pointer toirq_domain_infoandmsi_domain_infohttps://git.kernel.org/riscv/c/858e65af9135
...
Quoted 1 line
You are awesome, thank you!
I know that I'm awesome, but this broken patchwork bot is _not_
Why the hell does it waste electrons and inbox space on stuff which is
A) applied on a different tree
B) already upstream