Add KVM support for Book3s_64 (PPC64) hosts v2
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest14 of 23 patches 3 repliesIn review
V1 -> V2 from the cover letter
- extend sregs with padding
- new naming scheme (ppc64 -> book3s_64; 74xx -> book3s_32)
- to_phys -> in-kernel tophys()
- loadimm -> LOAD_REG_IMMEDIATE
- call .ko kvm.ko
- set magic paca bit later
- run guest code with PACA->soft_enabled=true
- pt_regs for host state saving (guest too?)
- only do HV dcbz trick on 970
- refuse to run on LPAR because of missing SLB pieces
14 of 23 patches are in this archive. The cover letter announces 23.
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 2/23 | Add Book3s definitionsarch/ | +39 | 0 replies | |
| 3/23 | Add Book3s fields to vcpu structsarch/ | +79 | 0 replies | |
| 4/23 | Add asm/kvm_book3s.harch/ | +131 | 0 replies | |
| 5/23 | Add Book3s_64 intercept helpersarch/ | +58 | 0 replies | |
| 6/23 | Add book3s_64 highmem asm codearch/ arch/ | +405 | 0 replies | |
| 9/23 | Add book3s.carch/ | +955 | 0 replies | |
| 10/23 | Add book3s_64 Host MMU handlingarch/ | +439 | 0 replies | |
| 11/23 | Add book3s_64 guest MMUarch/ | +466 | 0 replies | |
| 12/23 | Add book3s_32 guest MMUarch/ | +357 | 0 replies | |
| 13/23 | Add book3s_64 specific opcode emulationarch/ | +338 | 0 replies | |
| 18/23 | Add Book3s_64 offsets to asm-offsets.carch/ | +13 | 0 replies | |
| 21/23 | Include Book3s_64 target in buildsystemarch/ arch/ | +40 | 0 replies | |
| 22/23 | Fix trace.harch/ | +3 | 0 replies | |
| 23/23 | Hack in dirty logging for VGAarch/ | +20 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 00/23] Add KVM support for Book3s_64 (PPC64) hosts v2
KVM for PowerPC only supports embedded cores at the moment.
While it makes sense to virtualize on small machines, it's even more fun to do so on big boxes. So I figured we need KVM for PowerPC64 as well.
This patchset implements KVM support for Book3s_64 hosts and guest support for Book3s_64 and G3/G4.
To really make use of this, you will also need a modified version of qemu that can deal with KVM on desktop cores. I will send out patches for those later, but want to get feedback on the kernel side first.
In the meanwhile, use the qemu version from
http://www.powerkvm.org/powerkvm.git which already includes all required patches to run G3/G4 and G5 guests.
V1 -> V2:
- extend sregs with padding
- new naming scheme (ppc64 -> book3s_64; 74xx -> book3s_32)
- to_phys -> in-kernel tophys()
- loadimm -> LOAD_REG_IMMEDIATE
- call .ko kvm.ko
- set magic paca bit later
- run guest code with PACA->soft_enabled=true
- pt_regs for host state saving (guest too?)
- only do HV dcbz trick on 970
- refuse to run on LPAR because of missing SLB pieces
TODO:
- MMU Notifiers (non-showstopper)
- create SLB shadow in PACA for reliable guest/host switching (non-showstopper)
- pHyp might restore SLB entries from shadow
- remove CONTEXT_ magic because the SLB shadow handles that
- wait for benh to think of a great interrupt hijack mechanism
Alexander Graf (23):
Pass PVR in sregs
Add Book3s definitions
Add Book3s fields to vcpu structs
Add asm/kvm_book3s.h
Add Book3s_64 intercept helpers
Add book3s_64 highmem asm code
Add SLB switching code for entry/exit
Add interrupt handling code
Add book3s.c
Add book3s_64 Host MMU handling
Add book3s_64 guest MMU
Add book3s_32 guest MMU
Add book3s_64 specific opcode emulation
Add mfdec emulation
Add desktop PowerPC specific emulation
Make head_64.S aware of KVM real mode code
Patch SLB size
Add Book3s_64 offsets to asm-offsets.c
Export symbols for KVM module
Export KVM symbols for module
Include Book3s_64 target in buildsystem
Fix trace.h
Hack in dirty logging for VGA
arch/powerpc/include/asm/exception.h | 2 + arch/powerpc/include/asm/kvm.h | 2 + arch/powerpc/include/asm/kvm_asm.h | 39 + arch/powerpc/include/asm/kvm_book3s.h | 131 ++++ arch/powerpc/include/asm/kvm_book3s_64_asm.h | 58 ++ arch/powerpc/include/asm/kvm_host.h | 80 +++- arch/powerpc/include/asm/kvm_ppc.h | 1 + arch/powerpc/kernel/asm-offsets.c | 13 + arch/powerpc/kernel/exceptions-64s.S | 8 + arch/powerpc/kernel/head_64.S | 6 + arch/powerpc/kernel/ppc_ksyms.c | 3 +- arch/powerpc/kernel/time.c | 1 + arch/powerpc/kvm/Kconfig | 17 + arch/powerpc/kvm/Makefile | 27 +- arch/powerpc/kvm/book3s.c | 956 ++++++++++++++++++++++++++ arch/powerpc/kvm/book3s_32_mmu.c | 357 ++++++++++ arch/powerpc/kvm/book3s_64_emulate.c | 338 +++++++++ arch/powerpc/kvm/book3s_64_exports.c | 24 + arch/powerpc/kvm/book3s_64_interrupts.S | 404 +++++++++++ arch/powerpc/kvm/book3s_64_mmu.c | 466 +++++++++++++ arch/powerpc/kvm/book3s_64_mmu_host.c | 439 ++++++++++++ arch/powerpc/kvm/book3s_64_rmhandlers.S | 133 ++++ arch/powerpc/kvm/book3s_64_slb.S | 456 ++++++++++++ arch/powerpc/kvm/emulate.c | 43 ++- arch/powerpc/kvm/powerpc.c | 21 +- arch/powerpc/kvm/trace.h | 6 +- arch/powerpc/mm/hash_utils_64.c | 2 + arch/powerpc/mm/mmu_context_hash64.c | 4 + arch/powerpc/mm/slb.c | 15 + kernel/fork.c | 1 + 30 files changed, 4042 insertions(+), 11 deletions(-) create mode 100644 arch/powerpc/include/asm/kvm_book3s.h create mode 100644 arch/powerpc/include/asm/kvm_book3s_64_asm.h create mode 100644 arch/powerpc/kvm/book3s.c create mode 100644 arch/powerpc/kvm/book3s_32_mmu.c create mode 100644 arch/powerpc/kvm/book3s_64_emulate.c create mode 100644 arch/powerpc/kvm/book3s_64_exports.c create mode 100644 arch/powerpc/kvm/book3s_64_interrupts.S create mode 100644 arch/powerpc/kvm/book3s_64_mmu.c create mode 100644 arch/powerpc/kvm/book3s_64_mmu_host.c create mode 100644 arch/powerpc/kvm/book3s_64_rmhandlers.S create mode 100644 arch/powerpc/kvm/book3s_64_slb.S