Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Zeng Heng <zengheng@huaweicloud.com>
To: Vladimir Murzin <vladimir.murzin@arm.com>,
	Zeng Heng <zengheng@huaweicloud.com>,
	corbet@lwn.net, kuninori.morimoto.gx@renesas.com, maz@kernel.org,
	oupton@kernel.org, catalin.marinas@arm.com, lucaswei@google.com,
	yeoreum.yun@arm.com, skhan@linuxfoundation.org,
	james.clark@linaro.org, broonie@kernel.org, mark.rutland@arm.com,
	lpieralisi@kernel.org, ryan.roberts@arm.com, will@kernel.org,
	tongtiangen@huawei.com, kevin.brodsky@arm.com,
	yangyicong@hisilicon.com, miko.lenczewski@arm.com
Cc: linux-doc@vger.kernel.org, wangkefeng.wang@huawei.com,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, sunnanyong@huawei.com
Subject: Re: [PATCH] arm64: kernel: Disable CNP on HiSilicon HIP09
Date: Tue, 26 May 2026 20:19:28 +0800	[thread overview]
Message-ID: <262fdd41-81bf-fb65-c1b7-c9f15e893156@huaweicloud.com> (raw)
In-Reply-To: <3e7d5472-9c40-456c-876e-c2e71fa0e8fa@arm.com>

Hi Vladimir,

On 2026/5/26 20:10, Vladimir Murzin wrote:
> Hi,
> 
> On 5/26/26 02:57, Zeng Heng wrote:
>> From: Tong Tiangen <tongtiangen@huawei.com>
>>
>> HiSilicon HIP09 implements TLB entry matching behavior that deviates
>> from the ARM architecture specification when the CNP (Common not Private)
>> bit is set in TTBRx_ELx.
>>
>> When TTBRx.CNP=1, TLB entries may be incorrectly shared between CPU
>> cores, leading to TLB conflicts and stale mappings. This affects
>> coherency and can result in incorrect translations.
>>
>> Add the hardware erratum workaround (Hisilicon erratum 162100125) to
>> disable CNP on affected HIP09 cores.
>>
>> Signed-off-by: Tong Tiangen <tongtiangen@huawei.com>
>> Signed-off-by: Zeng Heng <zengheng4@huawei.com>
>> ---
>>   Documentation/arch/arm64/silicon-errata.rst |  2 ++
>>   arch/arm64/Kconfig                          | 15 +++++++++++++++
>>   arch/arm64/kernel/cpu_errata.c              |  7 +++++++
>>   arch/arm64/kernel/cpufeature.c              |  3 ++-
>>   arch/arm64/tools/cpucaps                    |  1 +
>>   5 files changed, 27 insertions(+), 1 deletion(-)
>>
>> diff --git a/Documentation/arch/arm64/silicon-errata.rst b/Documentation/arch/arm64/silicon-errata.rst
>> index 211119ce7adc..cd50059edb85 100644
>> --- a/Documentation/arch/arm64/silicon-errata.rst
>> +++ b/Documentation/arch/arm64/silicon-errata.rst
>> @@ -284,6 +284,8 @@ stable kernels.
>>   +----------------+-----------------+-----------------+-----------------------------+
>>   | Hisilicon      | Hip09           | #162100801      | HISILICON_ERRATUM_162100801 |
>>   +----------------+-----------------+-----------------+-----------------------------+
>> +| Hisilicon      | Hip09           | #162100125      | HISILICON_ERRATUM_162100125 |
>> ++----------------+-----------------+-----------------+-----------------------------+
>>   +----------------+-----------------+-----------------+-----------------------------+
>>   | Qualcomm Tech. | Kryo/Falkor v1  | E1003           | QCOM_FALKOR_ERRATUM_1003    |
>>   +----------------+-----------------+-----------------+-----------------------------+
>> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
>> index fe60738e5943..ed6207c75b54 100644
>> --- a/arch/arm64/Kconfig
>> +++ b/arch/arm64/Kconfig
>> @@ -1273,6 +1273,21 @@ config HISILICON_ERRATUM_162100801
>>   
>>   	  If unsure, say Y.
>>   
>> +config HISILICON_ERRATUM_162100125
>> +	bool "Hisilicon erratum 162100125"
>> +	default y
>> +	help
>> +	  On HiSilicon HIP09, TLB entry matching behavior when CNP
>> +	  (TTBRx.CNP=1) is enabled differs from the ARM architecture
>> +	  specification.
>> +
>> +	  TLB entries may be incorrectly shared between CPUs, potentially
>> +	  causing TLB conflicts and stale mappings.
>> +
>> +	  Disable CNP support for affected HiSilicon HIP09 cores.
>> +
>> +	  If unsure, say Y.
>> +
>>   config QCOM_FALKOR_ERRATUM_1003
>>   	bool "Falkor E1003: Incorrect translation due to ASID change"
>>   	default y
>> diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c
>> index 5377e4c2eba2..26d9677a20fc 100644
>> --- a/arch/arm64/kernel/cpu_errata.c
>> +++ b/arch/arm64/kernel/cpu_errata.c
>> @@ -968,6 +968,13 @@ const struct arm64_cpu_capabilities arm64_errata[] = {
>>   		.matches = has_impdef_pmuv3,
>>   		.cpu_enable = cpu_enable_impdef_pmuv3_traps,
>>   	},
>> +#ifdef CONFIG_HISILICON_ERRATUM_162100125
>> +	{
>> +		.desc = "Hisilicon erratum 162100125",
>> +		.capability = ARM64_WORKAROUND_HISILICON_ERRATUM_162100125,
>> +		ERRATA_MIDR_ALL_VERSIONS(MIDR_HISI_HIP09),
>> +	},
>> +#endif
>>   	{
>>   	}
>>   };
>> diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
>> index 6d53bb15cf7b..c4b0db77a58a 100644
>> --- a/arch/arm64/kernel/cpufeature.c
>> +++ b/arch/arm64/kernel/cpufeature.c
>> @@ -1785,7 +1785,8 @@ has_useable_cnp(const struct arm64_cpu_capabilities *entry, int scope)
>>   	if (is_kdump_kernel())
>>   		return false;
>>   
>> -	if (cpus_have_cap(ARM64_WORKAROUND_NVIDIA_CARMEL_CNP))
>> +	if (cpus_have_cap(ARM64_WORKAROUND_NVIDIA_CARMEL_CNP) ||
>> +	    cpus_have_cap(ARM64_WORKAROUND_HISILICON_ERRATUM_162100125))
>>   		return false;
> 
> Since we now have a second user for this workaround, would it
> make sense to:
> 1. factor out the existing ARM64_WORKAROUND_NVIDIA_CARMEL_CNP into a common capability,
>     for example ARM64_WORKAROUND_DISABLE_CNP
> 2. wire up erratum 162100125 to use the common ARM64_WORKAROUND_DISABLE_CNP capability?
> 
> Cheers
> Vladimir
> 

This makes sense to me. Thanks for the reminder.

Best regards,
Zeng Heng

>>   
>>   	return has_cpuid_feature(entry, scope);
>> diff --git a/arch/arm64/tools/cpucaps b/arch/arm64/tools/cpucaps
>> index 811c2479e82d..b797d4893adc 100644
>> --- a/arch/arm64/tools/cpucaps
>> +++ b/arch/arm64/tools/cpucaps
>> @@ -128,3 +128,4 @@ WORKAROUND_REPEAT_TLBI
>>   WORKAROUND_SPECULATIVE_AT
>>   WORKAROUND_SPECULATIVE_SSBS
>>   WORKAROUND_SPECULATIVE_UNPRIV_LOAD
>> +WORKAROUND_HISILICON_ERRATUM_162100125
>> -- 2.43.0
>>
> 
> 
> 



      reply	other threads:[~2026-05-26 12:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-26  1:57 [PATCH] arm64: kernel: Disable CNP on HiSilicon HIP09 Zeng Heng
2026-05-26 12:10 ` Vladimir Murzin
2026-05-26 12:19   ` Zeng Heng [this message]

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=262fdd41-81bf-fb65-c1b7-c9f15e893156@huaweicloud.com \
    --to=zengheng@huaweicloud.com \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=corbet@lwn.net \
    --cc=james.clark@linaro.org \
    --cc=kevin.brodsky@arm.com \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=lucaswei@google.com \
    --cc=mark.rutland@arm.com \
    --cc=maz@kernel.org \
    --cc=miko.lenczewski@arm.com \
    --cc=oupton@kernel.org \
    --cc=ryan.roberts@arm.com \
    --cc=skhan@linuxfoundation.org \
    --cc=sunnanyong@huawei.com \
    --cc=tongtiangen@huawei.com \
    --cc=vladimir.murzin@arm.com \
    --cc=wangkefeng.wang@huawei.com \
    --cc=will@kernel.org \
    --cc=yangyicong@hisilicon.com \
    --cc=yeoreum.yun@arm.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