public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: arm/arm64: Revert to old way of checking for device mapping in stage2_flush_ptes().
@ 2015-12-01 13:03 Pavel Fedin
  2015-12-02 17:41 ` Ard Biesheuvel
  2015-12-02 18:50 ` Christoffer Dall
  0 siblings, 2 replies; 11+ messages in thread
From: Pavel Fedin @ 2015-12-01 13:03 UTC (permalink / raw)
  To: kvmarm, kvm; +Cc: marc.zyngier, stable, Ard Biesheuvel

This function takes stage-II physical addresses (A.K.A. IPA), on input, not
real physical addresses. This causes kvm_is_device_pfn() to return wrong
values, depending on how much guest and host memory maps match. This
results in completely broken KVM on some boards. The problem has been
caught on Samsung proprietary hardware.

Cc: stable@vger.kernel.org
Fixes: e6fab5442345 ("ARM/arm64: KVM: test properly for a PTE's uncachedness")

Signed-off-by: Pavel Fedin <p.fedin@samsung.com>
---
 arch/arm/kvm/mmu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c
index 7dace90..51ad98f 100644
--- a/arch/arm/kvm/mmu.c
+++ b/arch/arm/kvm/mmu.c
@@ -310,7 +310,8 @@ static void stage2_flush_ptes(struct kvm *kvm, pmd_t *pmd,
 
 	pte = pte_offset_kernel(pmd, addr);
 	do {
-		if (!pte_none(*pte) && !kvm_is_device_pfn(__phys_to_pfn(addr)))
+		if (!pte_none(*pte) &&
+		    (pte_val(*pte) & PAGE_S2_DEVICE) != PAGE_S2_DEVICE)
 			kvm_flush_dcache_pte(*pte);
 	} while (pte++, addr += PAGE_SIZE, addr != end);
 }
-- 
2.4.4

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2015-12-04  8:37 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-01 13:03 [PATCH] KVM: arm/arm64: Revert to old way of checking for device mapping in stage2_flush_ptes() Pavel Fedin
2015-12-02 17:41 ` Ard Biesheuvel
2015-12-03  7:14   ` Pavel Fedin
2015-12-03  8:09     ` Ard Biesheuvel
2015-12-03  8:14       ` Pavel Fedin
2015-12-04  1:58   ` Ben Hutchings
2015-12-04  6:39     ` Pavel Fedin
2015-12-04  8:37     ` Ard Biesheuvel
2015-12-02 18:50 ` Christoffer Dall
2015-12-02 19:04   ` Ard Biesheuvel
2015-12-02 19:23     ` Christoffer Dall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox