diff mbox

[U-Boot,v1,2/4] virt-dt: Allow reservation of the secure region when it is in a RAM carveout.

Message ID 1421178360-23778-2-git-send-email-ijc@hellion.org.uk
State Superseded
Delegated to: Tom Warren
Headers show

Commit Message

Ian Campbell Jan. 13, 2015, 7:45 p.m. UTC
In this case the secure code lives in RAM, and hence needs to be reserved, but
it has been relocated, so the reservation of __secure_start does not apply.

Add support for setting CONFIG_ARMV7_SECURE_RESERVE_SIZE to reserve such a
region.

This will be used in a subsequent patch for Jetson-TK1

Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
---
 arch/arm/cpu/armv7/virt-dt.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Stephen Warren Jan. 15, 2015, 11:49 p.m. UTC | #1
On 01/13/2015 12:45 PM, Ian Campbell wrote:
> In this case the secure code lives in RAM, and hence needs to be reserved, but
> it has been relocated, so the reservation of __secure_start does not apply.
>
> Add support for setting CONFIG_ARMV7_SECURE_RESERVE_SIZE to reserve such a
> region.
>
> This will be used in a subsequent patch for Jetson-TK1

It's rather hard to review this without any documentation in the README, 
of the new symbol, or any of the existing:

CONFIG_ARMV7_NONSEC
CONFIG_ARMV7_VIRT
CONFIG_ARMV7_PSCI

It'd be nice to have a description of what those do exactly, and how 
they interact or conflict.
Ian Campbell Jan. 16, 2015, 9:33 a.m. UTC | #2
On Thu, 2015-01-15 at 16:49 -0700, Stephen Warren wrote:
> On 01/13/2015 12:45 PM, Ian Campbell wrote:
> > In this case the secure code lives in RAM, and hence needs to be reserved, but
> > it has been relocated, so the reservation of __secure_start does not apply.
> >
> > Add support for setting CONFIG_ARMV7_SECURE_RESERVE_SIZE to reserve such a
> > region.
> >
> > This will be used in a subsequent patch for Jetson-TK1
> 
> It's rather hard to review this without any documentation in the README, 
> of the new symbol, or any of the existing:
> 
> CONFIG_ARMV7_NONSEC
> CONFIG_ARMV7_VIRT
> CONFIG_ARMV7_PSCI
> 
> It'd be nice to have a description of what those do exactly, and how 
> they interact or conflict.

Ack, I'll see what I can do about the existing ones too.

Ian.
Ian Campbell Jan. 18, 2015, 6:06 p.m. UTC | #3
On Thu, 2015-01-15 at 16:49 -0700, Stephen Warren wrote:
> On 01/13/2015 12:45 PM, Ian Campbell wrote:
> > In this case the secure code lives in RAM, and hence needs to be reserved, but
> > it has been relocated, so the reservation of __secure_start does not apply.
> >
> > Add support for setting CONFIG_ARMV7_SECURE_RESERVE_SIZE to reserve such a
> > region.
> >
> > This will be used in a subsequent patch for Jetson-TK1
> 
> It's rather hard to review this without any documentation in the README, 
> of the new symbol, or any of the existing:
> 
> CONFIG_ARMV7_NONSEC
> CONFIG_ARMV7_VIRT
> CONFIG_ARMV7_PSCI
> 
> It'd be nice to have a description of what those do exactly, and how 
> they interact or conflict.

Anyone got any opinions in the new Kconfig-world regarding whether it is
more or less appropriate to use the help section of the Kconfig file vs.
the README file?

...and only now do I notice that the first two of the three options
mentioned above are already documented in the Kconfig and the third
(PSCI) isn't a Kconfig option (yet?) so there's no ambiguity about where
it should be put.

I also just noticed that the README says "Later we will add a
configuration tool - probably similar to or even identical to what's
used for the Linux kernel".

Ian.
diff mbox

Patch

diff --git a/arch/arm/cpu/armv7/virt-dt.c b/arch/arm/cpu/armv7/virt-dt.c
index ad19e4c..eb95031 100644
--- a/arch/arm/cpu/armv7/virt-dt.c
+++ b/arch/arm/cpu/armv7/virt-dt.c
@@ -96,6 +96,11 @@  int armv7_update_dt(void *fdt)
 	/* secure code lives in RAM, keep it alive */
 	fdt_add_mem_rsv(fdt, (unsigned long)__secure_start,
 			__secure_end - __secure_start);
+#elif defined(CONFIG_ARMV7_SECURE_RESERVE_SIZE)
+	/* secure code has been relocated into RAM carveout, keep it alive */
+	fdt_add_mem_rsv(fdt,
+			CONFIG_ARMV7_SECURE_BASE,
+			CONFIG_ARMV7_SECURE_RESERVE_SIZE);
 #endif
 
 	return fdt_psci(fdt);