summaryrefslogtreecommitdiffstats
path: root/virt/kvm
diff options
context:
space:
mode:
authorMarc Zyngier <marc.zyngier@arm.com>2018-03-12 14:25:10 +0000
committerMarc Zyngier <marc.zyngier@arm.com>2018-03-19 13:04:17 +0000
commit46fef158f10d255dfe47cf3a0ab5f0965b66b1da (patch)
treef4a777adab64a7572f270695ca7d0f9de7948a30 /virt/kvm
parent1bb32a44aea1fe73c6f84e466a45ae559ef74559 (diff)
downloadlinux-46fef158f10d255dfe47cf3a0ab5f0965b66b1da.tar.gz
linux-46fef158f10d255dfe47cf3a0ab5f0965b66b1da.tar.bz2
linux-46fef158f10d255dfe47cf3a0ab5f0965b66b1da.zip
KVM: arm/arm64: Fix idmap size and alignment
Although the idmap section of KVM can only be at most 4kB and must be aligned on a 4kB boundary, the rest of the code expects it to be page aligned. Things get messy when tearing down the HYP page tables when PAGE_SIZE is 64K, and the idmap section isn't 64K aligned. Let's fix this by computing aligned boundaries that the HYP code will use. Acked-by: Catalin Marinas <catalin.marinas@arm.com> Reported-by: James Morse <james.morse@arm.com> Reviewed-by: James Morse <james.morse@arm.com> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Diffstat (limited to 'virt/kvm')
-rw-r--r--virt/kvm/arm/mmu.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/virt/kvm/arm/mmu.c b/virt/kvm/arm/mmu.c
index 52b0ee31ebee..c41d03a8af93 100644
--- a/virt/kvm/arm/mmu.c
+++ b/virt/kvm/arm/mmu.c
@@ -1815,7 +1815,9 @@ int kvm_mmu_init(void)
int err;
hyp_idmap_start = kvm_virt_to_phys(__hyp_idmap_text_start);
+ hyp_idmap_start = ALIGN_DOWN(hyp_idmap_start, PAGE_SIZE);
hyp_idmap_end = kvm_virt_to_phys(__hyp_idmap_text_end);
+ hyp_idmap_end = ALIGN(hyp_idmap_end, PAGE_SIZE);
hyp_idmap_vector = kvm_virt_to_phys(__kvm_hyp_init);
/*