diff options
author | Dimitris Papastamos <dimitris.papastamos@arm.com> | 2018-03-12 14:47:09 +0000 |
---|---|---|
committer | Dimitris Papastamos <dimitris.papastamos@arm.com> | 2018-03-14 11:19:53 +0000 |
commit | a205a56ea891c354c642713701075fec28906c40 (patch) | |
tree | 1628809d59852289308473302ff04414388b8737 /services/arm_arch_svc | |
parent | 3991a6a49f3cf8d0b30a2800428e60454e2f92dd (diff) |
Fixup `SMCCC_ARCH_FEATURES` semantics
When querying `SMCCC_ARCH_WORKAROUND_1` through `SMCCC_ARCH_FEATURES`,
return either:
* -1 to indicate the PE on which `SMCCC_ARCH_FEATURES` is called
requires firmware mitigation for CVE-2017-5715 but the mitigation
is not compiled in.
* 0 to indicate that firmware mitigation is required, or
* 1 to indicate that no firmware mitigation is required.
This patch complies with v1.2 of the firmware interfaces
specification (ARM DEN 0070A).
Change-Id: Ibc32d6620efdac6c340758ec502d95554a55f02a
Signed-off-by: Dimitris Papastamos <dimitris.papastamos@arm.com>
Diffstat (limited to 'services/arm_arch_svc')
-rw-r--r-- | services/arm_arch_svc/arm_arch_svc_setup.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/services/arm_arch_svc/arm_arch_svc_setup.c b/services/arm_arch_svc/arm_arch_svc_setup.c index a809c429..f75a737e 100644 --- a/services/arm_arch_svc/arm_arch_svc_setup.c +++ b/services/arm_arch_svc/arm_arch_svc_setup.c @@ -6,9 +6,11 @@ #include <arm_arch_svc.h> #include <debug.h> +#include <errata_report.h> #include <runtime_svc.h> #include <smcc.h> #include <smcc_helpers.h> +#include <workaround_cve_2017_5715.h> static int32_t smccc_version(void) { @@ -17,14 +19,19 @@ static int32_t smccc_version(void) static int32_t smccc_arch_features(u_register_t arg) { + int ret; + switch (arg) { case SMCCC_VERSION: case SMCCC_ARCH_FEATURES: return SMC_OK; -#if WORKAROUND_CVE_2017_5715 case SMCCC_ARCH_WORKAROUND_1: - return SMC_OK; -#endif + ret = check_workaround_cve_2017_5715(); + if (ret == ERRATA_APPLIES) + return 0; + else if (ret == ERRATA_NOT_APPLIES) + return 1; + return -1; /* ERRATA_MISSING */ default: return SMC_UNK; } |