Commit graph

15097 commits

Author SHA1 Message Date
Charlie Bareham
01959a1656 fix(psci): fix parent parsing in psci_is_last_cpu_to_idle_at_pwrlvl
The function always checks the first parent of the current core
instead parse the tree topology to find the parent at parent level
of the CPU. It is because the current loop has no effect as it uses
a fixed parameter 'my_idx' and returns the FIRST parent of CPU.
Also, it looks for the parent nodes in the array of CPU nodes, but
actually they are in a separate array.

This update allows to parse the PSCI topology tree to find
the parent at parent level of the CPU identified by my_idx.

Fixes: 606b743007 ("feat(psci): add support for OS-initiated mode")
Change-Id: I96fb5ecc154a76b16adca5b5055217b8626c9e66
Signed-off-by: Charlie Bareham <charlie.bareham@arm.com>
2024-08-06 09:20:29 +01:00
Manish V Badarkhe
18faaa2424 Merge changes from topic "us_pmu" into integration
* changes:
  fix(tc): correct CPU PMU binding
  feat(tc): add device tree binding for SPE
  feat(tc): add PPI partitions in DT binding
  feat(tc): change GIC DT property 'interrupt-cells' to 4
  feat(tc): add NI-Tower PMU node for TC3
  feat(tc): setup ni-tower non-secure access for TC3
2024-08-05 17:43:33 +02:00
Jagdish Gediya
7aca660c4e fix(tc): correct CPU PMU binding
CPU PMU types are not same for all CPUs on TC platforms, so define the
PMU nodes per micro architectures.

Change-Id: I4e940976cdda9a6eab3e15936c6c41a2bb668c9d
Signed-off-by: Jagdish Gediya <jagdish.gediya@arm.com>
Signed-off-by: Leo Yan <leo.yan@arm.com>
2024-08-05 16:25:59 +01:00
Jagdish Gediya
77080f6aaf feat(tc): add device tree binding for SPE
Add node for Statistical Profiling Extension, which provides
periodic sampling of operations in the CPU pipeline and reports
this via the perf AUX interface.

Change-Id: Ic7a9d9ce927edbce02c7c09470a009dc56247240
Signed-off-by: Jagdish Gediya <jagdish.gediya@arm.com>
Signed-off-by: Leo Yan <leo.yan@arm.com>
2024-08-05 16:25:59 +01:00
Jagdish Gediya
ebc991b3a1 feat(tc): add PPI partitions in DT binding
Define ppi-partitions for little, middle, and big cpu groups. PPI
affinity is expressed as a single "ppi-partitions" node, containing a
set of sub-nodes for each microarchitecture type, each with the
property 'affinity' which should be a list of phandles to CPU nodes.

PPI paritions are useful to affine specific PPI with set of CPUs
so that the drivers of micro-architecture specific nodes which uses
PPI can be divided based on CPU list e.g. SPE-PMU, CPU-PMU etc.

Change-Id: If7d47f71387ac982d2d992a0ce2de1652d564bd6
Signed-off-by: Jagdish Gediya <jagdish.gediya@arm.com>
Signed-off-by: Leo Yan <leo.yan@arm.com>
2024-08-05 16:25:59 +01:00
Jagdish Gediya
1300bbce15 feat(tc): change GIC DT property 'interrupt-cells' to 4
Change the GIC's DT property 'interrupt-cells' to 4, so the 4th cell is
a phandle to a node describing a set of CPUs this interrupt is affine
to.

If an interrupt is a PPI, and the node pointed in the 4th cell must be a
subnode of the "ppi-partitions" in the GIC node. For interrupt types
other than PPI, this cell must be zero. This is a preparison for
sequential changes for interrupt partitions, as the first step, it sets
all zeros for the interrupt affinity.

Change-Id: I66490a86a27aad5db6b1a42c2d8e0d042eee46a9
Signed-off-by: Jagdish Gediya <jagdish.gediya@arm.com>
Signed-off-by: Leo Yan <leo.yan@arm.com>
2024-08-05 16:25:59 +01:00
Jagdish Gediya
169eb7daf2 feat(tc): add NI-Tower PMU node for TC3
Enable NI-Tower PMU on TC3.

Change-Id: I8a4d4e31e84ab33f95bc8b7661e873cf97561b79
Signed-off-by: Jagdish Gediya <jagdish.gediya@arm.com>
Signed-off-by: Leo Yan <leo.yan@arm.com>
2024-08-05 16:25:59 +01:00
Jagdish Gediya
89c58a5087 feat(tc): setup ni-tower non-secure access for TC3
NI-Tower's component's registers are need to be accessed from
kernel NI-PMU driver so enable NS access to it.

Change-Id: I83a8b3a1d2778baf767ff93263e246d127ef8114
Signed-off-by: Jagdish Gediya <jagdish.gediya@arm.com>
Signed-off-by: Leo Yan <leo.yan@arm.com>
2024-08-05 16:25:51 +01:00
Manish V Badarkhe
1baf62469e Merge changes from topic "ar/asymmetricSupport" into integration
* changes:
  feat(trbe): introduce trbe_disable() function
  feat(spe): introduce spe_disable() function
  chore(spe): rename spe_disable() to spe_stop()
2024-08-05 17:16:52 +02:00
Manish Pandey
bbca58ffd3 Merge changes from topic "corstone1000-bugfixes" into integration
* changes:
  fix(corstone1000): update memory layout comments
  fix(corstone1000): clean cache and disable interrupt before system reset
  fix(corstone1000): remove unused NS_SHARED_RAM region
  fix(corstone1000): pass spsr value explicitly
2024-08-05 13:48:38 +02:00
Manish Pandey
9bfad24c3b Merge changes from topic "hm/handoff" into integration
* changes:
  fix(arm): move HW_CONFIG relocation into BL31
  feat: add option to input attr as string of flag names
  feat: add option to input text instead of tag id number
  feat: add creating transfer lists from yaml files
2024-08-05 12:35:49 +02:00
Manish V Badarkhe
9268bc23f1 Merge "fix(arm): correct the RESET_TO_BL31 x1 handoff arg" into integration 2024-08-05 12:31:35 +02:00
Manish V Badarkhe
fe40084d3b Merge "fix(docs): refactor poetry dependency group" into integration 2024-08-02 18:16:38 +02:00
Bence Balogh
d7417adc21 fix(corstone1000): update memory layout comments
The SRAM (CVM) memory layout was outdated in the platform_defs.h of
the Corstone-1000 platform. Updated it to list every bootloaders and
to be aligned with the implementation. Also added the starting (base)
addresses of each partition.

Change-Id: Ie8e8416ee2650ff25a8d4c61d8d9af789bc639c1
Signed-off-by: Bence Balogh <bence.balogh@arm.com>
2024-08-02 17:42:03 +02:00
Emekcan Aras
335c4f8b30 fix(corstone1000): clean cache and disable interrupt before system reset
Corstone1000 does not properly clean the cache and disable gic interrupts
before the reset. This causes a race condition especially in FVP after
reset. This adds proper sequence before resetting the platform.

Change-Id: I22791eec2ec0ca61d201d8a745972a351248aa3d
Signed-off-by: Emekcan Aras <Emekcan.Aras@arm.com>
2024-08-02 17:41:56 +02:00
Harrison Mutai
fe94a21a68 fix(arm): move HW_CONFIG relocation into BL31
Refactor DT relocation logic from BL2 to BL31 for non-secure DRAM.
Previously, BL2 was responsible for copying the DT into SRAM and DRAM,
resulting in duplicate code in BL31 to cater for the `RESET_TO_BL31`
case. By moving the re-location logic to BL31, we simplify handling of
the non-secure DT and TL.

Change-Id: Id239f9410669afe4b223fa8d8bb093084a0e5e1b
Signed-off-by: Harrison Mutai <harrison.mutai@arm.com>
2024-08-02 14:59:47 +00:00
Harrison Mutai
4a29299f2e fix(docs): refactor poetry dependency group
Rename 'doc' group to 'docs' for consistency, this is to follow the
widely accepted convention of using plural nouns groups that contain
multiple items. This change signifies that the 'docs' group includes a
collection of documentation-related dependencies.

Also, ensure that the dependencies are actually conditionally installed
by setting the group as optional. This was missing in the original
change.

Change-Id: I07caccfb1b57bc2dc1e7596899dfb926e8a5f71a
Signed-off-by: Harrison Mutai <harrison.mutai@arm.com>
2024-08-02 14:24:07 +00:00
Harrison Mutai
5da68cc477 fix(arm): correct the RESET_TO_BL31 x1 handoff arg
Use the designated macro to accurately set the signature within the
parameters transferred from BL33 to the non-secure payload.

Change-Id: Id91319121a70b2c72f8489450f191ca4f129cfcb
Signed-off-by: Harrison Mutai <harrison.mutai@arm.com>
2024-08-02 14:09:27 +00:00
Charlie Bareham
4dcbba98ce feat: add option to input attr as string of flag names
Change-Id: I56f0364ef43c9d415a335474e15b68e79db37f5d
Signed-off-by: Charlie Bareham <charlie.bareham@arm.com>
2024-08-02 12:14:53 +00:00
Charlie Bareham
792e8e896f feat: add option to input text instead of tag id number
Change-Id: I6d1b1a20d1cd5b073d7d614da102b9e6bd8ea522
Signed-off-by: Charlie Bareham <charlie.bareham@arm.com>
2024-08-02 12:14:53 +00:00
Charlie Bareham
311209934e feat: add creating transfer lists from yaml files
This commit adds a command create-from-yaml to tlc, which
creates a transfer list from a yaml file. It also changes
the files structure of the fixtures in the unit tests so
they are in a directory called trusted-firmware-a. This
is necessary because blob file paths in the yaml file are
relative to the root of TF-A.

The blob files are not verified by TLC, so it can be used
to load arbitrary binary information into the transfer
list. The authenticity of the transfer list must be
ensured by the loader.

Change-Id: Idf704ce5d9b7e28b31f471ac337e4aef33d0ad8a
Signed-off-by: Charlie Bareham <charlie.bareham@arm.com>
2024-08-02 12:14:53 +00:00
Manish Pandey
0c331352a0 Merge "refactor(mbedtls): rewrite psa crt verification" into integration 2024-08-02 10:23:30 +02:00
Manish V Badarkhe
66f6d3bf8f Merge "fix(docs): point poetry readthedocs virtual env" into integration 2024-08-01 19:07:20 +02:00
Harrison Mutai
5383a88b93 fix(docs): point poetry readthedocs virtual env
RTD uses a mixture of poetry and pip to install packages in the build
environment. In the past it was recommended to disable poetry from
creating a fresh virtual environment. Instead, the expectation was that
poetry would be able to detect it's current virtual environment and
install the packages in the right place. This was recently updated to
allow poetry to better allow dependcy management by poetry [1]. Remove
this configuration and explicitly point Poetry to the virtual
environment.

[1] https://github.com/readthedocs/readthedocs.org/pull/11152

Change-Id: I58e49ba6f6d122e70bbcf1dbb10220881a09faf3
Signed-off-by: Harrison Mutai <harrison.mutai@arm.com>
2024-08-01 15:48:44 +00:00
Ryan Everett
0bc36c839f refactor(mbedtls): rewrite psa crt verification
This new version uses fewer internal functions
in favour of calling equivalent mbedtls APIs.

Change-Id: I0c2c20a74687211f2d554501f57898da07b01739
Signed-off-by: Ryan Everett <ryan.everett@arm.com>
2024-08-01 16:39:13 +01:00
André Przywara
80cd7dd1bb Merge "fix(allwinner): dtb: check for correct error condition" into integration 2024-07-31 18:35:49 +02:00
Manish Pandey
47add9d3ed Merge changes from topic "hm/handoff" into integration
* changes:
  build: make poetry use existing lock file
  feat(arm): add fw handoff support for RESET_TO_BL31
  feat(tlc): add host tool for static TL generation
2024-07-31 16:44:12 +02:00
Andre Przywara
7300a4d167 fix(allwinner): dtb: check for correct error condition
In sunxi_soc_fdt_fixup(), we check for the value of "ret" again, after
calling fdt_node_offset_by_phandle(), even though the error value of
that lands in "node".

Check for "node" being non-negative instead, to properly detect any
errors here.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Change-Id: I57c1406388dbe11d343038da173019519e18af3e
2024-07-31 10:58:55 +01:00
Manish Pandey
a169b8fbc2 Merge "build: fix missing $$(@D)/ from sp_gen.mk" into integration 2024-07-31 11:32:43 +02:00
Emekcan Aras
83c11c0bd1 fix(corstone1000): remove unused NS_SHARED_RAM region
After enabling additional features in Trusted Services, the size of BL32
image (OP-TEE + Trusted Services SPs) is larger now. To create more space
in secure RAM for BL32 image, this patch removes NS_SHARED_RAM region
which is not currently used by corstone1000 platform.

Change-Id: I1e9468fd2dcb66b4d21fce245097ba51331ec54d
Signed-off-by: Emekcan Aras <Emekcan.Aras@arm.com>
2024-07-31 11:15:28 +02:00
Emekcan Aras
32690bacb9 fix(corstone1000): pass spsr value explicitly
Passes spsr value for BL33 (U-Boot) explicitly between different boot
stages. This information is needed in order to boot properly.

Change-Id: I06b5b750f963f8609e00ff6bf2838bac0f8b7b28
Signed-off-by: Emekcan Aras <Emekcan.Aras@arm.com>
2024-07-31 11:15:28 +02:00
Chris Kay
fd74ca0d6b build: fix missing $$(@D)/ from sp_gen.mk
This target can currently fail as the `$(BUILD_PLAT)` target no longer exists, as it is now `$(BUILD_PLAT)/` (with an explicit trailing slash).

Change-Id: I9172b2f51f6e02e6369f62468ea63a64ec0f6dd1
Signed-off-by: Chris Kay <chris.kay@arm.com>
2024-07-30 17:26:10 +02:00
Charlie Bareham
e182f4380c build: make poetry use existing lock file
This makes the build reproducible.

When `make dev-install` was run, it would ignore the existing
poetry lock file, install different versions of all the
libraries, then overwrite the lock file. Once `--no-update`
is added, it stops doing that, and installs exactly what is
in the poetry lock file.

Change-Id: If62637a40504d23deb47a05347a272e1c13bf41e
Signed-off-by: Charlie Bareham <charlie.bareham@arm.com>
2024-07-30 10:26:07 +00:00
Harrison Mutai
1a0ebff784 feat(arm): add fw handoff support for RESET_TO_BL31
Change-Id: I78f3c5606f0221bb5fc613a973a7d3fe187db35b
Signed-off-by: Harrison Mutai <harrison.mutai@arm.com>
2024-07-30 10:26:07 +00:00
Harrison Mutai
6ac31f3e76 feat(tlc): add host tool for static TL generation
Transfer List Compiler is a command line tool that enables the static
generation of TL's compliant with version 0.9 of the firmware handoff
specification. The intent of this tool is to support information passing
via the firmware handoff framework to bootloaders that run without
preceding images (i.e. `RESET_TO_BL31`).

It currently allows for TL's to be statically generated from blobs of
data, and modified by removing/adding TE's. Future work will provide
support for TL generation from configuration file.

Change-Id: Iff670842e34c9ad18eac935248ee2aece43dc533
Signed-off-by: Harrison Mutai <harrison.mutai@arm.com>
Co-authored-by: Charlie Bareham <charlie.bareham@arm.com>
2024-07-30 10:25:57 +00:00
Arvind Ram Prakash
b36e975ea3 feat(trbe): introduce trbe_disable() function
This patch adds trbe_disable() which disables Trace buffer access
from lower ELs in all security state. This function makes Secure
state the owner of Trace buffer and access from EL2/EL1 generate
trap exceptions to EL3.

Signed-off-by: Arvind Ram Prakash <arvind.ramprakash@arm.com>
Change-Id: If3e3bd621684b3c28f44c3ed2fe3df30b143f8cd
2024-07-29 20:35:14 +01:00
Manish Pandey
651fe5073c feat(spe): introduce spe_disable() function
Introduce a function to disable SPE feature for Non-secure state and do
the default setting of making Secure state the owner of profiling
buffers and trap access of profiling and profiling buffer control
registers from lower ELs to EL3.

This functionality is required to handle asymmetric cores where SPE has
to disabled at runtime.

Signed-off-by: Manish Pandey <manish.pandey2@arm.com>
Change-Id: I2f99e922e8df06bfc900c153137aef7c9dcfd759
2024-07-29 20:34:18 +01:00
Manish Pandey
4de07b4be7 chore(spe): rename spe_disable() to spe_stop()
During CPU power down, we stop the profiling by calling spe_disable()
function. From TF-A point of view, enable/disable means the avaibility
of the feature for lower EL. In this case we are not actully disabling
the feautre but stoping it before power down.

Signed-off-by: Manish Pandey <manish.pandey2@arm.com>
Change-Id: I6e3b39c5c35d330c51e7ac715446a8b36bf9531f
2024-07-29 20:34:04 +01:00
Manish V Badarkhe
4bcf5b847c Merge changes from topic "jc/refact_el1_ctx" into integration
* changes:
  refactor(cm): convert el1-ctx assembly offset entries to c structure
  feat(cm): add explicit context entries for ERRATA_SPECULATIVE_AT
2024-07-29 19:21:30 +02:00
Manish V Badarkhe
93b7b752e9 Merge "build(amu): restrict counters (RAZ)" into integration 2024-07-29 18:55:03 +02:00
Manish Pandey
55b4c5ceb2 Merge changes from topic "h616_pmics" into integration
* changes:
  feat(allwinner): adjust H616 L2 cache size in DTB
  feat(allwinner): h616: add support for AXP717 PMIC
  feat(allwinner): h616: add support for AXP313 PMIC
  feat(allwinner): h616: add I2C PMIC support
  refactor(allwinner): h616: prepare for more than one PMIC model
2024-07-29 18:28:41 +02:00
Manish Pandey
70c8a8f547 Merge "feat(rcar3): populate kaslr-seed in next stage DT" into integration 2024-07-29 17:12:18 +02:00
Manish Pandey
aca05c5991 Merge "fix(fvp): add secure uart interrupt in device region" into integration 2024-07-29 15:55:35 +02:00
Manish Pandey
0195bac19b Merge "build: consolidate directory creation rules" into integration 2024-07-29 15:54:46 +02:00
Manish Pandey
5477fb37e6 Merge "feat(fvp): add flash areas for secure partition" into integration 2024-07-29 15:11:27 +02:00
levi.yun
9fb767630d feat(fvp): add flash areas for secure partition
To support UEFI secure variable service,
StandaloneMm which runs in BL32 should know flash areas.
Add flash memory areas and system register region
so that StandaloneMm access to flash storages.

Change-Id: I803bda9664a17a0b978ebff90974eaf5442a91cd
Signed-off-by: levi.yun <yeoreum.yun@arm.com>
2024-07-29 09:55:43 +01:00
Olivier Deprez
fc3a01aac3 fix(fvp): add secure uart interrupt in device region
OP-TEE enables the use case of a secure interrupt triggered by the UART
driver. This interrupt is routed by FFA_INTERRUPT interface to OP-TEE.
Define the UART interrupt in the FF-A device region node.
Without this change, OPTEE panics at the boot with the following:

  |  I/TC: No non-secure external DT
  |  I/TC: manifest DT found
  |  I/TC: OP-TEE version: 4.3.0-23-gfcd8750677db
  |  I/TC: WARNING: This OP-TEE configuration might be insecure!
  |  I/TC: WARNING: Please check https://optee.readthedocs.io/en/latest/architecture/porting_guidelines.html
  |  I/TC: Primary CPU initializing
  |  E/TC:0 0 assertion '!res' failed at core/drivers/hfic.c:56 <hfic_op_enable>
  |  E/TC:0 0 Panic at core/kernel/assert.c:28 <_assert_break>
  |  E/TC:0 0 TEE load address @ 0x6284000

Change-Id: Icddcdfd032315aeee65ba3100f3a6b470a74435d
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2024-07-26 23:13:23 +02:00
Olivier Deprez
a4e2a9f16d Merge changes from topic "rmmd-graceful-exit" into integration
* changes:
  fix(rmmd): remove the assert check for RMM_BASE
  fix(std_svc): continue boot if rmmd_setup fails
  fix(rmmd): ignore SMC FID when RMM image is not present
  fix(rmmd): fail gracefully if RME is not enabled
  fix(rmmd): handle RMMD manifest loading failure
2024-07-26 23:12:32 +02:00
Jayanth Dodderi Chidanand
42e35d2f8c refactor(cm): convert el1-ctx assembly offset entries to c structure
Currently the EL1 part of the context structure (el1_sysregs_t),
is coupled with feature flags reducing the context memory allocation
for platforms, that don't enable/support all the architectural
features at once.

Similar to the el2 context optimization commit-"d6af234" this patch
further improves this section by converting the assembly context-offset
entries into a c structure. It relies on garbage collection of the
linker removing unreferenced structures from memory, as well as aiding
in readability and future maintenance. Additionally, it eliminates
the #ifs usage in 'context_mgmt.c' source file.

Change-Id: If6075931cec994bc89231241337eccc7042c5ede
Signed-off-by: Jayanth Dodderi Chidanand <jayanthdodderi.chidanand@arm.com>
2024-07-26 17:08:12 +01:00
Jayanth Dodderi Chidanand
59b7c0a03f feat(cm): add explicit context entries for ERRATA_SPECULATIVE_AT
* Currently, "ERRATA_SPECUALTIVE_AT" errata is enabled by default
  for few cores and they need context entries for saving and
  restoring EL1 regs "SCTLR_EL1 and TCR_EL1" registers at all times.

* This prevents the mechanism of decoupling EL1 and EL2 registers,
  as EL3 firmware shouldn't be handling both simultaneously.

* Depending on the build configuration either EL1 or EL2 context
  structures need to included, which would result in saving a good
  amount of context memory.

* In order to achieve this it's essential to have explicit context
  entries for registers supporting "ERRATA_SPECULATIVE_AT".

* This patch adds two context entries under "errata_speculative_at"
  structure to assist this errata and thereby allows decoupling
  EL1 and EL2 context structures.

Change-Id: Ia50626eea8fb64899a2e2d81622adbe07fe77d65
Signed-off-by: Jayanth Dodderi Chidanand <jayanthdodderi.chidanand@arm.com>
2024-07-26 15:36:31 +01:00