From: Oliver Upton <oliver.upton@linux.dev>
To: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
Cc: kvmarm@lists.linux.dev, maz@kernel.org, catalin.marinas@arm.com,
will@kernel.org, mark.rutland@arm.com, cohuck@redhat.com,
eric.auger@redhat.com, sebott@redhat.com, yuzenghui@huawei.com,
wangzhou1@hisilicon.com, jiangkunkun@huawei.com,
jonathan.cameron@huawei.com, anthony.jebson@huawei.com,
linux-arm-kernel@lists.infradead.org, linuxarm@huawei.com
Subject: Re: [PATCH v5 4/4] arm64: paravirt: Enable errata based on implementation CPUs
Date: Mon, 27 Jan 2025 09:37:54 -0800 [thread overview]
Message-ID: <Z5fEcqVDrPP_7pXp@linux.dev> (raw)
In-Reply-To: <20250124151732.6072-5-shameerali.kolothum.thodi@huawei.com>
On Fri, Jan 24, 2025 at 03:17:32PM +0000, Shameer Kolothum wrote:
> +void __init pv_target_impl_cpu_init(void)
I get the sense that this implementation should actually be part of the
KVM guest services driver in drivers/firmware/smccc/kvm_guest.c
> +{
> + int i;
> + unsigned long max_cpus;
> + struct arm_smccc_res res;
> + const u32 funcs[] = {
> + ARM_SMCCC_KVM_FUNC_DISCOVER_IMPL_VER,
> + ARM_SMCCC_KVM_FUNC_DISCOVER_IMPL_CPUS,
> + };
> +
> + /* Check we have already set targets */
> + if (target_impl_cpu_num)
> + return;
> +
> + for (i = 0; i < ARRAY_SIZE(funcs); ++i) {
> + if (!kvm_arm_hyp_service_available(funcs[i]))
> + return;
> + }
nit: drop the for loop and just use the literal values.
> + arm_smccc_1_1_invoke(ARM_SMCCC_VENDOR_HYP_KVM_DISCOVER_IMPL_VER_FUNC_ID,
> + 0, &res);
> + if (res.a0 != SMCCC_RET_SUCCESS)
> + return;
> +
> + if (res.a1 != ARM_SMCCC_KVM_DISCOVER_IMPL_VER_1_0 || !res.a2) {
This is brittle. The versioning scheme really should match that of PSCI
/ SMCCC, where minor revisions within the same major are backwards
compatible with older clients.
So consider just checking that the major version is 1.
> + pr_warn("Unsupported target impl version or CPU implementations\n");
This would be more useful if you provide context (i.e. the detected
version).
--
Thanks,
Oliver
next prev parent reply other threads:[~2025-01-27 17:39 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-24 15:17 [PATCH v5 0/4] KVM: arm64: Errata management for VM Live migration Shameer Kolothum
2025-01-24 15:17 ` [PATCH v5 1/4] arm64: Modify _midr_range() functions to read MIDR/REVIDR internally Shameer Kolothum
2025-01-24 15:17 ` [PATCH v5 2/4] KVM: arm64: Introduce hypercall support for retrieving target implementations Shameer Kolothum
2025-01-27 12:50 ` Cornelia Huck
2025-01-27 17:26 ` Oliver Upton
2025-01-28 14:16 ` Shameerali Kolothum Thodi
2025-01-24 15:17 ` [PATCH v5 3/4] KVM: arm64: Report all the KVM/arm64-specific hypercalls Shameer Kolothum
2025-01-27 12:47 ` Cornelia Huck
2025-01-27 13:35 ` Shameerali Kolothum Thodi
2025-01-27 17:05 ` Oliver Upton
2025-01-27 17:24 ` Shameerali Kolothum Thodi
2025-01-24 15:17 ` [PATCH v5 4/4] arm64: paravirt: Enable errata based on implementation CPUs Shameer Kolothum
2025-01-27 12:53 ` Cornelia Huck
2025-01-27 17:37 ` Oliver Upton [this message]
2025-02-04 16:45 ` [PATCH v5 0/4] KVM: arm64: Errata management for VM Live migration Sebastian Ott
2025-02-04 17:11 ` Marc Zyngier
2025-02-04 17:42 ` Sebastian Ott
2025-02-04 18:15 ` Marc Zyngier
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=Z5fEcqVDrPP_7pXp@linux.dev \
--to=oliver.upton@linux.dev \
--cc=anthony.jebson@huawei.com \
--cc=catalin.marinas@arm.com \
--cc=cohuck@redhat.com \
--cc=eric.auger@redhat.com \
--cc=jiangkunkun@huawei.com \
--cc=jonathan.cameron@huawei.com \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linuxarm@huawei.com \
--cc=mark.rutland@arm.com \
--cc=maz@kernel.org \
--cc=sebott@redhat.com \
--cc=shameerali.kolothum.thodi@huawei.com \
--cc=wangzhou1@hisilicon.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).