Hi Ayan,
> On 4 Mar 2025, at 11:55, Ayan Kumar Halder <ayank...@amd.com> wrote: > > Hi Luca, > > On 28/02/2025 16:18, Luca Fancellu wrote: >> CAUTION: This message has originated from an External Source. Please use >> proper judgment and caution when opening attachments, clicking links, or >> responding to this email. >> >> >> Introduce the MPU memory mapping flags in asm/page.h. >> >> Signed-off-by: Luca Fancellu <luca.fance...@arm.com> >> --- >> xen/arch/arm/include/asm/page.h | 25 +++++++++++++++++++++++++ >> 1 file changed, 25 insertions(+) >> >> diff --git a/xen/arch/arm/include/asm/page.h >> b/xen/arch/arm/include/asm/page.h >> index 69f817d1e68a..22f7d2c6cb30 100644 >> --- a/xen/arch/arm/include/asm/page.h >> +++ b/xen/arch/arm/include/asm/page.h >> @@ -62,6 +62,7 @@ >> >> #define MAIRVAL (MAIR1VAL << 32 | MAIR0VAL) >> >> +#ifdef CONFIG_MMU >> /* >> * Layout of the flags used for updating the hypervisor page tables >> * >> @@ -90,6 +91,30 @@ >> #define _PAGE_CONTIG_BIT 8 >> #define _PAGE_CONTIG (1U << _PAGE_CONTIG_BIT) >> >> +#else /* !CONFIG_MMU */ >> + >> +/* >> + * Layout of the flags used for updating MPU memory region attributes >> + * [0:2] Memory attribute Index >> + * [3:4] Execute Never >> + * [5:6] Access Permission >> + * [7] Region Present >> + */ >> +#define _PAGE_AI_BIT 0 >> +#define _PAGE_XN_BIT 3 >> +#define _PAGE_AP_BIT 5 >> +#define _PAGE_PRESENT_BIT 7 >> +#define _PAGE_AI (7U << _PAGE_AI_BIT) >> +#define _PAGE_XN (2U << _PAGE_XN_BIT) >> +#define _PAGE_RO (2U << _PAGE_AP_BIT) >> +#define _PAGE_PRESENT (1U << _PAGE_PRESENT_BIT) >> +#define PAGE_AI_MASK(x) (((x) >> _PAGE_AI_BIT) & 0x7U) >> +#define PAGE_XN_MASK(x) (((x) >> _PAGE_XN_BIT) & 0x3U) >> +#define PAGE_AP_MASK(x) (((x) >> _PAGE_AP_BIT) & 0x3U) >> +#define PAGE_RO_MASK(x) (((x) >> _PAGE_AP_BIT) & 0x2U) > > Can you point out to the references (in some Arm doc or somewhere) from where > you have picked these values ? > > Also, AFAICS you are not using these macros in your current patch serie. So > can you send this patch later (along with another patch showing the usage). I’ve used all of them in the following patches, the only one not used is _PAGE_PRESENT, but if possible I would like to keep it there as it will be used on the MPU subsystem management in order to signal to the subsystem if the mapping is to be created etc, so here we are trying to use the same interfaces of MMU in order to reuse the most of the common code. Cheers, Luca