mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-15 00:54:22 +00:00

The previous commit added the infrastructure to load and save ARMv8.3-PAuth registers during Non-secure <-> Secure world switches, but didn't actually enable pointer authentication in the firmware. This patch adds the functionality needed for platforms to provide authentication keys for the firmware, and a new option (ENABLE_PAUTH) to enable pointer authentication in the firmware itself. This option is disabled by default, and it requires CTX_INCLUDE_PAUTH_REGS to be enabled. Change-Id: I35127ec271e1198d43209044de39fa712ef202a5 Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
49 lines
1.2 KiB
C
49 lines
1.2 KiB
C
/*
|
|
* Copyright (c) 2019, Arm Limited. All rights reserved.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
|
|
#ifndef ARCH_FEATURES_H
|
|
#define ARCH_FEATURES_H
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <arch_helpers.h>
|
|
|
|
static inline bool is_armv7_gentimer_present(void)
|
|
{
|
|
/* The Generic Timer is always present in an ARMv8-A implementation */
|
|
return true;
|
|
}
|
|
|
|
static inline bool is_armv8_2_ttcnp_present(void)
|
|
{
|
|
return ((read_id_aa64mmfr2_el1() >> ID_AA64MMFR2_EL1_CNP_SHIFT) &
|
|
ID_AA64MMFR2_EL1_CNP_MASK) != 0U;
|
|
}
|
|
|
|
static inline bool is_armv8_3_pauth_present(void)
|
|
{
|
|
uint64_t mask = (ID_AA64ISAR1_GPI_MASK << ID_AA64ISAR1_GPI_SHIFT) |
|
|
(ID_AA64ISAR1_GPA_MASK << ID_AA64ISAR1_GPA_SHIFT) |
|
|
(ID_AA64ISAR1_API_MASK << ID_AA64ISAR1_API_SHIFT) |
|
|
(ID_AA64ISAR1_APA_MASK << ID_AA64ISAR1_APA_SHIFT);
|
|
|
|
/* If any of the fields is not zero, PAuth is present */
|
|
return (read_id_aa64isar1_el1() & mask) != 0U;
|
|
}
|
|
|
|
static inline bool is_armv8_3_pauth_api_present(void)
|
|
{
|
|
return ((read_id_aa64isar1_el1() >> ID_AA64ISAR1_API_SHIFT) &
|
|
ID_AA64ISAR1_API_MASK) != 0U;
|
|
}
|
|
|
|
static inline bool is_armv8_4_ttst_present(void)
|
|
{
|
|
return ((read_id_aa64mmfr2_el1() >> ID_AA64MMFR2_EL1_ST_SHIFT) &
|
|
ID_AA64MMFR2_EL1_ST_MASK) == 1U;
|
|
}
|
|
|
|
#endif /* ARCH_FEATURES_H */
|