]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: arm64: Fix HYP idmap unmap when using 52bit PA
authorMarc Zyngier <marc.zyngier@arm.com>
Wed, 14 Mar 2018 15:17:33 +0000 (15:17 +0000)
committerMarc Zyngier <marc.zyngier@arm.com>
Mon, 19 Mar 2018 13:04:26 +0000 (13:04 +0000)
commit68a3a09832562cff99ec88e6a4eae971e3d0d7f3
treed55a4a8f85e969183d096700813b83bb676fc591
parentd94273ff1cd400761c604fc3b1c5cdc0cf547f91
KVM: arm64: Fix HYP idmap unmap when using 52bit PA

Unmapping the idmap range using 52bit PA is quite broken, as we
don't take into account the right number of PGD entries, and rely
on PTRS_PER_PGD. The result is that pgd_index() truncates the
address, and we end-up in the weed.

Let's introduce a new unmap_hyp_idmap_range() that knows about this,
together with a kvm_pgd_index() helper, which hides a bit of the
complexity of the issue.

Fixes: b0c25ad0ae14 ("KVM: arm/arm64: fix HYP ID map extension to 52 bits")
Reported-by: James Morse <james.morse@arm.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
virt/kvm/arm/mmu.c