Re: [PATCH v2] MIPS: disable MMID when not supported by the hardware

From: Thomas Bogendoerfer
Date: Wed Jul 16 2025 - 14:23:11 EST


On Thu, Jul 10, 2025 at 04:54:42PM +0200, Gregory CLEMENT wrote:
> It is possible that MMID is supported at the CPU level, but its
> integration in a SoC prevents its usage. For instance, if the
> System-level Interconnect (also known as Network on Chip) does not
> support global invalidation, then the MMID feature is not usable. The
> current implementation of MMID relies on the GINV* instructions.
>
> This patch allows the disabling of MMID based on a device tree
> property, as this issue cannot be detected at runtime.
>
> MMID is set up very early during the boot process, even before device
> tree data can be accessed. Therefore, when we determine whether MMID
> needs to be disabled, some MMID setup has already been performed for
> the boot CPU. Consequently, we must revert the MMID setup on the first
> CPU before disabling the feature for the subsequent CPUs that will be
> initialized later.
>
> Signed-off-by: Gregory CLEMENT <gregory.clement@xxxxxxxxxxx>
> ---
> Since the issue around MMID support cannot be detected at runtime,
> this patch now relies on a device tree property instead of a Kconfig
> option, as requested by Jiaxun and Thomas. However, as I pointed out
> in the commit log, MMID is enabled very early in the boot
> process. Therefore, I had to track all the parts of the kernel where
> MMID was set up before being able to access the device tree.
>
> I found that MMID was only set up for the first CPU, and I also
> ensured that we can revert the MMID configuration. Indeed, the MMID
> feature is not actively used until paging is set up, which occurs
> later in the boot process.
>
> Gregory
> ---
> Changes in v2:
> - Remove Kconfig dependencies
> - Rely on device tree property
> - Link to v1: https://lore.kernel.org/r/20250625-mmid_disable_no_ginv_on_noc-v1-1-38a3902607a7@xxxxxxxxxxx
> ---
> arch/mips/include/asm/cpu-info.h | 1 +
> arch/mips/kernel/cpu-probe.c | 42 ++++++++++++++++++++++++++++++++++++++--
> arch/mips/kernel/mips-cm.c | 5 +++++
> 3 files changed, 46 insertions(+), 2 deletions(-)

applied to mips-next.

Thomas.

--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]