diff mbox series

[v2,1/1] arm64/cpufeature: Add arm64.nomte to override id-reg

Message ID 20210729020717.15142-2-yee.lee@mediatek.com (mailing list archive)
State New, archived
Headers show
Series Add option to disable mte support | expand

Commit Message

Yee Lee (李建誼) July 29, 2021, 2:07 a.m. UTC
From: Yee Lee <yee.lee@mediatek.com>

Add an alias, "arm64.nomte", to override id-reg and
suppress mte feature.

Suggested-by: Marc Zyngier <maz@kernel.org>
Suggested-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Yee Lee <yee.lee@mediatek.com>
---
 arch/arm64/kernel/idreg-override.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Marc Zyngier July 29, 2021, 8:47 a.m. UTC | #1
On Thu, 29 Jul 2021 03:07:12 +0100,
<yee.lee@mediatek.com> wrote:
> 
> From: Yee Lee <yee.lee@mediatek.com>
> 
> Add an alias, "arm64.nomte", to override id-reg and

This isn't just an alias. This patch does two things:

- it allows the ID_AA64PFR1_EL1.MTE shadow capability to be set from
  the command line,
- it provides the arm64.nomte alias that sets the above to 0 to
  disable the MTE feature.

> suppress mte feature.

s/mte/MTE/

Maybe also worth indicating *why* this is needed. Possible
justifications include errata workarounds, performance issues... Pick
your own.

> 
> Suggested-by: Marc Zyngier <maz@kernel.org>
> Suggested-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> Signed-off-by: Yee Lee <yee.lee@mediatek.com>
> ---
>  arch/arm64/kernel/idreg-override.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/arm64/kernel/idreg-override.c b/arch/arm64/kernel/idreg-override.c
> index 53a381a7f65d..d8e606fe3c21 100644
> --- a/arch/arm64/kernel/idreg-override.c
> +++ b/arch/arm64/kernel/idreg-override.c
> @@ -54,6 +54,7 @@ static const struct ftr_set_desc pfr1 __initconst = {
>  	.override	= &id_aa64pfr1_override,
>  	.fields		= {
>  	        { "bt", ID_AA64PFR1_BT_SHIFT },
> +		{ "mte", ID_AA64PFR1_MTE_SHIFT},
>  		{}
>  	},
>  };
> @@ -100,6 +101,7 @@ static const struct {
>  	{ "arm64.nopauth",
>  	  "id_aa64isar1.gpi=0 id_aa64isar1.gpa=0 "
>  	  "id_aa64isar1.api=0 id_aa64isar1.apa=0"	   },
> +	{ "arm64.nomte",		"id_aa64pfr1.mte=0" },
>  	{ "nokaslr",			"kaslr.disabled=1" },
>  };
>  

This needs to be documented in kernel-parameters.txt. See the nobti
and nopauth options for guidance.

Thanks,

	M.
diff mbox series

Patch

diff --git a/arch/arm64/kernel/idreg-override.c b/arch/arm64/kernel/idreg-override.c
index 53a381a7f65d..d8e606fe3c21 100644
--- a/arch/arm64/kernel/idreg-override.c
+++ b/arch/arm64/kernel/idreg-override.c
@@ -54,6 +54,7 @@  static const struct ftr_set_desc pfr1 __initconst = {
 	.override	= &id_aa64pfr1_override,
 	.fields		= {
 	        { "bt", ID_AA64PFR1_BT_SHIFT },
+		{ "mte", ID_AA64PFR1_MTE_SHIFT},
 		{}
 	},
 };
@@ -100,6 +101,7 @@  static const struct {
 	{ "arm64.nopauth",
 	  "id_aa64isar1.gpi=0 id_aa64isar1.gpa=0 "
 	  "id_aa64isar1.api=0 id_aa64isar1.apa=0"	   },
+	{ "arm64.nomte",		"id_aa64pfr1.mte=0" },
 	{ "nokaslr",			"kaslr.disabled=1" },
 };