|
11 | 11 | #include <linux/module.h>
|
12 | 12 | #include <linux/seq_file.h>
|
13 | 13 | #include <asm/sbi.h>
|
| 14 | +#include <asm/smp.h> |
| 15 | +#include <asm/softirq_stack.h> |
| 16 | +#include <asm/stacktrace.h> |
14 | 17 |
|
15 | 18 | static struct fwnode_handle *(*__get_intc_node)(void);
|
16 | 19 |
|
@@ -56,6 +59,38 @@ static void init_irq_stacks(void)
|
56 | 59 | per_cpu(irq_stack_ptr, cpu) = per_cpu(irq_stack, cpu);
|
57 | 60 | }
|
58 | 61 | #endif /* CONFIG_VMAP_STACK */
|
| 62 | + |
| 63 | +#ifdef CONFIG_HAVE_SOFTIRQ_ON_OWN_STACK |
| 64 | +void do_softirq_own_stack(void) |
| 65 | +{ |
| 66 | +#ifdef CONFIG_IRQ_STACKS |
| 67 | + if (on_thread_stack()) { |
| 68 | + ulong *sp = per_cpu(irq_stack_ptr, smp_processor_id()) |
| 69 | + + IRQ_STACK_SIZE/sizeof(ulong); |
| 70 | + __asm__ __volatile( |
| 71 | + "addi sp, sp, -"RISCV_SZPTR "\n" |
| 72 | + REG_S" ra, (sp) \n" |
| 73 | + "addi sp, sp, -"RISCV_SZPTR "\n" |
| 74 | + REG_S" s0, (sp) \n" |
| 75 | + "addi s0, sp, 2*"RISCV_SZPTR "\n" |
| 76 | + "move sp, %[sp] \n" |
| 77 | + "call __do_softirq \n" |
| 78 | + "addi sp, s0, -2*"RISCV_SZPTR"\n" |
| 79 | + REG_L" s0, (sp) \n" |
| 80 | + "addi sp, sp, "RISCV_SZPTR "\n" |
| 81 | + REG_L" ra, (sp) \n" |
| 82 | + "addi sp, sp, "RISCV_SZPTR "\n" |
| 83 | + : |
| 84 | + : [sp] "r" (sp) |
| 85 | + : "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", |
| 86 | + "t0", "t1", "t2", "t3", "t4", "t5", "t6", |
| 87 | + "memory"); |
| 88 | + } else |
| 89 | +#endif |
| 90 | + __do_softirq(); |
| 91 | +} |
| 92 | +#endif /* CONFIG_HAVE_SOFTIRQ_ON_OWN_STACK */ |
| 93 | + |
59 | 94 | #else
|
60 | 95 | static void init_irq_stacks(void) {}
|
61 | 96 | #endif /* CONFIG_IRQ_STACKS */
|
|
0 commit comments