[PATCH v3 2/6] arm64: cpufeature: discover CPU support for MPAM

Shameerali Kolothum Thodi shameerali.kolothum.thodi at huawei.com
Fri Jun 28 01:23:42 PDT 2024



> -----Original Message-----
> From: linux-arm-kernel <linux-arm-kernel-bounces at lists.infradead.org> On
> Behalf Of James Morse
> Sent: Thursday, March 21, 2024 4:57 PM
> To: linux-arm-kernel at lists.infradead.org; kvmarm at lists.linux.dev
> Cc: Marc Zyngier <maz at kernel.org>; Oliver Upton <oliver.upton at linux.dev>;
> Suzuki K Poulose <suzuki.poulose at arm.com>; yuzenghui
> <yuzenghui at huawei.com>; Catalin Marinas <catalin.marinas at arm.com>; Will
> Deacon <will at kernel.org>; Jing Zhang <jingzhangos at google.com>; James
> Morse <james.morse at arm.com>
> Subject: [PATCH v3 2/6] arm64: cpufeature: discover CPU support for MPAM
> 
> ARMv8.4 adds support for 'Memory Partitioning And Monitoring' (MPAM)
> which describes an interface to cache and bandwidth controls wherever
> they appear in the system.
> 
> Add support to detect MPAM. Like SVE, MPAM has an extra id register that
> describes some more properties, including the virtualisation support,
> which is optional. Detect this separately so we can detect
> mismatched/insane systems, but still use MPAM on the host even if the
> virtualisation support is missing.
> 
> MPAM needs enabling at the highest implemented exception level, otherwise
> the register accesses trap. The 'enabled' flag is accessible to lower
> exception levels, but its in a register that traps when MPAM isn't enabled.
> The cpufeature 'matches' hook is extended to test this on one of the
> CPUs, so that firmware can emulate MPAM as disabled if it is reserved
> for use by secure world.
> 
> Secondary CPUs that appear late could trip cpufeature's 'lower safe'
> behaviour after the MPAM properties have been advertised to user-space.
> Add a verify call to ensure late secondaries match the existing CPUs.
> 
> (If you have a boot failure that bisects here its likely your CPUs
> advertise MPAM in the id registers, but firmware failed to either enable
> or MPAM, or emulate the trap as if it were disabled)
> 
> Signed-off-by: James Morse <james.morse at arm.com>
> ---


> @@ -2852,6 +2912,15 @@ static const struct arm64_cpu_capabilities
> arm64_features[] = {
>  		ARM64_CPUID_FIELDS(ID_AA64MMFR0_EL1, TGRAN16,
> 52_BIT)
>  #endif
>  #endif
> +#endif
> +#ifdef CONFIG_ARM64_MPAM
> +	{
> +		.desc = "Memory Partitioning And Monitoring",
> +		.type = ARM64_CPUCAP_SYSTEM_FEATURE,
> +		.capability = ARM64_MPAM,
> +		.matches = test_has_mpam,
> +		.cpu_enable = cpu_enable_mpam,
> +		ARM64_CPUID_FIELDS(ID_AA64PFR0_EL1, MPAM, 1)
>  	},
>  #endif

This one gives me a compile error as seems to miss the" }," for the above
ARM64_VA_BITS_52. Please check.

Thanks,
Shameer



More information about the linux-arm-kernel mailing list