All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>
Cc: Frank.Li@kernel.org, "Oliver Upton" <oupton@kernel.org>,
	"Marc Zyngier" <maz@kernel.org>,
	kvmarm@lists.linux.dev, imx@lists.linux.dev
Subject: Re: [PATCH v3] arm64: errata: Add NXP iMX8QM workaround for A53 cache coherency issue
Date: Mon, 03 Aug 2026 09:24:08 +0000	[thread overview]
Message-ID: <20260803092408.69C7E1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260803-imx8qm-cache-coherency-v3-1-c518d0da3d3b@nxp.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

Pre-existing issues:
- [High] Trapping EL0 cache maintenance instructions breaks AArch32 compat applications because compat trap handlers are not implemented.
- [High] Missing Context Synchronization Event (ISB) immediately after writing to the SCTLR_EL1 control-plane system register.
--

--- Patch [1]: [PATCH v3] arm64: errata: Add NXP iMX8QM workaround for A53 cache coherency issue ---
commit ea6ce757f778ea074d9d845a9b2aa0e396e921d8
Author: Peng Fan <peng.fan@nxp.com>
Subject: arm64: errata: Add NXP iMX8QM workaround for A53 cache coherency issue

This patch adds a workaround for the i.MX8QM cache coherency issue ERR050104.
It downgrades targeted TLBI operations to broadcast-all variants, upgrades
IC IVAU to IC IALLUIS for kernel and userspace, and disables KVM.

Link: https://lore.kernel.org/all/20230420112952.28340-1-iivanov@suse.de/
Link: https://www.nxp.com/docs/en/errata/IMX8_1N94W.pdf

> diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c
> index 5db8f0619e4bc..4ba68c1f29b29 100644
> --- a/arch/arm64/kernel/cpu_errata.c
> +++ b/arch/arm64/kernel/cpu_errata.c

> [ ... ]

> @@ -200,6 +202,28 @@ cpu_enable_cache_maint_trap(const struct arm64_cpu_capabilities *__unused)
>  	sysreg_clear_set(sctlr_el1, SCTLR_EL1_UCI, 0);
>  }
>  
> +#ifdef CONFIG_NXP_IMX8QM_ERRATUM_ERR050104
> +static bool
> +is_imx8qm_soc(const struct arm64_cpu_capabilities *entry, int scope)
> +{
> +	WARN_ON(preemptible());
> +
> +	return of_machine_is_compatible("fsl,imx8qm");
> +}
> +
> +static void
> +cpu_enable_imx8qm_err050104(const struct arm64_cpu_capabilities *__unused)
> +{
> +	cpu_enable_cache_maint_trap(__unused);

[Severity: High]
This is a pre-existing issue, but does trapping EL0 cache maintenance
instructions break AArch32 compat applications here?

The cpu_enable_cache_maint_trap() function clears SCTLR_EL1.UCI, which
causes EL0 cache maintenance instructions to trap to EL1. While AArch64
instructions trap as ESR_ELx_EC_SYS64 and are handled by
user_cache_maint_handler(), AArch32 CP15 instructions trap as
ESR_ELx_EC_CP15_32.

Looking at cp15_32_hooks[] in arch/arm64/kernel/traps.c, it lacks definitions
to catch trapped AArch32 CP15 cache maintenance instructions. This means the
trap falls through to do_el0_undef() which injects SIGILL, crashing valid
AArch32 userspace applications on affected systems.

[Severity: High]
This is also a pre-existing issue in cpu_enable_cache_maint_trap(), but does
the call here extend an unsynchronized execution window?

cpu_enable_cache_maint_trap() updates SCTLR_EL1 but misses the required
context synchronization event (isb) immediately after the write:

cpu_enable_cache_maint_trap()
    sysreg_clear_set(sctlr_el1, SCTLR_EL1_UCI, 0);
    /* missing isb() */

When called from cpu_enable_imx8qm_err050104(), execution continues to
kvm_disable_mode() without a barrier.

The ARM64 subsystem guidelines state that every write to a control-plane
system register must be followed by an isb() as the very next instruction,
otherwise the CPU operates under a stale configuration for several cycles.

> +
> +	/*
> +	 * TLB maintenance cannot be guaranteed correct for guests, so
> +	 * disable KVM as if kvm-arm.mode=none was passed on the command line.
> +	 */
> +	kvm_disable_mode();
> +}
> +#endif

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260803-imx8qm-cache-coherency-v3-1-c518d0da3d3b@nxp.com?part=1

  reply	other threads:[~2026-08-03  9:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-03  8:54 [PATCH v3] arm64: errata: Add NXP iMX8QM workaround for A53 cache coherency issue Peng Fan (OSS)
2026-08-03  9:24 ` sashiko-bot [this message]
2026-08-10 14:51 ` Francesco Dolcini
2026-08-11 14:11   ` Peng Fan
2026-08-11 14:26 ` 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=20260803092408.69C7E1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=imx@lists.linux.dev \
    --cc=kvmarm@lists.linux.dev \
    --cc=maz@kernel.org \
    --cc=oupton@kernel.org \
    --cc=peng.fan@oss.nxp.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.