hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
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,11 @@
246270 {
247271 u32 reg;
248272
273
+#ifdef CONFIG_ROCKCHIP_AMP
274
+ if (which != IRQCHIP_STATE_PENDING &&
275
+ rockchip_amp_check_amp_irq(gic_irq(d)))
276
+ return -EINVAL;
277
+#endif
249278 switch (which) {
250279 case IRQCHIP_STATE_PENDING:
251280 reg = val ? GIC_DIST_PENDING_SET : GIC_DIST_PENDING_CLEAR;
....@@ -295,6 +324,11 @@
295324 void __iomem *base = gic_dist_base(d);
296325 unsigned int gicirq = gic_irq(d);
297326 int ret;
327
+
328
+#ifdef CONFIG_ROCKCHIP_AMP
329
+ if (rockchip_amp_check_amp_irq(gic_irq(d)))
330
+ return -EINVAL;
331
+#endif
298332
299333 /* Interrupt configuration for SGIs can't be changed */
300334 if (gicirq < 16)
....@@ -492,10 +526,29 @@
492526 * Set all global interrupts to this CPU only.
493527 */
494528 cpumask = gic_get_cpumask(gic);
529
+
530
+#ifdef CONFIG_ROCKCHIP_AMP
531
+ for (i = 32; i < gic_irqs; i += 4) {
532
+ u32 maskval;
533
+ unsigned int j;
534
+
535
+ maskval = 0;
536
+ for (j = 0; j < 4; j++) {
537
+ if (rockchip_amp_need_init_amp_irq(i + j)) {
538
+ maskval |= rockchip_amp_get_irq_cpumask(i + j) <<
539
+ (j * 8);
540
+ } else {
541
+ maskval |= cpumask << (j * 8);
542
+ }
543
+ }
544
+ writel_relaxed(maskval, base + GIC_DIST_TARGET + i * 4 / 4);
545
+ }
546
+#else
495547 cpumask |= cpumask << 8;
496548 cpumask |= cpumask << 16;
497549 for (i = 32; i < gic_irqs; i += 4)
498550 writel_relaxed(cpumask, base + GIC_DIST_TARGET + i * 4 / 4);
551
+#endif
499552
500553 gic_dist_config(base, gic_irqs, NULL);
501554
....@@ -846,6 +899,11 @@
846899 {
847900 void __iomem *reg = gic_dist_base(d) + GIC_DIST_TARGET + gic_irq(d);
848901 unsigned int cpu;
902
+
903
+#ifdef CONFIG_ROCKCHIP_AMP
904
+ if (rockchip_amp_check_amp_irq(gic_irq(d)))
905
+ return -EINVAL;
906
+#endif
849907
850908 if (!force)
851909 cpu = cpumask_any_and(mask_val, cpu_online_mask);
....@@ -1291,6 +1349,9 @@
12911349 goto error;
12921350 }
12931351
1352
+#ifdef CONFIG_ROCKCHIP_AMP
1353
+ rockchip_amp_get_gic_info(gic->gic_irqs, GIC_V2);
1354
+#endif
12941355 gic_dist_init(gic);
12951356 ret = gic_cpu_init(gic);
12961357 if (ret)