Commit graph

1457 commits

Author SHA1 Message Date
Manish V Badarkhe
cda12ab9c7 Merge "fix(gicv3/multichip): fix overflow caused by left shift" into integration 2022-10-26 09:45:24 +02:00
Joanna Farley
4e7983b71d Merge "feat(ethos-n)!: add support for SMMU streams" into integration 2022-10-20 11:04:48 +02:00
Madhukar Pappireddy
c45d2febb9 Merge "fix(ufs): retry commands on unit attention" into integration 2022-10-12 15:56:24 +02:00
Vijayenthiran Subramaniam
6aea7624a0 fix(gicv3/multichip): fix overflow caused by left shift
When spi_id_max is 5119, the expression `(spi_id_max - 4096U + 1U >> 5)`
evaluates to 32 leading to undefined behavior when using it to left
shift 1. Fix this undefined behavior.

Reported-by coverity scan:
https://lists.trustedfirmware.org/archives/list/tf-a@lists.trustedfirmware.org/thread/RMB4U7COL6IONZWEGF2FWXOQ6FPDIT4U/

```
    large_shift: In expression 1 << (spi_id_max - 4096U + 1U >> 5), left
    shifting by more than 31 bits has undefined behavior. The shift
    amount, spi_id_max - 4096U + 1U >> 5, is as much as 32.
```

Signed-off-by: Vijayenthiran Subramaniam <vijayenthiran.subramaniam@arm.com>
Change-Id: I5e77a78b81a6d0367875e7ea432a82b6ba0e587c
2022-10-11 21:17:47 +05:30
Tamas Ban
2c8f2a9ad4 fix(rss): determine the size of sw_type in RSS mboot metadata
Without setting the correct size of sw_type the metadata won't
be propagated to RSS through rss_measured_boot_extend_measurement()
API.

Signed-off-by: Tamas Ban <tamas.ban@arm.com>
Change-Id: I4066d4762689c96ac2ac8e8b8db5d2b1f108b550
2022-10-07 11:32:48 +02:00
Tamas Ban
e3a6fb84f5 fix(rss): clear the message buffer
Clear the MHU message buffer to remove assets from memory.

Signed-off-by: Tamas Ban <tamas.ban@arm.com>
Change-Id: I730e7b044eaf0bf517532a12146e4f542949544e
2022-10-07 11:32:48 +02:00
Tamas Ban
6aa71542f3 fix(rss): remove dependency on attestation header
Platform must define the maximum size of the message
over MHU.

Signed-off-by: Tamas Ban <tamas.ban@arm.com>
Change-Id: I91a6c132c946f4465178910b8ea83544f562e837
2022-10-07 11:32:48 +02:00
Tamas Ban
70247ddbbd fix(rss): rename AP-RSS message size macro
Adding PLAT_* prefix to indicate that the
platform needs to provide this definition.

Signed-off-by: Tamas Ban <tamas.ban@arm.com>
Change-Id: I0bd02be405fd8b1e625bd2b82647ebb2b58265fc
2022-10-07 11:32:48 +02:00
Tamas Ban
13a129e8dc fix(rss): reduce input validation for measured boot
Remove an assert, which checks whether output buffer is
provided, because in measured boot there is no output.

Signed-off-by: Tamas Ban <tamas.ban@arm.com>
Change-Id: I08db9c2eea1da2d7120c9872ffbf8d8ee45c8e08
2022-10-07 11:32:48 +02:00
Manish V Badarkhe
b9b175086c refactor(measured-boot): split out a few Event Log driver functions
Reorganized a few Event Log functions into multiple functions so that
they can be used for the upcoming DRTM feature. This change mainly
implements below new functions -
1. event_log_buf_init - called by 'event_log_init' to initialise Event
   Log buffer
2. event_log_write_specid_event - called by 'event_log_fixed_header' to
   write specification id event to Event Log buffer
3. event_log_measure and event_log_record - called by
   'event_log_measure_and_record' to measure and record the measurement
   to the Event Log buffer

Change-Id: I1aabb57f79bead726fcf36d59839702cd6a3521d
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
2022-10-05 15:25:28 +01:00
Manish V Badarkhe
2bf4f27f58 refactor(crypto): change CRYPTO_SUPPORT flag to numeric
Updated CRYPTO_SUPPORT flag to numeric to provide below
supports -
1. CRYPTO_SUPPORT = 1 -> Authentication verification only
2. CRYPTO_SUPPORT = 2 -> Hash calculation only
3. CRYPTO_SUPPORT = 3 -> Authentication verification and
                         hash calculation

Change-Id: Ib34f31457a6c87d2356d736ad2d048dc787da56f
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
2022-10-05 15:25:28 +01:00
Manish V Badarkhe
8b653909b7 feat(mbedtls): update mbedTLS driver for DRTM support
Updated mbedTLS driver to include mbedTLS functions necessary for a
DRTM supported build.

Signed-off-by: Manish V Badarkhe <manish.badarkhe@arm.com>
Change-Id: If0120374a971519cf84f93e0c59e1a320a72cd97
2022-10-05 15:25:28 +01:00
Manish V Badarkhe
e43caf3890 feat(crypto): update crypto module for DRTM support
Updated crypto module to include crypto calls necessary for a
DRTM supported build.

Signed-off-by: Manish V Badarkhe <manish.badarkhe@arm.com>
Change-Id: I4f945997824393f46864b7fb7fd380308a025452
2022-10-05 15:25:28 +01:00
Sandrine Bailleux
2ddb5415ca Merge "fix(rss): fix build issues with comms protocol" into integration 2022-10-05 14:44:05 +02:00
Tamas Ban
ab545efddc fix(rss): fix build issues with comms protocol
Signed-off-by: Tamas Ban <tamas.ban@arm.com>
Change-Id: I77d2d3c5ac39a840b768f84f859d76b3965749aa
2022-10-05 13:37:35 +02:00
Mikael Olsson
b139f1cf97 feat(ethos-n)!: add support for SMMU streams
The Arm(R) Ethos(TM)-N NPU driver now supports configuring the SMMU
streams that the NPU shall use and will therefore no longer delegate
access to these registers to the non-secure world. In order for the
driver to support this, the device tree parsing has been updated to
support parsing the allocators used by the NPU and what SMMU stream that
is associated with each allocator.

To keep track of what NPU device each allocator is associated with, the
resulting config from the device tree parsing will now group the NPU
cores and allocators into their respective NPU device.

The SMC API has been changed to allow the caller to specify what
allocator the NPU shall be configured to use and the API version has
been bumped to indicate this change.

Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
Change-Id: I6ac43819133138614e3f55a014e93466fe3d5277
2022-10-04 15:15:04 +02:00
Claus Pedersen
e0b6826e44 refactor(console): move putchar() to console driver
Moving putchar() out of libc and adding a weak dummy
implementation in libc.

This is to remove libc's dependencies to the platform
driver.

Signed-off-by: Claus Pedersen <claustbp@google.com>
Change-Id: Ib7fefaec0babb783def614ea23521f482fa4a28a
2022-10-04 09:30:48 +02:00
Sandrine Bailleux
4348497ace build(rss): introduce rss_comms.mk makefile
Provide a new makefile as a convenience for platform makefiles to pull
in the list of source files and headers for the RSS communication
driver.

Change-Id: I188a1a8f4e77318cdc87c3155b280090c46ce813
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
2022-10-03 12:44:36 +02:00
Manish Pandey
e8f4ec1ab0 Merge changes from topic "st_uart_updates" into integration
* changes:
  feat(stm32mp1): add early console in SP_min
  feat(st): properly manage early console
  feat(st-uart): manage STM32MP_RECONFIGURE_CONSOLE
  docs(st): introduce STM32MP_RECONFIGURE_CONSOLE
  feat(st): add trace for early console
  fix(stm32mp1): enable crash console in FIQ handler
  feat(st-uart): add initialization with the device tree
  refactor(stm32mp1): move DT_UART_COMPAT in include file
  feat(stm32mp1): configure the serial boot load address
  fix(stm32mp1): update the FIP load address for serial boot
  refactor(st): configure baudrate for UART programmer
  refactor(st-uart): compute the over sampling dynamically
2022-10-03 11:58:07 +02:00
Anand Saminathan
3d309556c7 fix(ufs): retry commands on unit attention
Unit Attention Condition (UAC) gets set on a warm reset. Sending any
command (other than INQUIRY and REPORT LUNs) clears UAC, so its good to
add some retries when UAC is encountered

Signed-off-by: Anand Saminathan <anans@google.com>
Change-Id: Ia03b916d68565d0f3d25086b7f6d8c51d557b64f
2022-09-29 10:06:52 +02:00
Raef Coles
3125901923 feat(rss): add new comms protocols
The current comms protocol (where arguments and return data is embedded
into the MHU message) is now protocol v0. Protocol v1 embeds pointers
into the message, and has the RSS retrieve the data via DMA.

Change-Id: I08d7f09c4eaea673769fde9eee194447a99f1b78
Signed-off-by: Raef Coles <raef.coles@arm.com>
2022-09-28 13:38:02 +01:00
Yann Gautier
ea69dcdc73 feat(st-uart): manage STM32MP_RECONFIGURE_CONSOLE
If the flag STM32MP_RECONFIGURE_CONSOLE is set in BL32, the UART init
should be skipped if the UART clock is set to zero. This will be used
when configuring the default console, after an early console has been
configured.

Signed-off-by: Yann Gautier <yann.gautier@foss.st.com>
Change-Id: Icbc640c7bdd6342f9c3ec1586a0d0c64127b18b8
2022-09-23 15:17:43 +02:00
Patrick Delaunay
d99998f76e feat(st-uart): add initialization with the device tree
Add the pincontrol configuration and clock enable in UART driver
with information found in the device tree.

This patch avoids an issue on STM32MP13x platform because the UART
configuration is reset by the ROM code for UART serial boot
(STM32MP_UART_PROGRAMMER=1).

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Change-Id: I575fd0e1026b857059abcfd4a3166eb3a239e1fd
2022-09-23 15:17:43 +02:00
Patrick Delaunay
7d197d6281 refactor(stm32mp1): move DT_UART_COMPAT in include file
Move the definition of DT_UART_COMPAT in stm32mp1_def.h to be used
in several files.

Change-Id: I74d0350bcd971df9b15697f2b9ec04061d6a7656
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2022-09-23 15:17:43 +02:00
Patrick Delaunay
1258189515 refactor(st-uart): compute the over sampling dynamically
The parameter over_sampling of stm32_uart_init_s is not required
as it can be computed dynamically from clock rate of the serial
device and the requested baudrate.

Oversampling by 8 is allowed only for higher speed
(up to clock_rate / 8) to reduce the maximum receiver tolerance
to clock deviation.

This patch update the driver, the serial init struct and the
only user, the stm32cubeprogrammer over uart support.

Change-Id: I422731089730a288defeb7fa49886db65d0902b2
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2022-09-23 15:17:43 +02:00
Claus Pedersen
885e268304 refactor(libc): clean up dependencies in libc
- Removing platform dependencies from libc modules.
- Replacing panicking with actual error handling.
- Debug macros are included indirectly from assert.h. Removing
  "platform_def.h" from assert.h and adding "common/debug.h"
  where the macros are used.
- Removing hack for fixing PLAT_LOG_LEVEL_ASSERT to 40.
  Instead removing assert with expression, as this
  does not provide additional information.

Signed-off-by: Claus Pedersen <claustbp@google.com>
Change-Id: Icc201ea7b63c1277e423c1cfd13fd6816c2bc568
2022-09-22 13:23:49 +02:00
Joanna Farley
b86cbe10d2 Merge changes from topic "provencore-spd" into integration
* changes:
  feat(zynqmp): add support for ProvenCore
  feat(services): add a SPD for ProvenCore
  feat(gic): add APIs to raise NS and S-EL1 SGIs
2022-09-16 10:52:37 +02:00
Pranav Madhu
14a2892309 feat(scmi): send powerdown request to online secondary cpus
To initiate a reset or reboot, the nonsecure OS invokes the PSCI
SYSTEM_RESET function from any one core. As per the PSCI specification,
it is the responsibility of firmware to implement the system view of
the reset or reboot operation. For the platforms supported by CSS,
trigger the reset/reboot operation by sending an SGI to rest all CPUs
which are online. The CPUs respond to this interrupt by initiating its
powerdown sequence.

In addition to these changes, fix coding style issues that are not
directly related to the code being introduced in this patch.

Change-Id: I547253ee28ef7eefa78180d016893671a406bbfa
Signed-off-by: Pranav Madhu <pranav.madhu@arm.com>
2022-09-15 18:09:56 +05:30
Pranav Madhu
5cf9cc130a feat(scmi): set warm reboot entry point
Before issuing the system power down command, set the trusted mailbox
to 0. This will ensure that in the case of a warm/cold reset, the
primary CPU executes from the cold boot sequence, clearing any stale
jump address at this location.

Change-Id: I491ef5baf7a6728acd7e90e4558939ba77b8f9bf
Signed-off-by: Pranav Madhu <pranav.madhu@arm.com>
2022-09-15 18:09:56 +05:30
Manish Pandey
c6957b66e6 Merge "feat(gicv3): validate multichip data for GIC-700" into integration 2022-09-15 11:04:41 +02:00
Florian Lugou
dcb31ff790 feat(gic): add APIs to raise NS and S-EL1 SGIs
This patch adds two helper functions:
 - plat_ic_raise_ns_sgi to raise a NS SGI
 - plat_ic_raise_s_el1_sgi to raise a S-EL1 SGI

Signed-off-by: Florian Lugou <florian.lugou@provenrun.com>
Change-Id: I6f262dd1da1d77fec3f850eb74189e726b8e24da
2022-09-14 16:08:29 +02:00
Jayanth Dodderi Chidanand
ccf8392ccb fix(mmc): resolve the build error
Adding the header file plat/common/common_def.h to
resolve the "SIZE_128" undeclared identifier error.

Change-Id: I399edf4248776f6dd9f93e000b8672cadc71509d
Signed-off-by: Jayanth Dodderi Chidanand <jayanthdodderi.chidanand@arm.com>
2022-09-09 17:28:04 +01:00
Yann Gautier
f462c1249a feat(mmc): get boot partition size
The boot partition size of an eMMC is given in ext_csd register, at
offset 226 (BOOT_SIZE_MULT), which has to be multiplied by 128kB.
Add a helper function mmc_boot_part_size() to get this eMMC boot
partition size.

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Change-Id: I0e8e0fc9632f147fa1b1b3374accb78439025403
2022-09-07 09:36:48 +02:00
Lionel Debieve
f29c0702d2 feat(mtd): add platform function to allow using external buffer
The scratch buffer could be large. The new function allows
platform to defined its own external buffer or use the default
one.

Signed-off-by: Lionel Debieve <lionel.debieve@foss.st.com>
Change-Id: Ib7ab8ff19fa0a9cb06e364f058b91af58c3c471a
2022-08-30 09:20:20 +02:00
Madhukar Pappireddy
029f9b9c01 Merge changes I60b3b59e,Ibd5d22b4 into integration
* changes:
  fix(ufs): init utrlba/utrlbau with desc_base
  fix(ufs): fix slot base address computation
2022-08-29 15:35:35 +02:00
Madhukar Pappireddy
afbb10abdc Merge changes from topic "st-mmc-updates" into integration
* changes:
  feat(st-sdmmc2): define FIFO size
  feat(st-sdmmc2): make reset property optional
  feat(st): enable MMC_FLAG_SD_CMD6 for SD-cards
  feat(st-sdmmc2): manage CMD6
  feat(mmc): manage SD Switch Function for high speed mode
2022-08-17 16:33:10 +02:00
Madhukar Pappireddy
51d52c7923 Merge changes from topic "st-etzpc-cleanup" into integration
* changes:
  refactor(stm32mp15-fdts): remove ETZPC status
  refactor(st-drivers): do not rely on DT in etzpc_init
2022-08-17 16:32:55 +02:00
Yann Gautier
b46f74d4e6 feat(st-sdmmc2): define FIFO size
Instead of using hard-coded values in stm32_sdmmc2_read() function,
use a defined SDMMC_FIFO_SIZE, which is 64 on STM32MP1.

Signed-off-by: Yann Gautier <yann.gautier@foss.st.com>
Change-Id: I1ace0a28fbddae474379f0187371b9c360ceb7b3
2022-08-16 15:58:22 +02:00
Yann Gautier
8324b16cd5 feat(st-sdmmc2): make reset property optional
Although not recommended, the reset property could be made optional.
This way the driver will probe even if no reset property is provided
in an sdmmc node in DT. This reset is already optional in Linux.

Signed-off-by: Yann Gautier <yann.gautier@foss.st.com>
Change-Id: I6e63ff00118d9497f505d6379982334dd62686ca
2022-08-16 15:58:22 +02:00
Yann Gautier
3deebd4ccf feat(st-sdmmc2): manage CMD6
For SD-cards, CMD6 is used to switch functions, like setting high speed
mode. As it has another meaning for eMMC, and may not work on standard
capacity SD-cards, it must be checked with MMC_IS_SD_HC flag.
As ACMD6 is also used, and will have the same index, a check on
CMD/ACMD commands is done: a boolean is stored depending on previous
command. It is set to true if CMD55 is issued, for other commands
it is set to false.

Change-Id: I6c2b9c7637656f858601ec075de1cb5f57af271a
Signed-off-by: Yann Gautier <yann.gautier@st.com>
2022-08-16 15:58:22 +02:00
Yann Gautier
e5b267bba1 feat(mmc): manage SD Switch Function for high speed mode
On SD-cards, Switch Function Command (CMD6) is used to switch
functions, like setting High Speed mode. It is useful for high capacity
cards to double frequency (from 25MHz by default to 50MHz).
If the SD-card is High Capacity, a CMD6 is issued after filling the
device information. If High Speed mode is supported and the switch is
OK, then the max_bus_freq can be set to 50MHz. The driver set_ios()
function should then be called to update peripheral configuration,
especially clock prescaler.

Change-Id: I2d6807aa7f9440d2b2f907a747cd3b47a2ba1545
Signed-off-by: Yann Gautier <yann.gautier@st.com>
2022-08-16 15:58:22 +02:00
Yann Gautier
e9ff3486d3 refactor(st-drivers): do not rely on DT in etzpc_init
The ETZPC peripheral is always secure, and has a fixed address,
given by STM32MP1_ETZPC_BASE. This is then not needed to check
that in DT.

Signed-off-by: Yann Gautier <yann.gautier@foss.st.com>
Change-Id: Ifb0779abaf830e1e5a469c72181c2b2726fb47b5
2022-08-10 10:00:03 +02:00
Gabriel Fernandez
3ff1ff4047 refactor(st-clock): code size optimization
Clock name is not used and can be removed for code size optimization.

Change-Id: I75f6a1828e4374004e31a7ce13fa6885c52bbac3
Signed-off-by: Gabriel Fernandez <gabriel.fernandez@foss.st.com>
2022-08-10 09:56:32 +02:00
Gabriel Fernandez
b44f5acf5d refactor(st-clock): remove unused PLL field
The divn_max field is unused, remove it.

Change-Id: I971912bcc035f16963d98dfa88782c8aed4415f2
Signed-off-by: Gabriel Fernandez <gabriel.fernandez@foss.st.com>
2022-08-10 09:56:32 +02:00
Lauren Wehrmeister
c152276829 Merge changes from topic "st_fip_uuid" into integration
* changes:
  feat(stm32mp1): retrieve FIP partition by type UUID
  feat(guid-partition): allow to find partition by type UUID
  refactor(stm32mp1): update PLAT_PARTITION_MAX_ENTRIES
2022-08-01 16:45:49 +02:00
anans
9d6d1a94c9 fix(ufs): init utrlba/utrlbau with desc_base
Initialising these registers with header address will not work when
get_empty_slot returns anything other than 0 because these registers
should point to the starting of transfer request list instead of the
current descriptor

Change-Id: I60b3b59e2be6e2635a59b14dd1f11d93b9d95a1f
Signed-off-by: anans <anans@google.com>
2022-08-01 03:13:48 +00:00
anans
7d9648dd6c fix(ufs): fix slot base address computation
The entire packet including UPIUs and PRDT is 0x400 but the controller
just looks for the header (32-bytes) from the UTRL

Change-Id: Ibd5d22b4a841c107fdf6447d598c5c600998e0f8
Signed-off-by: Anand Saminathan <anans@google.com>
2022-08-01 02:39:52 +00:00
Varun Wadekar
a78b3b382b feat(gicv3): validate multichip data for GIC-700
This patch introduces support to validate the GIC-700 multichip data
structure passed by the platform.

GIC-700 provides support for SPI ID 4096 to 5119. Platforms using the
GIC-700 in a multichip configuration can enable these SPI IDs. The
driver needs to validate the data before using it and this patch
implements the support.

Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
Change-Id: I6f85ec21ef7a59f397fcf6271f8c13c24fe47697
2022-07-29 10:59:47 +01:00
Madhukar Pappireddy
1d867c14cb Merge "fix(ufs): add retries to ufs_read_capacity" into integration 2022-07-27 16:06:43 +02:00
anans
9d3f6c4b60 fix(ufs): point utrlbau to header instead of upiu
utrlbau should point to header and not upiu
this is the case everywhere except for ufs_prepare_cmd

Signed-off-by: anans <anans@google.com>
Change-Id: I02695824c1409124a60e63c3a7ff3278a4dc5fa8
2022-07-26 11:39:23 +00:00