Skip to content

RFC KVM: PPC: Book3S: C-ify the P9 entry/exit code

Nicholas Piggin kvm-ppc linuxppc-dev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest9 patches 8 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9KVM: PPC: Book3S 64: move KVM interrupt entry to a common entry pointarch/powerpc/kernel/exceptions-64s.S arch/powerpc/kvm/Makefile arch/powerpc/kvm/book3s_64_entry.S +1 more+40 -163 replies
2/9KVM: PPC: Book3S 64: Move GUEST_MODE_SKIP test into KVMarch/powerpc/kernel/exceptions-64s.S arch/powerpc/kvm/book3s_64_entry.S+42 -724 replies
3/9KVM: PPC: Book3S 64: add hcall interrupt handlerarch/powerpc/kernel/exceptions-64s.S arch/powerpc/kvm/book3s_64_entry.S+6 -21 reply
4/9KVM: PPC: Book3S HV: Move hcall early register setup to KVMarch/powerpc/include/asm/exception-64s.h arch/powerpc/kernel/exceptions-64s.S arch/powerpc/kvm/book3s_64_entry.S+32 -420 replies
5/9powerpc/64s: Remove EXSLB interrupt save areaarch/powerpc/include/asm/paca.h arch/powerpc/kernel/asm-offsets.c arch/powerpc/kernel/exceptions-64s.S+1 -80 replies
6/9KVM: PPC: Book3S HV: Move interrupt early register setup to KVMarch/powerpc/kernel/exceptions-64s.S arch/powerpc/kvm/book3s_64_entry.S+50 -1130 replies
7/9KVM: PPC: Book3S HV: move bad_host_intr check to HV handlerarch/powerpc/kvm/book3s_64_entry.S arch/powerpc/kvm/book3s_hv_rmhandlers.S arch/powerpc/kvm/book3s_segment.S+10 -40 replies
8/9KVM: PPC: Book3S HV: Minimise hcall handler calling convention differencesarch/powerpc/kernel/exceptions-64s.S arch/powerpc/kvm/book3s_64_entry.S+18 -200 replies
9/9KVM: PPC: Book3S HV: Implement the rest of the P9 entry/exit handling in Carch/powerpc/include/asm/asm-prototypes.h arch/powerpc/include/asm/kvm_asm.h arch/powerpc/include/asm/kvm_book3s_64.h +7 more+364 -1230 replies

Reviews trailers per patch

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

PatchFabiano RosasDaniel Axtens
1/9R-b R-b
2/9
3/9R-b
4/9
5/9
6/9
7/9
8/9
9/9

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

Read the v1 thread

Cover letter [RFC PATCH 0/9] KVM: PPC: Book3S: C-ify the P9 entry/exit code

This series goes on top of the KVM patches I sent for the next merge window. It's pretty rough and incomplete at the moment but has started booting a simple guest into busybox in sim.

One of the main points of this is to avoid running KVM in a special mode (aka "realmode") which is hostile to the rest of Linux and can't be instrumented well by core facilities or generally use core code.

The asm itself is also tricky to follow. It's nothing compared with the old HV path when you sit down and go through it, but it's not trivial and sharing code paths makes things painful too.

One issue is what to do about PR-KVM and pre-ISAv3.0 / HPT HV-KVM.

The old path could also be converted similarly to C, although that's a far bigger job. At least removing the asm code sharing makes a (slight) simplification to the old path for now.

This change is a pretty clean break in the low level exit/entry code, and the rest of the code already has many divergences, so I don't think this exacerbates the problem, but if those PR / old-HV are to be maintained well then we should eat the cost early to modernise that code too. If they stay walled off with these interface shims then they'll just be harder to maintain and the problem will definitely not get better.

Now, the number of people who understand PR-KVM and have time to maintain it is roughly zero, and for the old HV path it's approaching zero. The radix, LPAR-per-thread programming model by comparison is so nice and simple, maybe its better to just keep the rest on life support and keep them going for as long as we can with the bare minimum.

Thanks,
Nick

Nicholas Piggin (9):
KVM: PPC: Book3S 64: move KVM interrupt entry to a common entry point
KVM: PPC: Book3S 64: Move GUEST_MODE_SKIP test into KVM
KVM: PPC: Book3S 64: add hcall interrupt handler
KVM: PPC: Book3S HV: Move hcall early register setup to KVM powerpc/64s: Remove EXSLB interrupt save area
KVM: PPC: Book3S HV: Move interrupt early register setup to KVM
KVM: PPC: Book3S HV: move bad_host_intr check to HV handler
KVM: PPC: Book3S HV: Minimise hcall handler calling convention
differences
KVM: PPC: Book3S HV: Implement the rest of the P9 entry/exit handling
in C

 arch/powerpc/include/asm/asm-prototypes.h |   2 +-
 arch/powerpc/include/asm/exception-64s.h  |  13 ++
 arch/powerpc/include/asm/kvm_asm.h        |   3 +-
 arch/powerpc/include/asm/kvm_book3s_64.h  |   2 +
 arch/powerpc/include/asm/kvm_ppc.h        |   2 +
 arch/powerpc/include/asm/paca.h           |   3 +-
 arch/powerpc/kernel/asm-offsets.c         |   1 -
 arch/powerpc/kernel/exceptions-64s.S      | 259 +++-------------------
 arch/powerpc/kvm/Makefile                 |   6 +
 arch/powerpc/kvm/book3s_64_entry.S        | 232 +++++++++++++++++++
 arch/powerpc/kvm/book3s_hv.c              |  21 +-
 arch/powerpc/kvm/book3s_hv_interrupt.c    | 164 ++++++++++++++
 arch/powerpc/kvm/book3s_hv_rmhandlers.S   | 136 ++----------
 arch/powerpc/kvm/book3s_segment.S         |   7 +
 arch/powerpc/kvm/book3s_xive.c            |  32 +++
 15 files changed, 523 insertions(+), 360 deletions(-)
 create mode 100644 arch/powerpc/kvm/book3s_64_entry.S
 create mode 100644 arch/powerpc/kvm/book3s_hv_interrupt.c
Signature · 1 line
2.23.0