Skip to content

KVM: Introduce KVM_MEM_UNCACHED

Andrew Jones kvmarm qemu-devel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 47 repliesIn review
  2. v1 RFC3 patches 6 repliesSuperseded

Changes in v2 from the cover letter

1) don't pin pages [Paolo]
2) ensure the guest maps the memory non-cacheable [me]
3) clean up memslot flag documentation [Christoffer]
changes 1 and 2 effectively redesigned/rewrote v1. Find v1 here
http://www.spinics.net/lists/kvm-arm/msg14022.html

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3arm/arm64: pageattr: add set_memory_ncarch/arm/include/asm/cacheflush.h arch/arm/mm/pageattr.c arch/arm64/include/asm/cacheflush.h +1 more+17 -012 replies
2/3KVM: promote KVM_MEMSLOT_INCOHERENT to uapiDocumentation/virtual/kvm/api.txt arch/arm/include/uapi/asm/kvm.h arch/arm/kvm/arm.c +5 more+27 -102 replies
3/3arm/arm64: KVM: implement 'uncached' mem coherencyarch/arm/include/asm/kvm_mmu.h arch/arm/include/asm/pgtable-3level.h arch/arm/include/asm/pgtable.h +4 more+36 -157 replies

Reviews trailers per patch

2 of 3 patches have a Reviewed-by or Acked-by.

PatchPaolo BonziniChristoffer Dall
1/3R-b
2/3R-b R-b
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [RFC/RFT PATCH v2 0/3] KVM: Introduce KVM_MEM_UNCACHED

Introduce a new memory region flag, KVM_MEM_UNCACHED, which is needed by ARM. This flag informs KVM that the given memory region is typically mapped by the guest as non-cacheable. KVM for ARM then ensures that that memory is indeed mapped non-cacheable by the guest, and also remaps that region as non-cacheable for userspace, allowing them both to maintain a coherent view.

Changes since v1:
1) don't pin pages [Paolo]
2) ensure the guest maps the memory non-cacheable [me]
3) clean up memslot flag documentation [Christoffer]
changes 1 and 2 effectively redesigned/rewrote v1. Find v1 here
http://www.spinics.net/lists/kvm-arm/msg14022.html

The QEMU series for v1 hasn't really changed. Only the linux header hack needed to bump KVM_CAP_UNCACHED_MEM from 107 to
116. Find the series here
http://www.spinics.net/lists/kvm-arm/msg14026.html

Testing:
This series still needs lots of testing, but I thought I'd kick it to the list early, as there's been recent interest in solving this problem, and I'd like to get test results and opinions on this approach from others sooner than later. I've tested with AAVMF (UEFI for AArch64 mach-virt guests). AAVMF has a kludge in it to avoid the coherency problem. I've tested both with and without that kludge active. Both worked for me (almost). Sometimes with the non-kludged version I was still able to see a bit of corruption in grub's output after edk2 loaded it - not much, and not always, but something. Anyway, it's quite frustrating, as I'm not sure what I'm missing...

This series applies to Linus' 110bc76729d4, but I tested with a version backported to the current RHELSA kernel.

Thanks for reviews and testing!

drew

Andrew Jones (3):
arm/arm64: pageattr: add set_memory_nc
KVM: promote KVM_MEMSLOT_INCOHERENT to uapi arm/arm64: KVM: implement 'uncached' mem coherency

 Documentation/virtual/kvm/api.txt     | 20 ++++++++++++------
 arch/arm/include/asm/cacheflush.h     |  1 +
 arch/arm/include/asm/kvm_mmu.h        |  5 ++++-
 arch/arm/include/asm/pgtable-3level.h |  1 +
 arch/arm/include/asm/pgtable.h        |  1 +
 arch/arm/include/uapi/asm/kvm.h       |  1 +
 arch/arm/kvm/arm.c                    |  1 +
 arch/arm/kvm/mmu.c                    | 39 ++++++++++++++++++++++-------------
 arch/arm/mm/pageattr.c                |  7 +++++++
 arch/arm64/include/asm/cacheflush.h   |  1 +
 arch/arm64/include/asm/kvm_mmu.h      |  5 ++++-
 arch/arm64/include/asm/memory.h       |  1 +
 arch/arm64/include/asm/pgtable.h      |  1 +
 arch/arm64/include/uapi/asm/kvm.h     |  1 +
 arch/arm64/mm/pageattr.c              |  8 +++++++
 include/linux/kvm_host.h              |  1 -
 include/uapi/linux/kvm.h              |  2 ++
 virt/kvm/kvm_main.c                   |  7 ++++++-
 18 files changed, 79 insertions(+), 24 deletions(-)
Signature · 1 line
2.1.0