Re: [PATCH v5 2/5] KVM: arm64: Add pre_fault_memory implementation

From: Thomson, Jack

Date: Fri Aug 21 2026 - 10:09:38 EST


Hi Vincent,

On 27/07/2026 12:11 pm, Vincent Donnefort wrote:
+ unsigned long *page_size;

It looks a bit odd in that struct.

Also, transparent_hugepage_adjust() modifies pfn and gfn. So perhaps it'd be
better to introduce a struct kvm_s2_fault_mapping that can be used to get what
has actually been mapped in kvm_s2_fault_map()?


Yeah that's much nicer I'll do that thanks for the suggestion!

+ if (vcpu_is_protected(vcpu))
+ return -EOPNOTSUPP;

It could just call pkvm_mem_abort() when the VM is protected?


I see, I don't have a setup to test this properly myself, so at the
moment I left the protected vm's out and don't advertise the capability,
if there's a usecase happy to look at it as a follow-up.

+ /*
+ * pKVM stage-2 mappings aren't directly walkable from the host; let
+ * the fault path handle both new and existing mappings.
+ */

pKVM has a host interval-tree where we keep track of what has been mapped and at
what level. This tree is also protected with the mmu_lock.


Thanks, that sounds better. I'll have a look at moving to that for v6 then.

--
Thanks,
Jack