Commit graph

12224 commits

Author SHA1 Message Date
Chen Baozi
226f4c8e35 feat(qemu): add "neoverse-n1" cpu support
Add support to qemu "neoverse-n1" cpu for "qemu_sbsa" ('sbsa-ref')
platform.

Signed-off-by: Chen Baozi <chenbaozi@phytium.com.cn>
Change-Id: I4620e879c71115451ae91a1643812d89ec7c071f
2023-03-12 22:37:12 +08:00
Chen Baozi
af994ae8a0 feat(qemu): make coherent memory section optional
Since CPUs such as cortex-a76 are hardware-assisted coherent, coherent
memory section is not required for them and should be an optional
section.

Signed-off-by: Chen Baozi <chenbaozi@phytium.com.cn>
Change-Id: I03c8e9148ca1780b8af92024359698f4452f7129
2023-03-12 21:08:08 +08:00
Chen Baozi
a12cb77c82 refactor(qemu): make use of setup_page_tables()
Use the setup_page_tables() helper function to setup page tables.

Signed-off-by: Chen Baozi <chenbaozi@phytium.com.cn>
Change-Id: I0bca4e463ed68abf2ef1c79fc8e5cb2b635fcd1c
2023-03-12 20:50:43 +08:00
Varun Wadekar
ff65ac2440 Merge "fix(tegra210): support legacy SMC_ID 0xC2FEFE00" into integration 2023-03-10 17:28:10 +01:00
Manish V Badarkhe
77844a8df1 Merge "docs: add guidelines for thirdparty includes" into integration 2023-03-10 12:35:05 +01:00
Joanna Farley
3dff98ab40 Merge changes from topic "xlnx_ipi_fix" into integration
* changes:
  fix(xilinx): handle CRC failure in IPI callback
  fix(xilinx): handle CRC failure in IPI
2023-03-10 10:11:24 +01:00
Sona Mathew
f1c3eae9e0 fix(cpus): workaround for Neoverse V1 errata 2743233
Neoverse V1 erratum 2743233 is a Cat B erratum that applies to
all revisions <= r1p2 and is still open.

The workaround sets CPUACTLR5_EL1[56:55] to 2'b01.

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

Change-Id: If51a6f4293fa8b5b35c44edd564ebb715ba309a1
Signed-off-by: Sona Mathew <SonaRebecca.Mathew@arm.com>
2023-03-09 14:09:37 -06:00
Kalyani Chidambaram Vaidyanathan
40a4e2d84c fix(tegra210): support legacy SMC_ID 0xC2FEFE00
This patch introduces a workaround to support the legacy SMC FID
0xC2FEFE00 to maintain compatibility with older software components.

Change-Id: Icf2ef9cfa6b28c09bbab325a642d0b3b20b23535
Signed-off-by: Kalyani Chidambaram Vaidyanathan <kalyanic@nvidia.com>
2023-03-09 21:59:52 +02:00
Varun Wadekar
33c476601c fix(tegra): append major revision to the chip_id value
This patch appends the chip's major revision to the chip id value
to form the SoC version value expected by the SMCCC_GET_SOC_VERSION
function ID.

Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
Change-Id: I09118f446f6b8198588826d4a161bd97dcb6a581
2023-03-09 19:58:05 +00:00
Olivier Deprez
4121a2c320 Merge "feat(spmd): fail safe if SPM fails to initialize" into integration 2023-03-09 17:44:24 +01:00
Madhukar Pappireddy
5864b58afc Merge changes from topic "imx8m_misc_changes" into integration
* changes:
  feat(imx8mq): enable dram dvfs support on imx8mq
  feat(imx8m): use non-fast wakeup stop mode for system suspend
  feat(imx8mq): correct the slot ack setting for STOP mode
  feat(imx8mq): add anamix pll override setting for DSM mode
  feat(imx8mq): add workaround code for ERR11171 on imx8mq
  feat(imx8mq): add the dram retention support for imx8mq
  feat(imx8mq): add version for B2
  fix(imx8m): backup mr12/14 value from lpddr4 chip
  fix(imx8m): add ddr4 dvfs sw workaround for ERR050712
  fix(imx8m): fix coverity out of bound access issue
  fix(imx8m): fix the dram retention random hang on some imx8mq Rev2.0
  feat(imx8m): add more dram pll setting
  fix(imx8m): fix the current fsp init
  fix(imx8m): fix the rank to rank space issue
  fix(imx8m): fix the dfiphymaster setting after dvfs
  feat(imx8m): update the ddr4 dvfs flow to include ddr3l support
  fix(imx8m): correct the rank info get fro mstr
  feat(imx8m): fix the ddr4 dvfs random hang on imx8m
2023-03-09 15:46:36 +01:00
Madhukar Pappireddy
7ca8b585a9 Merge changes from topic "errata" into integration
* changes:
  fix(cpus): workaround for Cortex-A78C erratum 2779484
  fix(cpus): workaround for Cortex-A78 erratum 2742426
2023-03-09 15:44:06 +01:00
Elyes Haouas
9a90d720b8 style: remove useless trailing semicolon and line continuations
found using checkpatch.pl[1]

[1]: https://review.coreboot.org/plugins/gitiles/coreboot/+/refs/heads/master/util/lint/checkpatch.pl

Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Change-Id: I7957c9694300fefb85d11f7819c43af95271f14c
2023-03-09 14:59:08 +01:00
Manish V Badarkhe
1fc7106ce1 Merge "docs(drtm): mention DRTM_SUPPORT as an experimental build option" into integration 2023-03-09 11:55:04 +01:00
Naman Trivedi Manojbhai
6173d914d6 fix(xilinx): handle CRC failure in IPI callback
Currently, if CRC validation fails during IPI communication,
pm_ipi_buff_read_callb() logs error message but don't return
error code to upper layers.

Added CRC failure specific error code which will be returned by
pm_ipi_buff_read_callb() if CRC validation fails.

Signed-off-by: Naman Trivedi Manojbhai <naman.trivedimanojbhai@amd.com>
Change-Id: I2eaca073e2bf325a8c86b1820bdd7cca487b783e
2023-03-09 15:05:37 +05:30
Naman Trivedi Manojbhai
5e92be5121 fix(xilinx): handle CRC failure in IPI
Currently, if CRC validation fails during IPI communication,
pm_ipi_buff_read() logs error message but don't return error
code to upper layers.

Added CRC failure specific error code which will be returned by
pm_ipi_buff_read() if CRC validation fails.

Signed-off-by: Naman Trivedi Manojbhai <naman.trivedimanojbhai@amd.com>
Change-Id: I33be330f276973471f4ce4115d1e1609ed8fb754
2023-03-09 15:03:50 +05:30
Olivier Deprez
0d33649e3e feat(spmd): fail safe if SPM fails to initialize
The spmd_setup function is made fail safe in that a failure in the
SPMC manifest parsing, SPMD or SPMC initialization returns a success
code to the standard services initialization routine (std_svc_setup).
This permits continuing the boot process and initialize services
beyond the SPMD to succeed for the system to operate in the normal
world. It operates in a degraded mode for the secure world.

Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
Change-Id: Ida0ac91c17925279a79f112d190f9ad038f518e7
2023-03-09 09:33:28 +01:00
Bipin Ravi
66bf3ba482 fix(cpus): workaround for Cortex-A78C erratum 2779484
Cortex-A78C erratum 2779484 is a Cat B erratum that applies to
revisions r0p1 and r0p2 and is still open.

The workaround is to set the CPUACTLR3_EL1[47] bit to 1. Setting this
bit might have a small impact on power and negligible impact on
performance.

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

Signed-off-by: Bipin Ravi <bipin.ravi@arm.com>
Change-Id: I9a8c16a845c3ba6eb2f17a5119aa6ca09a0d27ed
2023-03-08 22:00:14 +01:00
Bipin Ravi
a63332c517 fix(cpus): workaround for Cortex-A78 erratum 2742426
Cortex-A78 erratum 2742426 is a Cat B erratum that applies to
all revisions <= r1p2 and is still open.

The workaround is to set the CPUACTLR5_EL1[56:55] to 2'b01.

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

Signed-off-by: Bipin Ravi <bipin.ravi@arm.com>
Change-Id: I42506a87d41c9e2b30bc78c08d22f36e1f9635c1
2023-03-08 14:58:05 -06:00
Manish V Badarkhe
191aa5d3fc feat(fvp): copy the Event Log to TZC secured DRAM area
Copied the Event Log from internal SRAM to the TZC secured DRAM
reserved area. Also passed this Trusted DRAM address to OPTEE via
NT FW configuration, and to SPMC via TOS FW configuration,
which is eventually used to extend PCR via fTPM application running
on top of OPTEE/SPMC.

Furthermore, this patch makes it easier to access Event Log in RME
enabled systems where Secure World firmware does not have access to
internal(Root) SRAM.

Change-Id: I005e9da1e6075511f412bdf4d8b541fa543df9ab
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
2023-03-08 20:17:24 +00:00
Manish V Badarkhe
6b2e961fb1 feat(arm): carveout DRAM1 area for Event Log
Reserved 4KB area for Event Log in DRAM1. This area is used by BL2
to copy Event Log from internal SRAM to this carved out DRAM region
in the subsequent patch.

Change-Id: I7b405775c66d249e31edf7688d95770e6c05c175
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
2023-03-08 19:51:17 +00:00
laurenw-arm
1b0761130b test(tc): test for AP/RSS NV counter interface
Change in PLATFORM_TEST build flag from boolean -> string, with the
current string options being tfm-testsuite and rss-nv-counters.

To get the old behavior, i.e. where we used to use PLATFORM_TEST=1,
we now need to pass PLATFORM_TEST=tfm-testsuite.

Adding new test of the AP/RSS interface for non-volatile counters.
The test reads, increments, and reads again each 3 types of NV
counters for: CCA, secure, and non-secure firmware. Enabled by
PLATFORM_TEST=rss-nv-counters.

Change-Id: I2044cc9b2f37984697e0754c9c824eab51a11e7f
Signed-off-by: Lauren Wehrmeister <lauren.wehrmeister@arm.com>
Signed-off-by: Raef Coles <raef.coles@arm.com>
2023-03-08 12:05:06 -06:00
Govindraj Raja
9babfab479 docs: add guidelines for thirdparty includes
Currently there is no guidelines in docs for including thirdparty
includes, trying to address that with a proposed method to use third
party includes.

Change-Id: Ieec7a5c88a60b66ca72228741ba1894545130a06
Signed-off-by: Govindraj Raja <govindraj.raja@arm.com>
2023-03-08 15:00:23 +00:00
Manish V Badarkhe
1035e3a87a Merge "fix(tc): change the FIP offset to 8 KiB boundary" into integration 2023-03-08 14:57:00 +01:00
Tintu Thomas
d07b8aac39 fix(tc): change the FIP offset to 8 KiB boundary
* This change overrides the default PLAT_ARM_FIP_OFFSET_IN_GPT

* This aligns the FIP base in GPT image to the RSS ATU page size
  boundary (8 KiB). RSS XIP feature requires the FIP to be aligned to
  the page size boundary. TC platform will require the XIP feature.

* The aligned FIP_A is starting at sector 48. Hence the offset will be
  48*512 = 0x6000.

Signed-off-by: Tintu Thomas <tintu.thomas@arm.com>
Change-Id: I8135ecd4168231847c80151c33ef8353a1586b9a
2023-03-08 15:48:30 +02:00
Andrew Davis
9977948112 fix(ti): do not take system power reference in bl31_platform_setup()
Taking a reference at this early stage can cause boot failure if the DM
firmware is not fully initialized. Remove this early call until the
fix in DM firmware is widely available.

Signed-off-by: Andrew Davis <afd@ti.com>
Change-Id: Ic9c47ccf1e9a1b9faeb1c7d2665d54cf55ef5396
2023-03-07 09:22:32 -06:00
AlexeiFedorov
d7c455d8cc fix(pmu): switch FVP PMUv3 SPIs to PPI
FVP PMUv3 SPIs legacy interrupts are only listed for
cluster #0 and are missing for cluster #1.
This patch changes FVP SPIs to PMUv3 PPI as in
arm_fpga.dtsi, morello.dtsi and n1sdp.dtsi.

Signed-off-by: AlexeiFedorov <Alexei.Fedorov@arm.com>
Change-Id: Ic624cec09ba932666c746ae1a6a4b78b6decde96
2023-03-07 13:34:45 +00:00
Belsare, Akshay
2b932f83db docs(zynqmp): add ddr address usage
Update documentation for TF-A DDR address range usage when the FSBL is
run on RPU instead of APU.

Change-Id: I223d67c35ac9ce3384820531a7453d3b32a1eb58
Signed-off-by: Akshay Belsare <akshay.belsare@amd.com>
2023-03-07 10:28:11 +05:30
Sandrine Bailleux
2b7150b381 Merge "docs: discourage usage of weak functions" into integration 2023-03-06 20:38:28 +01:00
Sandrine Bailleux
8a66597385 docs: discourage usage of weak functions
As a coding guideline, we now discourage introducing new weak
functions in platform-agnostic code going forward and provide the
rationale for this.

This was already enforced most of the time in code reviews but this
patch makes it explicit in the project's documentation.

Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
Change-Id: I88f4a55788899fb4146c4d26afb3a7418376b30c
2023-03-06 19:25:41 +01:00
David Vincze
dda052851a fix(rss): fix msg deserialization bugs in comms
-fix1: size of struct instead of pointer during reply_size check
-fix2: update the out_vec length with the actual length from reply
       message (e.g. in case of an output buffer, the returned output
       data length remained the size of the buffer and was not updated
       with the size of the actual data in it)

Change-Id: Ibed5520ca1fb05df358de4bdf85ace219183866c
Signed-off-by: David Vincze <david.vincze@arm.com>
2023-03-06 15:34:09 +01:00
Madhukar Pappireddy
48fb931536 Merge "docs(spm): add other-s-interrupts-action field to sp manifest" into integration 2023-03-06 15:09:27 +01:00
Joanna Farley
5673160717 Merge "fix(zynqmp): conditional reservation of memory in DTB" into integration 2023-03-06 13:33:39 +01:00
Akshay Belsare
c52a142b7c fix(zynqmp): conditional reservation of memory in DTB
When the TF-A is placed in DDR memory range, the DDR memory range is
getting explicitly reserved in the default device tree by TF-A.
This creates an error condition in the use case where Device tree is
not present or it is present at a different location.

To fix this, a new build time parameter, XILINX_OF_BOARD_DTB_ADDR, is
introduced. The TF-A will reserve the DDR memory only when a valid
DTB address is provided to XILINX_OF_BOARD_DTB_ADDR during build.

Now the user has options, either manually reserve the desired
DDR address range for TF-A in device tree or let TF-A access and modify
the device tree, to reserve the DDR address range, in runtime using
the build parameter.

Change-Id: I846fa373ba9f7c984eda3a55ccaaa622082cad81
Signed-off-by: Akshay Belsare <akshay.belsare@amd.com>
2023-03-06 12:11:56 +01:00
Manish V Badarkhe
88844f6de2 Merge "fix(mbedtls): fix mbedtls coverity issues" into integration 2023-03-03 10:54:43 +01:00
Sandrine Bailleux
d26cb4f46e Merge "refactor(auth): use a single function for parsing extensions" into integration 2023-03-03 08:39:16 +01:00
Demi Marie Obenour
a987b89dab refactor(auth): use a single function for parsing extensions
Previously, extensions were parsed twice: once with error checking for
validation, and a second time without error checking to extract the
extension data.  This is error prone and caused TFV-10 (CVE-2022-47630).

A simpler approach is to have get_ext() be responsible for all extension
parsing, and to treat a NULL OID as an indicator that get_ext() is only
being called for validation.  cert_parse() checks that get_ext() returns
IMG_PARSER_OK and fails otherwise.

Change-Id: I65a2ff053a188351ba54799827a2b7bd833bb037
Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
2023-03-02 11:48:43 -05:00
Joanna Farley
74c4ae9cce Merge "fix(docs): add plantuml as a dependency" into integration 2023-03-02 16:48:28 +01:00
Manish Pandey
7cd2e3c972 Merge "fix(cpufeat): resolve build errors due to compiler optimization" into integration 2023-03-02 11:37:12 +01:00
Jayanth Dodderi Chidanand
e8f0dd58da fix(cpufeat): resolve build errors due to compiler optimization
Currently most of the architectural feature build flags are set
to 2(FEATURE_STATE_CHECK) for fvp platform only.

However other platforms still configure them by default to 0, which
would lead to build failures in cases when compiler configured
to build TF-A  with zero optimization (CFLAGS='-O0').

This patch addresses such build issues and thereby resolves the failures
seen under CI-l3 test_configurations.

Change-Id: I45b82b821951bba6b9df08177f7d286e624a4239
Signed-off-by: Jayanth Dodderi Chidanand <jayanthdodderi.chidanand@arm.com>
2023-03-01 17:54:07 +01:00
Govindraj Raja
a9edc32c89 fix(mbedtls): fix mbedtls coverity issues
commit (a8eadc51a refactor(mbedtls): avoid including
MBEDTLS_CONFIG_FILE) avoids using config file directly and relies on
config file usage from mbedtls version.h

But we could build trusted boot without mbedtls dir so guard version.h
include in cot_def.h with availability of config file.

Also we refactored in same commit to break dependencies between
auth_mod.h and cot_def.h, So add cot_def.h include in nxp tbbr
cot file.

Change-Id: I4779e90c18f04c73d2121c88df6420b4b1109c8b
Signed-off-by: Govindraj Raja <govindraj.raja@arm.com>
2023-03-01 12:51:43 +00:00
Jacky Bai
8962bdd603 feat(imx8mq): enable dram dvfs support on imx8mq
Enable DRAM DVFS support on i.MX8MQ.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Change-Id: Id72c5eb9625936052ec51e5a52d9d31175ed1b1b
2023-03-01 10:18:03 +08:00
Jacky Bai
ef4e5f0f10 feat(imx8m): use non-fast wakeup stop mode for system suspend
Use non-fast wakeup stop mode for system suspend support, so
the SOC can enter DSM mode by default.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Change-Id: I37828d4e66ee2ebd48e7adca054b93c520cb2c82
2023-03-01 10:18:03 +08:00
Jacky Bai
724ac3e2c2 feat(imx8mq): correct the slot ack setting for STOP mode
A53 core's power up ack need to be used when system resume
from DSM mode.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Change-Id: I47fb33c0582ae5f483ffaa887f95e27bd47875f7
2023-03-01 10:18:03 +08:00
Jacky Bai
387a1df18e feat(imx8mq): add anamix pll override setting for DSM mode
Add the anamix PLL override setting for DSM mode support,
so that the PLL can be power down in DSM mode to save power.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Change-Id: Ibe954bc7c4a7b453ace13f8e4b6a335e6d4856c3
2023-03-01 10:18:03 +08:00
Jacky Bai
88a264657f feat(imx8mq): add workaround code for ERR11171 on imx8mq
This new workaround takes advantage of the per core IMR
registers in GPC in order to unmask the IRQ0, still generated
by the 12bit in IOMUX_GPR register (which now remains always set),
so it can only wake up one core at the time.Also, this entire
workaround has now been moved here in TF-A, allowing the kernel
side to be minimal.

Another advantage this workaround brings is the removal of the
50us delay (which was necessary before in gic_raise_softirq in
kernel) by allowing the core that is waking up to mask his own
IRQ0 in the suspend finish callback.

One important change here is the way the cores are woken up in
dram_dvfs_handler. Since the wake up mechanism has changed from
asserting the 12th bit in IOMUX_GPR and leaving the IMR1 1st bit
on for each core to exactly the reverse, that is, leaving the
IOMUX_GPR 12th bit always set and then masking/unmasking the IMR1
1st bit for each independent core, we need to use the imx_gpc_core_wake
to wake up the cores.

Also, the 50us udelay is moved to TF-A (inside imx_pwr_domain_off)
from kernel(gic_raise_softirq), since the new cpuidle workaround
does not need it in order to clean the IOMUX_GPC 12bit. For now,
the udelay seems to be still needed in order to delay the affinity
info OFF for the dying core. This is something that needs further
investigation.

Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Change-Id: I9f17ff6fc3452b8225a50b232964712aafeab78a
2023-03-01 10:18:03 +08:00
Jacky Bai
dd108c3c1f feat(imx8mq): add the dram retention support for imx8mq
Add the dram retention support for i.MX8MQ. As there is
no enough ocram space available before entering TF-A,
so the timing info need to be copied from dram into ocram.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Change-Id: Id8264c342fd62e297b1969cba5ed505450c78a25
2023-03-01 10:18:03 +08:00
Ye Li
99475c5dcc feat(imx8mq): add version for B2
iMX8MQ B2 chip uses same OCOTP magic value with B1. So
read the ROM version to distinguish it with B1.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Jacky Bai <ping.bai@nxp.com>
Change-Id: I3e6865922deeb66816a0dddb49d986405e802b6f
2023-03-01 10:18:03 +08:00
Jacky Bai
a2655f4869 fix(imx8m): backup mr12/14 value from lpddr4 chip
Backup the mr12/14 value as the actual value used is not the
one we configured in the ddrc config timing.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
Change-Id: If04733b34a3b4c080828bb7c82e83f0badbeaafd
2023-03-01 10:03:37 +08:00
Soby Mathew
55d5c6a16a Merge "fix(rme): update sample platform attestation token" into integration 2023-02-28 17:41:41 +01:00