From patchwork Thu Feb 17 18:39:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 12750555 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D73EFC433F5 for ; Thu, 17 Feb 2022 18:41:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=GrtrlN/6b79qjcQU5K5ezKIUnzXu5dBtNmjXg+Pq45A=; b=U9B5N+N1/YPuEp mAe+qJE2HUEM3yCfRqGNFt5KAfAQeRrmI2KjEwt3qt7dsSXUG+nq+l1wjhH4juxIauQvJflOEDSSC pR5kQBaYbIQ/q3J9Vc7HdoDzhcWfrNDGVPh2PclJ6ukzHnfBdKhCWjEIdcH+JjovN0egrlmNn1aj+ t908RsS8A88yM3zHmC1Le3J5twu8BMJNvTWj9AUr5eS5iCfFcbJRnMRu+9a7C3kQiryX7iPErfPPl EQdj+qIKxhQEXx+tbBer52ncI7pveq99/AaXOhliF80HnQvSVruP5qySDbWUaOiJctBdT+4HIbkDT xzMWTLSD4YSjv5MQ2fYg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nKlhX-00BlBy-SU; Thu, 17 Feb 2022 18:40:24 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nKlhL-00BlAG-Ur for linux-arm-kernel@lists.infradead.org; Thu, 17 Feb 2022 18:40:13 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6EBE761B90; Thu, 17 Feb 2022 18:40:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74284C340F1; Thu, 17 Feb 2022 18:40:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645123210; bh=0AXo15yBYZFWMH8ykOuG3qsr78Xojpop/gHZzCMvs6A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nWuSPtBUj7EMYZ/Wi++d/iL10sqRqgVtv0TY+/J7+I3KQ4Iy3A6jQryUG4Z2iqFxJ 3OSPreK/+oyJUHhG9b/uUX0Y5X6SQNKmv31x7MaiJQ5YqcS5e3Qe9rmZSCG785l/Ut tUFoz9GFWGBIkzumhfy+7BUZjC6yIuCYAjDLs4cBFvIl1vqNJl2pAq2b20E4YWoSOE 6h19VnrNi6KD/9I87N2AU91hDjZi7SW2/Yw/oNp8o40orc/WKX6crPNyIMOs8K6Gie pOzYPwCE1xw7jP7E0RuUvNFi/nrsGXhNtudoyk+X7A9BDp2fl52XGrSCKI8axZvrzF mSNEjbzN8FN7A== From: Will Deacon To: kvmarm@lists.cs.columbia.edu Cc: linux-arm-kernel@lists.infradead.org, Will Deacon , Marc Zyngier , James Morse , Alexandru Elisei , Suzuki K Poulose Subject: [PATCH 1/3] KVM: arm64: Bump guest PSCI version to 1.1 Date: Thu, 17 Feb 2022 18:39:59 +0000 Message-Id: <20220217184001.11753-2-will@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220217184001.11753-1-will@kernel.org> References: <20220217184001.11753-1-will@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220217_104012_101244_ED9ED66D X-CRM114-Status: GOOD ( 15.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Expose PSCI version v1.1 to the guest by default. The only difference for now is that an updated version number is reported by PSCI_VERSION. Cc: Marc Zyngier Cc: James Morse Cc: Alexandru Elisei Cc: Suzuki K Poulose Signed-off-by: Will Deacon --- arch/arm64/kvm/psci.c | 12 +++++++++--- include/kvm/arm_psci.h | 3 ++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/arch/arm64/kvm/psci.c b/arch/arm64/kvm/psci.c index 3eae32876897..70d07477e712 100644 --- a/arch/arm64/kvm/psci.c +++ b/arch/arm64/kvm/psci.c @@ -305,16 +305,19 @@ static int kvm_psci_0_2_call(struct kvm_vcpu *vcpu) return ret; } -static int kvm_psci_1_0_call(struct kvm_vcpu *vcpu) +static int kvm_psci_1_x_call(struct kvm_vcpu *vcpu, u32 minor) { u32 psci_fn = smccc_get_function(vcpu); u32 feature; unsigned long val; int ret = 1; + if (minor > 1) + return -EINVAL; + switch(psci_fn) { case PSCI_0_2_FN_PSCI_VERSION: - val = KVM_ARM_PSCI_1_0; + val = minor == 0 ? KVM_ARM_PSCI_1_0 : KVM_ARM_PSCI_1_1; break; case PSCI_1_0_FN_PSCI_FEATURES: feature = smccc_get_arg1(vcpu); @@ -393,8 +396,10 @@ static int kvm_psci_0_1_call(struct kvm_vcpu *vcpu) int kvm_psci_call(struct kvm_vcpu *vcpu) { switch (kvm_psci_version(vcpu, vcpu->kvm)) { + case KVM_ARM_PSCI_1_1: + return kvm_psci_1_x_call(vcpu, 1); case KVM_ARM_PSCI_1_0: - return kvm_psci_1_0_call(vcpu); + return kvm_psci_1_x_call(vcpu, 0); case KVM_ARM_PSCI_0_2: return kvm_psci_0_2_call(vcpu); case KVM_ARM_PSCI_0_1: @@ -511,6 +516,7 @@ int kvm_arm_set_fw_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg) return 0; case KVM_ARM_PSCI_0_2: case KVM_ARM_PSCI_1_0: + case KVM_ARM_PSCI_1_1: if (!wants_02) return -EINVAL; vcpu->kvm->arch.psci_version = val; diff --git a/include/kvm/arm_psci.h b/include/kvm/arm_psci.h index 5b58bd2fe088..4a1003323a0c 100644 --- a/include/kvm/arm_psci.h +++ b/include/kvm/arm_psci.h @@ -13,8 +13,9 @@ #define KVM_ARM_PSCI_0_1 PSCI_VERSION(0, 1) #define KVM_ARM_PSCI_0_2 PSCI_VERSION(0, 2) #define KVM_ARM_PSCI_1_0 PSCI_VERSION(1, 0) +#define KVM_ARM_PSCI_1_1 PSCI_VERSION(1, 1) -#define KVM_ARM_PSCI_LATEST KVM_ARM_PSCI_1_0 +#define KVM_ARM_PSCI_LATEST KVM_ARM_PSCI_1_1 /* * We need the KVM pointer independently from the vcpu as we can call