This supports SDEI_{PRIVATE, SHARED}_RESET. They are used by the guest to purge the private or shared SDEI events, which are registered previously. Signed-off-by: Gavin Shan <gshan@xxxxxxxxxx> --- arch/arm64/kvm/sdei.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/arch/arm64/kvm/sdei.c b/arch/arm64/kvm/sdei.c index 3fb33258b494..62efee2b67b8 100644 --- a/arch/arm64/kvm/sdei.c +++ b/arch/arm64/kvm/sdei.c @@ -582,6 +582,29 @@ static unsigned long kvm_sdei_hypercall_mask(struct kvm_vcpu *vcpu, return ret; } +static unsigned long kvm_sdei_hypercall_reset(struct kvm_vcpu *vcpu, + bool private) +{ + struct kvm *kvm = vcpu->kvm; + struct kvm_sdei_kvm *ksdei = kvm->arch.sdei; + struct kvm_sdei_vcpu *vsdei = vcpu->arch.sdei; + unsigned int mask = private ? (1 << SDEI_EVENT_TYPE_PRIVATE) : + (1 << SDEI_EVENT_TYPE_SHARED); + unsigned long ret = SDEI_SUCCESS; + + /* Sanity check */ + if (!(ksdei && vsdei)) { + ret = SDEI_NOT_SUPPORTED; + goto out; + } + + spin_lock(&ksdei->lock); + kvm_sdei_remove_kvm_events(kvm, mask, false); + spin_unlock(&ksdei->lock); +out: + return ret; +} + int kvm_sdei_hypercall(struct kvm_vcpu *vcpu) { u32 func = smccc_get_function(vcpu); @@ -626,8 +649,14 @@ int kvm_sdei_hypercall(struct kvm_vcpu *vcpu) break; case SDEI_1_0_FN_SDEI_INTERRUPT_BIND: case SDEI_1_0_FN_SDEI_INTERRUPT_RELEASE: + ret = SDEI_NOT_SUPPORTED; + break; case SDEI_1_0_FN_SDEI_PRIVATE_RESET: + ret = kvm_sdei_hypercall_reset(vcpu, true); + break; case SDEI_1_0_FN_SDEI_SHARED_RESET: + ret = kvm_sdei_hypercall_reset(vcpu, false); + break; default: ret = SDEI_NOT_SUPPORTED; } -- 2.23.0 _______________________________________________ kvmarm mailing list kvmarm@xxxxxxxxxxxxxxxxxxxxx https://lists.cs.columbia.edu/mailman/listinfo/kvmarm