Commit 5ce05d6b authored by Anthony Zhou's avatar Anthony Zhou Committed by Varun Wadekar
Browse files

Tegra194: add strict checking mode verification



After enabling the strict checking mode, verify that
the strict mode has really been enabled by querying
the MCE.

If the mode is found to be disabled, the code should
assert.

Change-Id: I113ec8decb737f8208059a2a3ba3076fad77890e
Signed-off-by: default avatarAnthony Zhou <anzhou@nvidia.com>
parent 7e491133
...@@ -56,6 +56,7 @@ int32_t nvg_update_ccplex_gsc(uint32_t gsc_idx); ...@@ -56,6 +56,7 @@ int32_t nvg_update_ccplex_gsc(uint32_t gsc_idx);
int32_t nvg_enter_cstate(uint32_t state, uint32_t wake_time); int32_t nvg_enter_cstate(uint32_t state, uint32_t wake_time);
int32_t nvg_roc_clean_cache_trbits(void); int32_t nvg_roc_clean_cache_trbits(void);
void nvg_enable_strict_checking_mode(void); void nvg_enable_strict_checking_mode(void);
void nvg_verify_strict_checking_mode(void);
void nvg_system_shutdown(void); void nvg_system_shutdown(void);
void nvg_system_reboot(void); void nvg_system_reboot(void);
void nvg_clear_hsm_corr_status(void); void nvg_clear_hsm_corr_status(void);
...@@ -70,6 +71,7 @@ uint64_t nvg_cache_inval_all(void); ...@@ -70,6 +71,7 @@ uint64_t nvg_cache_inval_all(void);
/* MCE helper functions */ /* MCE helper functions */
void mce_enable_strict_checking(void); void mce_enable_strict_checking(void);
void mce_verify_strict_checking(void);
void mce_system_shutdown(void); void mce_system_shutdown(void);
void mce_system_reboot(void); void mce_system_reboot(void);
void mce_clear_hsm_corr_status(void); void mce_clear_hsm_corr_status(void);
......
...@@ -217,6 +217,15 @@ void mce_enable_strict_checking(void) ...@@ -217,6 +217,15 @@ void mce_enable_strict_checking(void)
nvg_enable_strict_checking_mode(); nvg_enable_strict_checking_mode();
} }
} }
void mce_verify_strict_checking(void)
{
bool is_silicon = tegra_platform_is_silicon();
bool is_fpga = tegra_platform_is_fpga();
if (is_silicon || is_fpga) {
nvg_verify_strict_checking_mode();
}
}
#endif #endif
/******************************************************************************* /*******************************************************************************
......
...@@ -4,12 +4,15 @@ ...@@ -4,12 +4,15 @@
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
#include <assert.h>
#include <errno.h>
#include <arch.h> #include <arch.h>
#include <arch_helpers.h> #include <arch_helpers.h>
#include <common/debug.h> #include <common/debug.h>
#include <denver.h> #include <denver.h>
#include <errno.h>
#include <lib/mmio.h> #include <lib/mmio.h>
#include <mce_private.h> #include <mce_private.h>
#include <platform_def.h> #include <platform_def.h>
#include <t194_nvg.h> #include <t194_nvg.h>
...@@ -211,6 +214,15 @@ void nvg_enable_strict_checking_mode(void) ...@@ -211,6 +214,15 @@ void nvg_enable_strict_checking_mode(void)
nvg_set_request_data((uint64_t)TEGRA_NVG_CHANNEL_SECURITY_CONFIG, params); nvg_set_request_data((uint64_t)TEGRA_NVG_CHANNEL_SECURITY_CONFIG, params);
} }
void nvg_verify_strict_checking_mode(void)
{
uint64_t params = (uint64_t)(STRICT_CHECKING_ENABLED_SET |
STRICT_CHECKING_LOCKED_SET);
nvg_set_request((uint64_t)TEGRA_NVG_CHANNEL_SECURITY_CONFIG);
assert(params == (uint64_t)nvg_get_result());
}
#endif #endif
/* /*
......
...@@ -406,6 +406,7 @@ void plat_late_platform_setup(void) ...@@ -406,6 +406,7 @@ void plat_late_platform_setup(void)
* enabling TZSRAM and TZDRAM * enabling TZSRAM and TZDRAM
*/ */
mce_enable_strict_checking(); mce_enable_strict_checking();
mce_verify_strict_checking();
#endif #endif
} }
......
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