linux_dsm_epyc7002/arch/arm/kvm
Ard Biesheuvel e6fab54423 ARM/arm64: KVM: test properly for a PTE's uncachedness
The open coded tests for checking whether a PTE maps a page as
uncached use a flawed '(pte_val(xxx) & CONST) != CONST' pattern,
which is not guaranteed to work since the type of a mapping is
not a set of mutually exclusive bits

For HYP mappings, the type is an index into the MAIR table (i.e, the
index itself does not contain any information whatsoever about the
type of the mapping), and for stage-2 mappings it is a bit field where
normal memory and device types are defined as follows:

    #define MT_S2_NORMAL            0xf
    #define MT_S2_DEVICE_nGnRE      0x1

I.e., masking *and* comparing with the latter matches on the former,
and we have been getting lucky merely because the S2 device mappings
also have the PTE_UXN bit set, or we would misidentify memory mappings
as device mappings.

Since the unmap_range() code path (which contains one instance of the
flawed test) is used both for HYP mappings and stage-2 mappings, and
considering the difference between the two, it is non-trivial to fix
this by rewriting the tests in place, as it would involve passing
down the type of mapping through all the functions.

However, since HYP mappings and stage-2 mappings both deal with host
physical addresses, we can simply check whether the mapping is backed
by memory that is managed by the host kernel, and only perform the
D-cache maintenance if this is the case.

Cc: stable@vger.kernel.org
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: Pavel Fedin <p.fedin@samsung.com>
Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
2015-11-24 17:58:00 +01:00
..
arm.c arm/arm64: KVM: Improve kvm_exit tracepoint 2015-10-22 23:01:47 +02:00
coproc_a7.c arm/arm64: KVM: Use set/way op trapping to track the state of the caches 2015-01-29 23:24:56 +01:00
coproc_a15.c arm/arm64: KVM: Use set/way op trapping to track the state of the caches 2015-01-29 23:24:56 +01:00
coproc.c arm/arm64: KVM: Use set/way op trapping to track the state of the caches 2015-01-29 23:24:56 +01:00
coproc.h arm/arm64: KVM: Use set/way op trapping to track the state of the caches 2015-01-29 23:24:56 +01:00
emulate.c KVM: ARM: Fix typo in comments of inject_abt() 2013-10-02 17:29:19 +01:00
guest.c KVM: arm: guest debug, add stub KVM_SET_GUEST_DEBUG ioctl 2015-07-21 12:47:08 +01:00
handle_exit.c ARM: KVM: extend WFI tracepoint to differentiate between wfi and wfe 2015-01-15 13:12:27 +01:00
init.S ARM: kvm: round HYP section to page size instead of log2 upper bound 2015-03-27 12:21:27 +00:00
interrupts_head.S arm: KVM: Disable virtual timer even if the guest is not using it 2015-09-17 13:11:48 +01:00
interrupts.S arm: KVM: keep arm vfp/simd exit handling consistent with arm64 2015-08-19 22:27:58 +01:00
Kconfig arm/arm64: KVM : Enable vhost device selection under KVM config menu 2015-10-22 23:01:45 +02:00
Makefile KVM: arm/arm64: Enable the KVM-VFIO device 2015-06-17 09:46:29 +01:00
mmio.c KVM: arm/arm64: rework MMIO abort handling to use KVM MMIO bus 2015-03-30 17:07:19 +01:00
mmu.c ARM/arm64: KVM: test properly for a PTE's uncachedness 2015-11-24 17:58:00 +01:00
perf.c ARM: KVM: add support for minimal host vs guest profiling 2013-04-28 21:44:01 -07:00
psci.c KVM: arm/arm64: rename pause into power_off 2015-10-22 23:01:45 +02:00
reset.c KVM: arm/arm64: timer: Allow the timer to control the active state 2015-08-12 11:28:26 +01:00
trace.h arm/arm64: KVM: Improve kvm_exit tracepoint 2015-10-22 23:01:47 +02:00