From 2be3014f6b7465f61ad4f0d01f934dbc9f39a254 Mon Sep 17 00:00:00 2001 From: Runyang Chen Date: Thu, 20 Mar 2025 19:06:24 +0800 Subject: [PATCH] refactor(mediatek): fix mcusys off issue for MTK GIC v3 driver When mcusys is off, rdist_ctx will save the rdist data of the last core. In the case of the last core plug off, the data of other cores will be inconsistent with the data in rdist_ctx. Therefore, each core needs to use a dedicated context. Signed-off-by: Runyang Chen Change-Id: Ic9501f4da219cf906c0e348982be3f550c3ba30b --- plat/mediatek/drivers/gicv3/mt_gic_v3.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plat/mediatek/drivers/gicv3/mt_gic_v3.c b/plat/mediatek/drivers/gicv3/mt_gic_v3.c index 659ca9ca1..e9bbbe153 100644 --- a/plat/mediatek/drivers/gicv3/mt_gic_v3.c +++ b/plat/mediatek/drivers/gicv3/mt_gic_v3.c @@ -23,7 +23,7 @@ uintptr_t rdistif_base_addrs[PLATFORM_CORE_COUNT]; -static gicv3_redist_ctx_t rdist_ctx; +static gicv3_redist_ctx_t rdist_ctx[PLATFORM_CORE_COUNT]; static gicv3_dist_ctx_t dist_ctx; /* Configure Secure IRQs */ @@ -112,7 +112,7 @@ void mt_gic_rdistif_save(void) * before the Distributor context. */ for (cpu = 0; cpu < PLATFORM_CORE_COUNT; cpu++) - gicv3_rdistif_save(cpu, &rdist_ctx); + gicv3_rdistif_save(cpu, &rdist_ctx[cpu]); } void mt_gic_rdistif_restore(void) @@ -126,7 +126,7 @@ void mt_gic_rdistif_restore(void) * the SYSTEM SUSPEND call. */ for (cpu = 0; cpu < PLATFORM_CORE_COUNT; cpu++) - gicv3_rdistif_init_restore(cpu, &rdist_ctx); + gicv3_rdistif_init_restore(cpu, &rdist_ctx[cpu]); } void mt_gic_redistif_on(void)