Commit graph

12746 commits

Author SHA1 Message Date
Raghu Krishnamurthy
01c1b3e17f chore: remove unused and undefined function
Clean up unused function

Signed-off-by: Raghu Krishnamurthy <raghu.ncstate@gmail.com>
Change-Id: Ib761d04070f7eb7e0dddad4ad885ce11f82582b8
2023-06-06 08:19:06 -07:00
Manish Pandey
e1c0a47267 Merge changes from topic "dummy_feat_aa32" into integration
* changes:
  feat(cpufeat): deny AArch64-only features when building for AArch32
  feat(cpufeat): add AArch32 PAN detection support
2023-06-06 16:50:36 +02:00
Manish Pandey
dbe4765c30 Merge "refactor(el3-spmc): avoid unneeded function call" into integration 2023-06-06 16:44:49 +02:00
Manish Pandey
f4c913630d Merge changes Ia052c7f9,If598680a,Ieae11722 into integration
* changes:
  refactor(el3-spmc): move function call out of loop
  refactor(el3-spmc): crash instead of reading OOB
  fix(el3-spmc): prevent total_page_count overflow
2023-06-06 16:43:53 +02:00
Madhukar Pappireddy
1d64109ece Merge changes from topic "st-fixes" into integration
* changes:
  fix(spi-nand): add Quad Enable management
  fix(st-clock): disabling CKPER clock is not functional on stm32mp13
  fix(st-uart): skip console flush if UART is disabled
  fix(st): flush UART at the end of uart_read()
  fix(stm32mp1): use the BSEC nodes compatible for stm32mp13
  fix(stm32mp13-fdts): correct the BSEC nodes compatible
  fix(stm32mp1-fdts): move /omit-if-no-ref/ to overlay files
  fix(stm32mp1): properly check PSCI functions return
2023-06-06 16:03:38 +02:00
Sandrine Bailleux
e14b7acb49 Merge "refactor(fvp): nv ctr addr static helper function" into integration 2023-06-06 13:30:26 +02:00
Sandrine Bailleux
e9736a01a1 Merge changes from topic "version/0.1-gic" into integration
* changes:
  feat(qemu-sbsa): handle GIC base
  feat(qemu-sbsa): handle platform version
2023-06-06 11:08:42 +02:00
Olivier Deprez
4c8e1f9a35 Merge changes I21d65a88,I949cfce9,If4249f22,Id0451bd1,I9e930070, ... into integration
* changes:
  feat(mediatek): add APU watchdog timeout control
  feat(mt8188): add emi mpu protection for APU secure memory
  feat(mt8188): add devapc setting of apusys rcx
  feat(mt8188): add backup/restore function when power on/off
  feat(mediatek): add APU bootup control smc call
  feat(mt8188): enable apusys mailbox mpu protect
  feat(mt8188): enable apusys domain remap
  feat(mt8188): add apusys ao devapc setting
  feat(mt8188): increase TZRAM_SIZE from 192KB to 256KB
2023-06-06 09:31:05 +02:00
Chungying Lu
baa0d45ced feat(mediatek): add APU watchdog timeout control
Add APU watchdog timeout control.

Change-Id: I21d65a88d20b6b2752a75f74487b5fe6596ebdf7
Signed-off-by: Chungying Lu <chungying.lu@mediatek.com>
Signed-off-by: Karl Li <karl.li@mediatek.com>
2023-06-06 13:45:40 +08:00
Chungying Lu
176846a50b feat(mt8188): add emi mpu protection for APU secure memory
Add emi mpu protection of APU secure memory.

Change-Id: I949cfce97565d8a313caae4ea41af60a171042a6
Signed-off-by: Chungying Lu <chungying.lu@mediatek.com>
Signed-off-by: Karl Li <karl.li@mediatek.com>
2023-06-06 13:45:40 +08:00
Karl Li
5986ae57aa feat(mt8188): add devapc setting of apusys rcx
Apusys rcx is a subsys in apusys, and it is a basic domain of APU and
it connects several components in APU.
The devapc control of apusys rcx is also inside APU and it can only be
set when APU is powered on.
Then apusys kernel driver will trigger rcx devapc init by ATF smc call.

Change-Id: If4249f22a08690b1e4f5aa5f0cbfb54ccacf90e1
Signed-off-by: Karl Li <karl.li@mediatek.com>
Signed-off-by: Chungying Lu <chungying.lu@mediatek.com>
2023-06-06 13:45:40 +08:00
Chungying Lu
233d604f50 feat(mt8188): add backup/restore function when power on/off
Add APU backup/restore function when power on/off.

Change-Id: Id0451bd12f402e1acabeb5c12266a2e01836e9dd
Signed-off-by: Chungying Lu <chungying.lu@mediatek.com>
Signed-off-by: Karl Li <karl.li@mediatek.com>
2023-06-06 13:45:40 +08:00
Chungying Lu
94a9e6243e feat(mediatek): add APU bootup control smc call
Add APU bootup control smc call.
The steps of bootup flow:
  1. set up APU config.
  2. reset APU.
  3. set up APU boot config.
  4. boot APU.

Change-Id: I9e930070a64c7c4dcaa3a8b3d28b897823e9f53c
Signed-off-by: Chungying Lu <chungying.lu@mediatek.com>
Signed-off-by: Karl Li <karl.li@mediatek.com>
2023-06-06 13:45:40 +08:00
Karl Li
ad7673adef feat(mt8188): enable apusys mailbox mpu protect
Enable apusys mailbox mpu protect.

Change-Id: Idbf67084037b7ecf4926f57a901075f98540ee57
Signed-off-by: Karl Li <karl.li@mediatek.com>
Signed-off-by: Chungying Lu <chungying.lu@mediatek.com>
2023-06-06 13:45:40 +08:00
Karl Li
b5900c92a1 feat(mt8188): enable apusys domain remap
Enable apusys domain remap to protect no-protect memory.
  - Remap request which from domain 5 to domain 14.
  - Remap request which from domain 7 to domain 14.

Change-Id: Iccd188e3b8edbe916fa9767c841a844b66c6011f
Signed-off-by: Karl Li <karl.li@mediatek.com>
Signed-off-by: Chungying Lu <chungying.lu@mediatek.com>
2023-06-06 13:45:40 +08:00
Karl Li
777e3b71bb feat(mt8188): add apusys ao devapc setting
Apusys ao devapc is a set of control registers inside APU, and it
controls the access permission of APU ao domain.
Moreover, apusys ao devapc must be set after apusys power init, so
we need to place the drivers in TF-A instead of coreboot.

Change-Id: Ife849c32d4dd9dca15432d4b8a51753fde61b148
Signed-off-by: Karl Li <karl.li@mediatek.com>
Signed-off-by: Chungying Lu <chungying.lu@mediatek.com>
2023-06-06 13:45:40 +08:00
Karl Li
aa1cb279b6 feat(mt8188): increase TZRAM_SIZE from 192KB to 256KB
Increase TZRAM_SIZE to 256KB for MT8188 APUSYS.

Change-Id: Iabe1a4aeb79ba23c3e963170a8eb9ce19f2925f3
Signed-off-by: Karl Li <karl.li@mediatek.com>
2023-06-06 13:44:03 +08:00
Demi Marie Obenour
1198ff8424 refactor(el3-spmc): avoid unneeded function call
The information is already available inline.  No functional change
intended.

Change-Id: I13d2ad62a9315b233d7a5fd3ffcaac3dd01b055c
Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
2023-06-05 13:22:21 -04:00
Demi Marie Obenour
48ffc74c97 refactor(el3-spmc): move function call out of loop
Hopefully this will be a tiny speedup.  No functional change intended.

Change-Id: Ia052c7f9b24d5ece6209a6fa2903b1271215ece7
Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
2023-06-05 13:22:21 -04:00
Demi Marie Obenour
9526282a7d refactor(el3-spmc): crash instead of reading OOB
If it is called on an invalid mtd, out-of-bounds memory reads are
likely.  Checks elsewhere in the code ensure that the mtd has been
validated before calling this function.

Change-Id: If598680a5b79e1786a6e0a213779ec80cbf37494
Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
2023-06-05 13:22:21 -04:00
Demi Marie Obenour
2d4da8e265 fix(el3-spmc): prevent total_page_count overflow
size_t is not guaranteed to be 64 bits, although it happens to be 64
bits on all systems that el3-spmc supports.

Change-Id: Ieae11722a15448641de50233597ac35869eab574
Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
2023-06-05 13:22:21 -04:00
laurenw-arm
b695b2f16e refactor(fvp): nv ctr addr static helper function
Adding a static helper function plat_get_nv_ctr_addr() to be used by
both plat_set_nv_ctr() and plat_get_nv_ctr() to return the
non-volatile counter address stored in the platform.

Change-Id: I5124c19e4537bb369724aa0160cc55a3cb1ab7eb
Signed-off-by: Lauren Wehrmeister <lauren.wehrmeister@arm.com>
2023-06-05 11:21:51 -05:00
Manish Pandey
a0f3b552cf Merge "chore: rename Makalu to Cortex-A715" into integration 2023-06-05 16:21:47 +02:00
Soby Mathew
9027be6fae Merge "feat(xlat): detect 4KB and 16KB page support when FEAT_LPA2 is present" into integration 2023-06-05 13:04:34 +02:00
Manish Pandey
ba56ea6fed Merge "fix(fiptool): move juno plat_fiptool.mk" into integration 2023-06-05 12:42:03 +02:00
Marcin Juszkiewicz
1e67b1b17a feat(qemu-sbsa): handle GIC base
QEMU provides GIC information in DeviceTree (on platform version 0.1+).
Read it and provide to next firmware level via SMC.

Signed-off-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
Change-Id: I383919bd172acc8873292a0c5e4469651dc96fb9
2023-06-05 12:24:44 +02:00
Marcin Juszkiewicz
c681d02c6c feat(qemu-sbsa): handle platform version
QEMU provides platform version information via DT. We want to use it
in firmware to handle differences between platform versions.

Signed-off-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
Change-Id: I8def66dac9dd5d7ab0e459baa40e27a11b65f0ba
2023-06-05 11:24:35 +01:00
Javier Almansa Sobrino
bff074dd94 feat(xlat): detect 4KB and 16KB page support when FEAT_LPA2 is present
At the moment, TF-A does not need to access VAs or PAs larger than
48 bits, so this patch just enables proper detection of support
for 4KB and 16KB granularity with 52 bits address support.

Signed-off-by: Javier Almansa Sobrino <javier.almansasobrino@arm.com>
Change-Id: Iccebbd5acc21f09dbb234ef21a802300e290ec18
2023-06-05 11:05:02 +01:00
Sandrine Bailleux
7f126ccff6 Merge changes from topic "cot_cca_nvctr" into integration
* changes:
  feat(fvp): mock support for CCA NV ctr
  feat(auth): add CCA NV ctr to CCA CoT
  feat(build): pass CCA NV ctr option to cert_create
  feat(cert-create): add new option for CCA NV ctr
2023-06-05 08:13:33 +02:00
Sandrine Bailleux
463655cc81 Merge "fix(measured-boot): don't strip last non-0 char" into integration 2023-06-02 10:02:47 +02:00
Sandrine Bailleux
9b5c0fcdba Merge changes from topic "hm/memmap-feat" into integration
* changes:
  build(bl32): add symbols for memory layout
  build(bl31): add symbols for memory layout
  build(bl2): add symbols for memory layout
  build(bl1): add symbols for memory layout
  refactor: improve readability of symbol table
2023-06-01 14:36:46 +02:00
Sandrine Bailleux
ff31094a0d Merge changes from topic "sb/maintainters-process" into integration
* changes:
  docs: clarify maintainers election process
  docs: consolidate code review process documentation
2023-06-01 13:42:16 +02:00
Sandrine Bailleux
0df5cf1893 docs: clarify maintainers election process
Add a new page in TF-A documentation for clarifying the process to
elect a new maintainer. This builds on top of the Trusted Firmware
process [1], with the following TF-A specific details:

 - Must have contributed to the project for at least a couple of years.
 - Must dedicate at least 2 hours a week for maintainer duties.
 - Details about the election process. In particular, setting a
   one-calendar-week deadline for other maintainers to raise
   objections.

[1] https://developer.trustedfirmware.org/w/collaboration/project-maintenance-process/

Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
Change-Id: Ibef08bbbd4d18cd7aea13e01ba570972a7ee808d
2023-06-01 13:41:09 +02:00
Sandrine Bailleux
ca4febac0c docs: consolidate code review process documentation
From the page listing the maintainers and code owners [1], add a link
to the code review guidelines page [2], which in turn has a link to
the tf.org code review process [3].

Before that patch, both pages [1] and [2] had a link to
[3]. Hopefully, this change will guide the reader better so they don't
miss out on any information.

Additionally, move some of the information from the top of page [1]
into page [2] and add extra details about the code review process used
in TF-A and how that get translated in Gerrit.

[1] https://trustedfirmware-a.readthedocs.io/en/latest/about/maintainers.html
[2] https://trustedfirmware-a.readthedocs.io/en/latest/process/code-review-guidelines.html
[3] https://developer.trustedfirmware.org/w/collaboration/project-maintenance-process/

Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
Change-Id: I56562a72443f03fff16077dadc411ef4ee78666d
2023-06-01 13:41:09 +02:00
Lauren Wehrmeister
0cfa06b22b Merge changes from topic "bk/errata_refactor" into integration
* changes:
  feat(cpus): wrappers to propagate AArch32 errata info
  feat(cpus): add a way to automatically report errata
  feat(cpus): add a concise way to implement AArch64 errata
  refactor(cpus): convert print_errata_status to C
  refactor(cpus): rename errata_report.h to errata.h
  refactor(cpus): move cpu_ops field defines to a header
2023-05-31 23:06:53 +02:00
Christophe Kerello
da7a33cf2f fix(spi-nand): add Quad Enable management
The framework currently supports QE feature only for Macronix devices.
Kioxia devices also support this feature, but this feature can not be
set based on the manufacturer ID as Kioxia first SPI NAND generation
does not support the QE feature when the second generation does.

Use a flag to manage QE feature. This flag will be added at board level
to manage the device.

Change-Id: I7a3683a2df8739967b17b4abbec32c51bf206b93
Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
2023-05-31 18:03:28 +02:00
Jimmy Brisson
b85bcb8ec9 fix(measured-boot): don't strip last non-0 char
With the current implementation of stripping the last null
byte from a string, there was no way to get the TF-M measured
boot test suite to pass. It would expect the size of the string
passed into extend measurement to be unaffected by the call.

This fix should allow passing a string with the null char
pre-stripped, allowing the tests to exclude the null char in
their test data and not have the length decremented.

Further, This patch adds an early exit if either the version
or sw_type is larger than its buffer. Without this check,
it may be possible to pass a length one more than the maximum,
and if the last element is a null, the length will be truncated
to fit. This is instead suppsed to return an error.

Signed-off-by: Jimmy Brisson <jimmy.brisson@arm.com>
Change-Id: I98e1bb53345574d4645513009883c6e7b6612531
2023-05-31 16:40:43 +02:00
Olivier Deprez
a0a4bf488d Merge "feat: define memory ranges for tc platform" into integration 2023-05-31 09:40:43 +02:00
Gabriel Fernandez
1bbcb58a69 fix(st-clock): disabling CKPER clock is not functional on stm32mp13
The mask used to configure the CKPER MUX was wrong and unnecessary.

Change-Id: I40098f2a27b9e5ba8706ab5377d23f578c09838b
Signed-off-by: Gabriel Fernandez <gabriel.fernandez@foss.st.com>
2023-05-30 15:39:50 +02:00
Yann Gautier
b156d7b1cc fix(st-uart): skip console flush if UART is disabled
Check the USART_CR1_UE bit and if it is 0, the UART is not enabled,
or not clocked (but the read won't freeze the bus and will return 0).
In this case skip the console flush.

Signed-off-by: Yann Gautier <yann.gautier@foss.st.com>
Change-Id: I5d1ef7e51612b4795e314b2f2da04a514b6c96a0
2023-05-30 15:39:50 +02:00
Yann Gautier
a9cb7d002d fix(st): flush UART at the end of uart_read()
Add a flush to ensure that the programmer get time to read the last
command sent.

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Change-Id: Ic1f718d2754f27945f12c04563663b46274810a7
2023-05-30 15:39:50 +02:00
Patrick Delaunay
2171bd9511 fix(stm32mp1): use the BSEC nodes compatible for stm32mp13
Device tree alignment with kernel and latest binding for BSEC node:
the rev2.0 is used on STM32MP13x devices with the new compatible
compatible = "st,stm32mp13-bsec".

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Change-Id: I76f86f2951eff4af91d22dfb926969fd842a36ce
2023-05-30 15:39:50 +02:00
Patrick Delaunay
85c2ea8fd3 fix(stm32mp13-fdts): correct the BSEC nodes compatible
Device tree alignment with kernel and latest binding for BSEC node:
the rev2.0 is used on STM32MP13x devices with the new compatible
compatible = "st,stm32mp13-bsec".

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Change-Id: I62c4090ae5d5c1de901e6df1e8ea5d1a3296a272
2023-05-30 15:39:50 +02:00
Yann Gautier
f351f9110f fix(stm32mp1-fdts): move /omit-if-no-ref/ to overlay files
To keep (as much as possible) alignment with Linux DT, move the
/omit-if-no-ref/ keywords to DT overlay files (fdts/stm32mp1*-bl*.dtsi).
This also ease checks for ST tools.

Signed-off-by: Yann Gautier <yann.gautier@foss.st.com>
Change-Id: Ib467a6b65f05a84c9678799ad32e1820249b4ed1
2023-05-30 15:39:50 +02:00
Yann Gautier
241f874545 fix(stm32mp1): properly check PSCI functions return
The psci_get_pstate_* helpers return unsigned int values,
update the code accordingly. Remove the useless pstate variable.
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.

Change-Id: Idc7e756f4ba2bc0d66a327763013f77f86fe16b2
Signed-off-by: Yann Gautier <yann.gautier@st.com>
2023-05-30 15:39:50 +02:00
Madhukar Pappireddy
3f52d599f4 Merge "docs: fix syntax error in note" into integration 2023-05-30 15:08:09 +02:00
Harrison Mutai
15889d1332 chore: rename Makalu to Cortex-A715
Change-Id: I017c955cb643e2befb6b01e1b5a07c22172b08b9
Signed-off-by: Harrison Mutai <harrison.mutai@arm.com>
2023-05-30 09:52:14 +01:00
Boyan Karatotev
34c51f327d feat(cpus): wrappers to propagate AArch32 errata info
AArch32 is not being ported to the errata framework. However, the
runtime errata list is needed at runtime for the upcoming errata ABI.
Add wrappers to populate this information and make it accessible in the
same way as AArch64.

Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
Change-Id: I084720f34d6ed4e00e94b09babd3c90a5393298a
2023-05-30 09:31:15 +01:00
Boyan Karatotev
4f748cc44c feat(cpus): add a way to automatically report errata
Using the errata framework per-cpu data structure, errata can all be
reported automatically through a single standard errata reporter which
can replace the cpu-specific ones.

This reporter can also enforce the ordering requirement of errata.

Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
Change-Id: I7d2d5ac5bcb9d21aed0d560d7d23919a323ffdab
2023-05-30 09:31:15 +01:00
Boyan Karatotev
3f4c1e1e7b feat(cpus): add a concise way to implement AArch64 errata
Errata implementation involves adding a lot of boilerplate to random
places with just conventions on how to do them. Copy pasting is the
usual method for doing this. The result is an error-prone and verbose
patch that is a nightmare to get through review.

Errata workarounds have a very large degree of similarity - most of them
involve setting a bit at reset. As such most of the boilerplate is not
strictly necessary. To solve this, add a collection of assembly macros
to wrap errata implementations such that only the actual mitigations
need to be written. A new erratum mitigation looks something like:

  workaround_reset_start cortex_a77, ERRATUM(1925769), ERRATA_A77_1925769
    sysreg_bit_set CORTEX_A77_CPUECTLR_EL1, CORTEX_A77_CPUECTLR_EL1_BIT_8
  workaround_reset_end cortex_a77, ERRATUM(1925769)

  check_erratum_ls cortex_a77, ERRATUM(1925769), CPU_REV(1, 1)

Note, that the long comment on every mitigation is missing. This is on
purpose, as this new format includes all of its contents into an easily
readable format.

The workaround wrappers add an erratum entry (24 bytes) to a per-cpu
data structure which can then be read by a standard reset function to
apply all errata automatically. This has the added benefit of collecting
all errata TF-A knows about in a central way, which was previously
missing. This can then be used at runtime with the errata ABI.

If an erratum doesn't fit this standard definition (eg. the
CVE_2022_23960), it can progressively be unwrapped to the old
convention. The only differences are that the naming format is slightly
more verbose and a call to add_erratum_entry is needed to inform the
framework about the errata.

Finally, the internal workaround names change a tiny bit, especially
CVEs.

Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
Change-Id: Iac644f85dcf85b8279b25e83baf1e7d08b253b16
2023-05-30 09:31:15 +01:00