Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3473420pxb; Mon, 4 Apr 2022 18:05:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXpOtXe7B6hAh7ytoQ4h3BRIb4dYQOq86EDmPaSuh5TuJYo3bifBM3cwFxY45c75JtS8sp X-Received: by 2002:a63:8f45:0:b0:398:d78:142f with SMTP id r5-20020a638f45000000b003980d78142fmr770833pgn.162.1649120738246; Mon, 04 Apr 2022 18:05:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649120738; cv=none; d=google.com; s=arc-20160816; b=CzwlJsMKZNxyM73FgZqTB/oxDo3Q2O7WZeSdX+KU/TFHNFeu3U3ALYbFWOcNzUHKJ0 M+F159oCQNLwvM29Mx+YBG7W9yZkQZm5OfpkxI6pyoCf+i2rwkdOCPI/qeMPbHEz1Mft /3Ob0wWm+JuFK9LOujWR8BQV7xjPcpyulHsPBFV59t194jtiQ6dYbNjyBdO0SZ+J3hPW Afss/4Ur9NeHoCfxcsc7kFnGOy8muGPLYL4yc9zusnrSr+Du2jqANkhjpSiW4uBToJ5i hYne8N0czAIACruasofBhe9netfl/0Dn2Fn9a+Oi38vnUDVSwv74LH4Rawps1RIUpF4l dwLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=u5GN46hECBcYCEJr/r3tYpcCJXItKVN6iW9DqJff394=; b=AloobhvGsZDW+U4De9JHBXAnMxou7PonsfViNO/hHJq+RHjTYRuGdi+VKD/8lN7LvU 925ojVJwMzLGrbnX4JrRC+w8EgJGC2NFrvUwv6u0MNBUscWtNJTgnEMAA+hISRFQ6B5n eJIbAv/VimTRQ/qOdrd/bCfcRt7rogG5CptVT3MBq832pJZVIPCJuuG1tBGAgd+9B1NG 0ygxBx0cV+x7doX6LuGFy+OWkxpJBn6UG0LurugvL5wTj6Gm7ElXGbtowi/ZVp2PqkOf owZuZgE4GAG36CQPb5Y8RI6i5vix+znBnSDocN08VLNgAyOVRjWh9n5GkS94WcsIAxzV c7Fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fxof5NVD; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id p1-20020a056a000b4100b004f784a59a59si12370519pfo.0.2022.04.04.18.05.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 18:05:38 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fxof5NVD; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7D34213AA1C; Mon, 4 Apr 2022 17:04:59 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359299AbiDCPnk (ORCPT + 99 others); Sun, 3 Apr 2022 11:43:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359302AbiDCPna (ORCPT ); Sun, 3 Apr 2022 11:43:30 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BA60139BAA for ; Sun, 3 Apr 2022 08:41:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649000484; 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=u5GN46hECBcYCEJr/r3tYpcCJXItKVN6iW9DqJff394=; b=fxof5NVDxyMh3/q5pDMTyM3ULcxffOVqlXWezje9ACRhx9LMTmZQoOaMLVd7uIqAYBY72J s3VkepLFiPbKfr87GPCB9m3RtfTgEQyuJEk+AmKCPVlLuCL9utJZIrR3bJPqIiiu2KFWt4 5w1nx9+9F6WptOrCmfr5zxnfHM8wSn0= 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-148-9-Ub-BPIO7ipQKp1eA7nxQ-1; Sun, 03 Apr 2022 11:41:21 -0400 X-MC-Unique: 9-Ub-BPIO7ipQKp1eA7nxQ-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 34AC485A5A8; Sun, 3 Apr 2022 15:41:21 +0000 (UTC) Received: from gshan.redhat.com (ovpn-12-82.pek2.redhat.com [10.72.12.82]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 409EC403172; Sun, 3 Apr 2022 15:41:14 +0000 (UTC) From: Gavin Shan To: kvmarm@lists.cs.columbia.edu Cc: linux-kernel@vger.kernel.org, eauger@redhat.com, oupton@google.com, Jonathan.Cameron@huawei.com, vkuznets@redhat.com, will@kernel.org, shannon.zhaosl@gmail.com, james.morse@arm.com, mark.rutland@arm.com, maz@kernel.org, pbonzini@redhat.com, shan.gavin@gmail.com Subject: [PATCH v6 16/18] KVM: arm64: Support SDEI_VERSION hypercall Date: Sun, 3 Apr 2022 23:39:09 +0800 Message-Id: <20220403153911.12332-17-gshan@redhat.com> In-Reply-To: <20220403153911.12332-1-gshan@redhat.com> References: <20220403153911.12332-1-gshan@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This supports SDEI_VERSION hypercall by returning v1.1, which is the specification version we're following. The vendor is set to one of the values returned from ARM_SMCCC_VENDOR_HYP_CALL_UID hypercall. Signed-off-by: Gavin Shan --- arch/arm64/include/asm/kvm_sdei.h | 3 +++ arch/arm64/kvm/sdei.c | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/arch/arm64/include/asm/kvm_sdei.h b/arch/arm64/include/asm/kvm_sdei.h index f946d4ebdc14..32dfd5595f15 100644 --- a/arch/arm64/include/asm/kvm_sdei.h +++ b/arch/arm64/include/asm/kvm_sdei.h @@ -71,6 +71,9 @@ struct kvm_sdei_vcpu { struct kvm_sdei_vcpu_context context[SDEI_EVENT_PRIORITY_CRITICAL + 1]; }; +/* Returned as vendor through SDEI_VERSION hypercall */ +#define KVM_SDEI_VENDOR ARM_SMCCC_VENDOR_HYP_UID_KVM_REG_2 + /* * According to SDEI specification (v1.1), the event number spans 32-bits * and the lower 24-bits are used as the (real) event number. I don't diff --git a/arch/arm64/kvm/sdei.c b/arch/arm64/kvm/sdei.c index ab0b7b5e3191..5d9b49a4355c 100644 --- a/arch/arm64/kvm/sdei.c +++ b/arch/arm64/kvm/sdei.c @@ -117,6 +117,14 @@ static int inject_event(struct kvm_vcpu *vcpu, return 0; } +static unsigned long hypercall_version(struct kvm_vcpu *vcpu) +{ + /* v1.1 and vendor ID */ + return (1UL << SDEI_VERSION_MAJOR_SHIFT) | + (1UL << SDEI_VERSION_MINOR_SHIFT) | + KVM_SDEI_VENDOR; +} + static unsigned long hypercall_register(struct kvm_vcpu *vcpu) { struct kvm_sdei_vcpu *vsdei = vcpu->arch.sdei; @@ -565,6 +573,9 @@ int kvm_sdei_call(struct kvm_vcpu *vcpu) } switch (func) { + case SDEI_1_0_FN_SDEI_VERSION: + ret = hypercall_version(vcpu); + break; case SDEI_1_0_FN_SDEI_EVENT_REGISTER: ret = hypercall_register(vcpu); break; -- 2.23.0