History

irq: riscv: perform irqentry in entry code

In preparation for removing HANDLE_DOMAIN_IRQ_IRQENTRY, have arch/riscv perform all the irqentry accounting in its entry code. As arch/riscv uses GENERIC_IRQ_MULTI_HANDLER, we can use generic_handle_arch_irq() to do so. Since generic_handle_arch_irq() handles the irq entry and setting the irq regs, and happens before the irqchip code calls handle_IPI(), we can remove the redundant irq entry and irq regs manipulation from handle_IPI(). There should be no functional change as a result of this patch.

Mark Rutland committed 5 years ago

Commit 7ecbc641 parent 418360b3 files · +2 −11Browse files

Unified · Split

3 files
  1. arch/riscv/Kconfig +0 −1
  2. arch/riscv/kernel/entry.S +1 −2
  3. arch/riscv/kernel/smp.c +1 −8
arch/riscv/Kconfig+0−1
@@ -63,7 +63,6 @@ config RISCV · 62 unmodified lines
63 select GENERIC_SMP_IDLE_THREAD63 select GENERIC_SMP_IDLE_THREAD
64 select GENERIC_TIME_VSYSCALL if MMU && 64BIT64 select GENERIC_TIME_VSYSCALL if MMU && 64BIT
65 select HANDLE_DOMAIN_IRQ65 select HANDLE_DOMAIN_IRQ
66 select HANDLE_DOMAIN_IRQ_IRQENTRY
67 select HAVE_ARCH_AUDITSYSCALL66 select HAVE_ARCH_AUDITSYSCALL
68 select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL67 select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL
69 select HAVE_ARCH_JUMP_LABEL_RELATIVE if !XIP_KERNEL68 select HAVE_ARCH_JUMP_LABEL_RELATIVE if !XIP_KERNEL
arch/riscv/kernel/entry.S+1−2
@@ -130,8 +130,7 @@ skip_context_tracking: · 129 unmodified lines
130 130
131 /* Handle interrupts */131 /* Handle interrupts */
132 move a0, sp /* pt_regs */132 move a0, sp /* pt_regs */
133 la a1, handle_arch_irq133 la a1, generic_handle_arch_irq
134 REG_L a1, (a1)
135 jr a1134 jr a1
1361:1351:
137 /*136 /*
arch/riscv/kernel/smp.c+1−8
@@ -140,12 +140,9 @@ void arch_irq_work_raise(void) · 139 unmodified lines
140 140
141void handle_IPI(struct pt_regs *regs)141void handle_IPI(struct pt_regs *regs)
142{142{
143 struct pt_regs *old_regs = set_irq_regs(regs);
144 unsigned long *pending_ipis = &ipi_data[smp_processor_id()].bits;143 unsigned long *pending_ipis = &ipi_data[smp_processor_id()].bits;
145 unsigned long *stats = ipi_data[smp_processor_id()].stats;144 unsigned long *stats = ipi_data[smp_processor_id()].stats;
146 145
147 irq_enter();
148
149 riscv_clear_ipi();146 riscv_clear_ipi();
150 147
151 while (true) {148 while (true) {
@@ -156,7 +153,7 @@ void handle_IPI(struct pt_regs *regs) · 4 unmodified lines
156 153
157 ops = xchg(pending_ipis, 0);154 ops = xchg(pending_ipis, 0);
158 if (ops == 0)155 if (ops == 0)
159 goto done;156 return;
160 157
161 if (ops & (1 << IPI_RESCHEDULE)) {158 if (ops & (1 << IPI_RESCHEDULE)) {
162 stats[IPI_RESCHEDULE]++;159 stats[IPI_RESCHEDULE]++;
@@ -189,10 +186,6 @@ void handle_IPI(struct pt_regs *regs) · 26 unmodified lines
189 /* Order data access and bit testing. */186 /* Order data access and bit testing. */
190 mb();187 mb();
191 }188 }
192
193done:
194 irq_exit();
195 set_irq_regs(old_regs);
196}189}
197 190
198static const char * const ipi_names[] = {191static const char * const ipi_names[] = {