TrustZone example on i.MX6

Adam Lackorzynski adam at
Thu Jan 8 23:42:01 CET 2015

On Mon Jan 05, 2015 at 16:30:42 +0200, Markku Ahvenjärvi wrote:
> On 05.01.2015 01:22, Adam Lackorzynski wrote:
> >On Tue Dec 23, 2014 at 15:39:09 +0200, Markku Ahvenjärvi wrote:
> >>I'm trying to run Fiasco.OC in secure world and Linux in non-secure world on
> >>i.MX6Q. For this I'm using the TrustZone example (pkg/examples/sys/vm-tz).
> >>To secure world I have given 128MB RAM starting from 0x10000000 and I
> >>modified the example to give NS world 256MB starting from 0x20000000. I've
> >>replaced atags with dtb of my board and it is copied to NS side like kernel
> >>and initrd.
> >>
> >>At first I encountered runtime exception, which I fixed by implementing
> >>following to arm_em_tz builds
> >>Thread::arch_ext_vcpu_enabled() { return true; }
> >>
> >>Now I'm having problems at early stages of NS boot, where Linux kernel is
> >>checking for the dtb magic. The code loads the dtb magic from the address
> >>I'm giving in r2 register (0x21000000), but the magic value usually have one
> >>byte or all of them incorrect.
> >>
> >>I've used JDB to dump the area of dtb after hitting that error and it shows
> >>the dtb magic properly. So for some reason the NS-world gets mangled value.
> >>Any idea what might be causing this?
> >Sounds like a caching issue.
> >
> >
> >
> >Adam
> Yes, I was assuming that it is caching issue. The copyblob-function in the
> example cleans cache by calling l4_cache_clean_data, so the data should be
> in RAM.
> Linux kernel expects D-cache and MMU to be disabled on boot up, how is it
> done in TrustZone? By initializing banked cp15 registers?
> Can you point where these are done? I'm using 20140928 snapshot.

I'm not sure I'm getting the question right. Do you mean the non-secure
or the secure side? Anyway, yes, cp15 is used independently of the side.
It should not be switched on on the ns side initially, right?

Adam                 adam at

More information about the l4-hackers mailing list