From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED100C433EF for ; Tue, 22 Mar 2022 08:09:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230021AbiCVILS (ORCPT ); Tue, 22 Mar 2022 04:11:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229925AbiCVILN (ORCPT ); Tue, 22 Mar 2022 04:11:13 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C593A24BCF for ; Tue, 22 Mar 2022 01:09:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647936577; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gltiXYOSEEjNUqLYmzcduTiT7DayTJW8FdFdmgcfQdQ=; b=Qlhkp5N7pnoK6QmXIx33LHIeZTB4dZRGIL477PRRpuT/xMxRg/CbsEn9LUc+cVCYV9RGNV sdcqFIUY8Nr5ylNFRQ+mhatunR1nKZFutpm3CMYMjiBKbMYxGOpaQUcF50H+X+MDHAj89Q OuXFsp/gRc2b8PSk9NzYlDFVs+zyfOA= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-651-Q090hviFPbuszSirU_DsBQ-1; Tue, 22 Mar 2022 04:09:34 -0400 X-MC-Unique: Q090hviFPbuszSirU_DsBQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 96E4C185A794; Tue, 22 Mar 2022 08:09:33 +0000 (UTC) Received: from gshan.redhat.com (ovpn-12-33.pek2.redhat.com [10.72.12.33]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5ED681121324; Tue, 22 Mar 2022 08:09:11 +0000 (UTC) From: Gavin Shan To: kvmarm@lists.cs.columbia.edu Cc: linux-kernel@vger.kernel.org, eauger@redhat.com, shannon.zhaosl@gmail.com, maz@kernel.org, Jonathan.Cameron@huawei.com, will@kernel.org, pbonzini@redhat.com, james.morse@arm.com, mark.rutland@arm.com, drjones@redhat.com, vkuznets@redhat.com, shan.gavin@gmail.com Subject: [PATCH v5 11/22] KVM: arm64: Support SDEI_PE_{MASK, UNMASK} hypercall Date: Tue, 22 Mar 2022 16:06:59 +0800 Message-Id: <20220322080710.51727-12-gshan@redhat.com> In-Reply-To: <20220322080710.51727-1-gshan@redhat.com> References: <20220322080710.51727-1-gshan@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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