Refactor ARMv8.3 Pointer Authentication support code
[project/bcm63xx/atf.git] / bl31 / bl31_main.c
index 856ea9f62bd48da2e39c60db8bfb5e690d95e61f..92a2027dd0e2603e0ba39809470c27118c5b5dfb 100644 (file)
@@ -8,6 +8,7 @@
 #include <string.h>
 
 #include <arch.h>
+#include <arch_features.h>
 #include <arch_helpers.h>
 #include <bl31/bl31.h>
 #include <bl31/ehf.h>
@@ -72,16 +73,16 @@ void bl31_setup(u_register_t arg0, u_register_t arg1, u_register_t arg2,
        /* Perform early platform-specific setup */
        bl31_early_platform_setup2(arg0, arg1, arg2, arg3);
 
-       /*
-        * Update pointer authentication key before the MMU is enabled. It is
-        * saved in the rodata section, that can be writen before enabling the
-        * MMU. This function must be called after the console is initialized
-        * in the early platform setup.
-        */
-       bl_handle_pauth();
-
        /* Perform late platform-specific setup */
        bl31_plat_arch_setup();
+
+#if CTX_INCLUDE_PAUTH_REGS
+       /*
+        * Assert that the ARMv8.3-PAuth registers are present or an access
+        * fault will be triggered when they are being saved or restored.
+        */
+       assert(is_armv8_3_pauth_present());
+#endif /* CTX_INCLUDE_PAUTH_REGS */
 }
 
 /*******************************************************************************