Skip to content

KVM: PPC: Book3S HV: Support virtual SMT modes on POWER9

Paul Mackerras kvm kvm-ppc 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4KVM: PPC: Book3S HV: Don't let VCPU sleep if it has a doorbell pendingarch/powerpc/kvm/book3s_hv.c+22 -30 replies
2/4KVM: PPC: Book3S HV: Context-switch HFSCR between host and guest on POWER9arch/powerpc/include/asm/kvm_host.h arch/powerpc/kernel/asm-offsets.c arch/powerpc/kvm/book3s_hv.c +1 more+27 -00 replies
3/4KVM: PPC: Book3S HV: Allow userspace to set the desired SMT modeDocumentation/virtual/kvm/api.txt arch/powerpc/include/asm/kvm_host.h arch/powerpc/include/asm/kvm_ppc.h +2 more+90 -120 replies
4/4KVM: PPC: Book3S HV: Virtualize doorbell facility on POWER9arch/powerpc/include/asm/kvm_host.h arch/powerpc/include/asm/ppc-opcode.h arch/powerpc/kernel/asm-offsets.c +3 more+153 -110 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/4] KVM: PPC: Book3S HV: Support virtual SMT modes on POWER9

This patch series makes it possible to run guests on POWER9 with 2, 4 or 8 threads (vCPUs) per virtual core, for example by specifying -smp 8,threads=8 on the QEMU command line. Previously it was only possible to use 1 thread per virtual core. This was mostly because the CPU threads being independent on POWER9 has the side-effect that the doorbell facility (i.e. the msgsndp instruction) can only be used to send an interrupt from a CPU to itself. With this patch series, the doorbell facility is emulated in software, and thus the guest can now send doorbell interrupts to other vCPUs in the same virtual core as it expects to be able to do when there is more than one thread per core.

This patch series also has the effect that userspace on POWER8 can specify the virtual SMT mode that it wants for the guest and then use consecutive CPU numbering, rather than having to space the vCPU numbers out to get the desired SMT mode (for example by using vCPU numbers 0, 1, 8, 9 to get 4 vCPUs with 2 threads per virtual core).

The interface for userspace to set the vSMT mode uses the existing KVM_CAP_PPC_SMT capability. It can now be enabled on a VM, and the parameters specify the desired vSMT mode. Old kernels will give an error on attempts to enable the capability, which should be sufficient indication that this feature is not present; I don't think it is necessary to provide another capability to say that this capability can be enabled.

These patches are against v4.12-rc2 plus my patch series "KVM: PPC:
Book3S HV: Support POWER9's large decrementer mode", although the two patch series don't interact.

Paul.

---
 Documentation/virtual/kvm/api.txt       |  15 ++
 arch/powerpc/include/asm/kvm_host.h     |   4 +
 arch/powerpc/include/asm/kvm_ppc.h      |   2 +
 arch/powerpc/include/asm/ppc-opcode.h   |   2 +
 arch/powerpc/kernel/asm-offsets.c       |   2 +
 arch/powerpc/kvm/book3s_hv.c            | 239 +++++++++++++++++++++++++++++---
 arch/powerpc/kvm/book3s_hv_rmhandlers.S |  32 +++++
 arch/powerpc/kvm/powerpc.c              |  16 ++-
 8 files changed, 289 insertions(+), 23 deletions(-)