lib: utils: fdt_domain: Use consistent device-tree address when next-arg1 is missing
PATCH v2 1/1 lib: utils: fdt_domain: Use consistent device-tree address when next-arg1 is missing
The diagram shown below illustrates the boot-flow involving OP-TEE OS initialization.
(1)-----------+
| U-Boot SPL |
+------------+
|
v
(2)-------------------------------------------------------------+
| OpenSBI (fw_dynamic) |
| (4)------------------------+ |
| | optee dispatcher driver | |
+-----------------+-------^---------|-------+------------------+
M-mode | | |
---------+--[trusted domain]---+----.----+--[untrusted domain]-------
S-mode | (coldboot domain) | | |
v | | v
(3)---------------------------+ |(5)----------------------------+
| OP-TEE OS | | | U-Boot |
+----------------------------+ | +-----------------------------+
| |
| v
|(6)----------------------------+
| | Linux |
| +-----------------------------+As OP-TEE OS has device-tree node fixups that need to be passed through to the next boot stages, e.g. the reserved memory node:
reserved-memory {
#address-cells = <2>;
#size-cells = <2>;
ranges;
optee_core at f1000000 {
no-map;
reg = <0x0 0xf1000000 // OP-TEE OS base address
0x0 0x01000000>;
};
<...>
};Instead of using 0x0 as the default value, allow identical next-arg1 to be used by non-coldboot domain (i.e., untrusted domain) when the property is not provided.
Also, update the description of next-arg1 property in the document.
---
Changes v1 -> v2:
- Improve commit message, no functional change
--- docs/domain_support.md | 4 +--- lib/utils/fdt/fdt_domain.c | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-)
docs/domain_support.md +1 -3
@@ -180,9 +180,7 @@ The DT properties of a domain instance DT node are as follows: boot HART of the domain instance. * **next-arg1** (Optional) - The 64 bit next booting stage arg1 for the domain instance. If this DT property is not available and coldboot HART - is not assigned to the domain instance then **0x0** is used as default - value. If this DT property is not available and coldboot HART is assigned - to the domain instance then **next booting stage arg1 of coldboot HART** + is not assigned to the domain instance then **next booting stage arg1 of coldboot HART** is used as default value. * **next-addr** (Optional) - The 64 bit next booting stage address for the domain instance. If this DT property is not available and coldboot HART
lib/utils/fdt/fdt_domain.c +1 -2
@@ -395,8 +395,7 @@ static int __fdt_parse_domain(void *fdt, int domain_offset, void *opaque) val64 =fdt32_to_cpu (val[0 ]); val64 = (val64 <<32 ) |fdt32_to_cpu (val[1 ]); }else { -if (domain_offset == *cold_domain_offset) - val64 =sbi_scratch_thishart_ptr ()->next_arg1; + val64 =sbi_scratch_thishart_ptr ()->next_arg1; } dom->next_arg1 = val64;
Signature · 1 line
2.45.2
Anup Patel
AppliedPATCH v2 1/1 lib: utils: fdt_domain: Use consistent device-tree address when next-arg1 is missing
Quoted 46 lines · On Wed, Jul 24, 2024 at 8:31?PM Yu Chien Peter Lin <[email protected]>…
The diagram shown below illustrates the boot-flow involving OP-TEE OS initialization.
(1)-----------+ | U-Boot SPL | +------------+ | v (2)-------------------------------------------------------------+ | OpenSBI (fw_dynamic) | | (4)------------------------+ | | | optee dispatcher driver | | +-----------------+-------^---------|-------+------------------+ M-mode | | | ---------+--[trusted domain]---+----.----+--[untrusted domain]------- S-mode | (coldboot domain) | | | v | | v (3)---------------------------+ |(5)----------------------------+ | OP-TEE OS | | | U-Boot | +----------------------------+ | +-----------------------------+ | | | v |(6)----------------------------+ | | Linux | | +-----------------------------+As OP-TEE OS has device-tree node fixups that need to be passed through to the next boot stages, e.g. the reserved memory node:
reserved-memory { #address-cells = <2>; #size-cells = <2>; ranges; optee_core at f1000000 { no-map; reg = <0x0 0xf1000000 // OP-TEE OS base address 0x0 0x01000000>; }; <...> };Instead of using
0x0as the default value, allow identical next-arg1 to be used by non-coldboot domain (i.e., untrusted domain) when the property is not provided.
Quoted 5 lines
Also, update the description of next-arg1 property in the document.
Signed-off-by Yu Chien Peter Lin <[email protected]>Reviewed-by Alvin Chang <[email protected]>Reviewed-by Anup Patel <[email protected]>
Applied this patch to the riscv/opensbi repo.
Thanks,
Anup
Quoted 40 lines
---
Changes v1 -> v2:
- Improve commit message, no functional change--- docs/domain_support.md | 4 +--- lib/utils/fdt/fdt_domain.c | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-)docs/domain_support.md +1
-3@@ -180,9 +180,7 @@ The DT properties of a domain instance DT node are as follows: boot HART of the domain instance. * **next-arg1** (Optional) - The 64 bit next booting stage arg1 for the domain instance. If this DT property is not available and coldboot HART - is not assigned to the domain instance then **0x0** is used as default - value. If this DT property is not available and coldboot HART is assigned - to the domain instance then **next booting stage arg1 of coldboot HART** + is not assigned to the domain instance then **next booting stage arg1 of coldboot HART** is used as default value. * **next-addr** (Optional) - The 64 bit next booting stage address for the domain instance. If this DT property is not available and coldboot HARTlib/utils/fdt/fdt_domain.c +1
-3@@ -395,8 +395,7 @@ static int __fdt_parse_domain(void *fdt, int domain_offset, void *opaque) val64 =fdt32_to_cpu (val[0 ]); val64 = (val64 <<32 ) |fdt32_to_cpu (val[1 ]); }else { -if (domain_offset == *cold_domain_offset) - val64 =sbi_scratch_thishart_ptr ()->next_arg1; + val64 =sbi_scratch_thishart_ptr ()->next_arg1; } dom->next_arg1 = val64; --2.45.2