forked from OP-TEE/optee_os
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
drivers: caam: skip JR init of CFG_JR_HAB_INDEX
On iMX8M SoC, the HAB requires the JR0 to be set to secure world to decrypt the kernel image when loading the image in U-Boot. Before reaching u-boot, OP-TEE and TF-A set the JR0 to the non-secure domain that leads to a HAB failure when trying to decrypt the kernel. To fix the issue, this commit introduces CFG_JR_HAB_INDEX that specifies which JR the HAB uses. OPTEE will skip the initialization of CFG_JR_HAB_INDEX and leave it as secure. It will also disable its usage in the device tree to inform the kernel. Signed-off-by: Clement Faure <[email protected]> Signed-off-by: Franck LENORMAND <[email protected]> Signed-off-by: Sahil Malhotra <[email protected]> Acked-by: Jens Wiklander <[email protected]>
- Loading branch information
1 parent
2e48051
commit 75be62a
Showing
4 changed files
with
64 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// SPDX-License-Identifier: BSD-2-Clause | ||
/* | ||
* Copyright 2024 NXP | ||
* | ||
* Brief CAAM Configuration. | ||
*/ | ||
#include <caam_hal_cfg.h> | ||
#include <caam_hal_jr.h> | ||
#include <kernel/dt.h> | ||
#include <registers/jr_regs.h> | ||
|
||
void caam_hal_cfg_hab_jr_mgmt(struct caam_jrcfg *jrcfg) | ||
{ | ||
void *fdt = NULL; | ||
struct caam_jrcfg tmp_jrcfg = { | ||
.offset = (CFG_JR_HAB_INDEX + 1) * JRX_BLOCK_SIZE, | ||
}; | ||
|
||
fdt = get_dt(); | ||
if (fdt) { | ||
/* Ensure Secure Job Ring is secure only into DTB */ | ||
caam_hal_cfg_disable_jobring_dt(fdt, &tmp_jrcfg); | ||
} | ||
|
||
caam_hal_jr_prepare_backup(jrcfg->base, tmp_jrcfg.offset); | ||
} | ||
|
||
bool caam_hal_cfg_is_hab_jr(paddr_t jr_offset) | ||
{ | ||
unsigned int jr_idx = JRX_IDX(jr_offset); | ||
|
||
return jr_idx == CFG_JR_HAB_INDEX; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ incdirs-y += . | |
srcs-y += hal_clk.c | ||
srcs-y += hal_ctrl.c | ||
srcs-y += hal_jr.c | ||
srcs-y += hal_cfg.c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters