Re: [RFC PATCH v2 2/2] KVM: arm64: Support FFA_MEM_RECLAIM2 in host handler

From: Vincent Donnefort

Date: Tue Oct 20 2026 - 05:07:15 EST


On Fri, Oct 16, 2026 at 08:23:41AM +0000, Snehal Koukuntla wrote:
> FF-A v1.3 ALP5 (DEN0140 rev J) adds the FFA_MEM_RECLAIM2 interface,
> allowing an Owner to reclaim a subset of pages from a shared or lent
> memory region by populating constituent memory region descriptors in
> its TX buffer along with a starting descriptor byte offset and initial
> page index. Upon completion, the Relayer returns the number of 4K pages
> reclaimed in x3.
>
> Support FFA_MEM_RECLAIM2 in the host FF-A proxy handler. Validate the
> register arguments, copy the constituent descriptors from the host TX
> buffer into the hypervisor's TX buffer, and check the descriptor bounds,
> the total page count and the initial page index on that copy before
> forwarding the call to the SPMD. On success, unshare the reclaimed page
> ranges from the host stage-2 page tables.
>
> Link: https://support.arm.com/documentation/den0140/j
> Signed-off-by: Snehal Koukuntla <snehalreddy@xxxxxxxxxx>

Reviewed-by: Vincent Donnefort <vdonnefort@xxxxxxxxxx>

> ---
> Changes in v2:
> - Rename FFA_FN64_MEM_RECLAIM2 to FFA_MEM_RECLAIM2
> - Check that the sum of pg_cnt across all constituent descriptors
> matches total_pages, guarding against overflow (Vincent)
> - Simplify the flags and offset alignment checks (Vincent)
>
> arch/arm64/kvm/hyp/nvhe/ffa.c | 126 ++++++++++++++++++++++++++++++++++
> 1 file changed, 126 insertions(+)
>

[...]