| #
6b1abd43 |
| 05-Oct-2026 |
Vincent Donnefort <vdonnefort@google.com> |
KVM: arm64: pkvm: Drop keneldoc markers for the allocator structs
chunk_hdr and hyp_allocator are private. Their description is not exposed to the API documentation. Drop the kerneldoc markers.
Whi
KVM: arm64: pkvm: Drop keneldoc markers for the allocator structs
chunk_hdr and hyp_allocator are private. Their description is not exposed to the API documentation. Drop the kerneldoc markers.
While at it add the missing description for chunk_hdr::data.
Signed-off-by: Vincent Donnefort <vdonnefort@google.com> Closes: https://lore.kernel.org/oe-kbuild-all/202610041002.Yvw5qUrt-lkp@intel.com/ Link: https://patch.msgid.link/20261005072046.2246900-1-vdonnefort@google.com Signed-off-by: Marc Zyngier <maz@kernel.org>
show more ...
|
| #
bd930683 |
| 01-Oct-2026 |
Vincent Donnefort <vdonnefort@google.com> |
KVM: arm64: Add selftests for the pKVM heap allocator
Introduce a comprehensive runtime selftest for the pKVM hypervisor heap allocator, executed during init when CONFIG_NVHE_EL2_DEBUG is enabled.
KVM: arm64: Add selftests for the pKVM heap allocator
Introduce a comprehensive runtime selftest for the pKVM hypervisor heap allocator, executed during init when CONFIG_NVHE_EL2_DEBUG is enabled.
The selftest runs entirely at EL2 and exercises allocator's core mechanisms:
* over-sized allocations * basic allocation and alignment * chunk recycling, splitting, merging * memory reclaiming * memory topup
Signed-off-by: Vincent Donnefort <vdonnefort@google.com> Reviewed-by: Fuad Tabba <fuad.tabba@linux.dev> Tested-by: Fuad Tabba <fuad.tabba@linux.dev> Link: https://patch.msgid.link/20261001142849.3367614-10-vdonnefort@google.com Signed-off-by: Marc Zyngier <maz@kernel.org>
show more ...
|
| #
c8d7834c |
| 01-Oct-2026 |
Vincent Donnefort <vdonnefort@google.com> |
KVM: arm64: Add a heap allocator for the pKVM hyp
Currently, memory used by the hypervisor comes from donations that are embedded within HVCs. e.g. __pkvm_init_vm()'s hyp_vm.
This is cumbersome: th
KVM: arm64: Add a heap allocator for the pKVM hyp
Currently, memory used by the hypervisor comes from donations that are embedded within HVCs. e.g. __pkvm_init_vm()'s hyp_vm.
This is cumbersome: the host needs to know the size of those struct, the memory must be page-aligned and physically contiguous which may be difficult to satisfy when host memory is highly fragmented.
Create a heap allocator to manage VA-contiguous memory. This allocator grows upward, recycles unused chunks of memory and provides a simple API to allocate and free:
hyp_alloc(size), hyp_free(addr)
This heap allocator also manages the underlying physical memory, allowing the host to top up the allocator's pool and reclaim memory.
hyp_alloc_topup(), hyp_alloc_reclaim().
Pages remain mapped in the allocator's VA-space as long as they are not reclaimed.
When the allocator runs out of memory, hyp_alloc() fails and hyp_alloc_errno() returns -ENOMEM to signal that a top-up is required.
Additionally, harden the allocator with a fast hash of the chunks meta-data. This intends to detect accidental corruptions and makes the allocator slightly more robust to potential attacks.
Signed-off-by: Vincent Donnefort <vdonnefort@google.com> Tested-by: Fuad Tabba <fuad.tabba@linux.dev> Reviewed-by: Fuad Tabba <fuad.tabba@linux.dev> Link: https://patch.msgid.link/20261001142849.3367614-5-vdonnefort@google.com Signed-off-by: Marc Zyngier <maz@kernel.org>
show more ...
|