From: Marc Zyngier <maz@kernel.org>
To: Oliver Upton <oliver.upton@linux.dev>
Cc: kvmarm@lists.linux.dev, James Morse <james.morse@arm.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Zenghui Yu <yuzenghui@huawei.com>, Will Deacon <will@kernel.org>,
Sebastian Ene <sebastianene@google.com>
Subject: Re: [PATCH] KVM: arm64: Allow pKVM on v1.0 compatible FF-A implementations
Date: Wed, 19 Jul 2023 10:57:44 +0100 [thread overview]
Message-ID: <86wmywte93.wl-maz@kernel.org> (raw)
In-Reply-To: <20230718184537.3220867-1-oliver.upton@linux.dev>
On Tue, 18 Jul 2023 19:45:37 +0100,
Oliver Upton <oliver.upton@linux.dev> 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 <oliver.upton@linux.dev>
> ---
> 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 <maz@kernel.org>
M.
--
Without deviation from the norm, progress is not possible.
next prev parent reply other threads:[~2023-07-19 9:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-18 18:45 [PATCH] KVM: arm64: Allow pKVM on v1.0 compatible FF-A implementations Oliver Upton
2023-07-19 9:57 ` Marc Zyngier [this message]
2023-07-19 11:17 ` Will Deacon
2023-07-19 16:59 ` Oliver Upton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86wmywte93.wl-maz@kernel.org \
--to=maz@kernel.org \
--cc=james.morse@arm.com \
--cc=kvmarm@lists.linux.dev \
--cc=oliver.upton@linux.dev \
--cc=sebastianene@google.com \
--cc=suzuki.poulose@arm.com \
--cc=will@kernel.org \
--cc=yuzenghui@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.