Re: [PATCH v4 00/21] Support SDEI Virtualization

From: Gavin Shan
Date: Sat Aug 14 2021 - 20:20:04 EST


On 8/15/21 10:13 AM, Gavin Shan wrote:
This series intends to virtualize Software Delegated Exception Interface
(SDEI), which is defined by DEN0054A. It allows the hypervisor to deliver
NMI-alike event to guest and it's needed by asynchronous page fault to
deliver page-not-present notification from hypervisor to guest. The code
and the required qemu changes can be found from:

https://developer.arm.com/documentation/den0054/latest
https://github.com/gwshan/linux ("kvm/arm64_sdei")
https://github.com/gwshan/qemu ("kvm/arm64_sdei")

The SDEI event is identified by a 32-bits number. Bits[31:24] are used
to indicate the SDEI event properties while bits[23:0] are identifying
the unique number. The implementation takes bits[23:22] to indicate the
owner of the SDEI event. For example, those SDEI events owned by KVM
should have these two bits set to 0b01. Besides, the implementation
supports SDEI events owned by KVM only.

The design is pretty straightforward and the implementation is just
following the SDEI specification, to support the defined SMCCC intefaces,
except the IRQ binding stuff. There are several data structures introduced.
Some of the objects have to be migrated by VMM. So their definitions are
split up for VMM to include the corresponding states for migration.

struct kvm_sdei_kvm
Associated with VM and used to track the KVM exposed SDEI events
and those registered by guest.
struct kvm_sdei_vcpu
Associated with vCPU and used to track SDEI event delivery. The
preempted context is saved prior to the delivery and restored
after that.
struct kvm_sdei_event
SDEI events exposed by KVM so that guest can register and enable.
struct kvm_sdei_kvm_event
SDEI events that have been registered by guest.
struct kvm_sdei_vcpu_event
SDEI events that have been queued to specific vCPU for delivery.

The series is organized as below:

PATCH[01] Introduces template for smccc_get_argx()
PATCH[02] Introduces the data structures and infrastructure
PATCH[03-14] Supports various SDEI related hypercalls
PATCH[15] Supports SDEI event notification
PATCH[16-17] Introduces ioctl command for migration
PATCH[18-19] Supports SDEI event injection and cancellation
PATCH[20] Exports SDEI capability
PATCH[21] Adds self-test case for SDEI virtualization


[...]

I explicitly copied James Morse and Mark Rutland when posting the series,
but something unknown went wrong. I'm including them here to avoid
reposting the whole series.

Thanks,
Gavin