Commit graph

12224 commits

Author SHA1 Message Date
Manish Pandey
b4fc04103e Merge changes from topic "feat_state_part2" into integration
* changes:
  refactor(trf): enable FEAT_TRF for FEAT_STATE_CHECKED
  refactor(brbe): enable FEAT_BRBE for FEAT_STATE_CHECKED
  refactor(trbe): enable FEAT_TRBE for FEAT_STATE_CHECKED
  fix(cpufeat): context-switch: move FGT availability check to callers
  feat(cpufeat): extend check_feature() to deal with min/max
  refactor(cpufeat): wrap CPU ID register field isolation
2023-02-28 11:40:54 +01:00
Sandrine Bailleux
8d48bc8646 Merge changes Ia19c6678,I44baaa47 into integration
* changes:
  refactor(auth): clean up certificate length checks
  refactor(auth): remove code duplication
2023-02-28 09:42:51 +01:00
Jacky Bai
e00fe11df3 fix(imx8m): add ddr4 dvfs sw workaround for ERR050712
APB Write data corruption following MRCTRL0.mr_wr=1 while
hardware-driven MR access is occurring

When performing a software driven MR access, the following
sequence must be done automatically before performing other
APB register accesses:

1. Set MRCTRL0.mr_wr=1
2. Check for MRSTAT.mr_wr_busy=0. If not, go to step (2)
3. Check for MRSTAT.mr_wr_busy=0 again (for the second time),
   if not, go to step (2).

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
Change-Id: Ie26e08bcc83d3ed4844ed04a853162308dcdccd0
2023-02-28 14:27:28 +08:00
Jacky Bai
0331b1c611 fix(imx8m): fix coverity out of bound access issue
Fix the out of bound access to the rank setting array.

Fix Coverity issue:

CID 6474575: Out-of-bounds access (OVERRUN)
CID 11014855: Unused value (UNUSED_VALUE)

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
Change-Id: I5d9ef90f1479e5d46d1b6c8693a27e3abd614766
2023-02-28 14:27:24 +08:00
Jacky Bai
4bf5019228 fix(imx8m): fix the dram retention random hang on some imx8mq Rev2.0
It seems the DRAM APB clock root slice can NOT work normally
if the PLLs is power down in DSM mode. So update this clock
slice's setting explicitly to make it work. This piece of code
is there for a long while on previous release, so just add
it back to align with previous flow.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Anson Huang <Anson.Huang@nxp.com>
Change-Id: I113069494074194e116fdb1229052d2956bf90ea
2023-02-28 14:26:39 +08:00
Jacky Bai
4234b902ae feat(imx8m): add more dram pll setting
Add DRAM PLL frequency setting for 3200mts & 4000mts.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Anson Huang <anson.huang@nxp.com>
Change-Id: I4b0609f9e7c0f35d75a26ec9ccebec77b3dbe68f
2023-02-28 14:26:39 +08:00
Jacky Bai
25c43233e8 fix(imx8m): fix the current fsp init
The dfimisc reg value should be shift right 8 bit to
get the current fsp.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Anson Huang <Anson.Huang@nxp.com>
Change-Id: I4c8c166bc3ad4cc1376961cbf47631c68b5900cc
2023-02-28 14:26:39 +08:00
Jacky Bai
3330084979 fix(imx8m): fix the rank to rank space issue
update umctl2's setting based on phy training CDD value
to workaround the rank-to-rank space issue.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Anson Huang <anson.huang@nxp.com>
Change-Id: I0fab18cdc378fda760daa0f89c4dd84eb46f7e11
2023-02-28 14:26:35 +08:00
Demi Marie Obenour
ddd9f6757e refactor(auth): clean up certificate length checks
The previous code was correct but unnecessarily verbose.

Change-Id: Ia19c667811a7c3b6957a0274d36076b0b16e36b7
Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
2023-02-27 14:08:28 -05:00
Demi Marie Obenour
6a7104a324 refactor(auth): remove code duplication
The unique IDs are handled identically, so just use a for loop to get
both of them.

Change-Id: I44baaa4747ca7f314d364a79dfcbce97315f5a92
Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
2023-02-27 14:08:28 -05:00
Andre Przywara
fc8d2d3980 refactor(trf): enable FEAT_TRF for FEAT_STATE_CHECKED
At the moment we only support FEAT_TRF to be either unconditionally
compiled in, or to be not supported at all.

Add support for runtime detection (ENABLE_TRF_FOR_NS=2), by splitting
is_feat_trf_present() into an ID register reading function and a second
function to report the support status. That function considers both
build time settings and runtime information (if needed), and is used
before we access TRF related registers.
Also move the context saving code from assembly to C, and use the new
is_feat_trf_supported() function to guard its execution.

The FVP platform decided to compile in support unconditionally (=1),
even though FEAT_TRF is an ARMv8.4 feature, so is not available with the
FVP model's default command line.
Change that to the now supported dynamic option (=2), so the right
decision can be made by the code at runtime.

Change-Id: Ia97b01adbe24970a4d837afd463dc5506b7295a3
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2023-02-27 18:04:14 +00:00
Andre Przywara
ff49103660 refactor(brbe): enable FEAT_BRBE for FEAT_STATE_CHECKED
At the moment we only support FEAT_BRBE to be either unconditionally
compiled in, or to be not supported at all.

Add support for runtime detection (ENABLE_BRBE_FOR_NS=2), by splitting
is_feat_brbe_present() into an ID register reading function and a second
function to report the support status. That function considers both
build time settings and runtime information (if needed), and is used
before we access BRBE related registers.

The FVP platform decided to compile in support unconditionally (=1),
even though FEAT_BRBE is an ARMv9 feature, so is not available with the
FVP model's default command line.
Change that to the now supported dynamic option (=2), so the right
decision can be made by the code at runtime.

Change-Id: I5f2e2c9648300f65f0fa9a5f8e2f34e73529d053
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2023-02-27 18:04:14 +00:00
Andre Przywara
f5360cfa81 refactor(trbe): enable FEAT_TRBE for FEAT_STATE_CHECKED
At the moment we only support FEAT_TRBE to be either unconditionally
compiled in, or to be not supported at all.

Add support for runtime detection (ENABLE_TRBE_FOR_NS=2), by splitting
is_feat_trbe_present() into an ID register reading function and a second
function to report the support status. That function considers both
build time settings and runtime information (if needed), and is used
before we access TRBE related registers.

The FVP platform decided to compile in support unconditionally (=1),
even though FEAT_TRBE is an ARMv9 feature, so is not available with the
FVP model's default command line.
Change that to the now supported dynamic option (=2), so the right
decision can be made by the code at runtime.

Change-Id: Iee7f88ea930119049543a8a4a105389997e7692c
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2023-02-27 18:04:14 +00:00
Andre Przywara
de8c489247 fix(cpufeat): context-switch: move FGT availability check to callers
To be inline with other features, and to allow the availability to be
checked for different contexts, move the FGT availability check out of
the save/restore functions. This is instead now checked at the caller.

Change-Id: I96e0638714f9d1b6fdadc1cb989cbd33bd48b1f6
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2023-02-27 18:04:14 +00:00
Andre Przywara
a4cccb4f6c feat(cpufeat): extend check_feature() to deal with min/max
So far the check_feature() function compares the subfield of a CPU ID
register against 0, to learn if a feature is enabled or not.
This is problematic for checks that require a certain revision of a
feature, so we should check against a minimum version number instead.
On top of that we might need to add code to support newer versions of a
feature, so we should be alerted if new hardware introduces a higher
number.

Extend the check_feature() function to take two extra arguments: the
minimum version, and the greatest currently known number.
Then make sure that the CPU ID field is in this range.

Change-Id: I425b68535a2ba9eafd31854e74d142183b521cd5
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2023-02-27 18:04:14 +00:00
Andre Przywara
fd1dd4cb2c refactor(cpufeat): wrap CPU ID register field isolation
Some MISRA test complains about our code to isolate CPU ID register
fields: the ID registers (and associated masks) are 64 bits wide, but
the eventual field is always 4 bits wide only, so we use an unsigned
int to represent that. MISRA dislikes the differing width here.

Since the code to extract a feature field from a CPU ID register is very
schematic already, provide a wrapper macro to make this more readable,
and do the proper casting in one central place on the way.

While at it, use the same macro for the AArch32 feature detection side.

Change-Id: Ie102a9e7007a386f5879ec65e159ff041504a4ee
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2023-02-27 18:04:14 +00:00
Madhukar Pappireddy
55a328305a Merge changes I960771e6,I291dc627,I57f31664 into integration
* changes:
  fix(ufs): set the PRDT length field properly
  fix(ufs): flush the entire PRDT
  fix(ufs): only allow using one slot
2023-02-27 16:59:56 +01:00
Manish V Badarkhe
766d78b1cf Merge changes from topic "mbedtls3_support" into integration
* changes:
  feat(stm32mp1): add mbedtls-3.3 support config
  refactor(fvp): minor cleanup with TRUSTED_BOARD_BOOT
  style(crypto): add braces for if statement
  feat(fvp): increase BL1_RW and BL2 size
  feat(mbedtls): add support for mbedtls-3.3
  refactor(crypto): avoid using struct mbedtls_pk_rsassa_pss_options
  refactor(mbedtls): avoid including MBEDTLS_CONFIG_FILE
2023-02-27 16:32:21 +01:00
Boyan Karatotev
65982a94ef fix(docs): add plantuml as a dependency
This wasn't listed on the web interface configuration. Perhaps it came
preloaded. Anyway, it's needed for diagrams. Add it back.

Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
Change-Id: I20c1eb0e8d5abaa3533169dd9704cbd3b0eb06a5
2023-02-27 15:01:58 +00:00
Joanna Farley
78b5ef6b79 Merge "revert(zynqmp): remove EM SMC handler" into integration 2023-02-27 14:20:08 +01:00
Govindraj Raja
c9498c8f56 feat(stm32mp1): add mbedtls-3.3 support config
Add stm32mp1_mbedtls_config-3.h config file for stm32mp1 builds with
mbedtls-3.3

Change-Id: I4581cb0ea7b2c7022e71aefd7ff05ee3a72f5883
Signed-off-by: Govindraj Raja <govindraj.raja@arm.com>
2023-02-27 15:17:21 +02:00
Michal Simek
82b7038405 revert(zynqmp): remove EM SMC handler
EM support was out of SMC SIP range that's why has been moved to SIP
range 0x3000 by commit acbae3998b ("fix(zynqmp): move EM SMC range
to SIP range").
But after another investigation was found that this interface has no
user in any our SW and likely never adopted by anybody else. That's
why simply remove it. If there is any user it can be added back but
as TF-A size is challenging removing unused code is very welcome.
Origin code was added by commit 504925f99d ("xilinx: zynqmp: Add
support for Error Management").

Change-Id: I2d9222d7dde507400893e06f7f12e1713ce6bc9a
Signed-off-by: Michal Simek <michal.simek@amd.com>
2023-02-27 11:20:08 +01:00
Jacky Bai
ad0cbbf513 fix(imx8m): fix the dfiphymaster setting after dvfs
the dfi phy master setting need to be save/restore to make
sure it aligned with the initial config.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Anson Huang <anson.huang@nxp.com>
Change-Id: I4f572b9aff9cc47a6c28524ce0fe03cdc66b88a1
2023-02-27 11:23:44 +08:00
Jacky Bai
0e39488ff3 feat(imx8m): update the ddr4 dvfs flow to include ddr3l support
the DDR3L & DDR4 can share same piece of code for DDR frequency scaling.
So update the ddr4 dvfs flow to support DDR3L too.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Anson Huang <anson.huang@nxp.com>
Change-Id: Ifc6981f05ed8a4e399adad97690197a9680f554d
2023-02-27 11:22:51 +08:00
Jacky Bai
5277c09606 fix(imx8m): correct the rank info get fro mstr
the bitfield of active_ranks in MSTR is defined as below.
Correct the rank num get in dram_info.

  0x01: one rank;
  0x11: two rank;

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Anson Huang <anson.huang@nxp.com>
Change-Id: Idcadb39f492a8fe81c973ac4136d9a1eaa32f54b
2023-02-27 11:21:32 +08:00
Jacky Bai
093888caaf feat(imx8m): fix the ddr4 dvfs random hang on imx8m
Remove the while loop waiting in step12 to align with what
we did before, just use a 'if' condition check for debug
purpose.

Tested-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Change-Id: Id2685c5f628270a24944470d675a5c8706f39f13
2023-02-27 11:20:23 +08:00
Jorge Troncoso
20fdbcf502 fix(ufs): set the PRDT length field properly
The PRDT length field contains the count of the entries in the PRDT. See
JEDEC Standard No. 223E, section 6.1.1, "UTP Transfer Request
Descriptor," page 66. Previously we were setting the PRDT length field
to the number of bytes in the PRDT divided by four (the size in units of
32 bits). This was incorrect according to the spec.

Signed-off-by: Jorge Troncoso <jatron@google.com>
Change-Id: I960771e6ce57002872392993042fae9ec505447e
2023-02-25 06:32:44 -08:00
Jorge Troncoso
83ef8698f9 fix(ufs): flush the entire PRDT
Previously, if the image being read exceeded 12,800 KB (or 50 PRDT
entries of size 256 KB), the UFS driver would not flush the entire
Physical Region Descriptor Table (PRDT). This would cause the UFS host
controller to read empty PRDT entries, which eventually would make the
system crash. This change updates the UFS driver to flush the entire
PRDT, irrespective of the size of the image being read.

This change also throws an error if the memory allocated for UFS
descriptors is not sufficient to hold the entire Physical Region
Descriptor Table (PRDT).

Signed-off-by: Jorge Troncoso <jatron@google.com>
Change-Id: I291dc62748992481be3cc156ce1474a6e3990ea9
2023-02-25 06:32:43 -08:00
Jorge Troncoso
56db7b8b08 fix(ufs): only allow using one slot
Currently the UFS driver places the Command UPIU, Response UPIU, and
PRDT immediately after the UTP Transfer Request Descriptor. This space
would normally be reserved for other slots in the UTP Transfer Request
List, but because we always use slot zero, the other slots in the UTP
Transfer Request List are never used and this is okay.

Because the Command UPIU, Response UPIU, and PRDT are placed inside the
UTP Transfer Request List, the UFS driver would break if two or more
slots were used at the same time. Therefore, in a sense the
get_empty_slot() function is misleading. It gives developers the
illusion that they can use two or more slots simultaneously but in
reality they cannot.

This change deletes the get_empty_slot() function and replaces it with
is_slot_available() so that only one slot can be used.

Signed-off-by: Jorge Troncoso <jatron@google.com>
Change-Id: I57f316640a1cdd56493505ede61f3012ceb2f305
2023-02-25 06:32:43 -08:00
Joanna Farley
3d2da6f5d3 Merge "feat(zynqmp): add hooks for mmap and early setup" into integration 2023-02-25 01:15:09 +01:00
Mate Toth-Pal
19c1dcef88 fix(rme): update sample platform attestation token
Update FVP platform attestation token to comply with RMM Beta0
specification. The changes are:
- change platform implementation id claim value from 64 to 32 bits
- change Realm Challenge
- update Hash Algorithm Identifier claim value
- add protected header
- change signing algotithm to ECDSA ES384

Change-Id: I1c5907d1a4961ce08a1408d25128de125b3f2e7f
Signed-off-by: Mate Toth-Pal <mate.toth-pal@arm.com>
2023-02-24 16:22:04 +01:00
Sandrine Bailleux
295f0d8498 Merge "feat(build): allow additional CFLAGS for library build" into integration 2023-02-24 15:17:10 +01:00
Amit Nagal
7013400084 feat(zynqmp): add hooks for mmap and early setup
Add early setup hooks (via custom_early_setup()) and provide a way
to cover custom memory mapping which includes extending memory map
via custom_mmap_add().

This likely also require to align MAX_XLAT_TABLE, MAX_XLAT_TABLES
macros. It can be done for example by defining these macros in
custom_pkg.mk
MAX_MMAP_REGIONS	:= XY
$(eval $(call add_define,MAX_MMAP_REGIONS))
MAX_XLAT_TABLES		:= XZ
$(eval $(call add_define,MAX_XLAT_TABLES))

custom_early_setup() can be used for early low level operations
related to setting up the system to correct state.

Signed-off-by: Amit Nagal <amit.nagal@amd.com>
Change-Id: I61df6f9ba5af0bc97c430974fb10a2edde44f23d
2023-02-24 11:27:32 +05:30
Bipin Ravi
dc2b8e8028 Merge changes from topic "panic_cleanup" into integration
* changes:
  refactor(bl31): use elx_panic for sysreg_handler64
  refactor(aarch64): rename do_panic and el3_panic
  refactor(aarch64): remove weak links to el3_panic
  refactor(aarch64): refactor usage of elx_panic
  refactor(aarch64): cleanup HANDLE_EA_EL3_FIRST_NS usage
2023-02-23 23:38:26 +01:00
Madhukar Pappireddy
66a387d437 Merge "fix: remove useless "return" at void functions" into integration 2023-02-23 21:26:24 +01:00
Joanna Farley
b48b921b08 Merge "fix(zynqmp): add bitmask for get_op_char API" into integration 2023-02-23 18:23:44 +01:00
Govindraj Raja
17d07a552b refactor(bl31): use elx_panic for sysreg_handler64
When we reach sysreg_handler64 from any trap handling we are entering
this path from lower EL and thus we should be calling lower_el_panic
reporting mechanism to print panic report.

Make report_elx_panic available through assembly func elx_panic which
could be used for reporting any lower_el_panic.

Change-Id: Ieb260cf20ea327a59db84198b2c6a6bfc9ca9537
Signed-off-by: Govindraj Raja <govindraj.raja@arm.com>
2023-02-22 17:24:17 +00:00
Madhukar Pappireddy
83a6798708 Merge "docs: add interrupts-target field to sp manifest" into integration 2023-02-22 17:46:22 +01:00
Ronak Jain
ad4b667d3b fix(zynqmp): add bitmask for get_op_char API
As per the current functionality, there are a couple of types like
PM_OPCHAR_TYPE_TEMP, PM_OPCHAR_TYPE_POWER and PM_OPCHAR_TYPE_LATENCY
for the PM_GET_OP_CHARACTERISTIC EEMI API which is mismatched across
the Versal and ZynqMP platforms.

So added the bitmask functionality for PM_GET_OP_CHARACTERISTIC API
in feature check in the firmware and as part of that the firmware fill
up payload[1] with the bitmask value of supported types of the
PM_GET_OP_CHARACTERISTIC EEMI API but from TF-A based on the current
codebase it is just returning the version. So filling up the bitmask
buffer which is received from the firmware and returned the same to
the user.

Signed-off-by: Ronak Jain <ronak.jain@amd.com>
Change-Id: I2c55f3e902a5f89eed899e99a97ad9b3f0a12796
2023-02-22 19:03:02 +05:30
Manish Pandey
338dbe2f1f Merge changes I51c13c52,I3358c51e into integration
* changes:
  build: always prefix section names with `.`
  build: communicate correct page size to linker
2023-02-22 13:19:01 +01:00
Manish Pandey
ba12668a65 Merge "feat(gicv3): enlarge the range for intr_num of structure interrupt_prop_t" into integration 2023-02-22 10:51:11 +01:00
Joanna Farley
e5ffd27f9b Merge "fix(zynqmp): panic w/o handoff structure in !JTAG" into integration 2023-02-22 10:47:41 +01:00
Joanna Farley
a6df28766e Merge "fix(zynqmp): move EM SMC range to SIP range" into integration 2023-02-22 10:44:20 +01:00
Madhukar Pappireddy
fa662cde20 Merge "fix(ufs): device present (DP) field is set to '1'" into integration 2023-02-21 22:34:33 +01:00
Govindraj Raja
bd62ce98d2 refactor(aarch64): rename do_panic and el3_panic
Current panic call invokes do_panic which calls el3_panic, but now panic
handles only panic from EL3 anid clear separation to use lower_el_panic()
which handles panic from lower ELs.

So now we can remove do_panic and just call el3_panic for all panics.

Change-Id: I739c69271b9fb15c1176050877a9b0c0394dc739
Signed-off-by: Govindraj Raja <govindraj.raja@arm.com>
2023-02-21 17:26:01 +00:00
Govindraj Raja
f300ef6628 refactor(aarch64): remove weak links to el3_panic
Cleanup weak links to el3_panic and restrict crash_reporting usage
to bl31.

Crash reporting is not used with bl1, bl2 and weak linkage to el3_panic
is used, this can cause ambiguity in understanding the code so remove
this weak linkage and introduce funcs that should be used when we have
crash reporting for el3 panics.

Change-Id: Ic5c711143ba36898ef9574a078b8fa02effceb12
Signed-off-by: Govindraj Raja <govindraj.raja@arm.com>
2023-02-21 17:26:01 +00:00
Govindraj Raja
7e619ecc89 refactor(aarch64): refactor usage of elx_panic
Currently we call el3_panic for panics from EL3 and elx_panic for
panics from lower ELs.

When we boot into a rich OS environment and interact with BL31 using
SMC/ABI calls and we can also decide to handle any lower EL panics in
EL3. Panic can occur in lower EL from rich OS or during SMC/ABI calls
after context switch to EL3.

But after booting into any rich OS we may land in panic either from
rich OS or while servicing any SMC call, here the logic to use
el3_panic or elx_panic is flawed as spsr_el3[3:0] is always EL3h
and end up in elx_panic even if panic occurred from EL3 during
SMC handling.

We try to decouple the elx_panic usage for its intended purpose,
introduce lower_el_panic which would call elx_panic, currently
lower_el_panic is called from default platform_ea_handle which
would be called due to panic from any of the lower ELs.

Also remove the weak linkage for elx_panic and rename it to
report_elx_panic which could be used with lower_el_panic.

Change-Id: I268bca89c01c60520d127ef6c7ba851460edc747
Signed-off-by: Govindraj Raja <govindraj.raja@arm.com>
2023-02-21 17:26:01 +00:00
Govindraj Raja
f4be868be9 refactor(aarch64): cleanup HANDLE_EA_EL3_FIRST_NS usage
Remove usage of HANDLE_EA_EL3_FIRST_NS in plat_default_ea_handler

Change-Id: I2bf4788960d20a090d66cf39c7bbbdea1d3243ca
Signed-off-by: Govindraj Raja <govindraj.raja@arm.com>
2023-02-21 17:26:01 +00:00
Madhukar Pappireddy
d8f006a26e Merge "fix(gicv3): fixed bug in the initialization of GICv3 SGIs/(E)PPIs interrupt priorities" into integration 2023-02-21 17:02:14 +01:00
Manish V Badarkhe
cd8f6af390 Merge changes I63b584cf,I617f3d41 into integration
* changes:
  refactor(el3_runtime): unify handle/enter_lower_el_async_ea
  refactor(el3_runtime): introduce save_x30 macro
2023-02-21 14:44:37 +01:00