Increase VM memory size
Stefan Kalkowski
stefan.kalkowski at genode-labs.com
Thu Sep 27 12:56:46 CEST 2018
Hi,
it crossed my mind, if you do not need more than half of the memory
(512 MiB) inside Linux, you can easily assign the second memory bank
to the non-secure guest without further adaptions. Here is a patch:
diff --git a/repos/base-hw/include/spec/imx53/drivers/trustzone.h
b/repos/base-hw/include/spec/imx53/drivers/trustzone.h
index 8a65fea02..0f8d51b4c 100644
--- a/repos/base-hw/include/spec/imx53/drivers/trustzone.h
+++ b/repos/base-hw/include/spec/imx53/drivers/trustzone.h
@@ -28,8 +28,8 @@ namespace Trustzone
*/
SECURE_RAM_BASE = Imx53::RAM_BANK_0_BASE,
SECURE_RAM_SIZE = 256 * 1024 * 1024,
- 256NONSECURE_RAM_BASE = Imx53::RAM_BANK_0_BASE + SECURE_RAM_SIZE,
- RAM_BANK_0_BASENONSECURE_RAM_SIZE = 256 * 1024 * 1024,
+ 256NONSECURE_RAM_BASE = Imx53::RAM_BANK_1_BASE,
+ Imx53NONSECURE_RAM_SIZE = 512 * 1024 * 1024,
};
}
Please keep in mind to *not* increase the secure ram area. It needs to
be protected by the M4IF TrustZone aware IP core, which is somehow
limited in its configuration of secure address ranges.
Regards
Stefan
On Thu, Sep 27, 2018 at 12:01:30PM +0200, Stefan Kalkowski wrote:
> Hello,
>
> On Wed, Sep 26, 2018 at 08:27:53PM +0800, lzSun wrote:
> > hello,
> > I have written an email about to increase the tz_vmm demo's memory size before, but haven't get any answer yet. The thing is, I want to increase the memory size that linux in the normal world can use. During these days, I found the related file which is at
> > " /genode/repos/base-hw/include/spec/imx53/drivers/trustzone.h " . In this file I found the NONSECURE_MEMORY_SIZE = 256*1024*1024. So I increase this size to 512*1024*1024, however, when the system booting, it print the error message like:
>
> just increasing the value of the memory size for the non-secure memory
> is not sufficient here. The physical memory of the i.MX53 QSB is not
> continous. It has 256 MiB starting at 0x70000000 and 256 MiB starting
> at 0xb0000000. For our experiments with ARM TrustZone we started on
> another platform with continous physical memory, and for ease of
> implementation of the VMM example we kept that assumption. Therefore,
> we are using just half of the memory on i.MX53 in the TrustZone
> example.
>
> If you want to use both regions, you will have to change the Ram class
> in and Vm_base class in repos/os/src/server/tz_vmm/include to accept
> more than one region, and handle the virtual to physical translations
> in the VMM accordingly. Moreover, the additional memory area has to be
> added to the ATAG in repos/os/src/server/tz_vmm/spec/imx53_qsb/vm.cc.
>
> Regards
> Stefan
>
> > [init -> tz_vmm] Start virtual machine ...
> > [init -> tz_vmm] Error: failed to handle data abort
> > [init -> tz_vmm] Cpu state:
> > [init -> tz_vmm] Register Virt Phys
> > [init -> tz_vmm] ------------------------------------
> > [init -> tz_vmm] r0 = 0xc0888294 0x80888294
> > [init -> tz_vmm] r1 = 0x00000000 0x00000000
> > [init -> tz_vmm] r2 = 0x00000020 0x00000000
> > [init -> tz_vmm] r3 = 0xd5001000 0x95001000
> > [init -> tz_vmm] r4 = 0xc0c28000 0x80c28000
> > [init -> tz_vmm] r5 = 0xd50000c0 0x950000c0
> > [init -> tz_vmm] r6 = 0xc0888294 0x80888294
> > [init -> tz_vmm] r7 = 0xd50000a0 0x950000a0
> > [init -> tz_vmm] r8 = 0xd5000000 0x95000000
> > [init -> tz_vmm] r9 = 0x00000000 0x00000000
> > [init -> tz_vmm] r10 = 0x00000000 0x00000000
> > [init -> tz_vmm] r11 = 0xffffffff 0x00000000
> > [init -> tz_vmm] r12 = 0x00000001 0x00000000
> > [init -> tz_vmm] sp = 0x00000000 0x00000000
> > [init -> tz_vmm] lr = 0x00000000 0x00000000
> > [init -> tz_vmm] ip = 0xc00cde10 0x800cde10
> > [init -> tz_vmm] cpsr = 0x60000093 0x00000000
> > [init -> tz_vmm] sp _und = 0xc08e59d8 0x808e59d8
> > [init -> tz_vmm] lr _und = 0xc08e59d8 0x808e59d8
> > [init -> tz_vmm] spsr _und = 0x00000000 0x00000000
> > [init -> tz_vmm] sp _svc = 0xc0887f30 0x80887f30
> > [init -> tz_vmm] lr _svc = 0xc00cddf0 0x800cddf0
> > [init -> tz_vmm] spsr _svc = 0x00000000 0x00000000
> > [init -> tz_vmm] sp _abt = 0xc08e59cc 0x808e59cc
> > [init -> tz_vmm] lr _abt = 0xc08e59cc 0x808e59cc
> > [init -> tz_vmm] spsr _abt = 0x00000000 0x00000000
> > [init -> tz_vmm] sp _irq = 0xc08e59c0 0x808e59c0
> > [init -> tz_vmm] lr _irq = 0xc08e59c0 0x808e59c0
> > [init -> tz_vmm] spsr _irq = 0x00000000 0x00000000
> > [init -> tz_vmm] sp _fiq = 0x00000000 0x00000000
> > [init -> tz_vmm] lr _fiq = 0x00000000 0x00000000
> > [init -> tz_vmm] spsr _fiq = 0x00000000 0x00000000
> > [init -> tz_vmm] ttbr0 = 0x80004019
> > [init -> tz_vmm] ttbr1 = 0x80004019
> > [init -> tz_vmm] ttbrc = 0x00000000
> > [init -> tz_vmm] dfar = 0xc088829c 0x8088829c
> > [init -> tz_vmm] exception = data_abort
> >
> >
> >
> > Did I missed something ? Any help will be grateful, thanks a lot!
> >
> >
> > ------------------
> > Best wishes
>
> > _______________________________________________
> > Genode users mailing list
> > users at lists.genode.org
> > https://lists.genode.org/listinfo/users
>
>
> --
> Stefan Kalkowski
> Genode labs
>
> https://github.com.skalk | https://genode.org
>
> _______________________________________________
> Genode users mailing list
> users at lists.genode.org
> https://lists.genode.org/listinfo/users
--
Stefan Kalkowski
Genode labs
https://github.com.skalk | https://genode.org
More information about the users
mailing list