linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/3] arm64: KVM: host cache maintainance when guest caches are off
@ 2014-01-17 15:03 Marc Zyngier
  2014-01-17 15:03 ` [RFC PATCH 1/3] arm64: KVM: force cache clean on page fault when " Marc Zyngier
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Marc Zyngier @ 2014-01-17 15:03 UTC (permalink / raw)
  To: linux-arm-kernel

When we run a guest with cache disabled, we don't flush the cache to
the Point of Coherency, hence possibly missing bits of data that have
been written in the cache, but have not yet reached memory.

We also have the opposite issue: when a guest enables its cache,
whatever sits in the cache is suddenly going to become visible,
shadowing whatever the guest has written into RAM.

There are several approaches to these issues:
- Using the DC bit when caches are off: this breaks guests assuming
  caches off while doing DMA operations. Bootloaders, for example.
  It also breaks the I-D coherency.
- Fetch the memory attributes on translation fault, and flush the
  cache while handling the fault. This relies on using the PAR_EL1
  register to obtain the Stage-1 memory attributes, and tends to be
  slow.
- Detecting the translation faults occuring with MMU off (and
  performing a cache clean), and trapping SCTLR_EL1 to detect the
  moment when the guest is turning its caches on (and performing a
  cache invalidation). Trapping of SCTLR_EL1 is then disabled to
  ensure the best performance.

This patch series implements the last solution, only on arm64 for the
time being (I'll add the necessary ARMv7 bits once we reach an
agreement on arm64).

Marc Zyngier (3):
  arm64: KVM: force cache clean on page fault when caches are off
  arm64: KVM: trap VM system registers until MMU and caches are ON
  arm64: KVM: flush VM pages before letting the guest enable caches

 arch/arm/include/asm/kvm_mmu.h   |  4 +--
 arch/arm/kvm/mmu.c               | 76 ++++++++++++++++++++++++++++++++++++++--
 arch/arm64/include/asm/kvm_arm.h |  3 +-
 arch/arm64/include/asm/kvm_mmu.h | 12 ++++---
 arch/arm64/kvm/sys_regs.c        | 61 ++++++++++++++++++++++++++------
 5 files changed, 136 insertions(+), 20 deletions(-)

-- 
1.8.3.4

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

end of thread, other threads:[~2014-01-21 14:15 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-17 15:03 [RFC PATCH 0/3] arm64: KVM: host cache maintainance when guest caches are off Marc Zyngier
2014-01-17 15:03 ` [RFC PATCH 1/3] arm64: KVM: force cache clean on page fault when " Marc Zyngier
2014-01-17 15:03 ` [RFC PATCH 2/3] arm64: KVM: trap VM system registers until MMU and caches are ON Marc Zyngier
2014-01-20 12:00   ` Anup Patel
2014-01-20 13:41     ` Marc Zyngier
2014-01-20 16:30       ` Anup Patel
2014-01-21 12:17         ` Pranavkumar Sawargaonkar
2014-01-21 14:15           ` Marc Zyngier
2014-01-17 15:03 ` [RFC PATCH 3/3] arm64: KVM: flush VM pages before letting the guest enable caches Marc Zyngier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).