[PATCH 05/18] arm64/kvm: Support SDEI_1_0_FN_SDEI_VERSION hypercall

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This supports SDEI_1_0_FN_SDEI_VERSION hypercall by returning the
corresponding version. The SDEI version retrieved from the underly
firmware is returned if that's supported. Otherwise, v1.0 is returned
to support the kvm private events, which originates from the kvm module
itself.

Signed-off-by: Gavin Shan <gshan@xxxxxxxxxx>
---
 arch/arm64/kvm/sdei.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/arch/arm64/kvm/sdei.c b/arch/arm64/kvm/sdei.c
index e2090e9bab8b..f5739c0063df 100644
--- a/arch/arm64/kvm/sdei.c
+++ b/arch/arm64/kvm/sdei.c
@@ -36,6 +36,21 @@ static inline int kvm_sdei_unregister_event(struct sdei_event *event)
 }
 #endif /* CONFIG_ARM_SDE_INTERFACE */
 
+static unsigned long kvm_sdei_hypercall_version(struct kvm_vcpu *vcpu)
+{
+	unsigned long ret = SDEI_NOT_SUPPORTED;
+
+	if (kvm_sdei_data && kvm_sdei_data->supported) {
+		ret = kvm_sdei_data->version;
+		goto out;
+	}
+
+	ret = (1UL << SDEI_VERSION_MAJOR_SHIFT);
+
+out:
+	return ret;
+}
+
 static unsigned long kvm_sdei_reset(struct kvm *kvm, unsigned int types)
 {
 	struct kvm_sdei_event *e, *event = NULL;
@@ -107,6 +122,8 @@ int kvm_sdei_hypercall(struct kvm_vcpu *vcpu)
 
 	switch (function) {
 	case SDEI_1_0_FN_SDEI_VERSION:
+		ret = kvm_sdei_hypercall_version(vcpu);
+		break;
 	case SDEI_1_0_FN_SDEI_EVENT_REGISTER:
 	case SDEI_1_0_FN_SDEI_EVENT_ENABLE:
 	case SDEI_1_0_FN_SDEI_EVENT_DISABLE:
-- 
2.23.0

_______________________________________________
kvmarm mailing list
kvmarm@xxxxxxxxxxxxxxxxxxxxx
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm



[Index of Archives]     [Linux KVM]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux