]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
KVM: arm64: Support unaligned fixmap in the pKVM hyp
authorVincent Donnefort <vdonnefort@google.com>
Mon, 9 Mar 2026 16:25:08 +0000 (16:25 +0000)
committerMarc Zyngier <maz@kernel.org>
Wed, 11 Mar 2026 08:51:16 +0000 (08:51 +0000)
Return the fixmap VA with the page offset, instead of the page base
address. This allows to use hyp_fixmap_map() seamlessly regardless of
the address alignment. While at it, do the same for hyp_fixblock_map().

Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
Link: https://patch.msgid.link/20260309162516.2623589-23-vdonnefort@google.com
Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/kvm/hyp/nvhe/mm.c

index 218976287d3fe71d8f5048c0dae494034d25e613..c98cec0c150f6f0bb09fbd26266cba9ef0b0b7fb 100644 (file)
@@ -244,7 +244,7 @@ static void *fixmap_map_slot(struct hyp_fixmap_slot *slot, phys_addr_t phys)
 
 void *hyp_fixmap_map(phys_addr_t phys)
 {
-       return fixmap_map_slot(this_cpu_ptr(&fixmap_slots), phys);
+       return fixmap_map_slot(this_cpu_ptr(&fixmap_slots), phys) + offset_in_page(phys);
 }
 
 static void fixmap_clear_slot(struct hyp_fixmap_slot *slot)
@@ -366,7 +366,7 @@ void *hyp_fixblock_map(phys_addr_t phys, size_t *size)
 #ifdef HAS_FIXBLOCK
        *size = PMD_SIZE;
        hyp_spin_lock(&hyp_fixblock_lock);
-       return fixmap_map_slot(&hyp_fixblock_slot, phys);
+       return fixmap_map_slot(&hyp_fixblock_slot, phys) + offset_in_page(phys);
 #else
        *size = PAGE_SIZE;
        return hyp_fixmap_map(phys);