* [PATCH 00/10] armada-370-xp irqchip updates round 4
@ 2024-07-11 16:08 Marek Behún
2024-07-11 16:08 ` [PATCH 01/10] irqchip/armada-370-xp: Use consistent variable names for hwirqs Marek Behún
` (10 more replies)
0 siblings, 11 replies; 34+ messages in thread
From: Marek Behún @ 2024-07-11 16:08 UTC (permalink / raw)
To: Andrew Lunn, Gregory Clement, Sebastian Hesselbarth,
Thomas Gleixner, linux-arm-kernel, arm, Andy Shevchenko,
Hans de Goede, Ilpo Järvinen
Cc: Marek Behún
Hi Thomas, Andrew, Ilpo et al.,
since round 3 was reviewed so quickly, here comes round 4, which should
be similarly easy to review.
This series can be applied on tip/irq/core, but only after round 2 and
round 3 series are applied:
https://patchwork.kernel.org/project/linux-arm-kernel/list/?series=869325
https://patchwork.kernel.org/project/linux-arm-kernel/list/?series=870469
Marek
Marek Behún (10):
irqchip/armada-370-xp: Use consistent variable names for hwirqs
irqchip/armada-370-xp: Use consistent types when iterating interrupts
irqchip/armada-370-xp: Use consistent name for struct irq_data
variables
irqchip/armada-370-xp: Simplify mpic_reenable_percpu() and
mpic_resume()
irqchip/armada-370-xp: Drop unneeded curly brackets
irqchip/armada-370-xp: Drop redundant continue
irqchip/armada-370-xp: Rename variable for consistency
irqchip/armada-370-xp: Use u32 type instead of unsigned long where
possieble
irqchip/armada-370-xp: Refactor initial memory regions mapping
irqchip/armada-370-xp: Print error and return error code on
initialization failure
drivers/irqchip/irq-armada-370-xp.c | 201 ++++++++++++++++------------
1 file changed, 118 insertions(+), 83 deletions(-)
--
2.44.2
^ permalink raw reply [flat|nested] 34+ messages in thread
* [PATCH 01/10] irqchip/armada-370-xp: Use consistent variable names for hwirqs
2024-07-11 16:08 [PATCH 00/10] armada-370-xp irqchip updates round 4 Marek Behún
@ 2024-07-11 16:08 ` Marek Behún
2024-07-29 9:49 ` [tip: irq/core] " tip-bot2 for Marek Behún
2024-07-30 11:39 ` tip-bot2 for Marek Behún
2024-07-11 16:08 ` [PATCH 02/10] irqchip/armada-370-xp: Use consistent types when iterating interrupts Marek Behún
` (9 subsequent siblings)
10 siblings, 2 replies; 34+ messages in thread
From: Marek Behún @ 2024-07-11 16:08 UTC (permalink / raw)
To: Andrew Lunn, Gregory Clement, Sebastian Hesselbarth,
Thomas Gleixner, linux-arm-kernel, arm, Andy Shevchenko,
Hans de Goede, Ilpo Järvinen
Cc: Marek Behún
Use consistent variable names for hwirqs: when iterating, use "i",
otherwise use "hwirq".
Signed-off-by: Marek Behún <kabel@kernel.org>
---
drivers/irqchip/irq-armada-370-xp.c | 56 ++++++++++++++---------------
1 file changed, 28 insertions(+), 28 deletions(-)
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index be1c3721f980..a710a325f81a 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -117,7 +117,7 @@
#define MPIC_SW_TRIG_INT 0x04
#define MPIC_INT_SET_ENABLE 0x30
#define MPIC_INT_CLEAR_ENABLE 0x34
-#define MPIC_INT_SOURCE_CTL(irq) (0x100 + (irq) * 4)
+#define MPIC_INT_SOURCE_CTL(hwirq) (0x100 + (hwirq) * 4)
#define MPIC_INT_SOURCE_CPU_MASK GENMASK(3, 0)
#define MPIC_INT_IRQ_FIQ_MASK(cpuid) ((BIT(0) | BIT(8)) << (cpuid))
@@ -199,9 +199,9 @@ static inline unsigned int msi_doorbell_end(void)
PCI_MSI_FULL_DOORBELL_END;
}
-static inline bool mpic_is_percpu_irq(irq_hw_number_t irq)
+static inline bool mpic_is_percpu_irq(irq_hw_number_t hwirq)
{
- return irq <= MPIC_MAX_PER_CPU_IRQS;
+ return hwirq <= MPIC_MAX_PER_CPU_IRQS;
}
/*
@@ -530,11 +530,11 @@ static void mpic_smp_cpu_init(void)
static void mpic_reenable_percpu(void)
{
/* Re-enable per-CPU interrupts that were enabled before suspend */
- for (unsigned int irq = 0; irq < MPIC_MAX_PER_CPU_IRQS; irq++) {
+ for (unsigned int i = 0; i < MPIC_MAX_PER_CPU_IRQS; i++) {
struct irq_data *data;
unsigned int virq;
- virq = irq_linear_revmap(mpic_domain, irq);
+ virq = irq_linear_revmap(mpic_domain, i);
if (!virq)
continue;
@@ -586,20 +586,20 @@ static struct irq_chip mpic_irq_chip = {
};
static int mpic_irq_map(struct irq_domain *h, unsigned int virq,
- irq_hw_number_t hw)
+ irq_hw_number_t hwirq)
{
/* IRQs 0 and 1 cannot be mapped, they are handled internally */
- if (hw <= 1)
+ if (hwirq <= 1)
return -EINVAL;
mpic_irq_mask(irq_get_irq_data(virq));
- if (!mpic_is_percpu_irq(hw))
- writel(hw, per_cpu_int_base + MPIC_INT_CLEAR_MASK);
+ if (!mpic_is_percpu_irq(hwirq))
+ writel(hwirq, per_cpu_int_base + MPIC_INT_CLEAR_MASK);
else
- writel(hw, main_int_base + MPIC_INT_SET_ENABLE);
+ writel(hwirq, main_int_base + MPIC_INT_SET_ENABLE);
irq_set_status_flags(virq, IRQ_LEVEL);
- if (mpic_is_percpu_irq(hw)) {
+ if (mpic_is_percpu_irq(hwirq)) {
irq_set_percpu_devid(virq);
irq_set_chip_and_handler(virq, &mpic_irq_chip,
handle_percpu_devid_irq);
@@ -654,15 +654,15 @@ static inline void mpic_handle_ipi_irq(void) {}
static void mpic_handle_cascade_irq(struct irq_desc *desc)
{
struct irq_chip *chip = irq_desc_get_chip(desc);
- unsigned long irqmap, irqn, irqsrc, cpuid;
+ unsigned long irqmap, i, irqsrc, cpuid;
chained_irq_enter(chip, desc);
irqmap = readl_relaxed(per_cpu_int_base + MPIC_PPI_CAUSE);
cpuid = cpu_logical_map(smp_processor_id());
- for_each_set_bit(irqn, &irqmap, BITS_PER_LONG) {
- irqsrc = readl_relaxed(main_int_base + MPIC_INT_SOURCE_CTL(irqn));
+ for_each_set_bit(i, &irqmap, BITS_PER_LONG) {
+ irqsrc = readl_relaxed(main_int_base + MPIC_INT_SOURCE_CTL(i));
/* Check if the interrupt is not masked on current CPU.
* Test IRQ (0-1) and FIQ (8-9) mask bits.
@@ -670,12 +670,12 @@ static void mpic_handle_cascade_irq(struct irq_desc *desc)
if (!(irqsrc & MPIC_INT_IRQ_FIQ_MASK(cpuid)))
continue;
- if (irqn == 0 || irqn == 1) {
+ if (i == 0 || i == 1) {
mpic_handle_msi_irq();
continue;
}
- generic_handle_domain_irq(mpic_domain, irqn);
+ generic_handle_domain_irq(mpic_domain, i);
}
chained_irq_exit(chip, desc);
@@ -683,26 +683,26 @@ static void mpic_handle_cascade_irq(struct irq_desc *desc)
static void __exception_irq_entry mpic_handle_irq(struct pt_regs *regs)
{
- u32 irqstat, irqnr;
+ u32 irqstat, i;
do {
irqstat = readl_relaxed(per_cpu_int_base + MPIC_CPU_INTACK);
- irqnr = FIELD_GET(MPIC_CPU_INTACK_IID_MASK, irqstat);
+ i = FIELD_GET(MPIC_CPU_INTACK_IID_MASK, irqstat);
- if (irqnr > 1022)
+ if (i > 1022)
break;
- if (irqnr > 1) {
- generic_handle_domain_irq(mpic_domain, irqnr);
+ if (i > 1) {
+ generic_handle_domain_irq(mpic_domain, i);
continue;
}
/* MSI handling */
- if (irqnr == 1)
+ if (i == 1)
mpic_handle_msi_irq();
/* IPI Handling */
- if (irqnr == 0)
+ if (i == 0)
mpic_handle_ipi_irq();
} while (1);
}
@@ -719,24 +719,24 @@ static void mpic_resume(void)
bool src0, src1;
/* Re-enable interrupts */
- for (irq_hw_number_t irq = 0; irq < mpic_domain->hwirq_max; irq++) {
+ for (irq_hw_number_t i = 0; i < mpic_domain->hwirq_max; i++) {
struct irq_data *data;
unsigned int virq;
- virq = irq_linear_revmap(mpic_domain, irq);
+ virq = irq_linear_revmap(mpic_domain, i);
if (!virq)
continue;
data = irq_get_irq_data(virq);
- if (!mpic_is_percpu_irq(irq)) {
+ if (!mpic_is_percpu_irq(i)) {
/* Non per-CPU interrupts */
- writel(irq, per_cpu_int_base + MPIC_INT_CLEAR_MASK);
+ writel(i, per_cpu_int_base + MPIC_INT_CLEAR_MASK);
if (!irqd_irq_disabled(data))
mpic_irq_unmask(data);
} else {
/* Per-CPU interrupts */
- writel(irq, main_int_base + MPIC_INT_SET_ENABLE);
+ writel(i, main_int_base + MPIC_INT_SET_ENABLE);
/*
* Re-enable on the current CPU, mpic_reenable_percpu()
--
2.44.2
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 02/10] irqchip/armada-370-xp: Use consistent types when iterating interrupts
2024-07-11 16:08 [PATCH 00/10] armada-370-xp irqchip updates round 4 Marek Behún
2024-07-11 16:08 ` [PATCH 01/10] irqchip/armada-370-xp: Use consistent variable names for hwirqs Marek Behún
@ 2024-07-11 16:08 ` Marek Behún
2024-07-29 9:49 ` [tip: irq/core] " tip-bot2 for Marek Behún
2024-07-30 11:39 ` tip-bot2 for Marek Behún
2024-07-11 16:09 ` [PATCH 03/10] irqchip/armada-370-xp: Use consistent name for struct irq_data variables Marek Behún
` (8 subsequent siblings)
10 siblings, 2 replies; 34+ messages in thread
From: Marek Behún @ 2024-07-11 16:08 UTC (permalink / raw)
To: Andrew Lunn, Gregory Clement, Sebastian Hesselbarth,
Thomas Gleixner, linux-arm-kernel, arm, Andy Shevchenko,
Hans de Goede, Ilpo Järvinen
Cc: Marek Behún
When iterating, use either the irq_hw_number_t type or the unsigned int
type for the iterator variable, depending on whether the variable
represents HW IRQ number or whether it is added to a IRQ number.
Signed-off-by: Marek Behún <kabel@kernel.org>
---
drivers/irqchip/irq-armada-370-xp.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index a710a325f81a..27bceb911912 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -289,7 +289,7 @@ static int mpic_msi_alloc(struct irq_domain *domain, unsigned int virq,
if (hwirq < 0)
return -ENOSPC;
- for (int i = 0; i < nr_irqs; i++) {
+ for (unsigned int i = 0; i < nr_irqs; i++) {
irq_domain_set_info(domain, virq + i, hwirq + i,
&mpic_msi_bottom_irq_chip,
domain->host_data, handle_simple_irq,
@@ -438,7 +438,7 @@ static struct irq_chip mpic_ipi_irqchip = {
static int mpic_ipi_alloc(struct irq_domain *d, unsigned int virq,
unsigned int nr_irqs, void *args)
{
- for (int i = 0; i < nr_irqs; i++) {
+ for (unsigned int i = 0; i < nr_irqs; i++) {
irq_set_percpu_devid(virq + i);
irq_domain_set_info(d, virq + i, i, &mpic_ipi_irqchip,
d->host_data, handle_percpu_devid_irq,
@@ -461,7 +461,7 @@ static const struct irq_domain_ops mpic_ipi_domain_ops = {
static void mpic_ipi_resume(void)
{
- for (int i = 0; i < IPI_DOORBELL_END; i++) {
+ for (irq_hw_number_t i = 0; i < IPI_DOORBELL_END; i++) {
unsigned int virq = irq_find_mapping(mpic_ipi_domain, i);
struct irq_data *d;
@@ -511,7 +511,7 @@ static int mpic_set_affinity(struct irq_data *d, const struct cpumask *mask_val,
static void mpic_smp_cpu_init(void)
{
- for (int i = 0; i < mpic_domain->hwirq_max; i++)
+ for (irq_hw_number_t i = 0; i < mpic_domain->hwirq_max; i++)
writel(i, per_cpu_int_base + MPIC_INT_SET_MASK);
if (!mpic_is_ipi_available())
@@ -530,7 +530,7 @@ static void mpic_smp_cpu_init(void)
static void mpic_reenable_percpu(void)
{
/* Re-enable per-CPU interrupts that were enabled before suspend */
- for (unsigned int i = 0; i < MPIC_MAX_PER_CPU_IRQS; i++) {
+ for (irq_hw_number_t i = 0; i < MPIC_MAX_PER_CPU_IRQS; i++) {
struct irq_data *data;
unsigned int virq;
@@ -654,7 +654,8 @@ static inline void mpic_handle_ipi_irq(void) {}
static void mpic_handle_cascade_irq(struct irq_desc *desc)
{
struct irq_chip *chip = irq_desc_get_chip(desc);
- unsigned long irqmap, i, irqsrc, cpuid;
+ unsigned long irqmap, irqsrc, cpuid;
+ irq_hw_number_t i;
chained_irq_enter(chip, desc);
@@ -683,7 +684,8 @@ static void mpic_handle_cascade_irq(struct irq_desc *desc)
static void __exception_irq_entry mpic_handle_irq(struct pt_regs *regs)
{
- u32 irqstat, i;
+ irq_hw_number_t i;
+ u32 irqstat;
do {
irqstat = readl_relaxed(per_cpu_int_base + MPIC_CPU_INTACK);
@@ -799,7 +801,7 @@ static int __init mpic_of_init(struct device_node *node,
nr_irqs = FIELD_GET(MPIC_INT_CONTROL_NUMINT_MASK,
readl(main_int_base + MPIC_INT_CONTROL));
- for (int i = 0; i < nr_irqs; i++)
+ for (irq_hw_number_t i = 0; i < nr_irqs; i++)
writel(i, main_int_base + MPIC_INT_CLEAR_ENABLE);
mpic_domain = irq_domain_add_linear(node, nr_irqs, &mpic_irq_ops, NULL);
--
2.44.2
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 03/10] irqchip/armada-370-xp: Use consistent name for struct irq_data variables
2024-07-11 16:08 [PATCH 00/10] armada-370-xp irqchip updates round 4 Marek Behún
2024-07-11 16:08 ` [PATCH 01/10] irqchip/armada-370-xp: Use consistent variable names for hwirqs Marek Behún
2024-07-11 16:08 ` [PATCH 02/10] irqchip/armada-370-xp: Use consistent types when iterating interrupts Marek Behún
@ 2024-07-11 16:09 ` Marek Behún
2024-07-29 9:49 ` [tip: irq/core] " tip-bot2 for Marek Behún
2024-07-30 11:39 ` tip-bot2 for Marek Behún
2024-07-11 16:09 ` [PATCH 04/10] irqchip/armada-370-xp: Simplify mpic_reenable_percpu() and mpic_resume() Marek Behún
` (7 subsequent siblings)
10 siblings, 2 replies; 34+ messages in thread
From: Marek Behún @ 2024-07-11 16:09 UTC (permalink / raw)
To: Andrew Lunn, Gregory Clement, Sebastian Hesselbarth,
Thomas Gleixner, linux-arm-kernel, arm, Andy Shevchenko,
Hans de Goede, Ilpo Järvinen
Cc: Marek Behún
Always use variable name "d" for struct irq_data *, for consistency.
Signed-off-by: Marek Behún <kabel@kernel.org>
---
drivers/irqchip/irq-armada-370-xp.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index 27bceb911912..9e4fc91fe422 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -243,17 +243,17 @@ static struct msi_domain_info mpic_msi_domain_info = {
.chip = &mpic_msi_irq_chip,
};
-static void mpic_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
+static void mpic_compose_msi_msg(struct irq_data *d, struct msi_msg *msg)
{
- unsigned int cpu = cpumask_first(irq_data_get_effective_affinity_mask(data));
+ unsigned int cpu = cpumask_first(irq_data_get_effective_affinity_mask(d));
msg->address_lo = lower_32_bits(msi_doorbell_addr);
msg->address_hi = upper_32_bits(msi_doorbell_addr);
- msg->data = BIT(cpu + 8) | (data->hwirq + msi_doorbell_start());
+ msg->data = BIT(cpu + 8) | (d->hwirq + msi_doorbell_start());
}
-static int mpic_msi_set_affinity(struct irq_data *irq_data,
- const struct cpumask *mask, bool force)
+static int mpic_msi_set_affinity(struct irq_data *d, const struct cpumask *mask,
+ bool force)
{
unsigned int cpu;
@@ -265,7 +265,7 @@ static int mpic_msi_set_affinity(struct irq_data *irq_data,
if (cpu >= nr_cpu_ids)
return -EINVAL;
- irq_data_update_effective_affinity(irq_data, cpumask_of(cpu));
+ irq_data_update_effective_affinity(d, cpumask_of(cpu));
return IRQ_SET_MASK_OK;
}
@@ -531,19 +531,19 @@ static void mpic_reenable_percpu(void)
{
/* Re-enable per-CPU interrupts that were enabled before suspend */
for (irq_hw_number_t i = 0; i < MPIC_MAX_PER_CPU_IRQS; i++) {
- struct irq_data *data;
+ struct irq_data *d;
unsigned int virq;
virq = irq_linear_revmap(mpic_domain, i);
if (!virq)
continue;
- data = irq_get_irq_data(virq);
+ d = irq_get_irq_data(virq);
if (!irq_percpu_is_enabled(virq))
continue;
- mpic_irq_unmask(data);
+ mpic_irq_unmask(d);
}
if (mpic_is_ipi_available())
@@ -722,20 +722,20 @@ static void mpic_resume(void)
/* Re-enable interrupts */
for (irq_hw_number_t i = 0; i < mpic_domain->hwirq_max; i++) {
- struct irq_data *data;
+ struct irq_data *d;
unsigned int virq;
virq = irq_linear_revmap(mpic_domain, i);
if (!virq)
continue;
- data = irq_get_irq_data(virq);
+ d = irq_get_irq_data(virq);
if (!mpic_is_percpu_irq(i)) {
/* Non per-CPU interrupts */
writel(i, per_cpu_int_base + MPIC_INT_CLEAR_MASK);
- if (!irqd_irq_disabled(data))
- mpic_irq_unmask(data);
+ if (!irqd_irq_disabled(d))
+ mpic_irq_unmask(d);
} else {
/* Per-CPU interrupts */
writel(i, main_int_base + MPIC_INT_SET_ENABLE);
@@ -745,7 +745,7 @@ static void mpic_resume(void)
* will take care of secondary CPUs when they come up.
*/
if (irq_percpu_is_enabled(virq))
- mpic_irq_unmask(data);
+ mpic_irq_unmask(d);
}
}
--
2.44.2
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 04/10] irqchip/armada-370-xp: Simplify mpic_reenable_percpu() and mpic_resume()
2024-07-11 16:08 [PATCH 00/10] armada-370-xp irqchip updates round 4 Marek Behún
` (2 preceding siblings ...)
2024-07-11 16:09 ` [PATCH 03/10] irqchip/armada-370-xp: Use consistent name for struct irq_data variables Marek Behún
@ 2024-07-11 16:09 ` Marek Behún
2024-07-29 9:49 ` [tip: irq/core] " tip-bot2 for Marek Behún
2024-07-30 11:39 ` tip-bot2 for Marek Behún
2024-07-11 16:09 ` [PATCH 05/10] irqchip/armada-370-xp: Drop unneeded curly brackets Marek Behún
` (6 subsequent siblings)
10 siblings, 2 replies; 34+ messages in thread
From: Marek Behún @ 2024-07-11 16:09 UTC (permalink / raw)
To: Andrew Lunn, Gregory Clement, Sebastian Hesselbarth,
Thomas Gleixner, linux-arm-kernel, arm, Andy Shevchenko,
Hans de Goede, Ilpo Järvinen
Cc: Marek Behún
Refactor the mpic_reenable_percpu() and mpic_resume() functions to make
them a little bit simpler.
Signed-off-by: Marek Behún <kabel@kernel.org>
---
drivers/irqchip/irq-armada-370-xp.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index 9e4fc91fe422..3fc669cfd494 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -531,18 +531,13 @@ static void mpic_reenable_percpu(void)
{
/* Re-enable per-CPU interrupts that were enabled before suspend */
for (irq_hw_number_t i = 0; i < MPIC_MAX_PER_CPU_IRQS; i++) {
+ unsigned int virq = irq_linear_revmap(mpic_domain, i);
struct irq_data *d;
- unsigned int virq;
- virq = irq_linear_revmap(mpic_domain, i);
- if (!virq)
+ if (!virq || !irq_percpu_is_enabled(virq))
continue;
d = irq_get_irq_data(virq);
-
- if (!irq_percpu_is_enabled(virq))
- continue;
-
mpic_irq_unmask(d);
}
@@ -722,10 +717,9 @@ static void mpic_resume(void)
/* Re-enable interrupts */
for (irq_hw_number_t i = 0; i < mpic_domain->hwirq_max; i++) {
+ unsigned int virq = irq_linear_revmap(mpic_domain, i);
struct irq_data *d;
- unsigned int virq;
- virq = irq_linear_revmap(mpic_domain, i);
if (!virq)
continue;
--
2.44.2
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 05/10] irqchip/armada-370-xp: Drop unneeded curly brackets
2024-07-11 16:08 [PATCH 00/10] armada-370-xp irqchip updates round 4 Marek Behún
` (3 preceding siblings ...)
2024-07-11 16:09 ` [PATCH 04/10] irqchip/armada-370-xp: Simplify mpic_reenable_percpu() and mpic_resume() Marek Behún
@ 2024-07-11 16:09 ` Marek Behún
2024-07-29 8:52 ` Thomas Gleixner
2024-07-11 16:09 ` [PATCH 06/10] irqchip/armada-370-xp: Drop redundant continue Marek Behún
` (5 subsequent siblings)
10 siblings, 1 reply; 34+ messages in thread
From: Marek Behún @ 2024-07-11 16:09 UTC (permalink / raw)
To: Andrew Lunn, Gregory Clement, Sebastian Hesselbarth,
Thomas Gleixner, linux-arm-kernel, arm, Andy Shevchenko,
Hans de Goede, Ilpo Järvinen
Cc: Marek Behún
Drop unneeded curly brackets in mpic_msi_alloc().
Signed-off-by: Marek Behún <kabel@kernel.org>
---
drivers/irqchip/irq-armada-370-xp.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index 3fc669cfd494..3d4f32f340f6 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -289,12 +289,11 @@ static int mpic_msi_alloc(struct irq_domain *domain, unsigned int virq,
if (hwirq < 0)
return -ENOSPC;
- for (unsigned int i = 0; i < nr_irqs; i++) {
+ for (unsigned int i = 0; i < nr_irqs; i++)
irq_domain_set_info(domain, virq + i, hwirq + i,
&mpic_msi_bottom_irq_chip,
domain->host_data, handle_simple_irq,
NULL, NULL);
- }
return 0;
}
--
2.44.2
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 06/10] irqchip/armada-370-xp: Drop redundant continue
2024-07-11 16:08 [PATCH 00/10] armada-370-xp irqchip updates round 4 Marek Behún
` (4 preceding siblings ...)
2024-07-11 16:09 ` [PATCH 05/10] irqchip/armada-370-xp: Drop unneeded curly brackets Marek Behún
@ 2024-07-11 16:09 ` Marek Behún
2024-07-29 9:49 ` [tip: irq/core] " tip-bot2 for Marek Behún
2024-07-30 11:39 ` tip-bot2 for Marek Behún
2024-07-11 16:09 ` [PATCH 07/10] irqchip/armada-370-xp: Rename variable for consistency Marek Behún
` (4 subsequent siblings)
10 siblings, 2 replies; 34+ messages in thread
From: Marek Behún @ 2024-07-11 16:09 UTC (permalink / raw)
To: Andrew Lunn, Gregory Clement, Sebastian Hesselbarth,
Thomas Gleixner, linux-arm-kernel, arm, Andy Shevchenko,
Hans de Goede, Ilpo Järvinen
Cc: Marek Behún
Drop redundant continue from mpic_handle_irq().
Signed-off-by: Marek Behún <kabel@kernel.org>
---
drivers/irqchip/irq-armada-370-xp.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index 3d4f32f340f6..5f8bb693a0b1 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -688,10 +688,8 @@ static void __exception_irq_entry mpic_handle_irq(struct pt_regs *regs)
if (i > 1022)
break;
- if (i > 1) {
+ if (i > 1)
generic_handle_domain_irq(mpic_domain, i);
- continue;
- }
/* MSI handling */
if (i == 1)
--
2.44.2
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 07/10] irqchip/armada-370-xp: Rename variable for consistency
2024-07-11 16:08 [PATCH 00/10] armada-370-xp irqchip updates round 4 Marek Behún
` (5 preceding siblings ...)
2024-07-11 16:09 ` [PATCH 06/10] irqchip/armada-370-xp: Drop redundant continue Marek Behún
@ 2024-07-11 16:09 ` Marek Behún
2024-07-29 9:49 ` [tip: irq/core] " tip-bot2 for Marek Behún
2024-07-30 11:39 ` tip-bot2 for Marek Behún
2024-07-11 16:09 ` [PATCH 08/10] irqchip/armada-370-xp: Use u32 type instead of unsigned long where possieble Marek Behún
` (3 subsequent siblings)
10 siblings, 2 replies; 34+ messages in thread
From: Marek Behún @ 2024-07-11 16:09 UTC (permalink / raw)
To: Andrew Lunn, Gregory Clement, Sebastian Hesselbarth,
Thomas Gleixner, linux-arm-kernel, arm, Andy Shevchenko,
Hans de Goede, Ilpo Järvinen
Cc: Marek Behún
Rename the variable holding the cause register to "cause" in
mpic_handle_cascade_irq().
Signed-off-by: Marek Behún <kabel@kernel.org>
---
drivers/irqchip/irq-armada-370-xp.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index 5f8bb693a0b1..2021b7e47a93 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -648,15 +648,15 @@ static inline void mpic_handle_ipi_irq(void) {}
static void mpic_handle_cascade_irq(struct irq_desc *desc)
{
struct irq_chip *chip = irq_desc_get_chip(desc);
- unsigned long irqmap, irqsrc, cpuid;
+ unsigned long cause, irqsrc, cpuid;
irq_hw_number_t i;
chained_irq_enter(chip, desc);
- irqmap = readl_relaxed(per_cpu_int_base + MPIC_PPI_CAUSE);
+ cause = readl_relaxed(per_cpu_int_base + MPIC_PPI_CAUSE);
cpuid = cpu_logical_map(smp_processor_id());
- for_each_set_bit(i, &irqmap, BITS_PER_LONG) {
+ for_each_set_bit(i, &cause, BITS_PER_LONG) {
irqsrc = readl_relaxed(main_int_base + MPIC_INT_SOURCE_CTL(i));
/* Check if the interrupt is not masked on current CPU.
--
2.44.2
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 08/10] irqchip/armada-370-xp: Use u32 type instead of unsigned long where possieble
2024-07-11 16:08 [PATCH 00/10] armada-370-xp irqchip updates round 4 Marek Behún
` (6 preceding siblings ...)
2024-07-11 16:09 ` [PATCH 07/10] irqchip/armada-370-xp: Rename variable for consistency Marek Behún
@ 2024-07-11 16:09 ` Marek Behún
2024-07-29 9:49 ` [tip: irq/core] " tip-bot2 for Marek Behún
2024-07-30 11:39 ` tip-bot2 for Marek Behún
2024-07-11 16:09 ` [PATCH 09/10] irqchip/armada-370-xp: Refactor initial memory regions mapping Marek Behún
` (2 subsequent siblings)
10 siblings, 2 replies; 34+ messages in thread
From: Marek Behún @ 2024-07-11 16:09 UTC (permalink / raw)
To: Andrew Lunn, Gregory Clement, Sebastian Hesselbarth,
Thomas Gleixner, linux-arm-kernel, arm, Andy Shevchenko,
Hans de Goede, Ilpo Järvinen
Cc: Marek Behún
For consistency across the driver, use the u32 type instead of unsigned
long for holding register values and return value of cpu_logical_map().
One exception is when the variable is referenced for passing into
for_each_set_bit(), in which case it has to be unsigned long.
Signed-off-by: Marek Behún <kabel@kernel.org>
---
drivers/irqchip/irq-armada-370-xp.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index 2021b7e47a93..2c8272fe7150 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -365,7 +365,7 @@ static inline int mpic_msi_init(struct device_node *node,
static void mpic_perf_init(void)
{
- unsigned long cpuid;
+ u32 cpuid;
/*
* This Performance Counter Overflow interrupt is specific for
@@ -404,8 +404,8 @@ static void mpic_ipi_unmask(struct irq_data *d)
static void mpic_ipi_send_mask(struct irq_data *d, const struct cpumask *mask)
{
- unsigned long map = 0;
unsigned int cpu;
+ u32 map = 0;
/* Convert our logical CPU mask into a physical one. */
for_each_cpu(cpu, mask)
@@ -648,7 +648,8 @@ static inline void mpic_handle_ipi_irq(void) {}
static void mpic_handle_cascade_irq(struct irq_desc *desc)
{
struct irq_chip *chip = irq_desc_get_chip(desc);
- unsigned long cause, irqsrc, cpuid;
+ unsigned long cause;
+ u32 irqsrc, cpuid;
irq_hw_number_t i;
chained_irq_enter(chip, desc);
--
2.44.2
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 09/10] irqchip/armada-370-xp: Refactor initial memory regions mapping
2024-07-11 16:08 [PATCH 00/10] armada-370-xp irqchip updates round 4 Marek Behún
` (7 preceding siblings ...)
2024-07-11 16:09 ` [PATCH 08/10] irqchip/armada-370-xp: Use u32 type instead of unsigned long where possieble Marek Behún
@ 2024-07-11 16:09 ` Marek Behún
2024-07-29 9:49 ` [tip: irq/core] " tip-bot2 for Marek Behún
2024-07-30 11:39 ` tip-bot2 for Marek Behún
2024-07-11 16:09 ` [PATCH 10/10] irqchip/armada-370-xp: Print error and return error code on initialization failure Marek Behún
2024-07-11 20:56 ` [PATCH 00/10] armada-370-xp irqchip updates round 4 Thomas Gleixner
10 siblings, 2 replies; 34+ messages in thread
From: Marek Behún @ 2024-07-11 16:09 UTC (permalink / raw)
To: Andrew Lunn, Gregory Clement, Sebastian Hesselbarth,
Thomas Gleixner, linux-arm-kernel, arm, Andy Shevchenko,
Hans de Goede, Ilpo Järvinen
Cc: Marek Behún
Refactor the initial memory regions mapping:
- put into its own function
- return error numbers on failure
- use WARN_ON() instead of BUG_ON()
Signed-off-by: Marek Behún <kabel@kernel.org>
---
drivers/irqchip/irq-armada-370-xp.c | 62 ++++++++++++++++++++---------
1 file changed, 44 insertions(+), 18 deletions(-)
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index 2c8272fe7150..dccc69aa2bf4 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -12,6 +12,7 @@
#include <linux/bitfield.h>
#include <linux/bits.h>
+#include <linux/err.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -766,29 +767,54 @@ static struct syscore_ops mpic_syscore_ops = {
.resume = mpic_resume,
};
+static int __init mpic_map_region(struct device_node *np, int index,
+ void __iomem **base, phys_addr_t *phys_base)
+{
+ struct resource res;
+ int err;
+
+ err = of_address_to_resource(np, index, &res);
+ if (WARN_ON(err))
+ goto fail;
+
+ if (WARN_ON(!request_mem_region(res.start, resource_size(&res),
+ np->full_name))) {
+ err = -EBUSY;
+ goto fail;
+ }
+
+ *base = ioremap(res.start, resource_size(&res));
+ if (WARN_ON(!*base)) {
+ err = -ENOMEM;
+ goto fail;
+ }
+
+ if (phys_base)
+ *phys_base = res.start;
+
+ return 0;
+
+fail:
+ pr_err("%pOF: Unable to map resource %d: %pE\n", np, index,
+ ERR_PTR(err));
+
+ return err;
+}
+
static int __init mpic_of_init(struct device_node *node,
struct device_node *parent)
{
- struct resource main_int_res, per_cpu_int_res;
+ phys_addr_t phys_base;
unsigned int nr_irqs;
+ int err;
- BUG_ON(of_address_to_resource(node, 0, &main_int_res));
- BUG_ON(of_address_to_resource(node, 1, &per_cpu_int_res));
-
- BUG_ON(!request_mem_region(main_int_res.start,
- resource_size(&main_int_res),
- node->full_name));
- BUG_ON(!request_mem_region(per_cpu_int_res.start,
- resource_size(&per_cpu_int_res),
- node->full_name));
-
- main_int_base = ioremap(main_int_res.start,
- resource_size(&main_int_res));
- BUG_ON(!main_int_base);
+ err = mpic_map_region(node, 0, &main_int_base, &phys_base);
+ if (err)
+ return err;
- per_cpu_int_base = ioremap(per_cpu_int_res.start,
- resource_size(&per_cpu_int_res));
- BUG_ON(!per_cpu_int_base);
+ err = mpic_map_region(node, 1, &per_cpu_int_base, NULL);
+ if (err)
+ return err;
nr_irqs = FIELD_GET(MPIC_INT_CONTROL_NUMINT_MASK,
readl(main_int_base + MPIC_INT_CONTROL));
@@ -810,7 +836,7 @@ static int __init mpic_of_init(struct device_node *node,
mpic_perf_init();
mpic_smp_cpu_init();
- mpic_msi_init(node, main_int_res.start);
+ mpic_msi_init(node, phys_base);
if (parent_irq <= 0) {
irq_set_default_host(mpic_domain);
--
2.44.2
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 10/10] irqchip/armada-370-xp: Print error and return error code on initialization failure
2024-07-11 16:08 [PATCH 00/10] armada-370-xp irqchip updates round 4 Marek Behún
` (8 preceding siblings ...)
2024-07-11 16:09 ` [PATCH 09/10] irqchip/armada-370-xp: Refactor initial memory regions mapping Marek Behún
@ 2024-07-11 16:09 ` Marek Behún
2024-07-29 9:49 ` [tip: irq/core] " tip-bot2 for Marek Behún
2024-07-30 11:39 ` tip-bot2 for Marek Behún
2024-07-11 20:56 ` [PATCH 00/10] armada-370-xp irqchip updates round 4 Thomas Gleixner
10 siblings, 2 replies; 34+ messages in thread
From: Marek Behún @ 2024-07-11 16:09 UTC (permalink / raw)
To: Andrew Lunn, Gregory Clement, Sebastian Hesselbarth,
Thomas Gleixner, linux-arm-kernel, arm, Andy Shevchenko,
Hans de Goede, Ilpo Järvinen
Cc: Marek Behún
Print error and return error code on main / IPI / MSI domain
initialization failure. Use WARN_ON() instead of BUG_ON().
Signed-off-by: Marek Behún <kabel@kernel.org>
---
drivers/irqchip/irq-armada-370-xp.c | 27 +++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index dccc69aa2bf4..c93fab8ac2e4 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -473,7 +473,7 @@ static void mpic_ipi_resume(void)
}
}
-static __init void mpic_ipi_init(struct device_node *node)
+static __init int mpic_ipi_init(struct device_node *node)
{
int base_ipi;
@@ -481,15 +481,17 @@ static __init void mpic_ipi_init(struct device_node *node)
IPI_DOORBELL_END,
&mpic_ipi_domain_ops, NULL);
if (WARN_ON(!mpic_ipi_domain))
- return;
+ return -ENOMEM;
irq_domain_update_bus_token(mpic_ipi_domain, DOMAIN_BUS_IPI);
base_ipi = irq_domain_alloc_irqs(mpic_ipi_domain, IPI_DOORBELL_END,
NUMA_NO_NODE, NULL);
if (WARN_ON(!base_ipi))
- return;
+ return -ENOMEM;
set_smp_ipi_range(base_ipi, IPI_DOORBELL_END);
+
+ return 0;
}
static int mpic_set_affinity(struct irq_data *d, const struct cpumask *mask_val,
@@ -823,7 +825,11 @@ static int __init mpic_of_init(struct device_node *node,
writel(i, main_int_base + MPIC_INT_CLEAR_ENABLE);
mpic_domain = irq_domain_add_linear(node, nr_irqs, &mpic_irq_ops, NULL);
- BUG_ON(!mpic_domain);
+ if (!mpic_domain) {
+ pr_err("%pOF: Unable to add IRQ domain\n", node);
+ return -ENOMEM;
+ }
+
irq_domain_update_bus_token(mpic_domain, DOMAIN_BUS_WIRED);
/*
@@ -836,13 +842,22 @@ static int __init mpic_of_init(struct device_node *node,
mpic_perf_init();
mpic_smp_cpu_init();
- mpic_msi_init(node, phys_base);
+ err = mpic_msi_init(node, phys_base);
+ if (err) {
+ pr_err("%pOF: Unable to initialize MSI domain\n", node);
+ return err;
+ }
if (parent_irq <= 0) {
irq_set_default_host(mpic_domain);
set_handle_irq(mpic_handle_irq);
#ifdef CONFIG_SMP
- mpic_ipi_init(node);
+ err = mpic_ipi_init(node);
+ if (err) {
+ pr_err("%pOF: Unable to initialize IPI domain\n", node);
+ return err;
+ }
+
cpuhp_setup_state_nocalls(CPUHP_AP_IRQ_ARMADA_XP_STARTING,
"irqchip/armada/ipi:starting",
mpic_starting_cpu, NULL);
--
2.44.2
^ permalink raw reply related [flat|nested] 34+ messages in thread
* Re: [PATCH 00/10] armada-370-xp irqchip updates round 4
2024-07-11 16:08 [PATCH 00/10] armada-370-xp irqchip updates round 4 Marek Behún
` (9 preceding siblings ...)
2024-07-11 16:09 ` [PATCH 10/10] irqchip/armada-370-xp: Print error and return error code on initialization failure Marek Behún
@ 2024-07-11 20:56 ` Thomas Gleixner
2024-07-12 7:46 ` Marek Behún
10 siblings, 1 reply; 34+ messages in thread
From: Thomas Gleixner @ 2024-07-11 20:56 UTC (permalink / raw)
To: Marek Behún, Andrew Lunn, Gregory Clement,
Sebastian Hesselbarth, linux-arm-kernel, arm, Andy Shevchenko,
Hans de Goede, Ilpo Järvinen
Cc: Marek Behún
Marek!
On Thu, Jul 11 2024 at 18:08, Marek Behún wrote:
> Hi Thomas, Andrew, Ilpo et al.,
>
> since round 3 was reviewed so quickly, here comes round 4, which should
> be similarly easy to review.
>
> This series can be applied on tip/irq/core, but only after round 2 and
> round 3 series are applied:
> https://patchwork.kernel.org/project/linux-arm-kernel/list/?series=869325
> https://patchwork.kernel.org/project/linux-arm-kernel/list/?series=870469
I marked all of this as material to merge right after 6.11-rc1.
Thanks,
tglx
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 00/10] armada-370-xp irqchip updates round 4
2024-07-11 20:56 ` [PATCH 00/10] armada-370-xp irqchip updates round 4 Thomas Gleixner
@ 2024-07-12 7:46 ` Marek Behún
2024-07-12 22:19 ` Thomas Gleixner
0 siblings, 1 reply; 34+ messages in thread
From: Marek Behún @ 2024-07-12 7:46 UTC (permalink / raw)
To: Thomas Gleixner
Cc: Marek Behún, Andrew Lunn, Gregory Clement,
Sebastian Hesselbarth, linux-arm-kernel, arm, Andy Shevchenko,
Hans de Goede, Ilpo Järvinen
Hello Thomas,
On Thu, Jul 11, 2024 at 10:56:35PM +0200, Thomas Gleixner wrote:
> Marek!
>
> On Thu, Jul 11 2024 at 18:08, Marek Behún wrote:
>
> > Hi Thomas, Andrew, Ilpo et al.,
> >
> > since round 3 was reviewed so quickly, here comes round 4, which should
> > be similarly easy to review.
> >
> > This series can be applied on tip/irq/core, but only after round 2 and
> > round 3 series are applied:
> > https://patchwork.kernel.org/project/linux-arm-kernel/list/?series=869325
> > https://patchwork.kernel.org/project/linux-arm-kernel/list/?series=870469
>
> I marked all of this as material to merge right after 6.11-rc1.
I have another 10 refactoring/cleanup patches prepared, bringing this
driver to modern style, I will be sending that as round 5.
And finally after that I have the patch adding support for SoC Error
interrupts, which is why I have been doing all this.
Hopefully this SoC Error interrupt support will get merger for 6.12.
Marek
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 00/10] armada-370-xp irqchip updates round 4
2024-07-12 7:46 ` Marek Behún
@ 2024-07-12 22:19 ` Thomas Gleixner
2024-07-29 9:44 ` Thomas Gleixner
0 siblings, 1 reply; 34+ messages in thread
From: Thomas Gleixner @ 2024-07-12 22:19 UTC (permalink / raw)
To: Marek Behún
Cc: Marek Behún, Andrew Lunn, Gregory Clement,
Sebastian Hesselbarth, linux-arm-kernel, arm, Andy Shevchenko,
Hans de Goede, Ilpo Järvinen
Marek!
On Fri, Jul 12 2024 at 09:46, Marek Behún wrote:
> On Thu, Jul 11, 2024 at 10:56:35PM +0200, Thomas Gleixner wrote:
>> I marked all of this as material to merge right after 6.11-rc1.
>
> I have another 10 refactoring/cleanup patches prepared, bringing this
> driver to modern style, I will be sending that as round 5.
>
> And finally after that I have the patch adding support for SoC Error
> interrupts, which is why I have been doing all this.
>
> Hopefully this SoC Error interrupt support will get merger for 6.12.
I don't see a problem with that if the quality stays at that level. Nice
work!
Thanks,
tglx
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 05/10] irqchip/armada-370-xp: Drop unneeded curly brackets
2024-07-11 16:09 ` [PATCH 05/10] irqchip/armada-370-xp: Drop unneeded curly brackets Marek Behún
@ 2024-07-29 8:52 ` Thomas Gleixner
0 siblings, 0 replies; 34+ messages in thread
From: Thomas Gleixner @ 2024-07-29 8:52 UTC (permalink / raw)
To: Marek Behún, Andrew Lunn, Gregory Clement,
Sebastian Hesselbarth, linux-arm-kernel, arm, Andy Shevchenko,
Hans de Goede, Ilpo Järvinen
Cc: Marek Behún
On Thu, Jul 11 2024 at 18:09, Marek Behún wrote:
> Drop unneeded curly brackets in mpic_msi_alloc().
No.
https://www.kernel.org/doc/html/latest/process/maintainer-tip.html#bracket-rules
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: [PATCH 00/10] armada-370-xp irqchip updates round 4
2024-07-12 22:19 ` Thomas Gleixner
@ 2024-07-29 9:44 ` Thomas Gleixner
0 siblings, 0 replies; 34+ messages in thread
From: Thomas Gleixner @ 2024-07-29 9:44 UTC (permalink / raw)
To: Marek Behún
Cc: Marek Behún, Andrew Lunn, Gregory Clement,
Sebastian Hesselbarth, linux-arm-kernel, arm, Andy Shevchenko,
Hans de Goede, Ilpo Järvinen
Marek!
On Sat, Jul 13 2024 at 00:19, Thomas Gleixner wrote:
> On Fri, Jul 12 2024 at 09:46, Marek Behún wrote:
>> On Thu, Jul 11, 2024 at 10:56:35PM +0200, Thomas Gleixner wrote:
>>> I marked all of this as material to merge right after 6.11-rc1.
>>
>> I have another 10 refactoring/cleanup patches prepared, bringing this
>> driver to modern style, I will be sending that as round 5.
>>
>> And finally after that I have the patch adding support for SoC Error
>> interrupts, which is why I have been doing all this.
>>
>> Hopefully this SoC Error interrupt support will get merger for 6.12.
>
> I don't see a problem with that if the quality stays at that level. Nice
> work!
I've applied the lot (except the brackets one) to tip irq/core and fixed
up a bunch of line breaks while going through it. The 80 character limit
was lifted quite some time ago and extended to 100.
Please double check that everything is correct.
Btw, please Cc: LKML on your next series as that's the official mailing
list for irqchip work.
Thanks,
tglx
^ permalink raw reply [flat|nested] 34+ messages in thread
* [tip: irq/core] irqchip/armada-370-xp: Print error and return error code on initialization failure
2024-07-11 16:09 ` [PATCH 10/10] irqchip/armada-370-xp: Print error and return error code on initialization failure Marek Behún
@ 2024-07-29 9:49 ` tip-bot2 for Marek Behún
2024-07-30 11:39 ` tip-bot2 for Marek Behún
1 sibling, 0 replies; 34+ messages in thread
From: tip-bot2 for Marek Behún @ 2024-07-29 9:49 UTC (permalink / raw)
To: linux-tip-commits; +Cc: kabel, Thomas Gleixner, x86, linux-kernel, maz
The following commit has been merged into the irq/core branch of tip:
Commit-ID: b50a11ce64e7c2de0b1a5ba50bba38cccc770125
Gitweb: https://git.kernel.org/tip/b50a11ce64e7c2de0b1a5ba50bba38cccc770125
Author: Marek Behún <kabel@kernel.org>
AuthorDate: Thu, 11 Jul 2024 18:09:07 +02:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Mon, 29 Jul 2024 10:57:25 +02:00
irqchip/armada-370-xp: Print error and return error code on initialization failure
Print error and return error code on main / IPI / MSI domain
initialization failure. Use WARN_ON() instead of BUG_ON().
Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20240711160907.31012-11-kabel@kernel.org
---
drivers/irqchip/irq-armada-370-xp.c | 28 ++++++++++++++++++++++------
1 file changed, 22 insertions(+), 6 deletions(-)
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index 244454e..0f21310 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -464,20 +464,23 @@ static void mpic_ipi_resume(void)
}
}
-static __init void mpic_ipi_init(struct device_node *node)
+static __init int mpic_ipi_init(struct device_node *node)
{
int base_ipi;
mpic_ipi_domain = irq_domain_create_linear(of_node_to_fwnode(node), IPI_DOORBELL_END,
&mpic_ipi_domain_ops, NULL);
if (WARN_ON(!mpic_ipi_domain))
- return;
+ return -ENOMEM;
irq_domain_update_bus_token(mpic_ipi_domain, DOMAIN_BUS_IPI);
base_ipi = irq_domain_alloc_irqs(mpic_ipi_domain, IPI_DOORBELL_END, NUMA_NO_NODE, NULL);
if (WARN_ON(!base_ipi))
- return;
+ return -ENOMEM;
+
set_smp_ipi_range(base_ipi, IPI_DOORBELL_END);
+
+ return 0;
}
static int mpic_set_affinity(struct irq_data *d, const struct cpumask *mask_val, bool force)
@@ -803,7 +806,11 @@ static int __init mpic_of_init(struct device_node *node, struct device_node *par
writel(i, main_int_base + MPIC_INT_CLEAR_ENABLE);
mpic_domain = irq_domain_add_linear(node, nr_irqs, &mpic_irq_ops, NULL);
- BUG_ON(!mpic_domain);
+ if (!mpic_domain) {
+ pr_err("%pOF: Unable to add IRQ domain\n", node);
+ return -ENOMEM;
+ }
+
irq_domain_update_bus_token(mpic_domain, DOMAIN_BUS_WIRED);
/*
@@ -816,13 +823,22 @@ static int __init mpic_of_init(struct device_node *node, struct device_node *par
mpic_perf_init();
mpic_smp_cpu_init();
- mpic_msi_init(node, phys_base);
+ err = mpic_msi_init(node, phys_base);
+ if (err) {
+ pr_err("%pOF: Unable to initialize MSI domain\n", node);
+ return err;
+ }
if (parent_irq <= 0) {
irq_set_default_host(mpic_domain);
set_handle_irq(mpic_handle_irq);
#ifdef CONFIG_SMP
- mpic_ipi_init(node);
+ err = mpic_ipi_init(node);
+ if (err) {
+ pr_err("%pOF: Unable to initialize IPI domain\n", node);
+ return err;
+ }
+
cpuhp_setup_state_nocalls(CPUHP_AP_IRQ_ARMADA_XP_STARTING,
"irqchip/armada/ipi:starting",
mpic_starting_cpu, NULL);
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [tip: irq/core] irqchip/armada-370-xp: Use u32 type instead of unsigned long where possieble
2024-07-11 16:09 ` [PATCH 08/10] irqchip/armada-370-xp: Use u32 type instead of unsigned long where possieble Marek Behún
@ 2024-07-29 9:49 ` tip-bot2 for Marek Behún
2024-07-30 11:39 ` tip-bot2 for Marek Behún
1 sibling, 0 replies; 34+ messages in thread
From: tip-bot2 for Marek Behún @ 2024-07-29 9:49 UTC (permalink / raw)
To: linux-tip-commits; +Cc: kabel, Thomas Gleixner, x86, linux-kernel, maz
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 33950cdeab2ebc7644db556a0c3f486ca0296027
Gitweb: https://git.kernel.org/tip/33950cdeab2ebc7644db556a0c3f486ca0296027
Author: Marek Behún <kabel@kernel.org>
AuthorDate: Thu, 11 Jul 2024 18:09:05 +02:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Mon, 29 Jul 2024 10:57:24 +02:00
irqchip/armada-370-xp: Use u32 type instead of unsigned long where possieble
For consistency across the driver, use the u32 type instead of unsigned
long for holding register values and return value of cpu_logical_map().
One exception is when the variable is referenced for passing into
for_each_set_bit(), in which case it has to be unsigned long.
Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20240711160907.31012-9-kabel@kernel.org
---
drivers/irqchip/irq-armada-370-xp.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index 29ce6fe..1e0f1b4 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -357,7 +357,7 @@ static inline int mpic_msi_init(struct device_node *node,
static void mpic_perf_init(void)
{
- unsigned long cpuid;
+ u32 cpuid;
/*
* This Performance Counter Overflow interrupt is specific for
@@ -396,8 +396,8 @@ static void mpic_ipi_unmask(struct irq_data *d)
static void mpic_ipi_send_mask(struct irq_data *d, const struct cpumask *mask)
{
- unsigned long map = 0;
unsigned int cpu;
+ u32 map = 0;
/* Convert our logical CPU mask into a physical one. */
for_each_cpu(cpu, mask)
@@ -633,7 +633,8 @@ static inline void mpic_handle_ipi_irq(void) {}
static void mpic_handle_cascade_irq(struct irq_desc *desc)
{
struct irq_chip *chip = irq_desc_get_chip(desc);
- unsigned long cause, irqsrc, cpuid;
+ unsigned long cause;
+ u32 irqsrc, cpuid;
irq_hw_number_t i;
chained_irq_enter(chip, desc);
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [tip: irq/core] irqchip/armada-370-xp: Rename variable for consistency
2024-07-11 16:09 ` [PATCH 07/10] irqchip/armada-370-xp: Rename variable for consistency Marek Behún
@ 2024-07-29 9:49 ` tip-bot2 for Marek Behún
2024-07-30 11:39 ` tip-bot2 for Marek Behún
1 sibling, 0 replies; 34+ messages in thread
From: tip-bot2 for Marek Behún @ 2024-07-29 9:49 UTC (permalink / raw)
To: linux-tip-commits; +Cc: kabel, Thomas Gleixner, x86, linux-kernel, maz
The following commit has been merged into the irq/core branch of tip:
Commit-ID: e827b6cb64b412a6b52e5fc0f453013ac98032f6
Gitweb: https://git.kernel.org/tip/e827b6cb64b412a6b52e5fc0f453013ac98032f6
Author: Marek Behún <kabel@kernel.org>
AuthorDate: Thu, 11 Jul 2024 18:09:04 +02:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Mon, 29 Jul 2024 10:57:24 +02:00
irqchip/armada-370-xp: Rename variable for consistency
Rename the variable holding the cause register to "cause" in
mpic_handle_cascade_irq().
Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20240711160907.31012-8-kabel@kernel.org
---
drivers/irqchip/irq-armada-370-xp.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index c1085c7..29ce6fe 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -633,15 +633,15 @@ static inline void mpic_handle_ipi_irq(void) {}
static void mpic_handle_cascade_irq(struct irq_desc *desc)
{
struct irq_chip *chip = irq_desc_get_chip(desc);
- unsigned long irqmap, irqsrc, cpuid;
+ unsigned long cause, irqsrc, cpuid;
irq_hw_number_t i;
chained_irq_enter(chip, desc);
- irqmap = readl_relaxed(per_cpu_int_base + MPIC_PPI_CAUSE);
+ cause = readl_relaxed(per_cpu_int_base + MPIC_PPI_CAUSE);
cpuid = cpu_logical_map(smp_processor_id());
- for_each_set_bit(i, &irqmap, BITS_PER_LONG) {
+ for_each_set_bit(i, &cause, BITS_PER_LONG) {
irqsrc = readl_relaxed(main_int_base + MPIC_INT_SOURCE_CTL(i));
/* Check if the interrupt is not masked on current CPU.
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [tip: irq/core] irqchip/armada-370-xp: Drop redundant continue
2024-07-11 16:09 ` [PATCH 06/10] irqchip/armada-370-xp: Drop redundant continue Marek Behún
@ 2024-07-29 9:49 ` tip-bot2 for Marek Behún
2024-07-30 11:39 ` tip-bot2 for Marek Behún
1 sibling, 0 replies; 34+ messages in thread
From: tip-bot2 for Marek Behún @ 2024-07-29 9:49 UTC (permalink / raw)
To: linux-tip-commits; +Cc: kabel, Thomas Gleixner, x86, linux-kernel, maz
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 9424aba41d43204236fe0d1af322c021d14b9f8a
Gitweb: https://git.kernel.org/tip/9424aba41d43204236fe0d1af322c021d14b9f8a
Author: Marek Behún <kabel@kernel.org>
AuthorDate: Thu, 11 Jul 2024 18:09:03 +02:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Mon, 29 Jul 2024 10:57:24 +02:00
irqchip/armada-370-xp: Drop redundant continue
Drop redundant continue from mpic_handle_irq().
Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20240711160907.31012-7-kabel@kernel.org
---
drivers/irqchip/irq-armada-370-xp.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index 6e35f3c..c1085c7 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -673,10 +673,8 @@ static void __exception_irq_entry mpic_handle_irq(struct pt_regs *regs)
if (i > 1022)
break;
- if (i > 1) {
+ if (i > 1)
generic_handle_domain_irq(mpic_domain, i);
- continue;
- }
/* MSI handling */
if (i == 1)
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [tip: irq/core] irqchip/armada-370-xp: Refactor initial memory regions mapping
2024-07-11 16:09 ` [PATCH 09/10] irqchip/armada-370-xp: Refactor initial memory regions mapping Marek Behún
@ 2024-07-29 9:49 ` tip-bot2 for Marek Behún
2024-07-30 11:39 ` tip-bot2 for Marek Behún
1 sibling, 0 replies; 34+ messages in thread
From: tip-bot2 for Marek Behún @ 2024-07-29 9:49 UTC (permalink / raw)
To: linux-tip-commits; +Cc: kabel, Thomas Gleixner, x86, linux-kernel, maz
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 732639e1d5f0f4b5135833de63ad4e4b79cbfd78
Gitweb: https://git.kernel.org/tip/732639e1d5f0f4b5135833de63ad4e4b79cbfd78
Author: Marek Behún <kabel@kernel.org>
AuthorDate: Thu, 11 Jul 2024 18:09:06 +02:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Mon, 29 Jul 2024 10:57:24 +02:00
irqchip/armada-370-xp: Refactor initial memory regions mapping
Refactor the initial memory regions mapping:
- put into its own function
- return error numbers on failure
- use WARN_ON() instead of BUG_ON()
Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20240711160907.31012-10-kabel@kernel.org
---
drivers/irqchip/irq-armada-370-xp.c | 60 +++++++++++++++++++---------
1 file changed, 41 insertions(+), 19 deletions(-)
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index 1e0f1b4..244454e 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -12,6 +12,7 @@
#include <linux/bitfield.h>
#include <linux/bits.h>
+#include <linux/err.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -751,29 +752,50 @@ static struct syscore_ops mpic_syscore_ops = {
.resume = mpic_resume,
};
-static int __init mpic_of_init(struct device_node *node,
- struct device_node *parent)
+static int __init mpic_map_region(struct device_node *np, int index,
+ void __iomem **base, phys_addr_t *phys_base)
{
- struct resource main_int_res, per_cpu_int_res;
- unsigned int nr_irqs;
+ struct resource res;
+ int err;
+
+ err = of_address_to_resource(np, index, &res);
+ if (WARN_ON(err))
+ goto fail;
+
+ if (WARN_ON(!request_mem_region(res.start, resource_size(&res), np->full_name))) {
+ err = -EBUSY;
+ goto fail;
+ }
+
+ *base = ioremap(res.start, resource_size(&res));
+ if (WARN_ON(!*base)) {
+ err = -ENOMEM;
+ goto fail;
+ }
- BUG_ON(of_address_to_resource(node, 0, &main_int_res));
- BUG_ON(of_address_to_resource(node, 1, &per_cpu_int_res));
+ if (phys_base)
+ *phys_base = res.start;
- BUG_ON(!request_mem_region(main_int_res.start,
- resource_size(&main_int_res),
- node->full_name));
- BUG_ON(!request_mem_region(per_cpu_int_res.start,
- resource_size(&per_cpu_int_res),
- node->full_name));
+ return 0;
+
+fail:
+ pr_err("%pOF: Unable to map resource %d: %pE\n", np, index, ERR_PTR(err));
+ return err;
+}
+
+static int __init mpic_of_init(struct device_node *node, struct device_node *parent)
+{
+ phys_addr_t phys_base;
+ unsigned int nr_irqs;
+ int err;
- main_int_base = ioremap(main_int_res.start,
- resource_size(&main_int_res));
- BUG_ON(!main_int_base);
+ err = mpic_map_region(node, 0, &main_int_base, &phys_base);
+ if (err)
+ return err;
- per_cpu_int_base = ioremap(per_cpu_int_res.start,
- resource_size(&per_cpu_int_res));
- BUG_ON(!per_cpu_int_base);
+ err = mpic_map_region(node, 1, &per_cpu_int_base, NULL);
+ if (err)
+ return err;
nr_irqs = FIELD_GET(MPIC_INT_CONTROL_NUMINT_MASK, readl(main_int_base + MPIC_INT_CONTROL));
@@ -794,7 +816,7 @@ static int __init mpic_of_init(struct device_node *node,
mpic_perf_init();
mpic_smp_cpu_init();
- mpic_msi_init(node, main_int_res.start);
+ mpic_msi_init(node, phys_base);
if (parent_irq <= 0) {
irq_set_default_host(mpic_domain);
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [tip: irq/core] irqchip/armada-370-xp: Simplify mpic_reenable_percpu() and mpic_resume()
2024-07-11 16:09 ` [PATCH 04/10] irqchip/armada-370-xp: Simplify mpic_reenable_percpu() and mpic_resume() Marek Behún
@ 2024-07-29 9:49 ` tip-bot2 for Marek Behún
2024-07-30 11:39 ` tip-bot2 for Marek Behún
1 sibling, 0 replies; 34+ messages in thread
From: tip-bot2 for Marek Behún @ 2024-07-29 9:49 UTC (permalink / raw)
To: linux-tip-commits; +Cc: kabel, Thomas Gleixner, x86, linux-kernel, maz
The following commit has been merged into the irq/core branch of tip:
Commit-ID: e1ed69fb599823fb04372b2a02bc3cbf7deb23c3
Gitweb: https://git.kernel.org/tip/e1ed69fb599823fb04372b2a02bc3cbf7deb23c3
Author: Marek Behún <kabel@kernel.org>
AuthorDate: Thu, 11 Jul 2024 18:09:01 +02:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Mon, 29 Jul 2024 10:57:24 +02:00
irqchip/armada-370-xp: Simplify mpic_reenable_percpu() and mpic_resume()
Refactor the mpic_reenable_percpu() and mpic_resume() functions to make
them a little bit simpler.
Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20240711160907.31012-5-kabel@kernel.org
---
drivers/irqchip/irq-armada-370-xp.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index bab9297..6e35f3c 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -517,18 +517,13 @@ static void mpic_reenable_percpu(void)
{
/* Re-enable per-CPU interrupts that were enabled before suspend */
for (irq_hw_number_t i = 0; i < MPIC_MAX_PER_CPU_IRQS; i++) {
+ unsigned int virq = irq_linear_revmap(mpic_domain, i);
struct irq_data *d;
- unsigned int virq;
- virq = irq_linear_revmap(mpic_domain, i);
- if (!virq)
+ if (!virq || !irq_percpu_is_enabled(virq))
continue;
d = irq_get_irq_data(virq);
-
- if (!irq_percpu_is_enabled(virq))
- continue;
-
mpic_irq_unmask(d);
}
@@ -706,10 +701,9 @@ static void mpic_resume(void)
/* Re-enable interrupts */
for (irq_hw_number_t i = 0; i < mpic_domain->hwirq_max; i++) {
+ unsigned int virq = irq_linear_revmap(mpic_domain, i);
struct irq_data *d;
- unsigned int virq;
- virq = irq_linear_revmap(mpic_domain, i);
if (!virq)
continue;
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [tip: irq/core] irqchip/armada-370-xp: Use consistent name for struct irq_data variables
2024-07-11 16:09 ` [PATCH 03/10] irqchip/armada-370-xp: Use consistent name for struct irq_data variables Marek Behún
@ 2024-07-29 9:49 ` tip-bot2 for Marek Behún
2024-07-30 11:39 ` tip-bot2 for Marek Behún
1 sibling, 0 replies; 34+ messages in thread
From: tip-bot2 for Marek Behún @ 2024-07-29 9:49 UTC (permalink / raw)
To: linux-tip-commits; +Cc: kabel, Thomas Gleixner, x86, linux-kernel, maz
The following commit has been merged into the irq/core branch of tip:
Commit-ID: f72976cd7f0e16639f29398d5fe5ab1b03789b42
Gitweb: https://git.kernel.org/tip/f72976cd7f0e16639f29398d5fe5ab1b03789b42
Author: Marek Behún <kabel@kernel.org>
AuthorDate: Thu, 11 Jul 2024 18:09:00 +02:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Mon, 29 Jul 2024 10:57:24 +02:00
irqchip/armada-370-xp: Use consistent name for struct irq_data variables
Always use variable name "d" for struct irq_data *, for consistency.
Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20240711160907.31012-4-kabel@kernel.org
---
drivers/irqchip/irq-armada-370-xp.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index db9594b..bab9297 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -239,13 +239,13 @@ static struct msi_domain_info mpic_msi_domain_info = {
.chip = &mpic_msi_irq_chip,
};
-static void mpic_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
+static void mpic_compose_msi_msg(struct irq_data *d, struct msi_msg *msg)
{
- unsigned int cpu = cpumask_first(irq_data_get_effective_affinity_mask(data));
+ unsigned int cpu = cpumask_first(irq_data_get_effective_affinity_mask(d));
msg->address_lo = lower_32_bits(msi_doorbell_addr);
msg->address_hi = upper_32_bits(msi_doorbell_addr);
- msg->data = BIT(cpu + 8) | (data->hwirq + msi_doorbell_start());
+ msg->data = BIT(cpu + 8) | (d->hwirq + msi_doorbell_start());
}
static int mpic_msi_set_affinity(struct irq_data *irq_data, const struct cpumask *mask, bool force)
@@ -260,7 +260,7 @@ static int mpic_msi_set_affinity(struct irq_data *irq_data, const struct cpumask
if (cpu >= nr_cpu_ids)
return -EINVAL;
- irq_data_update_effective_affinity(irq_data, cpumask_of(cpu));
+ irq_data_update_effective_affinity(d, cpumask_of(cpu));
return IRQ_SET_MASK_OK;
}
@@ -517,19 +517,19 @@ static void mpic_reenable_percpu(void)
{
/* Re-enable per-CPU interrupts that were enabled before suspend */
for (irq_hw_number_t i = 0; i < MPIC_MAX_PER_CPU_IRQS; i++) {
- struct irq_data *data;
+ struct irq_data *d;
unsigned int virq;
virq = irq_linear_revmap(mpic_domain, i);
if (!virq)
continue;
- data = irq_get_irq_data(virq);
+ d = irq_get_irq_data(virq);
if (!irq_percpu_is_enabled(virq))
continue;
- mpic_irq_unmask(data);
+ mpic_irq_unmask(d);
}
if (mpic_is_ipi_available())
@@ -706,20 +706,20 @@ static void mpic_resume(void)
/* Re-enable interrupts */
for (irq_hw_number_t i = 0; i < mpic_domain->hwirq_max; i++) {
- struct irq_data *data;
+ struct irq_data *d;
unsigned int virq;
virq = irq_linear_revmap(mpic_domain, i);
if (!virq)
continue;
- data = irq_get_irq_data(virq);
+ d = irq_get_irq_data(virq);
if (!mpic_is_percpu_irq(i)) {
/* Non per-CPU interrupts */
writel(i, per_cpu_int_base + MPIC_INT_CLEAR_MASK);
- if (!irqd_irq_disabled(data))
- mpic_irq_unmask(data);
+ if (!irqd_irq_disabled(d))
+ mpic_irq_unmask(d);
} else {
/* Per-CPU interrupts */
writel(i, main_int_base + MPIC_INT_SET_ENABLE);
@@ -729,7 +729,7 @@ static void mpic_resume(void)
* will take care of secondary CPUs when they come up.
*/
if (irq_percpu_is_enabled(virq))
- mpic_irq_unmask(data);
+ mpic_irq_unmask(d);
}
}
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [tip: irq/core] irqchip/armada-370-xp: Use consistent types when iterating interrupts
2024-07-11 16:08 ` [PATCH 02/10] irqchip/armada-370-xp: Use consistent types when iterating interrupts Marek Behún
@ 2024-07-29 9:49 ` tip-bot2 for Marek Behún
2024-07-30 11:39 ` tip-bot2 for Marek Behún
1 sibling, 0 replies; 34+ messages in thread
From: tip-bot2 for Marek Behún @ 2024-07-29 9:49 UTC (permalink / raw)
To: linux-tip-commits; +Cc: kabel, Thomas Gleixner, x86, linux-kernel, maz
The following commit has been merged into the irq/core branch of tip:
Commit-ID: bb6d30540c5f6c2035c07c885f4117b33d4e549a
Gitweb: https://git.kernel.org/tip/bb6d30540c5f6c2035c07c885f4117b33d4e549a
Author: Marek Behún <kabel@kernel.org>
AuthorDate: Thu, 11 Jul 2024 18:08:59 +02:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Mon, 29 Jul 2024 10:57:24 +02:00
irqchip/armada-370-xp: Use consistent types when iterating interrupts
When iterating, use either the irq_hw_number_t type or the unsigned int
type for the iterator variable, depending on whether the variable
represents HW IRQ number or whether it is added to a IRQ number.
Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20240711160907.31012-3-kabel@kernel.org
---
drivers/irqchip/irq-armada-370-xp.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index 8f95da0..db9594b 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -284,7 +284,7 @@ static int mpic_msi_alloc(struct irq_domain *domain, unsigned int virq, unsigned
if (hwirq < 0)
return -ENOSPC;
- for (int i = 0; i < nr_irqs; i++) {
+ for (unsigned int i = 0; i < nr_irqs; i++) {
irq_domain_set_info(domain, virq + i, hwirq + i,
&mpic_msi_bottom_irq_chip,
domain->host_data, handle_simple_irq,
@@ -429,7 +429,7 @@ static struct irq_chip mpic_ipi_irqchip = {
static int mpic_ipi_alloc(struct irq_domain *d, unsigned int virq,
unsigned int nr_irqs, void *args)
{
- for (int i = 0; i < nr_irqs; i++) {
+ for (unsigned int i = 0; i < nr_irqs; i++) {
irq_set_percpu_devid(virq + i);
irq_domain_set_info(d, virq + i, i, &mpic_ipi_irqchip, d->host_data,
handle_percpu_devid_irq, NULL, NULL);
@@ -451,7 +451,7 @@ static const struct irq_domain_ops mpic_ipi_domain_ops = {
static void mpic_ipi_resume(void)
{
- for (int i = 0; i < IPI_DOORBELL_END; i++) {
+ for (irq_hw_number_t i = 0; i < IPI_DOORBELL_END; i++) {
unsigned int virq = irq_find_mapping(mpic_ipi_domain, i);
struct irq_data *d;
@@ -497,7 +497,7 @@ static int mpic_set_affinity(struct irq_data *d, const struct cpumask *mask_val,
static void mpic_smp_cpu_init(void)
{
- for (int i = 0; i < mpic_domain->hwirq_max; i++)
+ for (irq_hw_number_t i = 0; i < mpic_domain->hwirq_max; i++)
writel(i, per_cpu_int_base + MPIC_INT_SET_MASK);
if (!mpic_is_ipi_available())
@@ -516,7 +516,7 @@ static void mpic_smp_cpu_init(void)
static void mpic_reenable_percpu(void)
{
/* Re-enable per-CPU interrupts that were enabled before suspend */
- for (unsigned int i = 0; i < MPIC_MAX_PER_CPU_IRQS; i++) {
+ for (irq_hw_number_t i = 0; i < MPIC_MAX_PER_CPU_IRQS; i++) {
struct irq_data *data;
unsigned int virq;
@@ -638,7 +638,8 @@ static inline void mpic_handle_ipi_irq(void) {}
static void mpic_handle_cascade_irq(struct irq_desc *desc)
{
struct irq_chip *chip = irq_desc_get_chip(desc);
- unsigned long irqmap, i, irqsrc, cpuid;
+ unsigned long irqmap, irqsrc, cpuid;
+ irq_hw_number_t i;
chained_irq_enter(chip, desc);
@@ -667,7 +668,8 @@ static void mpic_handle_cascade_irq(struct irq_desc *desc)
static void __exception_irq_entry mpic_handle_irq(struct pt_regs *regs)
{
- u32 irqstat, i;
+ irq_hw_number_t i;
+ u32 irqstat;
do {
irqstat = readl_relaxed(per_cpu_int_base + MPIC_CPU_INTACK);
@@ -782,7 +784,7 @@ static int __init mpic_of_init(struct device_node *node,
nr_irqs = FIELD_GET(MPIC_INT_CONTROL_NUMINT_MASK, readl(main_int_base + MPIC_INT_CONTROL));
- for (int i = 0; i < nr_irqs; i++)
+ for (irq_hw_number_t i = 0; i < nr_irqs; i++)
writel(i, main_int_base + MPIC_INT_CLEAR_ENABLE);
mpic_domain = irq_domain_add_linear(node, nr_irqs, &mpic_irq_ops, NULL);
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [tip: irq/core] irqchip/armada-370-xp: Use consistent variable names for hwirqs
2024-07-11 16:08 ` [PATCH 01/10] irqchip/armada-370-xp: Use consistent variable names for hwirqs Marek Behún
@ 2024-07-29 9:49 ` tip-bot2 for Marek Behún
2024-07-30 11:39 ` tip-bot2 for Marek Behún
1 sibling, 0 replies; 34+ messages in thread
From: tip-bot2 for Marek Behún @ 2024-07-29 9:49 UTC (permalink / raw)
To: linux-tip-commits; +Cc: kabel, Thomas Gleixner, x86, linux-kernel, maz
The following commit has been merged into the irq/core branch of tip:
Commit-ID: da3b3ce541259951ff4e087c20ff991f9056fa64
Gitweb: https://git.kernel.org/tip/da3b3ce541259951ff4e087c20ff991f9056fa64
Author: Marek Behún <kabel@kernel.org>
AuthorDate: Thu, 11 Jul 2024 18:08:58 +02:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Mon, 29 Jul 2024 10:57:24 +02:00
irqchip/armada-370-xp: Use consistent variable names for hwirqs
Use consistent variable names for hwirqs: when iterating, use "i",
otherwise use "hwirq".
Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20240711160907.31012-2-kabel@kernel.org
---
drivers/irqchip/irq-armada-370-xp.c | 56 ++++++++++++++--------------
1 file changed, 28 insertions(+), 28 deletions(-)
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index d42c7a1..8f95da0 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -117,7 +117,7 @@
#define MPIC_SW_TRIG_INT 0x04
#define MPIC_INT_SET_ENABLE 0x30
#define MPIC_INT_CLEAR_ENABLE 0x34
-#define MPIC_INT_SOURCE_CTL(irq) (0x100 + (irq) * 4)
+#define MPIC_INT_SOURCE_CTL(hwirq) (0x100 + (hwirq) * 4)
#define MPIC_INT_SOURCE_CPU_MASK GENMASK(3, 0)
#define MPIC_INT_IRQ_FIQ_MASK(cpuid) ((BIT(0) | BIT(8)) << (cpuid))
@@ -195,9 +195,9 @@ static inline unsigned int msi_doorbell_end(void)
return mpic_is_ipi_available() ? PCI_MSI_DOORBELL_END : PCI_MSI_FULL_DOORBELL_END;
}
-static inline bool mpic_is_percpu_irq(irq_hw_number_t irq)
+static inline bool mpic_is_percpu_irq(irq_hw_number_t hwirq)
{
- return irq <= MPIC_MAX_PER_CPU_IRQS;
+ return hwirq <= MPIC_MAX_PER_CPU_IRQS;
}
/*
@@ -516,11 +516,11 @@ static void mpic_smp_cpu_init(void)
static void mpic_reenable_percpu(void)
{
/* Re-enable per-CPU interrupts that were enabled before suspend */
- for (unsigned int irq = 0; irq < MPIC_MAX_PER_CPU_IRQS; irq++) {
+ for (unsigned int i = 0; i < MPIC_MAX_PER_CPU_IRQS; i++) {
struct irq_data *data;
unsigned int virq;
- virq = irq_linear_revmap(mpic_domain, irq);
+ virq = irq_linear_revmap(mpic_domain, i);
if (!virq)
continue;
@@ -572,20 +572,20 @@ static struct irq_chip mpic_irq_chip = {
};
static int mpic_irq_map(struct irq_domain *h, unsigned int virq,
- irq_hw_number_t hw)
+ irq_hw_number_t hwirq)
{
/* IRQs 0 and 1 cannot be mapped, they are handled internally */
- if (hw <= 1)
+ if (hwirq <= 1)
return -EINVAL;
mpic_irq_mask(irq_get_irq_data(virq));
- if (!mpic_is_percpu_irq(hw))
- writel(hw, per_cpu_int_base + MPIC_INT_CLEAR_MASK);
+ if (!mpic_is_percpu_irq(hwirq))
+ writel(hwirq, per_cpu_int_base + MPIC_INT_CLEAR_MASK);
else
- writel(hw, main_int_base + MPIC_INT_SET_ENABLE);
+ writel(hwirq, main_int_base + MPIC_INT_SET_ENABLE);
irq_set_status_flags(virq, IRQ_LEVEL);
- if (mpic_is_percpu_irq(hw)) {
+ if (mpic_is_percpu_irq(hwirq)) {
irq_set_percpu_devid(virq);
irq_set_chip_and_handler(virq, &mpic_irq_chip, handle_percpu_devid_irq);
} else {
@@ -638,15 +638,15 @@ static inline void mpic_handle_ipi_irq(void) {}
static void mpic_handle_cascade_irq(struct irq_desc *desc)
{
struct irq_chip *chip = irq_desc_get_chip(desc);
- unsigned long irqmap, irqn, irqsrc, cpuid;
+ unsigned long irqmap, i, irqsrc, cpuid;
chained_irq_enter(chip, desc);
irqmap = readl_relaxed(per_cpu_int_base + MPIC_PPI_CAUSE);
cpuid = cpu_logical_map(smp_processor_id());
- for_each_set_bit(irqn, &irqmap, BITS_PER_LONG) {
- irqsrc = readl_relaxed(main_int_base + MPIC_INT_SOURCE_CTL(irqn));
+ for_each_set_bit(i, &irqmap, BITS_PER_LONG) {
+ irqsrc = readl_relaxed(main_int_base + MPIC_INT_SOURCE_CTL(i));
/* Check if the interrupt is not masked on current CPU.
* Test IRQ (0-1) and FIQ (8-9) mask bits.
@@ -654,12 +654,12 @@ static void mpic_handle_cascade_irq(struct irq_desc *desc)
if (!(irqsrc & MPIC_INT_IRQ_FIQ_MASK(cpuid)))
continue;
- if (irqn == 0 || irqn == 1) {
+ if (i == 0 || i == 1) {
mpic_handle_msi_irq();
continue;
}
- generic_handle_domain_irq(mpic_domain, irqn);
+ generic_handle_domain_irq(mpic_domain, i);
}
chained_irq_exit(chip, desc);
@@ -667,26 +667,26 @@ static void mpic_handle_cascade_irq(struct irq_desc *desc)
static void __exception_irq_entry mpic_handle_irq(struct pt_regs *regs)
{
- u32 irqstat, irqnr;
+ u32 irqstat, i;
do {
irqstat = readl_relaxed(per_cpu_int_base + MPIC_CPU_INTACK);
- irqnr = FIELD_GET(MPIC_CPU_INTACK_IID_MASK, irqstat);
+ i = FIELD_GET(MPIC_CPU_INTACK_IID_MASK, irqstat);
- if (irqnr > 1022)
+ if (i > 1022)
break;
- if (irqnr > 1) {
- generic_handle_domain_irq(mpic_domain, irqnr);
+ if (i > 1) {
+ generic_handle_domain_irq(mpic_domain, i);
continue;
}
/* MSI handling */
- if (irqnr == 1)
+ if (i == 1)
mpic_handle_msi_irq();
/* IPI Handling */
- if (irqnr == 0)
+ if (i == 0)
mpic_handle_ipi_irq();
} while (1);
}
@@ -703,24 +703,24 @@ static void mpic_resume(void)
bool src0, src1;
/* Re-enable interrupts */
- for (irq_hw_number_t irq = 0; irq < mpic_domain->hwirq_max; irq++) {
+ for (irq_hw_number_t i = 0; i < mpic_domain->hwirq_max; i++) {
struct irq_data *data;
unsigned int virq;
- virq = irq_linear_revmap(mpic_domain, irq);
+ virq = irq_linear_revmap(mpic_domain, i);
if (!virq)
continue;
data = irq_get_irq_data(virq);
- if (!mpic_is_percpu_irq(irq)) {
+ if (!mpic_is_percpu_irq(i)) {
/* Non per-CPU interrupts */
- writel(irq, per_cpu_int_base + MPIC_INT_CLEAR_MASK);
+ writel(i, per_cpu_int_base + MPIC_INT_CLEAR_MASK);
if (!irqd_irq_disabled(data))
mpic_irq_unmask(data);
} else {
/* Per-CPU interrupts */
- writel(irq, main_int_base + MPIC_INT_SET_ENABLE);
+ writel(i, main_int_base + MPIC_INT_SET_ENABLE);
/*
* Re-enable on the current CPU, mpic_reenable_percpu()
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [tip: irq/core] irqchip/armada-370-xp: Print error and return error code on initialization failure
2024-07-11 16:09 ` [PATCH 10/10] irqchip/armada-370-xp: Print error and return error code on initialization failure Marek Behún
2024-07-29 9:49 ` [tip: irq/core] " tip-bot2 for Marek Behún
@ 2024-07-30 11:39 ` tip-bot2 for Marek Behún
1 sibling, 0 replies; 34+ messages in thread
From: tip-bot2 for Marek Behún @ 2024-07-30 11:39 UTC (permalink / raw)
To: linux-tip-commits; +Cc: kabel, Thomas Gleixner, x86, linux-kernel, maz
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 1d07c9a3e71c97ee1bbc1f119e104bf3746c51f7
Gitweb: https://git.kernel.org/tip/1d07c9a3e71c97ee1bbc1f119e104bf3746c51f7
Author: Marek Behún <kabel@kernel.org>
AuthorDate: Thu, 11 Jul 2024 18:09:07 +02:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Tue, 30 Jul 2024 13:35:49 +02:00
irqchip/armada-370-xp: Print error and return error code on initialization failure
Print error and return error code on main / IPI / MSI domain
initialization failure. Use WARN_ON() instead of BUG_ON().
Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20240711160907.31012-11-kabel@kernel.org
---
drivers/irqchip/irq-armada-370-xp.c | 28 ++++++++++++++++++++++------
1 file changed, 22 insertions(+), 6 deletions(-)
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index 9c66c25..b11612a 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -464,20 +464,23 @@ static void mpic_ipi_resume(void)
}
}
-static __init void mpic_ipi_init(struct device_node *node)
+static __init int mpic_ipi_init(struct device_node *node)
{
int base_ipi;
mpic_ipi_domain = irq_domain_create_linear(of_node_to_fwnode(node), IPI_DOORBELL_END,
&mpic_ipi_domain_ops, NULL);
if (WARN_ON(!mpic_ipi_domain))
- return;
+ return -ENOMEM;
irq_domain_update_bus_token(mpic_ipi_domain, DOMAIN_BUS_IPI);
base_ipi = irq_domain_alloc_irqs(mpic_ipi_domain, IPI_DOORBELL_END, NUMA_NO_NODE, NULL);
if (WARN_ON(!base_ipi))
- return;
+ return -ENOMEM;
+
set_smp_ipi_range(base_ipi, IPI_DOORBELL_END);
+
+ return 0;
}
static int mpic_set_affinity(struct irq_data *d, const struct cpumask *mask_val, bool force)
@@ -803,7 +806,11 @@ static int __init mpic_of_init(struct device_node *node, struct device_node *par
writel(i, main_int_base + MPIC_INT_CLEAR_ENABLE);
mpic_domain = irq_domain_add_linear(node, nr_irqs, &mpic_irq_ops, NULL);
- BUG_ON(!mpic_domain);
+ if (!mpic_domain) {
+ pr_err("%pOF: Unable to add IRQ domain\n", node);
+ return -ENOMEM;
+ }
+
irq_domain_update_bus_token(mpic_domain, DOMAIN_BUS_WIRED);
/*
@@ -816,13 +823,22 @@ static int __init mpic_of_init(struct device_node *node, struct device_node *par
mpic_perf_init();
mpic_smp_cpu_init();
- mpic_msi_init(node, phys_base);
+ err = mpic_msi_init(node, phys_base);
+ if (err) {
+ pr_err("%pOF: Unable to initialize MSI domain\n", node);
+ return err;
+ }
if (parent_irq <= 0) {
irq_set_default_host(mpic_domain);
set_handle_irq(mpic_handle_irq);
#ifdef CONFIG_SMP
- mpic_ipi_init(node);
+ err = mpic_ipi_init(node);
+ if (err) {
+ pr_err("%pOF: Unable to initialize IPI domain\n", node);
+ return err;
+ }
+
cpuhp_setup_state_nocalls(CPUHP_AP_IRQ_ARMADA_XP_STARTING,
"irqchip/armada/ipi:starting",
mpic_starting_cpu, NULL);
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [tip: irq/core] irqchip/armada-370-xp: Refactor initial memory regions mapping
2024-07-11 16:09 ` [PATCH 09/10] irqchip/armada-370-xp: Refactor initial memory regions mapping Marek Behún
2024-07-29 9:49 ` [tip: irq/core] " tip-bot2 for Marek Behún
@ 2024-07-30 11:39 ` tip-bot2 for Marek Behún
1 sibling, 0 replies; 34+ messages in thread
From: tip-bot2 for Marek Behún @ 2024-07-30 11:39 UTC (permalink / raw)
To: linux-tip-commits; +Cc: kabel, Thomas Gleixner, x86, linux-kernel, maz
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 654caa9db6649dbecdfa55ea29c9cbf4603fb402
Gitweb: https://git.kernel.org/tip/654caa9db6649dbecdfa55ea29c9cbf4603fb402
Author: Marek Behún <kabel@kernel.org>
AuthorDate: Thu, 11 Jul 2024 18:09:06 +02:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Tue, 30 Jul 2024 13:35:49 +02:00
irqchip/armada-370-xp: Refactor initial memory regions mapping
Refactor the initial memory regions mapping:
- put into its own function
- return error numbers on failure
- use WARN_ON() instead of BUG_ON()
Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20240711160907.31012-10-kabel@kernel.org
---
drivers/irqchip/irq-armada-370-xp.c | 60 +++++++++++++++++++---------
1 file changed, 41 insertions(+), 19 deletions(-)
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index 8b28188..9c66c25 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -12,6 +12,7 @@
#include <linux/bitfield.h>
#include <linux/bits.h>
+#include <linux/err.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -751,29 +752,50 @@ static struct syscore_ops mpic_syscore_ops = {
.resume = mpic_resume,
};
-static int __init mpic_of_init(struct device_node *node,
- struct device_node *parent)
+static int __init mpic_map_region(struct device_node *np, int index,
+ void __iomem **base, phys_addr_t *phys_base)
{
- struct resource main_int_res, per_cpu_int_res;
- unsigned int nr_irqs;
+ struct resource res;
+ int err;
+
+ err = of_address_to_resource(np, index, &res);
+ if (WARN_ON(err))
+ goto fail;
+
+ if (WARN_ON(!request_mem_region(res.start, resource_size(&res), np->full_name))) {
+ err = -EBUSY;
+ goto fail;
+ }
+
+ *base = ioremap(res.start, resource_size(&res));
+ if (WARN_ON(!*base)) {
+ err = -ENOMEM;
+ goto fail;
+ }
- BUG_ON(of_address_to_resource(node, 0, &main_int_res));
- BUG_ON(of_address_to_resource(node, 1, &per_cpu_int_res));
+ if (phys_base)
+ *phys_base = res.start;
- BUG_ON(!request_mem_region(main_int_res.start,
- resource_size(&main_int_res),
- node->full_name));
- BUG_ON(!request_mem_region(per_cpu_int_res.start,
- resource_size(&per_cpu_int_res),
- node->full_name));
+ return 0;
+
+fail:
+ pr_err("%pOF: Unable to map resource %d: %pE\n", np, index, ERR_PTR(err));
+ return err;
+}
+
+static int __init mpic_of_init(struct device_node *node, struct device_node *parent)
+{
+ phys_addr_t phys_base;
+ unsigned int nr_irqs;
+ int err;
- main_int_base = ioremap(main_int_res.start,
- resource_size(&main_int_res));
- BUG_ON(!main_int_base);
+ err = mpic_map_region(node, 0, &main_int_base, &phys_base);
+ if (err)
+ return err;
- per_cpu_int_base = ioremap(per_cpu_int_res.start,
- resource_size(&per_cpu_int_res));
- BUG_ON(!per_cpu_int_base);
+ err = mpic_map_region(node, 1, &per_cpu_int_base, NULL);
+ if (err)
+ return err;
nr_irqs = FIELD_GET(MPIC_INT_CONTROL_NUMINT_MASK, readl(main_int_base + MPIC_INT_CONTROL));
@@ -794,7 +816,7 @@ static int __init mpic_of_init(struct device_node *node,
mpic_perf_init();
mpic_smp_cpu_init();
- mpic_msi_init(node, main_int_res.start);
+ mpic_msi_init(node, phys_base);
if (parent_irq <= 0) {
irq_set_default_host(mpic_domain);
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [tip: irq/core] irqchip/armada-370-xp: Use u32 type instead of unsigned long where possieble
2024-07-11 16:09 ` [PATCH 08/10] irqchip/armada-370-xp: Use u32 type instead of unsigned long where possieble Marek Behún
2024-07-29 9:49 ` [tip: irq/core] " tip-bot2 for Marek Behún
@ 2024-07-30 11:39 ` tip-bot2 for Marek Behún
1 sibling, 0 replies; 34+ messages in thread
From: tip-bot2 for Marek Behún @ 2024-07-30 11:39 UTC (permalink / raw)
To: linux-tip-commits; +Cc: kabel, Thomas Gleixner, x86, linux-kernel, maz
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 625f0582f05d1f496ecd598323df1c8bfcdcbd6f
Gitweb: https://git.kernel.org/tip/625f0582f05d1f496ecd598323df1c8bfcdcbd6f
Author: Marek Behún <kabel@kernel.org>
AuthorDate: Thu, 11 Jul 2024 18:09:05 +02:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Tue, 30 Jul 2024 13:35:48 +02:00
irqchip/armada-370-xp: Use u32 type instead of unsigned long where possieble
For consistency across the driver, use the u32 type instead of unsigned
long for holding register values and return value of cpu_logical_map().
One exception is when the variable is referenced for passing into
for_each_set_bit(), in which case it has to be unsigned long.
Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20240711160907.31012-9-kabel@kernel.org
---
drivers/irqchip/irq-armada-370-xp.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index 5cde229..8b28188 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -357,7 +357,7 @@ static inline int mpic_msi_init(struct device_node *node,
static void mpic_perf_init(void)
{
- unsigned long cpuid;
+ u32 cpuid;
/*
* This Performance Counter Overflow interrupt is specific for
@@ -396,8 +396,8 @@ static void mpic_ipi_unmask(struct irq_data *d)
static void mpic_ipi_send_mask(struct irq_data *d, const struct cpumask *mask)
{
- unsigned long map = 0;
unsigned int cpu;
+ u32 map = 0;
/* Convert our logical CPU mask into a physical one. */
for_each_cpu(cpu, mask)
@@ -633,7 +633,8 @@ static inline void mpic_handle_ipi_irq(void) {}
static void mpic_handle_cascade_irq(struct irq_desc *desc)
{
struct irq_chip *chip = irq_desc_get_chip(desc);
- unsigned long cause, irqsrc, cpuid;
+ unsigned long cause;
+ u32 irqsrc, cpuid;
irq_hw_number_t i;
chained_irq_enter(chip, desc);
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [tip: irq/core] irqchip/armada-370-xp: Rename variable for consistency
2024-07-11 16:09 ` [PATCH 07/10] irqchip/armada-370-xp: Rename variable for consistency Marek Behún
2024-07-29 9:49 ` [tip: irq/core] " tip-bot2 for Marek Behún
@ 2024-07-30 11:39 ` tip-bot2 for Marek Behún
1 sibling, 0 replies; 34+ messages in thread
From: tip-bot2 for Marek Behún @ 2024-07-30 11:39 UTC (permalink / raw)
To: linux-tip-commits; +Cc: kabel, Thomas Gleixner, x86, linux-kernel, maz
The following commit has been merged into the irq/core branch of tip:
Commit-ID: ac0ae59db6f521223b477677d2ff51e26815b114
Gitweb: https://git.kernel.org/tip/ac0ae59db6f521223b477677d2ff51e26815b114
Author: Marek Behún <kabel@kernel.org>
AuthorDate: Thu, 11 Jul 2024 18:09:04 +02:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Tue, 30 Jul 2024 13:35:48 +02:00
irqchip/armada-370-xp: Rename variable for consistency
Rename the variable holding the cause register to "cause" in
mpic_handle_cascade_irq().
Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20240711160907.31012-8-kabel@kernel.org
---
drivers/irqchip/irq-armada-370-xp.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index 4abe0ea..5cde229 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -633,15 +633,15 @@ static inline void mpic_handle_ipi_irq(void) {}
static void mpic_handle_cascade_irq(struct irq_desc *desc)
{
struct irq_chip *chip = irq_desc_get_chip(desc);
- unsigned long irqmap, irqsrc, cpuid;
+ unsigned long cause, irqsrc, cpuid;
irq_hw_number_t i;
chained_irq_enter(chip, desc);
- irqmap = readl_relaxed(per_cpu_int_base + MPIC_PPI_CAUSE);
+ cause = readl_relaxed(per_cpu_int_base + MPIC_PPI_CAUSE);
cpuid = cpu_logical_map(smp_processor_id());
- for_each_set_bit(i, &irqmap, BITS_PER_LONG) {
+ for_each_set_bit(i, &cause, BITS_PER_LONG) {
irqsrc = readl_relaxed(main_int_base + MPIC_INT_SOURCE_CTL(i));
/* Check if the interrupt is not masked on current CPU.
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [tip: irq/core] irqchip/armada-370-xp: Drop redundant continue
2024-07-11 16:09 ` [PATCH 06/10] irqchip/armada-370-xp: Drop redundant continue Marek Behún
2024-07-29 9:49 ` [tip: irq/core] " tip-bot2 for Marek Behún
@ 2024-07-30 11:39 ` tip-bot2 for Marek Behún
1 sibling, 0 replies; 34+ messages in thread
From: tip-bot2 for Marek Behún @ 2024-07-30 11:39 UTC (permalink / raw)
To: linux-tip-commits; +Cc: kabel, Thomas Gleixner, x86, linux-kernel, maz
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 081b64cc872707f80a23e41f0ab12852716551b2
Gitweb: https://git.kernel.org/tip/081b64cc872707f80a23e41f0ab12852716551b2
Author: Marek Behún <kabel@kernel.org>
AuthorDate: Thu, 11 Jul 2024 18:09:03 +02:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Tue, 30 Jul 2024 13:35:48 +02:00
irqchip/armada-370-xp: Drop redundant continue
Drop redundant continue from mpic_handle_irq().
Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20240711160907.31012-7-kabel@kernel.org
---
drivers/irqchip/irq-armada-370-xp.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index 66e14f1..4abe0ea 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -673,10 +673,8 @@ static void __exception_irq_entry mpic_handle_irq(struct pt_regs *regs)
if (i > 1022)
break;
- if (i > 1) {
+ if (i > 1)
generic_handle_domain_irq(mpic_domain, i);
- continue;
- }
/* MSI handling */
if (i == 1)
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [tip: irq/core] irqchip/armada-370-xp: Simplify mpic_reenable_percpu() and mpic_resume()
2024-07-11 16:09 ` [PATCH 04/10] irqchip/armada-370-xp: Simplify mpic_reenable_percpu() and mpic_resume() Marek Behún
2024-07-29 9:49 ` [tip: irq/core] " tip-bot2 for Marek Behún
@ 2024-07-30 11:39 ` tip-bot2 for Marek Behún
1 sibling, 0 replies; 34+ messages in thread
From: tip-bot2 for Marek Behún @ 2024-07-30 11:39 UTC (permalink / raw)
To: linux-tip-commits; +Cc: kabel, Thomas Gleixner, x86, linux-kernel, maz
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 15a50eeaadc169243b00ec90087f689a8a28848e
Gitweb: https://git.kernel.org/tip/15a50eeaadc169243b00ec90087f689a8a28848e
Author: Marek Behún <kabel@kernel.org>
AuthorDate: Thu, 11 Jul 2024 18:09:01 +02:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Tue, 30 Jul 2024 13:35:48 +02:00
irqchip/armada-370-xp: Simplify mpic_reenable_percpu() and mpic_resume()
Refactor the mpic_reenable_percpu() and mpic_resume() functions to make
them a little bit simpler.
Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20240711160907.31012-5-kabel@kernel.org
---
drivers/irqchip/irq-armada-370-xp.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index 98f90a3..66e14f1 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -517,18 +517,13 @@ static void mpic_reenable_percpu(void)
{
/* Re-enable per-CPU interrupts that were enabled before suspend */
for (irq_hw_number_t i = 0; i < MPIC_MAX_PER_CPU_IRQS; i++) {
+ unsigned int virq = irq_linear_revmap(mpic_domain, i);
struct irq_data *d;
- unsigned int virq;
- virq = irq_linear_revmap(mpic_domain, i);
- if (!virq)
+ if (!virq || !irq_percpu_is_enabled(virq))
continue;
d = irq_get_irq_data(virq);
-
- if (!irq_percpu_is_enabled(virq))
- continue;
-
mpic_irq_unmask(d);
}
@@ -706,10 +701,9 @@ static void mpic_resume(void)
/* Re-enable interrupts */
for (irq_hw_number_t i = 0; i < mpic_domain->hwirq_max; i++) {
+ unsigned int virq = irq_linear_revmap(mpic_domain, i);
struct irq_data *d;
- unsigned int virq;
- virq = irq_linear_revmap(mpic_domain, i);
if (!virq)
continue;
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [tip: irq/core] irqchip/armada-370-xp: Use consistent name for struct irq_data variables
2024-07-11 16:09 ` [PATCH 03/10] irqchip/armada-370-xp: Use consistent name for struct irq_data variables Marek Behún
2024-07-29 9:49 ` [tip: irq/core] " tip-bot2 for Marek Behún
@ 2024-07-30 11:39 ` tip-bot2 for Marek Behún
1 sibling, 0 replies; 34+ messages in thread
From: tip-bot2 for Marek Behún @ 2024-07-30 11:39 UTC (permalink / raw)
To: linux-tip-commits; +Cc: kabel, Thomas Gleixner, x86, linux-kernel, maz
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 0d4b1fcd378ea61ff76bedf0d484eac69c028c57
Gitweb: https://git.kernel.org/tip/0d4b1fcd378ea61ff76bedf0d484eac69c028c57
Author: Marek Behún <kabel@kernel.org>
AuthorDate: Thu, 11 Jul 2024 18:09:00 +02:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Tue, 30 Jul 2024 13:35:48 +02:00
irqchip/armada-370-xp: Use consistent name for struct irq_data variables
Always use variable name "d" for struct irq_data *, for consistency.
Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20240711160907.31012-4-kabel@kernel.org
---
drivers/irqchip/irq-armada-370-xp.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index db9594b..98f90a3 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -239,16 +239,16 @@ static struct msi_domain_info mpic_msi_domain_info = {
.chip = &mpic_msi_irq_chip,
};
-static void mpic_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
+static void mpic_compose_msi_msg(struct irq_data *d, struct msi_msg *msg)
{
- unsigned int cpu = cpumask_first(irq_data_get_effective_affinity_mask(data));
+ unsigned int cpu = cpumask_first(irq_data_get_effective_affinity_mask(d));
msg->address_lo = lower_32_bits(msi_doorbell_addr);
msg->address_hi = upper_32_bits(msi_doorbell_addr);
- msg->data = BIT(cpu + 8) | (data->hwirq + msi_doorbell_start());
+ msg->data = BIT(cpu + 8) | (d->hwirq + msi_doorbell_start());
}
-static int mpic_msi_set_affinity(struct irq_data *irq_data, const struct cpumask *mask, bool force)
+static int mpic_msi_set_affinity(struct irq_data *d, const struct cpumask *mask, bool force)
{
unsigned int cpu;
@@ -260,7 +260,7 @@ static int mpic_msi_set_affinity(struct irq_data *irq_data, const struct cpumask
if (cpu >= nr_cpu_ids)
return -EINVAL;
- irq_data_update_effective_affinity(irq_data, cpumask_of(cpu));
+ irq_data_update_effective_affinity(d, cpumask_of(cpu));
return IRQ_SET_MASK_OK;
}
@@ -517,19 +517,19 @@ static void mpic_reenable_percpu(void)
{
/* Re-enable per-CPU interrupts that were enabled before suspend */
for (irq_hw_number_t i = 0; i < MPIC_MAX_PER_CPU_IRQS; i++) {
- struct irq_data *data;
+ struct irq_data *d;
unsigned int virq;
virq = irq_linear_revmap(mpic_domain, i);
if (!virq)
continue;
- data = irq_get_irq_data(virq);
+ d = irq_get_irq_data(virq);
if (!irq_percpu_is_enabled(virq))
continue;
- mpic_irq_unmask(data);
+ mpic_irq_unmask(d);
}
if (mpic_is_ipi_available())
@@ -706,20 +706,20 @@ static void mpic_resume(void)
/* Re-enable interrupts */
for (irq_hw_number_t i = 0; i < mpic_domain->hwirq_max; i++) {
- struct irq_data *data;
+ struct irq_data *d;
unsigned int virq;
virq = irq_linear_revmap(mpic_domain, i);
if (!virq)
continue;
- data = irq_get_irq_data(virq);
+ d = irq_get_irq_data(virq);
if (!mpic_is_percpu_irq(i)) {
/* Non per-CPU interrupts */
writel(i, per_cpu_int_base + MPIC_INT_CLEAR_MASK);
- if (!irqd_irq_disabled(data))
- mpic_irq_unmask(data);
+ if (!irqd_irq_disabled(d))
+ mpic_irq_unmask(d);
} else {
/* Per-CPU interrupts */
writel(i, main_int_base + MPIC_INT_SET_ENABLE);
@@ -729,7 +729,7 @@ static void mpic_resume(void)
* will take care of secondary CPUs when they come up.
*/
if (irq_percpu_is_enabled(virq))
- mpic_irq_unmask(data);
+ mpic_irq_unmask(d);
}
}
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [tip: irq/core] irqchip/armada-370-xp: Use consistent types when iterating interrupts
2024-07-11 16:08 ` [PATCH 02/10] irqchip/armada-370-xp: Use consistent types when iterating interrupts Marek Behún
2024-07-29 9:49 ` [tip: irq/core] " tip-bot2 for Marek Behún
@ 2024-07-30 11:39 ` tip-bot2 for Marek Behún
1 sibling, 0 replies; 34+ messages in thread
From: tip-bot2 for Marek Behún @ 2024-07-30 11:39 UTC (permalink / raw)
To: linux-tip-commits; +Cc: kabel, Thomas Gleixner, x86, linux-kernel, maz
The following commit has been merged into the irq/core branch of tip:
Commit-ID: a5d32b7475fffe2506fa374b1d6b4a74fa13020c
Gitweb: https://git.kernel.org/tip/a5d32b7475fffe2506fa374b1d6b4a74fa13020c
Author: Marek Behún <kabel@kernel.org>
AuthorDate: Thu, 11 Jul 2024 18:08:59 +02:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Tue, 30 Jul 2024 13:35:48 +02:00
irqchip/armada-370-xp: Use consistent types when iterating interrupts
When iterating, use either the irq_hw_number_t type or the unsigned int
type for the iterator variable, depending on whether the variable
represents HW IRQ number or whether it is added to a IRQ number.
Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20240711160907.31012-3-kabel@kernel.org
---
drivers/irqchip/irq-armada-370-xp.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index 8f95da0..db9594b 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -284,7 +284,7 @@ static int mpic_msi_alloc(struct irq_domain *domain, unsigned int virq, unsigned
if (hwirq < 0)
return -ENOSPC;
- for (int i = 0; i < nr_irqs; i++) {
+ for (unsigned int i = 0; i < nr_irqs; i++) {
irq_domain_set_info(domain, virq + i, hwirq + i,
&mpic_msi_bottom_irq_chip,
domain->host_data, handle_simple_irq,
@@ -429,7 +429,7 @@ static struct irq_chip mpic_ipi_irqchip = {
static int mpic_ipi_alloc(struct irq_domain *d, unsigned int virq,
unsigned int nr_irqs, void *args)
{
- for (int i = 0; i < nr_irqs; i++) {
+ for (unsigned int i = 0; i < nr_irqs; i++) {
irq_set_percpu_devid(virq + i);
irq_domain_set_info(d, virq + i, i, &mpic_ipi_irqchip, d->host_data,
handle_percpu_devid_irq, NULL, NULL);
@@ -451,7 +451,7 @@ static const struct irq_domain_ops mpic_ipi_domain_ops = {
static void mpic_ipi_resume(void)
{
- for (int i = 0; i < IPI_DOORBELL_END; i++) {
+ for (irq_hw_number_t i = 0; i < IPI_DOORBELL_END; i++) {
unsigned int virq = irq_find_mapping(mpic_ipi_domain, i);
struct irq_data *d;
@@ -497,7 +497,7 @@ static int mpic_set_affinity(struct irq_data *d, const struct cpumask *mask_val,
static void mpic_smp_cpu_init(void)
{
- for (int i = 0; i < mpic_domain->hwirq_max; i++)
+ for (irq_hw_number_t i = 0; i < mpic_domain->hwirq_max; i++)
writel(i, per_cpu_int_base + MPIC_INT_SET_MASK);
if (!mpic_is_ipi_available())
@@ -516,7 +516,7 @@ static void mpic_smp_cpu_init(void)
static void mpic_reenable_percpu(void)
{
/* Re-enable per-CPU interrupts that were enabled before suspend */
- for (unsigned int i = 0; i < MPIC_MAX_PER_CPU_IRQS; i++) {
+ for (irq_hw_number_t i = 0; i < MPIC_MAX_PER_CPU_IRQS; i++) {
struct irq_data *data;
unsigned int virq;
@@ -638,7 +638,8 @@ static inline void mpic_handle_ipi_irq(void) {}
static void mpic_handle_cascade_irq(struct irq_desc *desc)
{
struct irq_chip *chip = irq_desc_get_chip(desc);
- unsigned long irqmap, i, irqsrc, cpuid;
+ unsigned long irqmap, irqsrc, cpuid;
+ irq_hw_number_t i;
chained_irq_enter(chip, desc);
@@ -667,7 +668,8 @@ static void mpic_handle_cascade_irq(struct irq_desc *desc)
static void __exception_irq_entry mpic_handle_irq(struct pt_regs *regs)
{
- u32 irqstat, i;
+ irq_hw_number_t i;
+ u32 irqstat;
do {
irqstat = readl_relaxed(per_cpu_int_base + MPIC_CPU_INTACK);
@@ -782,7 +784,7 @@ static int __init mpic_of_init(struct device_node *node,
nr_irqs = FIELD_GET(MPIC_INT_CONTROL_NUMINT_MASK, readl(main_int_base + MPIC_INT_CONTROL));
- for (int i = 0; i < nr_irqs; i++)
+ for (irq_hw_number_t i = 0; i < nr_irqs; i++)
writel(i, main_int_base + MPIC_INT_CLEAR_ENABLE);
mpic_domain = irq_domain_add_linear(node, nr_irqs, &mpic_irq_ops, NULL);
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [tip: irq/core] irqchip/armada-370-xp: Use consistent variable names for hwirqs
2024-07-11 16:08 ` [PATCH 01/10] irqchip/armada-370-xp: Use consistent variable names for hwirqs Marek Behún
2024-07-29 9:49 ` [tip: irq/core] " tip-bot2 for Marek Behún
@ 2024-07-30 11:39 ` tip-bot2 for Marek Behún
1 sibling, 0 replies; 34+ messages in thread
From: tip-bot2 for Marek Behún @ 2024-07-30 11:39 UTC (permalink / raw)
To: linux-tip-commits; +Cc: kabel, Thomas Gleixner, x86, linux-kernel, maz
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 66fc31034f96cbdef7687b1c55d600367e70287e
Gitweb: https://git.kernel.org/tip/66fc31034f96cbdef7687b1c55d600367e70287e
Author: Marek Behún <kabel@kernel.org>
AuthorDate: Thu, 11 Jul 2024 18:08:58 +02:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Tue, 30 Jul 2024 13:35:48 +02:00
irqchip/armada-370-xp: Use consistent variable names for hwirqs
Use consistent variable names for hwirqs: when iterating, use "i",
otherwise use "hwirq".
Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20240711160907.31012-2-kabel@kernel.org
---
drivers/irqchip/irq-armada-370-xp.c | 56 ++++++++++++++--------------
1 file changed, 28 insertions(+), 28 deletions(-)
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index d42c7a1..8f95da0 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -117,7 +117,7 @@
#define MPIC_SW_TRIG_INT 0x04
#define MPIC_INT_SET_ENABLE 0x30
#define MPIC_INT_CLEAR_ENABLE 0x34
-#define MPIC_INT_SOURCE_CTL(irq) (0x100 + (irq) * 4)
+#define MPIC_INT_SOURCE_CTL(hwirq) (0x100 + (hwirq) * 4)
#define MPIC_INT_SOURCE_CPU_MASK GENMASK(3, 0)
#define MPIC_INT_IRQ_FIQ_MASK(cpuid) ((BIT(0) | BIT(8)) << (cpuid))
@@ -195,9 +195,9 @@ static inline unsigned int msi_doorbell_end(void)
return mpic_is_ipi_available() ? PCI_MSI_DOORBELL_END : PCI_MSI_FULL_DOORBELL_END;
}
-static inline bool mpic_is_percpu_irq(irq_hw_number_t irq)
+static inline bool mpic_is_percpu_irq(irq_hw_number_t hwirq)
{
- return irq <= MPIC_MAX_PER_CPU_IRQS;
+ return hwirq <= MPIC_MAX_PER_CPU_IRQS;
}
/*
@@ -516,11 +516,11 @@ static void mpic_smp_cpu_init(void)
static void mpic_reenable_percpu(void)
{
/* Re-enable per-CPU interrupts that were enabled before suspend */
- for (unsigned int irq = 0; irq < MPIC_MAX_PER_CPU_IRQS; irq++) {
+ for (unsigned int i = 0; i < MPIC_MAX_PER_CPU_IRQS; i++) {
struct irq_data *data;
unsigned int virq;
- virq = irq_linear_revmap(mpic_domain, irq);
+ virq = irq_linear_revmap(mpic_domain, i);
if (!virq)
continue;
@@ -572,20 +572,20 @@ static struct irq_chip mpic_irq_chip = {
};
static int mpic_irq_map(struct irq_domain *h, unsigned int virq,
- irq_hw_number_t hw)
+ irq_hw_number_t hwirq)
{
/* IRQs 0 and 1 cannot be mapped, they are handled internally */
- if (hw <= 1)
+ if (hwirq <= 1)
return -EINVAL;
mpic_irq_mask(irq_get_irq_data(virq));
- if (!mpic_is_percpu_irq(hw))
- writel(hw, per_cpu_int_base + MPIC_INT_CLEAR_MASK);
+ if (!mpic_is_percpu_irq(hwirq))
+ writel(hwirq, per_cpu_int_base + MPIC_INT_CLEAR_MASK);
else
- writel(hw, main_int_base + MPIC_INT_SET_ENABLE);
+ writel(hwirq, main_int_base + MPIC_INT_SET_ENABLE);
irq_set_status_flags(virq, IRQ_LEVEL);
- if (mpic_is_percpu_irq(hw)) {
+ if (mpic_is_percpu_irq(hwirq)) {
irq_set_percpu_devid(virq);
irq_set_chip_and_handler(virq, &mpic_irq_chip, handle_percpu_devid_irq);
} else {
@@ -638,15 +638,15 @@ static inline void mpic_handle_ipi_irq(void) {}
static void mpic_handle_cascade_irq(struct irq_desc *desc)
{
struct irq_chip *chip = irq_desc_get_chip(desc);
- unsigned long irqmap, irqn, irqsrc, cpuid;
+ unsigned long irqmap, i, irqsrc, cpuid;
chained_irq_enter(chip, desc);
irqmap = readl_relaxed(per_cpu_int_base + MPIC_PPI_CAUSE);
cpuid = cpu_logical_map(smp_processor_id());
- for_each_set_bit(irqn, &irqmap, BITS_PER_LONG) {
- irqsrc = readl_relaxed(main_int_base + MPIC_INT_SOURCE_CTL(irqn));
+ for_each_set_bit(i, &irqmap, BITS_PER_LONG) {
+ irqsrc = readl_relaxed(main_int_base + MPIC_INT_SOURCE_CTL(i));
/* Check if the interrupt is not masked on current CPU.
* Test IRQ (0-1) and FIQ (8-9) mask bits.
@@ -654,12 +654,12 @@ static void mpic_handle_cascade_irq(struct irq_desc *desc)
if (!(irqsrc & MPIC_INT_IRQ_FIQ_MASK(cpuid)))
continue;
- if (irqn == 0 || irqn == 1) {
+ if (i == 0 || i == 1) {
mpic_handle_msi_irq();
continue;
}
- generic_handle_domain_irq(mpic_domain, irqn);
+ generic_handle_domain_irq(mpic_domain, i);
}
chained_irq_exit(chip, desc);
@@ -667,26 +667,26 @@ static void mpic_handle_cascade_irq(struct irq_desc *desc)
static void __exception_irq_entry mpic_handle_irq(struct pt_regs *regs)
{
- u32 irqstat, irqnr;
+ u32 irqstat, i;
do {
irqstat = readl_relaxed(per_cpu_int_base + MPIC_CPU_INTACK);
- irqnr = FIELD_GET(MPIC_CPU_INTACK_IID_MASK, irqstat);
+ i = FIELD_GET(MPIC_CPU_INTACK_IID_MASK, irqstat);
- if (irqnr > 1022)
+ if (i > 1022)
break;
- if (irqnr > 1) {
- generic_handle_domain_irq(mpic_domain, irqnr);
+ if (i > 1) {
+ generic_handle_domain_irq(mpic_domain, i);
continue;
}
/* MSI handling */
- if (irqnr == 1)
+ if (i == 1)
mpic_handle_msi_irq();
/* IPI Handling */
- if (irqnr == 0)
+ if (i == 0)
mpic_handle_ipi_irq();
} while (1);
}
@@ -703,24 +703,24 @@ static void mpic_resume(void)
bool src0, src1;
/* Re-enable interrupts */
- for (irq_hw_number_t irq = 0; irq < mpic_domain->hwirq_max; irq++) {
+ for (irq_hw_number_t i = 0; i < mpic_domain->hwirq_max; i++) {
struct irq_data *data;
unsigned int virq;
- virq = irq_linear_revmap(mpic_domain, irq);
+ virq = irq_linear_revmap(mpic_domain, i);
if (!virq)
continue;
data = irq_get_irq_data(virq);
- if (!mpic_is_percpu_irq(irq)) {
+ if (!mpic_is_percpu_irq(i)) {
/* Non per-CPU interrupts */
- writel(irq, per_cpu_int_base + MPIC_INT_CLEAR_MASK);
+ writel(i, per_cpu_int_base + MPIC_INT_CLEAR_MASK);
if (!irqd_irq_disabled(data))
mpic_irq_unmask(data);
} else {
/* Per-CPU interrupts */
- writel(irq, main_int_base + MPIC_INT_SET_ENABLE);
+ writel(i, main_int_base + MPIC_INT_SET_ENABLE);
/*
* Re-enable on the current CPU, mpic_reenable_percpu()
^ permalink raw reply related [flat|nested] 34+ messages in thread
end of thread, other threads:[~2024-07-30 11:40 UTC | newest]
Thread overview: 34+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-11 16:08 [PATCH 00/10] armada-370-xp irqchip updates round 4 Marek Behún
2024-07-11 16:08 ` [PATCH 01/10] irqchip/armada-370-xp: Use consistent variable names for hwirqs Marek Behún
2024-07-29 9:49 ` [tip: irq/core] " tip-bot2 for Marek Behún
2024-07-30 11:39 ` tip-bot2 for Marek Behún
2024-07-11 16:08 ` [PATCH 02/10] irqchip/armada-370-xp: Use consistent types when iterating interrupts Marek Behún
2024-07-29 9:49 ` [tip: irq/core] " tip-bot2 for Marek Behún
2024-07-30 11:39 ` tip-bot2 for Marek Behún
2024-07-11 16:09 ` [PATCH 03/10] irqchip/armada-370-xp: Use consistent name for struct irq_data variables Marek Behún
2024-07-29 9:49 ` [tip: irq/core] " tip-bot2 for Marek Behún
2024-07-30 11:39 ` tip-bot2 for Marek Behún
2024-07-11 16:09 ` [PATCH 04/10] irqchip/armada-370-xp: Simplify mpic_reenable_percpu() and mpic_resume() Marek Behún
2024-07-29 9:49 ` [tip: irq/core] " tip-bot2 for Marek Behún
2024-07-30 11:39 ` tip-bot2 for Marek Behún
2024-07-11 16:09 ` [PATCH 05/10] irqchip/armada-370-xp: Drop unneeded curly brackets Marek Behún
2024-07-29 8:52 ` Thomas Gleixner
2024-07-11 16:09 ` [PATCH 06/10] irqchip/armada-370-xp: Drop redundant continue Marek Behún
2024-07-29 9:49 ` [tip: irq/core] " tip-bot2 for Marek Behún
2024-07-30 11:39 ` tip-bot2 for Marek Behún
2024-07-11 16:09 ` [PATCH 07/10] irqchip/armada-370-xp: Rename variable for consistency Marek Behún
2024-07-29 9:49 ` [tip: irq/core] " tip-bot2 for Marek Behún
2024-07-30 11:39 ` tip-bot2 for Marek Behún
2024-07-11 16:09 ` [PATCH 08/10] irqchip/armada-370-xp: Use u32 type instead of unsigned long where possieble Marek Behún
2024-07-29 9:49 ` [tip: irq/core] " tip-bot2 for Marek Behún
2024-07-30 11:39 ` tip-bot2 for Marek Behún
2024-07-11 16:09 ` [PATCH 09/10] irqchip/armada-370-xp: Refactor initial memory regions mapping Marek Behún
2024-07-29 9:49 ` [tip: irq/core] " tip-bot2 for Marek Behún
2024-07-30 11:39 ` tip-bot2 for Marek Behún
2024-07-11 16:09 ` [PATCH 10/10] irqchip/armada-370-xp: Print error and return error code on initialization failure Marek Behún
2024-07-29 9:49 ` [tip: irq/core] " tip-bot2 for Marek Behún
2024-07-30 11:39 ` tip-bot2 for Marek Behún
2024-07-11 20:56 ` [PATCH 00/10] armada-370-xp irqchip updates round 4 Thomas Gleixner
2024-07-12 7:46 ` Marek Behún
2024-07-12 22:19 ` Thomas Gleixner
2024-07-29 9:44 ` Thomas Gleixner
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.