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(-)