kvmarm.lists.cs.columbia.edu archive mirror
 help / color / mirror / Atom feed
From: Gavin Shan <gshan@redhat.com>
To: kvmarm@lists.cs.columbia.edu
Cc: maz@kernel.org, shan.gavin@gmail.com, pbonzini@redhat.com
Subject: [PATCH 13/18] arm64/kvm: Support SDEI_1_0_FN_SDEI_{PRIVATE, SHARED}_RESET hypercall
Date: Mon, 17 Aug 2020 20:05:26 +1000	[thread overview]
Message-ID: <20200817100531.83045-14-gshan@redhat.com> (raw)
In-Reply-To: <20200817100531.83045-1-gshan@redhat.com>

This supports SDEI_1_0_FN_SDEI_{PRIVATE,SHARED}_RESET hypercall by
adding kvm_sdei_hypercall_reset(). We can't direct the hypercall to
underly firmware for passthrou event because it might be shared by
multiple VMs. So the trick is to simulate the behaviour to unregister
all the (private or shared) events which have been registered on the
speicific VM. However, the request is directed to underly firmware
by calling sdei_event_unregister() when last event (reference) exits.

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

diff --git a/arch/arm64/kvm/sdei.c b/arch/arm64/kvm/sdei.c
index 0816136e73a6..2d5e44bb5497 100644
--- a/arch/arm64/kvm/sdei.c
+++ b/arch/arm64/kvm/sdei.c
@@ -741,6 +741,18 @@ static unsigned long kvm_sdei_reset(struct kvm *kvm, unsigned int types)
 	return ret;
 }
 
+static unsigned long kvm_sdei_hypercall_reset(struct kvm_vcpu *vcpu,
+					      bool is_private)
+{
+	struct kvm *kvm = vcpu->kvm;
+	unsigned int types = is_private ? (1 << SDEI_EVENT_TYPE_PRIVATE) :
+					  (1 << SDEI_EVENT_TYPE_SHARED);
+
+	kvm_sdei_reset(kvm, types);
+
+	return SDEI_SUCCESS;
+}
+
 int kvm_sdei_hypercall(struct kvm_vcpu *vcpu)
 {
 	u32 function = smccc_get_function(vcpu);
@@ -782,8 +794,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@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

  parent reply	other threads:[~2020-08-17 10:06 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-17 10:05 [PATCH 00/18] Support SDEI Virtualization Gavin Shan
2020-08-17 10:05 ` [PATCH 01/18] drivers/firmware/sdei: Retrieve event signaled property on registration Gavin Shan
2020-08-17 10:05 ` [PATCH 02/18] drivers/firmware/sdei: Add sdei_event_get_info() Gavin Shan
2020-08-17 10:05 ` [PATCH 03/18] arm/smccc: Introduce template for inline functions Gavin Shan
2020-08-17 10:05 ` [PATCH 04/18] arm64/kvm: Add SDEI virtualization infrastructure Gavin Shan
2020-08-17 10:05 ` [PATCH 05/18] arm64/kvm: Support SDEI_1_0_FN_SDEI_VERSION hypercall Gavin Shan
2020-08-17 10:05 ` [PATCH 06/18] arm64/kvm: Support SDEI_1_0_FN_SDEI_EVENT_REGISTER Gavin Shan
2020-08-17 10:05 ` [PATCH 07/18] arm64/kvm: Support SDEI_1_0_FN_SDEI_EVENT_{ENABLE, DISABLE} hypercall Gavin Shan
2020-08-17 10:05 ` [PATCH 08/18] arm64/kvm: Support SDEI_1_0_FN_SDEI_EVENT_UNREGISTER hypercall Gavin Shan
2020-08-17 10:05 ` [PATCH 09/18] arm64/kvm: Support SDEI_1_0_FN_SDEI_EVENT_STATUS hypercall Gavin Shan
2020-08-17 10:05 ` [PATCH 10/18] arm64/kvm: Support SDEI_1_0_FN_SDEI_EVENT_GET_INFO hypercall Gavin Shan
2020-08-17 10:05 ` [PATCH 11/18] arm64/kvm: Support SDEI_1_0_FN_SDEI_EVENT_ROUTING_SET hypercall Gavin Shan
2020-08-17 10:05 ` [PATCH 12/18] arm64/kvm: Support SDEI_1_0_FN_SDEI_PE_{MASK, UNMASK} hypercall Gavin Shan
2020-08-17 10:05 ` Gavin Shan [this message]
2020-08-17 10:05 ` [PATCH 14/18] arm64/kvm: Implement event handler Gavin Shan
2020-08-17 10:05 ` [PATCH 15/18] arm64/kvm: Support SDEI_1_0_FN_SDEI_EVENT_{COMPLETE, COMPLETE_AND_RESUME} hypercall Gavin Shan
2020-08-17 10:05 ` [PATCH 16/18] arm64/kvm: Support SDEI_1_0_FN_SDEI_EVENT_CONTEXT hypercall Gavin Shan
2020-08-17 10:05 ` [PATCH 17/18] arm64/kvm: Expose SDEI capability Gavin Shan
2020-08-17 10:05 ` [PATCH 18/18] kvm/selftests: Add SDEI test case Gavin Shan
2020-08-17 11:01 ` [PATCH 00/18] Support SDEI Virtualization Gavin Shan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200817100531.83045-14-gshan@redhat.com \
    --to=gshan@redhat.com \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=maz@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=shan.gavin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).