Re: [PATCH 00/18] Support SDEI Virtualization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 8/17/20 8:05 PM, Gavin Shan wrote:
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


[+James/Mark/Eric]

The series was supposed to have been cc'ed to more folks, but the
"git send-email" didn't do it properly for me. I assume I needn't
resend it until I'm going to be asked for that explicitly.

Thanks,
Gavin

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


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



[Index of Archives]     [Linux KVM]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux