Re: [PATCH v22 13/23] KVM: arm64: Abstract out memory abort handling
From: Suzuki K Poulose
Date: Tue Oct 06 2026 - 01:26:13 EST
On 06/10/2026 04:07, Gavin Shan wrote:
On 10/5/26 7:07 PM, Suzuki K Poulose wrote:
Move the memory abort handling under VM specific s2 operation.
Tested-by: Gavin Shan <gshan@xxxxxxxxxx>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@xxxxxxx>
---
Changes since v21:
- Rename protected_vm_mem_abort => protected_pkvm_mem_abort for consistency
with the other callbacks.
---
arch/arm64/include/asm/kvm_host.h | 2 ++
arch/arm64/kvm/mmu.c | 33 ++++++++++++++++++-------------
2 files changed, 21 insertions(+), 14 deletions(-)
One nitpick below. In either way:
Reviewed-by: Gavin Shan <gshan@xxxxxxxxxx>
Thanks Gavin !
...
+static int kvm_vm_mem_abort(const struct kvm_s2_fault_desc *s2fd)
+{
+ struct kvm_vcpu *vcpu = s2fd->vcpu;
+
+ VM_WARN_ON_ONCE(kvm_vcpu_trap_is_permission_fault(vcpu) &&
+ !kvm_is_write_fault(vcpu) &&
+ !kvm_vcpu_trap_is_exec_fault(vcpu));
+
+ if (kvm_slot_has_gmem(s2fd->memslot))
+ return gmem_abort(s2fd);
+ else
+ return user_mem_abort(s2fd);
+}
The "if...else" block is moved from kvm_handle_guest_abort(), but it might be
clearer if we have:
if (kvm_slot_has_gmem(s2fd->memslot))
return gmem_abort(s2fd);
return user_mem_abort(s2fd);
This was chosen based on another review comment. So, lets stick with this now.
Cheers
Suzuki