blob: 4f50b6b41967fca3ac36e85f4b13049df10aa17f [file] [log] [blame]
(window.webpackJsonp=window.webpackJsonp||[]).push([[65],{408:function(e,a,n){"use strict";n.r(a);var t=n(11),_=Object(t.a)({},(function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("ContentSlotsDistributor",{attrs:{"slot-key":e.$parent.slotKey}},[n("h1",{attrs:{id:"expanding-ta-secure-memory-on-qemuv8"}},[n("a",{staticClass:"header-anchor",attrs:{href:"#expanding-ta-secure-memory-on-qemuv8"}},[e._v("#")]),e._v(" Expanding TA Secure Memory on QEMUv8")]),e._v(" "),n("p",[e._v("Since some Rust examples such as "),n("code",[e._v("tls_server-rs")]),e._v(" and "),n("code",[e._v("tls_client-rs")]),e._v(" require\nlarger TA memory (about 18M heap), we've expanded TA secure memory on OP-TEE\nQEMUv8 platform. On QEMUv8 platform it supports 7M TA memory originally, after\nexpanding it supports 27M TA memory at most.")]),e._v(" "),n("p",[e._v("We modified the firmware and configuration of QEMU, ATF and OPTEE. You can\ndownload the pre-built image from\nhttps://nightlies.apache.org/teaclave/teaclave-trustzone-sdk/ or patch the code\nand build the images by yourself.")]),e._v(" "),n("p",[e._v("The modifications are:")]),e._v(" "),n("ol",[n("li",[e._v("QEMU patch in "),n("code",[e._v("optee-repo/qemu")]),e._v(":")])]),e._v(" "),n("div",{staticClass:"language- extra-class"},[n("pre",{pre:!0,attrs:{class:"language-text"}},[n("code",[e._v("diff --git a/hw/arm/virt.c b/hw/arm/virt.c\nindex d2e5ecd..e1070a0 100644\n--- a/hw/arm/virt.c\n+++ b/hw/arm/virt.c\n@@ -157,7 +157,7 @@ static const MemMapEntry base_memmap[] = {\n [VIRT_MMIO] = { 0x0a000000, 0x00000200 },\n /* ...repeating for a total of NUM_VIRTIO_TRANSPORTS, each of that size */\n [VIRT_PLATFORM_BUS] = { 0x0c000000, 0x02000000 },\n- [VIRT_SECURE_MEM] = { 0x0e000000, 0x01000000 },\n+ [VIRT_SECURE_MEM] = { 0x0e000000, 0x02000000 },\n [VIRT_PCIE_MMIO] = { 0x10000000, 0x2eff0000 },\n [VIRT_PCIE_PIO] = { 0x3eff0000, 0x00010000 },\n [VIRT_PCIE_ECAM] = { 0x3f000000, 0x01000000 },\n")])])]),n("ol",{attrs:{start:"2"}},[n("li",[e._v("ATF patch in "),n("code",[e._v("optee-repo/trusted-firmware-a")]),e._v(":")])]),e._v(" "),n("div",{staticClass:"language- extra-class"},[n("pre",{pre:!0,attrs:{class:"language-text"}},[n("code",[e._v("diff --git a/plat/qemu/qemu/include/platform_def.h b/plat/qemu/qemu/include/platform_def.h\nindex c02eff9..ded0660 100644\n--- a/plat/qemu/qemu/include/platform_def.h\n+++ b/plat/qemu/qemu/include/platform_def.h\n@@ -87,7 +87,7 @@\n #define SEC_SRAM_SIZE 0x00060000\n\n #define SEC_DRAM_BASE 0x0e100000\n-#define SEC_DRAM_SIZE 0x00f00000\n+#define SEC_DRAM_SIZE 0x01f00000\n\n #define SECURE_GPIO_BASE 0x090b0000\n #define SECURE_GPIO_SIZE 0x00001000\n")])])]),n("ol",{attrs:{start:"3"}},[n("li",[e._v("Add configurations in "),n("code",[e._v("optee-repo/optee_os")]),e._v(":")])]),e._v(" "),n("div",{staticClass:"language- extra-class"},[n("pre",{pre:!0,attrs:{class:"language-text"}},[n("code",[e._v("diff --git a/mk/config.mk b/mk/config.mk\nindex f2822df..8148cc5 100644\n--- a/mk/config.mk\n+++ b/mk/config.mk\n@@ -904,3 +904,7 @@ CFG_DRIVERS_TPM2_MMIO ?= n\n ifeq ($(CFG_CORE_TPM_EVENT_LOG),y)\n CFG_CORE_TCG_PROVIDER ?= $(CFG_DRIVERS_TPM2)\n endif\n+\n+# expand TA secure memory\n+CFG_TZDRAM_START = 0x0e100000\n+CFG_TZDRAM_SIZE = 0x01f00000\n")])])]),n("ol",{attrs:{start:"4"}},[n("li",[e._v("Patch for OP-TEE core pagetable:")])]),e._v(" "),n("div",{staticClass:"language- extra-class"},[n("pre",{pre:!0,attrs:{class:"language-text"}},[n("code",[e._v("diff --git a/core/include/mm/pgt_cache.h b/core/include/mm/pgt_cache.h\nindex 0e72e17..28c58ad 100644\n--- a/core/include/mm/pgt_cache.h\n+++ b/core/include/mm/pgt_cache.h\n@@ -45,9 +45,9 @@ struct pgt {\n #if CFG_NUM_THREADS < 2\n #define PGT_CACHE_SIZE 4\n #elif (CFG_NUM_THREADS == 2 && !defined(CFG_WITH_LPAE))\n-#define PGT_CACHE_SIZE 8\n+#define PGT_CACHE_SIZE 32\n #else\n-#define PGT_CACHE_SIZE ROUNDUP(CFG_NUM_THREADS * 2, PGT_NUM_PGT_PER_PAGE)\n+#define PGT_CACHE_SIZE 32\n #endif\n")])])]),n("p",[e._v("Finally, build images:")]),e._v(" "),n("div",{staticClass:"language- extra-class"},[n("pre",{pre:!0,attrs:{class:"language-text"}},[n("code",[e._v("$ cd optee-repo/build\n$ make\n")])])])])}),[],!1,null,null,null);a.default=_.exports}}]);