From 03af25bc9b66ef51ec4c23c77b312391cfd52bbb Mon Sep 17 00:00:00 2001 From: Varun Wadekar Date: Wed, 26 Apr 2017 13:46:11 -0700 Subject: [PATCH 1/4] Tegra: group platform settings together This patch groups all the platform configuration macros into the common platform.mk makefile. Signed-off-by: Varun Wadekar --- plat/nvidia/tegra/common/tegra_common.mk | 13 ------------- plat/nvidia/tegra/platform.mk | 22 ++++++++++++++++++++-- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/plat/nvidia/tegra/common/tegra_common.mk b/plat/nvidia/tegra/common/tegra_common.mk index e8e25ef0a4..cb4d188630 100644 --- a/plat/nvidia/tegra/common/tegra_common.mk +++ b/plat/nvidia/tegra/common/tegra_common.mk @@ -28,19 +28,6 @@ # POSSIBILITY OF SUCH DAMAGE. # -CRASH_REPORTING := 1 -$(eval $(call add_define,CRASH_REPORTING)) - -ASM_ASSERTION := 1 -$(eval $(call add_define,ASM_ASSERTION)) - -USE_COHERENT_MEM := 0 - -SEPARATE_CODE_AND_RODATA := 1 - -PLAT_XLAT_TABLES_DYNAMIC := 1 -$(eval $(call add_define,PLAT_XLAT_TABLES_DYNAMIC)) - PLAT_INCLUDES := -Iplat/nvidia/tegra/include/drivers \ -Iplat/nvidia/tegra/include \ -Iplat/nvidia/tegra/include/${TARGET_SOC} diff --git a/plat/nvidia/tegra/platform.mk b/plat/nvidia/tegra/platform.mk index 2eeffca74c..5f7e8c8f64 100644 --- a/plat/nvidia/tegra/platform.mk +++ b/plat/nvidia/tegra/platform.mk @@ -30,12 +30,30 @@ SOC_DIR := plat/nvidia/tegra/soc/${TARGET_SOC} -# Enable PSCI v1.0 extended state ID format -PSCI_EXTENDED_STATE_ID := 1 +# enable ASM_ASSERTION for the build +ASM_ASSERTION := 1 +$(eval $(call add_define,ASM_ASSERTION)) + +# dump the state on crash console +CRASH_REPORTING := 1 +$(eval $(call add_define,CRASH_REPORTING)) # Disable the PSCI platform compatibility layer ENABLE_PLAT_COMPAT := 0 +# enable dynamic memory mapping +PLAT_XLAT_TABLES_DYNAMIC := 1 +$(eval $(call add_define,PLAT_XLAT_TABLES_DYNAMIC)) + +# Enable PSCI v1.0 extended state ID format +PSCI_EXTENDED_STATE_ID := 1 + +# code and read-only data should be put on separate memory pages +SEPARATE_CODE_AND_RODATA := 1 + +# do not use coherent memory +USE_COHERENT_MEM := 0 + include plat/nvidia/tegra/common/tegra_common.mk include ${SOC_DIR}/platform_${TARGET_SOC}.mk From 6c16918f7d511d972e32eefd2b442aa5ec6e0f86 Mon Sep 17 00:00:00 2001 From: Varun Wadekar Date: Wed, 26 Apr 2017 13:48:19 -0700 Subject: [PATCH 2/4] Tegra: enable 'ENABLE_ASSERTIONS' for all builds This patch changes the platform Makefile to set `ENABLE_ASSERTIONS` to 1 instead of the deprecated option `ASM_ASSERTION`. This also pulls in C assertions in release mode. Signed-off-by: Varun Wadekar --- plat/nvidia/tegra/platform.mk | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/plat/nvidia/tegra/platform.mk b/plat/nvidia/tegra/platform.mk index 5f7e8c8f64..1f7a4dcdd4 100644 --- a/plat/nvidia/tegra/platform.mk +++ b/plat/nvidia/tegra/platform.mk @@ -30,14 +30,13 @@ SOC_DIR := plat/nvidia/tegra/soc/${TARGET_SOC} -# enable ASM_ASSERTION for the build -ASM_ASSERTION := 1 -$(eval $(call add_define,ASM_ASSERTION)) - # dump the state on crash console CRASH_REPORTING := 1 $(eval $(call add_define,CRASH_REPORTING)) +# enable assert() for release/debug builds +ENABLE_ASSERTIONS := 1 + # Disable the PSCI platform compatibility layer ENABLE_PLAT_COMPAT := 0 From cd3b7eb46a59cf2c3ad60fd34359fd87fdefadee Mon Sep 17 00:00:00 2001 From: Varun Wadekar Date: Wed, 26 Apr 2017 13:49:52 -0700 Subject: [PATCH 3/4] Tegra: smmu: enable asserts by default This patch enables the assert in the context save routine by default, for all flavours of the build. Signed-off-by: Varun Wadekar --- plat/nvidia/tegra/common/drivers/smmu/smmu.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/plat/nvidia/tegra/common/drivers/smmu/smmu.c b/plat/nvidia/tegra/common/drivers/smmu/smmu.c index a985532ceb..60fd300676 100644 --- a/plat/nvidia/tegra/common/drivers/smmu/smmu.c +++ b/plat/nvidia/tegra/common/drivers/smmu/smmu.c @@ -89,7 +89,6 @@ void tegra_smmu_save_context(uint64_t smmu_ctx_addr) { uint32_t i, num_entries = 0; smmu_regs_t *smmu_ctx_regs; -#if DEBUG plat_params_from_bl2_t *params_from_bl2 = bl31_get_plat_params(); uint64_t tzdram_base = params_from_bl2->tzdram_base; uint64_t tzdram_end = tzdram_base + params_from_bl2->tzdram_size; @@ -102,8 +101,6 @@ void tegra_smmu_save_context(uint64_t smmu_ctx_addr) (1 << (((reg_id1 >> ID1_NUMPAGENDXB_SHIFT) & ID1_NUMPAGENDXB_MASK) + 1)); assert(!((pgshift != PGSHIFT) || (cb_size != CB_SIZE))); -#endif - assert((smmu_ctx_addr >= tzdram_base) && (smmu_ctx_addr <= tzdram_end)); /* get SMMU context table */ From bf097cac40ca1c5aec613766b729a51f01994093 Mon Sep 17 00:00:00 2001 From: Antonio Nino Diaz Date: Tue, 28 Mar 2017 13:56:21 +0100 Subject: [PATCH 4/4] Tegra: Control inclusion of helper code used for asserts One assert depends on code that is conditionally compiled based on the DEBUG define. This patch modifies the conditional inclusion of such code so that it is based on the ENABLE_ASSERTIONS build option. Change-Id: Ic5659a3db8632593b9d2e83dac6d30afd87c131d Signed-off-by: Antonio Nino Diaz Signed-off-by: Varun Wadekar --- plat/nvidia/tegra/soc/t132/plat_psci_handlers.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plat/nvidia/tegra/soc/t132/plat_psci_handlers.c b/plat/nvidia/tegra/soc/t132/plat_psci_handlers.c index f05f3d0e9f..af21c2869a 100644 --- a/plat/nvidia/tegra/soc/t132/plat_psci_handlers.c +++ b/plat/nvidia/tegra/soc/t132/plat_psci_handlers.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -132,7 +132,7 @@ int tegra_soc_pwr_domain_off(const psci_power_state_t *target_state) int tegra_soc_pwr_domain_suspend(const psci_power_state_t *target_state) { -#if DEBUG +#if ENABLE_ASSERTIONS int cpu = read_mpidr() & MPIDR_CPU_MASK; /* SYSTEM_SUSPEND only on CPU0 */