tests: intel_adsp: Add vecbase lock test

Add a test to check if vecbase register was properly locked.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
Flavio Ceolin 2023-03-28 10:50:43 -07:00 committed by Carles Cufí
parent ca527d9f12
commit 7b209eee0a
1 changed files with 24 additions and 0 deletions

View File

@ -42,6 +42,30 @@ ZTEST(intel_adsp, test_clock_calibrate)
zassert_true((hz / MIN(1, diff)) > 100, "clock rate wrong");
}
#if XCHAL_HAVE_VECBASE
ZTEST(intel_adsp, test_vecbase_lock)
{
uintptr_t vecbase;
/* Unfortunately there is not symbol to check if the target
* supports locking VECBASE. The best we can do is checking if
* the first is not set and skip the test.
*/
__asm__ volatile("rsr.vecbase %0" : "=r"(vecbase));
if ((vecbase & 0x1) == 0) {
ztest_test_skip();
}
/* VECBASE register should have been locked during the cpu
* start up. Trying to change its location should fail.
*/
__asm__ volatile("wsr.vecbase %0; rsync" : : "r"(0x0));
__asm__ volatile("rsr.vecbase %0" : "=r"(vecbase));
zassert_not_equal(vecbase, 0x0, "VECBASE was changed");
}
#endif
static void *intel_adsp_setup(void)
{
struct intel_adsp_ipc_data *devdata = INTEL_ADSP_IPC_HOST_DEV->data;