On 30/07/2025 10:45, Hari Limaye wrote:
> From: Luca Fancellu <luca.fance...@arm.com>
>
> 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 <luca.fance...@arm.com>
> Signed-off-by: Hari Limaye <hari.lim...@arm.com>
> ---
> xen/arch/arm/include/asm/mpu/mm.h | 22 +++++
> xen/arch/arm/mpu/mm.c | 150 ++++++++++++++++++++++++++++--
> 2 files changed, 163 insertions(+), 9 deletions(-)
>
> diff --git a/xen/arch/arm/include/asm/mpu/mm.h
> b/xen/arch/arm/include/asm/mpu/mm.h
> index 56ca411af4..177550f5bd 100644
> --- a/xen/arch/arm/include/asm/mpu/mm.h
> +++ b/xen/arch/arm/include/asm/mpu/mm.h
> @@ -106,6 +106,28 @@ int xen_mpumap_update(paddr_t base, paddr_t limit,
> unsigned int flags,
> */
> pr_t pr_of_addr(paddr_t base, paddr_t limit, unsigned int flags);
>
> +/*
> + * Maps a temporary range of memory with attributes `flags`; if the range is
Why do you always mention 'temporary' in the context of these functions? What
prevents us from using them to map a region for a longer period of time?
Also, temporary range is a bit confusing term and should better be replaced with
'Maps temporarily a range of memory ...'
> + * already mapped with the same attributes, including an inclusive match, the
> + * existing mapping is returned. This API is intended for mappings that exist
What are the use cases you want to cover to try to map the same range with the
same attributes more than once (without unmapping in the meantime)?
> + * transiently for a short period between calls to this function and
> + * `unmap_mm_range`.
> + *
> + * @param start Base address of the range to map (inclusive).
> + * @param end Limit address of the range to map (exclusive).
> + * @param flags Flags for the memory range to map.
> + * @return Pointer to start of region on success, NULL on error.
> + */
> +void *map_mm_range(paddr_t start, paddr_t end, unsigned int flags);
So far, all the MPU related functions use [base, limit) instead of [start, end).
Do we see the benefit of diverging here?
~Michal