The SDEI functionality is ready and lets exposes the capability and service. * KVM_CAP_ARM_SDEI * KVM_REG_ARM_STD_BIT_SDEI in pseudo-firmware bitmap register KVM_REG_ARM_STD_BMAP * The events for software signaled one (0x0) and Async PF (0x1) are exposed. Signed-off-by: Gavin Shan <gshan@xxxxxxxxxx> --- Documentation/virt/kvm/api.rst | 11 +++++++++++ Documentation/virt/kvm/arm/hypercalls.rst | 4 ++++ arch/arm64/include/asm/kvm_sdei.h | 2 ++ arch/arm64/include/uapi/asm/kvm.h | 1 + arch/arm64/kvm/arm.c | 1 + arch/arm64/kvm/hypercalls.c | 4 ++++ include/uapi/linux/kvm.h | 1 + 7 files changed, 24 insertions(+) diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst index 11e00a46c610..011ec0987d71 100644 --- a/Documentation/virt/kvm/api.rst +++ b/Documentation/virt/kvm/api.rst @@ -7956,6 +7956,17 @@ should adjust CPUID leaf 0xA to reflect that the PMU is disabled. When enabled, KVM will exit to userspace with KVM_EXIT_SYSTEM_EVENT of type KVM_SYSTEM_EVENT_SUSPEND to process the guest suspend request. +8.37 KVM_CAP_ARM_SDEI +--------------------- + +:Capability: KVM_CAP_ARM_SDEI +:Architectures: arm64 +:Type: vm + +This capability indicates that the SDEI virtual service is supported +in the host. A VMM can check whether the service is available to enable +it. + 9. Known KVM API problems ========================= diff --git a/Documentation/virt/kvm/arm/hypercalls.rst b/Documentation/virt/kvm/arm/hypercalls.rst index 3e23084644ba..8b8159988934 100644 --- a/Documentation/virt/kvm/arm/hypercalls.rst +++ b/Documentation/virt/kvm/arm/hypercalls.rst @@ -106,6 +106,10 @@ The pseudo-firmware bitmap register are as follows: The bit represents the services offered under v1.0 of ARM True Random Number Generator (TRNG) specification, ARM DEN0098. + Bit-1: KVM_REG_ARM_STD_BIT_SDEI: + The bit represents the services offered under v1.1 of ARM Software + Delegated Exception Interface (SDEI) specification, ARM DEN0054C. + * KVM_REG_ARM_STD_HYP_BMAP: Controls the bitmap of the ARM Standard Hypervisor Service Calls. diff --git a/arch/arm64/include/asm/kvm_sdei.h b/arch/arm64/include/asm/kvm_sdei.h index a1e960943515..a68d40137a88 100644 --- a/arch/arm64/include/asm/kvm_sdei.h +++ b/arch/arm64/include/asm/kvm_sdei.h @@ -15,6 +15,8 @@ #include <linux/bits.h> enum { + KVM_SDEI_EVENT_SW_SIGNALED = 0, + KVM_SDEI_EVENT_ASYNC_PF, KVM_NR_SDEI_EVENTS, }; diff --git a/arch/arm64/include/uapi/asm/kvm.h b/arch/arm64/include/uapi/asm/kvm.h index 3bb134355874..cc3251381960 100644 --- a/arch/arm64/include/uapi/asm/kvm.h +++ b/arch/arm64/include/uapi/asm/kvm.h @@ -344,6 +344,7 @@ struct kvm_arm_copy_mte_tags { enum { KVM_REG_ARM_STD_BIT_TRNG_V1_0 = 0, + KVM_REG_ARM_STD_BIT_SDEI, #ifdef __KERNEL__ KVM_REG_ARM_STD_BMAP_BIT_COUNT, #endif diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c index 06cb5e38634e..15ead92ad26d 100644 --- a/arch/arm64/kvm/arm.c +++ b/arch/arm64/kvm/arm.c @@ -217,6 +217,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) case KVM_CAP_VCPU_ATTRIBUTES: case KVM_CAP_PTP_KVM: case KVM_CAP_ARM_SYSTEM_SUSPEND: + case KVM_CAP_ARM_SDEI: r = 1; break; case KVM_CAP_SET_GUEST_DEBUG2: diff --git a/arch/arm64/kvm/hypercalls.c b/arch/arm64/kvm/hypercalls.c index 88561ac47301..aaa5197ffe83 100644 --- a/arch/arm64/kvm/hypercalls.c +++ b/arch/arm64/kvm/hypercalls.c @@ -99,6 +99,10 @@ static bool kvm_hvc_call_allowed(struct kvm_vcpu *vcpu, u32 func) struct kvm_smccc_features *smccc_feat = &vcpu->kvm->arch.smccc_feat; switch (func) { + case SDEI_1_0_FN(ARM_SMCCC_STANDARD_SDEI_START - 0x20) ... + SDEI_1_0_FN(ARM_SMCCC_STANDARD_SDEI_END - 0x20): + return test_bit(KVM_REG_ARM_STD_BIT_SDEI, + &smccc_feat->std_bmap); case ARM_SMCCC_TRNG_VERSION: case ARM_SMCCC_TRNG_FEATURES: case ARM_SMCCC_TRNG_GET_UUID: diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h index 5088bd9f1922..65622bcaeec3 100644 --- a/include/uapi/linux/kvm.h +++ b/include/uapi/linux/kvm.h @@ -1157,6 +1157,7 @@ struct kvm_ppc_resize_hpt { #define KVM_CAP_VM_TSC_CONTROL 214 #define KVM_CAP_SYSTEM_EVENT_DATA 215 #define KVM_CAP_ARM_SYSTEM_SUSPEND 216 +#define KVM_CAP_ARM_SDEI 217 #ifdef KVM_CAP_IRQ_ROUTING -- 2.23.0 _______________________________________________ kvmarm mailing list kvmarm@xxxxxxxxxxxxxxxxxxxxx https://lists.cs.columbia.edu/mailman/listinfo/kvmarm