Commit graph

13046 commits

Author SHA1 Message Date
Manish V Badarkhe
137d934dd9 docs(rss): update RSS doc for signer-ID
Added details about the API that calculates the signer-ID and updated
console log details to provide signer-ID information for each image.

Change-Id: If637b3719418e9c0b8d2844c92bddbdfe454bfb8
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
2023-07-28 09:01:15 +01:00
Manish V Badarkhe
b9bceef8ee feat(imx): add dummy 'plat_mboot_measure_key' function
Added dummy implementation of 'plat_mboot_measure_key'
function for IMX platform.

Change-Id: Ib41fd86a9da330f62561707bda7d16f2825c0a7f
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
2023-07-28 09:01:15 +01:00
Manish V Badarkhe
eee9fb02f7 feat(tc): implement platform function to measure and publish Public Key
Implemented 'plat_mboot_measure_key' platform function for TC platform
to measure and publicise the public key information via RSS.

Change-Id: I10d90e921b135e729d5450d5a7468d0598072e60
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
2023-07-28 09:01:15 +01:00
Manish V Badarkhe
9eaa5a09ed feat(auth): measure and publicise the Public Key
Once the Public Key has been verified, call 'plat_mboot_measure_key'
to measure and publicise it.

Change-Id: I46ea71dcbba96db3706602ccd89f22596ae68416
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
2023-07-28 09:01:15 +01:00
Manish V Badarkhe
db55d23d34 feat(fvp): implement platform function to measure and publish Public Key
Implemented 'plat_mboot_measure_key' platform function for FVP platform
to measure and publish the public key information via RSS.

Change-Id: I0c9d6d6ac3650a939437e9331ed3c9246f242830
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
2023-07-28 09:01:15 +01:00
Manish V Badarkhe
bfbb1cbaac feat(fvp): add public key-OID information in RSS metadata structure
Added public key-OID information in the RSS metadata structure.

Change-Id: I5ee5d41519980091296deaa1882fdfe9ae6766c0
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
2023-07-28 09:01:15 +01:00
Manish V Badarkhe
0cffcdd617 feat(auth): add explicit entries for key OIDs
Key-OIDs that authenticate BL31, BL31(SOC)-FW config, and HW config
images have been explicitly entered.
Implementations of signer-ID consume these entries.

Change-Id: I24c9085ed5f266af06d40fb73302e35d857a9d5b
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
2023-07-28 09:01:15 +01:00
Manish V Badarkhe
60861a04e0 feat(rss): set the signer-ID in the RSS metadata
Calculate a hash of the public key and put that into the signer-ID
field of the relevant RSS metadata. The signer-ID metadata is mandatory
in the Arm CCA attestation scheme.

Change-Id: Ic846d8bf882cfea8581d3523a3461c919462df30
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
2023-07-28 09:01:15 +01:00
Manish V Badarkhe
9505d03e36 feat(auth): create a zero-OID for Subject Public Key
Created an explicit zero-OID which can be used for Subject
Public Key that do not have their own key identifier.

With this, all keys (including the subject public key) have
a proper key OID string so we don't need to make a special
case of null pointers when it comes to handling key OIDs.

Change-Id: Ice6923951699b6e253d7fd87e4c1b912470e0391
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
2023-07-28 09:01:15 +01:00
Manish V Badarkhe
97653189bc docs: add details about plat_mboot_measure_key function
Added details of 'plat_mboot_measure_key' function in the porting-guide.

Change-Id: Id62211abc0ba13a0f581dc8e24c7b367afe2dcf5
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
2023-07-28 09:01:04 +01:00
Manish V Badarkhe
2971bad8d4 feat(measured-boot): introduce platform function to measure and publish Public Key
Added a platform function to measure and publish Public Key information.
Subsequent patches define this function for the FVP and TC platforms to
measure Public Key and publishes it to RSS if MEASURED_BOOT is
enabled.

Change-Id: I1f61f44c7a83bb4cbafbd1af97b5adeb8398e8e8
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
2023-07-25 21:41:16 +01:00
Manish V Badarkhe
43a6544f01 Merge "chore(docs): update march utility details" into integration 2023-07-25 16:53:26 +02:00
Madhukar Pappireddy
1b0b17638c Merge "feat(imx8m): detect console base address during runtime" into integration 2023-07-25 16:47:45 +02:00
Olivier Deprez
abe80629fc Merge "fix(el3-spmc): fix incorrect CASSERT" into integration 2023-07-25 15:32:54 +02:00
Bipin Ravi
fbc90e0fdd Merge "fix(cpus): workaround for Neoverse V2 erratum 2801372" into integration 2023-07-25 15:00:29 +02:00
Marco Felsch
df730d94cb feat(imx8m): detect console base address during runtime
Provide a helper to detect the enabled UART device during runtime. This
lower the integration effort and make it more straight forward for
'simple' use-cases with a single UART enabled. If multiple UARTs are
enabled the first enabled is returned.

The auto-detection is enabled by setting IMX_BOOT_UART_BASE=0 to keep
the backward compatibility. For more advanced use-cases (multiple UARTs
are enabled) the user still has to provide the correct base address.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Change-Id: I300a167e1a10f9aa991c8d1c3efe2c6b23f56c47
2023-07-25 09:54:02 +02:00
Demi Marie Obenour
1dd79f9e23 fix(el3-spmc): fix incorrect CASSERT
Check that the size of desc->emad_count is 4, not that sizeof(int) is
nonzero.  Also improve a comment.

Change-Id: I8bf69b637158ddffe2d08aed3d9879a4d7fd3514
Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
2023-07-25 09:29:47 +02:00
Manish Pandey
e2ce7d3476 Merge changes from topic "bk/context_refactor" into integration
* changes:
  refactor(psci): extract cm_prepare_el3_exit_ns() to a common location
  refactor(cm): set MDCR_EL3/CPTR_EL3 bits in respective feat_init_el3() only
  fix(cm): set MDCR_EL3.{NSPBE, STE} explicitly
  refactor(cm): factor out EL2 register setting when EL2 is unused
2023-07-24 17:44:25 +02:00
Boyan Karatotev
e07e7392a1 refactor(psci): extract cm_prepare_el3_exit_ns() to a common location
PSCI on and suspend wakeup both end with a cm_prepare_el3_exit_ns() call.
Since they are equivalent to the caller, move the call to just after the
*_finish calls to deduplicate it.

Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
Change-Id: I05c16dc6613aba357d20cc39cc43aab803d675e0
2023-07-24 11:04:44 +01:00
Boyan Karatotev
ece8f7d734 refactor(cm): set MDCR_EL3/CPTR_EL3 bits in respective feat_init_el3() only
These bits (MDCR_EL3.{NSTB, NSTBE, TTRF, TPM}, CPTR_EL3.TTA) only affect
EL2 (and lower) execution. Each feat_init_el3() is called long before
any lower EL has had a chance to execute, so setting the bits at reset
is redundant. Removing them from reset code also improves readability of
the immutable EL3 state.

Preserve the original intention for the TTA bit of "enabled for NS and
disabled everywhere else" (inferred from commit messages d4582d3088 and
2031d6166a and the comment). This is because CPTR_EL3 will be contexted
and so everyone will eventually get whatever NS has anyway.

Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
Change-Id: I3d24b45d3ea80882c8e450b2d9db9d5531facec1
2023-07-24 11:04:44 +01:00
Boyan Karatotev
99506face1 fix(cm): set MDCR_EL3.{NSPBE, STE} explicitly
With the introduction of FEAT_RME MDCR_EL3 bits NSPB and NSPBE depend on
each other. The enable code relies on the register being initialised to
zero and omits to reset NSPBE. However, this is not obvious. Reset the
bit explicitly to document this.

Similarly, reset the STE bit , since it's part of the feature enablement.

Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
Change-Id: I3714507bae10042cdccd2b7bc713b31d4cdeb02f
2023-07-24 11:04:38 +01:00
Boyan Karatotev
b48bd79073 refactor(cm): factor out EL2 register setting when EL2 is unused
A bunch of registers need to be initialized when EL2 is unused. There
are a lot of them which makes cm_prepare_el3_exit() quite unreadable.
Put them in their own function to improve this.

Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
Change-Id: If07954ed799643f89f177411d4266bb7c21cd394
2023-07-24 10:59:47 +01:00
Moritz Fischer
40c81ed533 fix(cpus): workaround for Neoverse V2 erratum 2801372
Neoverse V2 erratum 2801372 is a Cat B erratum that applies to
all revisions <=r0p1 and is fixed in r0p2. The workaround is to
insert a dsb before the isb in the power down sequence.

This errata is explained in SDEN 2332927 available at:
https://developer.arm.com/documentation/SDEN2332927

Change-Id: I8716b9785a67270a72ae329dc49a2f2239dfabff
Signed-off-by: Moritz Fischer <moritzf@google.com>
2023-07-21 16:52:36 +02:00
Manish Pandey
d281e05318 Merge "refactor(el3-runtime): move interrupt exception handler from macro to a function" into integration 2023-07-21 11:01:08 +02:00
Manish Pandey
3991b88988 refactor(el3-runtime): move interrupt exception handler from macro to a function
interrupt exception handler in vector entry is used as a asm macro
(added as inline code) instead of a function call. Since we have limited
space (0x80) for a vector entry there is a chance that it may overflow
in the future.

Signed-off-by: Manish Pandey <manish.pandey2@arm.com>
Change-Id: Ieb59f249c58b52e56e0217268fa4dc40b420f8d3
2023-07-21 09:59:33 +01:00
Madhukar Pappireddy
cd91aa17c9 Merge "fix(fvp): adjust BL2 maximum size as per total SRAM size" into integration 2023-07-20 23:45:49 +02:00
Manish V Badarkhe
965aacea91 fix(fvp): adjust BL2 maximum size as per total SRAM size
Adjusted BL2 maximum size as per total SRAM size.

Change-Id: Ic3b398574a17e8a784e7c4dbe3fe69d1fb2b5e16
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
2023-07-20 15:20:38 +01:00
Manish V Badarkhe
e755d005d0 Merge "docs(maintainers): update AMD maintainers list" into integration 2023-07-20 12:43:48 +02:00
Manish Pandey
5ba2f1aae3 Merge "feat(mte): adds feature detection for MTE_PERM" into integration 2023-07-20 12:23:40 +02:00
Akshay Belsare
bc5aceeb00 docs(maintainers): update AMD maintainers list
Maintainers for AMD platform ports has been updated.
"Amit Nagal" and "Akshay Belsare" are added to the list.

Change-Id: Ia64e1ec6c2f80515054730d307d41b0060d3dcc7
Signed-off-by: Akshay Belsare <akshay.belsare@amd.com>
2023-07-20 14:58:50 +05:30
Maksims Svecovs
4d0b66323b feat(mte): adds feature detection for MTE_PERM
Adds feature detection for v8.9 feature FEAT_MTE_PERM. Adds respective
ID_AA64PFR2_EL1 definitions and ENABLE_FEAT_MTE_PERM define.

Change-Id: If24b42f1207154e639016b0b840b2d91c6ee13d4
Signed-off-by: Maksims Svecovs <maksims.svecovs@arm.com>
Signed-off-by: Harrison Mutai <harrison.mutai@arm.com>
2023-07-20 09:00:22 +01:00
Govindraj Raja
019311e712 chore(docs): update march utility details
commit@7794d6c8f8c44acc14fbdc5ada5965310056be1e added a march utility
but the details were not updated in docs.

Update docs to provide a glimpse of march utility added.

Change-Id: I696cb9a701a30d7bf36a1ecd38a80d07df1fd551
Signed-off-by: Govindraj Raja <govindraj.raja@arm.com>
2023-07-19 09:43:06 -05:00
Manish V Badarkhe
d1b5ada888 Merge changes from topic "msm8916-plats" into integration
* changes:
  docs(msm8916): document new platforms
  feat(msm8916): add port for MDM9607
  refactor(msm8916): handle single core platforms
  feat(msm8916): add port for MSM8939
  feat(msm8916): power on L2 caches for secondary clusters
  feat(msm8916): initialize CCI-400 for multiple clusters
  refactor(msm8916): handle multiple CPU clusters
  feat(msm8916): add port for MSM8909
  feat(msm8916): clear CACHE_LOCK for MMU-500 r2p0+
  style(msm8916): add missing braces to while statements
2023-07-19 13:08:42 +02:00
Stephan Gerhold
c97c7ebfec docs(msm8916): document new platforms
Document the new platform build options for the MSM8916 port which now
supports multiple similar Qualcomm SoCs:

  - Snapdragon 410 (PLAT=msm8916) as before
  - Snapdragon 615 (PLAT=msm8939)
  - Snapdragon 210 (PLAT=msm8909)
  - Snapdragon X5 Modem (PLAT=mdm9607)

The latter two use AArch32-only ARM Cortex-A7 cores that only support
using BL32/SP_MIN and not BL31 on AArch64.

Change-Id: I9fffe60dd0ad2acc18f006f11e91854b9e8dcb8f
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
2023-07-19 12:56:08 +02:00
Stephan Gerhold
78aac78ad2 feat(msm8916): add port for MDM9607
The Qualcomm X5 Modem (MDM9607) SoC is very similar to the existing
MSM8916, except for:

  - Single core ARM Cortex-A7
  - No GPU
  - MMU-500 r2p4 instead of r0p0 (need to clear CACHE_LOCK bit)
  - Different default BL31/BL33 address and UART number

Make the existing MSM8916 platform port usable for MDM9607 as well by
adding some minimal if statements where necessary plus the platform
make files for mdm9607.

Change-Id: I4dd02c8e29af6282d8d828c3027c5e333459ba36
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
2023-07-19 12:56:08 +02:00
Stephan Gerhold
d9e565ea80 refactor(msm8916): handle single core platforms
Some Qualcomm modem platforms (MDM*) are quite similar to MSM8916
except that there is just a single CPU core. This requires some special
handling:

 - There is no GPU so the GPU SMMU also does not exist.
 - Looking closely at dumps of the MMIO register regions reveals that
   some of the register addresses are slightly different.

Add the necessary checks for this to allow building for those
platforms.

No functional change for existing platforms.

Change-Id: I0380ac3734876243e970a55d8bec5a8247175343
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
2023-07-19 12:56:08 +02:00
Stephan Gerhold
c28e96cd52 feat(msm8916): add port for MSM8939
The Qualcomm Snapdragon 615 (MSM8939) SoC is very similar to the
existing MSM8916, except for:

  - Two clusters with ARM Cortex-A53 cores
  - CCI-400

Make the existing MSM8916 platform port usable for MSM8939 as well by
adding some minimal if statements where necessary plus the platform
make files for msm8939.

Change-Id: I8cda83dc642f62222f984a42eec14de5df4c11e3
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
2023-07-19 12:56:08 +02:00
Stephan Gerhold
c822d26506 feat(msm8916): power on L2 caches for secondary clusters
On platforms with multiple CPU clusters the L2 cache will be only on
for the cluster of the boot CPU. Add the necessary sequence to power it
up for secondary clusters similar to the CPU boot sequence.

No functional change for platforms with a single cluster. The new code
is discarded entirely in this case.

Change-Id: I3d3bce519a8a10ef5278d74d81acf59123e00454
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
2023-07-19 12:56:08 +02:00
Stephan Gerhold
1240dc7ef1 feat(msm8916): initialize CCI-400 for multiple clusters
The MSM8939 SoC is very similar to MSM8916 but uses an ARM CCI-400
for cache coherence between the two CPU clusters. Add the necessary
code to initialize it with the existing driver.

No functional change for platforms with a single cluster. The CCI
related code is discarded entirely in this case.

Change-Id: I041d60222d8d2aeca53b392934c87280c66b0db0
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
2023-07-19 12:56:04 +02:00
Stephan Gerhold
1d7ed58ff7 refactor(msm8916): handle multiple CPU clusters
Some Qualcomm platforms similar to MSM8916 have multiple CPU clusters.
In this case, some of the hardware blocks are duplicated and must be
configured separately.

Refactor the code to handle additional clusters by introducing loops
and some conditionals.

No functional change for existing single cluster platforms.

Change-Id: I5b4b1ad2a1adde559d5b79b7698afe73733b2e90
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
2023-07-19 12:53:59 +02:00
Stephan Gerhold
cf0a75f04d feat(msm8916): add port for MSM8909
The Qualcomm Snapdragon 210 (MSM8909) SoC is very similar to the
existing MSM8916, except for:

  - ARM Cortex-A7 instead of Cortex-A53 (AArch32-only)
  - MMU-500 r2p0 instead of r0p0 (need to clear CACHE_LOCK bit)
  - Different default BL31 address and UART number

Make the existing MSM8916 platform port usable for MSM8909 as well by
adding some minimal if statements where necessary plus the platform
make files for msm8909.

Change-Id: I8eca5bd8f2486cc2174562fb5de28f8dffa0d874
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
2023-07-19 12:53:58 +02:00
Stephan Gerhold
d9b04423cf feat(msm8916): clear CACHE_LOCK for MMU-500 r2p0+
Newer Qualcomm platforms similar to MSM8916 use MMU-500 r2p0+ instead
of MMU-500 r0p0. On these versions it is necessary to clear the
SMMU_sACR.CACHE_LOCK bit to allow the normal world to write to
SMMU_CBn_ACTLR. Without this Linux shows a warning and is unable to
workaround the errata in MMU-500:

  arm-smmu 1e00000.iommu: Failed to disable prefetcher
    [errata #841119  and #826419], check ACR.CACHE_LOCK

Handle this dynamically at runtime by enabling all the necessary SMMU
clocks and check the IDR7 register for MMU-500 r2p0+. This must be
applied to both SMMUs on the platform: APPS and GPU.

While at it clean up the clock handling: Leave the SMMU clocks on
because the normal world will need it again while booting. But make
sure the vote register of the RPM co-processor does not keep these
clocks always-on. For some reasons some platforms seem to have a
non-zero reset value for GCC_RPM_SMMU_CLOCK_BRANCH_ENA_VOTE.

Change-Id: I34cf7d3f2db977b0930eb6e64a870ecaf02a7573
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
2023-07-19 12:53:58 +02:00
Stephan Gerhold
b9072a340a style(msm8916): add missing braces to while statements
According to the coding style all conditional statements (such as if,
for, while, do) must use braces regardless of the number of the
statements in the body [1].

Fix this for the code inside plat/qti/msm8916.

[1]: https://trustedfirmware-a.readthedocs.io/en/latest/process/coding-style.html#conditional-statement-bodies

Change-Id: I74f2e65aa2b3a65899e37dfd3f481d90fb15531c
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
2023-07-19 12:53:58 +02:00
Olivier Deprez
80c2c3742b Merge "fix(spmd): perform G0 interrupt acknowledge and deactivation" into integration 2023-07-19 12:50:06 +02:00
Sandrine Bailleux
799f42b515 Merge "refactor(tc): move all plat tests in test makefile" into integration 2023-07-19 07:55:59 +02:00
Sandrine Bailleux
80569faa84 Merge changes from topics "rotpk_rss_interface", "rss_interfaces" into integration
* changes:
  refactor(tc): print RSS interface test PSA status
  test(tc): test for AP/RSS interface for ROTPK
  feat(psa): interface with RSS for retrieving ROTPK
2023-07-18 18:09:15 +02:00
laurenw-arm
c5ce48f5a2 refactor(tc): move all plat tests in test makefile
Moving all PLATFORM_TESTS into platform test makefile

Change-Id: I31821e9e69d916d12ae4c804df26f07fb523c835
Signed-off-by: Lauren Wehrmeister <lauren.wehrmeister@arm.com>
2023-07-18 10:25:50 -05:00
Madhukar Pappireddy
6c91fc4458 fix(spmd): perform G0 interrupt acknowledge and deactivation
Prior to delegating handling of Group0 secure interrupt to platform
handler, SPMD framework must acknowledge the highest pending interrupt.
Moreover, once the platform has handled the interrupt successfully,
SPMD must deactivate the interrupt.

The rationale behind this decision is SPMD framework is well suited to
perform interrupt management at GIC boundary while the platform handler
is well equipped to deal with the device interface related to the
interrupt.

This patch also fixes a bug in the error code returned upon invocation
of FFA_EL3_INTR_HANDLE from normal world.

Change-Id: If8fef51899e25f966038cc01ec58c84ee25e88eb
Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
2023-07-17 13:35:43 -05:00
Manish Pandey
a2d4363791 Merge changes from topic "bk/context_refactor" into integration
* changes:
  refactor(amu): separate the EL2 and EL3 enablement code
  refactor(cpufeat): separate the EL2 and EL3 enablement code
2023-07-17 18:55:52 +02:00
laurenw-arm
cb6b750505 refactor(tc): print RSS interface test PSA status
Adding PSA status to print statement upon failing communication
initialization, non-volatile counter, and rotpk read interface calls in
platform_tests.

Change-Id: Ia949cc2d18e93efb68f663d0c4e5500ca9021a94
Signed-off-by: Lauren Wehrmeister <lauren.wehrmeister@arm.com>
2023-07-17 11:53:44 -05:00