Explicitly disable the SPME bit in MDCR_EL3
authorPetre-Ionut Tudor <petre-ionut.tudor@arm.com>
Thu, 3 Oct 2019 16:09:08 +0000 (17:09 +0100)
committerPetre-Ionut Tudor <petre-ionut.tudor@arm.com>
Mon, 7 Oct 2019 10:50:07 +0000 (11:50 +0100)
Currently the MDCR_EL3 initialisation implicitly disables
MDCR_EL3.SPME by using mov_imm.

This patch makes the SPME bit more visible by explicitly
disabling it and documenting its use in different versions
of the architecture.

Signed-off-by: Petre-Ionut Tudor <petre-ionut.tudor@arm.com>
Change-Id: I221fdf314f01622f46ac5aa43388f59fa17a29b3

include/arch/aarch64/el3_common_macros.S

index ee20d5b2dcb05df231aa6b2e231eaa847d5e7bbe..378e827ce1c57427d00b477fa785151ebb14fab1 100644 (file)
         *  prohibited in Secure state. This bit is RES0 in versions of the
         *  architecture earlier than ARMv8.5, setting it to 1 doesn't have any
         *  effect on them.
+        *
+        * MDCR_EL3.SPME: Set to zero so that event counting by the programmable
+        *  counters PMEVCNTR<n>_EL0 is prohibited in Secure state. If ARMv8.2
+        *  Debug is not implemented this bit does not have any effect on the
+        *  counters unless there is support for the implementation defined
+        *  authentication interface ExternalSecureNoninvasiveDebugEnabled().
         * ---------------------------------------------------------------------
         */
        mov_imm x0, ((MDCR_EL3_RESET_VAL | MDCR_SDD_BIT | \
                      MDCR_SPD32(MDCR_SPD32_DISABLE) | MDCR_SCCD_BIT) & \
-                   ~(MDCR_TDOSA_BIT | MDCR_TDA_BIT | MDCR_TPM_BIT))
+                   ~(MDCR_SPME_BIT | MDCR_TDOSA_BIT | MDCR_TDA_BIT | \
+                     MDCR_TPM_BIT))
 
        msr     mdcr_el3, x0