mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-02 07:04:24 +00:00
irqchip/gic-v3-its: Flush ITS tables correctly in non-coherent GIC designs
In non-coherent GIC designs, the ITS tables must be flushed before writing
to the GITS_BASER<n> registers, otherwise the ITS could read dirty tables,
which results in unpredictable behavior.
Flush the tables right at the begin of its_setup_baser() to prevent that.
[ tglx: Massage changelog ]
Fixes: a8707f5538
("irqchip/gic-v3: Add Rockchip 3588001 erratum workaround")
Suggested-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Fang Xiang <fangxiang3@xiaomi.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20231030083256.4345-1-fangxiang3@xiaomi.com
This commit is contained in:
parent
8999ad99f4
commit
d3badb1561
1 changed files with 10 additions and 6 deletions
|
@ -2379,12 +2379,12 @@ static int its_setup_baser(struct its_node *its, struct its_baser *baser,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!shr)
|
||||||
|
gic_flush_dcache_to_poc(base, PAGE_ORDER_TO_SIZE(order));
|
||||||
|
|
||||||
its_write_baser(its, baser, val);
|
its_write_baser(its, baser, val);
|
||||||
tmp = baser->val;
|
tmp = baser->val;
|
||||||
|
|
||||||
if (its->flags & ITS_FLAGS_FORCE_NON_SHAREABLE)
|
|
||||||
tmp &= ~GITS_BASER_SHAREABILITY_MASK;
|
|
||||||
|
|
||||||
if ((val ^ tmp) & GITS_BASER_SHAREABILITY_MASK) {
|
if ((val ^ tmp) & GITS_BASER_SHAREABILITY_MASK) {
|
||||||
/*
|
/*
|
||||||
* Shareability didn't stick. Just use
|
* Shareability didn't stick. Just use
|
||||||
|
@ -2394,10 +2394,9 @@ static int its_setup_baser(struct its_node *its, struct its_baser *baser,
|
||||||
* non-cacheable as well.
|
* non-cacheable as well.
|
||||||
*/
|
*/
|
||||||
shr = tmp & GITS_BASER_SHAREABILITY_MASK;
|
shr = tmp & GITS_BASER_SHAREABILITY_MASK;
|
||||||
if (!shr) {
|
if (!shr)
|
||||||
cache = GITS_BASER_nC;
|
cache = GITS_BASER_nC;
|
||||||
gic_flush_dcache_to_poc(base, PAGE_ORDER_TO_SIZE(order));
|
|
||||||
}
|
|
||||||
goto retry_baser;
|
goto retry_baser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2609,6 +2608,11 @@ static int its_alloc_tables(struct its_node *its)
|
||||||
/* erratum 24313: ignore memory access type */
|
/* erratum 24313: ignore memory access type */
|
||||||
cache = GITS_BASER_nCnB;
|
cache = GITS_BASER_nCnB;
|
||||||
|
|
||||||
|
if (its->flags & ITS_FLAGS_FORCE_NON_SHAREABLE) {
|
||||||
|
cache = GITS_BASER_nC;
|
||||||
|
shr = 0;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < GITS_BASER_NR_REGS; i++) {
|
for (i = 0; i < GITS_BASER_NR_REGS; i++) {
|
||||||
struct its_baser *baser = its->tables + i;
|
struct its_baser *baser = its->tables + i;
|
||||||
u64 val = its_read_baser(its, baser);
|
u64 val = its_read_baser(its, baser);
|
||||||
|
|
Loading…
Reference in a new issue