|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v2 20/40] xen/mpu: plump early_fdt_map in MPU systems
Hi, On 13/01/2023 05:28, Penny Zheng wrote: In MPU system, device tree binary can be packed with Xen image through CONFIG_DTB_FILE, or provided by bootloader through x0. In MPU system, each section in xen.lds.S is PAGE_SIZE aligned. So in order to not overlap with the previous BSS section, dtb section should be made page-aligned too. We add . = ALIGN(PAGE_SIZE); in the head of dtb section to make it happen. In this commit, we map early FDT with a transient MPU memory region at rear with REGION_HYPERVISOR_BOOT. Signed-off-by: Penny Zheng <penny.zheng@xxxxxxx> Signed-off-by: Wei Chen <wei.chen@xxxxxxx> --- xen/arch/arm/include/asm/arm64/mpu.h | 5 +++ xen/arch/arm/mm_mpu.c | 63 +++++++++++++++++++++++++--- xen/arch/arm/xen.lds.S | 5 ++- 3 files changed, 67 insertions(+), 6 deletions(-) diff --git a/xen/arch/arm/include/asm/arm64/mpu.h b/xen/arch/arm/include/asm/arm64/mpu.h index fcde6ad0db..b85e420a90 100644 --- a/xen/arch/arm/include/asm/arm64/mpu.h +++ b/xen/arch/arm/include/asm/arm64/mpu.h @@ -45,18 +45,22 @@ * [3:4] Execute Never * [5:6] Access Permission * [7] Region Present + * [8] Boot-only Region */ #define _REGION_AI_BIT 0 #define _REGION_XN_BIT 3 #define _REGION_AP_BIT 5 #define _REGION_PRESENT_BIT 7 +#define _REGION_BOOTONLY_BIT 8 In a follow-up patch, you are replacing BOOTONLY with TRANSIENT. Please avoid renaming new functions and instead introduce them with the correct name from the start. #define _REGION_XN (2U << _REGION_XN_BIT) #define _REGION_RO (2U << _REGION_AP_BIT) #define _REGION_PRESENT (1U << _REGION_PRESENT_BIT) +#define _REGION_BOOTONLY (1U << _REGION_BOOTONLY_BIT) #define REGION_AI_MASK(x) (((x) >> _REGION_AI_BIT) & 0x7U) #define REGION_XN_MASK(x) (((x) >> _REGION_XN_BIT) & 0x3U) #define REGION_AP_MASK(x) (((x) >> _REGION_AP_BIT) & 0x3U) #define REGION_RO_MASK(x) (((x) >> _REGION_AP_BIT) & 0x2U) +#define REGION_BOOTONLY_MASK(x) (((x) >> _REGION_BOOTONLY_BIT) & 0x1U)/** _REGION_NORMAL is convenience define. It is not meant to be used @@ -68,6 +72,7 @@ #define REGION_HYPERVISOR_RO (_REGION_NORMAL|_REGION_XN|_REGION_RO)#define REGION_HYPERVISOR REGION_HYPERVISOR_RW+#define REGION_HYPERVISOR_BOOT (REGION_HYPERVISOR_RW|_REGION_BOOTONLY)#define INVALID_REGION (~0UL) diff --git a/xen/arch/arm/mm_mpu.c b/xen/arch/arm/mm_mpu.cindex 08720a7c19..b34dbf4515 100644 --- a/xen/arch/arm/mm_mpu.c +++ b/xen/arch/arm/mm_mpu.c @@ -20,11 +20,16 @@ */#include <xen/init.h>+#include <xen/libfdt/libfdt.h> #include <xen/mm.h> #include <xen/page-size.h> +#include <xen/pfn.h> +#include <xen/sizes.h> #include <xen/spinlock.h> #include <asm/arm64/mpu.h> +#include <asm/early_printk.h> #include <asm/page.h> +#include <asm/setup.h>#ifdef NDEBUGstatic inline void @@ -62,6 +67,8 @@ uint64_t __ro_after_init max_xen_mpumap;static DEFINE_SPINLOCK(xen_mpumap_lock); +static paddr_t dtb_paddr; A fair amount of this code is the same as the MMU version. Can we share some code? Same as the previous patch, why do you implmenet early_fdt_map() at a different place in the file?
Cheers, -- Julien Grall
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |