Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp1235768lqp; Fri, 22 Mar 2024 09:05:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVoceAwZfGIVe2ac8b4PlFcdT3hMApBF9CTGNHn0sY4I8i5AN0vMRA2XZDFNVfBScELyoDG2ITR+zZb+zaK5eP+X134KsGDdIUPc16dnw== X-Google-Smtp-Source: AGHT+IG+s0KbNgt+r1O2PO/2/h3VAtsv21mHWjMdxuZ8dAmdLVxqVZxB2qAYeOIepavu2IStgtvx X-Received: by 2002:a50:9e09:0:b0:568:d7a4:1e67 with SMTP id z9-20020a509e09000000b00568d7a41e67mr2001656ede.21.1711123518994; Fri, 22 Mar 2024 09:05:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711123518; cv=pass; d=google.com; s=arc-20160816; b=uv9sL/iUKC8oB9Ue59whM4ZImnW9hltV3Jh88qf01/iS3+ZnCg7bABB5IQPkltIBgJ 7bbaTtvav/zpiVCOFaChf2TC0tGu0A4n4rhBD8U78Gzpzm+n/KB19pzNGSvTswOH6m+W JeCQoVLG5bYb8BsvnuOrdtDOpgZ21vr1j9Iu2+wYojol4W94FF5Dmah2ui30LQOBKvE8 /SeH2dVwJ7s0E8TopHAI+urc0eJnnF96Cv7N2FCbdh4GtBpd1nLf4gsrzKQGOwbCEJxB NmL7qFsAc1XTb2lErze/5G7llPfQy+tmqAtH1PQZzTpgBgh5mA4+uwsjV3PiIfJXH7ob +0cA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:references:in-reply-to:subject:cc:to:from:message-id :date:dkim-signature; bh=9sAzZmcDkVziTkO/N+znN7O0p2ITKFD+oteaejIyJ7c=; fh=/m/KvBm29e8C82BxLyQmZAabVpMOhKD/wkT2O8iGeDs=; b=X5/d1CsJaKmlhhTxG12J1ZVY25qdrweAJv3KECrqb0v/N7lfaO6hU5tflhLVJwJRR7 EsiEq/WDiJDqeuFS+/TuLdePB2meHvJOw7YPrduD7bx8dWiTDkynptCEQhjVGjO4dlVx ZH1U8jmryvFpXKzJa7kagtU/SykFXFopndQlATWhpSoyDTPgjvzuOIgEYaS8dcBuuLNA 6wX6VNL2acyXtdc0/cky+0iyC3aAzVbrBUoCx534c+5Lqd2KsLkP8Ftam5+YjUiLHBas eqEULl5q0igF3wiiAlJxUXfefDKicWGTTa1/b6QoN8sEQyB5Qo/B9kY0RlOv9o1uowTU kwXg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sNV5udq8; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-111743-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111743-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id p23-20020a056402501700b00564511aa945si1015726eda.266.2024.03.22.09.05.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 09:05:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-111743-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sNV5udq8; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-111743-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111743-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 am.mirrors.kernel.org (Postfix) with ESMTPS id B97581F23CD1 for ; Fri, 22 Mar 2024 16:05:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9651557876; Fri, 22 Mar 2024 16:05:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="sNV5udq8" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A4A0C481A0; Fri, 22 Mar 2024 16:05:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711123504; cv=none; b=V8zh2l468MrefuaVWcFwh7Fi4/7nWfyH34LmEVO9+UJcf7BX90vSxaaS6A4riqZ4AZoq4eA1PzebtdAaAvrba+TcXzxcwT+60xpaor9waB3jvgEouxO5x46s9y75WEgA9jtT8x9YR6yFw5TPkrWwu72JcwUvHFrdBAS+R3KsZUs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711123504; c=relaxed/simple; bh=pU676GFAED0poswPTfyBT5GkBYVJPMcwY8WVLXctuBo=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=llepuJcltc85HmnRM+2Pw6DPBho6lpVE8WU1BNeYAd7aSIlnA3UinSbcKRZkuFDipDg5IL/uERKkSNuaV+vHX/8UhOBn404OsufXkM6gieIEf1CwU0/r+twCS1xFd84teuz9rz0XrmvzYo6F/MQuuEdsIt+UXz9qCj0B0r9u0yM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=sNV5udq8; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C2BBC433C7; Fri, 22 Mar 2024 16:05:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711123503; bh=pU676GFAED0poswPTfyBT5GkBYVJPMcwY8WVLXctuBo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=sNV5udq8Io5AIDHW9FgD7zcq57bDQSVadRUpGCrWONB22OGzkpZipbImWpeB4GZlD kIaCue/uKQ6cPGNWS+pem1hsXnnu1Y+dAoFmmun/ovE2woh43rxfRhc66DfLXpH4pJ bJ8NLeyGS/86ktSd8VUHIeoui2v/QUkPnj3imj31nRsGZkCreFuRxBc/xEHZXPc26r B8WZjQggLOqQZMNHYsYBESo/vGsbO2qRUzYRxyPNEgHk4ksylUcUKGLbiVmt950RnS yXyXt08sPngMk8DxTrrAW24Q6/xqGxR82yRfBu/+1sEy9sNJF5g6QvaqFTHob2DnFC FXbLYZNpUamEQ== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1rnhO8-00EYGR-P1; Fri, 22 Mar 2024 16:05:00 +0000 Date: Fri, 22 Mar 2024 16:05:00 +0000 Message-ID: <86il1ez1zn.wl-maz@kernel.org> From: Marc Zyngier To: David Woodhouse Cc: linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, Paolo Bonzini , Jonathan Corbet , 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: Re: [RFC PATCH v3 2/5] KVM: arm64: Add support for PSCI v1.2 and v1.3 In-Reply-To: <20240319130957.1050637-3-dwmw2@infradead.org> References: <20240319130957.1050637-1-dwmw2@infradead.org> <20240319130957.1050637-3-dwmw2@infradead.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/29.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: dwmw2@infradead.org, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, pbonzini@redhat.com, corbet@lwn.net, oliver.upton@linux.dev, james.morse@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, catalin.marinas@arm.com, will@kernel.org, mark.rutland@arm.com, lpieralisi@kernel.org, rafael@kernel.org, len.brown@intel.com, pavel@ucw.cz, dwmw@amazon.co.uk, smostafa@google.com, jean-philippe@linaro.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev, linux-pm@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Tue, 19 Mar 2024 12:59:03 +0000, David Woodhouse wrote: > > 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) > { Consider making the visibility of v1.2/1.3 to userspace and guest the last patch in the series, so that there is no transient support for some oddball PSCI version with no feature (keeps bisection clean). Thanks, M. -- Without deviation from the norm, progress is not possible.