linux/arch/arm/kvm
Marc Zyngier db69415c3f arm64: KVM: Do not use pgd_index to index stage-2 pgd
commit 04b8dc85bf upstream.

The kernel's pgd_index macro is designed to index a normal, page
sized array. KVM is a bit diffferent, as we can use concatenated
pages to have a bigger address space (for example 40bit IPA with
4kB pages gives us an 8kB PGD.

In the above case, the use of pgd_index will always return an index
inside the first 4kB, which makes a guest that has memory above
0x8000000000 rather unhappy, as it spins forever in a page fault,
whist the host happilly corrupts the lower pgd.

The obvious fix is to get our own kvm_pgd_index that does the right
thing(tm).

Tested on X-Gene with a hacked kvmtool that put memory at a stupidly
high address.

Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
[ luis: backported to 3.16: used shannon's backport to 3.14 ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
History 2015-05-20 13:25:54 +01:00
..
arm.c arm/arm64: KVM: Require in-kernel vgic for the arch timers 2015-05-20 13:25:52 +01:00
coproc.c KVM: ARM/arm64: avoid returning negative error code as bool 2015-05-20 13:25:43 +01:00
coproc.h ARM: KVM: trap VM system registers until MMU and caches are ON 2014-03-03 01:15:24 +00:00
coproc_a7.c ARM: KVM: trap VM system registers until MMU and caches are ON 2014-03-03 01:15:24 +00:00
coproc_a15.c ARM: KVM: trap VM system registers until MMU and caches are ON 2014-03-03 01:15:24 +00:00
emulate.c KVM: ARM: Fix typo in comments of inject_abt() 2013-10-02 17:29:19 +01:00
guest.c arm/arm64: KVM: Reset the HCR on each vcpu when resetting the vcpu 2015-05-20 13:25:51 +01:00
handle_exit.c arm/arm64: KVM: Complete WFI/WFE instructions 2014-10-05 13:40:52 -07:00
init.S ARM/ARM64: KVM: Nuke Hyp-mode tlbs before enabling MMU 2014-10-05 13:40:53 -07:00
interrupts.S arm/arm64: KVM: detect CPU reset on CPU_PM_EXIT 2014-02-27 19:27:10 +01:00
interrupts_head.S ARM: KVM: add world-switch for AMAIR{0,1} 2014-03-03 01:15:24 +00:00
Kconfig ARM: KVM: disable KVM in Kconfig on big-endian systems 2014-04-26 04:20:03 -07:00
Makefile KVM: ARM: Add support for Cortex-A7 2013-10-12 17:45:30 -07:00
mmio.c arm/arm64: KVM: MMIO support for BE guest 2013-11-07 19:09:04 +00:00
mmu.c arm64: KVM: Do not use pgd_index to index stage-2 pgd 2015-05-20 13:25:54 +01:00
perf.c ARM: KVM: add support for minimal host vs guest profiling 2013-04-28 21:44:01 -07:00
psci.c ARM/ARM64: KVM: Emulate PSCI v0.2 CPU_SUSPEND 2014-04-30 04:18:58 -07:00
reset.c Updates for KVM/ARM, take 3 supporting more than 4 CPUs. 2013-11-11 12:02:27 +01:00
trace.h ARM: KVM: Simplify tracepoint text 2013-08-30 15:47:53 -07:00