hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/drivers/irqchip/irq-gic.c
....@@ -47,6 +47,10 @@
4747
4848 #include "irq-gic-common.h"
4949
50
+#ifdef CONFIG_ROCKCHIP_AMP
51
+#include <soc/rockchip/rockchip_amp.h>
52
+#endif
53
+
5054 #ifdef CONFIG_ARM64
5155 #include <asm/cpufeature.h>
5256
....@@ -194,11 +198,19 @@
194198
195199 static void gic_mask_irq(struct irq_data *d)
196200 {
201
+#ifdef CONFIG_ROCKCHIP_AMP
202
+ if (rockchip_amp_check_amp_irq(gic_irq(d)))
203
+ return;
204
+#endif
197205 gic_poke_irq(d, GIC_DIST_ENABLE_CLEAR);
198206 }
199207
200208 static void gic_eoimode1_mask_irq(struct irq_data *d)
201209 {
210
+#ifdef CONFIG_ROCKCHIP_AMP
211
+ if (rockchip_amp_check_amp_irq(gic_irq(d)))
212
+ return;
213
+#endif
202214 gic_mask_irq(d);
203215 /*
204216 * When masking a forwarded interrupt, make sure it is
....@@ -214,6 +226,10 @@
214226
215227 static void gic_unmask_irq(struct irq_data *d)
216228 {
229
+#ifdef CONFIG_ROCKCHIP_AMP
230
+ if (rockchip_amp_check_amp_irq(gic_irq(d)))
231
+ return;
232
+#endif
217233 gic_poke_irq(d, GIC_DIST_ENABLE_SET);
218234 }
219235
....@@ -221,6 +237,10 @@
221237 {
222238 u32 hwirq = gic_irq(d);
223239
240
+#ifdef CONFIG_ROCKCHIP_AMP
241
+ if (rockchip_amp_check_amp_irq(hwirq))
242
+ return;
243
+#endif
224244 if (hwirq < 16)
225245 hwirq = this_cpu_read(sgi_intid);
226246
....@@ -231,6 +251,10 @@
231251 {
232252 u32 hwirq = gic_irq(d);
233253
254
+#ifdef CONFIG_ROCKCHIP_AMP
255
+ if (rockchip_amp_check_amp_irq(gic_irq(d)))
256
+ return;
257
+#endif
234258 /* Do not deactivate an IRQ forwarded to a vcpu. */
235259 if (irqd_is_forwarded_to_vcpu(d))
236260 return;
....@@ -246,6 +270,10 @@
246270 {
247271 u32 reg;
248272
273
+#ifdef CONFIG_ROCKCHIP_AMP
274
+ if (rockchip_amp_check_amp_irq(gic_irq(d)))
275
+ return -EINVAL;
276
+#endif
249277 switch (which) {
250278 case IRQCHIP_STATE_PENDING:
251279 reg = val ? GIC_DIST_PENDING_SET : GIC_DIST_PENDING_CLEAR;
....@@ -295,6 +323,11 @@
295323 void __iomem *base = gic_dist_base(d);
296324 unsigned int gicirq = gic_irq(d);
297325 int ret;
326
+
327
+#ifdef CONFIG_ROCKCHIP_AMP
328
+ if (rockchip_amp_check_amp_irq(gic_irq(d)))
329
+ return -EINVAL;
330
+#endif
298331
299332 /* Interrupt configuration for SGIs can't be changed */
300333 if (gicirq < 16)
....@@ -492,10 +525,29 @@
492525 * Set all global interrupts to this CPU only.
493526 */
494527 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
495546 cpumask |= cpumask << 8;
496547 cpumask |= cpumask << 16;
497548 for (i = 32; i < gic_irqs; i += 4)
498549 writel_relaxed(cpumask, base + GIC_DIST_TARGET + i * 4 / 4);
550
+#endif
499551
500552 gic_dist_config(base, gic_irqs, NULL);
501553
....@@ -846,6 +898,11 @@
846898 {
847899 void __iomem *reg = gic_dist_base(d) + GIC_DIST_TARGET + gic_irq(d);
848900 unsigned int cpu;
901
+
902
+#ifdef CONFIG_ROCKCHIP_AMP
903
+ if (rockchip_amp_check_amp_irq(gic_irq(d)))
904
+ return -EINVAL;
905
+#endif
849906
850907 if (!force)
851908 cpu = cpumask_any_and(mask_val, cpu_online_mask);
....@@ -1509,6 +1566,10 @@
15091566
15101567 gic_enable_of_quirks(node, gic_quirks, gic);
15111568
1569
+#ifdef CONFIG_ROCKCHIP_AMP
1570
+ rockchip_amp_get_gic_info();
1571
+#endif
1572
+
15121573 return 0;
15131574
15141575 error: