]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
KVM: arm64: Separate allocation and insertion of pKVM VM table entries
authorFuad Tabba <tabba@google.com>
Tue, 9 Sep 2025 07:24:33 +0000 (08:24 +0100)
committerMarc Zyngier <maz@kernel.org>
Mon, 15 Sep 2025 09:46:55 +0000 (10:46 +0100)
commit1abc1ad52989fcc45a0de68bc49656d9fd0c2d74
treee451dcf152680e8b24d22531e4bb244e659ce24f
parent3c45b67625357ac680ee2508493b697cdcd78128
KVM: arm64: Separate allocation and insertion of pKVM VM table entries

The current insert_vm_table_entry() function performs two actions at
once: it finds a free slot in the pKVM VM table and populates it with
the pkvm_hyp_vm pointer.

Refactor this function as a preparatory step for future work that will
require reserving a VM slot and its corresponding handle earlier in the
VM lifecycle, before the pkvm_hyp_vm structure is initialized and ready
to be inserted.

Split the function into a two-phase process:

- A new allocate_vm_table_entry() function finds an empty slot, marks it
  as reserved with a RESERVED_ENTRY placeholder, and returns a handle
  derived from the slot's index.

- The insert_vm_table_entry() function is repurposed to take the handle,
  validate that the corresponding slot is in the reserved state, and
  then populate it with the pkvm_hyp_vm pointer.

Signed-off-by: Fuad Tabba <tabba@google.com>
Tested-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/kvm/hyp/nvhe/pkvm.c