3ba0cb19ea
In some arm64 boards, MMU regions are set so userspace can access all peripherals (MT_P_RW_U_RW), including the GIC. This seems like a mistake, which has been copy/pasted in some boards. Change this to no userspace access by default (MT_P_RW_U_NA), like the other boards. Signed-off-by: Henri Xavier <datacomos@huawei.com>
32 lines
926 B
C
32 lines
926 B
C
/*
|
|
* Copyright (c) 2020-2022 EPAM Systems
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
#include <zephyr/devicetree.h>
|
|
#include <zephyr/sys/util.h>
|
|
#include <zephyr/arch/arm64/arm_mmu.h>
|
|
|
|
static const struct arm_mmu_region mmu_regions[] = {
|
|
|
|
MMU_REGION_FLAT_ENTRY("GIC",
|
|
DT_REG_ADDR_BY_IDX(DT_INST(0, arm_gic), 0),
|
|
DT_REG_SIZE_BY_IDX(DT_INST(0, arm_gic), 0),
|
|
MT_DEVICE_nGnRnE | MT_P_RW_U_NA | MT_NS),
|
|
|
|
MMU_REGION_FLAT_ENTRY("GIC",
|
|
DT_REG_ADDR_BY_IDX(DT_INST(0, arm_gic), 1),
|
|
DT_REG_SIZE_BY_IDX(DT_INST(0, arm_gic), 1),
|
|
MT_DEVICE_nGnRnE | MT_P_RW_U_NA | MT_NS),
|
|
|
|
MMU_REGION_FLAT_ENTRY("HYPERVISOR",
|
|
DT_REG_ADDR_BY_IDX(DT_INST(0, xen_xen), 0),
|
|
DT_REG_SIZE_BY_IDX(DT_INST(0, xen_xen), 0),
|
|
MT_NORMAL | MT_P_RW_U_NA | MT_NS),
|
|
};
|
|
|
|
const struct arm_mmu_config mmu_config = {
|
|
.num_regions = ARRAY_SIZE(mmu_regions),
|
|
.mmu_regions = mmu_regions,
|
|
};
|