From mboxrd@z Thu Jan 1 00:00:00 1970 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 D1308111A1 for ; Wed, 19 Jul 2023 09:57:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D1E5C433C7; Wed, 19 Jul 2023 09:57:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689760667; bh=nJ3oeY7upNBxIkfAu96/rCmaTW2rNvU5rG3BG0QbhMg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=o/pRF5u6RlxUfgcG+LzE+cs1xzMrvo4GnGstqbtYP6wYCFDlP7UDQ9Nts2CnLH9TD TJoS6cSzGLaZqGw5zI5Hd51l67ZTc1q3C4agIDZev+ZWsBCYZsgwRLMKANPNrgurOU 5BR8M8lSgZE4wZs9H2aT5pbtS+Mgx/Y5fZCnvYopnsm5d+ghLU5bumCVZzFJnirZdB SLxUefXzAcKHfojthyrOBxBO5atVWKIIu5kBs+Wsyq/nAj4SV0u0CPwd2B5lmYAdvX SOKHlD5hpSlOrNvFotX/4jSTs/h07cStyCzLBDmbpA0RAXyvILVELdWJRmZHVHDFYe 07+ZC+UvXc2kA== 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 1qM3wG-00EKoc-Se; Wed, 19 Jul 2023 10:57:44 +0100 Date: Wed, 19 Jul 2023 10:57:44 +0100 Message-ID: <86wmywte93.wl-maz@kernel.org> From: Marc Zyngier To: Oliver Upton Cc: kvmarm@lists.linux.dev, James Morse , Suzuki K Poulose , Zenghui Yu , Will Deacon , Sebastian Ene Subject: Re: [PATCH] KVM: arm64: Allow pKVM on v1.0 compatible FF-A implementations In-Reply-To: <20230718184537.3220867-1-oliver.upton@linux.dev> References: <20230718184537.3220867-1-oliver.upton@linux.dev> 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/28.2 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Precedence: bulk X-Mailing-List: kvmarm@lists.linux.dev 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: oliver.upton@linux.dev, kvmarm@lists.linux.dev, james.morse@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, will@kernel.org, sebastianene@google.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Tue, 18 Jul 2023 19:45:37 +0100, Oliver Upton wrote: > > pKVM initialization fails on systems with v1.1+ FF-A implementations, as > the hyp does a strict match on the returned version from FFA_VERSION. > This is a stronger assertion than required by the specification, which > requires minor revisions be backwards compatible with earlier revisions > of the same major version. > > Relax the check in hyp_ffa_init() to only test the returned major > version. Even though v1.1 broke ABI, the expectation is that firmware > incapable of using the v1.0 ABI return NOT_SUPPORTED instead of a valid > version. > > Signed-off-by: Oliver Upton > --- > arch/arm64/kvm/hyp/nvhe/ffa.c | 15 ++++++++++++++- > 1 file changed, 14 insertions(+), 1 deletion(-) > > diff --git a/arch/arm64/kvm/hyp/nvhe/ffa.c b/arch/arm64/kvm/hyp/nvhe/ffa.c > index 58dcd92bf346..ab4f5d160c58 100644 > --- a/arch/arm64/kvm/hyp/nvhe/ffa.c > +++ b/arch/arm64/kvm/hyp/nvhe/ffa.c > @@ -705,7 +705,20 @@ int hyp_ffa_init(void *pages) > if (res.a0 == FFA_RET_NOT_SUPPORTED) > return 0; > > - if (res.a0 != FFA_VERSION_1_0) > + /* > + * Firmware returns the maximum supported version of the FF-A > + * implementation. Check that the returned version is > + * backwards-compatible with the hyp according to the rules in DEN0077A > + * v1.1 REL0 13.2.1. > + * > + * Of course, things are never simple when dealing with firmware. v1.1 > + * broke ABI with v1.0 on several structures, which is itself > + * incompatible with the aforementioned versioning scheme. The > + * expectation is that v1.x implementations that do not support the v1.0 > + * ABI return NOT_SUPPORTED rather than a version number, according to > + * DEN0077A v1.1 REL0 18.6.4. To quote someone: "What a great!" > + */ > + if (FFA_MAJOR_VERSION(res.a0) != 1) > return -EOPNOTSUPP; > > arm_smccc_1_1_smc(FFA_ID_GET, 0, 0, 0, 0, 0, 0, 0, &res); > > base-commit: 9d2a55b403eea26cab7c831d8e1c00ef1e6a6850 Acked-by: Marc Zyngier M. -- Without deviation from the norm, progress is not possible.