kvmarm.lists.cs.columbia.edu archive mirror
 help / color / mirror / Atom feed
From: Gavin Shan <gshan@redhat.com>
To: kvmarm@lists.cs.columbia.edu
Cc: maz@kernel.org, shan.gavin@gmail.com, pbonzini@redhat.com
Subject: [PATCH 00/18] Support SDEI Virtualization
Date: Mon, 17 Aug 2020 20:05:13 +1000	[thread overview]
Message-ID: <20200817100531.83045-1-gshan@redhat.com> (raw)

This series intends to support SDEI virtualization. The background is
the feature (Asynchronous Page Fault) needs virtualized SDEI event to
deliver page-not-present notification from host to guest. This series
depends on the series "Refactor SDEI Client Driver", which was posted
previously. Both series can be found from github:

   https://developer.arm.com/documentation/den0054/a/
   https://www.spinics.net/lists/arm-kernel/msg826783.html
   https://github.com/gwshan/linux  ("sdei_client")
   https://github.com/gwshan/linux  ("sdei")

First of all, bits[23:20] of the SDEI event number are reserved to
indicate the SDEI event type:

   0x0: physical SDEI event number, originated from underly firmware
   0x1: virtual SDEI event number, passed from KVM because of physical
        SDEI event. The corresponding SDEI events are also called as
        passthrou SDEI events.
   0x2: KVM private SDEI event number, originated from KVM itself.

The implementation supports passthrou and KVM private SDEI events. The
same SDEI event can be registered and enabled on multiple VMs. So the
registered SDEI event is represented by "struct kvm_sdei_event" and
formed into a linked list globally. "struct kvm_sdei_kvm_event" is
created and inserted into the radix tree in "struct kvm_sdei_event",
which is indexed by @kvm->userspace_pid if the corresponding SDEI event
is registered on the particular KVM. Besides, "struct kvm_sdei_vcpu_event"
is introduced to deliver SDEI event to one particular vCPU. So the data
structs have different scopes, summaried as below:

   struct kvm_sdei_event: global scope
   struct kvm_sdei_kvm_event: VM scope
   struct kvm_sdei_vcpu_event: vCPU sope

For the passthrou SDEI events, the specific handler is registered to the
underly firmware if it's supported. The core functionality of the handler
is to route the incoming SDEI events to the target VM and vCPU. For the
shared SDEI event, it's duplicated to all VMs where the SDEI event was
registered and enabled. The target vCPU is chosen basing on the setting
of routing affinity. For private SDEI event, the event received from the
physical CPU is duplicated and delivered to the vCPUs, which are currently
running or suspending on the physical CPU. For KVM private event, which is
pre-defined and represented by "struct kvm_sdei_priv", API (kvm_sdei_inject())
is always called to deliver the event to the specified vCPU.

The series is organized as below:

PATCH[01-02] Retrieve event signaled property on registration and add API
             (sdei_event_get_info()) to retrieve event's information from
             underly firmware for the passthrou SDEI events.
PATCH[03]    Introduce template for smccc_get_argx().
PATCH[04]    Adds the needed source files, data structs.
PATCH[05-13] Support various hypercalls defined in SDEI specification (v1.0).
PATCH[14]    Implements the SDEI handler to route the incoming passthrou SDEI
             events to target VMs and vCPUs.
PATCH[15-16] Support more hypercalls like COMPLETE, COMPLETE_AND_RESUME, and
             CONTEXT.
PATCH[17]    Support injecting KVM private SDEI event and expose the SDEI
             capability.
PATCH[18]    Add self-test case for KVM private SDEI event

Gavin Shan (18):
  drivers/firmware/sdei: Retrieve event signaled property on
    registration
  drivers/firmware/sdei: Add sdei_event_get_info()
  arm/smccc: Introduce template for inline functions
  arm64/kvm: Add SDEI virtualization infrastructure
  arm64/kvm: Support SDEI_1_0_FN_SDEI_VERSION hypercall
  arm64/kvm: Support SDEI_1_0_FN_SDEI_EVENT_REGISTER
  arm64/kvm: Support SDEI_1_0_FN_SDEI_EVENT_{ENABLE, DISABLE} hypercall
  arm64/kvm: Support SDEI_1_0_FN_SDEI_EVENT_UNREGISTER hypercall
  arm64/kvm: Support SDEI_1_0_FN_SDEI_EVENT_STATUS hypercall
  arm64/kvm: Support SDEI_1_0_FN_SDEI_EVENT_GET_INFO hypercall
  arm64/kvm: Support SDEI_1_0_FN_SDEI_EVENT_ROUTING_SET hypercall
  arm64/kvm: Support SDEI_1_0_FN_SDEI_PE_{MASK, UNMASK} hypercall
  arm64/kvm: Support SDEI_1_0_FN_SDEI_{PRIVATE,SHARED}_RESET hypercall
  arm64/kvm: Implement event handler
  arm64/kvm: Support SDEI_1_0_FN_SDEI_EVENT_{COMPLETE,
    COMPLETE_AND_RESUME} hypercall
  arm64/kvm: Support SDEI_1_0_FN_SDEI_EVENT_CONTEXT hypercall
  arm64/kvm: Expose SDEI capability
  kvm/selftests: Add SDEI test case

 arch/arm64/include/asm/kvm_emulate.h       |    2 +
 arch/arm64/include/asm/kvm_host.h          |   10 +
 arch/arm64/include/asm/kvm_sdei.h          |  117 ++
 arch/arm64/kvm/Makefile                    |    2 +-
 arch/arm64/kvm/aarch32.c                   |    8 +
 arch/arm64/kvm/arm.c                       |   19 +
 arch/arm64/kvm/hypercalls.c                |   19 +
 arch/arm64/kvm/inject_fault.c              |   30 +
 arch/arm64/kvm/reset.c                     |    3 +
 arch/arm64/kvm/sdei.c                      | 1322 ++++++++++++++++++++
 drivers/firmware/arm_sdei.c                |   38 +
 include/kvm/arm_hypercalls.h               |   34 +-
 include/linux/arm_sdei.h                   |    7 +
 include/uapi/linux/kvm.h                   |    4 +
 tools/testing/selftests/kvm/Makefile       |    1 +
 tools/testing/selftests/kvm/aarch64/sdei.c |  170 +++
 16 files changed, 1766 insertions(+), 20 deletions(-)
 create mode 100644 arch/arm64/include/asm/kvm_sdei.h
 create mode 100644 arch/arm64/kvm/sdei.c
 create mode 100644 tools/testing/selftests/kvm/aarch64/sdei.c

-- 
2.23.0

_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

             reply	other threads:[~2020-08-17 10:05 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-17 10:05 Gavin Shan [this message]
2020-08-17 10:05 ` [PATCH 01/18] drivers/firmware/sdei: Retrieve event signaled property on registration Gavin Shan
2020-08-17 10:05 ` [PATCH 02/18] drivers/firmware/sdei: Add sdei_event_get_info() Gavin Shan
2020-08-17 10:05 ` [PATCH 03/18] arm/smccc: Introduce template for inline functions Gavin Shan
2020-08-17 10:05 ` [PATCH 04/18] arm64/kvm: Add SDEI virtualization infrastructure Gavin Shan
2020-08-17 10:05 ` [PATCH 05/18] arm64/kvm: Support SDEI_1_0_FN_SDEI_VERSION hypercall Gavin Shan
2020-08-17 10:05 ` [PATCH 06/18] arm64/kvm: Support SDEI_1_0_FN_SDEI_EVENT_REGISTER Gavin Shan
2020-08-17 10:05 ` [PATCH 07/18] arm64/kvm: Support SDEI_1_0_FN_SDEI_EVENT_{ENABLE, DISABLE} hypercall Gavin Shan
2020-08-17 10:05 ` [PATCH 08/18] arm64/kvm: Support SDEI_1_0_FN_SDEI_EVENT_UNREGISTER hypercall Gavin Shan
2020-08-17 10:05 ` [PATCH 09/18] arm64/kvm: Support SDEI_1_0_FN_SDEI_EVENT_STATUS hypercall Gavin Shan
2020-08-17 10:05 ` [PATCH 10/18] arm64/kvm: Support SDEI_1_0_FN_SDEI_EVENT_GET_INFO hypercall Gavin Shan
2020-08-17 10:05 ` [PATCH 11/18] arm64/kvm: Support SDEI_1_0_FN_SDEI_EVENT_ROUTING_SET hypercall Gavin Shan
2020-08-17 10:05 ` [PATCH 12/18] arm64/kvm: Support SDEI_1_0_FN_SDEI_PE_{MASK, UNMASK} hypercall Gavin Shan
2020-08-17 10:05 ` [PATCH 13/18] arm64/kvm: Support SDEI_1_0_FN_SDEI_{PRIVATE, SHARED}_RESET hypercall Gavin Shan
2020-08-17 10:05 ` [PATCH 14/18] arm64/kvm: Implement event handler Gavin Shan
2020-08-17 10:05 ` [PATCH 15/18] arm64/kvm: Support SDEI_1_0_FN_SDEI_EVENT_{COMPLETE, COMPLETE_AND_RESUME} hypercall Gavin Shan
2020-08-17 10:05 ` [PATCH 16/18] arm64/kvm: Support SDEI_1_0_FN_SDEI_EVENT_CONTEXT hypercall Gavin Shan
2020-08-17 10:05 ` [PATCH 17/18] arm64/kvm: Expose SDEI capability Gavin Shan
2020-08-17 10:05 ` [PATCH 18/18] kvm/selftests: Add SDEI test case Gavin Shan
2020-08-17 11:01 ` [PATCH 00/18] Support SDEI Virtualization Gavin Shan

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=20200817100531.83045-1-gshan@redhat.com \
    --to=gshan@redhat.com \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=maz@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=shan.gavin@gmail.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).