.. | .. |
---|
47 | 47 | |
---|
48 | 48 | #include "irq-gic-common.h" |
---|
49 | 49 | |
---|
| 50 | +#ifdef CONFIG_ROCKCHIP_AMP |
---|
| 51 | +#include <soc/rockchip/rockchip_amp.h> |
---|
| 52 | +#endif |
---|
| 53 | + |
---|
50 | 54 | #ifdef CONFIG_ARM64 |
---|
51 | 55 | #include <asm/cpufeature.h> |
---|
52 | 56 | |
---|
.. | .. |
---|
194 | 198 | |
---|
195 | 199 | static void gic_mask_irq(struct irq_data *d) |
---|
196 | 200 | { |
---|
| 201 | +#ifdef CONFIG_ROCKCHIP_AMP |
---|
| 202 | + if (rockchip_amp_check_amp_irq(gic_irq(d))) |
---|
| 203 | + return; |
---|
| 204 | +#endif |
---|
197 | 205 | gic_poke_irq(d, GIC_DIST_ENABLE_CLEAR); |
---|
198 | 206 | } |
---|
199 | 207 | |
---|
200 | 208 | static void gic_eoimode1_mask_irq(struct irq_data *d) |
---|
201 | 209 | { |
---|
| 210 | +#ifdef CONFIG_ROCKCHIP_AMP |
---|
| 211 | + if (rockchip_amp_check_amp_irq(gic_irq(d))) |
---|
| 212 | + return; |
---|
| 213 | +#endif |
---|
202 | 214 | gic_mask_irq(d); |
---|
203 | 215 | /* |
---|
204 | 216 | * When masking a forwarded interrupt, make sure it is |
---|
.. | .. |
---|
214 | 226 | |
---|
215 | 227 | static void gic_unmask_irq(struct irq_data *d) |
---|
216 | 228 | { |
---|
| 229 | +#ifdef CONFIG_ROCKCHIP_AMP |
---|
| 230 | + if (rockchip_amp_check_amp_irq(gic_irq(d))) |
---|
| 231 | + return; |
---|
| 232 | +#endif |
---|
217 | 233 | gic_poke_irq(d, GIC_DIST_ENABLE_SET); |
---|
218 | 234 | } |
---|
219 | 235 | |
---|
.. | .. |
---|
221 | 237 | { |
---|
222 | 238 | u32 hwirq = gic_irq(d); |
---|
223 | 239 | |
---|
| 240 | +#ifdef CONFIG_ROCKCHIP_AMP |
---|
| 241 | + if (rockchip_amp_check_amp_irq(hwirq)) |
---|
| 242 | + return; |
---|
| 243 | +#endif |
---|
224 | 244 | if (hwirq < 16) |
---|
225 | 245 | hwirq = this_cpu_read(sgi_intid); |
---|
226 | 246 | |
---|
.. | .. |
---|
231 | 251 | { |
---|
232 | 252 | u32 hwirq = gic_irq(d); |
---|
233 | 253 | |
---|
| 254 | +#ifdef CONFIG_ROCKCHIP_AMP |
---|
| 255 | + if (rockchip_amp_check_amp_irq(gic_irq(d))) |
---|
| 256 | + return; |
---|
| 257 | +#endif |
---|
234 | 258 | /* Do not deactivate an IRQ forwarded to a vcpu. */ |
---|
235 | 259 | if (irqd_is_forwarded_to_vcpu(d)) |
---|
236 | 260 | return; |
---|
.. | .. |
---|
246 | 270 | { |
---|
247 | 271 | u32 reg; |
---|
248 | 272 | |
---|
| 273 | +#ifdef CONFIG_ROCKCHIP_AMP |
---|
| 274 | + if (rockchip_amp_check_amp_irq(gic_irq(d))) |
---|
| 275 | + return -EINVAL; |
---|
| 276 | +#endif |
---|
249 | 277 | switch (which) { |
---|
250 | 278 | case IRQCHIP_STATE_PENDING: |
---|
251 | 279 | reg = val ? GIC_DIST_PENDING_SET : GIC_DIST_PENDING_CLEAR; |
---|
.. | .. |
---|
295 | 323 | void __iomem *base = gic_dist_base(d); |
---|
296 | 324 | unsigned int gicirq = gic_irq(d); |
---|
297 | 325 | int ret; |
---|
| 326 | + |
---|
| 327 | +#ifdef CONFIG_ROCKCHIP_AMP |
---|
| 328 | + if (rockchip_amp_check_amp_irq(gic_irq(d))) |
---|
| 329 | + return -EINVAL; |
---|
| 330 | +#endif |
---|
298 | 331 | |
---|
299 | 332 | /* Interrupt configuration for SGIs can't be changed */ |
---|
300 | 333 | if (gicirq < 16) |
---|
.. | .. |
---|
492 | 525 | * Set all global interrupts to this CPU only. |
---|
493 | 526 | */ |
---|
494 | 527 | cpumask = gic_get_cpumask(gic); |
---|
| 528 | + |
---|
| 529 | +#ifdef CONFIG_ROCKCHIP_AMP |
---|
| 530 | + for (i = 32; i < gic_irqs; i += 4) { |
---|
| 531 | + u32 maskval; |
---|
| 532 | + unsigned int j; |
---|
| 533 | + |
---|
| 534 | + maskval = 0; |
---|
| 535 | + for (j = 0; j < 4; j++) { |
---|
| 536 | + if (rockchip_amp_check_amp_irq(i + j)) { |
---|
| 537 | + maskval |= rockchip_amp_get_irq_cpumask(i + j) << |
---|
| 538 | + (j * 8); |
---|
| 539 | + } else { |
---|
| 540 | + maskval |= cpumask << (j * 8); |
---|
| 541 | + } |
---|
| 542 | + } |
---|
| 543 | + writel_relaxed(maskval, base + GIC_DIST_TARGET + i * 4 / 4); |
---|
| 544 | + } |
---|
| 545 | +#else |
---|
495 | 546 | cpumask |= cpumask << 8; |
---|
496 | 547 | cpumask |= cpumask << 16; |
---|
497 | 548 | for (i = 32; i < gic_irqs; i += 4) |
---|
498 | 549 | writel_relaxed(cpumask, base + GIC_DIST_TARGET + i * 4 / 4); |
---|
| 550 | +#endif |
---|
499 | 551 | |
---|
500 | 552 | gic_dist_config(base, gic_irqs, NULL); |
---|
501 | 553 | |
---|
.. | .. |
---|
846 | 898 | { |
---|
847 | 899 | void __iomem *reg = gic_dist_base(d) + GIC_DIST_TARGET + gic_irq(d); |
---|
848 | 900 | unsigned int cpu; |
---|
| 901 | + |
---|
| 902 | +#ifdef CONFIG_ROCKCHIP_AMP |
---|
| 903 | + if (rockchip_amp_check_amp_irq(gic_irq(d))) |
---|
| 904 | + return -EINVAL; |
---|
| 905 | +#endif |
---|
849 | 906 | |
---|
850 | 907 | if (!force) |
---|
851 | 908 | cpu = cpumask_any_and(mask_val, cpu_online_mask); |
---|
.. | .. |
---|
1509 | 1566 | |
---|
1510 | 1567 | gic_enable_of_quirks(node, gic_quirks, gic); |
---|
1511 | 1568 | |
---|
| 1569 | +#ifdef CONFIG_ROCKCHIP_AMP |
---|
| 1570 | + rockchip_amp_get_gic_info(); |
---|
| 1571 | +#endif |
---|
| 1572 | + |
---|
1512 | 1573 | return 0; |
---|
1513 | 1574 | |
---|
1514 | 1575 | error: |
---|