Hi Michal,

>> + * 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 ...'
The intended meaning of ’temporary’ in the context of these functions is that 
the mapping is created, used, and then destroyed in a sequence e.g. where 
map_domain_page and unmap_domain_page are used. The term transient is possibly 
more fitting than temporary, and this is the term used in 
xen/common/page_alloc.c. Nothing actually prevents us from using them to map a 
region for a longer period of time, it is just that the intended use of the API 
is for transient mapping. Regarding the confusing comment - noted I will fix 
this in the next version of the series.

>> + * 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)?
The use case here is some places where a memory region is requested that has 
already been mapped, so we want to simply return the mapping. For example when 
the fdt is relocated in start_xen this uses a call to `xmalloc`, which 
eventually calls `map_domain_page` for an address in the static heap which has 
already been mapped.

>> + * 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

Noted, I will align this to use [base, limit) in the next version of the series.

Many thanks,
Hari

Reply via email to