mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-08-20 05:51:01 +02:00
Enforce full include path for includes. Deprecate old paths. The following folders inside include/lib have been left unchanged: - include/lib/cpus/${ARCH} - include/lib/el3_runtime/${ARCH} The reason for this change is that having a global namespace for includes isn't a good idea. It defeats one of the advantages of having folders and it introduces problems that are sometimes subtle (because you may not know the header you are actually including if there are two of them). For example, this patch had to be created because two headers were called the same way: e0ea0928d5b7 ("Fix gpio includes of mt8173 platform to avoid collision."). More recently, this patch has had similar problems: 46f9b2c3a282 ("drivers: add tzc380 support"). This problem was introduced in commit 4ecca33988b9 ("Move include and source files to logical locations"). At that time, there weren't too many headers so it wasn't a real issue. However, time has shown that this creates problems. Platforms that want to preserve the way they include headers may add the removed paths to PLAT_INCLUDES, but this is discouraged. Change-Id: I39dc53ed98f9e297a5966e723d1936d6ccf2fc8f Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
133 lines
3.1 KiB
C
133 lines
3.1 KiB
C
/*
|
|
* Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
|
|
#include <common/debug.h>
|
|
#include <common/runtime_svc.h>
|
|
#include <lib/cpus/errata_report.h>
|
|
#include <lib/cpus/wa_cve_2017_5715.h>
|
|
#include <lib/cpus/wa_cve_2018_3639.h>
|
|
#include <lib/smccc.h>
|
|
#include <services/arm_arch_svc.h>
|
|
#include <smccc_helpers.h>
|
|
|
|
static int32_t smccc_version(void)
|
|
{
|
|
return MAKE_SMCCC_VERSION(SMCCC_MAJOR_VERSION, SMCCC_MINOR_VERSION);
|
|
}
|
|
|
|
static int32_t smccc_arch_features(u_register_t arg)
|
|
{
|
|
switch (arg) {
|
|
case SMCCC_VERSION:
|
|
case SMCCC_ARCH_FEATURES:
|
|
return SMC_OK;
|
|
#if WORKAROUND_CVE_2017_5715
|
|
case SMCCC_ARCH_WORKAROUND_1:
|
|
if (check_wa_cve_2017_5715() == ERRATA_NOT_APPLIES)
|
|
return 1;
|
|
return 0; /* ERRATA_APPLIES || ERRATA_MISSING */
|
|
#endif
|
|
|
|
#if WORKAROUND_CVE_2018_3639
|
|
case SMCCC_ARCH_WORKAROUND_2: {
|
|
#if DYNAMIC_WORKAROUND_CVE_2018_3639
|
|
unsigned long long ssbs;
|
|
|
|
/*
|
|
* Firmware doesn't have to carry out dynamic workaround if the
|
|
* PE implements architectural Speculation Store Bypass Safe
|
|
* (SSBS) feature.
|
|
*/
|
|
ssbs = (read_id_aa64pfr0_el1() >> ID_AA64PFR1_EL1_SSBS_SHIFT) &
|
|
ID_AA64PFR1_EL1_SSBS_MASK;
|
|
|
|
/*
|
|
* If architectural SSBS is available on this PE, no firmware
|
|
* mitigation via SMCCC_ARCH_WORKAROUND_2 is required.
|
|
*/
|
|
if (ssbs != SSBS_UNAVAILABLE)
|
|
return 1;
|
|
|
|
/*
|
|
* On a platform where at least one CPU requires
|
|
* dynamic mitigation but others are either unaffected
|
|
* or permanently mitigated, report the latter as not
|
|
* needing dynamic mitigation.
|
|
*/
|
|
if (wa_cve_2018_3639_get_disable_ptr() == NULL)
|
|
return 1;
|
|
/*
|
|
* If we get here, this CPU requires dynamic mitigation
|
|
* so report it as such.
|
|
*/
|
|
return 0;
|
|
#else
|
|
/* Either the CPUs are unaffected or permanently mitigated */
|
|
return SMCCC_ARCH_NOT_REQUIRED;
|
|
#endif
|
|
}
|
|
#endif
|
|
|
|
/* Fallthrough */
|
|
|
|
default:
|
|
return SMC_UNK;
|
|
}
|
|
}
|
|
|
|
/*
|
|
* Top-level Arm Architectural Service SMC handler.
|
|
*/
|
|
static uintptr_t arm_arch_svc_smc_handler(uint32_t smc_fid,
|
|
u_register_t x1,
|
|
u_register_t x2,
|
|
u_register_t x3,
|
|
u_register_t x4,
|
|
void *cookie,
|
|
void *handle,
|
|
u_register_t flags)
|
|
{
|
|
switch (smc_fid) {
|
|
case SMCCC_VERSION:
|
|
SMC_RET1(handle, smccc_version());
|
|
case SMCCC_ARCH_FEATURES:
|
|
SMC_RET1(handle, smccc_arch_features(x1));
|
|
#if WORKAROUND_CVE_2017_5715
|
|
case SMCCC_ARCH_WORKAROUND_1:
|
|
/*
|
|
* The workaround has already been applied on affected PEs
|
|
* during entry to EL3. On unaffected PEs, this function
|
|
* has no effect.
|
|
*/
|
|
SMC_RET0(handle);
|
|
#endif
|
|
#if WORKAROUND_CVE_2018_3639
|
|
case SMCCC_ARCH_WORKAROUND_2:
|
|
/*
|
|
* The workaround has already been applied on affected PEs
|
|
* requiring dynamic mitigation during entry to EL3.
|
|
* On unaffected or statically mitigated PEs, this function
|
|
* has no effect.
|
|
*/
|
|
SMC_RET0(handle);
|
|
#endif
|
|
default:
|
|
WARN("Unimplemented Arm Architecture Service Call: 0x%x \n",
|
|
smc_fid);
|
|
SMC_RET1(handle, SMC_UNK);
|
|
}
|
|
}
|
|
|
|
/* Register Standard Service Calls as runtime service */
|
|
DECLARE_RT_SVC(
|
|
arm_arch_svc,
|
|
OEN_ARM_START,
|
|
OEN_ARM_END,
|
|
SMC_TYPE_FAST,
|
|
NULL,
|
|
arm_arch_svc_smc_handler
|
|
);
|