linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Jordan Niethe <jpn@linux.vnet.ibm.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: Jordan Niethe <jpn@linux.vnet.ibm.com>,
	mikey@neuling.org, sbhat@linux.ibm.com,
	kautuk.consul.1980@gmail.com, npiggin@gmail.com,
	kvm-ppc@vger.kernel.org, vaibhav@linux.ibm.com
Subject: [RFC PATCH v1 0/5] KVM: PPC: Nested PAPR guests
Date: Mon,  8 May 2023 17:23:27 +1000	[thread overview]
Message-ID: <20230508072332.2937883-1-jpn@linux.vnet.ibm.com> (raw)

There is existing support for nested guests on powernv hosts however the
hcall interface this uses is not support by other PAPR hosts. A set of
new hcalls will be added to PAPR to facilitate creating and managing
guests by a regular partition in the following way:

  - L1 and L0 negotiate capabilities with
    H_GUEST_{G,S}ET_CAPABILITIES

  - L1 requests the L0 create a L2 with
    H_GUEST_CREATE and receives a handle to use in future hcalls

  - L1 requests the L0 create a L2 vCPU with
    H_GUEST_CREATE_VCPU

  - L1 sets up the L2 using H_GUEST_SET and the
    H_GUEST_VCPU_RUN input buffer

  - L1 requests the L0 runs the L2 vCPU using H_GUEST_VCPU_RUN

  - L2 returns to L1 with an exit reason and L1 reads the
    H_GUEST_VCPU_RUN output buffer populated by the L0

  - L1 handles the exit using H_GET_STATE if necessary

  - L1 reruns L2 vCPU with H_GUEST_VCPU_RUN

  - L1 frees the L2 in the L0 with H_GUEST_DELETE

Further details are available in Documentation/powerpc/kvm-nested.rst.

This series adds KVM support for using this hcall interface as a regular
PAPR partition, i.e. the L1. It does not add support for running as the
L0.

The new hcalls have been implemented in the spapr qemu model for
testing.

This is available at https://github.com/mikey/qemu/tree/kvm-papr

There are scripts available to assist in setting up an environment for
testing nested guests at https://github.com/mikey/kvm-powervm-test

Thanks to Kautuk Consul, Vaibhav Jain, Michael Neuling, Shivaprasad
Bhat, Harsh Prateek Bora, Paul Mackerras and Nicholas Piggin. 

Jordan Niethe (5):
  KVM: PPC: Use getters and setters for vcpu register state
  KVM: PPC: Add fpr getters and setters
  KVM: PPC: Add vr getters and setters
  powerpc: Add helper library for Guest State Buffers
  KVM: PPC: Add support for nested PAPR guests

 Documentation/powerpc/index.rst               |    1 +
 Documentation/powerpc/kvm-nested.rst          |  636 +++++++++
 arch/powerpc/include/asm/guest-state-buffer.h | 1133 +++++++++++++++++
 arch/powerpc/include/asm/hvcall.h             |   30 +
 arch/powerpc/include/asm/kvm_book3s.h         |  203 ++-
 arch/powerpc/include/asm/kvm_book3s_64.h      |    6 +
 arch/powerpc/include/asm/kvm_booke.h          |   10 +
 arch/powerpc/include/asm/kvm_host.h           |   21 +
 arch/powerpc/include/asm/kvm_ppc.h            |   80 +-
 arch/powerpc/include/asm/plpar_wrappers.h     |  198 +++
 arch/powerpc/kvm/Makefile                     |    1 +
 arch/powerpc/kvm/book3s.c                     |   38 +-
 arch/powerpc/kvm/book3s_64_mmu_hv.c           |    4 +-
 arch/powerpc/kvm/book3s_64_mmu_radix.c        |    9 +-
 arch/powerpc/kvm/book3s_64_vio.c              |    4 +-
 arch/powerpc/kvm/book3s_hv.c                  |  337 +++--
 arch/powerpc/kvm/book3s_hv.h                  |   66 +
 arch/powerpc/kvm/book3s_hv_builtin.c          |   10 +-
 arch/powerpc/kvm/book3s_hv_nested.c           |   34 +-
 arch/powerpc/kvm/book3s_hv_p9_entry.c         |    4 +-
 arch/powerpc/kvm/book3s_hv_papr.c             |  947 ++++++++++++++
 arch/powerpc/kvm/book3s_hv_ras.c              |    5 +-
 arch/powerpc/kvm/book3s_hv_rm_mmu.c           |    8 +-
 arch/powerpc/kvm/book3s_hv_rm_xics.c          |    4 +-
 arch/powerpc/kvm/book3s_xive.c                |    9 +-
 arch/powerpc/kvm/emulate_loadstore.c          |    6 +-
 arch/powerpc/kvm/powerpc.c                    |   76 +-
 arch/powerpc/lib/Makefile                     |    3 +-
 arch/powerpc/lib/guest-state-buffer.c         |  560 ++++++++
 arch/powerpc/lib/test-guest-state-buffer.c    |  334 +++++
 30 files changed, 4560 insertions(+), 217 deletions(-)
 create mode 100644 Documentation/powerpc/kvm-nested.rst
 create mode 100644 arch/powerpc/include/asm/guest-state-buffer.h
 create mode 100644 arch/powerpc/kvm/book3s_hv_papr.c
 create mode 100644 arch/powerpc/lib/guest-state-buffer.c
 create mode 100644 arch/powerpc/lib/test-guest-state-buffer.c

-- 
2.31.1


             reply	other threads:[~2023-05-08 15:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-08  7:23 Jordan Niethe [this message]
2023-05-08  7:23 ` [RFC PATCH v1 1/5] KVM: PPC: Use getters and setters for vcpu register state Jordan Niethe
2023-05-08  7:23 ` [RFC PATCH v1 2/5] KVM: PPC: Add fpr getters and setters Jordan Niethe
2023-05-08  7:23 ` [RFC PATCH v1 3/5] KVM: PPC: Add vr " Jordan Niethe
2023-05-08  7:23 ` [RFC PATCH v1 4/5] powerpc: Add helper library for Guest State Buffers Jordan Niethe
2023-05-08  7:23 ` [RFC PATCH v1 5/5] KVM: PPC: Add support for nested PAPR guests Jordan Niethe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230508072332.2937883-1-jpn@linux.vnet.ibm.com \
    --to=jpn@linux.vnet.ibm.com \
    --cc=kautuk.consul.1980@gmail.com \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mikey@neuling.org \
    --cc=npiggin@gmail.com \
    --cc=sbhat@linux.ibm.com \
    --cc=vaibhav@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).