diff options
| author | Vincent Donnefort <vdonnefort@google.com> | 2026-10-01 15:28:35 +0100 |
|---|---|---|
| committer | Marc Zyngier <maz@kernel.org> | 2026-10-02 17:06:40 +0100 |
| commit | c8d7834c9c219a9a0e3969986e90c5c444b9d98d (patch) | |
| tree | a99772666da6e8fe11a95bc8c425d9f8da8ad96a /tools/perf/scripts/python/stackcollapse.py | |
| parent | 06b705e789ed1a118331bc77f477a9b46c52dcfe (diff) | |
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>
Diffstat (limited to 'tools/perf/scripts/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions
