ANDROID: arm64: Wrap MPAM setup with a config option

As it turns out, there are broken firmwares out there, and an apparent
need to turn MPAM off until the firmware can be fixed.

Introduce the ARM64_MPAM config option, wrap the MPAM setup with it,
and set it as default for GKI. Non-GKI uses with broken firmwares can
have their own config fragments to deal with it.

The config option text is lifted from James Morse's git tree.

Bug: 228613614
Signed-off-by: Marc Zyngier <mzyngier@google.com>
Change-Id: Ib782aab89c826ea96dbf9ae26c16d1a4a61c41fb
This commit is contained in:
Marc Zyngier
2022-04-14 09:01:42 +00:00
parent 53b9568a1c
commit 5f852449e8
3 changed files with 18 additions and 0 deletions

View File

@@ -1688,6 +1688,21 @@ config ARM64_TLB_RANGE
The feature introduces new assembly instructions, and they were
support when binutils >= 2.30.
config ARM64_MPAM
bool "Enable support for MPAM"
help
Memory Partitioning and Monitoring is an optional extension
that allows the CPUs to mark load and store transactions with
labels for partition-id and performance-monitoring-group.
System components, such as the caches, can use the partition-id
to apply a performance policy. MPAM monitors can use the
partition-id and performance-monitoring-group to measure the
cache occupancy or data throughput.
Use of this extension requires CPU support, support in the
memory system components (MSC), and a description from firmware
of where the MSC are in the address space.
endmenu
menu "ARMv8.5 architectural features"

View File

@@ -60,6 +60,7 @@ CONFIG_ARMV8_DEPRECATED=y
CONFIG_SWP_EMULATION=y
CONFIG_CP15_BARRIER_EMULATION=y
CONFIG_SETEND_EMULATION=y
CONFIG_ARM64_MPAM=y
CONFIG_RANDOMIZE_BASE=y
# CONFIG_RANDOMIZE_MODULE_REGION_FULL is not set
CONFIG_CMDLINE="stack_depot_disable=on kasan.stacktrace=off kvm-arm.mode=protected cgroup_disable=pressure"

View File

@@ -178,6 +178,7 @@
.endm
.macro __init_el2_mpam
#ifdef CONFIG_ARM64_MPAM
/* Memory Partioning And Monitoring: disable EL2 traps */
mrs x1, id_aa64pfr0_el1
ubfx x0, x1, #ID_AA64PFR0_MPAM_SHIFT, #4
@@ -189,6 +190,7 @@
tbz x0, #17, .Lskip_mpam_\@ // skip if no MPAMHCR reg
msr_s SYS_MPAMHCR_EL2, xzr // clear TRAP_MPAMIDR_EL1 -> EL2
.Lskip_mpam_\@:
#endif /* CONFIG_ARM64_MPAM */
.endm
/**