[PATCH 5/5] xen/arm: map static memory on demand

2025-07-30 Thread Hari Limaye
for initialization. Signed-off-by: Penny Zheng Signed-off-by: Wei Chen Signed-off-by: Luca Fancellu Signed-off-by: Hari Limaye --- xen/arch/arm/include/asm/mmu/mm.h | 3 +++ xen/arch/arm/include/asm/mpu/mm.h | 4 xen/arch/arm/mpu/setup.c | 11 +++ xen/include/xen

[PATCH 0/5] Third series for R82 MPU support

2025-07-30 Thread Hari Limaye
Hi all, This series is the third set of patches in the ongoing work to introduce support for MPU systems and Cortex R82 in Xen. The patches in this series implement the necessary logic to transiently map and unmap the static memory banks for initialization. Cheers, Hari Luca Fancellu (4): arm

[PATCH 4/5] arm/mpu: Implement ioremap_attr for MPU

2025-07-30 Thread Hari Limaye
From: Luca Fancellu Introduce helpers (un)map_mm_range() in order to allow the temporary mapping of a range of memory, and use these to implement the function `ioremap_attr` for MPU systems. Signed-off-by: Luca Fancellu Signed-off-by: Hari Limaye --- xen/arch/arm/include/asm/mpu/mm.h | 22

[PATCH 3/5] arm/mpu: Implement transient mapping

2025-07-30 Thread Hari Limaye
From: Luca Fancellu Add a scheme to distinguish transient MPU regions, to identify MPU regions which will be mapped for a short period of time. Signed-off-by: Luca Fancellu Signed-off-by: Hari Limaye --- xen/arch/arm/include/asm/arm32/mpu.h | 2 ++ xen/arch/arm/include/asm/arm64/mpu.h

[PATCH 2/5] arm/mpu: Implement setup_mm for MPU systems

2025-07-30 Thread Hari Limaye
From: Luca Fancellu Implement `setup_mm` for MPU systems. This variant doesn't need to set up the direct map. Signed-off-by: Luca Fancellu Signed-off-by: Hari Limaye --- xen/arch/arm/mpu/mm.c | 64 ++- 1 file changed, 63 insertions(+), 1 del

[PATCH 1/5] arm/mpu: Implement setup_frametable_mappings for MPU systems

2025-07-30 Thread Hari Limaye
From: Luca Fancellu Implement the MPU variant of `setup_frametable_mappings`. This function will be called by `setup_mm` when an implementation for MPU systems is added in a follow up commit. Signed-off-by: Luca Fancellu Signed-off-by: Hari Limaye --- xen/arch/arm/mpu/mm.c | 19

Re: [XEN][PATCH] xen/arm: remove unused dump_p2m_lookup()

2025-07-21 Thread Hari Limaye
Hi Grygorii, > On Fri, Jul 18, 2025 at 10:15:36AM +, Grygorii Strashko wrote: > From: Grygorii Strashko > > The dump_p2m_lookup() is not used, so remove it. NIT: I think this would read better as 'The function dump_p2m_lookup()...' Otherwise LGTM! Reviewed-by: Hari Limaye Cheers, Hari

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

2025-07-21 Thread Hari Limaye
Hi Michal, > NIT: In this patch you start adding mpu: prefix, even though other messages do > not have it. I don't think it's needed. > > Otherwise: > Reviewed-by: Michal Orzel > > ~Michal > Would you like me to respin for this change, or can it be addressed on commit? Many thanks, Hari

[PATCH v4 6/6] arm/mpu: Implement remove_early_mappings for MPU systems

2025-07-21 Thread Hari Limaye
From: Luca Fancellu Implement remove_early_mappings for MPU systems. Signed-off-by: Luca Fancellu Signed-off-by: Hari Limaye Reviewed-by: Michal Orzel --- Changes from v1: - Add Ayan's R-b Changes from v2: - Remove full stop - Remove sanity check for `mapped_fdt_paddr == INVALID_

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

2025-07-21 Thread Hari Limaye
: Wei Chen Signed-off-by: Luca Fancellu Signed-off-by: Hari Limaye --- Changes from v1: - Move check for part-region removal outside if condition - Use normal printk Changes from v2: - Fix assert from `ASSERT(s <= e)` -> `ASSERT(s < e)` - Remove call to context_sync_mpu - Use register

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

2025-07-21 Thread Hari Limaye
the case that the initial mapping of the fdt_header is insufficient to cover the entire DTB, as we must destroy and then remap the region due to the APIs no providing support for extending the size of an existing region. Signed-off-by: Luca Fancellu Signed-off-by: Hari Limaye Reviewed-by: Ayan

[PATCH v4 2/6] xen/arm: Introduce flags_has_rwx helper

2025-07-21 Thread Hari Limaye
ff-by: Luca Fancellu Signed-off-by: Hari Limaye Reviewed-by: Ayan Kumar Halder Reviewed-by: Michal Orzel --- Changes from v1: - Add Ayan and Michal's R-b - Fix typos --- xen/arch/arm/include/asm/mm.h | 2 ++ xen/arch/arm/mm.c | 15 +++ xen/arch/arm/mmu/pt.c

[PATCH v4 0/6] Second series for R82 MPU Support

2025-07-21 Thread Hari Limaye
Hi all, This series is the second set of patches in the ongoing work to introduce support for MPU systems and Cortex R82 in Xen. The patches in this series implement the necessary logic to map and unmap the Device Tree Blob in the early stages of the boot process. Changes from v3: - Changes ment

[PATCH v4 3/6] arm/mpu: Populate a new region in Xen MPU mapping table

2025-07-21 Thread Hari Limaye
. This commit only implements populating a new entry in Xen MPU memory mapping table(xen_mpumap). Signed-off-by: Penny Zheng Signed-off-by: Wei Chen Signed-off-by: Luca Fancellu Signed-off-by: Hari Limaye Reviewed-by: Michal Orzel --- Changes from v1: - Simplify if condition - Use normal

[PATCH v4 1/6] arm/mpu: Find MPU region by range

2025-07-21 Thread Hari Limaye
From: Luca Fancellu Implement a function to find the index of a MPU region in the xen_mpumap MPU region array. This function will be used in future commits to implement creating and destroying MPU regions. Signed-off-by: Luca Fancellu Signed-off-by: Hari Limaye Reviewed-by: Michal Orzel

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

2025-07-17 Thread Hari Limaye
Hi Michal, > On 17 Jul 2025, at 13:54, Orzel, Michal wrote: >> +/* >> + * DTB starting at a different address has been mapped, so destroy this >> + * before continuing. > I don't understand this scenario. Can you describe it in more details? > I know that early_fdt_map will be called

Re: [PATCH v3 1/6] arm/mpu: Find MPU region by range

2025-07-15 Thread Hari Limaye
Hi Michal, > On 15 Jul 2025, at 09:45, Orzel, Michal wrote: > > > > On 15/07/2025 10:36, Hari Limaye wrote: >> Hi Michal, >> >>>> +int mpumap_contains_region(pr_t *table, uint8_t nr_regions, paddr_t base, >>>> +

Re: [PATCH v3 3/6] arm/mpu: Populate a new region in Xen MPU mapping table

2025-07-15 Thread Hari Limaye
Hi Michal. >> +if ( base >= limit ) > Given that limit is exclusive, to prevent empty regions, you would need to > check > for base >= (limit - 1), even though it's not really possible because today we > require page aligned addresses (limit must be at least bigger or equal than > base > + P

Re: [PATCH v3 1/6] arm/mpu: Find MPU region by range

2025-07-15 Thread Hari Limaye
Hi Michal, >> +int mpumap_contains_region(pr_t *table, uint8_t nr_regions, paddr_t base, >> + paddr_t limit, uint8_t *index) >> +{ >> +ASSERT(index); >> +*index = INVALID_REGION_IDX; >> + >> +/* >> + * The caller supplies a half-open interval [base, limit)

[PATCH v3 6/6] arm/mpu: Implement remove_early_mappings for MPU systems

2025-07-15 Thread Hari Limaye
From: Luca Fancellu Implement remove_early_mappings for MPU systems. Signed-off-by: Luca Fancellu Signed-off-by: Hari Limaye Reviewed-by: Ayan Kumar Halder --- Changes from v1: - Add Ayan's R-b Changes from v2: - Remove full stop - Remove sanity check for `mapped_fdt_paddr == INVALID_

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

2025-07-15 Thread Hari Limaye
: Wei Chen Signed-off-by: Luca Fancellu Signed-off-by: Hari Limaye --- Changes from v1: - Move check for part-region removal outside if condition - Use normal printk Changes from v2: - Fix assert from `ASSERT(s <= e)` -> `ASSERT(s < e)` - Remove call to context_sync_mpu - Use register

[PATCH v3 2/6] xen/arm: Introduce flags_has_rwx helper

2025-07-15 Thread Hari Limaye
ff-by: Luca Fancellu Signed-off-by: Hari Limaye Reviewed-by: Ayan Kumar Halder Reviewed-by: Michal Orzel --- Changes from v1: - Add Ayan and Michal's R-b - Fix typos --- xen/arch/arm/include/asm/mm.h | 2 ++ xen/arch/arm/mm.c | 15 +++ xen/arch/arm/mmu/pt.c

[PATCH v3 0/6] Second series for R82 MPU Support

2025-07-15 Thread Hari Limaye
Hi all, This series is the second set of patches in the ongoing work to introduce support for MPU systems and Cortex R82 in Xen. The patches in this series implement the necessary logic to map and unmap the Device Tree Blob in the early stages of the boot process. Changes from v2: - Changes ment

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

2025-07-15 Thread Hari Limaye
the case that the initial mapping of the fdt_header is insufficient to cover the entire DTB, as we must destroy and then remap the region due to the APIs no providing support for extending the size of an existing region. Signed-off-by: Luca Fancellu Signed-off-by: Hari Limaye Reviewed-by: Ayan

[PATCH v3 3/6] arm/mpu: Populate a new region in Xen MPU mapping table

2025-07-15 Thread Hari Limaye
. This commit only implements populating a new entry in Xen MPU memory mapping table(xen_mpumap). Signed-off-by: Penny Zheng Signed-off-by: Wei Chen Signed-off-by: Luca Fancellu Signed-off-by: Hari Limaye --- Changes from v1: - Simplify if condition - Use normal printk - Use %# over 0x% - Add

[PATCH v3 1/6] arm/mpu: Find MPU region by range

2025-07-15 Thread Hari Limaye
From: Luca Fancellu Implement a function to find the index of a MPU region in the xen_mpumap MPU region array. This function will be used in future commits to implement creating and destroying MPU regions. Signed-off-by: Luca Fancellu Signed-off-by: Hari Limaye --- Changes from v1: - Update

Re: [PATCH v2 3/6] arm/mpu: Populate a new region in Xen MPU mapping table

2025-07-11 Thread Hari Limaye
Hi Michal, >> +int map_pages_to_xen(unsigned long virt, mfn_t mfn, unsigned long nr_mfns, >> + unsigned int flags) >> +{ >> +int rc = xen_mpumap_update(mfn_to_maddr(mfn), > What do you expect to be passed as virt? I would expect maddr which could save > you the conversion h

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

2025-07-10 Thread Hari Limaye
Hi Michal, Thank you for reviewing the patch. To answer the following question: > > +/* DTB starting at this address has already been mapped. */ > When can this happen? In xen/arch/arm/setup.c `start_xen` early_fdt_map(fdt_paddr) is called twice, before and after `setup_page_tables` - which i

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

2025-07-10 Thread Hari Limaye
Hi Michal, Thank you for reviewing the patch. > > +/* Zeroing the region will also zero the region enable */ > > +memset(&xen_mpumap[index], 0, sizeof(pr_t)); > Is it ok that for a fast case (i.e. 0-31) our representation of prbar/prlar > will > be different from the HW i.e. xen_mpumap[in

RFC: Proposal for supporting EL1 MPU region context switch in Xen

2025-07-08 Thread Hari Limaye
# Proposal for supporting EL1 MPU region context switch in Xen This proposal will introduce the proposed design for supporting EL1 MPU region context switch for guests. ## Purpose We would like to be able to support the PMSAv8-64 translation regime at EL1 for Xen guests. We would also like to co

Re: [PATCH 2/2] xen/arm: Skip loops in init_pdx() when no PDX compression is used

2025-07-07 Thread Hari Limaye
keep the two loops iterating over all the memory banks. > > Signed-off-by: Michal Orzel > --- Reviewed-by: Hari Limaye Tested-by: Hari Limaye Cheers, Hari

Re: [PATCH 2/2] xen/arm: Skip loops in init_pdx() when no PDX compression is used

2025-07-07 Thread Hari Limaye
Hi Michal, > On Fri, Jul 04, 2025 at 09:54:28AM +, Michal Orzel wrote: > When CONFIG_PDX_COMPRESSION=n, pdx_init_mask(), pdx_region_mask() and > pfn_pdx_hole_setup() are just stubs doing nothing. It does not make > sense to keep the two loops iterating over all the memory banks. > > Signed-of

Re: [PATCH 1/2] xen/arm64: Panic if direct map is too small

2025-07-07 Thread Hari Limaye
max_pdx > in init_pdx() for both arm32 and arm64. max_pdx will be used in the > future to set up frametable mappings respecting the PDX grouping. > > Signed-off-by: Michal Orzel Reviewed-by: Hari Limaye Tested-by: Hari Limaye LGTM! Tested (compilation) via both Arm AArch32 and AArch64 builds. Many thanks, Hari

Re: [PATCH] xen/arm32: Tidy up setup_mm()

2025-07-07 Thread Hari Limaye
of membanks > is split from the loop for no reason. Tidy up this function for better > readability. > > No functional change. > > Signed-off-by: Michal Orzel Reviewed-by: Hari Limaye Tested-by: Hari Limaye LGTM! Tested (compilation) via Arm AArch32 build. Many thanks, Hari

Re: [PATCH v5 2/4] tools/xl: allow resume command compilation for arm

2025-07-03 Thread Hari Limaye
Hi Mykola, > On Fri, Jun 27, 2025 at 01:51:31PM +, Mykola Kvach wrote: > From: Mykola Kvach > > The "xl resume" command was previously excluded from ARM builds because > system suspend/resume (e.g., `SYSTEM_SUSPEND`) via vPSCI was not > implemented. On x86, the command is used for ACPI S3 su

[PATCH v2 3/6] arm/mpu: Populate a new region in Xen MPU mapping table

2025-07-02 Thread Hari Limaye
. This commit only implements populating a new entry in Xen MPU memory mapping table(xen_mpumap). Signed-off-by: Penny Zheng Signed-off-by: Wei Chen Signed-off-by: Luca Fancellu Signed-off-by: Hari Limaye --- Changes from v1: - Simplify if condition - Use normal printk - Use %# over 0x% - Add

[PATCH v2 0/6] Second series for R82 MPU Support

2025-07-02 Thread Hari Limaye
Hi all, This series is the second set of patches in the ongoing work to introduce support for MPU systems and Cortex R82 in Xen. The patches in this series implement the necessary logic to map and unmap the Device Tree Blob in the early stages of the boot process. Changes from v1: - Changes ment

[PATCH v2 6/6] arm/mpu: Implement remove_early_mappings for MPU systems

2025-07-02 Thread Hari Limaye
From: Luca Fancellu Implement remove_early_mappings for MPU systems. Signed-off-by: Luca Fancellu Signed-off-by: Hari Limaye Reviewed-by: Ayan Kumar Halder --- Changes from v1: - Add Ayan's R-b --- xen/arch/arm/mpu/setup.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-)

[PATCH v2 2/6] xen/arm: Introduce flags_has_rwx helper

2025-07-02 Thread Hari Limaye
ff-by: Luca Fancellu Signed-off-by: Hari Limaye Reviewed-by: Ayan Kumar Halder Reviewed-by: Michal Orzel --- Changes from v1: - Add Ayan and Michal's R-b - Fix typos - Don't use extern for function prototype --- xen/arch/arm/include/asm/mm.h | 2 ++ xen/arch/arm/mm.c

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

2025-07-02 Thread Hari Limaye
: Wei Chen Signed-off-by: Luca Fancellu Signed-off-by: Hari Limaye --- Changes from v1: - Move check for part-region removal outside if condition - Use normal printk --- xen/arch/arm/include/asm/mpu.h| 2 + xen/arch/arm/include/asm/mpu/cpregs.h | 4 ++ xen/arch/arm/mpu/mm.c

[PATCH v2 1/6] arm/mpu: Find MPU region by range

2025-07-02 Thread Hari Limaye
From: Luca Fancellu Implement a function to find the index of a MPU region in the xen_mpumap MPU region array. This function will be used in future commits to implement creating and destroying MPU regions. Signed-off-by: Luca Fancellu Signed-off-by: Hari Limaye --- Changes from v1: - Update

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

2025-07-02 Thread Hari Limaye
the case that the initial mapping of the fdt_header is insufficient to cover the entire DTB, as we must destroy and then remap the region due to the APIs no providing support for extending the size of an existing region. Signed-off-by: Luca Fancellu Signed-off-by: Hari Limaye Reviewed-by: Ayan

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

2025-07-01 Thread Hari Limaye
Hi Ayan, Thank you for the review. I have just a couple of clarifications before I re-spin the series to address all the comments: > > -if ( flags & _PAGE_PRESENT ) > > +if ( (flags & _PAGE_PRESENT) && (MPUMAP_REGION_NOTFOUND == rc) ) > > Same question in this patch , why do we need to ch

Re: [PATCH 1/6] arm/mpu: Find MPU region by range

2025-06-30 Thread Hari Limaye
Hi Michal, Thank you very much for the review. I just had a small clarification regarding the following comment: >> + > +/* Allow index to be NULL */ > +index = index ? index : &_index; >If index argument is NULL, why bother setting this internal variable _index? This assignment is inten

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

2025-06-20 Thread Hari Limaye
the case that the initial mapping of the fdt_header is insufficient to cover the entire DTB, as we must destroy and then remap the region due to the APIs no providing support for extending the size of an existing region. Signed-off-by: Luca Fancellu Signed-off-by: Hari Limaye --- xen/arch/arm/mpu

[PATCH 0/6] Second series for R82 MPU Support

2025-06-20 Thread Hari Limaye
Hi all, This series is the second set of patches in the ongoing work to introduce support for MPU systems and Cortex R82 in Xen. The patches in this series implement the necessary logic to map and unmap the Device Tree Blob in the early stages of the boot process. Cheers, Hari Luca Fancellu (4)

[PATCH 6/6] arm/mpu: Implement remove_early_mappings for MPU systems

2025-06-20 Thread Hari Limaye
From: Luca Fancellu Implement remove_early_mappings for MPU systems. Signed-off-by: Luca Fancellu Signed-off-by: Hari Limaye --- xen/arch/arm/mpu/setup.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/mpu/setup.c b/xen/arch/arm/mpu/setup.c index

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

2025-06-20 Thread Hari Limaye
: Wei Chen Signed-off-by: Luca Fancellu Signed-off-by: Hari Limaye --- xen/arch/arm/include/asm/mpu.h| 2 + xen/arch/arm/include/asm/mpu/cpregs.h | 4 ++ xen/arch/arm/mpu/mm.c | 71 ++- 3 files changed, 75 insertions(+), 2 deletions(-) diff --git

[PATCH 2/6] xen/arm: Introduce flags_has_rwx helper

2025-06-20 Thread Hari Limaye
From: Luca Fancellu Introduce flags_has_rwx() function that will check if a mapping is both writable and executable when modifying or update the mapping. This check was already present in pt.c but since it will be used also for MPU system, it's wrapped into a function now. Signed-off-by: Luca F

[PATCH 3/6] arm/mpu: Populate a new region in Xen MPU mapping table

2025-06-20 Thread Hari Limaye
. This commit only implements populating a new entry in Xen MPU memory mapping table(xen_mpumap). Signed-off-by: Penny Zheng Signed-off-by: Wei Chen Signed-off-by: Luca Fancellu Signed-off-by: Hari Limaye --- xen/arch/arm/include/asm/mpu/mm.h | 12 xen/arch/arm/mpu/mm.c | 96

[PATCH 1/6] arm/mpu: Find MPU region by range

2025-06-20 Thread Hari Limaye
From: Luca Fancellu Implement a function to find the index of a MPU region in the xen_mpumap MPU region array. Signed-off-by: Luca Fancellu Signed-off-by: Hari Limaye --- xen/arch/arm/include/asm/mpu/mm.h | 29 ++ xen/arch/arm/mpu/mm.c | 66

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

2025-06-17 Thread Hari Limaye
rm32. > 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 > Reviewed-by: Luca Fancellu > --- Apart from the above, all LGTM! I've tested com

Re: [PATCH v3 5/6] arm/mpu: Define arm32 system registers

2025-06-16 Thread Hari Limaye
+, Ayan Kumar Halder wrote: > Fix the definition for HPRLAR. > Define the base/limit address registers to access the first 32 protection > regions. > > Signed-off-by: Ayan Kumar Halder > --- Reviewed-by: Hari Limaye Many thanks, Hari