irqchip/alpine-msi: Cleanups and debug logging
Subsystems (2)
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-3 are trivial, no-functional-change cleanups that address the coding-style issues checkpatch reports for the file: convert the license boilerplate to an SPDX identifier, drop the redundant <asm/msi.h> include (already pulled in via <linux/msi.h>), and fix the missing space after a comma in a GENMASK_ULL() invocation.
Patch 4 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.
Eliav Farber (4):
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: Add debug logging for MSI allocation
drivers/irqchip/irq-alpine-msi.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
Signature · 1 line
2.47.3
PATCH 3/4 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
@@ -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
PATCH 1/4 irqchip/alpine-msi: Use SPDX-License-Identifier
In reply to Eliav FarberReplace 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
@@ -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
PATCH 4/4 irqchip/alpine-msi: Add debug logging for MSI allocation
In reply to Eliav FarberAdd 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
@@ -104,6 +104,8 @@ static int alpine_msix_middle_domain_alloc(struct irq_domain *domain, unsigned istruct alpine_msix_data *priv = domain->host_data;int sgi, err, i; +pr_debug ("trying to allocate %d msi starting from %d\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 iirq_domain_set_hwirq_and_chip (domain, virq + i, sgi + i, &middle_irq_chip, priv); } + +pr_debug ("allocated %d msi starting from %d\n" , nr_irqs, virq); +return 0 ; err_sgi:
@@ -132,6 +137,8 @@ static void alpine_msix_middle_domain_free(struct irq_domain *domain, unsigned iirq_domain_free_irqs_parent (domain, virq, nr_irqs);alpine_msix_free_sgi (priv, d->hwirq, nr_irqs); + +pr_debug ("freed %d msi starting from %d\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 *parentif (ret)return ret; +pr_info ("initialized successfully, spi %d to %d\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
PATCH 2/4 irqchip/alpine-msi: Drop redundant asm/msi.h include
In reply to Eliav FarberThe 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
@@ -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
Re: [PATCH 1/4] irqchip/alpine-msi: Use SPDX-License-Identifier
In reply to Eliav FarberQuoted 26 lines · Eliav Farber
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.
Signed-off-by Eliav Farber <[email protected]>---
drivers/irqchip/irq-alpine-msi.c | 5 +----1 file changed, 1 insertion(+), 4 deletions(-)drivers/irqchip/irq-alpine-msi.c +1
-4@@ -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. */
Quoted 2 lines
#definepr_fmt(fmt)KBUILD_MODNAME": " fmt
Re: [PATCH 2/4] irqchip/alpine-msi: Drop redundant asm/msi.h include
In reply to Eliav FarberQuoted 16 lines · 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.Signed-off-by Eliav Farber <[email protected]>---
drivers/irqchip/irq-alpine-msi.c | 1 -1 file changed, 1 deletion(-)drivers/irqchip/irq-alpine-msi.c +0
-0@@ -21,7 +21,6 @@ #include <linux/slab.h>
Quoted 6 lines
#include <asm/irq.h>
-#include <asm/msi.h>
/* MSIX message address format: local GIC target */
#defineALPINE_MSIX_SPI_TARGET_CLUSTER0BIT(16)
Re: [PATCH 3/4] irqchip/alpine-msi: Add missing space after comma in GENMASK_ULL
In reply to Eliav FarberQuoted 22 lines · Eliav Farber
Fix the coding-style issue reported by checkpatch:
ERROR: space required after that ',' (ctx:VxV)
No functional change.
Signed-off-by Eliav Farber <[email protected]>---
drivers/irqchip/irq-alpine-msi.c | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/irqchip/irq-alpine-msi.c +1
-1@@ -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;
Quoted 2 lines
if (of_property_read_u32(node, "al,msi-base-spi", &priv->spi_first)) {
Radu Rendec
reviewerRe: [PATCH 4/4] irqchip/alpine-msi: Add debug logging for MSI allocation
In reply to Eliav FarberQuoted 48 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.
Signed-off-by Eliav Farber <[email protected]>---
drivers/irqchip/irq-alpine-msi.c | 10 ++++++++++1 file changed, 10 insertions(+)drivers/irqchip/irq-alpine-msi.c +0
-0@@ -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 %d msi starting from %d\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 %d msi starting from %d\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 %d msi starting from %d\n" , nr_irqs, virq);}
static const structirq_domain_opsalpine_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 %d to %d\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;
Not that this matters in reality (because all these numbers are "small") but for the sake of correctness: all the variables you added messages for are unsigned, so you should use %u on them.
Since you're cleaning up this driver, you may want to look at the other prints. For example, the existing pr_debug() in alpine_msix_init() has the same problem.
Signature · 2 lines
Regards, Radu
RE: [PATCH 4/4] irqchip/alpine-msi: Add debug logging for MSI allocation
Quoted 4 lines · Radu Rendec
Quoted 3 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.
[...]
Quoted 10 lines
drivers/irqchip/irq-alpine-msi.c static int alpine_msix_init(struct device_node *node, struct device_node *parent · line 250
Quoted 6 lines
drivers/irqchip/irq-alpine-msi.c +3
-0+pr_info ("initialized successfully, spi %d to %d\n" , + priv->spi_first, priv->spi_first + priv->num_spis -1 ); +retain_and_null_ptr (priv);retain_and_null_ptr (msi_map);return 0 ;Not that this matters in reality (because all these numbers are "small") but for the sake of correctness: all the variables you added messages for are unsigned, so you should use %u on them.
Thanks for the review. Fixed in v2: all the new messages use %u.
Quoted 3 lines
Since you're cleaning up this driver, you may want to look at the other prints. For example, the existing
pr_debug()inalpine_msix_init()has the same problem.
Fixed in a separate patch in v2, which also corrects the wording of that message. The other prints in the driver are pr_err() calls without any arguments, so nothing else needed changing.
Thanks,
Eliav
Radu Rendec
reviewerRe: [PATCH 4/4] irqchip/alpine-msi: Add debug logging for MSI allocation
Quoted 15 lines · Eliav
Quoted 4 lines · Radu Rendec
Quoted 3 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.
[...]
Quoted 7 lines
Quoted 6 lines
+ pr_info("initialized successfully, spi %d to %d\n", +
priv->spi_first,priv->spi_first+priv->num_spis- 1); +
retain_and_null_ptr(priv);retain_and_null_ptr(msi_map);
return 0;
Quoted 5 lines
Quoted 3 lines
Not that this matters in reality (because all these numbers are "small") but for the sake of correctness: all the variables you added messages for are unsigned, so you should use %u on them.
Thanks for the review. Fixed in v2: all the new messages use %u.
You're welcome. Thanks for fixing it and sorry for the late reply!
Quoted 7 lines
Quoted 3 lines
Since you're cleaning up this driver, you may want to look at the other prints. For example, the existing
pr_debug()inalpine_msix_init()has the same problem.Fixed in a separate patch in v2, which also corrects the wording of that message. The other prints in the driver are
pr_err()calls without any arguments, so nothing else needed changing.
Sounds good, thanks!
Signature · 1 line
Radu