On 24.11.2025 13:33, Oleksii Kurochko wrote:
> This patch introduces a working implementation of p2m_free_subtree() for 
> RISC-V
> based on ARM's implementation of p2m_free_entry(), enabling proper cleanup
> of page table entries in the P2M (physical-to-machine) mapping.
> 
> Only few things are changed:
> - Introduce and use p2m_get_type() to get a type of p2m entry as
>   RISC-V's PTE doesn't have enough space to store all necessary types so
>   a type is stored outside PTE. But, at the moment, handle only types
>   which fit into PTE's bits.
> 
> Key additions include:
> - p2m_free_subtree(): Recursively frees page table entries at all levels. It
>   handles both regular and superpage mappings and ensures that TLB entries
>   are flushed before freeing intermediate tables.
> - p2m_put_page() and helpers:
>   - p2m_put_4k_page(): Clears GFN from xenheap pages if applicable.
>   - p2m_put_2m_superpage(): Releases foreign page references in a 2MB
>     superpage.
>   - p2m_get_type(): Extracts the stored p2m_type from the PTE bits.
> - p2m_free_page(): Returns a page to a domain's freelist.
> - Introduce p2m_is_foreign() and connected to it things.
> 
> Signed-off-by: Oleksii Kurochko <[email protected]>

Acked-by: Jan Beulich <[email protected]>


Reply via email to