-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add driver probing also for external device tree use #5604
Add driver probing also for external device tree use #5604
Conversation
This is split from PR #5350 as we could not re-open that. Also decided to split the commits to own PRs. |
return TEE_SUCCESS; | ||
|
||
fdt = get_embedded_dt(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May I ask a question?
In some case, fdt will be "external_dt.blob",but in old codes that fdt will be NULL;
For example: if get_embedded_dt() return NULL, get_dt() maybe return "external_dt.blob".
I don’t' know what the impact will be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this is addressed in @etienne-lms's proposal.
There is slight logical change still.
Previously if embedded device tree usage was enabled but it was not actually present then there would be assertion failure. Now this continues the boot (and may fail later on).
I would leave this to firmware integrator to make sure that they have configured things properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this change, I think we should have a helper function like this, to ensure the DTB used to configure OP-TEE is secure:
void *get_secure_dt(void)
{
void *fdt = get_embedded_dt();
if (!fdt && IS_ENABLED(CFG_MAP_EXT_DT_SECURE))
fdt = get_external_dt();
return fdt;
}
I can give this approach a spin. |
fc3f70a
to
8a61d8d
Compare
I have made updates based on comments. Please check it out and see if it matches your ideas. |
Verified that one of my devices boots with |
Will update commit subjects "kernel: " -> "core: " on next update round. |
I have also similar change for clocks: commit e78479b3b2e9cf52382e6cd5c339276cf3ed3bc1
Author: Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com>
Date: Tue Feb 8 17:41:34 2022 +0200
drivers: clk_dt: Switch to use get_secure_dt()
This adds support for both embedded and external secure device trees so
that clock driver and system configuration information can be fetched from
there.
Signed-off-by: Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com>
diff --git a/core/drivers/clk/clk_dt.c b/core/drivers/clk/clk_dt.c
index e90abf638..ff91902c5 100644
--- a/core/drivers/clk/clk_dt.c
+++ b/core/drivers/clk/clk_dt.c
@@ -197,7 +197,7 @@ static void clk_probe_assigned(const void *fdt, int parent_node)
static TEE_Result clk_dt_probe(void)
{
- const void *fdt = get_embedded_dt();
+ const void *fdt = get_secure_dt();
DMSG("Probing clocks from devicetree");
if (!fdt) Should I include this here as additional commit? |
8a61d8d
to
e281ddd
Compare
Added it here. Can drop if you think it is better with other clock changes for zynq7k. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
for the 3 patches.
I think dtb_get_sdp_region()
could use get_secure_dt()
.
Add new helper to query device tree considered secure for device driver usage. First priority is given to embedded device tree if present. If system is configured with secure external device tree location then external device tree is returned. Signed-off-by: Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
When secure external device tree is configured for use OP-TEE's drivers should be loaded based on its definitions. Add support to probe drivers also with secure external device tree. This allows common system device tree to be used to define devices for bootloaders and OP-TEE. In any case if embedded device tree is defined this will take precedense. Signed-off-by: Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
This adds support for both embedded and external secure device trees so that clock driver and system configuration information can be fetched from there. Signed-off-by: Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
e281ddd
to
e1aa9de
Compare
Thanks for the review. Applied tags. About other changes. $ git grep get_embedded_dt
core/arch/arm/kernel/boot.c: void *fdt = get_embedded_dt();
core/arch/arm/kernel/boot.c:void *get_embedded_dt(void)
core/arch/arm/kernel/boot.c:void *get_embedded_dt(void)
core/arch/arm/plat-ls/main.c: void *fdt = get_embedded_dt();
core/arch/arm/plat-sam/freq.c: const void *fdt = get_embedded_dt();
core/arch/arm/plat-stm32mp1/drivers/stm32mp1_pmic.c: void *fdt = get_embedded_dt();
core/arch/arm/plat-stm32mp1/drivers/stm32mp1_pmic.c: fdt = get_embedded_dt();
core/arch/arm/plat-stm32mp1/drivers/stm32mp1_pmic.c: fdt = get_embedded_dt();
core/arch/arm/plat-stm32mp1/drivers/stm32mp1_pmic.c: fdt = get_embedded_dt();
core/arch/arm/plat-stm32mp1/main.c: fdt = get_embedded_dt();
core/arch/arm/plat-stm32mp1/shared_resources.c: void *fdt = get_embedded_dt();
core/drivers/atmel_saic.c: const void *fdt = get_embedded_dt();
core/drivers/clk/clk_dt.c: const void *fdt = get_embedded_dt();
core/drivers/crypto/se050/glue/i2c_stm32.c: fdt = get_embedded_dt();
core/drivers/ls_gpio.c: fdt = get_embedded_dt();
core/drivers/ls_i2c.c: fdt = get_embedded_dt();
core/drivers/ls_sec_mon.c: fdt = get_embedded_dt();
core/drivers/stm32_bsec.c: fdt = get_embedded_dt();
core/drivers/stm32_etzpc.c: void *fdt = get_embedded_dt();
core/drivers/stm32_rng.c: fdt = get_embedded_dt();
core/include/kernel/boot.h:void *get_embedded_dt(void);
core/include/kernel/boot.h: return fdt && fdt == get_embedded_dt();
core/kernel/dt_driver.c: fdt = get_embedded_dt();
core/kernel/dt_driver.c: fdt = get_embedded_dt();
core/kernel/dt_driver.c: fdt = get_embedded_dt();
core/mm/core_mmu.c: fdt = get_embedded_dt();
$ git grep "get_dt()"
core/drivers/crypto/caam/hal/common/hal_cfg.c: fdt = get_dt();
core/drivers/imx/dcp/dcp.c: fdt = get_dt();
core/drivers/imx_i2c.c: void *fdt = get_dt();
core/drivers/imx_rngb.c: void *fdt = get_dt();
core/drivers/imx_wdog.c: fdt = get_dt();
core/drivers/ls_dspi.c: fdt = get_dt();
core/kernel/console.c: fdt = get_dt(); There are plenty of places where About I can of course to dummy modifications for all wanted parts but I cannot test most of them. |
I'm fine with the 3 changes as is.
I looked at the generic place. You covered them, but the SDP part.
Fair enough, let's not addressed it here. |
When secure external device tree is configured for use OP-TEE's drivers
should be loaded based on its definitions. Add support to probe drivers
also with secure external device tree.
This allows common system device tree to be used to define devices for
bootloaders and OP-TEE.
In any case if embedded device tree is defined this will take precedense.
Signed-off-by: Vesa Jääskeläinen vesa.jaaskelainen@vaisala.com