[PATCH v7 45/45] WIP: Enable support for PAGE_SIZE>4k

Steven Price
2025-02-13T16:18:11Z

We now support host page sizes greater than 4k. For this to work
reliably the guest must be enlightened enough to make sharing requests
at a granule at least as big as the host. Which today means the guests
PAGE_SIZE must be equal or greater than the host.

Note that RTT tables are still allocated using the host's page size, so
most of the page will be wasted as only the first 4k are actually
delegated to the RMM. This is the main reason why this is still WIP - I
haven't yet implemented an appropriate allocator for this.

Large page sizes are also only very minimally tested, so expect bugs!

Signed-off-by: Steven Price <steven.price@arm.com>
---
New patch for v7
---
arch/arm64/kvm/rme.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/kvm/rme.c b/arch/arm64/kvm/rme.c
index a3eddf6917ad..4ae348ee9376 100644
--- a/arch/arm64/kvm/rme.c
+++ b/arch/arm64/kvm/rme.c
@@ -144,6 +144,7 @@ static int find_map_level(struct realm *realm,
return level;
}

+/* FIXME: This conflates pages and granules */
static phys_addr_t alloc_delegated_granule(struct kvm_mmu_memory_cache *mc)
{
phys_addr_t phys = PHYS_ADDR_MAX;
@@ -171,6 +172,7 @@ static phys_addr_t alloc_delegated_granule(struct kvm_mmu_memory_cache *mc)
return phys;
}

+/* FIXME: This conflates pages and granules */
static void free_delegated_granule(phys_addr_t phys)
{
if (WARN_ON(rmi_granule_undelegate(phys))) {
@@ -1694,10 +1696,6 @@ int kvm_init_realm_vm(struct kvm *kvm)

void kvm_init_rme(void)
{
- if (PAGE_SIZE != SZ_4K)
- /* Only 4k page size on the host is supported */
- return;
-
if (rmi_check_version())
/* Continue without realm support */
return;
--
2.43.0