Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp957685lqt; Tue, 19 Mar 2024 08:41:50 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX+MY/k2trDEgHy0QqCnikSymfPVRwZlf8wenUnEDlvoWxKPX+3CZuzwbjbdeRWKX6q/FoBVmtjVI93TnScHNpZGXmC3XOYpgqyo7EMOw== X-Google-Smtp-Source: AGHT+IFvTDMW690t4hbX3hErVQhzATi+oQRn4yguWTuYk5AqENfsNqHdM2IFqwR5/+jtkrSKNyaH X-Received: by 2002:a05:6808:301e:b0:3c2:39d1:f111 with SMTP id ay30-20020a056808301e00b003c239d1f111mr17072461oib.48.1710862910040; Tue, 19 Mar 2024 08:41:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710862910; cv=pass; d=google.com; s=arc-20160816; b=YbGMqYgBFN4UrkWkWhaQI+5R6v1SKfdJzcpgK+B9SNuWfAXsIyYsHBzbITW1BMSrjf T57XF4h7D8VqIDnKtXohQI6t834ng59JJzyJ19tXhFQDcr9kpkoWO/2bdumlmotVg51K 9YFTqNoY5u+UwzVMy9qqC2NDO8l+KYorvJI3lEFGGIUhVN4WP5NDqNPSixU72BAwrA59 Od65Meq2jQ8c5A/53Oc1bBHkvPRR1BvLFHeHNL44g1tQoTi0CBvgCzb9e4KgLztMYhUt GGrvL3r333b53BVY5Xgl72njzdU97lccFkkt9oRafXn0rql2iCR/3rLngEkN1Leb4y6j qEGg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Gextfsg6+axAOOI5Q/vPLc1swsmolk11VUfz1aNL728=; fh=cGTiXEW680tjRkJBO0R8Z7uT0RUWfkbNFWDDGM1ZY2g=; b=nK7ObutJpCMXVvih+jzW0al0ky/ilgRs2fcvpLqi/UmBlA5MG8vTiRJfIul0qSgJAY Q9kPyT9M6b5LjIjpmjDUZ/aPWKJv1Ll4G8O9CMyNy+dNcOmjLmL2aqNoGYV/FTrI2kOu PdyKYBGlxBSyM4RTn7SlGCK5p8ZZliIkKyxLZ/VCjpQrNM4aL2iLW2woxnot9ZQoigf3 l5a0U5rLU2TMrLp1D1AO+VRkv/jjqSnF4eOW7IyyKYndJDUeNUfCWUgKItU9dh9whnMF WtF/94L6iNjrxY3j11qGGWY6A6YSuc6Wj3rdcIXdpN8gJF1/0KTvOGhBujrT5jLwcl1N A5vQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=qe59vEfy; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-107575-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107575-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id h14-20020ac85e0e000000b0043093b86b69si11215498qtx.308.2024.03.19.08.41.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 08:41:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-107575-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=qe59vEfy; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-107575-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107575-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id B231B1C226B1 for ; Tue, 19 Mar 2024 13:13:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8052782889; Tue, 19 Mar 2024 13:10:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="qe59vEfy" Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6FB9081727; Tue, 19 Mar 2024 13:10:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710853815; cv=none; b=hq277N6pHN+Cjwa88p3p53vMNXgQ6AXdh2Cb9g0u20KMQTQh3XYLGTL5BgRPe4KeMOIrwkh2qeNF817uaUYO0NJqhjtntwScIA8BQDG5wGalG6QcEDkJYvoeKF5R9cFYWjWh6cg0wFj8XC1Ogmafvsizyw+4DnwTxGwbVdbxczo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710853815; c=relaxed/simple; bh=2UaxaJdxQ3fwEDx6b3vxPqEwTgxUhZqVXdbgubPR4Lw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=i61/ozyYDQp9snz9yTcSQKVQ/C8x+LNFZ1GrfHNzBy4Aq6raIai3sSisKNVBdnb6lScoBF7JwSvf/m74gnD+61vQ4yCBbC6/2+7owk4/xSmS6OBFVuz+kaAKv5h7RdvtSmpgoXOHHEIh/qyo1V+UwugpLYBUdb+z/A37IHJScKU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=casper.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=qe59vEfy; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=casper.srs.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=Gextfsg6+axAOOI5Q/vPLc1swsmolk11VUfz1aNL728=; b=qe59vEfyF2X2pAJ/UxqyBl2VB0 rLoKiMCsI2Wi3RGvpHvWx1CtZ+KsnvjNyDMizDRQBvfhFbs6akWxts76Di8g12dWr7tplS/ZhpMuh wGTrBXpoSiB9dkSQ1FuMjf8lKoTt9/lQlKCGezETSGfp3lIzbGhoFbdNlq4K2XND2SbNnc8YqZtR1 4Uea2VfGbQ8RTsZQTBLk/qBUyUWwI0m8k9Mnb4/Crxlo/H7QLLGg2X6Oa6hLB4oibJZv/z0suEUBy EhL0k/9wQVyNqZyxz4GfgOtc74eDlwAE53P31fMYITrY/Y/EWnysfWxWy+99Xt114+x8daWYrg+PW XT9n9AOA==; Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by casper.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rmZE9-00000001zLT-1ZF8; Tue, 19 Mar 2024 13:10:01 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rmZE8-00000004PMu-43k6; Tue, 19 Mar 2024 13:10:00 +0000 From: David Woodhouse To: linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org Cc: Paolo Bonzini , Jonathan Corbet , Marc Zyngier , Oliver Upton , James Morse , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Will Deacon , Mark Rutland , Lorenzo Pieralisi , "Rafael J. Wysocki" , Len Brown , Pavel Machek , David Woodhouse , Mostafa Saleh , Jean-Philippe Brucker , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev, linux-pm@vger.kernel.org Subject: [RFC PATCH v3 2/5] KVM: arm64: Add support for PSCI v1.2 and v1.3 Date: Tue, 19 Mar 2024 12:59:03 +0000 Message-ID: <20240319130957.1050637-3-dwmw2@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240319130957.1050637-1-dwmw2@infradead.org> References: <20240319130957.1050637-1-dwmw2@infradead.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: David Woodhouse X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html From: David Woodhouse Since the v1.3 specification is still in Alpha, only default to v1.2 unless userspace explicitly requests v1.3 for now. Signed-off-by: David Woodhouse --- arch/arm64/kvm/hypercalls.c | 2 ++ arch/arm64/kvm/psci.c | 6 +++++- include/kvm/arm_psci.h | 4 +++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kvm/hypercalls.c b/arch/arm64/kvm/hypercalls.c index 5763d979d8ca..9c6267ca2b82 100644 --- a/arch/arm64/kvm/hypercalls.c +++ b/arch/arm64/kvm/hypercalls.c @@ -575,6 +575,8 @@ int kvm_arm_set_fw_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg) case KVM_ARM_PSCI_0_2: case KVM_ARM_PSCI_1_0: case KVM_ARM_PSCI_1_1: + case KVM_ARM_PSCI_1_2: + case KVM_ARM_PSCI_1_3: if (!wants_02) return -EINVAL; vcpu->kvm->arch.psci_version = val; diff --git a/arch/arm64/kvm/psci.c b/arch/arm64/kvm/psci.c index 1f69b667332b..f689ef3f2f10 100644 --- a/arch/arm64/kvm/psci.c +++ b/arch/arm64/kvm/psci.c @@ -322,7 +322,7 @@ static int kvm_psci_1_x_call(struct kvm_vcpu *vcpu, u32 minor) switch(psci_fn) { case PSCI_0_2_FN_PSCI_VERSION: - val = minor == 0 ? KVM_ARM_PSCI_1_0 : KVM_ARM_PSCI_1_1; + val = PSCI_VERSION(1, minor); break; case PSCI_1_0_FN_PSCI_FEATURES: arg = smccc_get_arg1(vcpu); @@ -449,6 +449,10 @@ int kvm_psci_call(struct kvm_vcpu *vcpu) } switch (version) { + case KVM_ARM_PSCI_1_3: + return kvm_psci_1_x_call(vcpu, 3); + case KVM_ARM_PSCI_1_2: + return kvm_psci_1_x_call(vcpu, 2); case KVM_ARM_PSCI_1_1: return kvm_psci_1_x_call(vcpu, 1); case KVM_ARM_PSCI_1_0: diff --git a/include/kvm/arm_psci.h b/include/kvm/arm_psci.h index e8fb624013d1..ebd7d9a12790 100644 --- a/include/kvm/arm_psci.h +++ b/include/kvm/arm_psci.h @@ -14,8 +14,10 @@ #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_1_2 PSCI_VERSION(1, 2) +#define KVM_ARM_PSCI_1_3 PSCI_VERSION(1, 3) -#define KVM_ARM_PSCI_LATEST KVM_ARM_PSCI_1_1 +#define KVM_ARM_PSCI_LATEST KVM_ARM_PSCI_1_2 /* v1.3 is still Alpha */ static inline int kvm_psci_version(struct kvm_vcpu *vcpu) { -- 2.44.0