[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220322080710.51727-12-gshan@redhat.com>
Date: Tue, 22 Mar 2022 16:06:59 +0800
From: Gavin Shan <gshan@...hat.com>
To: kvmarm@...ts.cs.columbia.edu
Cc: linux-kernel@...r.kernel.org, eauger@...hat.com,
shannon.zhaosl@...il.com, maz@...nel.org,
Jonathan.Cameron@...wei.com, will@...nel.org, pbonzini@...hat.com,
james.morse@....com, mark.rutland@....com, drjones@...hat.com,
vkuznets@...hat.com, shan.gavin@...il.com
Subject: [PATCH v5 11/22] KVM: arm64: Support SDEI_PE_{MASK, UNMASK} hypercall
This supports SDEI_PE_{MASK, UNMASK} hypercall. They are used by
the guest to stop or start receiving SDEI event on the specified
vCPU.
Signed-off-by: Gavin Shan <gshan@...hat.com>
---
arch/arm64/kvm/sdei.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/arch/arm64/kvm/sdei.c b/arch/arm64/kvm/sdei.c
index db82ea441eae..b2a916724cfa 100644
--- a/arch/arm64/kvm/sdei.c
+++ b/arch/arm64/kvm/sdei.c
@@ -625,6 +625,18 @@ static unsigned long hypercall_route(struct kvm_vcpu *vcpu)
return ret;
}
+static unsigned long hypercall_mask(struct kvm_vcpu *vcpu, bool mask)
+{
+ struct kvm_sdei_vcpu *vsdei = vcpu->arch.sdei;
+ unsigned long ret = SDEI_SUCCESS;
+
+ spin_lock(&vsdei->lock);
+ vsdei->state.masked = mask ? 1 : 0;
+ spin_unlock(&vsdei->lock);
+
+ return ret;
+}
+
int kvm_sdei_hypercall(struct kvm_vcpu *vcpu)
{
struct kvm *kvm = vcpu->kvm;
@@ -680,7 +692,11 @@ int kvm_sdei_hypercall(struct kvm_vcpu *vcpu)
ret = hypercall_route(vcpu);
break;
case SDEI_1_0_FN_SDEI_PE_MASK:
+ ret = hypercall_mask(vcpu, true);
+ break;
case SDEI_1_0_FN_SDEI_PE_UNMASK:
+ ret = hypercall_mask(vcpu, false);
+ break;
case SDEI_1_0_FN_SDEI_INTERRUPT_BIND:
case SDEI_1_0_FN_SDEI_INTERRUPT_RELEASE:
case SDEI_1_1_FN_SDEI_EVENT_SIGNAL:
--
2.23.0
Powered by blists - more mailing lists