[PATCH v5 13/22] KVM: arm64: Support SDEI_FEATURES hypercall

From: Gavin Shan
Date: Tue Mar 22 2022 - 04:10:06 EST


This supports SDEI_FEATURES hypercall. It's used by the guest to
retrieve the supported features, which are number of binding slots
and relative mode for the event handler. Currently, none of them
is supported.

Signed-off-by: Gavin Shan <gshan@xxxxxxxxxx>
---
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 0dec35a0eed1..1e0ca9022eaa 100644
--- a/arch/arm64/kvm/sdei.c
+++ b/arch/arm64/kvm/sdei.c
@@ -662,6 +662,20 @@ static unsigned long hypercall_reset(struct kvm_vcpu *vcpu, bool private)
return ret;
}

+static unsigned long hypercall_features(struct kvm_vcpu *vcpu)
+{
+ unsigned long feature = smccc_get_arg1(vcpu);
+
+ switch (feature) {
+ case 0: /* BIND_SLOTS */
+ return 0;
+ case 1: /* RELATIVE_MODE */
+ return 0;
+ }
+
+ return SDEI_INVALID_PARAMETERS;
+}
+
int kvm_sdei_hypercall(struct kvm_vcpu *vcpu)
{
struct kvm *kvm = vcpu->kvm;
@@ -734,6 +748,8 @@ int kvm_sdei_hypercall(struct kvm_vcpu *vcpu)
ret = hypercall_reset(vcpu, false);
break;
case SDEI_1_1_FN_SDEI_FEATURES:
+ ret = hypercall_features(vcpu);
+ break;
default:
ret = SDEI_NOT_SUPPORTED;
}
--
2.23.0