Commit d55b8f6a authored by Kalyani Chidambaram's avatar Kalyani Chidambaram Committed by Varun Wadekar
Browse files

Tegra194: enable dual execution for EL2 and EL3



This patch enables dual execution optimized translations for EL2 and EL3
CPU exception levels.

Change-Id: I28fe98bb05687400f247e94adf44a1f3a85c38b1
Signed-off-by: default avatarVarun Wadekar <vwadekar@nvidia.com>
parent 3bab03eb
...@@ -34,6 +34,11 @@ ...@@ -34,6 +34,11 @@
#define DENVER_CPU_PMSTATE_C7 U(0x7) #define DENVER_CPU_PMSTATE_C7 U(0x7)
#define DENVER_CPU_PMSTATE_MASK U(0xF) #define DENVER_CPU_PMSTATE_MASK U(0xF)
/* ACTRL_ELx bits to enable dual execution*/
#define DENVER_CPU_ENABLE_DUAL_EXEC_EL2 (ULL(1) << 9)
#define DENVER_CPU_ENABLE_DUAL_EXEC_EL3 (ULL(1) << 9)
#define DENVER_CPU_ENABLE_DUAL_EXEC_EL1 (U(1) << 4)
#ifndef __ASSEMBLER__ #ifndef __ASSEMBLER__
/* Disable Dynamic Code Optimisation */ /* Disable Dynamic Code Optimisation */
......
...@@ -47,6 +47,8 @@ typedef struct plat_params_from_bl2 { ...@@ -47,6 +47,8 @@ typedef struct plat_params_from_bl2 {
uint64_t sc7entry_fw_size; uint64_t sc7entry_fw_size;
/* System Suspend Entry Firmware base address */ /* System Suspend Entry Firmware base address */
uint64_t sc7entry_fw_base; uint64_t sc7entry_fw_base;
/* Enable dual execution */
uint8_t enable_ccplex_lock_step;
} plat_params_from_bl2_t; } plat_params_from_bl2_t;
/******************************************************************************* /*******************************************************************************
......
...@@ -368,7 +368,11 @@ int32_t tegra_soc_pwr_domain_on(u_register_t mpidr) ...@@ -368,7 +368,11 @@ int32_t tegra_soc_pwr_domain_on(u_register_t mpidr)
int32_t tegra_soc_pwr_domain_on_finish(const psci_power_state_t *target_state) int32_t tegra_soc_pwr_domain_on_finish(const psci_power_state_t *target_state)
{ {
const plat_params_from_bl2_t *params_from_bl2 = bl31_get_plat_params();
uint8_t enable_ccplex_lock_step = params_from_bl2->enable_ccplex_lock_step;
uint8_t stateid_afflvl2 = target_state->pwr_domain_state[PLAT_MAX_PWR_LVL]; uint8_t stateid_afflvl2 = target_state->pwr_domain_state[PLAT_MAX_PWR_LVL];
cpu_context_t *ctx = cm_get_context(NON_SECURE);
uint64_t actlr_elx;
/* /*
* Reset power state info for CPUs when onlining, we set * Reset power state info for CPUs when onlining, we set
...@@ -446,13 +450,23 @@ int32_t tegra_soc_pwr_domain_on_finish(const psci_power_state_t *target_state) ...@@ -446,13 +450,23 @@ int32_t tegra_soc_pwr_domain_on_finish(const psci_power_state_t *target_state)
mmio_write_32(TEGRA_XUSB_PADCTL_BASE + mmio_write_32(TEGRA_XUSB_PADCTL_BASE +
XUSB_PADCTL_DEV_AXI_STREAMID_PF_0, TEGRA_SID_XUSB_DEV); XUSB_PADCTL_DEV_AXI_STREAMID_PF_0, TEGRA_SID_XUSB_DEV);
} }
}
/* /*
* Reset power state info for the last core doing SC7 * Enable dual execution optimized translations for all ELx.
* entry and exit, we set deepest power state as CC7 */
* and SC7 for SC7 entry which may not be requested by if (enable_ccplex_lock_step != 0U) {
* non-secure SW which controls idle states. actlr_elx = read_actlr_el3();
*/ actlr_elx |= DENVER_CPU_ENABLE_DUAL_EXEC_EL3;
write_actlr_el3(actlr_elx);
actlr_elx = read_actlr_el2();
actlr_elx |= DENVER_CPU_ENABLE_DUAL_EXEC_EL2;
write_actlr_el2(actlr_elx);
actlr_elx = read_actlr_el1();
actlr_elx |= DENVER_CPU_ENABLE_DUAL_EXEC_EL1;
write_actlr_el1(actlr_elx);
} }
return PSCI_E_SUCCESS; return PSCI_E_SUCCESS;
......
...@@ -201,6 +201,10 @@ void plat_enable_console(int32_t id) ...@@ -201,6 +201,10 @@ void plat_enable_console(int32_t id)
******************************************************************************/ ******************************************************************************/
void plat_early_platform_setup(void) void plat_early_platform_setup(void)
{ {
const plat_params_from_bl2_t *params_from_bl2 = bl31_get_plat_params();
uint8_t enable_ccplex_lock_step = params_from_bl2->enable_ccplex_lock_step;
uint64_t actlr_elx;
/* sanity check MCE firmware compatibility */ /* sanity check MCE firmware compatibility */
mce_verify_firmware_version(); mce_verify_firmware_version();
...@@ -250,6 +254,23 @@ void plat_early_platform_setup(void) ...@@ -250,6 +254,23 @@ void plat_early_platform_setup(void)
mmio_write_32(TEGRA_XUSB_PADCTL_BASE + mmio_write_32(TEGRA_XUSB_PADCTL_BASE +
XUSB_PADCTL_DEV_AXI_STREAMID_PF_0, TEGRA_SID_XUSB_DEV); XUSB_PADCTL_DEV_AXI_STREAMID_PF_0, TEGRA_SID_XUSB_DEV);
} }
/*
* Enable dual execution optimized translations for all ELx.
*/
if (enable_ccplex_lock_step != 0U) {
actlr_elx = read_actlr_el3();
actlr_elx |= DENVER_CPU_ENABLE_DUAL_EXEC_EL3;
write_actlr_el3(actlr_elx);
actlr_elx = read_actlr_el2();
actlr_elx |= DENVER_CPU_ENABLE_DUAL_EXEC_EL2;
write_actlr_el2(actlr_elx);
actlr_elx = read_actlr_el1();
actlr_elx |= DENVER_CPU_ENABLE_DUAL_EXEC_EL1;
write_actlr_el1(actlr_elx);
}
} }
/* Secure IRQs for Tegra194 */ /* Secure IRQs for Tegra194 */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment