Skip to contentSkip to conversation

riscv: Make IPI_MAX visible and use it consistently

PATCH Applied Guo Ren 6 participants 25 messages Aug 16 – Sep 28

Subsystems (4)

v1 of 2 Applied Latest is v2 →

lore
Share & tools
lore

Guo Ren

author
#0 lore raw

cover riscv: Make IPI_MAX visible and use it consistently

From: "GUO Ren (XuanTie)" <[email protected]>

This series removes the implicit assumption that RISC-V supports exactly eight IPI message types.

Currently, the SBI, CLINT and ACLINT SSWI IPI providers use BITS_PER_BYTE when sizing the generic IPI mux, while IMSIC carries a separate IMSIC_NR_IPI definition set to 8. These values happen to match IPI_MAX today, but neither is the proper source of truth for the number of RISC-V IPI message types.

Move enum ipi_message_type to asm/smp.h so IPI providers can use IPI_MAX directly, then replace the BITS_PER_BYTE and IMSIC_NR_IPI uses with IPI_MAX.

This also makes adding future RISC-V IPI message types independent of the current eight-entry assumption.

GUO Ren (XuanTie) (5):
riscv: smp: Move enum ipi_message_type to asm/smp.h
riscv: sbi: Use IPI_MAX for SBI IPI muxing
clocksource: clint: Use IPI_MAX for IPI muxing irqchip/aclint-sswi: Use IPI_MAX for IPI muxing irqchip/imsic: Use IPI_MAX instead of IMSIC_NR_IPI

 arch/riscv/include/asm/smp.h            | 12 ++++++++++++
 arch/riscv/kernel/sbi-ipi.c             |  4 ++--
 arch/riscv/kernel/smp.c                 | 12 ------------
 drivers/clocksource/timer-clint.c       |  4 ++--
 drivers/irqchip/irq-aclint-sswi.c       |  4 ++--
 drivers/irqchip/irq-riscv-imsic-early.c |  4 ++--
 drivers/irqchip/irq-riscv-imsic-state.h |  1 -
 7 files changed, 20 insertions(+), 21 deletions(-)
Signature · 1 line
2.43.0
author
#1 lore raw

PATCH 1/5 riscv: smp: Move enum ipi_message_type to asm/smp.h

From: "GUO Ren (XuanTie)" <[email protected]>

The IPI message type enumeration (and therefore IPI_MAX) is currently private to arch/riscv/kernel/smp.c. Several IPI providers need to know the exact number of IPIs that the architecture requires, so move the enum into the public header.

This is a pure code movement with no functional change.

---
 arch/riscv/include/asm/smp.h | 12 ++++++++++++
 arch/riscv/kernel/smp.c      | 12 ------------
 2 files changed, 12 insertions(+), 12 deletions(-)
arch/riscv/include/asm/smp.h +12 -0
index 0ecc67641b09..bed39fff1f8a 100644
@@ -15,6 +15,18 @@
 struct seq_file;
 extern unsigned long boot_cpu_hartid;
 
+enum ipi_message_type {
+	IPI_RESCHEDULE,
+	IPI_CALL_FUNC,
+	IPI_CPU_STOP,
+	IPI_CPU_CRASH_STOP,
+	IPI_IRQ_WORK,
+	IPI_TIMER,
+	IPI_CPU_BACKTRACE,
+	IPI_KGDB_ROUNDUP,
+	IPI_MAX
+};
+
 #ifdef CONFIG_SMP
 
 #include <linux/jump_label.h>
arch/riscv/kernel/smp.c +0 -12
index fa66f9c97d74..8930b62b15e7 100644
@@ -28,18 +28,6 @@
 #include <asm/cacheflush.h>
 #include <asm/cpu_ops.h>
 
-enum ipi_message_type {
-	IPI_RESCHEDULE,
-	IPI_CALL_FUNC,
-	IPI_CPU_STOP,
-	IPI_CPU_CRASH_STOP,
-	IPI_IRQ_WORK,
-	IPI_TIMER,
-	IPI_CPU_BACKTRACE,
-	IPI_KGDB_ROUNDUP,
-	IPI_MAX
-};
-
 static const char * const ipi_names[] = {
 	[IPI_RESCHEDULE]	= "Rescheduling interrupts",
 	[IPI_CALL_FUNC]		= "Function call interrupts",
Signature · 1 line
2.43.0
reviewer Reviewed-by on v1 1/5
#2 lore raw

Re: [PATCH 1/5] riscv: smp: Move enum ipi_message_type to asm/smp.h

Quoted 58 lines · Guo Ren

From: "GUO Ren (XuanTie)" <[email protected]>

The IPI message type enumeration (and therefore IPI_MAX) is currently private to arch/riscv/kernel/smp.c.  Several IPI providers need to know the exact number of IPIs that the architecture requires, so move the enum into the public header.

This is a pure code movement with no functional change.

---
 arch/riscv/include/asm/smp.h | 12 ++++++++++++
 arch/riscv/kernel/smp.c      | 12 ------------

 2 files changed, 12 insertions(+), 12 deletions(-)
arch/riscv/include/asm/smp.h +0 -0
index 0ecc67641b09..bed39fff1f8a 100644
@@ -15,6 +15,18 @@
  struct seq_file;
  extern unsigned long boot_cpu_hartid;

arch/riscv/include/asm/smp.h +12 -0
+enum ipi_message_type {
+	IPI_RESCHEDULE,
+	IPI_CALL_FUNC,
+	IPI_CPU_STOP,
+	IPI_CPU_CRASH_STOP,
+	IPI_IRQ_WORK,
+	IPI_TIMER,
+	IPI_CPU_BACKTRACE,
+	IPI_KGDB_ROUNDUP,
+	IPI_MAX
+};
+

 #ifdef CONFIG_SMP

 #include <linux/jump_label.h>

arch/riscv/kernel/smp.c +0 -0
index fa66f9c97d74..8930b62b15e7 100644
@@ -28,18 +28,6 @@
  #include <asm/cacheflush.h>
  #include <asm/cpu_ops.h>

arch/riscv/kernel/smp.c +0 -12
-enum ipi_message_type {
-	IPI_RESCHEDULE,
-	IPI_CALL_FUNC,
-	IPI_CPU_STOP,
-	IPI_CPU_CRASH_STOP,
-	IPI_IRQ_WORK,
-	IPI_TIMER,
-	IPI_CPU_BACKTRACE,
-	IPI_KGDB_ROUNDUP,
-	IPI_MAX
-};
-
Quoted 3 lines

 static const char * const ipi_names[] = {
  [IPI_RESCHEDULE] = "Rescheduling interrupts",
  [IPI_CALL_FUNC] = "Function call interrupts",

maintainer Reviewed-by on v1 1/5
#3 lore raw

Re: [PATCH 1/5] riscv: smp: Move enum ipi_message_type to asm/smp.h

In reply to Guo Ren
Quoted 11 lines · Guo Ren

From: "GUO Ren (XuanTie)" <[email protected]>

The IPI message type enumeration (and therefore IPI_MAX) is currently private to arch/riscv/kernel/smp.c. Several IPI providers need to know the exact number of IPIs that the architecture requires, so move the enum into the public header.

This is a pure code movement with no functional change.

LGTM.

Regards,
Anup

Quoted 54 lines
---
 arch/riscv/include/asm/smp.h | 12 ++++++++++++
 arch/riscv/kernel/smp.c      | 12 ------------
 2 files changed, 12 insertions(+), 12 deletions(-)
arch/riscv/include/asm/smp.h +12 -0
index 0ecc67641b09..bed39fff1f8a 100644
@@ -15,6 +15,18 @@
 struct seq_file;
 extern unsigned long boot_cpu_hartid;
 
+enum ipi_message_type {
+       IPI_RESCHEDULE,
+       IPI_CALL_FUNC,
+       IPI_CPU_STOP,
+       IPI_CPU_CRASH_STOP,
+       IPI_IRQ_WORK,
+       IPI_TIMER,
+       IPI_CPU_BACKTRACE,
+       IPI_KGDB_ROUNDUP,
+       IPI_MAX
+};
+
 #ifdef CONFIG_SMP
 
 #include <linux/jump_label.h>
arch/riscv/kernel/smp.c +0 -13
index fa66f9c97d74..8930b62b15e7 100644
@@ -28,18 +28,6 @@
 #include <asm/cacheflush.h>
 #include <asm/cpu_ops.h>
 
-enum ipi_message_type {
-       IPI_RESCHEDULE,
-       IPI_CALL_FUNC,
-       IPI_CPU_STOP,
-       IPI_CPU_CRASH_STOP,
-       IPI_IRQ_WORK,
-       IPI_TIMER,
-       IPI_CPU_BACKTRACE,
-       IPI_KGDB_ROUNDUP,
-       IPI_MAX
-};
-
 static const char * const ipi_names[] = {
        [IPI_RESCHEDULE]        = "Rescheduling interrupts",
        [IPI_CALL_FUNC]         = "Function call interrupts",
--

2.43.0

#4 lore raw

[tip: irq/drivers] riscv: smp: Move enum ipi_message_type to asm/smp.h

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

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

Commit-ID:     1ae91dc397eb1dbc0f4fc6b96f2481cbc02fe0f9
Gitweb:        https://git.kernel.org/tip/1ae91dc397eb1dbc0f4fc6b96f2481cbc02fe0f9
Author:        GUO Ren (XuanTie) <[email protected]>
AuthorDate:    Sun, 16 Aug 2026 07:00:45 
Committer:     Thomas Gleixner <[email protected]>
CommitterDate: Fri, 04 Sep 2026 15:34:34 +02:00

riscv: smp: Move enum ipi_message_type to asm/smp.h

The IPI message type enumeration (and therefore IPI_MAX) is currently private to arch/riscv/kernel/smp.c. Several IPI providers need to know the exact number of IPIs that the architecture requires, so move the enum into the public header.

This is a pure code movement with no functional change.

---
 arch/riscv/include/asm/smp.h | 12 ++++++++++++
 arch/riscv/kernel/smp.c      | 12 ------------
 2 files changed, 12 insertions(+), 12 deletions(-)
arch/riscv/include/asm/smp.h +12 -0
index 0ecc676..bed39ff 100644
@@ -15,6 +15,18 @@
 struct seq_file;
 extern unsigned long boot_cpu_hartid;
 
+enum ipi_message_type {
+	IPI_RESCHEDULE,
+	IPI_CALL_FUNC,
+	IPI_CPU_STOP,
+	IPI_CPU_CRASH_STOP,
+	IPI_IRQ_WORK,
+	IPI_TIMER,
+	IPI_CPU_BACKTRACE,
+	IPI_KGDB_ROUNDUP,
+	IPI_MAX
+};
+
 #ifdef CONFIG_SMP
 
 #include <linux/jump_label.h>
arch/riscv/kernel/smp.c +0 -12
index fa66f9c..8930b62 100644
@@ -28,18 +28,6 @@
 #include <asm/cacheflush.h>
 #include <asm/cpu_ops.h>
 
-enum ipi_message_type {
-	IPI_RESCHEDULE,
-	IPI_CALL_FUNC,
-	IPI_CPU_STOP,
-	IPI_CPU_CRASH_STOP,
-	IPI_IRQ_WORK,
-	IPI_TIMER,
-	IPI_CPU_BACKTRACE,
-	IPI_KGDB_ROUNDUP,
-	IPI_MAX
-};
-
 static const char * const ipi_names[] = {
 	[IPI_RESCHEDULE]	= "Rescheduling interrupts",
 	[IPI_CALL_FUNC]		= "Function call interrupts",
#5 lore raw

Re: [PATCH 1/5] riscv: smp: Move enum ipi_message_type to asm/smp.h

In reply to Guo Ren
Quoted 8 lines · Guo Ren

From: "GUO Ren (XuanTie)" <[email protected]>

The IPI message type enumeration (and therefore IPI_MAX) is currently private to arch/riscv/kernel/smp.c. Several IPI providers need to know the exact number of IPIs that the architecture requires, so move the enum into the public header.

This is a pure code movement with no functional change.

Other than a build breakage with allmodconfig :) -next has this change as commit 1ae91dc397eb ("riscv: smp: Move enum ipi_message_type to asm/smp.h"), where it breaks allmodconfig with several errors along the lines of:

In file included from drivers/media/platform/mediatek/mdp/mtk_mdp_m2m.c:20:
drivers/media/platform/mediatek/vpu/mtk_vpu.h:63:9: error: redeclaration of enumerator 'IPI_MAX'

     63 |         IPI_MAX,
        |         ^~~~~~~
  In file included from include/linux/smp.h:119,
                   from include/linux/interrupt_rc.h:17,
                   from include/linux/spinlock.h:60,
                   from include/linux/sched.h:38,
                   from include/linux/ratelimit.h:6,
                   from include/linux/dev_printk.h:16,
                   from include/linux/device.h:15,
                   from drivers/media/platform/mediatek/mdp/mtk_mdp_m2m.c:8:
  arch/riscv/include/asm/smp.h:27:9: note: previous definition of 'IPI_MAX' with type 'enum ipi_message_type'
     27 |         IPI_MAX
        |         ^~~~~~~

So one of these needs to change.

Quoted 55 lines
---
 arch/riscv/include/asm/smp.h | 12 ++++++++++++
 arch/riscv/kernel/smp.c      | 12 ------------
 2 files changed, 12 insertions(+), 12 deletions(-)
arch/riscv/include/asm/smp.h +12 -0
index 0ecc67641b09..bed39fff1f8a 100644
@@ -15,6 +15,18 @@
 struct seq_file;
 extern unsigned long boot_cpu_hartid;
 
+enum ipi_message_type {
+	IPI_RESCHEDULE,
+	IPI_CALL_FUNC,
+	IPI_CPU_STOP,
+	IPI_CPU_CRASH_STOP,
+	IPI_IRQ_WORK,
+	IPI_TIMER,
+	IPI_CPU_BACKTRACE,
+	IPI_KGDB_ROUNDUP,
+	IPI_MAX
+};
+
 #ifdef CONFIG_SMP
 
 #include <linux/jump_label.h>
arch/riscv/kernel/smp.c +0 -12
index fa66f9c97d74..8930b62b15e7 100644
@@ -28,18 +28,6 @@
 #include <asm/cacheflush.h>
 #include <asm/cpu_ops.h>
 
-enum ipi_message_type {
-	IPI_RESCHEDULE,
-	IPI_CALL_FUNC,
-	IPI_CPU_STOP,
-	IPI_CPU_CRASH_STOP,
-	IPI_IRQ_WORK,
-	IPI_TIMER,
-	IPI_CPU_BACKTRACE,
-	IPI_KGDB_ROUNDUP,
-	IPI_MAX
-};
-
 static const char * const ipi_names[] = {
 	[IPI_RESCHEDULE]	= "Rescheduling interrupts",
 	[IPI_CALL_FUNC]		= "Function call interrupts",
Signature · 1 line
2.43.0
Signature · 2 lines
Cheers,
Nathan
author
#6 lore raw

Re: [PATCH 1/5] riscv: smp: Move enum ipi_message_type to asm/smp.h

Quoted 32 lines · Nathan Chancellor
Quoted 8 lines · Guo Ren

From: "GUO Ren (XuanTie)" <[email protected]>

The IPI message type enumeration (and therefore IPI_MAX) is currently private to arch/riscv/kernel/smp.c. Several IPI providers need to know the exact number of IPIs that the architecture requires, so move the enum into the public header.

This is a pure code movement with no functional change.

Other than a build breakage with allmodconfig :) -next has this change as commit 1ae91dc397eb ("riscv: smp: Move enum ipi_message_type to asm/smp.h"), where it breaks allmodconfig with several errors along the lines of:

In file included from drivers/media/platform/mediatek/mdp/mtk_mdp_m2m.c:20:
drivers/media/platform/mediatek/vpu/mtk_vpu.h:63:9: error: redeclaration of enumerator 'IPI_MAX'

     63 |         IPI_MAX,
        |         ^~~~~~~
  In file included from include/linux/smp.h:119,
                   from include/linux/interrupt_rc.h:17,
                   from include/linux/spinlock.h:60,
                   from include/linux/sched.h:38,
                   from include/linux/ratelimit.h:6,
                   from include/linux/dev_printk.h:16,
                   from include/linux/device.h:15,
                   from drivers/media/platform/mediatek/mdp/mtk_mdp_m2m.c:8:
  arch/riscv/include/asm/smp.h:27:9: note: previous definition of 'IPI_MAX' with type 'enum ipi_message_type'
     27 |         IPI_MAX
        |         ^~~~~~~
Quoted 1 line

So one of these needs to change.

I prefer to keep IPI_MAX for SMP and rename IPI_MAX in mtk_vpu.h to VPU_IPI_MAX, consistent with SCP_IPI_MAX in mtk_scp.h.

Thx for point it out

--
Best Regards
Guo Ren

#7 lore raw

Re: [PATCH 1/5] riscv: smp: Move enum ipi_message_type to asm/smp.h

Quoted 33 lines · Guo Ren
Quoted 32 lines · Nathan Chancellor
Quoted 8 lines · Guo Ren

From: "GUO Ren (XuanTie)" <[email protected]>

The IPI message type enumeration (and therefore IPI_MAX) is currently private to arch/riscv/kernel/smp.c. Several IPI providers need to know the exact number of IPIs that the architecture requires, so move the enum into the public header.

This is a pure code movement with no functional change.

Other than a build breakage with allmodconfig :) -next has this change as commit 1ae91dc397eb ("riscv: smp: Move enum ipi_message_type to asm/smp.h"), where it breaks allmodconfig with several errors along the lines of:

In file included from drivers/media/platform/mediatek/mdp/mtk_mdp_m2m.c:20:
drivers/media/platform/mediatek/vpu/mtk_vpu.h:63:9: error: redeclaration of enumerator 'IPI_MAX'

     63 |         IPI_MAX,
        |         ^~~~~~~
  In file included from include/linux/smp.h:119,
                   from include/linux/interrupt_rc.h:17,
                   from include/linux/spinlock.h:60,
                   from include/linux/sched.h:38,
                   from include/linux/ratelimit.h:6,
                   from include/linux/dev_printk.h:16,
                   from include/linux/device.h:15,
                   from drivers/media/platform/mediatek/mdp/mtk_mdp_m2m.c:8:
  arch/riscv/include/asm/smp.h:27:9: note: previous definition of 'IPI_MAX' with type 'enum ipi_message_type'
     27 |         IPI_MAX
        |         ^~~~~~~
Quoted 4 lines
Quoted 1 line

So one of these needs to change.

I prefer to keep IPI_MAX for SMP and rename IPI_MAX in mtk_vpu.h to VPU_IPI_MAX, consistent with SCP_IPI_MAX in mtk_scp.h.

That's why using driver specific prefixes are great. Why not MTK_VPU_IPI_MAX or something along these lines?

Best regards
Uwe

author
#8 lore raw

Re: [PATCH 1/5] riscv: smp: Move enum ipi_message_type to asm/smp.h

Quoted 35 lines · Uwe Kleine-König
Quoted 33 lines · Guo Ren
Quoted 32 lines · Nathan Chancellor
Quoted 8 lines · Guo Ren

From: "GUO Ren (XuanTie)" <[email protected]>

The IPI message type enumeration (and therefore IPI_MAX) is currently private to arch/riscv/kernel/smp.c. Several IPI providers need to know the exact number of IPIs that the architecture requires, so move the enum into the public header.

This is a pure code movement with no functional change.

Other than a build breakage with allmodconfig :) -next has this change as commit 1ae91dc397eb ("riscv: smp: Move enum ipi_message_type to asm/smp.h"), where it breaks allmodconfig with several errors along the lines of:

In file included from drivers/media/platform/mediatek/mdp/mtk_mdp_m2m.c:20:
drivers/media/platform/mediatek/vpu/mtk_vpu.h:63:9: error: redeclaration of enumerator 'IPI_MAX'

     63 |         IPI_MAX,
        |         ^~~~~~~
  In file included from include/linux/smp.h:119,
                   from include/linux/interrupt_rc.h:17,
                   from include/linux/spinlock.h:60,
                   from include/linux/sched.h:38,
                   from include/linux/ratelimit.h:6,
                   from include/linux/dev_printk.h:16,
                   from include/linux/device.h:15,
                   from drivers/media/platform/mediatek/mdp/mtk_mdp_m2m.c:8:
  arch/riscv/include/asm/smp.h:27:9: note: previous definition of 'IPI_MAX' with type 'enum ipi_message_type'
     27 |         IPI_MAX
        |         ^~~~~~~
Quoted 7 lines
Quoted 4 lines
Quoted 1 line

So one of these needs to change.

I prefer to keep IPI_MAX for SMP and rename IPI_MAX in mtk_vpu.h to VPU_IPI_MAX, consistent with SCP_IPI_MAX in mtk_scp.h.

That's why using driver specific prefixes are great. Why not MTK_VPU_IPI_MAX or something along these lines?

I agree that a driver-specific prefix such as MTK_VPU_ would be clearer. One correction to my earlier reply: the patch uses IPI_VPU_MAX, not VPU_IPI_MAX. This follows the existing IPI_VPU_INIT naming in mtk_vpu.h; the other identifiers use prefixes such as IPI_VDEC_ and IPI_VENC_.

The intent of this patch [1] is to fix the IPI_MAX collision with a minimal change. Applying a consistent MTK_VPU_ prefix across the enum would be a broader cleanup, which I think is best handled separately in coordination with the driver maintainers.

[1] https://lore.kernel.org/all/[email protected]/

--
Best Regards
Guo Ren

author
#9 lore raw

PATCH 2/5 riscv: sbi: Use IPI_MAX for SBI IPI muxing

In reply to Guo Ren

From: "GUO Ren (XuanTie)" <[email protected]>

Now that IPI_MAX is visible from <asm/smp.h>, replace the hard-coded BITS_PER_BYTE with the proper symbolic constant in the SBI IPI extension driver.

No functional change; IPI_MAX is still 8.

---
 arch/riscv/kernel/sbi-ipi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/riscv/kernel/sbi-ipi.c +2 -2
index 0cc5559c08d8..eeec178a9b95 100644
@@ -57,7 +57,7 @@ void __init sbi_ipi_init(void)
 		return;
 	}
 
-	virq = ipi_mux_create(BITS_PER_BYTE, sbi_send_ipi);
+	virq = ipi_mux_create(IPI_MAX, sbi_send_ipi);
 	if (virq <= 0) {
 		pr_err("unable to create muxed IPIs\n");
 		irq_dispose_mapping(sbi_ipi_virq);
@@ -75,7 +75,7 @@ void __init sbi_ipi_init(void)
 			  "irqchip/sbi-ipi:starting",
 			  sbi_ipi_starting_cpu, NULL);
 
-	riscv_ipi_set_virq_range(virq, BITS_PER_BYTE);
+	riscv_ipi_set_virq_range(virq, IPI_MAX);
 	pr_info("providing IPIs using SBI IPI extension\n");
 
 	/*
Signature · 1 line
2.43.0
maintainer Reviewed-by on v1 2/5
#10 lore raw

Re: [PATCH 2/5] riscv: sbi: Use IPI_MAX for SBI IPI muxing

Quoted 10 lines · Guo Ren

From: "GUO Ren (XuanTie)" <[email protected]>

Now that IPI_MAX is visible from <asm/smp.h>, replace the hard-coded BITS_PER_BYTE with the proper symbolic constant in the SBI IPI extension driver.

No functional change; IPI_MAX is still 8.

LGTM.

Regards,
Anup

Quoted 29 lines
---
 arch/riscv/kernel/sbi-ipi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/riscv/kernel/sbi-ipi.c +2 -3
index 0cc5559c08d8..eeec178a9b95 100644
@@ -57,7 +57,7 @@ void __init sbi_ipi_init(void)
                return;
        }
 
-       virq = ipi_mux_create(BITS_PER_BYTE, sbi_send_ipi);
+       virq = ipi_mux_create(IPI_MAX, sbi_send_ipi);
        if (virq <= 0) {
                pr_err("unable to create muxed IPIs\n");
                irq_dispose_mapping(sbi_ipi_virq);
@@ -75,7 +75,7 @@ void __init sbi_ipi_init(void)
                          "irqchip/sbi-ipi:starting",
                          sbi_ipi_starting_cpu, NULL);
 
-       riscv_ipi_set_virq_range(virq, BITS_PER_BYTE);
+       riscv_ipi_set_virq_range(virq, IPI_MAX);
        pr_info("providing IPIs using SBI IPI extension\n");
 
        /*
--

2.43.0

#11 lore raw

[tip: irq/drivers] riscv: sbi: Use IPI_MAX for SBI IPI muxing

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

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

Commit-ID:     2a0d49514f297baee259b19fb5553b538aa67d10
Gitweb:        https://git.kernel.org/tip/2a0d49514f297baee259b19fb5553b538aa67d10
Author:        GUO Ren (XuanTie) <[email protected]>
AuthorDate:    Sun, 16 Aug 2026 07:00:46 
Committer:     Thomas Gleixner <[email protected]>
CommitterDate: Fri, 04 Sep 2026 15:34:34 +02:00

riscv: sbi: Use IPI_MAX for SBI IPI muxing

Now that IPI_MAX is visible from <asm/smp.h>, replace the hard-coded BITS_PER_BYTE with the proper symbolic constant in the SBI IPI extension driver.

No functional change; IPI_MAX is still 8.

---
 arch/riscv/kernel/sbi-ipi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/riscv/kernel/sbi-ipi.c +2 -2
index 0cc5559..eeec178 100644
@@ -57,7 +57,7 @@ void __init sbi_ipi_init(void)
 		return;
 	}
 
-	virq = ipi_mux_create(BITS_PER_BYTE, sbi_send_ipi);
+	virq = ipi_mux_create(IPI_MAX, sbi_send_ipi);
 	if (virq <= 0) {
 		pr_err("unable to create muxed IPIs\n");
 		irq_dispose_mapping(sbi_ipi_virq);
@@ -75,7 +75,7 @@ void __init sbi_ipi_init(void)
 			  "irqchip/sbi-ipi:starting",
 			  sbi_ipi_starting_cpu, NULL);
 
-	riscv_ipi_set_virq_range(virq, BITS_PER_BYTE);
+	riscv_ipi_set_virq_range(virq, IPI_MAX);
 	pr_info("providing IPIs using SBI IPI extension\n");
 
 	/*
author
#12 lore raw

PATCH 3/5 clocksource: clint: Use IPI_MAX for IPI muxing

In reply to Guo Ren

From: "GUO Ren (XuanTie)" <[email protected]>

Replace the hard-coded BITS_PER_BYTE with IPI_MAX now that the constant is exported from riscv asm/smp.h.

---
 drivers/clocksource/timer-clint.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clocksource/timer-clint.c +2 -2
index 0bdd9d7ec545..e56eee7e3781 100644
@@ -243,7 +243,7 @@ static int __init clint_timer_init_dt(struct device_node *np)
 	}
 
 #ifdef CONFIG_SMP
-	rc = ipi_mux_create(BITS_PER_BYTE, clint_send_ipi);
+	rc = ipi_mux_create(IPI_MAX, clint_send_ipi);
 	if (rc <= 0) {
 		pr_err("unable to create muxed IPIs\n");
 		rc = (rc < 0) ? rc : -ENODEV;
@@ -251,7 +251,7 @@ static int __init clint_timer_init_dt(struct device_node *np)
 	}
 
 	irq_set_chained_handler(clint_ipi_irq, clint_ipi_interrupt);
-	riscv_ipi_set_virq_range(rc, BITS_PER_BYTE);
+	riscv_ipi_set_virq_range(rc, IPI_MAX);
 	clint_clear_ipi();
 #endif
 
Signature · 1 line
2.43.0
maintainer Reviewed-by on v1 3/5
#13 lore raw

Re: [PATCH 3/5] clocksource: clint: Use IPI_MAX for IPI muxing

Quoted 7 lines · Guo Ren

From: "GUO Ren (XuanTie)" <[email protected]>

Replace the hard-coded BITS_PER_BYTE with IPI_MAX now that the constant is exported from riscv asm/smp.h.

LGTM.

Regards,
Anup

Quoted 29 lines
---
 drivers/clocksource/timer-clint.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clocksource/timer-clint.c +2 -3
index 0bdd9d7ec545..e56eee7e3781 100644
@@ -243,7 +243,7 @@ static int __init clint_timer_init_dt(struct device_node *np)
        }
 
 #ifdef CONFIG_SMP
-       rc = ipi_mux_create(BITS_PER_BYTE, clint_send_ipi);
+       rc = ipi_mux_create(IPI_MAX, clint_send_ipi);
        if (rc <= 0) {
                pr_err("unable to create muxed IPIs\n");
                rc = (rc < 0) ? rc : -ENODEV;
@@ -251,7 +251,7 @@ static int __init clint_timer_init_dt(struct device_node *np)
        }
 
        irq_set_chained_handler(clint_ipi_irq, clint_ipi_interrupt);
-       riscv_ipi_set_virq_range(rc, BITS_PER_BYTE);
+       riscv_ipi_set_virq_range(rc, IPI_MAX);
        clint_clear_ipi();
 #endif
 
--

2.43.0

#14 lore raw

[tip: irq/drivers] clocksource: clint: Use IPI_MAX for IPI muxing

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

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

Commit-ID:     f6326e26f60259f62ed2b172f7254d673e869cc1
Gitweb:        https://git.kernel.org/tip/f6326e26f60259f62ed2b172f7254d673e869cc1
Author:        GUO Ren (XuanTie) <[email protected]>
AuthorDate:    Sun, 16 Aug 2026 07:00:47 
Committer:     Thomas Gleixner <[email protected]>
CommitterDate: Fri, 04 Sep 2026 15:34:34 +02:00

clocksource: clint: Use IPI_MAX for IPI muxing

Replace the hard-coded BITS_PER_BYTE with IPI_MAX now that the constant is exported from riscv asm/smp.h.

---
 drivers/clocksource/timer-clint.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clocksource/timer-clint.c +2 -2
index 0bdd9d7..e56eee7 100644
@@ -243,7 +243,7 @@ static int __init clint_timer_init_dt(struct device_node *np)
 	}
 
 #ifdef CONFIG_SMP
-	rc = ipi_mux_create(BITS_PER_BYTE, clint_send_ipi);
+	rc = ipi_mux_create(IPI_MAX, clint_send_ipi);
 	if (rc <= 0) {
 		pr_err("unable to create muxed IPIs\n");
 		rc = (rc < 0) ? rc : -ENODEV;
@@ -251,7 +251,7 @@ static int __init clint_timer_init_dt(struct device_node *np)
 	}
 
 	irq_set_chained_handler(clint_ipi_irq, clint_ipi_interrupt);
-	riscv_ipi_set_virq_range(rc, BITS_PER_BYTE);
+	riscv_ipi_set_virq_range(rc, IPI_MAX);
 	clint_clear_ipi();
 #endif
 
author
#15 lore raw

PATCH 4/5 irqchip/aclint-sswi: Use IPI_MAX for IPI muxing

In reply to Guo Ren

From: "GUO Ren (XuanTie)" <[email protected]>

Replace the hard-coded BITS_PER_BYTE with IPI_MAX now that the constant is exported from riscv asm/smp.h.

---
 drivers/irqchip/irq-aclint-sswi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/irqchip/irq-aclint-sswi.c +2 -2
index ca06efd86fa1..5e010fc401f7 100644
@@ -138,7 +138,7 @@ static int __init aclint_sswi_probe(struct fwnode_handle *fwnode)
 	}
 
 	/* Register SSWI irq and handler */
-	virq = ipi_mux_create(BITS_PER_BYTE, aclint_sswi_ipi_send);
+	virq = ipi_mux_create(IPI_MAX, aclint_sswi_ipi_send);
 	if (virq <= 0) {
 		pr_err("unable to create muxed IPIs\n");
 		irq_dispose_mapping(sswi_ipi_virq);
@@ -152,7 +152,7 @@ static int __init aclint_sswi_probe(struct fwnode_handle *fwnode)
 			  aclint_sswi_starting_cpu,
 			  aclint_sswi_dying_cpu);
 
-	riscv_ipi_set_virq_range(virq, BITS_PER_BYTE);
+	riscv_ipi_set_virq_range(virq, IPI_MAX);
 
 	return 0;
 }
Signature · 1 line
2.43.0
reviewer Reviewed-by on v1 4/5
#16 lore raw

Re: [PATCH 4/5] irqchip/aclint-sswi: Use IPI_MAX for IPI muxing

Quoted 29 lines · Guo Ren

From: "GUO Ren (XuanTie)" <[email protected]>

Replace the hard-coded BITS_PER_BYTE with IPI_MAX now that the constant is exported from riscv asm/smp.h.

---
 drivers/irqchip/irq-aclint-sswi.c | 4 ++--

 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/irqchip/irq-aclint-sswi.c +0 -0
index ca06efd86fa1..5e010fc401f7 100644
@@ -138,7 +138,7 @@ static int __init aclint_sswi_probe(struct fwnode_handle *fwnode)
  	}


  /* Register SSWI irq and handler */

drivers/irqchip/irq-aclint-sswi.c +1 -1
-	virq = ipi_mux_create(BITS_PER_BYTE, aclint_sswi_ipi_send);
+	virq = ipi_mux_create(IPI_MAX, aclint_sswi_ipi_send);

  if (virq <= 0) {
  pr_err("unable to create muxed IPIs\n"); irq_dispose_mapping(sswi_ipi_virq);

drivers/irqchip/irq-aclint-sswi.c +0 -0
@@ -152,7 +152,7 @@ static int __init aclint_sswi_probe(struct fwnode_handle *fwnode)
  			  aclint_sswi_starting_cpu,
  			  aclint_sswi_dying_cpu);

drivers/irqchip/irq-aclint-sswi.c +1 -1
-	riscv_ipi_set_virq_range(virq, BITS_PER_BYTE);
+	riscv_ipi_set_virq_range(virq, IPI_MAX);
Quoted 3 lines


  return 0;
 }

maintainer Reviewed-by on v1 4/5
#17 lore raw

Re: [PATCH 4/5] irqchip/aclint-sswi: Use IPI_MAX for IPI muxing

In reply to Guo Ren
Quoted 7 lines · Guo Ren

From: "GUO Ren (XuanTie)" <[email protected]>

Replace the hard-coded BITS_PER_BYTE with IPI_MAX now that the constant is exported from riscv asm/smp.h.

LGTM.

Regards,
Anup

Quoted 29 lines
---
 drivers/irqchip/irq-aclint-sswi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/irqchip/irq-aclint-sswi.c +2 -3
index ca06efd86fa1..5e010fc401f7 100644
@@ -138,7 +138,7 @@ static int __init aclint_sswi_probe(struct fwnode_handle *fwnode)
        }
 
        /* Register SSWI irq and handler */
-       virq = ipi_mux_create(BITS_PER_BYTE, aclint_sswi_ipi_send);
+       virq = ipi_mux_create(IPI_MAX, aclint_sswi_ipi_send);
        if (virq <= 0) {
                pr_err("unable to create muxed IPIs\n");
                irq_dispose_mapping(sswi_ipi_virq);
@@ -152,7 +152,7 @@ static int __init aclint_sswi_probe(struct fwnode_handle *fwnode)
                          aclint_sswi_starting_cpu,
                          aclint_sswi_dying_cpu);
 
-       riscv_ipi_set_virq_range(virq, BITS_PER_BYTE);
+       riscv_ipi_set_virq_range(virq, IPI_MAX);
 
        return 0;
 }
--

2.43.0

#18 lore raw

[tip: irq/drivers] irqchip/aclint-sswi: Use IPI_MAX for IPI muxing

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

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

Commit-ID:     a89546503a0ee87c20ba742a58000bbe4f87fd34
Gitweb:        https://git.kernel.org/tip/a89546503a0ee87c20ba742a58000bbe4f87fd34
Author:        GUO Ren (XuanTie) <[email protected]>
AuthorDate:    Sun, 16 Aug 2026 07:00:48 
Committer:     Thomas Gleixner <[email protected]>
CommitterDate: Fri, 04 Sep 2026 15:34:34 +02:00

irqchip/aclint-sswi: Use IPI_MAX for IPI muxing

Replace the hard-coded BITS_PER_BYTE with IPI_MAX now that the constant is exported from riscv asm/smp.h.

---
 drivers/irqchip/irq-aclint-sswi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/irqchip/irq-aclint-sswi.c +2 -2
index ca06efd..5e010fc 100644
@@ -138,7 +138,7 @@ static int __init aclint_sswi_probe(struct fwnode_handle *fwnode)
 	}
 
 	/* Register SSWI irq and handler */
-	virq = ipi_mux_create(BITS_PER_BYTE, aclint_sswi_ipi_send);
+	virq = ipi_mux_create(IPI_MAX, aclint_sswi_ipi_send);
 	if (virq <= 0) {
 		pr_err("unable to create muxed IPIs\n");
 		irq_dispose_mapping(sswi_ipi_virq);
@@ -152,7 +152,7 @@ static int __init aclint_sswi_probe(struct fwnode_handle *fwnode)
 			  aclint_sswi_starting_cpu,
 			  aclint_sswi_dying_cpu);
 
-	riscv_ipi_set_virq_range(virq, BITS_PER_BYTE);
+	riscv_ipi_set_virq_range(virq, IPI_MAX);
 
 	return 0;
 }
author
#19 lore raw

PATCH 5/5 irqchip/imsic: Use IPI_MAX instead of IMSIC_NR_IPI

In reply to Guo Ren

From: "GUO Ren (XuanTie)" <[email protected]>

IMSIC was defining its own IMSIC_NR_IPI (= 8) which happened to match the architecture's IPI_MAX. Now that IPI_MAX is exported from riscv asm/smp.h, use the architecture constant and drop the private define.

This keeps the number of multiplexed IPIs in sync with the rest of the RISC-V IPI infrastructure.

---
 drivers/irqchip/irq-riscv-imsic-early.c | 4 ++--
 drivers/irqchip/irq-riscv-imsic-state.h | 1 -
 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/irqchip/irq-riscv-imsic-early.c +2 -2
index 12efd241ce88..823f5f2ecb3d 100644
@@ -67,12 +67,12 @@ static int __init imsic_ipi_domain_init(void)
 		return 0;
 
 	/* Create IMSIC IPI multiplexing */
-	virq = ipi_mux_create(IMSIC_NR_IPI, imsic_ipi_send);
+	virq = ipi_mux_create(IPI_MAX, imsic_ipi_send);
 	if (virq <= 0)
 		return virq < 0 ? virq : -ENOMEM;
 
 	/* Set vIRQ range */
-	riscv_ipi_set_virq_range(virq, IMSIC_NR_IPI);
+	riscv_ipi_set_virq_range(virq, IPI_MAX);
 
 	/* Announce that IMSIC is providing IPIs */
 	pr_info("%pfwP: providing IPIs using interrupt %d\n", imsic->fwnode, IMSIC_IPI_ID);
drivers/irqchip/irq-riscv-imsic-state.h +0 -1
index c42ee180b305..878cc192ccec 100644
@@ -13,7 +13,6 @@
 #include <linux/timer.h>
 
 #define IMSIC_IPI_ID				1
-#define IMSIC_NR_IPI				8
 
 struct imsic_vector {
 	/* Fixed details of the vector */
Signature · 1 line
2.43.0
reviewer Reviewed-by on v1 5/5
#20 lore raw

Re: [PATCH 5/5] irqchip/imsic: Use IPI_MAX instead of IMSIC_NR_IPI

Quoted 40 lines · Guo Ren

From: "GUO Ren (XuanTie)" <[email protected]>

IMSIC was defining its own IMSIC_NR_IPI (= 8) which happened to match the architecture's IPI_MAX. Now that IPI_MAX is exported from riscv asm/smp.h, use the architecture constant and drop the private define.

This keeps the number of multiplexed IPIs in sync with the rest of the RISC-V IPI infrastructure.

---
 drivers/irqchip/irq-riscv-imsic-early.c | 4 ++--
 drivers/irqchip/irq-riscv-imsic-state.h | 1 -

 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/irqchip/irq-riscv-imsic-early.c +0 -0
index 12efd241ce88..823f5f2ecb3d 100644
@@ -67,12 +67,12 @@ static int __init imsic_ipi_domain_init(void)
  		return 0;


  /* Create IMSIC IPI multiplexing */

drivers/irqchip/irq-riscv-imsic-early.c +1 -1
-	virq = ipi_mux_create(IMSIC_NR_IPI, imsic_ipi_send);
+	virq = ipi_mux_create(IPI_MAX, imsic_ipi_send);

  if (virq <= 0)
  return virq < 0 ? virq : -ENOMEM;

  /* Set vIRQ range */

drivers/irqchip/irq-riscv-imsic-early.c +1 -1
-	riscv_ipi_set_virq_range(virq, IMSIC_NR_IPI);
+	riscv_ipi_set_virq_range(virq, IPI_MAX);


  /* Announce that IMSIC is providing IPIs */
  pr_info("%pfwP: providing IPIs using interrupt %d\n", imsic->fwnode, IMSIC_IPI_ID);

drivers/irqchip/irq-riscv-imsic-state.h +0 -0
index c42ee180b305..878cc192ccec 100644
@@ -13,7 +13,6 @@
  #include <linux/timer.h>
Quoted 6 lines


 #define IMSIC_IPI_ID 1
-#define IMSIC_NR_IPI 8

 struct imsic_vector {
  /* Fixed details of the vector */

author
#21 lore raw

Re: [PATCH 5/5] irqchip/imsic: Use IPI_MAX instead of IMSIC_NR_IPI

Quoted 43 lines · Radu Rendec
Quoted 41 lines · Guo Ren

From: "GUO Ren (XuanTie)" <[email protected]>

IMSIC was defining its own IMSIC_NR_IPI (= 8) which happened to match the architecture's IPI_MAX. Now that IPI_MAX is exported from riscv asm/smp.h, use the architecture constant and drop the private define.

This keeps the number of multiplexed IPIs in sync with the rest of the RISC-V IPI infrastructure.

---
 drivers/irqchip/irq-riscv-imsic-early.c | 4 ++--
 drivers/irqchip/irq-riscv-imsic-state.h | 1 -
 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/irqchip/irq-riscv-imsic-early.c +2 -2
index 12efd241ce88..823f5f2ecb3d 100644
@@ -67,12 +67,12 @@ static int __init imsic_ipi_domain_init(void)
              return 0;
 
      /* Create IMSIC IPI multiplexing */
-     virq = ipi_mux_create(IMSIC_NR_IPI, imsic_ipi_send);
+     virq = ipi_mux_create(IPI_MAX, imsic_ipi_send);
      if (virq <= 0)
              return virq < 0 ? virq : -ENOMEM;
 
      /* Set vIRQ range */
-     riscv_ipi_set_virq_range(virq, IMSIC_NR_IPI);
+     riscv_ipi_set_virq_range(virq, IPI_MAX);
 
      /* Announce that IMSIC is providing IPIs */
      pr_info("%pfwP: providing IPIs using interrupt %d\n", imsic->fwnode, IMSIC_IPI_ID);
drivers/irqchip/irq-riscv-imsic-state.h +0 -0
index c42ee180b305..878cc192ccec 100644
@@ -13,7 +13,6 @@
 #include <linux/timer.h>
 
Quoted 7 lines

drivers/irqchip/irq-riscv-imsic-state.h line 18

Quoted 5 lines
drivers/irqchip/irq-riscv-imsic-state.h +0 -1
 #define IMSIC_IPI_ID                         1
-#define IMSIC_NR_IPI                         8
 
 struct imsic_vector {
      /* Fixed details of the vector */

Thanks for the review, Radu. However, this patch depends on [1]. Would you mind also reviewing [1]?

[1]: https://lore.kernel.org/linux-riscv/[email protected]/

Signature · 2 lines
Best Regards
 Guo Ren
reviewer
#22 lore raw

Re: [PATCH 5/5] irqchip/imsic: Use IPI_MAX instead of IMSIC_NR_IPI

Quoted 52 lines · Guo Ren
Quoted 43 lines · Radu Rendec
Quoted 41 lines · Guo Ren

From: "GUO Ren (XuanTie)" <[email protected]>

IMSIC was defining its own IMSIC_NR_IPI (= 8) which happened to match the architecture's IPI_MAX. Now that IPI_MAX is exported from riscv asm/smp.h, use the architecture constant and drop the private define.

This keeps the number of multiplexed IPIs in sync with the rest of the RISC-V IPI infrastructure.

---
 drivers/irqchip/irq-riscv-imsic-early.c | 4 ++--
 drivers/irqchip/irq-riscv-imsic-state.h | 1 -

 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/irqchip/irq-riscv-imsic-early.c +2 -2
index 12efd241ce88..823f5f2ecb3d 100644
@@ -67,12 +67,12 @@ static int __init imsic_ipi_domain_init(void)
               return 0;
 
       /* Create IMSIC IPI multiplexing */
-     virq = ipi_mux_create(IMSIC_NR_IPI, imsic_ipi_send);
+     virq = ipi_mux_create(IPI_MAX, imsic_ipi_send);
       if (virq <= 0)
               return virq < 0 ? virq : -ENOMEM;
 
       /* Set vIRQ range */
-     riscv_ipi_set_virq_range(virq, IMSIC_NR_IPI);
+     riscv_ipi_set_virq_range(virq, IPI_MAX);
 
       /* Announce that IMSIC is providing IPIs */
       pr_info("%pfwP: providing IPIs using interrupt %d\n", imsic->fwnode, IMSIC_IPI_ID);
drivers/irqchip/irq-riscv-imsic-state.h +0 -0
index c42ee180b305..878cc192ccec 100644
@@ -13,7 +13,6 @@
  #include <linux/timer.h>
 
Quoted 7 lines

drivers/irqchip/irq-riscv-imsic-state.h line 18

Quoted 5 lines
drivers/irqchip/irq-riscv-imsic-state.h +0 -1
  #define IMSIC_IPI_ID                         1
-#define IMSIC_NR_IPI                         8
 
  struct imsic_vector {
       /* Fixed details of the vector */
Quoted 4 lines

Thanks for the review, Radu. However, this patch depends on [1]. Would you mind also reviewing [1]?

[1]: https://lore.kernel.org/linux-riscv/[email protected]/

You're welcome! Sure, that makes sense, I reviewed [1] as well.

Signature · 2 lines
Best regards,
Radu
maintainer Reviewed-by on v1 5/5
#23 lore raw

Re: [PATCH 5/5] irqchip/imsic: Use IPI_MAX instead of IMSIC_NR_IPI

In reply to Guo Ren
Quoted 11 lines · Guo Ren

From: "GUO Ren (XuanTie)" <[email protected]>

IMSIC was defining its own IMSIC_NR_IPI (= 8) which happened to match the architecture's IPI_MAX. Now that IPI_MAX is exported from riscv asm/smp.h, use the architecture constant and drop the private define.

This keeps the number of multiplexed IPIs in sync with the rest of the RISC-V IPI infrastructure.

LGTM.

Regards,
Anup

Quoted 39 lines
---
 drivers/irqchip/irq-riscv-imsic-early.c | 4 ++--
 drivers/irqchip/irq-riscv-imsic-state.h | 1 -
 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/irqchip/irq-riscv-imsic-early.c +2 -2
index 12efd241ce88..823f5f2ecb3d 100644
@@ -67,12 +67,12 @@ static int __init imsic_ipi_domain_init(void)
                return 0;
 
        /* Create IMSIC IPI multiplexing */
-       virq = ipi_mux_create(IMSIC_NR_IPI, imsic_ipi_send);
+       virq = ipi_mux_create(IPI_MAX, imsic_ipi_send);
        if (virq <= 0)
                return virq < 0 ? virq : -ENOMEM;
 
        /* Set vIRQ range */
-       riscv_ipi_set_virq_range(virq, IMSIC_NR_IPI);
+       riscv_ipi_set_virq_range(virq, IPI_MAX);
 
        /* Announce that IMSIC is providing IPIs */
        pr_info("%pfwP: providing IPIs using interrupt %d\n", imsic->fwnode, IMSIC_IPI_ID);
drivers/irqchip/irq-riscv-imsic-state.h +0 -2
index c42ee180b305..878cc192ccec 100644
@@ -13,7 +13,6 @@
 #include <linux/timer.h>
 
 #define IMSIC_IPI_ID                           1
-#define IMSIC_NR_IPI                           8
 
 struct imsic_vector {
        /* Fixed details of the vector */
--

2.43.0

#24 lore raw

[tip: irq/drivers] irqchip/imsic: Use IPI_MAX instead of IMSIC_NR_IPI

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

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

Commit-ID:     5b104000160dec7f01c292da1082fbe4bdd5f715
Gitweb:        https://git.kernel.org/tip/5b104000160dec7f01c292da1082fbe4bdd5f715
Author:        GUO Ren (XuanTie) <[email protected]>
AuthorDate:    Sun, 16 Aug 2026 07:00:49 
Committer:     Thomas Gleixner <[email protected]>
CommitterDate: Fri, 04 Sep 2026 15:34:34 +02:00

irqchip/imsic: Use IPI_MAX instead of IMSIC_NR_IPI

IMSIC was defining its own IMSIC_NR_IPI (= 8) which happened to match the architecture's IPI_MAX. Now that IPI_MAX is exported from riscv asm/smp.h, use the architecture constant and drop the private define.

This keeps the number of multiplexed IPIs in sync with the rest of the RISC-V IPI infrastructure.

---
 drivers/irqchip/irq-riscv-imsic-early.c | 4 ++--
 drivers/irqchip/irq-riscv-imsic-state.h | 1 -
 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/irqchip/irq-riscv-imsic-early.c +2 -2
index 12efd24..823f5f2 100644
@@ -67,12 +67,12 @@ static int __init imsic_ipi_domain_init(void)
 		return 0;
 
 	/* Create IMSIC IPI multiplexing */
-	virq = ipi_mux_create(IMSIC_NR_IPI, imsic_ipi_send);
+	virq = ipi_mux_create(IPI_MAX, imsic_ipi_send);
 	if (virq <= 0)
 		return virq < 0 ? virq : -ENOMEM;
 
 	/* Set vIRQ range */
-	riscv_ipi_set_virq_range(virq, IMSIC_NR_IPI);
+	riscv_ipi_set_virq_range(virq, IPI_MAX);
 
 	/* Announce that IMSIC is providing IPIs */
 	pr_info("%pfwP: providing IPIs using interrupt %d\n", imsic->fwnode, IMSIC_IPI_ID);
drivers/irqchip/irq-riscv-imsic-state.h +0 -1
index c42ee18..878cc19 100644
@@ -13,7 +13,6 @@
 #include <linux/timer.h>
 
 #define IMSIC_IPI_ID				1
-#define IMSIC_NR_IPI				8
 
 struct imsic_vector {
 	/* Fixed details of the vector */