Skip to contentSkip to conversation

irqchip/alpine-msi: Cleanups and debug logging

PATCH Applied Eliav Farber 3 participants 13 messages Oct 24 – Nov 9

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover irqchip/alpine-msi: Cleanups and debug logging

This series contains a few small cleanups for the Alpine MSIX irqchip driver, followed by the addition of some optional debug logging.

Patches 1-4 are trivial, no-functional-change cleanups: convert the license boilerplate to an SPDX identifier, drop the redundant <asm/msi.h> include (already pulled in via <linux/msi.h>), fix the missing space after a comma in a GENMASK_ULL() invocation, and use %u for the unsigned values in the existing registration debug message.

Patch 5 adds an info message on successful initialisation and debug messages on the MSI interrupt allocation and free paths, to make it easier to follow the driver flow when debugging.

Build-tested for arm64 with the aarch64 toolchain and KCFLAGS=-Werror. The driver is used by the Alpine V2, Alpine V3 and AL8 SoCs.

Changes in v2:
- Collected Reviewed-by from Radu on patches 1-3.
- New patch 4: use %u for the unsigned values in the existing "Registering" debug message and fix its wording (Radu).
- Patch 5: use %u for the unsigned values in the new messages (Radu), and write MSI/SPI in upper case to match patch 4.

v1: https://lore.kernel.org/r/[email protected]

Eliav Farber (5):
irqchip/alpine-msi: Use SPDX-License-Identifier irqchip/alpine-msi: Drop redundant asm/msi.h include irqchip/alpine-msi: Add missing space after comma in GENMASK_ULL irqchip/alpine-msi: Fix format and wording of the registration debug
print
irqchip/alpine-msi: Add debug logging for MSI allocation

 drivers/irqchip/irq-alpine-msi.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)
Signature · 1 line
2.47.3
#1 lore raw

PATCH v2 1/5 irqchip/alpine-msi: Use SPDX-License-Identifier

Replace the free-form GPL v2 license boilerplate with the equivalent SPDX-License-Identifier tag, as preferred for new and updated files. No functional change.

---
 drivers/irqchip/irq-alpine-msi.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/irqchip/irq-alpine-msi.c +1 -4
index 6764d64e7950..0d97abb85e16 100644
@@ -1,13 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Annapurna Labs MSIX support services
  *
  * Copyright (C) 2016, Amazon.com, Inc. or its affiliates. All Rights Reserved.
  *
  * Antoine Tenart <[email protected]>
- *
- * This file is licensed under the terms of the GNU General Public
- * License version 2. This program is licensed "as is" without any
- * warranty of any kind, whether express or implied.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
Signature · 1 line
2.47.3
#3 lore raw

PATCH v2 2/5 irqchip/alpine-msi: Drop redundant asm/msi.h include

In reply to Eliav Farber

The driver already includes <linux/msi.h>, which itself pulls in <asm/msi.h>, so the explicit arch include is redundant. Remove it; checkpatch also flags the direct use of the asm header in favour of the linux one. No functional change.

---
 drivers/irqchip/irq-alpine-msi.c | 1 -
 1 file changed, 1 deletion(-)
drivers/irqchip/irq-alpine-msi.c +0 -1
index 0d97abb85e16..20f1f7f7612b 100644
@@ -21,7 +21,6 @@
 #include <linux/slab.h>
 
 #include <asm/irq.h>
-#include <asm/msi.h>
 
 /* MSIX message address format: local GIC target */
 #define ALPINE_MSIX_SPI_TARGET_CLUSTER0		BIT(16)
Signature · 1 line
2.47.3
#5 lore raw

PATCH v2 3/5 irqchip/alpine-msi: Add missing space after comma in GENMASK_ULL

In reply to Eliav Farber

Fix the coding-style issue reported by checkpatch:

ERROR: space required after that ',' (ctx:VxV)

No functional change.

---
 drivers/irqchip/irq-alpine-msi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-alpine-msi.c +1 -1
index 20f1f7f7612b..8155f63cfd29 100644
@@ -210,7 +210,7 @@ static int alpine_msix_init(struct device_node *node, struct device_node *parent
 	 * To select the primary GIC as the target GIC, bits [18:17] must be set
 	 * to 0x0. In this case, bit 16 (SPI_TARGET_CLUSTER0) must be set.
 	 */
-	priv->addr = res.start & GENMASK_ULL(63,20);
+	priv->addr = res.start & GENMASK_ULL(63, 20);
 	priv->addr |= ALPINE_MSIX_SPI_TARGET_CLUSTER0;
 
 	if (of_property_read_u32(node, "al,msi-base-spi", &priv->spi_first)) {
Signature · 1 line
2.47.3
#7 lore raw

PATCH v2 4/5 irqchip/alpine-msi: Fix format and wording of the registration debug print

In reply to Eliav Farber

The "Registering" debug message in alpine_msix_init() prints priv->num_spis and priv->spi_first, both u32, with %d. Use %u to match their type, and fix the "msixs" wording while at it. No functional change.

---
v2: New patch (Radu).

 drivers/irqchip/irq-alpine-msi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-alpine-msi.c +1 -1
index 8155f63cfd29..fb84b6046193 100644
@@ -229,7 +229,7 @@ static int alpine_msix_init(struct device_node *node, struct device_node *parent
 		return -ENOMEM;
 	priv->msi_map = msi_map;
 
-	pr_debug("Registering %d msixs, starting at %d\n", priv->num_spis, priv->spi_first);
+	pr_debug("Registering %u MSIs, starting at SPI %u\n", priv->num_spis, priv->spi_first);
 
 	ret = alpine_msix_init_domains(priv, node);
 	if (ret)
Signature · 1 line
2.47.3
#10 lore raw

PATCH v2 5/5 irqchip/alpine-msi: Add debug logging for MSI allocation

In reply to Eliav Farber

Add log messages to help follow the driver flow when debugging: an info message on successful initialisation, and debug messages on the MSI interrupt allocation and free paths.

---
v2:
- Use %u for unsigned values (Radu).
- Write MSI/SPI in upper case, to match patch 4.

 drivers/irqchip/irq-alpine-msi.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/irqchip/irq-alpine-msi.c +10 -0
index fb84b6046193..c13646c763d3 100644
@@ -104,6 +104,8 @@ static int alpine_msix_middle_domain_alloc(struct irq_domain *domain, unsigned i
 	struct alpine_msix_data *priv = domain->host_data;
 	int sgi, err, i;
 
+	pr_debug("trying to allocate %u MSIs starting from %u\n", nr_irqs, virq);
+
 	sgi = alpine_msix_allocate_sgi(priv, nr_irqs);
 	if (sgi < 0)
 		return sgi;
@@ -116,6 +118,9 @@ static int alpine_msix_middle_domain_alloc(struct irq_domain *domain, unsigned i
 		irq_domain_set_hwirq_and_chip(domain, virq + i, sgi + i,
 					      &middle_irq_chip, priv);
 	}
+
+	pr_debug("allocated %u MSIs starting from %u\n", nr_irqs, virq);
+
 	return 0;
 
 err_sgi:
@@ -132,6 +137,8 @@ static void alpine_msix_middle_domain_free(struct irq_domain *domain, unsigned i
 
 	irq_domain_free_irqs_parent(domain, virq, nr_irqs);
 	alpine_msix_free_sgi(priv, d->hwirq, nr_irqs);
+
+	pr_debug("freed %u MSIs starting from %u\n", nr_irqs, virq);
 }
 
 static const struct irq_domain_ops alpine_msix_middle_domain_ops = {
@@ -235,6 +242,9 @@ static int alpine_msix_init(struct device_node *node, struct device_node *parent
 	if (ret)
 		return ret;
 
+	pr_info("initialized successfully, SPI %u to %u\n",
+		priv->spi_first, priv->spi_first + priv->num_spis - 1);
+
 	retain_and_null_ptr(priv);
 	retain_and_null_ptr(msi_map);
 	return 0;
Signature · 1 line
2.47.3
reviewer Reviewed-by on v2 4/5
#8 lore raw

Re: [PATCH v2 4/5] irqchip/alpine-msi: Fix format and wording of the registration debug print

In reply to Eliav Farber
Quoted 22 lines · Eliav Farber

The "Registering" debug message in alpine_msix_init() prints priv->num_spis and priv->spi_first, both u32, with %d. Use %u to match their type, and fix the "msixs" wording while at it. No functional change.

---
v2: New patch (Radu).

 drivers/irqchip/irq-alpine-msi.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-alpine-msi.c +0 -0
index 8155f63cfd29..fb84b6046193 100644
@@ -229,7 +229,7 @@ static int alpine_msix_init(struct device_node *node, struct device_node *parent
  		return -ENOMEM;
  	priv->msi_map = msi_map;

drivers/irqchip/irq-alpine-msi.c +1 -1
-	pr_debug("Registering %d msixs, starting at %d\n", priv->num_spis, priv->spi_first);
+	pr_debug("Registering %u MSIs, starting at SPI %u\n", priv->num_spis, priv->spi_first);
Quoted 3 lines


  ret = alpine_msix_init_domains(priv, node); if (ret)

reviewer Reviewed-by on v2 5/5
#11 lore raw

Re: [PATCH v2 5/5] irqchip/alpine-msi: Add debug logging for MSI allocation

In reply to Eliav Farber
Quoted 52 lines · Eliav Farber

Add log messages to help follow the driver flow when debugging: an info message on successful initialisation, and debug messages on the MSI interrupt allocation and free paths.

---
v2:
- Use %u for unsigned values (Radu).
- Write MSI/SPI in upper case, to match patch 4.

 drivers/irqchip/irq-alpine-msi.c | 10 ++++++++++

 1 file changed, 10 insertions(+)
drivers/irqchip/irq-alpine-msi.c +0 -0
index fb84b6046193..c13646c763d3 100644
@@ -104,6 +104,8 @@ static int alpine_msix_middle_domain_alloc(struct irq_domain *domain, unsigned i
  	struct alpine_msix_data *priv = domain->host_data;
  	int sgi, err, i;

drivers/irqchip/irq-alpine-msi.c +2 -0
+	pr_debug("trying to allocate %u MSIs starting from %u\n", nr_irqs, virq);
+

  sgi = alpine_msix_allocate_sgi(priv, nr_irqs); if (sgi < 0)
  return sgi;

drivers/irqchip/irq-alpine-msi.c +3 -0
@@ -116,6 +118,9 @@ static int alpine_msix_middle_domain_alloc(struct irq_domain *domain, unsigned i
  		irq_domain_set_hwirq_and_chip(domain, virq + i, sgi + i,
  					      &middle_irq_chip, priv);
  	}
+
+	pr_debug("allocated %u MSIs starting from %u\n", nr_irqs, virq);
+
  	return 0;


 err_sgi:

drivers/irqchip/irq-alpine-msi.c +0 -0
@@ -132,6 +137,8 @@ static void alpine_msix_middle_domain_free(struct irq_domain *domain, unsigned i


  irq_domain_free_irqs_parent(domain, virq, nr_irqs); alpine_msix_free_sgi(priv, d->hwirq, nr_irqs);

drivers/irqchip/irq-alpine-msi.c +2 -0
+
+	pr_debug("freed %u MSIs starting from %u\n", nr_irqs, virq);

 }

 static const struct irq_domain_ops alpine_msix_middle_domain_ops = {

drivers/irqchip/irq-alpine-msi.c +0 -0
@@ -235,6 +242,9 @@ static int alpine_msix_init(struct device_node *node, struct device_node *parent
  	if (ret)
  		return ret;

drivers/irqchip/irq-alpine-msi.c +3 -0
+	pr_info("initialized successfully, SPI %u to %u\n",
+		priv->spi_first, priv->spi_first + priv->num_spis - 1);
+
Quoted 3 lines

  retain_and_null_ptr(priv);
  retain_and_null_ptr(msi_map);
  return 0;

merge bot Applied
#12 lore raw

[tip: irq/drivers] irqchip/alpine-msi: Add debug logging for MSI allocation

In reply to Eliav Farber
The following commit has been merged into the irq/drivers branch of tip:

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

Commit-ID:     0fcfc884260ab15e303461de4494ef70a2d85983
Gitweb:        https://git.kernel.org/tip/0fcfc884260ab15e303461de4494ef70a2d85983
Author:        Eliav Farber <[email protected]>
AuthorDate:    Sat, 24 Oct 2026 19:36:20 
Committer:     Thomas Gleixner <[email protected]>
CommitterDate: Mon, 09 Nov 2026 10:20:18 +01:00

irqchip/alpine-msi: Add debug logging for MSI allocation

Add log messages to help follow the driver flow when debugging: an info message on successful initialisation, and debug messages on the MSI interrupt allocation and free paths.

---
 drivers/irqchip/irq-alpine-msi.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/irqchip/irq-alpine-msi.c +10 -0
index fb84b60..c13646c 100644
@@ -104,6 +104,8 @@ static int alpine_msix_middle_domain_alloc(struct irq_domain *domain, unsigned i
 	struct alpine_msix_data *priv = domain->host_data;
 	int sgi, err, i;
 
+	pr_debug("trying to allocate %u MSIs starting from %u\n", nr_irqs, virq);
+
 	sgi = alpine_msix_allocate_sgi(priv, nr_irqs);
 	if (sgi < 0)
 		return sgi;
@@ -116,6 +118,9 @@ static int alpine_msix_middle_domain_alloc(struct irq_domain *domain, unsigned i
 		irq_domain_set_hwirq_and_chip(domain, virq + i, sgi + i,
 					      &middle_irq_chip, priv);
 	}
+
+	pr_debug("allocated %u MSIs starting from %u\n", nr_irqs, virq);
+
 	return 0;
 
 err_sgi:
@@ -132,6 +137,8 @@ static void alpine_msix_middle_domain_free(struct irq_domain *domain, unsigned i
 
 	irq_domain_free_irqs_parent(domain, virq, nr_irqs);
 	alpine_msix_free_sgi(priv, d->hwirq, nr_irqs);
+
+	pr_debug("freed %u MSIs starting from %u\n", nr_irqs, virq);
 }
 
 static const struct irq_domain_ops alpine_msix_middle_domain_ops = {
@@ -235,6 +242,9 @@ static int alpine_msix_init(struct device_node *node, struct device_node *parent
 	if (ret)
 		return ret;
 
+	pr_info("initialized successfully, SPI %u to %u\n",
+		priv->spi_first, priv->spi_first + priv->num_spis - 1);
+
 	retain_and_null_ptr(priv);
 	retain_and_null_ptr(msi_map);
 	return 0;
merge bot Applied
#9 lore raw

[tip: irq/drivers] irqchip/alpine-msi: Fix format and wording of the registration debug print

In reply to Eliav Farber
The following commit has been merged into the irq/drivers branch of tip:

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

Commit-ID:     f6ce421fb051511481c8f286f90d9d44891089da
Gitweb:        https://git.kernel.org/tip/f6ce421fb051511481c8f286f90d9d44891089da
Author:        Eliav Farber <[email protected]>
AuthorDate:    Sat, 24 Oct 2026 19:36:19 
Committer:     Thomas Gleixner <[email protected]>
CommitterDate: Mon, 09 Nov 2026 10:20:18 +01:00

irqchip/alpine-msi: Fix format and wording of the registration debug print

The "Registering" debug message in alpine_msix_init() prints priv->num_spis and priv->spi_first, both u32, with %d. Use %u to match their type, and fix the "msixs" wording while at it. No functional change.

---
 drivers/irqchip/irq-alpine-msi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-alpine-msi.c +1 -1
index 8155f63..fb84b60 100644
@@ -229,7 +229,7 @@ static int alpine_msix_init(struct device_node *node, struct device_node *parent
 		return -ENOMEM;
 	priv->msi_map = msi_map;
 
-	pr_debug("Registering %d msixs, starting at %d\n", priv->num_spis, priv->spi_first);
+	pr_debug("Registering %u MSIs, starting at SPI %u\n", priv->num_spis, priv->spi_first);
 
 	ret = alpine_msix_init_domains(priv, node);
 	if (ret)
merge bot Applied
#4 lore raw

[tip: irq/drivers] irqchip/alpine-msi: Drop redundant asm/msi.h include

In reply to Eliav Farber
The following commit has been merged into the irq/drivers branch of tip:

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

Commit-ID:     34f1c8b1ea1460d27353c11adb0ac722cecc8bbc
Gitweb:        https://git.kernel.org/tip/34f1c8b1ea1460d27353c11adb0ac722cecc8bbc
Author:        Eliav Farber <[email protected]>
AuthorDate:    Sat, 24 Oct 2026 19:36:17 
Committer:     Thomas Gleixner <[email protected]>
CommitterDate: Mon, 09 Nov 2026 10:20:18 +01:00

irqchip/alpine-msi: Drop redundant asm/msi.h include

The driver already includes <linux/msi.h>, which itself pulls in <asm/msi.h>, so the explicit arch include is redundant. Remove it; checkpatch also flags the direct use of the asm header in favour of the linux one. No functional change.

---
 drivers/irqchip/irq-alpine-msi.c | 1 -
 1 file changed, 1 deletion(-)
drivers/irqchip/irq-alpine-msi.c +0 -1
index 0d97abb..20f1f7f 100644
@@ -21,7 +21,6 @@
 #include <linux/slab.h>
 
 #include <asm/irq.h>
-#include <asm/msi.h>
 
 /* MSIX message address format: local GIC target */
 #define ALPINE_MSIX_SPI_TARGET_CLUSTER0		BIT(16)
merge bot Applied
#6 lore raw

[tip: irq/drivers] irqchip/alpine-msi: Add missing space after comma in GENMASK_ULL

In reply to Eliav Farber
The following commit has been merged into the irq/drivers branch of tip:

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

Commit-ID:     88b4eda43e98f2d3ede58999ebc6281ee7a82ee3
Gitweb:        https://git.kernel.org/tip/88b4eda43e98f2d3ede58999ebc6281ee7a82ee3
Author:        Eliav Farber <[email protected]>
AuthorDate:    Sat, 24 Oct 2026 19:36:18 
Committer:     Thomas Gleixner <[email protected]>
CommitterDate: Mon, 09 Nov 2026 10:20:18 +01:00

irqchip/alpine-msi: Add missing space after comma in GENMASK_ULL

Fix the coding-style issue reported by checkpatch:

ERROR: space required after that ',' (ctx:VxV)

No functional change.

---
 drivers/irqchip/irq-alpine-msi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-alpine-msi.c +1 -1
index 20f1f7f..8155f63 100644
@@ -210,7 +210,7 @@ static int alpine_msix_init(struct device_node *node, struct device_node *parent
 	 * To select the primary GIC as the target GIC, bits [18:17] must be set
 	 * to 0x0. In this case, bit 16 (SPI_TARGET_CLUSTER0) must be set.
 	 */
-	priv->addr = res.start & GENMASK_ULL(63,20);
+	priv->addr = res.start & GENMASK_ULL(63, 20);
 	priv->addr |= ALPINE_MSIX_SPI_TARGET_CLUSTER0;
 
 	if (of_property_read_u32(node, "al,msi-base-spi", &priv->spi_first)) {
merge bot Applied
#2 lore raw

[tip: irq/drivers] irqchip/alpine-msi: Use SPDX-License-Identifier

In reply to Eliav Farber
The following commit has been merged into the irq/drivers branch of tip:

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

Commit-ID:     8b95bdbad8b11cb9ba24423bbd996510adc5be10
Gitweb:        https://git.kernel.org/tip/8b95bdbad8b11cb9ba24423bbd996510adc5be10
Author:        Eliav Farber <[email protected]>
AuthorDate:    Sat, 24 Oct 2026 19:36:16 
Committer:     Thomas Gleixner <[email protected]>
CommitterDate: Mon, 09 Nov 2026 10:20:18 +01:00

irqchip/alpine-msi: Use SPDX-License-Identifier

Replace the free-form GPL v2 license boilerplate with the equivalent SPDX-License-Identifier tag, as preferred for new and updated files. No functional change.

---
 drivers/irqchip/irq-alpine-msi.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/irqchip/irq-alpine-msi.c +1 -4
index 6764d64..0d97abb 100644
@@ -1,13 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Annapurna Labs MSIX support services
  *
  * Copyright (C) 2016, Amazon.com, Inc. or its affiliates. All Rights Reserved.
  *
  * Antoine Tenart <[email protected]>
- *
- * This file is licensed under the terms of the GNU General Public
- * License version 2. This program is licensed "as is" without any
- * warranty of any kind, whether express or implied.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt