Re: [PATCH v3 5/6] arm/mpu: Implement early_fdt_map support in MPU systems

2025-07-17 Thread Luca Fancellu
Hi Michal, > On 17 Jul 2025, at 14:00, Orzel, Michal wrote: > > > > On 17/07/2025 14:58, Hari Limaye wrote: >> Hi Michal, >> >>> On 17 Jul 2025, at 13:54, Orzel, Michal wrote: +/* + * DTB starting at a different address has been mapped, so destroy this + * be

Re: [ImageBuilder][PATCH] Fix DOM0_CMD options for early console

2025-07-16 Thread Luca Fancellu
(Arm64 does not have > earlyprintk), it should be just earlyprintk which will enable compiled > in (if at all) debug printk code. > > Signed-off-by: Michal Orzel > --- I’m not an ImageBuilder expert, but the change looks sensible to me: Reviewed-by: Luca Fancellu

Re: [PATCH 4/6] arm/mpu: Destroy an existing entry in Xen MPU memory mapping table

2025-07-02 Thread Luca Fancellu
Hi Ayan, > On 2 Jul 2025, at 14:11, Ayan Kumar Halder wrote: > > > On 01/07/2025 15:56, Hari Limaye wrote: >> >> Hi Ayan, >> > Hi Hari, >> >> Thank you for the review. I have just a couple of clarifications before I >> >> re-spin the series to address all the comments: >> >> > > -if (

Re: [PATCH] xen/arm: Fix booting hwdom/1:1 domU with CONFIG_GRANT_TABLE=n

2025-06-30 Thread Luca Fancellu
onditional allocation and configuration. > > Signed-off-by: Michal Orzel The patch looks good to me, I’ve reproduced locally the issue and tested that this patch solves it, using FVP. Reviewed-by: Luca Fancellu Tested-by: Luca Fancellu

Re: [PATCH v4 3/3] arm/mpu: Enable read/write to protection regions for arm32

2025-06-17 Thread Luca Fancellu
{get/set}_{base/limit}(), region_is_valid() for arm32. > Enable pr_of_addr() for arm32. > > The maximum number of regions supported is 255 (which corresponds to the > maximum value in HMPUIR). > > Signed-off-by: Ayan Kumar Halder > — This looks good to me! Reviewed-by: Luca Fancellu Cheers, Luca

Re: [PATCH] console: Do not duplicate early printk messages on conring flush

2025-06-17 Thread Luca Fancellu
ns(-) > This LGTM, I’ve also tested with fvp-base for arm64 with CONFIG_EARLY_PRINTK. Reviewed-by: Luca Fancellu Tested-by: Luca Fancellu Cheers, Luca

Re: [PATCH v3 6/6] arm/mpu: Enable read/write to protection regions for arm32

2025-06-15 Thread Luca Fancellu
Hi Ayan, > On 11 Jun 2025, at 15:35, Ayan Kumar Halder wrote: > > Define prepare_selector(), read_protection_region() and > write_protection_region() for arm32. Also, define > GENERATE_{READ/WRITE}_PR_REG_OTHERS to access MPU regions from 32 to 255. > > Enable pr_{get/set}_{base/limit}(), regio

Re: [PATCH v3 6/6] arm/mpu: Enable read/write to protection regions for arm32

2025-06-13 Thread Luca Fancellu
Hi Ayan, > On 11 Jun 2025, at 15:35, Ayan Kumar Halder wrote: > > Define prepare_selector(), read_protection_region() and > write_protection_region() for arm32. Also, define > GENERATE_{READ/WRITE}_PR_REG_OTHERS to access MPU regions from 32 to 255. > > Enable pr_{get/set}_{base/limit}(), regio

Re: [PATCH v3 2/6] arm/mpu: Provide and populate MPU C data structures

2025-06-13 Thread Luca Fancellu
lar} in arm32. Thus, 'prbar' has to be a even > numbered register and 'prlar' is the consecutively ordered register. > > Signed-off-by: Ayan Kumar Halder > --- This LGTM, I’ve also built for Arm64 and Arm32. Reviewed-by: Luca Fancellu

Re: [PATCH v3 1/6] arm/mpu: Introduce MPU memory region map structure

2025-06-13 Thread Luca Fancellu
n Kumar Halder LGTM! I’ve also built for Arm32 and Arm64. Reviewed-by: Luca Fancellu

Re: [PATCH v3 4/6] arm/mpu: Move the functions to arm64 specific files

2025-06-13 Thread Luca Fancellu
+ * regions, so in order to save the isb() overhead, change the PRSELR_EL2 > + * only when needed, so when the upper 4 bits of the selector will > change. > + */ > +cur_sel &= 0xF0U; > +if ( READ_SYSREG(PRSELR_EL2) != cur_sel ) > +{ > +WRITE_SYSREG(cur_sel, PRSELR_EL2); > +isb(); > +} > +*sel = *sel & 0xFU; This one is different in the original file (*sel &= 0xFU;) The rest looks good to me! With the above fixed: Reviewed-by: Luca Fancellu Cheers, Luca

Re: [PATCH v3 6/6] arm/mpu: Enable read/write to protection regions for arm32

2025-06-12 Thread Luca Fancellu
Hi Ayan, > On 11 Jun 2025, at 15:35, Ayan Kumar Halder wrote: > > Define prepare_selector(), read_protection_region() and > write_protection_region() for arm32. Also, define > GENERATE_{READ/WRITE}_PR_REG_OTHERS to access MPU regions from 32 to 255. > > Enable pr_{get/set}_{base/limit}(), regio

Re: [PATCH v3 3/6] arm/mpu: Move domain-page.c to arm32 specific dir

2025-06-11 Thread Luca Fancellu
Hi Ayan, > On 11 Jun 2025, at 15:35, Ayan Kumar Halder wrote: > > Create xen/arch/arm/mpu/arm32 to hold arm32 specific bits. > > Signed-off-by: Ayan Kumar Halder > --- > Changes from :- > > v1..v2 - New patch in v3. > > xen/arch/arm/mpu/Makefile | 2 +- > xen/arch/arm/mpu/arm

Re: [PATCH v2 3/3] arm/mpu: Provide access to the MPU region from the C code

2025-06-09 Thread Luca Fancellu
Oh sorry forgot one thing ... > >> /* >> * Armv8-R supports direct access and indirect access to the MPU regions >> through >> * registers: >> @@ -85,6 +87,7 @@ static void __init __maybe_unused build_assertions(void) >> */ >> static void prepare_selector(uint8_t *sel) >> { >> +#ifdef CONFIG_ARM_

Re: [PATCH v2 3/3] arm/mpu: Provide access to the MPU region from the C code

2025-06-09 Thread Luca Fancellu
Hi Ayan, If I understand correctly Armv8-R AArch32 supports up to 255 regions, so I would expect ... > /* > * Armv8-R supports direct access and indirect access to the MPU regions > through > * registers: > @@ -85,6 +87,7 @@ static void __init __maybe_unused build_assertions(void) > */ > sta

Re: [PATCH v1 1/3] arm/mpu: Introduce MPU memory region map structure

2025-06-05 Thread Luca Fancellu
Hi Ayan, >>> +/* Hypervisor Protection Region Base Address Register */ >>> +typedef union { >>> +struct { >>> +unsigned int xn:1; /* Execute-Never */ >>> +unsigned int ap_0:1; /* Acess Permission */ >>> +unsigned long ro:1; /* Access Permission AP[1] */ >

Re: [PATCH v1 1/3] arm/mpu: Introduce MPU memory region map structure

2025-06-04 Thread Luca Fancellu
Hi Ayan, > On 4 Jun 2025, at 18:43, Ayan Kumar Halder wrote: > > Introduce pr_t typedef which is a structure having the prbar and prlar > members, > each being structured as the registers of the AArch32 Armv8-R architecture. > > Also, define MPU_REGION_RES0 to 0 as there are no reserved 0 bits

Re: [PATCH v6 3/6] arm/mpu: Provide and populate MPU C data structures

2025-05-29 Thread Luca Fancellu
Hi Julien, > On 29 May 2025, at 10:45, Julien Grall wrote: > > Hi Luca, > > On 23/05/2025 07:54, Luca Fancellu wrote: >> /* >> * Macro to prepare and set a EL2 MPU memory region. >> * We will also create an according MPU memory region entry, which >&

[PATCH v6 0/6] First chunk for Arm R82 and MPU support

2025-05-23 Thread Luca Fancellu
: - rebased serie on the MPU skeleton that allow compilation - removed some patches already merged in the MPU skeleton Luca Fancellu (5): docs/arm: Document Xen booting protocol on Armv8-R arm/mpu: Provide and populate MPU C data structures arm/mpu: Provide access to the MPU region from the C code

[PATCH v6 4/6] arm/mpu: Provide access to the MPU region from the C code

2025-05-23 Thread Luca Fancellu
Implement some utility functions in order to access the MPU regions from the C world. Signed-off-by: Luca Fancellu Reviewed-by: Michal Orzel --- v6 changes: - add break to default in the switch - modify comment and style fixes - Add R-by Michal v5 changes: - move MPU_REGION_RES0 to arm64

[PATCH v6 1/6] docs/arm: Document Xen booting protocol on Armv8-R

2025-05-22 Thread Luca Fancellu
Document the requirement needed to boot Xen on Armv8-R platforms. Signed-off-by: Luca Fancellu Reviewed-by: Ayan Kumar Halder Reviewed-by: Michal Orzel Acked-by: Julien Grall --- v6 changes: - Add Julien's Ack-by, add " Cache state shall follow [1], [2] for MPU." v5 changes:

[PATCH v6 5/6] arm/mpu: Introduce utility functions for the pr_t type

2025-05-22 Thread Luca Fancellu
Introduce a few utility functions to manipulate and handle the pr_t type. Signed-off-by: Luca Fancellu --- v6 changes: - constify pointer arguments when needed, code style fix, add clarification comment in pr_set_limit v5 changes: - Don't rely on bitfield and use the mask MPU_REGION

[PATCH v6 6/6] arm/mpu: Provide a constructor for pr_t type

2025-05-22 Thread Luca Fancellu
Provide a function that creates a pr_t object from a memory range and some attributes. Signed-off-by: Luca Fancellu Reviewed-by: Michal Orzel --- v6 changes: - explicitly initialise also xn_0 and ap_0. v5 changes: - removed AP_RW_EL2 used only by pr_of_xenaddr(), fixed comments and typos

[PATCH v6 2/6] arm/mpu: Introduce MPU memory region map structure

2025-05-22 Thread Luca Fancellu
From: Penny Zheng Introduce pr_t typedef which is a structure having the prbar and prlar members, each being structured as the registers of the AArch64 Armv8-R architecture. Signed-off-by: Penny Zheng Signed-off-by: Wei Chen Signed-off-by: Luca Fancellu Acked-by: Julien Grall Reviewed-by

[PATCH v6 3/6] arm/mpu: Provide and populate MPU C data structures

2025-05-22 Thread Luca Fancellu
;xen_mpumap_mask' used to track the enabled regions. Provide a stub implementation for the pr_t type and asm macro for the Arm32 to prevent compilation break, they will be implemented later. Signed-off-by: Luca Fancellu --- v6 changes: - Improved comments on bitmap-op.inc - invalidate cache

Re: [PATCH v5 6/6] arm/mpu: Provide a constructor for pr_t type

2025-05-22 Thread Luca Fancellu
Hi Michal, >> + >> +pr_t pr_of_addr(paddr_t base, paddr_t limit, unsigned int flags) >> +{ >> +unsigned int attr_idx = PAGE_AI_MASK(flags); >> +prbar_t prbar; >> +prlar_t prlar; >> +pr_t region; >> + >> +/* Build up value for PRBAR_EL2. */ >> +prbar = (prbar_t) { >> +

Re: [PATCH v5 5/6] arm/mpu: Introduce utility functions for the pr_t type

2025-05-22 Thread Luca Fancellu
Hi Michal, >> + >> +/* >> + * Set limit address of MPU protection region. >> + * >> + * @pr: pointer to the protection region structure. >> + * @limit: exclusive address as limit of the protection region. >> + */ >> +static inline void pr_set_limit(pr_t *pr, paddr_t limit) >> +{ >> +pr->prlar.

Re: [PATCH v5 2/6] arm/mpu: Introduce MPU memory region map structure

2025-05-22 Thread Luca Fancellu
Hi Michal, >> >> diff --git a/xen/arch/arm/include/asm/arm64/mpu.h >> b/xen/arch/arm/include/asm/arm64/mpu.h >> new file mode 100644 >> index ..d3c055a2e53b >> --- /dev/null >> +++ b/xen/arch/arm/include/asm/arm64/mpu.h >> @@ -0,0 +1,52 @@ >> +/* SPDX-License-Identifier: GPL-2.0-only

Re: [PATCH v5 3/6] arm/mpu: Provide and populate MPU C data structures

2025-05-14 Thread Luca Fancellu
Hi Julien, >> diff --git a/xen/arch/arm/arm64/mpu/head.S b/xen/arch/arm/arm64/mpu/head.S >> index 6d336cafbbaf..59ddc46526eb 100644 >> --- a/xen/arch/arm/arm64/mpu/head.S >> +++ b/xen/arch/arm/arm64/mpu/head.S >> @@ -40,6 +40,9 @@ FUNC(enable_boot_cpu_mm) >> mrs x5, MPUIR_EL2 >> and

[PATCH v5 6/6] arm/mpu: Provide a constructor for pr_t type

2025-05-13 Thread Luca Fancellu
Provide a function that creates a pr_t object from a memory range and some attributes. Signed-off-by: Luca Fancellu --- v5 changes: - removed AP_RW_EL2 used only by pr_of_xenaddr(), fixed comments and typos - Given some comments to the page.h flags and modifications to the prbar_t fields

[PATCH v5 0/6] First chunk for Arm R82 and MPU support

2025-05-13 Thread Luca Fancellu
compilation - removed some patches already merged in the MPU skeleton Luca Fancellu (5): docs/arm: Document Xen booting protocol on Armv8-R arm/mpu: Provide and populate MPU C data structures arm/mpu: Provide access to the MPU region from the C code arm/mpu: Introduce utility functions for

[PATCH v5 2/6] arm/mpu: Introduce MPU memory region map structure

2025-05-13 Thread Luca Fancellu
From: Penny Zheng Introduce pr_t typedef which is a structure having the prbar and prlar members, each being structured as the registers of the AArch64 Armv8-R architecture. Signed-off-by: Penny Zheng Signed-off-by: Wei Chen Signed-off-by: Luca Fancellu --- Changes in v5: - Given some

[PATCH v5 3/6] arm/mpu: Provide and populate MPU C data structures

2025-05-13 Thread Luca Fancellu
;xen_mpumap_mask' used to track the enabled regions. Provide a stub implementation for the pr_t type and few asm macro for the Arm32 to prevent compilation break, they will be implemented later. Signed-off-by: Luca Fancellu --- v5 changes: - changed variable name from 'max_xen_mpumap&

[PATCH v5 1/6] docs/arm: Document Xen booting protocol on Armv8-R

2025-05-13 Thread Luca Fancellu
Document the requirement needed to boot Xen on Armv8-R platforms. Signed-off-by: Luca Fancellu Reviewed-by: Ayan Kumar Halder Reviewed-by: Michal Orzel --- v5 changes: - restructured and removed some EL3 reference that might not be there on Armv8-R aarch64 - add R-by Ayan and Michal v4

[PATCH v5 5/6] arm/mpu: Introduce utility functions for the pr_t type

2025-05-13 Thread Luca Fancellu
Introduce a few utility functions to manipulate and handle the pr_t type. Signed-off-by: Luca Fancellu --- v5 changes: - Don't rely on bitfield and use the mask MPU_REGION_RES0 for pr_set_base and pr_set_limit to make it explicit. Fixed typos in commit message. v4 changes: - M

[PATCH v5 4/6] arm/mpu: Provide access to the MPU region from the C code

2025-05-13 Thread Luca Fancellu
Implement some utility function in order to access the MPU regions from the C world. Signed-off-by: Luca Fancellu --- v5 changes: - move MPU_REGION_RES0 to arm64, fixed typos and code style. v4 changes: - moved back PRBAR0_EL2/PRLAR0_EL2 to mm.c and protect them with CONFIG_ARM_64, changed

Re: [PATCH v4 6/7] arm/mpu: Provide a constructor for pr_t type

2025-05-06 Thread Luca Fancellu
Hi Julien, > On 6 May 2025, at 14:51, Julien Grall wrote: > > Hi Luca, > > On 06/05/2025 13:56, Luca Fancellu wrote: >>>> +/* >>>> + * Creates a pr_t structure describing a protection region. >>>> + * >>>> + * @base: base addre

Re: [PATCH v4 6/7] arm/mpu: Provide a constructor for pr_t type

2025-05-06 Thread Luca Fancellu
>> +switch ( attr_idx ) >> +{ >> +case MT_NORMAL_NC: >> +/* >> + * ARM ARM: Overlaying the shareability attribute (DDI >> + * 0406C.b B3-1376 to 1377) > It's a bit odd to provide here the manual for Armv7. > Also, our general advice is to use the latest revision

Re: [PATCH v4 6/7] arm/mpu: Provide a constructor for pr_t type

2025-05-06 Thread Luca Fancellu
Hi Michal, >> >> +/* >> + * Excute never. >> + * Stage 1 EL2 translation regime. >> + * XN[1] determines whether execution of the instruction fetched from the >> MPU >> + * memory region is permitted. >> + * Stage 2 EL1/EL0 translation regime. >> + * XN[0] determines whether execution of the ins

Re: [PATCH v4 1/7] docs/arm: Document Xen booting protocol on Armv8-R

2025-05-06 Thread Luca Fancellu
Hi Julien, >> Just to be sure to be on the same page, are you suggesting these changes on >> the original file? > > Yes with one tweak. > > > > diff --git a/docs/misc/arm/booting.txt b/docs/misc/arm/booting.txt >> index 21ae74837dcc..c00c651805d7 100644 >> --- a/docs/misc/arm/booting.txt >> +++

Re: [PATCH v4 1/7] docs/arm: Document Xen booting protocol on Armv8-R

2025-05-06 Thread Luca Fancellu
Hi Julien, > On 6 May 2025, at 12:44, Julien Grall wrote: > > > > On 29/04/2025 16:20, Luca Fancellu wrote: >> Document the requirement needed to boot Xen on Armv8-R platforms. >> Signed-off-by: Luca Fancellu >> --- >> v4 changes: >> - New p

Re: [PATCH v4 4/7] arm/mpu: Provide access to the MPU region from the C code

2025-05-06 Thread Luca Fancellu
Hi Michal, >> >> diff --git a/xen/arch/arm/include/asm/mpu.h b/xen/arch/arm/include/asm/mpu.h >> index 1368b2eb990f..40a86140b6cc 100644 >> --- a/xen/arch/arm/include/asm/mpu.h >> +++ b/xen/arch/arm/include/asm/mpu.h >> @@ -17,6 +17,7 @@ >> #define MPU_REGION_SHIFT 6 >> #define MPU_REGION_ALIGN

Re: [PATCH v4 5/7] arm/mpu: Introduce utility functions for the pr_t type

2025-05-06 Thread Luca Fancellu
Hi Michal, > On 5 May 2025, at 13:08, Orzel, Michal wrote: > > > > On 29/04/2025 17:20, Luca Fancellu wrote: >> Introduce few utility function to manipulate and handle the > s/few/a few/ > s/function/functions/ Ok >> >> diff --git a/xen/arch/arm/inclu

Re: [PATCH v4 3/7] arm/mpu: Provide and populate MPU C data structures

2025-04-30 Thread Luca Fancellu
Hi Michal, > On 30 Apr 2025, at 11:57, Orzel, Michal wrote: > > > > On 29/04/2025 17:20, Luca Fancellu wrote: >> Provide some data structure in the C world to track the MPU >> status, these structures will be filled at boot by the assembly >> early c

Re: [PATCH v4 1/7] docs/arm: Document Xen booting protocol on Armv8-R

2025-04-30 Thread Luca Fancellu
Hi Michal, >>> >>> Is the goal of this patch to only write firmware/bootloader requirements or >>> accommodate booting protocol in general? Asking because in this file there >>> is a >>> requirement that Xen should be loaded below 10TB which afaict does not fit >>> Armv8-R. >> >> Yes you are r

Re: [PATCH v4 1/7] docs/arm: Document Xen booting protocol on Armv8-R

2025-04-30 Thread Luca Fancellu
Hi Michal, > On 30 Apr 2025, at 07:37, Orzel, Michal wrote: > > > > On 29/04/2025 17:20, Luca Fancellu wrote: >> Document the requirement needed to boot Xen on Armv8-R platforms. >> >> Signed-off-by: Luca Fancellu >> --- >> v4 changes: >>

Re: [PATCH v4 3/7] arm/mpu: Provide and populate MPU C data structures

2025-04-29 Thread Luca Fancellu
Hi all, > diff --git a/xen/arch/arm/include/asm/mpu/regions.inc > b/xen/arch/arm/include/asm/mpu/regions.inc > index 47868a152662..dc0306f8c5fc 100644 > --- a/xen/arch/arm/include/asm/mpu/regions.inc > +++ b/xen/arch/arm/include/asm/mpu/regions.inc > @@ -1,22 +1,50 @@ > /* SPDX-License-Identifier

Re: [PATCH v4 6/7] arm/mpu: Provide a constructor for pr_t type

2025-04-29 Thread Luca Fancellu
Hi Ayan, >> diff --git a/xen/arch/arm/mpu/mm.c b/xen/arch/arm/mpu/mm.c >> index 40ccf99adc94..2e0aeb486ff8 100644 >> --- a/xen/arch/arm/mpu/mm.c >> +++ b/xen/arch/arm/mpu/mm.c >> @@ -9,6 +9,7 @@ >> #include >> #include >> #include >> +#include >> #include >> >> struct page_info *frame_t

[PATCH v4 6/7] arm/mpu: Provide a constructor for pr_t type

2025-04-29 Thread Luca Fancellu
Provide a function that creates a pr_t object from a memory range and some attributes. Signed-off-by: Luca Fancellu --- v4 changes: - update helper comments - rename XN_EL2_ENABLED to PRBAR_EL2_XN_ENABLED - protected pr_of_xenaddr() with #ifdef Arm64 until Arm32 can build with it --- xen

[PATCH v4 5/7] arm/mpu: Introduce utility functions for the pr_t type

2025-04-29 Thread Luca Fancellu
Introduce few utility function to manipulate and handle the pr_t type. Signed-off-by: Luca Fancellu --- v4 changes: - Modify comment on top of the helpers. Clarify pr_set_limit takes exclusive address. Protected common code with #ifdef Arm64 until Arm32 is ready with pr_t --- xen/arch

[PATCH v4 0/7] First chunk for Arm R82 and MPU support

2025-04-29 Thread Luca Fancellu
: boot protocol and early asm MPU structure update - general fixes listed on each patch v3 changes: - stated on each patch v2 changes for this serie: - rebased serie on the MPU skeleton that allow compilation - removed some patches already merged in the MPU skeleton Luca Fancellu (6): docs

[PATCH v4 2/7] arm/mpu: Introduce MPU memory region map structure

2025-04-29 Thread Luca Fancellu
From: Penny Zheng Introduce pr_t typedef which is a structure having the prbar and prlar members, each being structured as the registers of the aarch64 armv8-r architecture. Signed-off-by: Penny Zheng Signed-off-by: Wei Chen Signed-off-by: Luca Fancellu --- Changes in v4: - Fixed typos

[PATCH v4 4/7] arm/mpu: Provide access to the MPU region from the C code

2025-04-29 Thread Luca Fancellu
Implement some utility function in order to access the MPU regions from the C world. Signed-off-by: Luca Fancellu --- v4 changes: - moved back PRBAR0_EL2/PRLAR0_EL2 to mm.c and protect them with CONFIG_ARM_64, changed comments, fixed typos and code style - Add PRBAR_EL2_(n) definition

[PATCH v4 3/7] arm/mpu: Provide and populate MPU C data structures

2025-04-29 Thread Luca Fancellu
s enough to understand how the macro will work and this will save some registers. Provide a stub implementation for the pr_t type and few asm macro for the Arm32 to prevent compilation break, they will be implemented later. Signed-off-by: Luca Fancellu --- v4 changes: - new patch --- xen/arch/arm/arm64/

[PATCH v4 7/7] arm/mpu: Introduce MPU memory mapping flags

2025-04-29 Thread Luca Fancellu
Introduce the MPU memory mapping flags in asm/page.h. Signed-off-by: Luca Fancellu --- v4 changes: - no changes, I'm not sure how I can merge XN and Permission flags. --- xen/arch/arm/include/asm/page.h | 25 + 1 file changed, 25 insertions(+) diff --git a/xen/arc

[PATCH v4 1/7] docs/arm: Document Xen booting protocol on Armv8-R

2025-04-29 Thread Luca Fancellu
Document the requirement needed to boot Xen on Armv8-R platforms. Signed-off-by: Luca Fancellu --- v4 changes: - New patch --- docs/misc/arm/booting.txt | 8 1 file changed, 8 insertions(+) diff --git a/docs/misc/arm/booting.txt b/docs/misc/arm/booting.txt index 21ae74837dcc

Re: [PATCH v1] xen/arm: AArch32-V8R: Add MPU register definitions

2025-04-29 Thread Luca Fancellu
Hi Ayan, > +/* > + * There is no actual ns bit in hardware. It is used here for > + * compatibility with Armr64 code. Thus, we are reusing a res0 > bit for ns. typo: Arm64. >>> Ack > + */ H, this would mean someone may mistakenly s

Re: [PATCH v1] xen/arm: AArch32-V8R: Add MPU register definitions

2025-04-28 Thread Luca Fancellu
> On 25 Apr 2025, at 14:32, Julien Grall wrote: > > Hi Ayan > > On 25/04/2025 13:00, Ayan Kumar Halder wrote: +unsigned int ns:1; /* Reserved 0 by hardware */ +unsigned int res0:1; /* Reserved 0 by hardware */ >> Then, we can change this on Arm32 as well. +

Re: [PATCH v1] xen/arm: AArch32-V8R: Add MPU register definitions

2025-04-28 Thread Luca Fancellu
Hi Ayan, > On 25 Apr 2025, at 13:00, Ayan Kumar Halder wrote: > > Hi Julien, > > cc-ed Luca for feedback on specific points. > > On 18/04/2025 05:54, Julien Grall wrote: >> Hi Ayan, >> >> On 18/04/2025 00:55, Ayan Kumar Halder wrote: >>> Add the definitions for HPRBAR<0..31>, HPRLAR<0..31> an

Re: [PATCH v3 5/7] arm/mpu: Introduce MPU memory mapping flags

2025-04-16 Thread Luca Fancellu
Hi Julien, > On 14 Apr 2025, at 12:48, Julien Grall wrote: > > Hi Luca, > > On 11/04/2025 23:56, Luca Fancellu wrote: >> Introduce the MPU memory mapping flags in asm/page.h. >> Signed-off-by: Luca Fancellu >> --- >> xen/arch/arm/include/asm/page.h |

Re: [PATCH v3 3/7] arm/mpu: Introduce utility functions for the pr_t type

2025-04-16 Thread Luca Fancellu
> On 16 Apr 2025, at 14:10, Orzel, Michal wrote: > > > > On 16/04/2025 14:57, Luca Fancellu wrote: >> Hi Michal, >> >>>> >>>>> >>>>>> +} >>>>>> + >>>>>> +/* Set limi

Re: [PATCH v3 3/7] arm/mpu: Introduce utility functions for the pr_t type

2025-04-16 Thread Luca Fancellu
Hi Michal, >> >>> +} + +/* Set limit address of MPU protection region(pr_t). */ +static inline void pr_set_limit(pr_t *pr, paddr_t limit) +{ +pr->prlar.reg.limit = ((limit - 1) >> MPU_REGION_SHIFT); >>> Why -1? AFAIR these registers take inclusive addresses, so

Re: [PATCH v3 3/7] arm/mpu: Introduce utility functions for the pr_t type

2025-04-16 Thread Luca Fancellu
Hi Michal, > On 16 Apr 2025, at 11:50, Orzel, Michal wrote: > > > > On 11/04/2025 16:56, Luca Fancellu wrote: >> Introduce few utility function to manipulate and handle the >> pr_t type. >> >> Signed-off-by: Luca Fancellu >&g

Re: [PATCH v3 6/7] arm/mpu: Implement early_fdt_map support in MPU systems

2025-04-16 Thread Luca Fancellu
Hi Julien, > >> + >> void __init setup_pagetables(void) {} >>void * __init early_fdt_map(paddr_t fdt_paddr) >> { >> -BUG_ON("unimplemented"); >> -return NULL; >> +/* Map at least a page containing the DTB address, exclusive range */ >> +paddr_t base_paddr = round_pgdown(fdt_

Re: Xen Armv8-R booting protocol

2025-04-15 Thread Luca Fancellu
Hi Ayan, > On 15 Apr 2025, at 14:06, Ayan Kumar Halder wrote: > > > On 15/04/2025 13:10, Luca Fancellu wrote: >> Hi all, > Hi Luca, >> >> I’ve started this thread to talk about a possible Xen booting protocol when >> running on Armv8-R, >> curren

Xen Armv8-R booting protocol

2025-04-15 Thread Luca Fancellu
Hi all, I’ve started this thread to talk about a possible Xen booting protocol when running on Armv8-R, currently Xen uses the Linux boot protocol and some other requirements stated in docs/misc/arm/booting.txt. Unfortunately we don’t have anything already available for Armv8-R, the only imple

Re: [PATCH v3 7/7] arm/mpu: Implement setup_mpu for MPU system

2025-04-15 Thread Luca Fancellu
Hi Julien, > On 15 Apr 2025, at 11:20, Julien Grall wrote: > > Hi Luca, > > On 15/04/2025 16:55, Luca Fancellu wrote: >> Hi Julien, >>>>>> +static void __init setup_mpu(void) >>>>>> +{ >

Re: [PATCH v3 2/7] arm/mpu: Provide access to the MPU region from the C code

2025-04-15 Thread Luca Fancellu
Hi Julien, +/* + * The following are needed for the case generators GENERATE_WRITE_PR_REG_CASE + * and GENERATE_READ_PR_REG_CASE with num==0 + */ +#define PRBAR0_EL2 PRBAR_EL2 +#define PRLAR0_EL2 PRLAR_EL2 >>> >>> Rather than aliasing, shouldn't we just rename

Re: [PATCH v7 0/3] Enable early bootup of Armv8-R AArch32 systems

2025-04-15 Thread Luca Fancellu
f 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 again the serie with the latest change, no issues: Tested-by: Luca Fancellu

Re: [PATCH v3 7/7] arm/mpu: Implement setup_mpu for MPU system

2025-04-15 Thread Luca Fancellu
Hi Julien, +static void __init setup_mpu(void) +{ +register_t prenr; +unsigned int i = 0; + +/* + * MPUIR_EL2.Region[0:7] identifies the number of regions supported by + * the EL2 MPU. + */ +max_xen_mpumap = (uint8_t)(RE

Re: [PATCH v3 1/7] arm/mpu: Introduce MPU memory region map structure

2025-04-14 Thread Luca Fancellu
Hi Michal, > On 14 Apr 2025, at 16:01, Orzel, Michal wrote: > > > > On 14/04/2025 16:50, Luca Fancellu wrote: >> Hi Michal, >> >>> On 14 Apr 2025, at 11:17, Orzel, Michal wrote: >>> >>> >>> >>> On 11/04/2025 16:56

Re: [PATCH v3 7/7] arm/mpu: Implement setup_mpu for MPU system

2025-04-14 Thread Luca Fancellu
HI Julien, > On 14 Apr 2025, at 13:12, Julien Grall wrote: > > Hi Luca, > > On 11/04/2025 23:56, Luca Fancellu wrote: >> Implement the function setup_mpu that will logically track the MPU >> regions defined by hardware registers, start introducing data >> stru

Re: [PATCH v3 2/7] arm/mpu: Provide access to the MPU region from the C code

2025-04-14 Thread Luca Fancellu
HI Julien, > On 14 Apr 2025, at 12:41, Julien Grall wrote: > > Hi Luca, > > On 11/04/2025 23:56, Luca Fancellu wrote: >> Implement some utility function in order to access the MPU regions >> from the C world. >> Signed-off-by: Luca Fancellu >> --

Re: [PATCH v3 1/7] arm/mpu: Introduce MPU memory region map structure

2025-04-14 Thread Luca Fancellu
Hi Michal, > On 14 Apr 2025, at 11:17, Orzel, Michal wrote: > > > > On 11/04/2025 16:56, Luca Fancellu wrote: >> From: Penny Zheng >> >> Introduce pr_t typedef which is a structure having the prbar >> and prlar members, each being structured as

[PATCH v3 2/7] arm/mpu: Provide access to the MPU region from the C code

2025-04-11 Thread Luca Fancellu
Implement some utility function in order to access the MPU regions from the C world. Signed-off-by: Luca Fancellu --- v3 changes: - Moved PRBAR0_EL2/PRLAR0_EL2 to arm64 specific - Modified prepare_selector() to be easily made a NOP for Arm32, which can address up to 32 region without

[PATCH v3 3/7] arm/mpu: Introduce utility functions for the pr_t type

2025-04-11 Thread Luca Fancellu
Introduce few utility function to manipulate and handle the pr_t type. Signed-off-by: Luca Fancellu --- xen/arch/arm/include/asm/mpu.h | 40 ++ 1 file changed, 40 insertions(+) diff --git a/xen/arch/arm/include/asm/mpu.h b/xen/arch/arm/include/asm/mpu.h index

[PATCH v3 5/7] arm/mpu: Introduce MPU memory mapping flags

2025-04-11 Thread Luca Fancellu
Introduce the MPU memory mapping flags in asm/page.h. Signed-off-by: Luca Fancellu --- 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

[PATCH v3 6/7] arm/mpu: Implement early_fdt_map support in MPU systems

2025-04-11 Thread Luca Fancellu
memory management is designed to work on pages of PAGE_SIZE in order to reuse helpers and macros already available on the Xen memory management system. Signed-off-by: Luca Fancellu --- xen/arch/arm/mpu/setup.c | 54 ++-- 1 file changed, 52 insertions(+), 2 deletions

[PATCH v3 0/7] First chunk for Arm R82 and MPU support

2025-04-11 Thread Luca Fancellu
serie: - rebased serie on the MPU skeleton that allow compilation - removed some patches already merged in the MPU skeleton Luca Fancellu (6): arm/mpu: Provide access to the MPU region from the C code arm/mpu: Introduce utility functions for the pr_t type arm/mpu: Provide a constructor for

[PATCH v3 4/7] arm/mpu: Provide a constructor for pr_t type

2025-04-11 Thread Luca Fancellu
Provide a function that creates a pr_t object from a memory range and some attributes. Signed-off-by: Luca Fancellu --- xen/arch/arm/include/asm/arm64/mpu.h | 11 + xen/arch/arm/include/asm/mpu.h | 4 ++ xen/arch/arm/include/asm/mpu/mm.h| 3 ++ xen/arch/arm/mpu/mm.c

[PATCH v3 7/7] arm/mpu: Implement setup_mpu for MPU system

2025-04-11 Thread Luca Fancellu
called from setup_mm() which full implementation will be provided in a later stage. Signed-off-by: Luca Fancellu --- v3 changes: - Moved PRENR_MASK define to common. --- --- xen/arch/arm/include/asm/mpu.h | 2 ++ xen/arch/arm/mpu/mm.c | 49 +- 2 files

[PATCH v3 1/7] arm/mpu: Introduce MPU memory region map structure

2025-04-11 Thread Luca Fancellu
PU_REGIONS macro that uses the value of NUM_MPU_REGIONS_MASK just for clarity, because using the latter as number of elements of the xen_mpumap array might be misleading. Signed-off-by: Penny Zheng Signed-off-by: Wei Chen Signed-off-by: Luca Fancellu --- xen/arch/arm/include/asm/arm64/

Re: [PATCH v6 0/3] Enable early bootup of Armv8-R AArch32 systems

2025-04-11 Thread Luca Fancellu
2: Create the same boot-time MPU regions as arm64 > xen/arm32: mpu: Stubs to build MPU for arm32 I’ve compiled both Arm32 and Arm64, MPU & MMU code: Tested-by: Luca Fancellu Cheers, Luca

[PATCH v2 0/7] First chunk for Arm R82 and MPU support

2025-04-10 Thread Luca Fancellu
skeleton that allow compilation - removed some patches already merged in the MPU skeleton Luca Fancellu (6): arm/mpu: Provide access to the MPU region from the C code arm/mpu: Introduce utility functions for the pr_t type arm/mpu: Provide a constructor for pr_t type arm/mpu: Introduce MPU

Re: [PATCH v2 2/7] arm/mpu: Provide access to the MPU region from the C code

2025-04-10 Thread Luca Fancellu
Hi Ayan, > On 8 Apr 2025, at 15:02, Ayan Kumar Halder wrote: > > Hi Luca, > >> >> +static void prepare_selector(uint8_t sel) >> +{ >> +/* >> + * {read,write}_protection_region works using the direct access to the >> 0..15 >> + * regions, so in order to save the isb() overhead, cha

[PATCH v2 6/7] arm/mpu: Implement early_fdt_map support in MPU systems

2025-04-10 Thread Luca Fancellu
memory management is designed to work on pages of PAGE_SIZE in order to reuse helpers and macros already available on the Xen memory management system. Signed-off-by: Luca Fancellu --- xen/arch/arm/mpu/setup.c | 54 ++-- 1 file changed, 52 insertions(+), 2 deletions

[PATCH v2 5/7] arm/mpu: Introduce MPU memory mapping flags

2025-04-10 Thread Luca Fancellu
Introduce the MPU memory mapping flags in asm/page.h. Signed-off-by: Luca Fancellu --- 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

Re: [PATCH v2 2/7] arm/mpu: Provide access to the MPU region from the C code

2025-04-09 Thread Luca Fancellu
Hi Ayan, > On 9 Apr 2025, at 11:46, Ayan Kumar Halder wrote: > > > On 09/04/2025 11:21, Luca Fancellu wrote: >> Hi Ayan, > Hi, >> >>> On 9 Apr 2025, at 11:07, Ayan Kumar Halder wrote: >>> >>> >>> On 09/04/2025 09:26, Luca Fanc

Re: [PATCH v2 2/7] arm/mpu: Provide access to the MPU region from the C code

2025-04-09 Thread Luca Fancellu
Hi Ayan, > On 9 Apr 2025, at 11:07, Ayan Kumar Halder wrote: > > > On 09/04/2025 09:26, Luca Fancellu wrote: >> Hi Ayan, > Hi Luca, >> >>>>> The point of the code was to don’t issue an isb() every time we change >>>>> the selector, &

Re: [PATCH v2 2/7] arm/mpu: Provide access to the MPU region from the C code

2025-04-09 Thread Luca Fancellu
Hi Ayan, >>> The point of the code was to don’t issue an isb() every time we change the >>> selector, >>> of course the code would be easier otherwise, but do we want to do that? >> >> Not sure if it is beneficial as you would need to use isb() from region16 >> onwards. > > The isb() is issued

Re: [PATCH v2 2/7] arm/mpu: Provide access to the MPU region from the C code

2025-04-09 Thread Luca Fancellu
Hi Ayan, > On 8 Apr 2025, at 18:02, Ayan Kumar Halder wrote: > > Hi, > > On 08/04/2025 17:48, Luca Fancellu wrote: >> >>> On 8 Apr 2025, at 17:33, Ayan Kumar Halder wrote: >>> >>> >>> On 08/04/2025 15:29, Luca Fancellu wrote: >&

Re: [PATCH v2 2/7] arm/mpu: Provide access to the MPU region from the C code

2025-04-08 Thread Luca Fancellu
> On 8 Apr 2025, at 17:33, Ayan Kumar Halder wrote: > > > On 08/04/2025 15:29, Luca Fancellu wrote: >> Hi Ayan, > Hi Luca, >> >>> On 8 Apr 2025, at 15:02, Ayan Kumar Halder wrote: >>> >>> Hi Luca, >>> >>>> +static

Re: [PATCH v2 7/7] arm/mpu: Implement setup_mpu for MPU system

2025-04-08 Thread Luca Fancellu
Hi Ayan, > On 8 Apr 2025, at 14:32, Ayan Kumar Halder wrote: > > Hi Luca, > > On 07/04/2025 10:14, Luca Fancellu wrote: >> CAUTION: This message has originated from an External Source. Please use >> proper judgment and caution when opening attachments, clicking

Re: [PATCH v5 3/3] xen/arm32: mpu: Stubs to build MPU for arm32

2025-04-08 Thread Luca Fancellu
include for BUG() #include for mfn_t and INVALID_MFN #include for NULL > + > +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: > + */ > -- > 2.25.1 with the above addressed, at least for me it looks good! Reviewed-by: Luca Fancellu Cheers, Luca

Re: [PATCH v5 2/3] xen/arm32: Create the same boot-time MPU regions as arm64

2025-04-08 Thread Luca Fancellu
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! Reviewed-by: Luca Fancellu Cheers, Luca

Re: [PATCH v5 1/3] xen/arm: Move some of the functions to common file

2025-04-08 Thread Luca Fancellu
Ayan Kumar Halder > — > 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

Re: [PATCH v5 0/3] Enable early bootup of Armv8-R AArch32 systems

2025-04-08 Thread Luca Fancellu
xen/arm32: mpu: Stubs to build MPU for arm32 > I’ve tested this serie building arm64 & arm32 MPU & MMU architecture: Tested-by: Luca Fancellu Cheers, Luca

Re: [PATCH v4 1/3] xen/arm: Move some of the functions to common file

2025-04-07 Thread Luca Fancellu
Hi Ayan, > On 7 Apr 2025, at 15:29, Ayan Kumar Halder wrote: > > Hi Luca, > > On 04/04/2025 10:06, Luca Fancellu wrote: >> Hi Ayan, >> >>> On 3 Apr 2025, at 18:12, Ayan Kumar Halder >>> wrote: >>> >>> Added a new file prepa

Re: [PATCH v4 1/3] xen/arm: Move some of the functions to common file

2025-04-07 Thread Luca Fancellu
Hi Ayan, > On 7 Apr 2025, at 14:18, Ayan Kumar Halder wrote: > > Hi Michal, > > On 07/04/2025 10:04, Orzel, Michal wrote: >> >> On 03/04/2025 19:12, Ayan Kumar Halder wrote: >>> Added a new file prepare_xen_region.inc to hold the common earlyboot MPU >>> regions >>> configurations across arm6

[PATCH v2 3/7] arm/mpu: Introduce utility functions for the pr_t type

2025-04-07 Thread Luca Fancellu
Introduce few utility function to manipulate and handle the pr_t type. Signed-off-by: Luca Fancellu --- xen/arch/arm/include/asm/mpu.h | 40 ++ 1 file changed, 40 insertions(+) diff --git a/xen/arch/arm/include/asm/mpu.h b/xen/arch/arm/include/asm/mpu.h index

  1   2   3   4   5   6   7   8   9   10   >