12179 Commits

Author SHA1 Message Date
Lucas Stach
36be10861e feat(imx8mq): always set up console
This aligns the i.MX8MQ platform behaviour with the other i.MX8M*
platforms by always setting up the console UART.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Change-Id: I1279d9cb4feb6e789422b9844cab711b8daae74e
2022-12-13 11:08:37 +01:00
Lucas Stach
7698dbab96 feat(imx8mq): remove empty bl31_plat_runtime_setup
Having this empty definition is actively harmful, as it prevents the
default weak function to be used, which does a switch of the console
state.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Change-Id: I3b78e0c524c4907714036dba573a44d8f9c48b09
2022-12-13 11:08:33 +01:00
Lucas Stach
202737efda feat(imx8mq): make IMX_BOOT_UART_BASE configurable via build parameter
This aligns the i.MX8MQ build with the other i.MX8M platforms by
allowing to override the default IMX_BOOT_UART_BASE value via a make
parameter.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Change-Id: Iad9b844517209fc7d051c61767f71ac9fa2b55c7
2022-12-13 11:07:02 +01:00
Yann Gautier
6b3ca0a817 fix(st-crypto): remove platdata functions
The functions stm32_pka_get_platdata() and stm32_saes_get_platdata()
are not used. They can be removed as we always use DT to retrieve
the device configuration.
This issue was triggered by sparse tool or when enabling warning
-Wmissing-prototypes.

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Change-Id: I5cce9a0765144d694e8ddece37361ccbb85d1734
2022-12-13 10:54:14 +01:00
Yann Gautier
70a422ba83 fix(st-crypto): set get_plain_pk_from_asn1() static
The issue is triggered when enabling -Wmissing-prototypes warning:
plat/st/common/stm32mp_crypto_lib.c:81:5: warning:
 no previous prototype for 'get_plain_pk_from_asn1'
 [-Wmissing-prototypes]
   81 | int get_plain_pk_from_asn1(void *pk_ptr, unsigned int pk_len,
      |     ^~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Change-Id: Ia36bbaba6e187ab47c203ddf0d7d017b210545cf
2022-12-13 10:54:07 +01:00
Yann Gautier
6e55f9e2cd fix(stm32mp1): add missing platform.h include
This includes the functions definitions, and avoids sparse warnings:
plat/st/stm32mp1/plat_image_load.c:13:6: warning:
 symbol 'plat_flush_next_bl_params' was not declared.
 Should it be static?
plat/st/stm32mp1/plat_image_load.c:21:16: warning:
 symbol 'plat_get_bl_image_load_info' was not declared.
 Should it be static?
plat/st/stm32mp1/plat_image_load.c:29:13: warning:
 symbol 'plat_get_next_bl_params' was not declared.
 Should it be static?

The issue was also found when enabling -Wmissing-prototypes warning:
plat/st/stm32mp1/plat_image_load.c:13:6: error:
 no previous prototype for 'plat_flush_next_bl_params'
 [-Werror=missing-prototypes]
   13 | void plat_flush_next_bl_params(void)
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~
plat/st/stm32mp1/plat_image_load.c:21:17: error:
 no previous prototype for 'plat_get_bl_image_load_info'
 [-Werror=missing-prototypes]
   21 | bl_load_info_t *plat_get_bl_image_load_info(void)
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
plat/st/stm32mp1/plat_image_load.c:29:14: error:
 no previous prototype for 'plat_get_next_bl_params'
 [-Werror=missing-prototypes]
   29 | bl_params_t *plat_get_next_bl_params(void)
      |              ^~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Change-Id: I0bb3052f6efd888462eab2fd8f18862e7fbf02b9
2022-12-13 09:52:27 +01:00
Yann Gautier
d1d8a9bad0 fix(st): make metadata_block_spec static
This issue was triggered by sparse tool:
plat/st/common/stm32mp_fconf_io.c:31:17: warning:
 symbol 'metadata_block_spec' was not declared. Should it be static?

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Change-Id: I283d15792ed0e7ac5181e18aaf54010a0e61b370
2022-12-13 09:48:56 +01:00
Lauren Wehrmeister
abd6d7ea60 Merge changes from topic "full_dev_rsa_key" into integration
* changes:
  docs(arm): add ARM_ROTPK_LOCATION variant full key
  feat(arm): add ARM_ROTPK_LOCATION variant full key
2022-12-12 22:18:26 +01:00
Channagoud kadabi
78fbb0ec83 fix(gic): wrap cache enabled assert under plat_can_cmo
with reference to feature 04c730 (feat(cpus): make cache ops conditional),
booting with caches in debug recovery means SCTLR_C_BIT will be 0.
Wrap the assert for the d-cache enabled check in CONDITIONAL_CMO and
plat_can_cmo calls to allow booting with d-cache disabled.

Signed-off-by: Channagoud kadabi <kadabi@google.com>
Change-Id: I80153df493d1ec9e5e354c7c2e6a14322d22c446
2022-12-12 20:33:40 +02:00
Manish Pandey
96851eeb8d Merge changes from topic "fix_misra_st_drivers" into integration
* changes:
  fix(st-gpio): define shift as uint32_t
  fix(st-sdmmc): check transfer size before filling register
2022-12-12 17:03:23 +01:00
Manish Pandey
c781765e09 Merge "fix(st): include utils.h to solve compilation error" into integration 2022-12-12 16:58:58 +01:00
Yann Gautier
377846b65e fix(st): include utils.h to solve compilation error
If compiling with STM32MP13 with DECRYPTION_SUPPORT != none, there is
a compilation error:
plat/st/common/stm32mp_crypto_lib.c:
 In function 'plat_get_enc_key_info':
plat/st/common/stm32mp_crypto_lib.c:532:25:
 error: implicit declaration of function 'zeromem'
 [-Werror=implicit-function-declaration]
  532 |                         zeromem(key, *key_len);
      |                         ^~~~~~~

Adding #include <lib/utils.h> solves the error.

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Change-Id: I0a20c5632f0379612149333e69875369d4cfca15
2022-12-12 15:15:38 +01:00
Boyan Karatotev
291be198fa docs: describe the new warning levels
When -Wextra was added, the warning levels changed their meaning. Add a
description in the build option section and leave the security hardening
section as mostly a pointer to it.

Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
Change-Id: Iabf2f598d0bf3e865c9b991c5d44d2acb9572bd5
2022-12-12 11:29:10 +00:00
Joanna Farley
c0d68bbfbe Merge "fix(xilinx): use lib/smccc.h macros instead of trusty spd" into integration 2022-12-12 11:21:01 +01:00
Akshay Belsare
0ee07d796c fix(xilinx): use lib/smccc.h macros instead of trusty spd
There is no reason to use macros from trusty spd header and creating
dependency on it. Use directly macros from lib/smccc.h

Co-developed-by: Michal Simek <michal.simek@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Signed-off-by: Akshay Belsare <akshay.belsare@amd.com>
Change-Id: I7cf1f76a5358ffc297c914f41c437469f5a42411
2022-12-12 14:25:51 +05:30
laurenw-arm
9b1dad8bb5 docs(arm): add ARM_ROTPK_LOCATION variant full key
Updating documentation to reflect the new ARM_ROTPK_LOCATION variant of
the full ROTPK, as opposed to the hash of it.

Change-Id: I0f83c519bd607ef1270c7d30ee9bc55451ce4ae2
Signed-off-by: Lauren Wehrmeister <lauren.wehrmeister@arm.com>
2022-12-09 14:55:39 -06:00
laurenw-arm
5f899286ea feat(arm): add ARM_ROTPK_LOCATION variant full key
Add support for ARM_ROTPK_LOCATION=devel_full_dev_rsa_key, which
implements the scenario where the platform provides the full ROTPK, as
opposed to the hash of it. This returns a 2kB development RSA key
embedded into the firmware.

The motivation for this patch is to extend our test coverage in the CI.
Right now, the authentication framework allows platforms to return
either the full ROTPK or a hash of it (*). However, the FVP platform
only supports returning a hash currently so we cannot easily exercise
the full key scenario. This patch adds that capability.

(*) Or even no key at all if it's not deployed on the platform yet, as
is typically the case on pre-production/developement platforms.

Signed-off-by: Lauren Wehrmeister <lauren.wehrmeister@arm.com>
Change-Id: Ie869cca1082410e63894e2b7dea2d31155684105
2022-12-09 14:54:50 -06:00
Manish Pandey
25eb64726d Merge changes from topic "fix_misra_st_drivers" into integration
* changes:
  fix(st-clock): avoid arithmetics on pointers
  fix(st-clock): give the size for parent_mp13 and dividers_mp13 tables
  fix(st-clock): remove useless switch
  fix(st-clock): use Boolean type for tests
  fix(st-regulator): use Boolean type for tests
  fix(st-regulator): enclose macro parameters in parentheses
  fix(st-regulator): rework for_each_*rdev macros
  fix(st-regulator): explicitly check operators precedence
  fix(st-pmic): define pmic_regs table size
  fix(st-pmic): enclose macro parameter in parentheses
2022-12-09 13:04:05 +01:00
Manish Pandey
d6ce990789 Merge changes from topic "fix_misra_st_platform" into integration
* changes:
  fix(stm32mp1): rework DWL buffer cache invalidation
  fix(stm32mp1): add const for strings in stm32mp_get_soc_name()
  fix(st): use Boolean type for tests
  fix(st): rework secure-status check in fdt_get_status()
  fix(st): use indices when counting GPIOs in DT
  fix(st): add U suffix for unsigned numbers
  fix(st): explicitly check operators precedence
2022-12-09 12:54:13 +01:00
AlexeiFedorov
a0d5147b82 fix(gpt_rme): fix compilation error for gpt_rme.c
This patch fixes compilation error for gpt_init_l0_tables()
function in lib/gpt_rme/gpt_rme.c reported by GCC 13.0.0:

"gpt_rme/gpt_rme.c:765:5: error: conflicting types for
'gpt_init_l0_tables' due to enum/integer mismatch;
have 'int(unsigned int,  uintptr_t,  size_t)'
{aka 'int(unsigned int,  long unsigned int,  long unsigned int)'}"

Signed-off-by: AlexeiFedorov <Alexei.Fedorov@arm.com>
Change-Id: I38f28be290337e7d37d59b52cad7bde5b96b8d51
2022-12-09 11:27:14 +00:00
Manish V Badarkhe
557bc9dcf3 Merge changes from topic "tonnad01/gcc_warn_fix" into integration
* changes:
  fix(scmi): change function prototype to fix gcc error
  fix(rdn1edge): change variable type to fix gcc sign conversion error
2022-12-09 12:09:57 +01:00
Sandrine Bailleux
85bc0486a9 Merge "docs: add threat model for AP-RSS interface" into integration 2022-12-09 10:15:12 +01:00
Tamas Ban
c201d6e8d1 docs: add threat model for AP-RSS interface
Signed-off-by: Tamas Ban <tamas.ban@arm.com>
Change-Id: Ic818da12584503e1a96396c4b55a8db14ae7584a
2022-12-09 10:15:09 +01:00
Jens Wiklander
302f05354f feat(qemu): support el3 spmc
Introduce additional defines needed when compiling the QEMU platform
with SPMC at EL3.

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Change-Id: If6dbe41fa8761637e39579a1f6818dabc769c139
2022-12-08 15:40:25 +01:00
Jens Wiklander
555677fe81 feat(el3-spmc): make platform logical partition optional
Prior to this commit a logical platform specific partition is added when
compiling with SPMC at EL3. Not all platform need to add a logical
platform so make this optional.

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Change-Id: I3bdd2a91350330c1637e8d84765974bfb6b225d7
2022-12-08 15:40:25 +01:00
Jens Wiklander
36802e2c79 feat(qemu): support s-el2 spmc
Supports S-EL2 SPMC + S-EL1 SP on qemu. S-EL1 SPs packaged in .pkg files
are added to the FIP as blob with an UUID. BL2 parses TB_FW_CONFIG to
know which SP blobs to load into memory.

Co-developed-by: Olivier Deprez <olivier.deprez@arm.com>
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Change-Id: I4b61c4c048f31540d4f1ef9e05f0b12deb341e06
2022-12-08 15:40:03 +01:00
Jens Wiklander
25ae7ad187 feat(qemu): update abi between spmd and spmc
Updates the ABI between SPMD and the SPMC at S-EL1 so that the hard
coded SPMC manifest can be replaced by a proper manifest via TOS FW
Config. TOS FW Config is provided via QEMU_TOS_FW_CONFIG_DTS as a DTS
file when building.  The DTS is turned into a DTB which is added to the
FIP.

Note that this is an incompatible change and requires corresponding
change in OP-TEE ("core: sel1 spmc: boot abi update").

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Change-Id: Ibabe78ef50a24f775492854ce5ac54e4d471e369
2022-12-08 15:18:48 +01:00
Alexei Fedorov
a0f256b033 Merge "fix(rmmd): add missing padding to RMM Boot Manifest and initialize it" into integration 2022-12-08 14:53:50 +01:00
Tony K Nadackal
f0f2c90365 fix(scmi): change function prototype to fix gcc error
Change function prototype of plat_css_get_scmi_info() to fix the GCC
sign conversion error "comparison between signed and unsigned integer
expressions". Changing channel_id type to unsigned int since it can
never be a negative value.

Signed-off-by: Tony K Nadackal <tony.nadackal@arm.com>
Change-Id: I579b21497329db40897c10d86c8fc68e4877f3db
2022-12-08 13:42:25 +00:00
Tony K Nadackal
3a3e0e5371 fix(rdn1edge): change variable type to fix gcc sign conversion error
Change variable type in function bl31_platform_setup() to fix the GCC
sign conversion error "comparison between signed and unsigned integer
expressions".

Signed-off-by: Tony K Nadackal <tony.nadackal@arm.com>
Change-Id: Iff914bd7ad521883723c8fb34dd893412cce7fc5
2022-12-08 13:42:25 +00:00
Shruti Gupta
3354915fff fix(tsp): use verbose for power logs
TSP use verbose for cpu suspend resume logs

Signed-off-by: Shruti Gupta <shruti.gupta@arm.com>
Change-Id: Ic1d3706feec6361946dd5c0d2bea90a2dd7a2d02
2022-12-08 12:30:24 +00:00
Shruti Gupta
1543d17b98 fix(el3-spmc): fix coverity scan warnings
Validate emad descriptor integrity before accessing.
Check for NULL pointer access.

Signed-off-by: Shruti Gupta <shruti.gupta@arm.com>
Change-Id: Id4ff3e5d88be95ca8d067378e344947880ec984b
2022-12-08 12:30:10 +00:00
Marc Bonnici
def7590b3e fix(el3-spmc): improve bound check for descriptor
Ensure that there is sufficient space in the memory
descriptor to accommodate the size of the composite memory
struct as part of the descriptor.

Signed-off-by: Marc Bonnici <marc.bonnici@arm.com>
Change-Id: Iea646b144c59a2a1a171298cabb5f31040a8af31
2022-12-08 12:29:58 +00:00
Sandrine Bailleux
cb875fd31a Merge "docs: extend generic tf-a threat model" into integration 2022-12-08 09:29:49 +01:00
Bipin Ravi
1cfde82227 fix(cpus): workaround for Cortex-X2 erratum 2768515
Cortex-X2 erratum 2768515 is a Cat B erratum that applies to
all revisions <=r2p1 and is still open. The workaround is to
insert a dsb before the isb in the power down sequence.

SDEN documentation:
https://developer.arm.com/documentation/SDEN1775100/latest

Signed-off-by: Bipin Ravi <bipin.ravi@arm.com>
Change-Id: Ib02688f7b6dc7f6ec305e68e8895174f6fd577a0
2022-12-07 13:54:02 -06:00
Bipin Ravi
b87b02cf1d fix(cpus): workaround for Cortex-A710 erratum 2768515
Cortex-A710 erratum 2768515 is a Cat B erratum that applies to
all revisions <=r2p1 and is still open. The workaround is to
insert a dsb before the isb in the power down sequence.

SDEN documentation:
https://developer.arm.com/documentation/SDEN1775101/latest

Signed-off-by: Bipin Ravi <bipin.ravi@arm.com>
Change-Id: If17fe04d3fda0dba6b8aabdd837a1c53e1830ed5
2022-12-07 13:32:35 -06:00
Javier Almansa Sobrino
dc0ca64e4b fix(rmmd): add missing padding to RMM Boot Manifest and initialize it
This patch also:
     * Enforces the check of RES0 fields on EL3-RMM boot interface
       and manifest
     * Fixes a couple of nits on the EL3-RMM Boot Interface
       documentation.

Signed-off-by: Javier Almansa Sobrino <javier.almansasobrino@arm.com>
Change-Id: Idb9e38f9fcda2ba0655646a1e2c4fdbabd5cdc40
2022-12-07 18:54:28 +00:00
Yann Gautier
5d942ff196 fix(st-gpio): define shift as uint32_t
This corrects MISRA C2012-10.6:
The value of a composite expression shall not be assigned to an object
with wider essential type.
While at it change all the shift values to unsigned.

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Change-Id: Idf9915313af965db2106095df7cb48a84f50c519
2022-12-07 18:25:13 +01:00
Yann Gautier
029f81e04c fix(st-sdmmc): check transfer size before filling register
Fix MISRA C2012-10.3:
The value of an expression shall not be assigned to an object with
a narrower essential type or of a different essential type category.

Check buffer size is less than 4GB before casting the command argument.

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Change-Id: Iac1afcfe905c99b22cb39dc4104d351b0e647e5d
2022-12-07 18:25:13 +01:00
Yann Gautier
127ed0008e fix(stm32mp1): rework DWL buffer cache invalidation
As the default part do nothing, all the code managing DWL buffer cache
invalidation can be under programmer flags.
This avoids running unneeded code if the flags are not enabled, and
corrects MISRA C2012-16.6:
Every switch statement shall have at least two switch-clauses.

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Change-Id: I90d2951f9518509b3380295fb1a6ad6b9c5e551e
2022-12-07 14:20:01 +01:00
Yann Gautier
d7f5bed90e fix(stm32mp1): add const for strings in stm32mp_get_soc_name()
This corrects MISRA C2012-7.4:
A string literal shall not be assigned to an object unless the object's
type is "pointer to const-qualified char".

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Change-Id: I0c9f483dce9abd32647d5f5e2df72047cdd376dd
2022-12-07 14:20:01 +01:00
Yann Gautier
45d2d495e7 fix(st): use Boolean type for tests
This corrects MISRA C2012-14.4
The controlling expression of an if statement and the controlling
expression of an iteration-statement shall have essentially Boolean type.

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Change-Id: Ibed7b87b50959f03dc5550dfaffacafd1d79feee
2022-12-07 14:20:01 +01:00
Yann Gautier
0ebaf22289 fix(st): rework secure-status check in fdt_get_status()
This corrects MISRA C2012-15.7:
All if...else if constructs shall be terminated with an else statement.

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Change-Id: I3d893d0db0a448323270086923563147008c59b9
2022-12-07 14:20:01 +01:00
Yann Gautier
e7d75448b9 fix(st): use indices when counting GPIOs in DT
Fix MISRA C2012-18.4:
The +, -, += and -= operators should not be applied to an expression
of pointer type.
While at it, avoid computing twice the same value, by removing the
initial value computation outside the loop.

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Change-Id: Iabfe587bf72535541c94bfa341de10148aa58030
2022-12-07 14:20:01 +01:00
Yann Gautier
9c1aa1253c fix(st): add U suffix for unsigned numbers
This corrects MISRA c2012-7.2 violation:
A "u" or "U" suffix shall be applied to all integer constants that are
represented in an unsigned type.

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Change-Id: I92b394572528e7179a314bbad4a032fd65053861
2022-12-07 14:20:01 +01:00
Yann Gautier
56048fe215 fix(st): explicitly check operators precedence
This corrects the MISRA violation C2012-12.1:
The precedence of operators within expressions should be made explicit.
This is done either by adding parentheses, or by creating dedicated
variables to ease readability.

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Change-Id: I5e3f191ee38eca7ef634bd7542e615ab625271f6
2022-12-07 14:20:01 +01:00
Yann Gautier
4198fa1db7 fix(st-clock): avoid arithmetics on pointers
This corrects MISRA C2012-18.4:
The +, -, += and -= operators should not be applied to an expression
of pointer type.

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Change-Id: I9128f567a7c83d8e3381428b07e6bd785be2703b
2022-12-07 14:18:31 +01:00
Yann Gautier
ee21709e98 fix(st-clock): give the size for parent_mp13 and dividers_mp13 tables
This corrects MISRA C2012-9.5:
Where designated initializers are used to initialize an array object
the size of the array shall be specified explicitly.

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Change-Id: I4c331b0225af975fd022ffe9e5fd1d536ed59879
2022-12-07 14:18:31 +01:00
Yann Gautier
69a2e320b6 fix(st-clock): remove useless switch
This corrects MISRA C2012-16.6:
Every switch statement shall have at least two switch-clauses.
While at it, remove useless rate variable.

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Change-Id: I123784e7184dbf4146fd0d7faeffd6a0382fc6a1
2022-12-07 14:18:31 +01:00
Yann Gautier
c3ae7da02d fix(st-clock): use Boolean type for tests
This corrects MISRA C2012-14.4
The controlling expression of an if statement and the controlling
expression of an iteration-statement shall have essentially Boolean type.

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Change-Id: Id217d3da223caf75cd0439d7ce11c9efab87b4d2
2022-12-07 14:18:31 +01:00