feat(build): pass cflags to the linker when LTO is enabledUsually, both compiling and linking happen by calling the top levelgcc/clang binary. Also, both compilers quite specifically tell us topa
feat(build): pass cflags to the linker when LTO is enabledUsually, both compiling and linking happen by calling the top levelgcc/clang binary. Also, both compilers quite specifically tell us topass the same flags to the compilation and linking stages when we enableLTO. This is crucial for things like the undefined behaviour sanitiser.Anecdotally, in working on this, there have been a fair few errors thatthe compiler has only been able to catch due to warning flags beingpassed to the linker and building with LTO.This patch puts the contents of TF_CFLAGS into TF_LDFLAGS when LTO isenabled. This is easier said than done, however, as we support buildingwith clang and linking with gcc (or vice versa), so CFLAGS that arediscovered for one will not work for the other. This patch works aroundthis by splitting all flags into a per-compiler variable. Then CFLAGSand LDFLAGS get the contents of the correct one.Some notable side effects: CPPFLAGS and TF_CFLAGS_$(ARCH) become emptyand are removed, although expanding them is kept as platforms set them.Some flags become duplicate and are removed form TF_LDFLAGS (eg -O1).The errata (--fix) flags are kept as-is but moved to cpu-ops.mk forconsistency. This is because they currently don't work with LTO and willbe addressed in a later patch.Finally, ERROR_DEPRECATED's flags are also identical on all compilers sodon't maintain a difference.Change-Id: I3630729ee5f474c09d4722cd0ede6845e1725d95Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
show more ...
feat(cpufeat): enable FEAT_PAuth to FEAT_STATE_CHECKEDFEAT_PAuth is the second to last feature to be a boolean choice - it'seither unconditionally compiled in and must be present in hardware orit
feat(cpufeat): enable FEAT_PAuth to FEAT_STATE_CHECKEDFEAT_PAuth is the second to last feature to be a boolean choice - it'seither unconditionally compiled in and must be present in hardware orit's not compiled in. FEAT_PAuth is architected to be backwardscompatible - a subset of the branch guarding instructions (pacia/autia)execute as NOPs when PAuth is not present. That subset is used with`-mbranch-protection=standard` and -march pre-8.3. This patch adds thenecessary logic to also check accesses of the non-backward compatibleregisters and allow a fully checked implementation.Note that a checked support requires -march to be pre 8.3, as otherwisethe compiler will include branch protection instructions that are notNOPs without PAuth (eg retaa) which cannot be checked.Change-Id: Id942c20cae9d15d25b3d72b8161333642574ddaaSigned-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
fix(debug): decouple "get_el_str()" from backtraceget_el_str() was implemented under ENABLE_BACKTRACE macro but beingused at generic places too, this causes multiple definition of thisfunction.R
fix(debug): decouple "get_el_str()" from backtraceget_el_str() was implemented under ENABLE_BACKTRACE macro but beingused at generic places too, this causes multiple definition of thisfunction.Remove duplicate definition of this function and move it out ofbacktrace scope. Also, this patch fixes a small bug where in defaultcase S-EL1 is returned which ideally should be EL1, as there is nonotion of security state in EL string.Signed-off-by: Manish Pandey <manish.pandey2@arm.com>Change-Id: Ib186ea03b776e2478eff556065449ebd478c3538
fix: backtrace stack unwind misses lr adjustmentWhen pointer authentication is used the frame record return addressincludes the pointer authentication code hence it must be masked outwhen willing
fix: backtrace stack unwind misses lr adjustmentWhen pointer authentication is used the frame record return addressincludes the pointer authentication code hence it must be masked outwhen willing to compare the pointer value with another address orchecking its validity. The stack unwind function missed one case ofadjusting the return address leading to a misinterpreted corrupted stackframe error message.Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>Change-Id: I435140937d5fd0f43da27c77d96056b7606d87e9
Don't return error information from console_flushAnd from crash_console_flush.We ignore the error information return by console_flush in _every_place where we call it, and casting the return typ
Don't return error information from console_flushAnd from crash_console_flush.We ignore the error information return by console_flush in _every_place where we call it, and casting the return type to void does notwork around the MISRA violation that this causes. Instead, we collectthe error information from the driver (to avoid changing that API), anddon't return it to the caller.Change-Id: I1e35afe01764d5c8f0efd04f8949d333ffb688c1Signed-off-by: Jimmy Brisson <jimmy.brisson@arm.com>
Add wrapper for AT instructionIn case of AT speculative workaround applied, page table walkis disabled for lower ELs (EL1 and EL0) in EL3.Hence added a wrapper function which temporarily enables
Add wrapper for AT instructionIn case of AT speculative workaround applied, page table walkis disabled for lower ELs (EL1 and EL0) in EL3.Hence added a wrapper function which temporarily enables pagetable walk to execute AT instruction for lower ELs and thendisables page table walk.Execute AT instructions directly for lower ELs (EL1 and EL0)assuming page table walk is enabled always when AT speculativeworkaround is not applied.Change-Id: I4ad4c0bcbb761448af257e9f72ae979473c0dde8Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
Fix crash dump for lower ELThis patch provides a fix for incorrect crash dump data forlower EL when TF-A is built with HANDLE_EA_EL3_FIRST=1 optionwhich enables routing of External Aborts and SEr
Fix crash dump for lower ELThis patch provides a fix for incorrect crash dump data forlower EL when TF-A is built with HANDLE_EA_EL3_FIRST=1 optionwhich enables routing of External Aborts and SErrors to EL3.Change-Id: I9d5e6775e6aad21db5b78362da6c3a3d897df977Signed-off-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Make PAC demangling more genericAt the moment, address demangling is only used by the backtracefunctionality. However, at some point, other parts of the TF-Acodebase may want to use it.The 'dema
Make PAC demangling more genericAt the moment, address demangling is only used by the backtracefunctionality. However, at some point, other parts of the TF-Acodebase may want to use it.The 'demangle_address' function is replaced with a single XPACIinstruction which is also added in 'do_crash_reporting()'.Signed-off-by: Alexei Fedorov <Alexei.Fedorov@arm.com>Change-Id: I4424dcd54d5bf0a5f9b2a0a84c4e565eec7329ec
Switch AARCH32/AARCH64 to __aarch64__NOTE: AARCH32/AARCH64 macros are now deprecated in favor of __aarch64__.All common C compilers pre-define the same macros to signal whicharchitecture the cod
Switch AARCH32/AARCH64 to __aarch64__NOTE: AARCH32/AARCH64 macros are now deprecated in favor of __aarch64__.All common C compilers pre-define the same macros to signal whicharchitecture the code is being compiled for: __arm__ for AArch32 (orearlier versions) and __aarch64__ for AArch64. There's no need for TF-Ato define its own custom macros for this. In order to unify code withthe export headers (which use __aarch64__ to avoid another dependency),let's deprecate the AARCH32 and AARCH64 macros and switch the code baseover to the pre-defined standard macro. (Since it is somewhatunintuitive that __arm__ only means AArch32, let's standardize on onlyusing __aarch64__.)Change-Id: Ic77de4b052297d77f38fc95f95f65a8ee70cf200Signed-off-by: Julius Werner <jwerner@chromium.org>
backtrace: Strip PAC field when PAUTH is enabledWhen pointer authentication is enabled, the LR value saved on the stackcontains a Pointer Authentication Code (PAC). It must be stripped toretrieve
backtrace: Strip PAC field when PAUTH is enabledWhen pointer authentication is enabled, the LR value saved on the stackcontains a Pointer Authentication Code (PAC). It must be stripped toretrieve the return address.The PAC field is stored on the high bits of the address and defined as:- PAC field = Xn[54:bottom_PAC_bit], when address tagging is used.- PAC field = Xn[63:56, 54:bottom_PAC_bit], without address tagging.With bottom_PAC_bit = 64 - TCR_ELx.TnSZChange-Id: I21d804e58200dfeca1da4c2554690bed5d191936Signed-off-by: Louis Mayencourt <louis.mayencourt@arm.com>
Correct typographical errorsCorrects typos in core code, documentation files, drivers, Armplatforms and services.None of the corrections affect code; changes are limited to commentsand other do
Correct typographical errorsCorrects typos in core code, documentation files, drivers, Armplatforms and services.None of the corrections affect code; changes are limited to commentsand other documentation.Change-Id: I5c1027b06ef149864f315ccc0ea473e2a16bfd1dSigned-off-by: Paul Beesley <paul.beesley@arm.com>
Sanitise includes across codebaseEnforce full include path for includes. Deprecate old paths.The following folders inside include/lib have been left unchanged:- include/lib/cpus/${ARCH}- inclu
Sanitise includes across codebaseEnforce 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 forincludes isn't a good idea. It defeats one of the advantages of havingfolders and it introduces problems that are sometimes subtle (becauseyou may not know the header you are actually including if there are twoof them).For example, this patch had to be created because two headers werecalled the same way: e0ea0928d5b7 ("Fix gpio includes of mt8173 platformto avoid collision."). More recently, this patch has had similarproblems: 46f9b2c3a282 ("drivers: add tzc380 support").This problem was introduced in commit 4ecca33988b9 ("Move include andsource files to logical locations"). At that time, there weren't toomany headers so it wasn't a real issue. However, time has shown thatthis creates problems.Platforms that want to preserve the way they include headers may add theremoved paths to PLAT_INCLUDES, but this is discouraged.Change-Id: I39dc53ed98f9e297a5966e723d1936d6ccf2fc8fSigned-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
backtrace: Extract rules from root MakefileIt's better to have them in a separate file instead of having them spreadacross the Makefile. This is what the stack protector is already doing.Change-
backtrace: Extract rules from root MakefileIt's better to have them in a separate file instead of having them spreadacross the Makefile. This is what the stack protector is already doing.Change-Id: Id30742c0af10de5ea6d10674ca25bf52b0f2b262Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>