feat(mpam): add MPAM system registers access test
Added a test which reads MPAM system registers to ensure that
EL3 is giving permission to Non-secure EL2 to access these registers.
Change-Id: Ie701a19c9682df6d6aeaec086954e275afff1843
Signed-off-by: Arvind Ram Prakash <arvind.ramprakash@arm.com>
diff --git a/include/lib/aarch64/arch_features.h b/include/lib/aarch64/arch_features.h
index 85f8952..b6d0ce7 100644
--- a/include/lib/aarch64/arch_features.h
+++ b/include/lib/aarch64/arch_features.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020-2023, Arm Limited. All rights reserved.
+ * Copyright (c) 2020-2024, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -212,6 +212,19 @@
== ID_AA64PFR1_EL1_RNG_TRAP_SUPPORTED);
}
+static inline bool is_feat_mpam_supported(void)
+{
+ /*
+ * If the MPAM version retreived from the Processor Feature registers
+ * is a non-zero value, then MPAM is supported.
+ */
+
+ return (((((read_id_aa64pfr0_el1() >>
+ ID_AA64PFR0_MPAM_SHIFT) & ID_AA64PFR0_MPAM_MASK) << 4) |
+ ((read_id_aa64pfr1_el1() >>
+ ID_AA64PFR1_MPAM_FRAC_SHIFT) & ID_AA64PFR1_MPAM_FRAC_MASK)) != 0U);
+}
+
static inline unsigned int spe_get_version(void)
{
return (unsigned int)((read_id_aa64dfr0_el1() >> ID_AA64DFR0_PMS_SHIFT) &