From patchwork Mon Feb 21 15:35:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 12753774 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 78B1FC433F5 for ; Mon, 21 Feb 2022 15:36:57 +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=L1b1Td4stL1g3o+dqKKVVlK0ME4wmhz+rR6lMn3r3Ow=; b=Mxf/8qB0/ourBi 8vhWydgo0RWQ5r0VuS7BTGDavSoJzJ4QJnqVA9j8nQBHnW/UvZjkaQBCPjbjlaGUAAo++vGtNoqrE WF5SmXXJLzbWSL3uVquse1l9/IskQdRfBwbEBfnX0E/Jo8nA0mHkThr/nVeeXwmYkVmaJzCbrIqzg hqJtkmAsrlQrl6XbQvAQh9l3aE1dX07GsjWL2U0QSAAyJkFgl8qQZs08e8ghGnE3EAbO15/IhQVa8 3fz3Eu1DY2KIkfDmIFxooIefH4eoASMJg67nt/7krC7kwQHnmOAlBnPhMrsygqGi36n8lgN/sF4B4 j0I+Ey9wOYg5ILv0uiYw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nMAj5-006Q1H-6L; Mon, 21 Feb 2022 15:35:47 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nMAit-006PzE-4K for linux-arm-kernel@lists.infradead.org; Mon, 21 Feb 2022 15:35:37 +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 ams.source.kernel.org (Postfix) with ESMTPS id B2AE0B81222; Mon, 21 Feb 2022 15:35:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE382C340F4; Mon, 21 Feb 2022 15:35:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645457732; bh=+usV0DLUYlp3wcD/2Tehep5skgPOjK010M8g3nZiRLs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VDiJbqp1KdF/+I2T4AchTS97KxV5YPAC0Cspi9TG5b11tLXslU5n2ZWRD3v53/R5g CkS39Hqi3wrxAIJXY5/fVHvpsQw1ksdlGE9cX/sVi4znRahwPt50EOWwulNaPlCUEk KDB2ETdRO3tKZ2ZkBsL4+bjPcTtfJ9ckwGL27VcBT4DZqMPjrxE9mUN1bnjCt4Hbvn a5tuDXCNwcBCs2CBbqrNW55uU1meM4qYOCxbOP5oOIr1IC89DnbtEqp5jlSjpyeZIt CNew3WPgpwWuXkTTrVO00M4hfVnGEUGUG3BXbe8U6J1eueqe/11rlNWVFnTU2jTaOu HL6j8OTIESsBA== 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 v2 1/3] KVM: arm64: Bump guest PSCI version to 1.1 Date: Mon, 21 Feb 2022 15:35:22 +0000 Message-Id: <20220221153524.15397-2-will@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220221153524.15397-1-will@kernel.org> References: <20220221153524.15397-1-will@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220221_073535_492026_25CC6A68 X-CRM114-Status: GOOD ( 15.95 ) 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