From f41f0324a592e60b62164e823504656bc1a55419 Mon Sep 17 00:00:00 2001 From: hujun5 Date: Tue, 5 Dec 2023 15:57:20 +0800 Subject: [PATCH] qemu/trustzone: add secure memory config According to the qemu source code, hw/arm/virt.c. The secure memory of the ARM Virt board is [0xe000000~0xf000000] and the non-secure memory is configured as [0x40000000~0xffffffff]. We made the following adjustments based on the above virt board configuration Signed-off-by: hujun5 --- arch/arm/src/qemu/qemu_memorymap.c | 4 ++++ arch/arm/src/qemu/qemu_memorymap.h | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/arch/arm/src/qemu/qemu_memorymap.c b/arch/arm/src/qemu/qemu_memorymap.c index 603f90d293..2eceb2ecda 100644 --- a/arch/arm/src/qemu/qemu_memorymap.c +++ b/arch/arm/src/qemu/qemu_memorymap.c @@ -47,6 +47,10 @@ static const struct section_mapping_s g_section_mapping[] = VIRT_IO_PSECTION, VIRT_IO_VSECTION, MMU_IOFLAGS, _NSECTIONS(VIRT_IO_SECSIZE) }, + { + VIRT_SEC_MEM_PSECTION, VIRT_SEC_MEM_VSECTION, + MMU_MEMFLAGS, _NSECTIONS(VIRT_SEC_MEM_SECSIZE) + }, { VIRT_PCIE_PSECTION, VIRT_PCIE_VSECTION, MMU_IOFLAGS, _NSECTIONS(VIRT_PCIE_SECSIZE) diff --git a/arch/arm/src/qemu/qemu_memorymap.h b/arch/arm/src/qemu/qemu_memorymap.h index 4c8660ac67..01fea1d37e 100644 --- a/arch/arm/src/qemu/qemu_memorymap.h +++ b/arch/arm/src/qemu/qemu_memorymap.h @@ -39,19 +39,22 @@ /* Qemu virt Physical Memory Map ********************************************/ #define VIRT_FLASH_PSECTION 0x00000000 /* 0x00000000-0x08000000 */ -#define VIRT_IO_PSECTION 0x08000000 /* 0x08000000-0x0f000000 */ +#define VIRT_IO_PSECTION 0x08000000 /* 0x08000000-0x0e000000 */ +#define VIRT_SEC_MEM_PSECTION 0x0e000000 /* 0x0e000000-0x0f000000 */ #define VIRT_PCIE_PSECTION 0x10000000 /* 0x10000000-0x40000000 */ /* Qemu virt Virtual Memory Map *********************************************/ #define VIRT_FLASH_VSECTION VIRT_FLASH_PSECTION #define VIRT_IO_VSECTION VIRT_IO_PSECTION +#define VIRT_SEC_MEM_VSECTION VIRT_SEC_MEM_PSECTION #define VIRT_PCIE_VSECTION VIRT_PCIE_PSECTION /* Sizes of memory regions in bytes. */ #define VIRT_FLASH_SECSIZE (128*1024*1024) -#define VIRT_IO_SECSIZE (112*1024*1024) +#define VIRT_IO_SECSIZE (96*1024*1024) +#define VIRT_SEC_MEM_SECSIZE (16*1024*1024) #define VIRT_PCIE_SECSIZE (3*256*1024*1024) /****************************************************************************