From 282514cff332090852e52bc7c56fdea53c1f7218 Mon Sep 17 00:00:00 2001 From: "Andrew F. Davis" Date: Thu, 25 Apr 2019 13:51:12 -0400 Subject: [PATCH 1/4] ti: k3: common: Remove unused STUB macro This macro was used when many of these functions were stubbed out, the macro is not used anymore, remove it. Signed-off-by: Andrew F. Davis Change-Id: Ida33f92fe3810a89e6e51faf6e93c1d2ada1a2ee --- plat/ti/k3/common/k3_psci.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/plat/ti/k3/common/k3_psci.c b/plat/ti/k3/common/k3_psci.c index f66f12a3d..cd42e7a0a 100644 --- a/plat/ti/k3/common/k3_psci.c +++ b/plat/ti/k3/common/k3_psci.c @@ -20,8 +20,6 @@ /* Need to flush psci internal locks before shutdown or their values are lost */ #include "../../../../lib/psci/psci_private.h" -#define STUB() ERROR("stub %s called\n", __func__) - uintptr_t k3_sec_entrypoint; static void k3_cpu_standby(plat_local_state_t cpu_state) From 6475237412f685b5515555a0afae83b47241c3c8 Mon Sep 17 00:00:00 2001 From: "Andrew F. Davis" Date: Thu, 25 Apr 2019 13:52:54 -0400 Subject: [PATCH 2/4] ti: k3: common: Fix RO data area size calculation The size of the RO data area was calculated by subtracting the area end address from itself and not the base address due to a typo. Fix this here. Note, this was noticed at a glance thanks to the new aligned formating of this table. Signed-off-by: Andrew F. Davis Change-Id: I994022ac9fc95dc5e37a420714da76081c61cce7 --- plat/ti/k3/common/k3_bl31_setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plat/ti/k3/common/k3_bl31_setup.c b/plat/ti/k3/common/k3_bl31_setup.c index b4ec37458..b3843a4d3 100644 --- a/plat/ti/k3/common/k3_bl31_setup.c +++ b/plat/ti/k3/common/k3_bl31_setup.c @@ -101,7 +101,7 @@ void bl31_plat_arch_setup(void) const mmap_region_t bl_regions[] = { MAP_REGION_FLAT(BL31_START, BL31_END - BL31_START, MT_MEMORY | MT_RW | MT_SECURE), MAP_REGION_FLAT(BL_CODE_BASE, BL_CODE_END - BL_CODE_BASE, MT_CODE | MT_RO | MT_SECURE), - MAP_REGION_FLAT(BL_RO_DATA_BASE, BL_RO_DATA_END - BL_RO_DATA_END, MT_RO_DATA | MT_RO | MT_SECURE), + MAP_REGION_FLAT(BL_RO_DATA_BASE, BL_RO_DATA_END - BL_RO_DATA_BASE, MT_RO_DATA | MT_RO | MT_SECURE), { /* sentinel */ } }; From ebfb0709d8bb3f3da3f8b46e70fb9503e66133e3 Mon Sep 17 00:00:00 2001 From: "Andrew F. Davis" Date: Thu, 25 Apr 2019 13:54:09 -0400 Subject: [PATCH 3/4] ti: k3: common: Allow USE_COHERENT_MEM for K3 To make the USE_COHERENT_MEM option work we need to add an entry for the area to our memory map table. Also fixup the alignment here. Signed-off-by: Andrew F. Davis Change-Id: I1c05477a97646ac73846a711bc38d3746628d847 --- plat/ti/k3/common/k3_bl31_setup.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plat/ti/k3/common/k3_bl31_setup.c b/plat/ti/k3/common/k3_bl31_setup.c index b3843a4d3..8bd736292 100644 --- a/plat/ti/k3/common/k3_bl31_setup.c +++ b/plat/ti/k3/common/k3_bl31_setup.c @@ -99,9 +99,12 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1, void bl31_plat_arch_setup(void) { const mmap_region_t bl_regions[] = { - MAP_REGION_FLAT(BL31_START, BL31_END - BL31_START, MT_MEMORY | MT_RW | MT_SECURE), - MAP_REGION_FLAT(BL_CODE_BASE, BL_CODE_END - BL_CODE_BASE, MT_CODE | MT_RO | MT_SECURE), - MAP_REGION_FLAT(BL_RO_DATA_BASE, BL_RO_DATA_END - BL_RO_DATA_BASE, MT_RO_DATA | MT_RO | MT_SECURE), + MAP_REGION_FLAT(BL31_START, BL31_END - BL31_START, MT_MEMORY | MT_RW | MT_SECURE), + MAP_REGION_FLAT(BL_CODE_BASE, BL_CODE_END - BL_CODE_BASE, MT_CODE | MT_RO | MT_SECURE), + MAP_REGION_FLAT(BL_RO_DATA_BASE, BL_RO_DATA_END - BL_RO_DATA_BASE, MT_RO_DATA | MT_RO | MT_SECURE), +#if USE_COHERENT_MEM + MAP_REGION_FLAT(BL_COHERENT_RAM_BASE, BL_COHERENT_RAM_END - BL_COHERENT_RAM_BASE, MT_DEVICE | MT_RW | MT_SECURE), +#endif { /* sentinel */ } }; From ff180993af519c2a7063c37ed12975c287c8c8e8 Mon Sep 17 00:00:00 2001 From: "Andrew F. Davis" Date: Thu, 25 Apr 2019 13:57:02 -0400 Subject: [PATCH 4/4] ti: k3: common: Mark sections for AM65x coherency workaround These sections of code are only needed for the coherency workaround used for AM65x, if this workaround is not needed then this code is not either. Mark it off to keep it separated from the rest of the PSCI implementation. Signed-off-by: Andrew F. Davis Change-Id: I113ca6a2a1f7881814ab0a64e5bac57139bc03ef --- plat/ti/k3/common/k3_psci.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plat/ti/k3/common/k3_psci.c b/plat/ti/k3/common/k3_psci.c index cd42e7a0a..c7754e994 100644 --- a/plat/ti/k3/common/k3_psci.c +++ b/plat/ti/k3/common/k3_psci.c @@ -17,8 +17,10 @@ #include #include +#ifdef TI_AM65X_WORKAROUND /* Need to flush psci internal locks before shutdown or their values are lost */ #include "../../../../lib/psci/psci_private.h" +#endif uintptr_t k3_sec_entrypoint; @@ -113,6 +115,7 @@ void k3_pwr_domain_on_finish(const psci_power_state_t *target_state) k3_gic_cpuif_enable(); } +#ifdef TI_AM65X_WORKAROUND static void __dead2 k3_pwr_domain_pwr_down_wfi(const psci_power_state_t *target_state) { @@ -120,6 +123,7 @@ static void __dead2 k3_pwr_domain_pwr_down_wfi(const psci_power_state_t flush_dcache_range((uintptr_t) psci_locks, sizeof(psci_locks)); psci_power_down_wfi(); } +#endif static void __dead2 k3_system_reset(void) { @@ -150,7 +154,9 @@ static const plat_psci_ops_t k3_plat_psci_ops = { .pwr_domain_on = k3_pwr_domain_on, .pwr_domain_off = k3_pwr_domain_off, .pwr_domain_on_finish = k3_pwr_domain_on_finish, +#ifdef TI_AM65X_WORKAROUND .pwr_domain_pwr_down_wfi = k3_pwr_domain_pwr_down_wfi, +#endif .system_reset = k3_system_reset, .validate_power_state = k3_validate_power_state, .validate_ns_entrypoint = k3_validate_ns_entrypoint