diff --git a/thermosphere/src/platform/qemu/stage2_config.c b/thermosphere/src/platform/qemu/stage2_config.c index bbd60a6d3..8f8ce6060 100644 --- a/thermosphere/src/platform/qemu/stage2_config.c +++ b/thermosphere/src/platform/qemu/stage2_config.c @@ -28,7 +28,6 @@ static TEMPORARY ALIGN(0x1000) u64 g_vttbl[BIT(ADDRSPACESZ2 - 30)] = {0}; static TEMPORARY ALIGN(0x1000) u64 g_vttbl_l2_mmio_0_0[512] = {0}; static TEMPORARY ALIGN(0x1000) u64 g_vttbl_l3_0[512] = {0}; -static TEMPORARY uintptr_t g_vttblPaddr; static inline void identityMapL1(u64 *tbl, uintptr_t addr, size_t size, u64 attribs) { @@ -51,8 +50,9 @@ uintptr_t stage2Configure(u32 *addrSpaceSize) static const u64 devattrs = 0 | MMU_S2AP_RW | MMU_MEMATTR_DEVICE_NGNRE; static const u64 unchanged = MMU_S2AP_RW | MMU_MEMATTR_NORMAL_CACHEABLE_OR_UNCHANGED; + uintptr_t g_vttblPaddr = va2pa(g_vttbl); + if (currentCoreCtx->isBootCore) { - g_vttblPaddr = va2pa(g_vttbl); uintptr_t *l2pa = (uintptr_t *)va2pa(g_vttbl_l2_mmio_0_0); uintptr_t *l3pa = (uintptr_t *)va2pa(g_vttbl_l3_0); diff --git a/thermosphere/src/platform/tegra/stage2_config.c b/thermosphere/src/platform/tegra/stage2_config.c index 2ca41ccdf..b27ba2d0d 100644 --- a/thermosphere/src/platform/tegra/stage2_config.c +++ b/thermosphere/src/platform/tegra/stage2_config.c @@ -26,7 +26,6 @@ static TEMPORARY ALIGN(0x1000) u64 g_vttbl[BIT(ADDRSPACESZ2 - 30)] = {0}; static TEMPORARY ALIGN(0x1000) u64 g_vttbl_l2_mmio_0[512] = {0}; static TEMPORARY ALIGN(0x1000) u64 g_vttbl_l3_0[512] = {0}; -static TEMPORARY uintptr_t g_vttblPaddr; static inline void identityMapL1(u64 *tbl, uintptr_t addr, size_t size, u64 attribs) { @@ -48,8 +47,8 @@ uintptr_t stage2Configure(u32 *addrSpaceSize) *addrSpaceSize = ADDRSPACESZ2; static const u64 devattrs = MMU_PTE_BLOCK_XN | MMU_S2AP_RW | MMU_MEMATTR_DEVICE_NGNRE; static const u64 unchanged = MMU_S2AP_RW | MMU_MEMATTR_NORMAL_CACHEABLE_OR_UNCHANGED; + uintptr_t g_vttblPaddr = va2pa(g_vttbl); if (currentCoreCtx->isBootCore) { - g_vttblPaddr = va2pa(g_vttbl); uintptr_t *l2pa = (uintptr_t *)va2pa(g_vttbl_l2_mmio_0); uintptr_t *l3pa = (uintptr_t *)va2pa(g_vttbl_l3_0); @@ -69,5 +68,5 @@ uintptr_t stage2Configure(u32 *addrSpaceSize) mmu_map_page_range(g_vttbl_l3_0, MEMORY_MAP_PA_GICC, MEMORY_MAP_PA_GICD, 0x2000ull, devattrs); } - return (uintptr_t)g_vttbl; + return g_vttblPaddr; }