Re: [PATCH v19 09/20] KVM: arm64: Add VM specific callback for S2 MMU operations

From: Suzuki K Poulose

Date: Mon Sep 28 2026 - 04:17:00 EST


On 28/09/2026 02:25, Gavin Shan wrote:
On 9/28/26 11:09 AM, Gavin Shan wrote:
On 9/21/26 7:28 AM, Suzuki K Poulose wrote:
Add VM type specific S2 MMU operation backends which can be initialized per
VM flavor, to keep the handling cleaner.

Signed-off-by: Suzuki K Poulose <suzuki.poulose@xxxxxxx>
---
  arch/arm64/include/asm/kvm_host.h |  15 ++++
  arch/arm64/kvm/mmu.c              | 137 +++++++++++++++++++++++++-----
  2 files changed, 131 insertions(+), 21 deletions(-)

...

+int kvm_arch_flush_remote_tlbs_range(struct kvm *kvm,
+                     gfn_t gfn, u64 nr_pages)
+{
+    if (!kvm->arch.vm_s2_ops->vm_flush_remote_tlbs_range)
+        return 1;
+

Realm would the only case where vm_s2_ops->vm_flush_remote_{tlbs, tlbs_range)
are NULL. On request to flush remote TLBs by kvm_flush_remote_tlbs_range(), it
ends up with event KVM_REQ_TLB_FLUSH queued for each vCPU. How this queued event
is linked to a remote TLB flush for realm? The problem is TLBs are owned by EL2
realm and there are no RMI calls for the management. So I'm wandering we should
return 0 here?


vm_s2_ops->vm_flush_remote_{tlbs, tlbs_range} are added in PATCH[14] where 0 is
returned for both function. So I guess needn't this check at all?

     if (!kvm->arch.vm_s2_ops->vm_flush_remote_tlbs_range)

I would leave that check as they are. The only callback that
is mandatory is the vm_mem_abort and we do enforce it at init.

Cheers
Suzuki