Commit b7bf6d0
committed
drivers: riscv: imsic: add SMP initialization support
Add automatic IMSIC initialization for secondary CPUs in SMP systems,
following the same pattern as the CLINT timer initialization.
Changes:
- Fixed IMSIC IRQ registration to avoid duplicate handler registration:
* Only hart 0 (instance 0) registers the global MEXT IRQ handler via
IRQ_CONNECT()
* Secondary hart instances only enable MEXT locally without
registering duplicate handlers
- Added z_riscv_imsic_secondary_init() function:
* Called automatically from arch_secondary_cpu_init() on each secondary CPU
* Configures EIDELIVERY to enable interrupt delivery in MMSI mode
* Sets EITHRESHOLD to 0 to allow all interrupt priorities
* Enables MEXT interrupt on the current CPU
* Follows the CLINT smp_timer_init() pattern for per-CPU initialization
- Integrated with arch/riscv/core/smp.c:
* arch_secondary_cpu_init() now calls z_riscv_imsic_secondary_init()
when CONFIG_RISCV_IMSIC && CONFIG_SMP are enabled
* Ensures IMSIC is properly initialized before secondary CPUs become
active
This allows IMSIC to work correctly in SMP configurations without
requiring manual initialization in application code. Each CPU's IMSIC
file is configured automatically during SMP boot.
Note: IMSIC CSRs are accessed via ISELECT/IREG and are local to each
CPU. When z_riscv_imsic_secondary_init() executes on CPU N, it
configures that CPU's IMSIC file.
Signed-off-by: Afonso Oliveira <afonsoo@synopsys.com>1 parent cb8f343 commit b7bf6d0
File tree
2 files changed
+95
-10
lines changed- arch/riscv/core
- drivers/interrupt_controller
2 files changed
+95
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
82 | 87 | | |
83 | 88 | | |
84 | 89 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
128 | | - | |
129 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
130 | 136 | | |
131 | | - | |
| 137 | + | |
132 | 138 | | |
133 | 139 | | |
134 | | - | |
| 140 | + | |
135 | 141 | | |
| 142 | + | |
| 143 | + | |
136 | 144 | | |
137 | 145 | | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
138 | 160 | | |
139 | | - | |
140 | 161 | | |
141 | 162 | | |
142 | 163 | | |
| |||
146 | 167 | | |
147 | 168 | | |
148 | 169 | | |
149 | | - | |
150 | | - | |
| 170 | + | |
151 | 171 | | |
152 | 172 | | |
153 | 173 | | |
154 | 174 | | |
155 | 175 | | |
156 | 176 | | |
157 | | - | |
158 | | - | |
159 | | - | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
160 | 194 | | |
161 | 195 | | |
162 | 196 | | |
| |||
208 | 242 | | |
209 | 243 | | |
210 | 244 | | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
0 commit comments