Commit Graph

9522 Commits

Author SHA1 Message Date
johpow01 88c227374c refactor(fvp_r): remove unused files and clean up makefiles
This patch removes files that are not used by TF-R as well as
removes unused generic files from the TF-R makefile.

Signed-off-by: John Powell <john.powell@arm.com>
Change-Id: Idb15ac295dc77fd38735bf2844efdb73e6f7c89b
2021-10-29 09:43:19 -05:00
Mark Dykes 3deb060015 Merge changes from topic "st_dt_match_instance" into integration
* changes:
  refactor(stm32_sdmmc2): use DT helpers
  feat(plat/st): create new helper for DT access
2021-10-15 20:53:01 +02:00
Manish Pandey 02d36a92fc Merge "fix(plat/st): only check header major when booting" into integration 2021-10-15 13:48:10 +02:00
Mark Dykes 09665c8348 Merge "fix(plat/st): correct signedness comparison issue" into integration 2021-10-14 23:25:28 +02:00
Mark Dykes 7b97cf378a Merge changes from topic "st_fixes" into integration
* changes:
  fix(stpmic1): fix power switches activation
  fix(stpmic1): update error cases return
  refactor(stpmic1): use BIT and GENMASK helpers
  fix(stm32mp1_clk): keep RTC clock always on
  fix(stm32mp1_clk): set other clocks as always on
2021-10-14 23:16:36 +02:00
Mark Dykes 115901bc2d Merge "fix(stm32mp1_clk): fix MPU clock rate" into integration 2021-10-14 22:56:25 +02:00
Mark Dykes d20d5002f9 Merge "fix(stm32mp1_clk): fix MCU/AXI parent clock" into integration 2021-10-14 22:56:15 +02:00
Mark Dykes 34ddd83bc8 Merge "refactor(stm32mp_clk): keep RCC node offset" into integration 2021-10-14 22:55:48 +02:00
Manish Pandey 68d8d3e7af Merge "fix(drivers/marvell/comphy-3700): configure phy selector also for PCIe" into integration 2021-10-14 18:03:28 +02:00
Madhukar Pappireddy 17c1f1e6ec Merge "fix(stm32mp1): add bl prefix for internal linker script" into integration 2021-10-13 18:54:55 +02:00
Manish Pandey d08a36544d Merge "build(plat/marvell): add descriptions why some checks are required" into integration 2021-10-13 17:52:10 +02:00
Manish Pandey 31e18c02e4 Merge "fix(fvp_r): fix compilation error in release mode" into integration 2021-10-13 17:43:44 +02:00
Manish Pandey 7d96e79a1a fix(fvp_r): fix compilation error in release mode
assert() is not used in release mode and complaining about unused
variable "desc".

Signed-off-by: Manish Pandey <manish.pandey2@arm.com>
Change-Id: Ib919eb27532344a25be0b6ece7e239efa87be744
2021-10-13 13:45:45 +01:00
Pali Rohár 71cb3a41ff build(plat/marvell): add descriptions why some checks are required
This change adds just comments why some checks are required. They check
that ENV variables and external repos are correctly set for TF-A builds.

Signed-off-by: Pali Rohár <pali@kernel.org>
Change-Id: I2f8af5061411c0c92d3875917f4d97b60dc2cf10
2021-10-13 11:37:12 +02:00
Sandrine Bailleux fa1e016766 Merge changes from topic "refactor-mb" into integration
* changes:
  docs(measured boot): add measured boot platform functions
  refactor(measured boot): make measurement strings compliant with SBSG
  feat(plat/fvp): pass Event Log addr and size from BL1 to BL2
  feat(measured_boot): update tb_fw_config with event log properties
  feat(measured_boot): image hash measurement and recording in BL1
  refactor(measured boot): remove platform calls from Event Log driver
  refactor(measured_boot): remove passing of BL2 hash via device tree
  refactor(measured boot): move BL2 measurement to platform layer
  refactor(measured boot): rename add_event2()
  refactor(measured boot): move image measurement to generic layer
  build(measured boot): rename measured boot makefile
  feat(measured boot): move init and teardown functions to platform layer
  refactor(measured boot): rename tpm_record_measurement()
2021-10-13 09:58:41 +02:00
Manish V Badarkhe 9b3004cfbf docs(measured boot): add measured boot platform functions
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
Change-Id: I411ee37cfeec32925849042689e8fdc7a26b7b13
2021-10-12 17:53:48 +01:00
Manish V Badarkhe 8a89e1898b refactor(measured boot): make measurement strings compliant with SBSG
Made measurement strings compliant to Server Base Security Guide
(SBSG, Arm DEN 0086) hence updated measurement strings for BL32, BL31,
and SCP_BL2 images. As the GPT image is not get measured by BL2 so
removed its measurement string.
Also, namespaced measurement string defines that were looking quite
generic.

Change-Id: Iaa17c0cfeee3d06dc822eff2bd553da23bd99b76
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
2021-10-12 17:53:48 +01:00
Manish V Badarkhe 0500f4479e feat(plat/fvp): pass Event Log addr and size from BL1 to BL2
Introduced functions to set and get Event log information
(tpm_event_log address and its size).

In FVP platform case, measured boot with Event Log backend flow
work as below
1. event_log_init function called by BL1 to initialize Event Log
   module
2. arm_set_tb_fw_info function called by BL1 to set the
   'tpm_event_log_addr' and 'tpm_event_log_size' properties
   in tb_fw_config
3. arm_get_tb_fw_info function called by BL2 to get tpm Event Log
   parameters set by BL1. These parameters used by the BL2 to
   extend the tpm Event Log records, and use these parameters
   to initialize Event Log using event_log_init function
4. arm_set_nt_fw_info and arm_set_tos_fw_info function called by
   BL2 to set 'tpm_event_log' address and its size properties in
   nt_fw_config and tos_fw_config respectively

Alongside, this patch created a separate instances of plat_mboot_init
and plat_mboot_finish APIs for BL1 and BL2.

This patch is tested using the existing measured boot test configuration
in jenkins CI.

Change-Id: Ib9eca092afe580df014541c937868f921dff9c37
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
2021-10-12 17:53:48 +01:00
Manish V Badarkhe e742bcdae0 feat(measured_boot): update tb_fw_config with event log properties
Making tb_fw_config ready to pass the Event Log base address
and size information to BL2.

Change-Id: I5dd0e79007e3848b5d6d0e69275a46c2e9807a98
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
2021-10-12 17:53:48 +01:00
Manish V Badarkhe 48ba0345f7 feat(measured_boot): image hash measurement and recording in BL1
It looks safer and cleaner approach to record the measurement taken by
BL1 straightaway in TCG Event Log instead of deferring these recordings
to BL2.
Hence pull in the full-fledged measured boot driver into BL1 that
replaces the former ad-hoc platform interfaces i.e.
bl1_plat_set_bl2_hash, bl2_plat_get_hash.

As a result of this change the BL1 of Arm FVP platform now do the
measurements and recordings of below images:
1. FW_CONFIG
2. TB_FW_CONFIG
3. BL2

Change-Id: I798c20336308b5e91b547da4f8ed57c24d490731
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
2021-10-12 17:53:48 +01:00
Manish V Badarkhe efa6521878 refactor(measured boot): remove platform calls from Event Log driver
Currently, the Event Log driver does platform layer work by invoking
a few platform functions in the 'event_log_finalise' call. Doing
platform work does not seem to be the driver's responsibility, hence
moved 'event_log_finalise' function's implementation to the platform
layer.

Alongside, introduced few Event Log driver functions and done
some cosmetic changes.

Change-Id: I486160e17e5b0677c734fd202af7ccd85476a551
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
2021-10-12 17:53:47 +01:00
Manish V Badarkhe eab78e9ba4 refactor(measured_boot): remove passing of BL2 hash via device tree
Subsequent patches will provide a solution to do the BL2 hash measurement
and recording in BL1 itself, hence in preparation to adopt that solution
remove the logic of passing BL2 hash measurement to BL2 component
via TB_FW config.

Change-Id: Iff9b3d4c6a236a33b942898fcdf799cbab89b724
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
2021-10-12 17:53:47 +01:00
Sandrine Bailleux 8cd09cfc91 refactor(measured boot): move BL2 measurement to platform layer
Right now, event_log_init() does 2 things:
1) It writes all the necessary TCG data structures in the event log buffer.
2) It writes the first measurement (BL2's).

Step 2) introduces in the TCG event log driver an assumption on what
is getting measured and in what order. Ideally, the driver should only
be concerned about generic operations, such as initializing the event
log or recording a measurement in it. As much as possible, we should
design the driver such that it could be reused in another project that
has a different measure boot flow.

For these reasons, move step 2) up to the caller, plat_mboot_init() in
this case. Make event_log_record() a public function for this purpose.

This refactoring will also help when we make BL1 record BL2's
measurement into the event log (instead of BL2). Both BL1 and BL2 will
need to call the driver's init function but only BL1 will need
recording BL2's measurement. We can handle this through different
implementations of plat_mboot_init() for BL1 and BL2, leaving the TCG
event log driver unchanged.

Change-Id: I358e097c1eedb54f82b866548dfc6bcade83d519
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
2021-10-12 17:53:47 +01:00
Sandrine Bailleux 9b0b344474 refactor(measured boot): rename add_event2()
To a layman in TCG linguo, add_event2() is not straight forward to
understand. Rename the function into event_log_record().

Change-Id: I75d53a656425cd78a41ebf2c4c4e4e57687adc0d
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
2021-10-12 17:53:47 +01:00
Manish V Badarkhe 140d9cb3e7 refactor(measured boot): move image measurement to generic layer
Right now, the assumption is that the platform post-load hook takes
care of measuring the image that just got loaded. This is how it's
implemented on FVP.

This patch moves the measurement into the generic code
instead. load_auth_image() now calls plat_mboot_measure_image(),
which is a new platform interface introduced in this patch to measure
an image. This is called just after authenticating the image.

Implement plat_mboot_measure_image() for the Arm FVP platform. The code
is copied straight from the post-load hook.

As a result, the FVP specific implementation of
arm_bl2_plat_handle_post_image_load() is no longer needed. We can go
back to using the Arm generic implementation of it.

Change-Id: I7b4b8d28941a865e10af9d0eadaf2e4850942090
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
2021-10-12 17:53:47 +01:00
Sandrine Bailleux d89bec83dc build(measured boot): rename measured boot makefile
With the removal of the generic functions measured_boot_init()/finish(),
measured_boot.mk becomes specific to the TCG event log backend. Change
its file name to event_log.mk.
Also, the Event Log driver is one of the backend of measured boot hence
created a separate folder for it under the measured_boot directory.

Alongside done some cosmetic changes (adding a comment and fixing
identation).

Change-Id: I4ce3300e6958728dc15ca5cced09eaa01510606c
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
2021-10-12 17:53:47 +01:00
Manish V Badarkhe 47bf3ac31e feat(measured boot): move init and teardown functions to platform layer
Right now, the measured boot driver is strongly coupled with the TCG
event log driver. It would not be possible to push the measurements
somewhere else, for instance to a physical TPM.

To enable this latter use case, turn the driver's init and teardown
functions into platform hooks. Call them bl2_plat_mboot_init()/finish().
This allows each platform to implement them appropriately, depending on
the type of measured boot backend they use. For example, on a platform
with a physical TPM, the plat_mboot_init() hook would startup the TPM
and setup it underlying bus (e.g. SPI).

Move the current implementation of the init and teardown function to the
FVP platform layer.

Finally move the conditional compilation logic (#if MEASURED_BOOT) out
of bl2_main() to improve its readability. Provide a dummy implementation
in the case measured boot is not included in the build.

Change-Id: Ib6474cb5a9c1e3d4a30c7f228431b22d1a6e85e3
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
2021-10-12 17:53:47 +01:00
Sandrine Bailleux 4a24707f94 refactor(measured boot): rename tpm_record_measurement()
tpm_record_measurement() function name suggests that:

 - It only records a measurement but does not compute it.
   This is not the case, the function does both.

 - It stores this measurement into a TPM (discrete chip or fTPM).
   This is not the case either, the measurement is just stored into
   the event log, which is a data structure hold in memory, there is
   no TPM involvement here.

To better convey the intent of the function, rename it into
event_log_measure_and_record().

Change-Id: I0102eeda477d6c6761151ac96759b31b6997e9fb
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
2021-10-12 17:53:47 +01:00
Pali Rohár 0f3a122109 fix(drivers/marvell/comphy-3700): configure phy selector also for PCIe
The mvebu_a3700_comphy_pcie_power_on() function does not configure the
PHY selector explicitly, it relies on the register default value.

Configure the PHY selector just in case someone changed the default
value.

Signed-off-by: Pali Rohár <pali@kernel.org>
Change-Id: I54048b4bb7a5eced36f7fe6592ebe108f978fff0
2021-10-12 15:09:52 +02:00
Manish Pandey 55eeb7b08f Merge "plat/marvell/a8k: add Globalscale Mochabin support" into integration 2021-10-11 22:09:11 +02:00
Manish Pandey 487d0329cb Merge "fix(plat/qemu): reboot/shutdown with low to high gpio" into integration 2021-10-11 17:07:55 +02:00
Maxim Uvarov bd2ad12ef1 fix(plat/qemu): reboot/shutdown with low to high gpio
Use low to high gpio sequence to reboot/shutdown qemu machine.

Use low to high gpio pins level change which will cause an interrupt
in qemu virt platform. This change will supported with next qemu 6.1
release once patchset:
hw/arm: Make virt board secure powerdown/reset work
will be merged.

Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
CC: Peter Maydell <peter.maydell@linaro.org>
Change-Id: I70979517358c3b587722b2dcb33f63d29bf79d9b
2021-10-11 17:33:29 +03:00
Robert Marko 0a6e2147e7
plat/marvell/a8k: add Globalscale Mochabin support
Add support for Globalscale MOCHAbin board.

Its based on Armada 7040 SoC and ships in multiple DRAM options:
* 2GB DDR4 (1CS)
* 4GB DDR4 (1CS)
* 8GB DDR4 (2CS)

Since it ships in multiple DRAM configurations, an
Armada 3k style DDR_TOPOLOGY variable is added.
Currently, this only has effect on the MOCHAbin, but
I expect more boards with multiple DRAM sizes to be
supported.

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
Change-Id: I8a1ec9268fed34f6a81c5cbf1e891f638d461305
2021-10-11 16:26:02 +02:00
André Przywara c0d359b69a Merge "fix(arm_fgpa): allow build after MAKE_* changes" into integration 2021-10-11 10:26:37 +02:00
Mark Dykes fcfecdaf2e Merge changes I9405f7f6,Id53ea099 into integration
* changes:
  fix(plat/mediatek/mt8183): fix out-of-bound access
  feat(plat/mediatek/common): enable software reset for CIRQ
2021-10-07 22:28:42 +02:00
Joanna Farley ae720acd71 Merge "feat(fvp_r): configure system registers to boot rich OS" into integration 2021-10-07 18:14:43 +02:00
Andre Przywara 9d38a3e698 fix(arm_fgpa): allow build after MAKE_* changes
Commit 434d0491c5 ("refactor(makefile): remove BL prefixes in build
macros") changed the MAKE_S macro to expect "bl31" instead of just "31".

Adjust our calls to MAKE_S and MAKE_LD to fix the build for arm_fpga.

Change-Id: I2743e421c10eaecb39bfa4515ea049a1b8d18fcb
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2021-10-07 14:21:26 +01:00
Yann Gautier 7684dddcfb fix(stm32mp1): add bl prefix for internal linker script
Due to patch [1], the bl prefix was removed from the build macros.
It should then add explicitly when compiling stm32mp1.ld.S.

[1] 434d0491c5 ("refactor(makefile): remove BL prefixes in build macros")

Change-Id: I298dba2a7c958dd4ea6429c83ed4b1ee97e1735f
Signed-off-by: Yann Gautier <yann.gautier@st.com>
2021-10-07 14:24:38 +02:00
Yann Gautier 5657decc7f fix(plat/st): correct signedness comparison issue
Add casts where required to avoid compialtion error when enabling
-Wsign-compare in shared resources file.
The assert is also corrected to match the correct range (change ||
to &&).

Change-Id: Ie4c9c0c935d39ff9a2165b909172aacb3e94ab4d
Signed-off-by: Yann Gautier <yann.gautier@st.com>
2021-10-07 09:26:27 +02:00
Manish Pandey 330669de94 Merge "refactor(fvp_r): tidy up platform port [1]" into integration 2021-10-06 23:55:26 +02:00
Mark Dykes 3c0df4cb49 Merge changes from topic "fvpr_cleanup" into integration
* changes:
  refactor(tbbr): remove "fvp_r" platform specific check
  refactor(Makefile): move NEED_<IMAGE> before their use
2021-10-06 23:44:11 +02:00
Mark Dykes 8c8e03088a Merge "fix(doc): fix TF-A v2.6 release date in the release information page" into integration 2021-10-06 20:23:10 +02:00
Bipin Ravi c90fa47202 fix(doc): fix TF-A v2.6 release date in the release information page
Signed-off-by: Bipin Ravi <bipin.ravi@arm.com>
Change-Id: If5482def6eb4fe23abe59ace09e9a1fbb891b117
2021-10-06 13:10:29 -05:00
Soby Mathew 1d65121174 Merge changes from topic "za/feat_rme" into integration
* changes:
  refactor(gpt): productize and refactor GPT library
  feat(rme): disable Watchdog for Arm platforms if FEAT_RME enabled
  docs(rme): add build and run instructions for FEAT_RME
  fix(plat/fvp): bump BL2 stack size
  fix(plat/fvp): allow changing the kernel DTB load address
  refactor(plat/arm): rename ARM_DTB_DRAM_NS region macros
  refactor(plat/fvp): update FVP platform DTS for FEAT_RME
  feat(plat/arm): add GPT initialization code for Arm platforms
  feat(plat/fvp): add memory map for FVP platform for FEAT_RME
  refactor(plat/arm): modify memory region attributes to account for FEAT_RME
  feat(plat/fvp): add RMM image support for FVP platform
  feat(rme): add GPT Library
  feat(rme): add ENABLE_RME build option and support for RMM image
  refactor(makefile): remove BL prefixes in build macros
  feat(rme): add context management changes for FEAT_RME
  feat(rme): add Test Realm Payload (TRP)
  feat(rme): add RMM dispatcher (RMMD)
  feat(rme): run BL2 in root world when FEAT_RME is enabled
  feat(rme): add xlat table library changes for FEAT_RME
  feat(rme): add Realm security state definition
  feat(rme): add register definitions and helper functions for FEAT_RME
2021-10-06 19:44:28 +02:00
Manish Pandey 28bbbf3bf5 feat(fvp_r): configure system registers to boot rich OS
Following system registers are modified before exiting EL2 to allow
u-boot/Linux to boot
  1. CNTHCTL_EL2.EL1PCTEN -> 1
     Allows U-boot to use physical counters at EL1
  2. VTCR_EL2.MSA -> 1
     Enables VMSA at EL1, which is required by U-Boot and Linux.
  3. HCR_EL2.APK = 1 & HCR_EL2.API = 1
     Disables PAuth instruction and register traps in EL1

Signed-off-by: Manish Pandey <manish.pandey2@arm.com>
Change-Id: I58f45b6669a9ad1debb80265b243015c054a9bb1
2021-10-06 17:53:28 +01:00
Manish Pandey 4796c6ca89 refactor(fvp_r): tidy up platform port [1]
Following changes done:
  1. Remove "fvp_r" specific check from bl1.mk
  2. Override BL1_SOURCES in fvp_r platform.mk
  3. Regroup source files
  4. Remove platform specific change from arm_common

Signed-off-by: Manish Pandey <manish.pandey2@arm.com>
Change-Id: I74d0b1f317853ab1333744d8da5c59f937789547
2021-10-06 17:38:06 +01:00
Manish Pandey 08c699e738 refactor(tbbr): remove "fvp_r" platform specific check
fvp_r is a unique platform which does not have BL2 binary and image
loading functionality is performed by BL1 itself. To avoid
generating certificate for BL2 there was platform specific check
added which looks bit ugly, replacing that check.

Signed-off-by: Manish Pandey <manish.pandey2@arm.com>
Change-Id: I11360fa753f847768906c42dce652296245b4a63
2021-10-06 17:38:06 +01:00
Manish Pandey 5f24ce968e refactor(Makefile): move NEED_<IMAGE> before their use
In later patch tbbr_tools.mk requires NEED_BL2 definition which is
defined after inclusion of this mk file.
Move NEED_<IMAGE> definitions earlier to their use

Signed-off-by: Manish Pandey <manish.pandey2@arm.com>
Change-Id: Ieff999b255690755779d0cd35d5aba2d3794873c
2021-10-06 17:37:49 +01:00
Mark Dykes 1b1123c5b9 Merge "feat(plat/mdeiatek/mt8195): add DFD control in SiP service" into integration 2021-10-06 17:25:05 +02:00
Joanna Farley e093b3fc8b Merge "fix(include/drivers/flexspi): fix warm boot wait time for MT35XU512A" into integration 2021-10-06 15:04:37 +02:00