Skip to content

Commit 7a062ce

Browse files
yeeleemtkctmarinas
authored andcommitted
arm64/cpufeature: Optionally disable MTE via command-line
MTE support needs to be optionally disabled in runtime for HW issue workaround, FW development and some evaluation works on system resource and performance. This patch makes two changes: (1) moves init of tag-allocation bits(ATA/ATA0) to cpu_enable_mte() as not cached in TLB. (2) allows ID_AA64PFR1_EL1.MTE to be overridden on its shadow value by giving "arm64.nomte" on cmdline. When the feature value is off, ATA and TCF will not set and the related functionalities are accordingly suppressed. Suggested-by: Catalin Marinas <[email protected]> Suggested-by: Marc Zyngier <[email protected]> Suggested-by: Suzuki K Poulose <[email protected]> Signed-off-by: Yee Lee <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent 7672150 commit 7a062ce

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,9 @@
380380
arm64.nopauth [ARM64] Unconditionally disable Pointer Authentication
381381
support
382382

383+
arm64.nomte [ARM64] Unconditionally disable Memory Tagging Extension
384+
support
385+
383386
ataflop= [HW,M68k]
384387

385388
atarimouse= [HW,MOUSE] Atari Mouse

arch/arm64/include/asm/sysreg.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -699,8 +699,7 @@
699699
(SCTLR_ELx_M | SCTLR_ELx_C | SCTLR_ELx_SA | SCTLR_EL1_SA0 | \
700700
SCTLR_EL1_SED | SCTLR_ELx_I | SCTLR_EL1_DZE | SCTLR_EL1_UCT | \
701701
SCTLR_EL1_NTWE | SCTLR_ELx_IESB | SCTLR_EL1_SPAN | SCTLR_ELx_ITFSB | \
702-
SCTLR_ELx_ATA | SCTLR_EL1_ATA0 | ENDIAN_SET_EL1 | SCTLR_EL1_UCI | \
703-
SCTLR_EL1_EPAN | SCTLR_EL1_RES1)
702+
ENDIAN_SET_EL1 | SCTLR_EL1_UCI | SCTLR_EL1_EPAN | SCTLR_EL1_RES1)
704703

705704
/* MAIR_ELx memory attributes (used by Linux) */
706705
#define MAIR_ATTR_DEVICE_nGnRnE UL(0x00)

arch/arm64/kernel/cpufeature.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1843,6 +1843,9 @@ static void bti_enable(const struct arm64_cpu_capabilities *__unused)
18431843
#ifdef CONFIG_ARM64_MTE
18441844
static void cpu_enable_mte(struct arm64_cpu_capabilities const *cap)
18451845
{
1846+
sysreg_clear_set(sctlr_el1, 0, SCTLR_ELx_ATA | SCTLR_EL1_ATA0);
1847+
isb();
1848+
18461849
/*
18471850
* Clear the tags in the zero page. This needs to be done via the
18481851
* linear map which has the Tagged attribute.

arch/arm64/kernel/idreg-override.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ static const struct ftr_set_desc pfr1 __initconst = {
5454
.override = &id_aa64pfr1_override,
5555
.fields = {
5656
{ "bt", ID_AA64PFR1_BT_SHIFT },
57+
{ "mte", ID_AA64PFR1_MTE_SHIFT},
5758
{}
5859
},
5960
};
@@ -100,6 +101,7 @@ static const struct {
100101
{ "arm64.nopauth",
101102
"id_aa64isar1.gpi=0 id_aa64isar1.gpa=0 "
102103
"id_aa64isar1.api=0 id_aa64isar1.apa=0" },
104+
{ "arm64.nomte", "id_aa64pfr1.mte=0" },
103105
{ "nokaslr", "kaslr.disabled=1" },
104106
};
105107

0 commit comments

Comments
 (0)