Commit ad7b74b415ab5e38dd4ebf935dad1cee3fec4742

Authored by BJ DevOps Team

Merge remote-tracking branch 'origin/ls_v2020.04' into lf_v2020.04

* origin/ls_v2020.04:
  arm64: gic-v3-its: Clear the Pending table before enabling LPIs

Showing 1 changed file Side-by-side Diff

arch/arm/lib/gic-v3-its.c
... ... @@ -3,6 +3,7 @@
3 3 * Copyright 2019 Broadcom.
4 4 */
5 5 #include <common.h>
  6 +#include <cpu_func.h>
6 7 #include <asm/gic.h>
7 8 #include <asm/gic-v3.h>
8 9 #include <asm/io.h>
... ... @@ -28,6 +29,8 @@
28 29 int i;
29 30 u64 redist_lpi_base;
30 31 u64 pend_base = GICR_BASE + GICR_PENDBASER;
  32 + ulong pend_tab_total_sz;
  33 + void *pend_tab_va;
31 34  
32 35 gicd_typer = readl(GICD_BASE + GICD_TYPER);
33 36  
34 37  
... ... @@ -76,12 +79,19 @@
76 79  
77 80 redist_lpi_base = base + LPI_PROPBASE_SZ;
78 81  
  82 + pend_tab_total_sz = num_redist * LPI_PENDBASE_SZ;
  83 + pend_tab_va = map_physmem(redist_lpi_base, pend_tab_total_sz, MAP_NOCACHE);
  84 + memset(pend_tab_va, 0, pend_tab_total_sz);
  85 + flush_cache((ulong)pend_tab_va, pend_tab_total_sz);
  86 + unmap_physmem(pend_tab_va, MAP_NOCACHE);
  87 +
79 88 for (i = 0; i < num_redist; i++) {
80 89 u32 offset = i * GIC_REDISTRIBUTOR_OFFSET;
81 90  
82 91 val = ((redist_lpi_base + (i * LPI_PENDBASE_SZ)) |
83 92 GICR_PENDBASER_INNERSHAREABLE |
84   - GICR_PENDBASER_RAWAWB);
  93 + GICR_PENDBASER_RAWAWB |
  94 + GICR_PENDBASER_PTZ);
85 95  
86 96 writeq(val, (uintptr_t)(pend_base + offset));
87 97 tmp = readq((uintptr_t)(pend_base + offset));