Enable early bootup of Armv8-R AArch32 systems
v5 cover Enable early bootup of Armv8-R AArch32 systems
Enable early booting of Armv8-R AArch32 based systems.
Ayan Kumar Halder (3):
xen/arm: Move some of the functions to common file xen/arm32: Create the same boot-time MPU regions as arm64 xen/arm32: mpu: Stubs to build MPU for arm32
xen/arch/arm/arm32/Makefile | 1 + xen/arch/arm/arm32/mpu/Makefile | 3 + xen/arch/arm/arm32/mpu/head.S | 101 +++++++++++++++++++++++ xen/arch/arm/arm32/mpu/p2m.c | 18 ++++ xen/arch/arm/arm32/mpu/smpboot.c | 23 ++++++ xen/arch/arm/arm64/mpu/head.S | 78 +---------------- xen/arch/arm/include/asm/arm32/sysregs.h | 7 ++ xen/arch/arm/include/asm/arm64/sysregs.h | 11 +++ xen/arch/arm/include/asm/cpregs.h | 4 + xen/arch/arm/include/asm/mm.h | 9 +- xen/arch/arm/include/asm/mmu/mm.h | 9 ++ xen/arch/arm/include/asm/mpu/common.inc | 79 ++++++++++++++++++ xen/arch/arm/include/asm/mpu/cpregs.h | 24 ++++++ xen/arch/arm/include/asm/mpu/mm.h | 5 ++ xen/arch/arm/mpu/Makefile | 1 + xen/arch/arm/mpu/domain_page.c | 41 +++++++++ 16 files changed, 329 insertions(+), 85 deletions(-) create mode 100644 xen/arch/arm/arm32/mpu/Makefile create mode 100644 xen/arch/arm/arm32/mpu/head.S create mode 100644 xen/arch/arm/arm32/mpu/p2m.c create mode 100644 xen/arch/arm/arm32/mpu/smpboot.c create mode 100644 xen/arch/arm/include/asm/mpu/common.inc create mode 100644 xen/arch/arm/include/asm/mpu/cpregs.h create mode 100644 xen/arch/arm/mpu/domain_page.c
Signature · 1 line
2.25.1
PATCH v5 1/3 xen/arm: Move some of the functions to common file
Added a new file common.inc to hold the common earlyboot MPU regions configurations across arm64 and arm32.
prepare_xen_region, fail_insufficient_regions() will be used by both arm32 and arm64. Thus, they have been moved to common.inc.
*_PRBAR are moved to arm64/sysregs.h.*_PRLAR are moved to common.inc as they are common between arm32 and arm64.
Introduce WRITE_SYSREG_ASM to write to the system registers from the common asm file.
---
Changes from
v1 -
1. enable_mpu() now sets HMAIR{0,1} registers. This is similar to what is being done in enable_mmu(). All the mm related configurations happen in this function.
2. Fixed some typos.
v2 -
1. Extracted the arm64 head.S functions/macros in a common file.
v3 -
1. Moved *_PRLAR are moved to prepare_xen_region.inc
2. enable_boot_cpu_mm() is preserved in mpu/head.S.
3. STORE_SYSREG is renamed as WRITE_SYSREG_ASM()
4. LOAD_SYSREG is removed.
5. No need to save/restore lr in enable_boot_cpu_mm(). IOW, keep it as it was in the original code.
v4 -
1. Rename prepare_xen_region.inc to common.inc
2. enable_secondary_cpu_mm() is moved back to mpu/head.S.
xen/arch/arm/arm64/mpu/head.S | 78 +---------------------- xen/arch/arm/include/asm/arm64/sysregs.h | 11 ++++ xen/arch/arm/include/asm/mpu/common.inc | 79 ++++++++++++++++++++++++ 3 files changed, 91 insertions(+), 77 deletions(-) create mode 100644 xen/arch/arm/include/asm/mpu/common.inc
xen/arch/arm/arm64/mpu/head.S +1 -77
@@ -3,83 +3,7 @@ * Start-of-day code for an Armv8-R MPU system. */ -#include <asm/early_printk.h> -#include <asm/mpu.h> - -/* Backgroud region enable/disable */ -#define SCTLR_ELx_BR BIT(17, UL) - -#define REGION_TEXT_PRBAR 0x38 /* SH=11 AP=10 XN=00 */ -#define REGION_RO_PRBAR 0x3A /* SH=11 AP=10 XN=10 */ -#define REGION_DATA_PRBAR 0x32 /* SH=11 AP=00 XN=10 */ -#define REGION_DEVICE_PRBAR 0x22 /* SH=10 AP=00 XN=10 */ - -#define REGION_NORMAL_PRLAR 0x0f /* NS=0 ATTR=111 EN=1 */ -#define REGION_DEVICE_PRLAR 0x09 /* NS=0 ATTR=100 EN=1 */ - -/* - * Macro to prepare and set a EL2 MPU memory region. - * We will also create an according MPU memory region entry, which - * is a structure of pr_t, in table \prmap. - * - * sel: region selector - * base: reg storing base address - * limit: reg storing limit address - * prbar: store computed PRBAR_EL2 value - * prlar: store computed PRLAR_EL2 value - * maxcount: maximum number of EL2 regions supported - * attr_prbar: PRBAR_EL2-related memory attributes. If not specified it will be - * REGION_DATA_PRBAR - * attr_prlar: PRLAR_EL2-related memory attributes. If not specified it will be - * REGION_NORMAL_PRLAR - * - * Preserves \maxcount - * Output: - * \sel: Next available region selector index. - * Clobbers \base, \limit, \prbar, \prlar - * - * Note that all parameters using registers should be distinct. - */ -.macro prepare_xen_region, sel, base, limit, prbar, prlar, maxcount, attr_prbar=REGION_DATA_PRBAR, attr_prlar=REGION_NORMAL_PRLAR - /* Check if the region is empty */ - cmp \base, \limit - beq 1f - - /* Check if the number of regions exceeded the count specified in MPUIR_EL2 */ - cmp \sel, \maxcount - bge fail_insufficient_regions - - /* Prepare value for PRBAR_EL2 reg and preserve it in \prbar.*/ - and \base, \base, #MPU_REGION_MASK - mov \prbar, #\attr_prbar - orr \prbar, \prbar, \base - - /* Limit address should be inclusive */ - sub \limit, \limit, #1 - and \limit, \limit, #MPU_REGION_MASK - mov \prlar, #\attr_prlar - orr \prlar, \prlar, \limit - - msr PRSELR_EL2, \sel - isb - msr PRBAR_EL2, \prbar - msr PRLAR_EL2, \prlar - dsb sy - isb - - add \sel, \sel, #1 - -1: -.endm - -/* - * Failure caused due to insufficient MPU regions. - */ -FUNC_LOCAL(fail_insufficient_regions) - PRINT("- Selected MPU region is above the implemented number in MPUIR_EL2 -\r\n") -1: wfe - b 1b -END(fail_insufficient_regions) +#include <asm/mpu/common.inc> /* * Enable EL2 MPU and data cache
xen/arch/arm/include/asm/arm64/sysregs.h +11 -0
@@ -462,6 +462,15 @@#define ZCR_ELx_LEN_SIZE 9#define ZCR_ELx_LEN_MASK 0x1ff +#define REGION_TEXT_PRBAR 0x38/* SH=11 AP=10 XN=00 */ +#define REGION_RO_PRBAR 0x3A/* SH=11 AP=10 XN=10 */ +#define REGION_DATA_PRBAR 0x32/* SH=11 AP=00 XN=10 */ +#define REGION_DEVICE_PRBAR 0x22/* SH=10 AP=00 XN=10 */ + +#define WRITE_SYSREG_ASM (v, name) "msr " __stringify(name,) #v; + +#ifndef __ASSEMBLY__ +/* Access to system registers */ #define WRITE_SYSREG64 (v, name) do { \
@@ -481,6 +490,8 @@#define WRITE_SYSREG_LR (v, index) WRITE_SYSREG(v, ICH_LR_REG(index))#define READ_SYSREG_LR (index) READ_SYSREG(ICH_LR_REG(index)) +#endif /* __ASSEMBLY__ */ +#endif /* _ASM_ARM_ARM64_SYSREGS_H */ /*
xen/arch/arm/include/asm/mpu/common.inc new file +79 -0
79 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [PATCH v5 1/3] xen/arm: Move some of the functions to common file
Quoted 1 line · Ayan Kumar Halder
Added a new file common.inc to hold the common earlyboot MPU regions
NIT: Describe your changes in imperative mood
Also, my understanding was that this file will contain common constructs not only regions related. If this is just for regions, then it's better to name it regions.inc.
Quoted 144 lines
configurations across arm64 and arm32.
prepare_xen_region,fail_insufficient_regions()will be used by both arm32 and arm64. Thus, they have been moved to common.inc.
*_PRBARare moved toarm64/sysregs.h.*_PRLARare moved to common.inc as they are common between arm32 and arm64.Introduce
WRITE_SYSREG_ASMto write to the system registers from the common asm file.Signed-off-by Ayan Kumar Halder <[email protected]>---
Changes from
v1 -
1.
enable_mpu()now sets HMAIR{0,1} registers. This is similar to what is being done inenable_mmu(). All the mm related configurations happen in this function.2. Fixed some typos.
v2 -
1. Extracted the arm64head.Sfunctions/macros in a common file.v3 -
1. Moved*_PRLARare moved to prepare_xen_region.inc2.
enable_boot_cpu_mm()is preserved inmpu/head.S.3.
STORE_SYSREGis renamed asWRITE_SYSREG_ASM()4.
LOAD_SYSREGis removed.5. No need to save/restore lr in
enable_boot_cpu_mm(). IOW, keep it as it was in the original code.v4 -
1. Rename prepare_xen_region.inc to common.inc2.
enable_secondary_cpu_mm()is moved back tompu/head.S.xen/arch/arm/arm64/mpu/head.S | 78 +---------------------- xen/arch/arm/include/asm/arm64/sysregs.h | 11 ++++ xen/arch/arm/include/asm/mpu/common.inc | 79 ++++++++++++++++++++++++ 3 files changed, 91 insertions(+), 77 deletions(-) create mode 100644 xen/arch/arm/include/asm/mpu/common.incxen/arch/arm/arm64/mpu/head.S +1
-77@@ -3,83 +3,7 @@ * Start-of-day code for an Armv8-R MPU system. */ -#include <asm/early_printk.h> -#include <asm/mpu.h> - -/* Backgroud region enable/disable */ -#define SCTLR_ELx_BR BIT(17, UL) - -#define REGION_TEXT_PRBAR 0x38 /* SH=11 AP=10 XN=00 */ -#define REGION_RO_PRBAR 0x3A /* SH=11 AP=10 XN=10 */ -#define REGION_DATA_PRBAR 0x32 /* SH=11 AP=00 XN=10 */ -#define REGION_DEVICE_PRBAR 0x22 /* SH=10 AP=00 XN=10 */ - -#define REGION_NORMAL_PRLAR 0x0f /* NS=0 ATTR=111 EN=1 */ -#define REGION_DEVICE_PRLAR 0x09 /* NS=0 ATTR=100 EN=1 */ - -/* - * Macro to prepare and set a EL2 MPU memory region. - * We will also create an according MPU memory region entry, which - * is a structure of pr_t, in table \prmap. - * - * sel: region selector - * base: reg storing base address - * limit: reg storing limit address - * prbar: store computed PRBAR_EL2 value - * prlar: store computed PRLAR_EL2 value - * maxcount: maximum number of EL2 regions supported - * attr_prbar: PRBAR_EL2-related memory attributes. If not specified it will be - * REGION_DATA_PRBAR - * attr_prlar: PRLAR_EL2-related memory attributes. If not specified it will be - * REGION_NORMAL_PRLAR - * - * Preserves \maxcount - * Output: - * \sel: Next available region selector index. - * Clobbers \base, \limit, \prbar, \prlar - * - * Note that all parameters using registers should be distinct. - */ -.macro prepare_xen_region, sel, base, limit, prbar, prlar, maxcount, attr_prbar=REGION_DATA_PRBAR, attr_prlar=REGION_NORMAL_PRLAR - /* Check if the region is empty */ - cmp \base, \limit - beq 1f - - /* Check if the number of regions exceeded the count specified in MPUIR_EL2 */ - cmp \sel, \maxcount - bge fail_insufficient_regions - - /* Prepare value for PRBAR_EL2 reg and preserve it in \prbar.*/ - and \base, \base, #MPU_REGION_MASK - mov \prbar, #\attr_prbar - orr \prbar, \prbar, \base - - /* Limit address should be inclusive */ - sub \limit, \limit, #1 - and \limit, \limit, #MPU_REGION_MASK - mov \prlar, #\attr_prlar - orr \prlar, \prlar, \limit - - msr PRSELR_EL2, \sel - isb - msr PRBAR_EL2, \prbar - msr PRLAR_EL2, \prlar - dsb sy - isb - - add \sel, \sel, #1 - -1: -.endm - -/* - * Failure caused due to insufficient MPU regions. - */ -FUNC_LOCAL(fail_insufficient_regions) - PRINT("- Selected MPU region is above the implemented number in MPUIR_EL2 -\r\n") -1: wfe - b 1b -END(fail_insufficient_regions) +#include <asm/mpu/common.inc> /* * Enable EL2 MPU and data cachexen/arch/arm/include/asm/arm64/sysregs.h +0
-0
xen/arch/arm/include/asm/arm64/sysregs.h line 470
Quoted 9 lines
xen/arch/arm/include/asm/arm64/sysregs.h +6
-0@@ -462,6 +462,15 @@#define ZCR_ELx_LEN_SIZE 9#define ZCR_ELx_LEN_MASK 0x1ff +#define REGION_TEXT_PRBAR 0x38/* SH=11 AP=10 XN=00 */ +#define REGION_RO_PRBAR 0x3A/* SH=11 AP=10 XN=10 */ +#define REGION_DATA_PRBAR 0x32/* SH=11 AP=00 XN=10 */ +#define REGION_DEVICE_PRBAR 0x22/* SH=10 AP=00 XN=10 */ + +#define WRITE_SYSREG_ASM (v, name) "msr " __stringify(name,) #v;
1) This macro is ASM only and you don't protect it like the C macros below. Why?
2) Semicolon not needed at the end
~Michal
Re: [PATCH v5 1/3] xen/arm: Move some of the functions to common file
Hi,
Quoted 156 lines · Michal
Quoted 1 line · Ayan Kumar Halder
Added a new file common.inc to hold the common earlyboot MPU regions
NIT: Describe your changes in imperative mood
Also, my understanding was that this file will contain common constructs not only regions related. If this is just for regions, then it's better to name it regions.inc.
Quoted 147 lines
configurations across arm64 and arm32.
prepare_xen_region,fail_insufficient_regions()will be used by both arm32 and arm64. Thus, they have been moved to common.inc.
*_PRBARare moved toarm64/sysregs.h.*_PRLARare moved to common.inc as they are common between arm32 and arm64.Introduce
WRITE_SYSREG_ASMto write to the system registers from the common asm file.Signed-off-by Ayan Kumar Halder <[email protected]>---
Changes from
v1 -
1.
enable_mpu()now sets HMAIR{0,1} registers. This is similar to what is being done inenable_mmu(). All the mm related configurations happen in this function.2. Fixed some typos.
v2 -
1. Extracted the arm64head.Sfunctions/macros in a common file.v3 -
1. Moved*_PRLARare moved to prepare_xen_region.inc2.
enable_boot_cpu_mm()is preserved inmpu/head.S.3.
STORE_SYSREGis renamed asWRITE_SYSREG_ASM()4.
LOAD_SYSREGis removed.5. No need to save/restore lr in
enable_boot_cpu_mm(). IOW, keep it as it was in the original code.v4 -
1. Rename prepare_xen_region.inc to common.inc2.
enable_secondary_cpu_mm()is moved back tompu/head.S.xen/arch/arm/arm64/mpu/head.S | 78 +---------------------- xen/arch/arm/include/asm/arm64/sysregs.h | 11 ++++ xen/arch/arm/include/asm/mpu/common.inc | 79 ++++++++++++++++++++++++ 3 files changed, 91 insertions(+), 77 deletions(-)create mode 100644 xen/arch/arm/include/asm/mpu/common.inc
xen/arch/arm/arm64/mpu/head.S +1
-77@@ -3,83 +3,7 @@ * Start-of-day code for an Armv8-R MPU system. */ -#include <asm/early_printk.h> -#include <asm/mpu.h> - -/* Backgroud region enable/disable */ -#define SCTLR_ELx_BR BIT(17, UL) - -#define REGION_TEXT_PRBAR 0x38 /* SH=11 AP=10 XN=00 */ -#define REGION_RO_PRBAR 0x3A /* SH=11 AP=10 XN=10 */ -#define REGION_DATA_PRBAR 0x32 /* SH=11 AP=00 XN=10 */ -#define REGION_DEVICE_PRBAR 0x22 /* SH=10 AP=00 XN=10 */ - -#define REGION_NORMAL_PRLAR 0x0f /* NS=0 ATTR=111 EN=1 */ -#define REGION_DEVICE_PRLAR 0x09 /* NS=0 ATTR=100 EN=1 */ - -/* - * Macro to prepare and set a EL2 MPU memory region. - * We will also create an according MPU memory region entry, which - * is a structure of pr_t, in table \prmap. - * - * sel: region selector - * base: reg storing base address - * limit: reg storing limit address - * prbar: store computed PRBAR_EL2 value - * prlar: store computed PRLAR_EL2 value - * maxcount: maximum number of EL2 regions supported - * attr_prbar: PRBAR_EL2-related memory attributes. If not specified it will be - * REGION_DATA_PRBAR - * attr_prlar: PRLAR_EL2-related memory attributes. If not specified it will be - * REGION_NORMAL_PRLAR - * - * Preserves \maxcount - * Output: - * \sel: Next available region selector index. - * Clobbers \base, \limit, \prbar, \prlar - * - * Note that all parameters using registers should be distinct. - */ -.macro prepare_xen_region, sel, base, limit, prbar, prlar, maxcount, attr_prbar=REGION_DATA_PRBAR, attr_prlar=REGION_NORMAL_PRLAR - /* Check if the region is empty */ - cmp \base, \limit - beq 1f - - /* Check if the number of regions exceeded the count specified in MPUIR_EL2 */ - cmp \sel, \maxcount - bge fail_insufficient_regions - - /* Prepare value for PRBAR_EL2 reg and preserve it in \prbar.*/ - and \base, \base, #MPU_REGION_MASK - mov \prbar, #\attr_prbar - orr \prbar, \prbar, \base - - /* Limit address should be inclusive */ - sub \limit, \limit, #1 - and \limit, \limit, #MPU_REGION_MASK - mov \prlar, #\attr_prlar - orr \prlar, \prlar, \limit - - msr PRSELR_EL2, \sel - isb - msr PRBAR_EL2, \prbar - msr PRLAR_EL2, \prlar - dsb sy - isb - - add \sel, \sel, #1 - -1: -.endm - -/* - * Failure caused due to insufficient MPU regions. - */ -FUNC_LOCAL(fail_insufficient_regions) - PRINT("- Selected MPU region is above the implemented number in MPUIR_EL2 -\r\n") -1: wfe - b 1b -END(fail_insufficient_regions) +#include <asm/mpu/common.inc> /* * Enable EL2 MPU and data cachexen/arch/arm/include/asm/arm64/sysregs.h +0
-0@@ -462,6 +462,15 @@#define ZCR_ELx_LEN_SIZE 9#define ZCR_ELx_LEN_MASK 0x1ff
Quoted 6 lines
xen/arch/arm/include/asm/arm64/sysregs.h line 470
Quoted 6 lines
xen/arch/arm/include/asm/arm64/sysregs.h +6
-0+#define REGION_TEXT_PRBAR 0x38/* SH=11 AP=10 XN=00 */ +#define REGION_RO_PRBAR 0x3A/* SH=11 AP=10 XN=10 */ +#define REGION_DATA_PRBAR 0x32/* SH=11 AP=00 XN=10 */ +#define REGION_DEVICE_PRBAR 0x22/* SH=10 AP=00 XN=10 */ + +#define WRITE_SYSREG_ASM (v, name) "msr " __stringify(name,) #v;
Agreed with your other points.
Quoted 1 line
1) This macro is ASM only and you don't protect it like the C macros below. Why?
I have a weak argument for this. :)
You can write ""msr " __stringify(name,) #v" in the C files. However, you cannot write "uint64_t _r ....." in the assembly files.
If you strongly prefer, I can enclose this within #ifdef __ASSEMBLY__
Quoted 1 line
2) Semicolon not needed at the end
Ack.
- Ayan
Quoted 3 lines
~Michal
Re: [PATCH v5 1/3] xen/arm: Move some of the functions to common file
In reply to Ayan Kumar HalderHi Ayan,
Quoted 8 lines · Ayan Kumar Halder
Added a new file common.inc to hold the common earlyboot MPU regions configurations across arm64 and arm32.
prepare_xen_region,fail_insufficient_regions()will be used by both arm32 and arm64. Thus, they have been moved to common.inc.
Quoted 9 lines
*_PRBARare moved toarm64/sysregs.h.*_PRLARare moved to common.inc as they are common between arm32 and arm64.Introduce
WRITE_SYSREG_ASMto write to the system registers from the common asm file.Signed-off-by Ayan Kumar Halder <[email protected]>—
Provided that you fix Michal’s comment about file name (even if {mpu-}common.inc is more flexible and would not need any renaming in case additional code is added that doesn’t involve region manipulation, but at this stage I can’t foresee any) and protect the asm macro:
Please keep it if you change the code for the above comment.
Cheers,
Luca
PATCH v5 2/3 xen/arm32: Create the same boot-time MPU regions as arm64
In reply to Ayan Kumar HalderWe have created the same boot-time MPU protection regions as Armv8-R AArch64. Also, we have defined *_PRBAR macros for arm32. The only difference from arm64 is that XN is 1-bit for arm32.
The macros have been defined in mpu/cpregs.h.
Also defined WRITE_SYSREG_ASM() to write to system registers in assembly.
---
Changes from
v1 -
1. enable_mpu() now sets HMAIR{0,1} registers. This is similar to what is being done in enable_mmu(). All the mm related configurations happen in this function.
2. Fixed some typos.
v2 -
1. Include the common prepare_xen_region.inc in head.S.
2. Define LOAD_SYSREG()/STORE_SYSREG() for arm32.
v3 -
1. Rename STORE_SYSREG() as WRITE_SYSREG_ASM()
2. enable_boot_cpu_mm() is defined in head.S
v4 -
1. *_PRBAR is moved to arm32/sysregs.h.
2. MPU specific CP15 system registers are defined in mpu/cpregs.h.
xen/arch/arm/arm32/Makefile | 1 + xen/arch/arm/arm32/mpu/Makefile | 1 + xen/arch/arm/arm32/mpu/head.S | 101 +++++++++++++++++++++++ xen/arch/arm/include/asm/arm32/sysregs.h | 7 ++ xen/arch/arm/include/asm/cpregs.h | 4 + xen/arch/arm/include/asm/mpu/cpregs.h | 24 ++++++ 6 files changed, 138 insertions(+) create mode 100644 xen/arch/arm/arm32/mpu/Makefile create mode 100644 xen/arch/arm/arm32/mpu/head.S create mode 100644 xen/arch/arm/include/asm/mpu/cpregs.h
xen/arch/arm/arm32/Makefile +1 -0
@@ -1,5 +1,6 @@ obj-y += lib/ obj-$(CONFIG_MMU) += mmu/ +obj-$(CONFIG_MPU) += mpu/ obj-$(CONFIG_EARLY_PRINTK) += debug.o obj-y += domctl.o
xen/arch/arm/arm32/mpu/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-y += head.o
xen/arch/arm/arm32/mpu/head.S new file +101 -0
101 lines not on this page · raw message
xen/arch/arm/include/asm/arm32/sysregs.h +7 -0
@@ -20,6 +20,13 @@* uses r0 as a placeholder register. */ #define CMD_CP32(name...) "mcr " __stringify(CP32(r0, name)) ";" +#define REGION_TEXT_PRBAR 0x18/* SH=11 AP=10 XN=0 */ +#define REGION_RO_PRBAR 0x1D/* SH=11 AP=10 XN=1 */ +#define REGION_DATA_PRBAR 0x19/* SH=11 AP=00 XN=1 */ +#define REGION_DEVICE_PRBAR 0x11/* SH=10 AP=00 XN=1 */ + +#define WRITE_SYSREG_ASM (v, name) mcr CP32(v, name) +#ifndef __ASSEMBLY__/* C wrappers */
xen/arch/arm/include/asm/cpregs.h +4 -0
@@ -1,6 +1,10 @@#ifndef __ASM_ARM_CPREGS_H#define __ASM_ARM_CPREGS_H +#ifdef CONFIG_MPU +#include <asm/mpu/cpregs.h> +#endif +/* * AArch32 Co-processor registers. *
xen/arch/arm/include/asm/mpu/cpregs.h new file +24 -0
@@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef __ASM_ARM_MPU_CPREGS_H +#define __ASM_ARM_MPU_CPREGS_H + +/* CP15 CR0: MPU Type Register */ +#define HMPUIR p15,4,c0,c0,4 + +/* CP15 CR6: MPU Protection Region Base/Limit/Select Address Register */ +#define HPRSELR p15,4,c6,c2,1 +#define PRBAR_EL2 p15,4,c6,c3,0 +#define PRLAR_EL2 p15,4,c6,c8,1 + +#define MPUIR_EL2 HMPUIR +#define PRSELR_EL2 HPRSELR + +#endif /* __ASM_ARM_MPU_CPREGS_H */ + +/* +* Local variables: +* mode: ASM +* indent-tabs-mode: nil +* End: +*/
Signature · 1 line
2.25.1
Re: [PATCH v5 2/3] xen/arm32: Create the same boot-time MPU regions as arm64
Hi Ayan,
Quoted 12 lines · Ayan Kumar Halder
We have created the same boot-time MPU protection regions as Armv8-R AArch64. Also, we have defined
*_PRBARmacros for arm32. The only difference from arm64 is that XN is 1-bit for arm32.
The macros have been defined inmpu/cpregs.h.Also defined
WRITE_SYSREG_ASM()to write to system registers in assembly.Signed-off-by Ayan Kumar Halder <[email protected]>---
[…]
Quoted 5 lines
xen/arch/arm/include/asm/arm32/sysregs.h +0
-0
xen/arch/arm/include/asm/arm32/sysregs.h line 28
Quoted 9 lines
xen/arch/arm/include/asm/arm32/sysregs.h +6
-0@@ -20,6 +20,13 @@* uses r0 as a placeholder register. */ #define CMD_CP32(name...) "mcr " __stringify(CP32(r0, name)) ";" +#define REGION_TEXT_PRBAR 0x18/* SH=11 AP=10 XN=0 */ +#define REGION_RO_PRBAR 0x1D/* SH=11 AP=10 XN=1 */ +#define REGION_DATA_PRBAR 0x19/* SH=11 AP=00 XN=1 */ +#define REGION_DEVICE_PRBAR 0x11/* SH=10 AP=00 XN=1 */ + +#define WRITE_SYSREG_ASM (v, name) mcr CP32(v, name)
probably the same applies to this patch, this one needs to stay where __ASSEMBLY__ is defined?
The rest looks good to me!
Cheers,
Luca
Re: [PATCH v5 2/3] xen/arm32: Create the same boot-time MPU regions as arm64
In reply to Ayan Kumar HalderQuoted 4 lines · Ayan Kumar Halder
We have created the same boot-time MPU protection regions as Armv8-R AArch64. Also, we have defined
*_PRBARmacros for arm32. The only difference from arm64 is that XN is 1-bit for arm32.
The macros have been defined inmpu/cpregs.h.
NIT: Describe your changes in imperative mood
Quoted 65 lines
Also defined
WRITE_SYSREG_ASM()to write to system registers in assembly.Signed-off-by Ayan Kumar Halder <[email protected]>---
Changes fromv1 -
1.
enable_mpu()now sets HMAIR{0,1} registers. This is similar to what is being done inenable_mmu(). All the mm related configurations happen in this function.2. Fixed some typos.
v2 -
1. Include the common prepare_xen_region.inc inhead.S.2. Define LOAD_SYSREG()/STORE_SYSREG() for arm32.
v3 -
1. RenameSTORE_SYSREG()asWRITE_SYSREG_ASM()2.
enable_boot_cpu_mm()is defined inhead.Sv4 -
1.*_PRBARis moved toarm32/sysregs.h.2. MPU specific CP15 system registers are defined in
mpu/cpregs.h.xen/arch/arm/arm32/Makefile | 1 + xen/arch/arm/arm32/mpu/Makefile | 1 + xen/arch/arm/arm32/mpu/head.S | 101 +++++++++++++++++++++++ xen/arch/arm/include/asm/arm32/sysregs.h | 7 ++ xen/arch/arm/include/asm/cpregs.h | 4 + xen/arch/arm/include/asm/mpu/cpregs.h | 24 ++++++ 6 files changed, 138 insertions(+) create mode 100644 xen/arch/arm/arm32/mpu/Makefile create mode 100644 xen/arch/arm/arm32/mpu/head.S create mode 100644 xen/arch/arm/include/asm/mpu/cpregs.hxen/arch/arm/arm32/Makefile +1
-0@@ -1,5 +1,6 @@ obj-y += lib/ obj-$(CONFIG_MMU) += mmu/ +obj-$(CONFIG_MPU) += mpu/ obj-$(CONFIG_EARLY_PRINTK) += debug.o obj-y += domctl.oxen/arch/arm/arm32/mpu/Makefile new file +1
-0@@ -0,0 +1 @@ +obj-y += head.oxen/arch/arm/arm32/mpu/head.S new file +0
-0
xen/arch/arm/arm32/mpu/head.S line 3
Quoted 3 lines
xen/arch/arm/arm32/mpu/head.S new file +3
-0@@ -0,0 +1,101 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Start-of-day code for an Armv8-R MPU system.
That's exactly the same text as for Aarch64. At least write Armv8A-R-AArch32.
Quoted 12 lines
xen/arch/arm/arm32/mpu/head.S new file +12
-0+ */ + +#include <asm/arm32/macros.h> +#include <asm/mpu/common.inc> +#include <asm/page.h> + +/* + * Set up the memory attribute type tables and enable EL2 MPU and data cache. + * If the Background region is enabled, then the MPU uses the default memory + * map as the Background region for generating the memory + * attributes when MPU is disabled. + * Since the default memory map of the Armv8-R AArch32 architecture is
xen/arch/arm/arm32/mpu/head.S line 25
Quoted 10 lines
xen/arch/arm/arm32/mpu/head.S new file +10
-0+ * IMPLEMENTATION DEFINED, we intend to turn off the Background region here. + * + * Clobbers r0 - r1 + */ +FUNC_LOCAL(enable_mpu) + /* Set up memory attribute type tables */ + mov_w r0, MAIR0VAL + mov_w r1, MAIR1VAL + mcr CP32(r0, HMAIR0) + mcr CP32(r1, HMAIR1)
Is there really a need to do these 2 writes one after another? Why can't we use only r0 and save one clobbered reg? mov_w r0, MAIR0VAL
mcr CP32(r0, HMAIR0)mov_w r0, MAIR1VAL
mcr CP32(r0, HMAIR1)
Quoted 81 lines
xen/arch/arm/arm32/mpu/head.S new file +76
-0+ + mrc CP32(r0, HSCTLR) + bic r0, r0, #SCTLR_ELx_BR /* Disable Background region */ + orr r0, r0, #SCTLR_Axx_ELx_M /* Enable MPU */ + orr r0, r0, #SCTLR_Axx_ELx_C /* Enable D-cache */ + mcr CP32(r0, HSCTLR) + isb + + ret +END(enable_mpu) + +/* + * Maps the various sections of Xen (described in xen.lds.S) as different MPU + * regions. + * + * Clobbers r0 - r5 + * + */ +FUNC(enable_boot_cpu_mm) + /* Get the number of regions specified in MPUIR_EL2 */ + mrc CP32(r5, MPUIR_EL2) + and r5, r5, #NUM_MPU_REGIONS_MASK + + /* x0: region sel */ + mov r0, #0 + /* Xen text section. */ + mov_w r1, _stext + mov_w r2, _etext + prepare_xen_region r0, r1, r2, r3, r4, r5, attr_prbar=REGION_TEXT_PRBAR + + /* Xen read-only data section. */ + mov_w r1, _srodata + mov_w r2, _erodata + prepare_xen_region r0, r1, r2, r3, r4, r5, attr_prbar=REGION_RO_PRBAR + + /* Xen read-only after init and data section. (RW data) */ + mov_w r1, __ro_after_init_start + mov_w r2, __init_begin + prepare_xen_region r0, r1, r2, r3, r4, r5 + + /* Xen code section. */ + mov_w r1, __init_begin + mov_w r2, __init_data_begin + prepare_xen_region r0, r1, r2, r3, r4, r5, attr_prbar=REGION_TEXT_PRBAR + + /* Xen data and BSS section. */ + mov_w r1, __init_data_begin + mov_w r2, __bss_end + prepare_xen_region r0, r1, r2, r3, r4, r5 + +#ifdef CONFIG_EARLY_PRINTK + /* Xen early UART section. */ + mov_w r1, CONFIG_EARLY_UART_BASE_ADDRESS + mov_w r2, (CONFIG_EARLY_UART_BASE_ADDRESS + CONFIG_EARLY_UART_SIZE) + prepare_xen_region r0, r1, r2, r3, r4, r5, attr_prbar=REGION_DEVICE_PRBAR, attr_prlar=REGION_DEVICE_PRLAR +#endif + + b enable_mpu +END(enable_boot_cpu_mm) + +/* + * We don't yet support secondary CPUs bring-up. Implement a dummy helper to + * please the common code. + */ +FUNC(enable_secondary_cpu_mm) + PRINT("- SMP not enabled yet -\r\n") +1: wfe + b 1b +END(enable_secondary_cpu_mm) + +/* + * Local variables: + * mode: ASM + * indent-tabs-mode: nil + * End: + */xen/arch/arm/include/asm/arm32/sysregs.h +0
-0
xen/arch/arm/include/asm/arm32/sysregs.h line 28
Quoted 9 lines
xen/arch/arm/include/asm/arm32/sysregs.h +6
-0@@ -20,6 +20,13 @@* uses r0 as a placeholder register. */ #define CMD_CP32(name...) "mcr " __stringify(CP32(r0, name)) ";" +#define REGION_TEXT_PRBAR 0x18/* SH=11 AP=10 XN=0 */ +#define REGION_RO_PRBAR 0x1D/* SH=11 AP=10 XN=1 */ +#define REGION_DATA_PRBAR 0x19/* SH=11 AP=00 XN=1 */ +#define REGION_DEVICE_PRBAR 0x11/* SH=10 AP=00 XN=1 */ + +#define WRITE_SYSREG_ASM (v, name) mcr CP32(v, name)
Same comment as for previous patch.
xen/arch/arm/include/asm/cpregs.h line 4
Quoted 13 lines
xen/arch/arm/include/asm/arm32/sysregs.h +1
-0+#ifndef __ASSEMBLY__/* C wrappers */ xen/arch/arm/include/asm/cpregs.h +1
-0@@ -1,6 +1,10 @@#ifndef __ASM_ARM_CPREGS_H#define __ASM_ARM_CPREGS_H +#ifdef CONFIG_MPU
NIT: Do we really need to protect this include? I thought we do the ifdefery if we need to include either mmu or mpu. Here we don't have a choice and afaict there's nothing problematic in mpu/cpregs.h
Quoted 17 lines
xen/arch/arm/include/asm/cpregs.h +3
-0+#include <asm/mpu/cpregs.h> +#endif +/* * AArch32 Co-processor registers. * xen/arch/arm/include/asm/mpu/cpregs.h new file +5
-0@@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef __ASM_ARM_MPU_CPREGS_H +#define __ASM_ARM_MPU_CPREGS_H +
xen/arch/arm/include/asm/mpu/cpregs.h line 15
Quoted 10 lines
xen/arch/arm/include/asm/mpu/cpregs.h new file +10
-0+/* CP15 CR0: MPU Type Register */ +#define HMPUIR p15,4,c0,c0,4 + +/* CP15 CR6: MPU Protection Region Base/Limit/Select Address Register */ +#define HPRSELR p15,4,c6,c2,1 +#define PRBAR_EL2 p15,4,c6,c3,0 +#define PRLAR_EL2 p15,4,c6,c8,1 + +#define MPUIR_EL2 HMPUIR +#define PRSELR_EL2 HPRSELR
AFAIK, these macros are there to use AArch64 sysreg names in common code when compiling Arm32. This would mean they should be protected with #ifdef CONFIG_ARM_32.
~Michal
Re: [PATCH v5 2/3] xen/arm32: Create the same boot-time MPU regions as arm64
Hi,
Quoted 68 lines · Michal
Quoted 4 lines · Ayan Kumar Halder
We have created the same boot-time MPU protection regions as Armv8-R AArch64. Also, we have defined
*_PRBARmacros for arm32. The only difference from arm64 is that XN is 1-bit for arm32.
The macros have been defined inmpu/cpregs.h.NIT: Describe your changes in imperative mood
Quoted 60 lines
Also defined
WRITE_SYSREG_ASM()to write to system registers in assembly.Signed-off-by Ayan Kumar Halder <[email protected]>---
Changes fromv1 -
1.
enable_mpu()now sets HMAIR{0,1} registers. This is similar to what is being done inenable_mmu(). All the mm related configurations happen in this function.2. Fixed some typos.
v2 -
1. Include the common prepare_xen_region.inc inhead.S.2. Define LOAD_SYSREG()/STORE_SYSREG() for arm32.
v3 -
1. RenameSTORE_SYSREG()asWRITE_SYSREG_ASM()2.
enable_boot_cpu_mm()is defined inhead.Sv4 -
1.*_PRBARis moved toarm32/sysregs.h.2. MPU specific CP15 system registers are defined in
mpu/cpregs.h.xen/arch/arm/arm32/Makefile | 1 + xen/arch/arm/arm32/mpu/Makefile | 1 + xen/arch/arm/arm32/mpu/head.S | 101 +++++++++++++++++++++++ xen/arch/arm/include/asm/arm32/sysregs.h | 7 ++ xen/arch/arm/include/asm/cpregs.h | 4 + xen/arch/arm/include/asm/mpu/cpregs.h | 24 ++++++ 6 files changed, 138 insertions(+)create mode 100644 xen/arch/arm/arm32/mpu/Makefile create mode 100644
xen/arch/arm/arm32/mpu/head.Screate mode 100644xen/arch/arm/include/asm/mpu/cpregs.hxen/arch/arm/arm32/Makefile +1
-0@@ -1,5 +1,6 @@ obj-y += lib/ obj-$(CONFIG_MMU) += mmu/ +obj-$(CONFIG_MPU) += mpu/ obj-$(CONFIG_EARLY_PRINTK) += debug.o obj-y += domctl.oxen/arch/arm/arm32/mpu/Makefile new file +1
-0@@ -0,0 +1 @@ +obj-y += head.oxen/arch/arm/arm32/mpu/head.S new file +0
-0
Quoted 8 lines
xen/arch/arm/arm32/mpu/head.S line 3
Quoted 7 lines
index 0000000000..84e9f1f8ec
xen/arch/arm/arm32/mpu/head.S new file +3
-0@@ -0,0 +1,101 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Start-of-day code for an Armv8-R MPU system.That's exactly the same text as for Aarch64. At least write Armv8A-R-AArch32.
Ack
Quoted 21 lines
Quoted 21 lines
xen/arch/arm/arm32/mpu/head.S new file +20
-0+ */ + +#include <asm/arm32/macros.h> +#include <asm/mpu/common.inc> +#include <asm/page.h> + +/* + * Set up the memory attribute type tables and enable EL2 MPU and data cache. + * If the Background region is enabled, then the MPU uses the default memory + * map as the Background region for generating the memory + * attributes when MPU is disabled. + * Since the default memory map of the Armv8-R AArch32 architecture is + * IMPLEMENTATION DEFINED, we intend to turn off the Background region here. + * + * Clobbers r0 - r1 + */ +FUNC_LOCAL(enable_mpu) + /* Set up memory attribute type tables */ + mov_w r0, MAIR0VAL + mov_w r1, MAIR1VAL
Quoted 8 lines
xen/arch/arm/arm32/mpu/head.S line 25
Quoted 2 lines
xen/arch/arm/arm32/mpu/head.S new file +2
-0+ mcr CP32(r0, HMAIR0) + mcr CP32(r1, HMAIR1)Is there really a need to do these 2 writes one after another? Why can't we use only r0 and save one clobbered reg?
mov_wr0, MAIR0VAL
mcrCP32(r0, HMAIR0)mov_wr0, MAIR1VAL
mcrCP32(r0, HMAIR1)
I just copied it as it is from head.S. :) I will change it in v6.
Quoted 85 lines
Quoted 85 lines
xen/arch/arm/arm32/mpu/head.S new file +76
-0+ + mrc CP32(r0, HSCTLR) + bic r0, r0, #SCTLR_ELx_BR /* Disable Background region */ + orr r0, r0, #SCTLR_Axx_ELx_M /* Enable MPU */ + orr r0, r0, #SCTLR_Axx_ELx_C /* Enable D-cache */ + mcr CP32(r0, HSCTLR) + isb + + ret +END(enable_mpu) + +/* + * Maps the various sections of Xen (described in xen.lds.S) as different MPU + * regions. + * + * Clobbers r0 - r5 + * + */ +FUNC(enable_boot_cpu_mm) + /* Get the number of regions specified in MPUIR_EL2 */ + mrc CP32(r5, MPUIR_EL2) + and r5, r5, #NUM_MPU_REGIONS_MASK + + /* x0: region sel */ + mov r0, #0 + /* Xen text section. */ + mov_w r1, _stext + mov_w r2, _etext + prepare_xen_region r0, r1, r2, r3, r4, r5, attr_prbar=REGION_TEXT_PRBAR + + /* Xen read-only data section. */ + mov_w r1, _srodata + mov_w r2, _erodata + prepare_xen_region r0, r1, r2, r3, r4, r5, attr_prbar=REGION_RO_PRBAR + + /* Xen read-only after init and data section. (RW data) */ + mov_w r1, __ro_after_init_start + mov_w r2, __init_begin + prepare_xen_region r0, r1, r2, r3, r4, r5 + + /* Xen code section. */ + mov_w r1, __init_begin + mov_w r2, __init_data_begin + prepare_xen_region r0, r1, r2, r3, r4, r5, attr_prbar=REGION_TEXT_PRBAR + + /* Xen data and BSS section. */ + mov_w r1, __init_data_begin + mov_w r2, __bss_end + prepare_xen_region r0, r1, r2, r3, r4, r5 + +#ifdef CONFIG_EARLY_PRINTK + /* Xen early UART section. */ + mov_w r1, CONFIG_EARLY_UART_BASE_ADDRESS + mov_w r2, (CONFIG_EARLY_UART_BASE_ADDRESS + CONFIG_EARLY_UART_SIZE) + prepare_xen_region r0, r1, r2, r3, r4, r5, attr_prbar=REGION_DEVICE_PRBAR, attr_prlar=REGION_DEVICE_PRLAR +#endif + + b enable_mpu +END(enable_boot_cpu_mm) + +/* + * We don't yet support secondary CPUs bring-up. Implement a dummy helper to + * please the common code. + */ +FUNC(enable_secondary_cpu_mm) + PRINT("- SMP not enabled yet -\r\n") +1: wfe + b 1b +END(enable_secondary_cpu_mm) + +/* + * Local variables: + * mode: ASM + * indent-tabs-mode: nil + * End: + */xen/arch/arm/include/asm/arm32/sysregs.h +0
-0@@ -20,6 +20,13 @@* uses r0 as a placeholder register. */ #define CMD_CP32(name...) "mcr " __stringify(CP32(r0, name)) ";"
Quoted 7 lines
xen/arch/arm/include/asm/arm32/sysregs.h line 28
Quoted 6 lines
xen/arch/arm/include/asm/arm32/sysregs.h +6
-0+#define REGION_TEXT_PRBAR 0x18/* SH=11 AP=10 XN=0 */ +#define REGION_RO_PRBAR 0x1D/* SH=11 AP=10 XN=1 */ +#define REGION_DATA_PRBAR 0x19/* SH=11 AP=00 XN=1 */ +#define REGION_DEVICE_PRBAR 0x11/* SH=10 AP=00 XN=1 */ + +#define WRITE_SYSREG_ASM (v, name) mcr CP32(v, name)Same comment as for previous patch.
Ack.
Quoted 13 lines
Quoted 13 lines
xen/arch/arm/include/asm/arm32/sysregs.h +1
-0+#ifndef __ASSEMBLY__/* C wrappers */ xen/arch/arm/include/asm/cpregs.h +0
-0@@ -1,6 +1,10 @@#ifndef __ASM_ARM_CPREGS_H#define __ASM_ARM_CPREGS_H
Quoted 4 lines
xen/arch/arm/include/asm/cpregs.h line 4
Quoted 1 line
xen/arch/arm/include/asm/cpregs.h +1
-0+#ifdef CONFIG_MPU NIT: Do we really need to protect this include? I thought we do the ifdefery if we need to include either mmu or mpu. Here we don't have a choice and afaict there's nothing problematic in
mpu/cpregs.h
Ack.
Quoted 22 lines
Quoted 22 lines
xen/arch/arm/include/asm/cpregs.h +3
-0+#include <asm/mpu/cpregs.h> +#endif +/* * AArch32 Co-processor registers. * xen/arch/arm/include/asm/mpu/cpregs.h new file +9
-0@@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef __ASM_ARM_MPU_CPREGS_H +#define __ASM_ARM_MPU_CPREGS_H + +/* CP15 CR0: MPU Type Register */ +#define HMPUIR p15,4,c0,c0,4 + +/* CP15 CR6: MPU Protection Region Base/Limit/Select Address Register */
Quoted 8 lines
xen/arch/arm/include/asm/mpu/cpregs.h line 15
Quoted 6 lines
xen/arch/arm/include/asm/mpu/cpregs.h new file +6
-0+#define HPRSELR p15,4,c6,c2,1 +#define PRBAR_EL2 p15,4,c6,c3,0 +#define PRLAR_EL2 p15,4,c6,c8,1 + +#define MPUIR_EL2 HMPUIR +#define PRSELR_EL2 HPRSELRAFAIK, these macros are there to use AArch64 sysreg names in common code when compiling Arm32. This would mean they should be protected with #ifdef
CONFIG_ARM_32.
In the case of Arm64, the MPU system registers are defined by the compiler. So, these definitions are overridden.
I will enclose this within CONFIG_ARM_32 for better readability.
@Luca - I will keep your R-b unless you object. The changes are mostly style related. :)
- Ayan
Quoted 3 lines
~Michal
PATCH v5 3/3 xen/arm32: mpu: Stubs to build MPU for arm32
In reply to Ayan Kumar HalderAdd stubs to enable compilation
---
Changes from :-
v1, v2 -
1. New patch introduced in v3.
2. Should be applied on top of
https://patchwork.kernel.org/project/xen-devel/cover/[email protected]/
v3 -
1. Add stubs for map_domain_page() and similar functions.
2. 'BUG_ON("unimplemented")' is kept in all the stubs.
v4 -
1. is_xen_heap_mfn() macros are defined across mpu/mm.h (ARM32 specific) , mmu/mm.h (ARM32 specific) and asm/mm.h (ARM64 specific)
2. s/(void*)0/NULL
xen/arch/arm/arm32/mpu/Makefile | 2 ++ xen/arch/arm/arm32/mpu/p2m.c | 18 ++++++++++++++ xen/arch/arm/arm32/mpu/smpboot.c | 23 +++++++++++++++++ xen/arch/arm/include/asm/mm.h | 9 +------ xen/arch/arm/include/asm/mmu/mm.h | 9 +++++++ xen/arch/arm/include/asm/mpu/mm.h | 5 ++++ xen/arch/arm/mpu/Makefile | 1 + xen/arch/arm/mpu/domain_page.c | 41 +++++++++++++++++++++++++++++++ 8 files changed, 100 insertions(+), 8 deletions(-) create mode 100644 xen/arch/arm/arm32/mpu/p2m.c create mode 100644 xen/arch/arm/arm32/mpu/smpboot.c create mode 100644 xen/arch/arm/mpu/domain_page.c
xen/arch/arm/arm32/mpu/Makefile +2 -0
@@ -1 +1,3 @@ obj-y += head.o +obj-y += smpboot.o +obj-y += p2m.o
xen/arch/arm/arm32/mpu/p2m.c new file +18 -0
@@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <xen/init.h> +#include <asm/p2m.h> + +void __init setup_virt_paging (void ) +{ +BUG_ON ("unimplemented" ); +} + +/* +* Local variables: +* mode: C +* c-file-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
xen/arch/arm/arm32/mpu/smpboot.c new file +23 -0
@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <xen/mm.h> + +int prepare_secondary_mm (int cpu) +{ +BUG_ON ("unimplemented" ); +return -EINVAL ; +} + +void update_boot_mapping (bool enable) +{ +BUG_ON ("unimplemented" ); +} + +/* +* Local variables: +* mode: C +* c-file-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
xen/arch/arm/include/asm/mm.h +1 -8
@@ -170,14 +170,7 @@ struct page_info#define _PGC_need_scrub _PGC_allocated#define PGC_need_scrub PGC_allocated -#ifdef CONFIG_ARM_32 -#define is_xen_heap_page (page) is_xen_heap_mfn(page_to_mfn(page)) -#define is_xen_heap_mfn (mfn) ({ \ - unsigned long mfn_ = mfn_x(mfn); \ - (mfn_ >= mfn_x(directmap_mfn_start) && \ - mfn_ < mfn_x(directmap_mfn_end)); \ -}) -#else +#ifdef CONFIG_ARM_64 #define is_xen_heap_page (page) ((page)->count_info & PGC_xen_heap)#define is_xen_heap_mfn (mfn) \ (mfn_valid(mfn) && is_xen_heap_page(mfn_to_page(mfn)))
xen/arch/arm/include/asm/mmu/mm.h +9 -0
@@ -21,6 +21,15 @@ extern unsigned long directmap_base_pdx;#define frame_table ((struct page_info *)FRAMETABLE_VIRT_START) +#ifdef CONFIG_ARM_32 +#define is_xen_heap_page (page) is_xen_heap_mfn(page_to_mfn(page)) +#define is_xen_heap_mfn (mfn) ({ \ + unsigned long mfn_ = mfn_x(mfn); \ + (mfn_ >= mfn_x(directmap_mfn_start) && \ + mfn_ < mfn_x(directmap_mfn_end)); \ +}) +#endif +#define virt_to_maddr (va) ({ \ vaddr_t va_ = (vaddr_t)(va); \ (paddr_t)((va_to_par(va_) & PADDR_MASK & PAGE_MASK) | (va_ & ~PAGE_MASK)); \
xen/arch/arm/include/asm/mpu/mm.h +5 -0
@@ -13,6 +13,11 @@ extern struct page_info *frame_table;#define virt_to_maddr (va) ((paddr_t)((vaddr_t)(va) & PADDR_MASK)) +#ifdef CONFIG_ARM_32 +#define is_xen_heap_page (page) ({ BUG_ON("unimplemented"); false; }) +#define is_xen_heap_mfn (mfn) ({ BUG_ON("unimplemented"); false; }) +#endif +/* On MPU systems there is no translation, ma == va. */ static inline void *maddr_to_virt (paddr_t ma) {
xen/arch/arm/mpu/Makefile +1 -0
@@ -2,3 +2,4 @@ obj-y += mm.o obj-y += p2m.o obj-y += setup.init.o obj-y += vmap.o +obj-$(CONFIG_ARM_32) += domain_page.o
xen/arch/arm/mpu/domain_page.c new file +41 -0
41 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [PATCH v5 3/3] xen/arm32: mpu: Stubs to build MPU for arm32
Hi Ayan,
Quoted 51 lines · Ayan Kumar Halder
Add stubs to enable compilation
Signed-off-by Ayan Kumar Halder <[email protected]>---
Changes from :-v1, v2 -
1. New patch introduced in v3.
2. Should be applied on top of
https://patchwork.kernel.org/project/xen-devel/cover/[email protected]/v3 -
1. Add stubs formap_domain_page()and similar functions.2. '
BUG_ON("unimplemented")' is kept in all the stubs.v4 -
1.is_xen_heap_mfn()macros are defined acrossmpu/mm.h(ARM32 specific) ,mmu/mm.h(ARM32 specific) andasm/mm.h(ARM64 specific)2. s/(void*)0/NULL
xen/arch/arm/arm32/mpu/Makefile | 2 ++ xen/arch/arm/arm32/mpu/p2m.c | 18 ++++++++++++++ xen/arch/arm/arm32/mpu/smpboot.c | 23 +++++++++++++++++ xen/arch/arm/include/asm/mm.h | 9 +------ xen/arch/arm/include/asm/mmu/mm.h | 9 +++++++ xen/arch/arm/include/asm/mpu/mm.h | 5 ++++ xen/arch/arm/mpu/Makefile | 1 + xen/arch/arm/mpu/domain_page.c | 41 +++++++++++++++++++++++++++++++ 8 files changed, 100 insertions(+), 8 deletions(-)create mode 100644
xen/arch/arm/arm32/mpu/p2m.ccreate mode 100644xen/arch/arm/arm32/mpu/smpboot.ccreate mode 100644xen/arch/arm/mpu/domain_page.cxen/arch/arm/arm32/mpu/Makefile +0
-0@@ -1 +1,3 @@obj-y += head.o
xen/arch/arm/arm32/mpu/Makefile +2
-0+obj-y += smpboot.o +obj-y += p2m.oxen/arch/arm/arm32/mpu/p2m.c new file +0
-0
xen/arch/arm/arm32/mpu/p2m.c line 2
Quoted 2 lines
xen/arch/arm/arm32/mpu/p2m.c new file +2
-0@@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +
I would add:
#include <xen/bug.h>
for BUG()
Quoted 22 lines
xen/arch/arm/arm32/mpu/p2m.c new file +16
-0+#include <xen/init.h> +#include <asm/p2m.h> + +void __init setup_virt_paging (void ) +{ +BUG_ON ("unimplemented" ); +} + +/* +* Local variables: +* mode: C +* c-file-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/ xen/arch/arm/arm32/mpu/smpboot.c new file +0
-0
xen/arch/arm/arm32/mpu/smpboot.c line 2
Quoted 2 lines
xen/arch/arm/arm32/mpu/smpboot.c new file +2
-0@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +
I would add:
#include <xen/bug.h>
for BUG()
#include <xen/errno.h>
for EINVAL
#include <xen/stdbool.h>
for bool
Quoted 92 lines
xen/arch/arm/arm32/mpu/smpboot.c new file +21
-0+#include <xen/mm.h> + +int prepare_secondary_mm (int cpu) +{ +BUG_ON ("unimplemented" ); +return -EINVAL ; +} + +void update_boot_mapping (bool enable) +{ +BUG_ON ("unimplemented" ); +} + +/* +* Local variables: +* mode: C +* c-file-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/ xen/arch/arm/include/asm/mm.h +1
-8@@ -170,14 +170,7 @@ struct page_info#define _PGC_need_scrub _PGC_allocated#define PGC_need_scrub PGC_allocated -#ifdef CONFIG_ARM_32 -#define is_xen_heap_page (page) is_xen_heap_mfn(page_to_mfn(page)) -#define is_xen_heap_mfn (mfn) ({ \ - unsigned long mfn_ = mfn_x(mfn); \ - (mfn_ >= mfn_x(directmap_mfn_start) && \ - mfn_ < mfn_x(directmap_mfn_end)); \ -}) -#else +#ifdef CONFIG_ARM_64 #define is_xen_heap_page (page) ((page)->count_info & PGC_xen_heap)#define is_xen_heap_mfn (mfn) \ (mfn_valid(mfn) && is_xen_heap_page(mfn_to_page(mfn)))xen/arch/arm/include/asm/mmu/mm.h +9
-0@@ -21,6 +21,15 @@ extern unsigned long directmap_base_pdx;#define frame_table ((struct page_info *)FRAMETABLE_VIRT_START) +#ifdef CONFIG_ARM_32 +#define is_xen_heap_page (page) is_xen_heap_mfn(page_to_mfn(page)) +#define is_xen_heap_mfn (mfn) ({ \ + unsigned long mfn_ = mfn_x(mfn); \ + (mfn_ >= mfn_x(directmap_mfn_start) && \ + mfn_ < mfn_x(directmap_mfn_end)); \ +}) +#endif +#define virt_to_maddr (va) ({ \ vaddr_t va_ = (vaddr_t)(va); \ (paddr_t)((va_to_par(va_) & PADDR_MASK & PAGE_MASK) | (va_ & ~PAGE_MASK)); \xen/arch/arm/include/asm/mpu/mm.h +5
-0@@ -13,6 +13,11 @@ extern struct page_info *frame_table;#define virt_to_maddr (va) ((paddr_t)((vaddr_t)(va) & PADDR_MASK)) +#ifdef CONFIG_ARM_32 +#define is_xen_heap_page (page) ({ BUG_ON("unimplemented"); false; }) +#define is_xen_heap_mfn (mfn) ({ BUG_ON("unimplemented"); false; }) +#endif +/* On MPU systems there is no translation, ma == va. */ static inline void *maddr_to_virt (paddr_t ma) {xen/arch/arm/mpu/Makefile +0
-0@@ -2,3 +2,4 @@ obj-y += mm.oobj-y += p2m.o
obj-y += setup.init.o
obj-y += vmap.oxen/arch/arm/mpu/Makefile +1
-0+obj-$(CONFIG_ARM_32) += domain_page.oxen/arch/arm/mpu/domain_page.c new file +0
-0
xen/arch/arm/mpu/domain_page.c line 2
Quoted 2 lines
xen/arch/arm/mpu/domain_page.c new file +2
-0@@ -0,0 +1,41 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#include <xen/domain_page.h>
I would add:
#include <xen/bug.h>
for BUG()
#include <xen/mm-frame.h>
for mfn_t and INVALID_MFN
#include <xen/types.h>
for NULL
Quoted 41 lines
xen/arch/arm/mpu/domain_page.c new file +39
-0+ +void *map_domain_page_global (mfn_t mfn) +{ +BUG_ON ("unimplemented" ); +return NULL ; +} + +/* Map a page of domheap memory */ +void *map_domain_page (mfn_t mfn) +{ +BUG_ON ("unimplemented" ); +return NULL ; +} + +/* Release a mapping taken with map_domain_page() */ +void unmap_domain_page (const void *ptr) +{ +BUG_ON ("unimplemented" ); +} + +mfn_t domain_page_map_to_mfn (const void *ptr) +{ +BUG_ON ("unimplemented" ); +return INVALID_MFN ; +} + +void unmap_domain_page_global (const void *va) +{ +BUG_ON ("unimplemented" ); +} + +/* +* Local variables: +* mode: C +* c-file-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/ Signature · 1 line
2.25.1
with the above addressed, at least for me it looks good!
Cheers,
Luca
Re: [PATCH v5 3/3] xen/arm32: mpu: Stubs to build MPU for arm32
In reply to Ayan Kumar HalderQuoted 1 line · Ayan Kumar Halder
Add stubs to enable compilation
NIT: missing dot at the end of sentence.
Quoted 39 lines
Signed-off-by Ayan Kumar Halder <[email protected]>---
Changes from :-v1, v2 -
1. New patch introduced in v3.
2. Should be applied on top of
https://patchwork.kernel.org/project/xen-devel/cover/[email protected]/v3 -
1. Add stubs formap_domain_page()and similar functions.2. '
BUG_ON("unimplemented")' is kept in all the stubs.v4 -
1.is_xen_heap_mfn()macros are defined acrossmpu/mm.h(ARM32 specific) ,mmu/mm.h(ARM32 specific) andasm/mm.h(ARM64 specific)2. s/(void*)0/NULL
xen/arch/arm/arm32/mpu/Makefile | 2 ++ xen/arch/arm/arm32/mpu/p2m.c | 18 ++++++++++++++ xen/arch/arm/arm32/mpu/smpboot.c | 23 +++++++++++++++++ xen/arch/arm/include/asm/mm.h | 9 +------ xen/arch/arm/include/asm/mmu/mm.h | 9 +++++++ xen/arch/arm/include/asm/mpu/mm.h | 5 ++++ xen/arch/arm/mpu/Makefile | 1 + xen/arch/arm/mpu/domain_page.c | 41 +++++++++++++++++++++++++++++++ 8 files changed, 100 insertions(+), 8 deletions(-) create mode 100644 xen/arch/arm/arm32/mpu/p2m.c create mode 100644 xen/arch/arm/arm32/mpu/smpboot.c create mode 100644 xen/arch/arm/mpu/domain_page.cxen/arch/arm/arm32/mpu/Makefile +0
-0
xen/arch/arm/arm32/mpu/Makefile line 3
Quoted 3 lines
xen/arch/arm/arm32/mpu/Makefile +2
-0@@ -1 +1,3 @@ obj-y += head.o +obj-y += smpboot.o +obj-y += p2m.o
Sort alphabetically. Always.
Quoted 59 lines
xen/arch/arm/arm32/mpu/p2m.c new file +18
-0@@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <xen/init.h> +#include <asm/p2m.h> + +void __init setup_virt_paging (void ) +{ +BUG_ON ("unimplemented" ); +} + +/* +* Local variables: +* mode: C +* c-file-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/ xen/arch/arm/arm32/mpu/smpboot.c new file +23
-0@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <xen/mm.h> + +int prepare_secondary_mm (int cpu) +{ +BUG_ON ("unimplemented" ); +return -EINVAL ; +} + +void update_boot_mapping (bool enable) +{ +BUG_ON ("unimplemented" ); +} + +/* +* Local variables: +* mode: C +* c-file-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/ xen/arch/arm/include/asm/mm.h +0
-0@@ -170,14 +170,7 @@ struct page_info#define _PGC_need_scrub _PGC_allocated
xen/arch/arm/include/asm/mm.h struct page_info · line 180
Quoted 10 lines
xen/arch/arm/include/asm/mm.h +0
-8#define PGC_need_scrub PGC_allocated -#ifdef CONFIG_ARM_32 -#define is_xen_heap_page (page) is_xen_heap_mfn(page_to_mfn(page)) -#define is_xen_heap_mfn (mfn) ({ \ - unsigned long mfn_ = mfn_x(mfn); \ - (mfn_ >= mfn_x(directmap_mfn_start) && \ - mfn_ < mfn_x(directmap_mfn_end)); \ -}) -#else
At first sight, it's not clear why we diverge here and move Arm32 but not Arm64. At least I'd expect some reasoning for this change in commit msg.
xen/arch/arm/include/asm/mmu/mm.h extern unsigned long directmap_base_pdx; · line 24
Quoted 13 lines
xen/arch/arm/include/asm/mm.h +1
-0+#ifdef CONFIG_ARM_64 #define is_xen_heap_page (page) ((page)->count_info & PGC_xen_heap)#define is_xen_heap_mfn (mfn) \ (mfn_valid(mfn) && is_xen_heap_page(mfn_to_page(mfn)))xen/arch/arm/include/asm/mmu/mm.h +1
-0@@ -21,6 +21,15 @@ extern unsigned long directmap_base_pdx;#define frame_table ((struct page_info *)FRAMETABLE_VIRT_START) +#ifdef CONFIG_ARM_32
Why another #ifdef if there is one a few lines below in this file (below virt_to_maddr)?
Quoted 32 lines
xen/arch/arm/include/asm/mmu/mm.h +8
-0+#define is_xen_heap_page (page) is_xen_heap_mfn(page_to_mfn(page)) +#define is_xen_heap_mfn (mfn) ({ \ + unsigned long mfn_ = mfn_x(mfn); \ + (mfn_ >= mfn_x(directmap_mfn_start) && \ + mfn_ < mfn_x(directmap_mfn_end)); \ +}) +#endif +#define virt_to_maddr (va) ({ \ vaddr_t va_ = (vaddr_t)(va); \ (paddr_t)((va_to_par(va_) & PADDR_MASK & PAGE_MASK) | (va_ & ~PAGE_MASK)); \xen/arch/arm/include/asm/mpu/mm.h +5
-0@@ -13,6 +13,11 @@ extern struct page_info *frame_table;#define virt_to_maddr (va) ((paddr_t)((vaddr_t)(va) & PADDR_MASK)) +#ifdef CONFIG_ARM_32 +#define is_xen_heap_page (page) ({ BUG_ON("unimplemented"); false; }) +#define is_xen_heap_mfn (mfn) ({ BUG_ON("unimplemented"); false; }) +#endif +/* On MPU systems there is no translation, ma == va. */ static inline void *maddr_to_virt (paddr_t ma) {xen/arch/arm/mpu/Makefile +0
-0
xen/arch/arm/mpu/Makefile obj-y += mm.o · line 5
Quoted 4 lines
xen/arch/arm/mpu/Makefile +1
-0@@ -2,3 +2,4 @@ obj-y += mm.o obj-y += p2m.o obj-y += setup.init.o obj-y += vmap.o +obj-$(CONFIG_ARM_32) += domain_page.o
Again, sort alphabetically.
xen/arch/arm/mpu/domain_page.c line 1
Quoted 7 lines
xen/arch/arm/mpu/domain_page.c new file +1
-0@@ -0,0 +1,41 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */
empty line here
Quoted 30 lines
xen/arch/arm/mpu/domain_page.c new file +30
-0+#include <xen/domain_page.h> + +void *map_domain_page_global (mfn_t mfn) +{ +BUG_ON ("unimplemented" ); +return NULL ; +} + +/* Map a page of domheap memory */ +void *map_domain_page (mfn_t mfn) +{ +BUG_ON ("unimplemented" ); +return NULL ; +} + +/* Release a mapping taken with map_domain_page() */ +void unmap_domain_page (const void *ptr) +{ +BUG_ON ("unimplemented" ); +} + +mfn_t domain_page_map_to_mfn (const void *ptr) +{ +BUG_ON ("unimplemented" ); +return INVALID_MFN ; +} + +void unmap_domain_page_global (const void *va) +{ +BUG_ON ("unimplemented" );
xen/arch/arm/mpu/domain_page.c line 41
Quoted 10 lines
xen/arch/arm/mpu/domain_page.c new file +10
-0+} + +/* +* Local variables: +* mode: C +* c-file-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
Additionally, take into account Luca remarks regarding headers.
~Michal
Re: [PATCH v5 3/3] xen/arm32: mpu: Stubs to build MPU for arm32
Hi,
Quoted 109 lines · Michal
Quoted 1 line · Ayan Kumar Halder
Add stubs to enable compilation
NIT: missing dot at the end of sentence.
Quoted 38 lines
Signed-off-by Ayan Kumar Halder <[email protected]>---
Changes from :-v1, v2 -
1. New patch introduced in v3.
2. Should be applied on top of
https://patchwork.kernel.org/project/xen-devel/cover/[email protected]/v3 -
1. Add stubs formap_domain_page()and similar functions.2. '
BUG_ON("unimplemented")' is kept in all the stubs.v4 -
1.is_xen_heap_mfn()macros are defined acrossmpu/mm.h(ARM32 specific) ,mmu/mm.h(ARM32 specific) andasm/mm.h(ARM64 specific)2. s/(void*)0/NULL
xen/arch/arm/arm32/mpu/Makefile | 2 ++ xen/arch/arm/arm32/mpu/p2m.c | 18 ++++++++++++++ xen/arch/arm/arm32/mpu/smpboot.c | 23 +++++++++++++++++ xen/arch/arm/include/asm/mm.h | 9 +------ xen/arch/arm/include/asm/mmu/mm.h | 9 +++++++ xen/arch/arm/include/asm/mpu/mm.h | 5 ++++ xen/arch/arm/mpu/Makefile | 1 + xen/arch/arm/mpu/domain_page.c | 41 +++++++++++++++++++++++++++++++ 8 files changed, 100 insertions(+), 8 deletions(-)create mode 100644
xen/arch/arm/arm32/mpu/p2m.ccreate mode 100644xen/arch/arm/arm32/mpu/smpboot.ccreate mode 100644xen/arch/arm/mpu/domain_page.cxen/arch/arm/arm32/mpu/Makefile +0
-0xen/arch/arm/arm32/mpu/Makefile line 3
Quoted 3 lines
xen/arch/arm/arm32/mpu/Makefile +2
-0@@ -1 +1,3 @@ obj-y += head.o +obj-y += smpboot.o +obj-y += p2m.oSort alphabetically. Always.
Quoted 61 lines
xen/arch/arm/arm32/mpu/p2m.c new file +18
-0@@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <xen/init.h> +#include <asm/p2m.h> + +void __init setup_virt_paging (void ) +{ +BUG_ON ("unimplemented" ); +} + +/* +* Local variables: +* mode: C +* c-file-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/ xen/arch/arm/arm32/mpu/smpboot.c new file +23
-0@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <xen/mm.h> + +int prepare_secondary_mm (int cpu) +{ +BUG_ON ("unimplemented" ); +return -EINVAL ; +} + +void update_boot_mapping (bool enable) +{ +BUG_ON ("unimplemented" ); +} + +/* +* Local variables: +* mode: C +* c-file-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/ xen/arch/arm/include/asm/mm.h +0
-0@@ -170,14 +170,7 @@ struct page_info#define _PGC_need_scrub _PGC_allocated#define PGC_need_scrub PGC_allocated
Quoted 10 lines
xen/arch/arm/include/asm/mm.h struct page_info · line 180
Quoted 8 lines
xen/arch/arm/include/asm/mm.h +0
-8-#ifdef CONFIG_ARM_32 -#define is_xen_heap_page (page) is_xen_heap_mfn(page_to_mfn(page)) -#define is_xen_heap_mfn (mfn) ({ \ - unsigned long mfn_ = mfn_x(mfn); \ - (mfn_ >= mfn_x(directmap_mfn_start) && \ - mfn_ < mfn_x(directmap_mfn_end)); \ -}) -#else At first sight, it's not clear why we diverge here and move Arm32 but not Arm64. At least I'd expect some reasoning for this change in commit msg.
I added an explaination why the code is moved for Arm32 in my latest patch.
Quoted 11 lines
Quoted 11 lines
xen/arch/arm/include/asm/mm.h +1
-0+#ifdef CONFIG_ARM_64 #define is_xen_heap_page (page) ((page)->count_info & PGC_xen_heap)#define is_xen_heap_mfn (mfn) \ (mfn_valid(mfn) && is_xen_heap_page(mfn_to_page(mfn)))xen/arch/arm/include/asm/mmu/mm.h +0
-0@@ -21,6 +21,15 @@ extern unsigned long directmap_base_pdx;
Quoted 5 lines
xen/arch/arm/include/asm/mmu/mm.h extern unsigned long directmap_base_pdx; · line 24
Quoted 3 lines
xen/arch/arm/include/asm/mmu/mm.h +1
-0#define frame_table ((struct page_info *)FRAMETABLE_VIRT_START) +#ifdef CONFIG_ARM_32 Why another #ifdef if there is one a few lines below in this file (below
virt_to_maddr)?
Ack. I have moved it.
Quoted 81 lines
Quoted 33 lines
xen/arch/arm/include/asm/mmu/mm.h +8
-0+#define is_xen_heap_page (page) is_xen_heap_mfn(page_to_mfn(page)) +#define is_xen_heap_mfn (mfn) ({ \ + unsigned long mfn_ = mfn_x(mfn); \ + (mfn_ >= mfn_x(directmap_mfn_start) && \ + mfn_ < mfn_x(directmap_mfn_end)); \ +}) +#endif +#define virt_to_maddr (va) ({ \ vaddr_t va_ = (vaddr_t)(va); \ (paddr_t)((va_to_par(va_) & PADDR_MASK & PAGE_MASK) | (va_ & ~PAGE_MASK)); \xen/arch/arm/include/asm/mpu/mm.h +5
-0@@ -13,6 +13,11 @@ extern struct page_info *frame_table;#define virt_to_maddr (va) ((paddr_t)((vaddr_t)(va) & PADDR_MASK)) +#ifdef CONFIG_ARM_32 +#define is_xen_heap_page (page) ({ BUG_ON("unimplemented"); false; }) +#define is_xen_heap_mfn (mfn) ({ BUG_ON("unimplemented"); false; }) +#endif +/* On MPU systems there is no translation, ma == va. */ static inline void *maddr_to_virt (paddr_t ma) {xen/arch/arm/mpu/Makefile +0
-0xen/arch/arm/mpu/Makefile obj-y += mm.o · line 5
Quoted 4 lines
xen/arch/arm/mpu/Makefile +1
-0@@ -2,3 +2,4 @@ obj-y += mm.o obj-y += p2m.o obj-y += setup.init.o obj-y += vmap.o +obj-$(CONFIG_ARM_32) += domain_page.oAgain, sort alphabetically.
xen/arch/arm/mpu/domain_page.c line 1
Quoted 7 lines
xen/arch/arm/mpu/domain_page.c new file +1
-0@@ -0,0 +1,41 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ empty line here
Quoted 33 lines
xen/arch/arm/mpu/domain_page.c new file +33
-0+#include <xen/domain_page.h> + +void *map_domain_page_global (mfn_t mfn) +{ +BUG_ON ("unimplemented" ); +return NULL ; +} + +/* Map a page of domheap memory */ +void *map_domain_page (mfn_t mfn) +{ +BUG_ON ("unimplemented" ); +return NULL ; +} + +/* Release a mapping taken with map_domain_page() */ +void unmap_domain_page (const void *ptr) +{ +BUG_ON ("unimplemented" ); +} + +mfn_t domain_page_map_to_mfn (const void *ptr) +{ +BUG_ON ("unimplemented" ); +return INVALID_MFN ; +} + +void unmap_domain_page_global (const void *va) +{ +BUG_ON ("unimplemented" ); +} + +/*
Quoted 8 lines
xen/arch/arm/mpu/domain_page.c line 41
Quoted 7 lines
xen/arch/arm/mpu/domain_page.c new file +7
-0+* Local variables: +* mode: C +* c-file-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/ Additionally, take into account Luca remarks regarding headers.
Thanks Luca for spotting them.
I have addressed all the other comments.
- Ayan
Quoted 4 lines
~Michal
Hi Ayan,
Quoted 9 lines · Ayan Kumar Halder
Enable early booting of Armv8-R AArch32 based systems.
Ayan Kumar Halder (3):
xen/arm: Move some of the functions to common file xen/arm32: Create the same boot-time MPU regions as arm64 xen/arm32: mpu: Stubs to build MPU for arm32
I’ve tested this serie building arm64 & arm32 MPU & MMU architecture:
Cheers,
Luca