Soby Mathew [Mon, 7 Oct 2019 11:43:32 +0000 (11:43 +0000)]
Merge "Fix the CAS spinlock implementation" into integration
Soby Mathew [Fri, 4 Oct 2019 13:47:40 +0000 (13:47 +0000)]
Merge "delay: timeout detection support" into integration
Soby Mathew [Wed, 25 Sep 2019 13:03:41 +0000 (14:03 +0100)]
Fix the CAS spinlock implementation
Make the spinlock implementation use ARMv8.1-LSE CAS instruction based
on a platform build option. The CAS-based implementation used to be
unconditionally selected for all ARM8.1+ platforms.
The previous CAS spinlock implementation had a bug wherein the spin_unlock()
implementation had an `sev` after `stlr` which is not sufficient. A dsb is
needed to ensure that the stlr completes prior to the sev. Having a dsb is
heavyweight and a better solution would be to use load exclusive semantics
to monitor the lock and wake up from wfe when a store happens to the lock.
The patch implements the same.
Change-Id: I5283ce4a889376e4cc01d1b9d09afa8229a2e522
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
Lionel Debieve [Tue, 24 Sep 2019 14:59:56 +0000 (16:59 +0200)]
delay: timeout detection support
Introduce timeout_init_us/timeout_elapsed() delay tracking with CNTPCT.
timeout_init_us(some_timeout_us); returns a reference to detect
timeout for the provided microsecond delay value from current time.
timeout_elapsed(reference) return true/false whether the reference
timeout is elapsed.
Cherry picked from OP-TEE implementation [1].
[1] commit
33d30a74502b ("core: timeout detection support")
Minor:
- Remove stm32mp platform duplicated implementation.
- Add new include in marvell ble.mk
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Lionel Debieve <lionel.debieve@st.com>
Change-Id: Iaef6d43c11a2e6992fb48efdc674a0552755ad9c
Soby Mathew [Thu, 3 Oct 2019 16:22:41 +0000 (16:22 +0000)]
Merge "TF-A: Add support for ARMv8.3-PAuth in BL1 SMC calls and BL2U" into integration
Alexei Fedorov [Tue, 1 Oct 2019 12:58:23 +0000 (13:58 +0100)]
TF-A: Add support for ARMv8.3-PAuth in BL1 SMC calls and BL2U
This patch adds support for ARMv8.3-PAuth in BL1 SMC calls and
BL2U image for firmware updates by programming APIAKey_EL1 registers
and enabling Pointer Authentication in EL3 and EL1 respectively.
Change-Id: I875d952aba8242caf74fb5f4f2d2af6f0c768c08
Signed-off-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Soby Mathew [Thu, 3 Oct 2019 13:43:51 +0000 (13:43 +0000)]
Merge "Introducing support for Cortex-A65AE" into integration
Imre Kis [Mon, 22 Jul 2019 12:36:30 +0000 (14:36 +0200)]
Introducing support for Cortex-A65AE
Change-Id: I1ea2bf088f1e001cdbd377cbfb7c6a2866af0422
Signed-off-by: Imre Kis <imre.kis@arm.com>
Soby Mathew [Thu, 3 Oct 2019 13:32:45 +0000 (13:32 +0000)]
Merge changes from topic "stm32mp_corrections_w40" into integration
* changes:
gpio: stm32_gpio: do not mix error code types
fdts: stm32mp1: move FDCAN to PLL4_R
mmc: increase delay between ACMD41 retries
crypto: stm32_hash: align stm32_hash_update() prototype
Soby Mathew [Thu, 3 Oct 2019 13:32:13 +0000 (13:32 +0000)]
Merge "Add missing support for BL2_AT_EL3 in XIP memory" into integration
Soby Mathew [Thu, 3 Oct 2019 13:23:37 +0000 (13:23 +0000)]
Merge changes from topic "qemu_sbsa" into integration
* changes:
qemu/qemu_sbsa: Adding memory mapping for both FLASH0/FLASH1
qemu/qemu_sbsa: Adding Qemu SBSA platform
Soby Mathew [Thu, 3 Oct 2019 10:30:40 +0000 (10:30 +0000)]
Merge changes I0355e084,I6a6dd1c0 into integration
* changes:
mediatek: mt8183: add EMI MPU driver for DRAM protection
mediatek: mt8183: add DEVAPC driver to control protection
Soby Mathew [Thu, 3 Oct 2019 10:22:06 +0000 (10:22 +0000)]
Merge "a5ds: Add handler for when user tries to switch off secondary cores" into integration
Nicolas Le Bayon [Wed, 11 Sep 2019 13:58:31 +0000 (15:58 +0200)]
gpio: stm32_gpio: do not mix error code types
Change-Id: I84f8a99be2dcdf7c51fbecdb324df8e2f32cc855
Signed-off-by: Nicolas Le Bayon <nicolas.le.bayon@st.com>
Signed-off-by: Yann Gautier <yann.gautier@st.com>
Antonio Borneo [Mon, 29 Jul 2019 12:46:16 +0000 (14:46 +0200)]
fdts: stm32mp1: move FDCAN to PLL4_R
LTDC modifies the clock frequency to adapt it to the display. Such
frequency change is not detected by the FDCAN driver that instead
caches the value at probe and pretends to use it later.
This change fixes the issue by moving the FDCAN to PLL4_R,
leaving the LTDC alone on PLL4_Q.
Signed-off-by: Antonio Borneo <antonio.borneo@st.com>
Signed-off-by: Yann Gautier <yann.gautier@st.com>
Change-Id: I8230868b2b5fd6deb6e3f9dc3911030d8d484c58
Yann Gautier [Fri, 16 Aug 2019 14:49:41 +0000 (16:49 +0200)]
mmc: increase delay between ACMD41 retries
In the SD Specification, Power Up Diagram of Card figure, the Timeout
value for initialization process (ACMD41 command retries) is 1 second.
Align to match MMC cards (in mmc_send_op_cond()) and Linux kernel code,
and set the delay between ACMD41 command retries to 10ms.
Change-Id: I2e07cb9944e7d7b72f2d4b13e0505e6751458091
Signed-off-by: Yann Gautier <yann.gautier@st.com>
Yann Gautier [Wed, 2 Oct 2019 14:33:41 +0000 (16:33 +0200)]
crypto: stm32_hash: align stm32_hash_update() prototype
Use size_t for length parameter in header file, as in .c file.
Change-Id: I310f2a6159cde1c069b4f814f6558c2488c203ec
Signed-off-by: Yann Gautier <yann.gautier@st.com>
Usama Arif [Thu, 26 Sep 2019 15:07:53 +0000 (16:07 +0100)]
a5ds: Add handler for when user tries to switch off secondary cores
a5ds only has always-on power domain and there is no power control
present. However, without the pwr_domain_off handler, the kernel
panics when the user will try to switch off secondary cores. The
a5ds_pwr_domain_off handler will prevent kernel from crashing,
i.e. the kernel will attempt but fail to shut down the secondary CPUs
if the user tries to switch them offline.
Change-Id: I3c2239a1b6f035113ddbdda063c8495000cbe30c
Signed-off-by: Usama Arif <usama.arif@arm.com>
kenny liang [Fri, 23 Aug 2019 07:50:58 +0000 (15:50 +0800)]
mediatek: mt8183: add EMI MPU driver for DRAM protection
Add EMI MPU driver for DRAM protection.
Signed-off-by: kenny liang <kenny.liang@mediatek.com>
Change-Id: I0355e084184b5396ad8ac99fff6ef9d050fb5e96
kenny liang [Fri, 23 Aug 2019 02:23:34 +0000 (10:23 +0800)]
mediatek: mt8183: add DEVAPC driver to control protection
Add DEVAPC driver to control protection.
Signed-off-by: kenny liang <kenny.liang@mediatek.com>
Change-Id: I6a6dd1c0bffa372b6df2cb604ca5e02eabbb9d26
Soby Mathew [Wed, 2 Oct 2019 20:12:37 +0000 (20:12 +0000)]
Merge "Introducing support for Cortex-A65" into integration
Imre Kis [Thu, 18 Jul 2019 12:30:03 +0000 (14:30 +0200)]
Introducing support for Cortex-A65
Change-Id: I645442d52a295706948e2cac88c36c1a3cb0bc47
Signed-off-by: Imre Kis <imre.kis@arm.com>
Lionel Debieve [Mon, 27 May 2019 07:32:00 +0000 (09:32 +0200)]
Add missing support for BL2_AT_EL3 in XIP memory
Add the missing flag for aarch32 XIP memory mode. It was
previously added in aarch64 only.
Minor: Correct the aarch64 missing flag.
Signed-off-by: Lionel Debieve <lionel.debieve@st.com>
Change-Id: Iac0a7581a1fd580aececa75f97deb894858f776f
Sandrine Bailleux [Wed, 2 Oct 2019 06:41:05 +0000 (06:41 +0000)]
Merge "doc: Fix GCC version to 8.3-2019.03" into integration
Louis Mayencourt [Thu, 26 Sep 2019 10:29:21 +0000 (11:29 +0100)]
doc: Fix GCC version to 8.3-2019.03
Change-Id: I3b866e927d93f4b690aa4891940fc8afabf4146e
Signed-off-by: Louis Mayencourt <louis.mayencourt@arm.com>
Soby Mathew [Tue, 1 Oct 2019 20:15:23 +0000 (20:15 +0000)]
Merge "Cortex_hercules: Add support for Hercules-AE" into integration
Sandrine Bailleux [Tue, 1 Oct 2019 15:49:54 +0000 (15:49 +0000)]
Merge "doc: Migrate to Linaro release 19.06" into integration
Radoslaw Biernacki [Thu, 7 Jun 2018 18:14:36 +0000 (20:14 +0200)]
qemu/qemu_sbsa: Adding memory mapping for both FLASH0/FLASH1
This patch adds mapping for secure FLASH0 for qemu/virt and
qemu/qemu_sbsa platforms. This change is targeted for sbsa but since both
platforms share common code, changes in common defines was necessary.
For qemu_sbsa, this patch adds necessary mapping in order to boot without
semi-hosting from secure FLASH0. EFI need to stay in FLASH1 (share it with
variables) since it need to "run in place" in non secure domain. Changes
for this are under RFC at edk2-platforms mailing list:
https://patches.linaro.org/patch/171327/
(edk2-platforms/Platform/Qemu/SbsaQemu/SbsaQemu.dsc).
In docs qemu/virt is described as using semi-hosting, therefore this change
should be orthogonal to existing assumptions while giving possibility to
store both bl1 and fip in FLASH0 at some point (additional changes required
for that).
Signed-off-by: Radoslaw Biernacki <radoslaw.biernacki@linaro.org>
Change-Id: I782bc3637c91c01eaee680b3c5c408e24b4b6e28
Radoslaw Biernacki [Thu, 17 May 2018 20:52:49 +0000 (22:52 +0200)]
qemu/qemu_sbsa: Adding Qemu SBSA platform
This patch introduces Qemu SBSA platform.
Both platform specific files where copied from qemu/qemu with changes for
DRAM base above 32bit and removal of ARMv7 conditional defines/code.
Documentation is aligned to rest of SBSA patches along the series and
planed changes in edk2-platform repo.
Fixes ARM-software/tf-issues#602
Signed-off-by: Radoslaw Biernacki <radoslaw.biernacki@linaro.org>
Change-Id: I8ebc34eedb2268365e479ef05654b2df1b99128c
zelalem-aweke [Fri, 20 Sep 2019 16:15:20 +0000 (11:15 -0500)]
doc: Migrate to Linaro release 19.06
- Updated Linaro release version number to 19.06
- Updated links to Linaro instructions and releases
- Removed the Linaro old releases link
Signed-off-by: zelalem-aweke <zelalem.aweke@arm.com>
Change-Id: Ib786728106961e89182b42183e7b889f6fc74190
Artsem Artsemenka [Mon, 16 Sep 2019 14:11:21 +0000 (15:11 +0100)]
Cortex_hercules: Add support for Hercules-AE
Not tested on FVP Model.
Change-Id: Iedebc5c1fbc7ea577e94142b7feafa5546f1f4f9
Signed-off-by: Artsem Artsemenka <artsem.artsemenka@arm.com>
Soby Mathew [Fri, 27 Sep 2019 10:55:15 +0000 (10:55 +0000)]
Merge "AArch32: Disable Secure Cycle Counter" into integration
Soby Mathew [Fri, 27 Sep 2019 09:54:27 +0000 (09:54 +0000)]
Merge changes from topic "ld/stm32-authentication" into integration
* changes:
stm32mp1: add authentication support for stm32image
bsec: move bsec_mode_is_closed_device() service to platform
crypto: stm32_hash: Add HASH driver
Soby Mathew [Fri, 27 Sep 2019 09:54:07 +0000 (09:54 +0000)]
Merge "doc: Fix platform port inclusion" into integration
Soby Mathew [Fri, 27 Sep 2019 09:53:40 +0000 (09:53 +0000)]
Merge changes from topic "amlogic-g12a" into integration
* changes:
amlogic: g12a: Add support for the S905X2 (G12A) platform
amlogic: makefile: Use PLAT variable when possible
amlogic: sha_dma: Move register mappings to platform header
Soby Mathew [Fri, 27 Sep 2019 09:49:23 +0000 (09:49 +0000)]
Merge changes from topic "a5ds-multicore" into integration
* changes:
a5ds: add multicore support
a5ds: Hold the secondary cpus in pen rather than panic
Soby Mathew [Fri, 27 Sep 2019 09:49:05 +0000 (09:49 +0000)]
Merge "GICv3 driver: Fix support for full SPI range" into integration
Soby Mathew [Fri, 27 Sep 2019 09:46:59 +0000 (09:46 +0000)]
Merge "Fix MTE support from causing unused variable warnings" into integration
Soby Mathew [Fri, 27 Sep 2019 09:45:42 +0000 (09:45 +0000)]
Merge changes from topic "raspberry-pi-4-support" into integration
* changes:
rpi4: Add initial documentation file
rpi4: Add stdout-path to device tree
rpi4: Add GIC maintenance interrupt to GIC DT node
rpi4: Cleanup memory regions, move pens to first page
rpi4: Reserve resident BL31 region from non-secure world
rpi4: Amend DTB to advertise PSCI
rpi4: Determine BL33 entry point at runtime
rpi4: Accommodate "armstub8.bin" header at the beginning of BL31 image
Add basic support for Raspberry Pi 4
rpi3: Allow runtime determination of UART base clock rate
FDT helper functions: Respect architecture in PSCI function IDs
FDT helper functions: Add function documentation
Soby Mathew [Fri, 27 Sep 2019 09:42:37 +0000 (09:42 +0000)]
Merge changes from topic "mp/giv3-discovery" into integration
* changes:
Migrate ARM platforms to use the new GICv3 API
Adding new optional PSCI hook pwr_domain_on_finish_late
GICv3: Enable multi socket GIC redistributor frame discovery
Alexei Fedorov [Tue, 20 Aug 2019 14:22:44 +0000 (15:22 +0100)]
AArch32: Disable Secure Cycle Counter
This patch changes implementation for disabling Secure Cycle
Counter. For ARMv8.5 the counter gets disabled by setting
SDCR.SCCD bit on CPU cold/warm boot. For the earlier
architectures PMCR register is saved/restored on secure
world entry/exit from/to Non-secure state, and cycle counting
gets disabled by setting PMCR.DP bit.
In 'include\aarch32\arch.h' header file new
ARMv8.5-PMU related definitions were added.
Change-Id: Ia8845db2ebe8de940d66dff479225a5b879316f8
Signed-off-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Paul Beesley [Thu, 26 Sep 2019 13:40:38 +0000 (13:40 +0000)]
Merge changes I0283fc2e,Ib476d024,Iada05f7c into integration
* changes:
hikey: fix to load FIP by partition table.
hikey960: fix to load FIP by partition table
drivers: partition: support different block size
Carlo Caione [Wed, 18 Sep 2019 10:29:48 +0000 (11:29 +0100)]
amlogic: g12a: Add support for the S905X2 (G12A) platform
Introduce the preliminary support for the Amlogic S905X2 (G12A) SoC.
This port is a minimal implementation of BL31 capable of booting
mainline U-Boot and Linux. Tested on a SEI510 board.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
Change-Id: Ife958f10e815a4530292c45446adb71239f3367f
Madhukar Pappireddy [Mon, 10 Jun 2019 21:54:36 +0000 (16:54 -0500)]
Migrate ARM platforms to use the new GICv3 API
This patch invokes the new function gicv3_rdistif_probe() in the
ARM platform specific gicv3 driver. Since this API modifies the
shared GIC related data structure, it must be invoked coherently
by using the platform specific pwr_domain_on_finish_late hook.
Change-Id: I6efb17d5da61545a1c5a6641b8f58472b31e62a8
Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
Madhukar Pappireddy [Mon, 12 Aug 2019 23:31:33 +0000 (18:31 -0500)]
Adding new optional PSCI hook pwr_domain_on_finish_late
This PSCI hook is similar to pwr_domain_on_finish but is
guaranteed to be invoked with the respective core and cluster are
participating in coherency. This will be necessary to safely invoke
the new GICv3 API which modifies shared GIC data structures concurrently.
Change-Id: I8e54f05c9d4ef5712184c9c18ba45ac97a29eb7a
Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
Madhukar Pappireddy [Wed, 15 May 2019 23:25:41 +0000 (18:25 -0500)]
GICv3: Enable multi socket GIC redistributor frame discovery
This patch provides declaration and definition of new GICv3 driver
API: gicv3_rdistif_probe().This function delegates the responsibility
of discovering the corresponding Redistributor base frame to each CPU
itself. It is a modified version of gicv3_rdistif_base_addrs_probe()
and is executed by each CPU in the platform unlike the previous
approach in which only the Primary CPU did the discovery of all the
Redistributor frames for every CPU.
The flush operations as part of gicv3_driver_init() function are
made necessary even for platforms with WARMBOOT_ENABLE_DCACHE_EARLY
because the GICv3 driver data structure contents are accessed by CPU
with D-Cache turned off during power down operations.
Change-Id: I1833e81d3974b32a3e4a3df4766a33d070982268
Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
Paul Beesley [Wed, 25 Sep 2019 12:58:36 +0000 (12:58 +0000)]
doc: Fix platform port inclusion
This patch:
- Adds any leftover platform ports that were not having their
documentation built (not in the index.rst table of contents)
- Corrects a handful of RST formatting errors that cause poor
rendering
- Reorders the list of platforms so that they are displayed
in alphabetical order
Change-Id: If8c135a822d581c3c5c4fca2936d501ccfd2e94c
Signed-off-by: Paul Beesley <paul.beesley@arm.com>
Paul Beesley [Wed, 25 Sep 2019 15:03:48 +0000 (15:03 +0000)]
Merge "FVP: Fix plat_set_nv_ctr() function" into integration
Paul Beesley [Wed, 25 Sep 2019 11:32:50 +0000 (11:32 +0000)]
Merge "doc: Render Marvell platform documents" into integration
Andre Przywara [Mon, 22 Jul 2019 09:31:10 +0000 (10:31 +0100)]
rpi4: Add initial documentation file
As the Raspberry Pi4 port is now in a usable state, add the build
instructions together with some background information to the
documentation directory.
The port differs quite a bit from the Raspberry Pi 3, so we use a
separate file for that.
Change-Id: I7d9f5967fdf3ec3bfe97d78141f59cbcf03388d4
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Andre Przywara [Mon, 15 Jul 2019 17:07:51 +0000 (18:07 +0100)]
rpi4: Add stdout-path to device tree
Some device tree users like to find a pointer to the standard serial
console in the device tree, in the "stdout-path" property of the /chosen
node.
Add the location of the Mini UART in that property, so that DT users are
happy, for instance Linux' earlycon detection.
Change-Id: I178e55016e5640de5ab0bc6e061944bd3583ea96
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Andre Przywara [Sun, 21 Jul 2019 00:45:31 +0000 (01:45 +0100)]
rpi4: Add GIC maintenance interrupt to GIC DT node
For being able to use the virtualisation support the GIC offers, we need
to know the interrupt number of the maintenance interrupt. This
information is missing from the official RPi4 device tree.
Use libfdt to add the "interrupts" property to the GIC node, which
allows hypervisors like KVM or Xen to be able to use the GIC's help on
virtualising interrupts.
Change-Id: Iab84f0885a5bf29fb84ca8f385e8a39d27700c75
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Andre Przywara [Mon, 15 Jul 2019 08:04:27 +0000 (09:04 +0100)]
rpi4: Cleanup memory regions, move pens to first page
Now that we have the SMP pens in the first page of DRAM, we can get rid
of all the fancy RPi3 memory regions that our RPi4 port does not really
need. This avoids using up memory all over the place, restricting ATF
to just run in the first 512KB of DRAM.
Remove the now unused regions. This also moves the SMP pens into our
first memory page (holding the firmware magic), where the original
firmware put them, but where there is also enough space for them.
Since the pens will require code execution privileges, we amend the
memory attributes used for that page to include write and execution
rights.
Change-Id: I131633abeb4a4d7b9057e737b9b0d163b73e47c6
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Andre Przywara [Sun, 21 Jul 2019 23:04:40 +0000 (00:04 +0100)]
rpi4: Reserve resident BL31 region from non-secure world
The GPU firmware loads the armstub8.bin (BL31) image at address 0, the
beginning of DRAM. As this holds the resident PSCI code and the SMP
pens, the non-secure world should better know about this, to avoid
accessing memory owned by TF-A. This is particularly criticial as the
Raspberry Pi 4 does not feature a secure memory controller, so
overwriting code is a very real danger.
Use the newly introduced function to add a node into reserved-memory
node, where non-secure world can check for regions to be excluded from
its mappings.
Reserve the first 512KB of memory for now. We can refine this later if
need be.
Change-Id: I00e55e70c5c02615320d79ff35bc32b805d30770
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Andre Przywara [Thu, 11 Jul 2019 00:45:39 +0000 (01:45 +0100)]
rpi4: Amend DTB to advertise PSCI
The device tree provided by the official Raspberry Pi firmware uses
spin tables for SMP bringup.
One of the benefit of having TF-A is that it provides PSCI services, so
let's rewrite the DTB to advertise PSCI instead of spin tables.
This uses the (newly exported) routine from the QEMU platform port.
Change-Id: Ifddcb14041ca253a333f8c2d5e97a42db152470c
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Andre Przywara [Thu, 11 Jul 2019 00:42:12 +0000 (01:42 +0100)]
rpi4: Determine BL33 entry point at runtime
Now that we have the armstub magic value in place, the GPU firmware will
write the kernel load address (and DTB address) into our special page,
so we can always easily access the actual location without hardcoding
any addresses into the BL31 image.
Make the compile-time defined PRELOADED_BL33_BASE macro optional, and
read the BL33 entry point from the magic location, if the macro was not
defined. We do the same for the DTB address.
This also splits the currently "common" definition of
plat_get_ns_image_entrypoint() to be separate between RPi3 and RPi4.
Change-Id: I6f26c0adc6fce2df47786b271c490928b4529abb
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Andre Przywara [Wed, 10 Jul 2019 17:09:18 +0000 (18:09 +0100)]
rpi4: Accommodate "armstub8.bin" header at the beginning of BL31 image
The Raspberry Pi GPU firmware checks for a magic value at offset 240
(0xf0) of the armstub8.bin image it loads. If that value matches,
it writes the kernel load address and the DTB address into subsequent
memory locations.
We can use these addresses to avoid hardcoding these values into the BL31
image, to make it more flexible and a drop-in replacement for the
official armstub8.bin.
Reserving just 16 bytes at offset 240 of the final image file is not easily
possible, though, as this location is in the middle of the generic BL31
entry point code.
However we can prepend an extra section before the actual BL31 image, to
contain the magic and addresses. This needs to be 4KB, because the
actual BL31 entry point needs to be page aligned.
Use the platform linker script hook that the generic code provides, to
add an almost empty 4KB code block before the entry point code. The very
first word contains a branch instruction to jump over this page, into
the actual entry code.
This also gives us plenty of room for the SMP pens later.
Change-Id: I38caa5e7195fa39cbef8600933a03d86f09263d6
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Andre Przywara [Tue, 9 Jul 2019 10:25:57 +0000 (11:25 +0100)]
Add basic support for Raspberry Pi 4
The Raspberry Pi 4 is a single board computer with four Cortex-A72
cores. From a TF-A perspective it is quite similar to the Raspberry Pi
3, although it comes with more memory (up to 4GB) and has a GIC.
This initial port though differs quite a lot from the existing rpi3
platform port, mainly due to taking a much simpler and more robust
approach to loading the non-secure payload:
The GPU firmware of the SoC, which is responsible for initial platform
setup (including DRAM initialisation), already loads the kernel, device
tree and the "armstub" into DRAM. We take advantage of this, by placing
just a BL31 component into the armstub8.bin component, which will be
executed first, in AArch64 EL3.
The non-secure payload can be a kernel or a boot loader (U-Boot or
EDK-2), disguised as the "kernel" image and loaded by the GPU firmware.
So this is just a BL31-only port, which directly drops into EL2
and executes whatever has been loaded as the "kernel" image, handing
over the DTB address in x0.
Change-Id: I636f4d1f661821566ad9e341d69ba36f6bbfb546
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Andre Przywara [Sun, 4 Aug 2019 09:46:21 +0000 (10:46 +0100)]
rpi3: Allow runtime determination of UART base clock rate
At the moment the UART input clock rate is hard coded at compile time.
This works as long as the GPU firmware always sets up the same rate,
which does not seem to be true for the Raspberry Pi 4.
In preparation for being able to change this at runtime, add a base
clock parameter to the console setup function. This is still hardcoded
for the Raspberry Pi 3.
Change-Id: I398bc2f1e9b46f7af9a84cb0b33cbe8e78f2d900
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Andre Przywara [Thu, 19 Sep 2019 09:55:25 +0000 (10:55 +0100)]
FDT helper functions: Respect architecture in PSCI function IDs
PSCI uses different function IDs for CPU_SUSPEND and CPU_ON, depending on
the architecture used (AArch64 or AArch32).
For recent PSCI versions the client will determine the right version,
but for PSCI v0.1 we need to put some ID in the DT node. At the moment
we always add the 64-bit IDs, which is not correct if TF-A is built for
AArch32.
Use the function IDs matching the TF-A build architecture, for the two
IDs where this differs. This only affects legacy OSes using PSCI v0.1.
On the way remove the sys_poweroff and sys_reset properties, which were
never described in the official PSCI DT binding.
Change-Id: If77bc6daec215faeb2dc67112e765aacafd17f33
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Andre Przywara [Thu, 19 Sep 2019 09:45:28 +0000 (10:45 +0100)]
FDT helper functions: Add function documentation
Since we moved some functions that amend a DT blob in memory to common
code, let's add proper function documentation.
This covers the three exported functions in common/fdt_fixup.c.
Change-Id: I67d7d27344e62172c789d308662f78d54903cf57
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Sandrine Bailleux [Tue, 23 Jul 2019 13:41:06 +0000 (15:41 +0200)]
FVP: Fix plat_set_nv_ctr() function
The Fast Models provide a non-volatile counter component, which is used
in the Trusted Board Boot implementation to protect against rollback
attacks.
This component comes in 2 versions (see [1]).
- Version 0 is the default and models a locked non-volatile counter,
whose value is fixed.
- Version 1 of the counter may be incremented in a monotonic fashion.
plat_set_nv_ctr() must cope with both versions. This is achieved by:
1) Attempting to write the new value in the counter.
2) Reading the value back.
3) If there is a mismatch, we know the counter upgrade failed.
When using version 0 of the counter, no upgrade is possible so the
function is expected to fail all the time. However, the code is
missing a compiler barrier between the write operation and the next
read. Thus, the compiler may optimize and remove the read operation on
the basis that the counter value has not changed. With the default
optimization level used in TF-A (-Os), this is what's happening.
The fix introduced in this patch marks the write and subsequent read
accesses to the counter as volatile, such that the compiler makes no
assumption about the value of the counter.
Note that the comment above plat_set_nv_ctr() was clearly stating
that when using the read-only version of the non-volatile counter,
"we expect the values in the certificates to always match the RO
values so that this function is never called". However, the fact that
the counter value was read back seems to contradict this comment, as
it is implementing a counter-measure against misuse of the
function. The comment has been reworded to avoid any confusion.
Without this patch, this bug may be demonstrated on the Base AEM FVP:
- Using version 0 of the non-volatile counter (default version).
- With certificates embedding a revision number value of 32
(compiling TF-A with TFW_NVCTR_VAL=32).
In this configuration, the non-volatile counter is tied to value 31 by
default. When BL1 loads the Trusted Boot Firmware certificate, it
notices that the two values do not match and tries to upgrade the
non-volatile counter. This write operation is expected to fail
(because the counter is locked) and the function is expected to return
an error but it succeeds instead.
As a result, the trusted boot does not abort as soon as it should and
incorrectly boots BL2. The boot is finally aborted when BL2 verifies
the BL31 image and figures out that the version of the SoC Firmware
Key Certificate does not match. On Arm platforms, only certificates
signed with the Root-of-Trust Key may trigger an upgrade of the
non-volatile Trusted counter.
[1] https://developer.arm.com/docs/100964/1160/fast-models-components/peripheral-components/nonvolatilecounter
Change-Id: I9979f29c23b47b338b9b484013d1fb86c59db92f
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
Usama Arif [Thu, 19 Sep 2019 10:07:24 +0000 (11:07 +0100)]
a5ds: add multicore support
Enable cores 1-3 using psci. On receiving the smc call from kernel,
core 0 will bring the secondary cores out pen and signal an event for
the cores. Currently on switching the cores is enabled i.e. it is not
possible to suspend, switch cores off, etc.
Change-Id: I6087e1d2ec650e1d587fd543efc1b08cbb50ae5f
Signed-off-by: Usama Arif <usama.arif@arm.com>
Usama Arif [Thu, 19 Sep 2019 09:54:16 +0000 (10:54 +0100)]
a5ds: Hold the secondary cpus in pen rather than panic
For the secondary CPUs, hold the cpu in wfe rather then panic.
This will be needed when multicore support is added to a5ds as
the smc call will write to the hold base and signal an event to
power on the secondary CPUs.
Change-Id: I0ffc2059e9ef894c21375ca5c94def859bfa6599
Signed-off-by: Usama Arif <usama.arif@arm.com>
Sandrine Bailleux [Mon, 23 Sep 2019 11:13:47 +0000 (11:13 +0000)]
Merge changes I66dc6855,I2217a1ad into integration
* changes:
rockchip: Update BL31_BASE to 0x40000
rockchip: Fix typo for TF content text
Lionel Debieve [Tue, 3 Sep 2019 10:22:23 +0000 (12:22 +0200)]
stm32mp1: add authentication support for stm32image
This commit adds authentication binary support for STM32MP1.
It prints the bootrom authentication result if signed
image is used and authenticates the next loaded STM32 images.
It also enables the dynamic translation table support
(PLAT_XLAT_TABLES_DYNAMIC) to use bootrom services.
Signed-off-by: Lionel Debieve <lionel.debieve@st.com>
Change-Id: Iba706519e0dc6b6fae1f3dd498383351f0f75f51
Lionel Debieve [Mon, 16 Sep 2019 10:17:09 +0000 (12:17 +0200)]
bsec: move bsec_mode_is_closed_device() service to platform
This BSEC service is a platform specific service. Implementation
moved to the platform part.
Signed-off-by: Lionel Debieve <lionel.debieve@st.com>
Change-Id: I1f70ed48a446860498ed111acce01187568538c9
Lionel Debieve [Mon, 26 Aug 2019 13:14:51 +0000 (15:14 +0200)]
crypto: stm32_hash: Add HASH driver
The driver manages the HASH processor IP on STM32MP1
Signed-off-by: Lionel Debieve <lionel.debieve@st.com>
Change-Id: I3b67c80c16d819f86b951dae29a6c465e51ad585
Paul Beesley [Fri, 12 Jul 2019 10:37:07 +0000 (11:37 +0100)]
doc: Render Marvell platform documents
The documentation for Marvell platforms was not included in the
rendered document output until now because, while it was mostly
valid RST format, the files were saved with a .txt extension.
This patch corrects some RST formatting errors, creates a document
tree (index page) for the Marvell documents, and adds the Marvell
subtree to the main index.
Change-Id: Id7d4ac37eded636f8f62322a153e1e5f652ff51a
Signed-off-by: Paul Beesley <paul.beesley@arm.com>
Justin Chadwell [Fri, 20 Sep 2019 08:13:14 +0000 (09:13 +0100)]
Fix MTE support from causing unused variable warnings
assert() calls are removed in release builds, and if that assert call is
the only use of a variable, an unused variable warning will be triggered
in a release build. This patch fixes this problem when
CTX_INCLUDE_MTE_REGS by not using an intermediate variable to store the
results of get_armv8_5_mte_support().
Change-Id: I529e10ec0b2c8650d2c3ab52c4f0cecc0b3a670e
Signed-off-by: Justin Chadwell <justin.chadwell@arm.com>
Kever Yang [Thu, 19 Sep 2019 02:37:36 +0000 (10:37 +0800)]
rockchip: Update BL31_BASE to 0x40000
Rockchip platform is using the first 1MB of DRAM as secure ram space,
and there is a vendor loader who loads and runs the BL31/BL32/BL33,
this loader is usually load by SoC BootRom to the start addres of DRAM,
we need to reserve enough space for this loader so that it doesn't need
to do the relocate when loading the BL31. eg.
We use U-Boot SPL to load ATF BL31 and U-Boot proper as BL33, the SPL
TEXT BASE is offset 0 of DRAM which is decide by Bootrom; if we update
the BL31_BASE to offset 0x40000(256KB), then the 0~0x40000 should be
enough for SPL and no need to do the relocate while the space size
0x10000(64KB) may not enough for SPL.
After this update, the BL31 can use the rest 768KB of the first 1MB,
which is also enough, and the loader who is using BL31 elf file can
support this update without any change.
Change-Id: I66dc685594d77f10f9a49c3be015fd6729250ece
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Kever Yang [Fri, 20 Sep 2019 00:40:54 +0000 (08:40 +0800)]
rockchip: Fix typo for TF content text
The 'txet' should be 'text'.
Change-Id: I2217a1adf50c3b86f3087b83c77d9291b280627c
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Sandrine Bailleux [Wed, 18 Sep 2019 15:22:03 +0000 (15:22 +0000)]
Merge "amlogic: scpi: Add support to retrieve chip ID" into integration
Sandrine Bailleux [Wed, 18 Sep 2019 14:51:13 +0000 (14:51 +0000)]
Merge changes I93ecff4d,I30dd9a95,I8207eea9,Id4197b07,Ib810125b, ... into integration
* changes:
mediatek: mt8183: add MTK MCDI driver
mediatek: mt8183: add MTK SSPM driver
mediatek: mt8183: add MTK SPM driver
mediatek: mt8183: add MTK uart driver for controlling clock gate
mediatek: mt8183: configure MCUSYS DCM
mediatek: mt8173: refactor RTC and PMIC drivers
Sandrine Bailleux [Wed, 18 Sep 2019 14:30:09 +0000 (14:30 +0000)]
Merge changes from topic "db/unsigned_long" into integration
* changes:
Unsigned long should not be used as per coding guidelines
SCTLR and ACTLR are 32-bit for AArch32 and 64-bit for AArch64
Sandrine Bailleux [Wed, 18 Sep 2019 14:28:01 +0000 (14:28 +0000)]
Merge changes from topic "qemu_sbsa" into integration
* changes:
qemu: Simplify the image size calculation
qemu: introducing sub-platforms to qemu platform
Radoslaw Biernacki [Thu, 17 May 2018 20:19:35 +0000 (22:19 +0200)]
qemu: Simplify the image size calculation
Patch introduce the macro NS_IMAGE_MAX_SIZE to simplify the image size
calculation. Use of additional parenthesis removes the possibility of
improper calculations due nested macro expansion for subtraction.
In case of platforms with DRAM window over 32bits, patch also removes
potential problems with type casting, as meminfo.image_size is uint32_t
but macro calculations were done in 64bit space.
Signed-off-by: Radoslaw Biernacki <radoslaw.biernacki@linaro.org>
Change-Id: I2d05a2d9dd6000dba6114df53262995cf85af018
Radoslaw Biernacki [Thu, 17 May 2018 20:19:11 +0000 (22:19 +0200)]
qemu: introducing sub-platforms to qemu platform
This commit change the plat/qemu directory structure into:
`-- plat
`-- qemu
|-- common (files shared with all qemu subplatforms)
|-- qemu (original qemu platform)
|-- qemu_sbsa (new sqemu_sbsa platform)
|-- subplat1
`-- subplat2
This opens the possibility of adding new qemu sub-platforms which reuse
existing common platform code. The first platform which will leverage new
structure will be SBSA platform.
Signed-off-by: Radoslaw Biernacki <radoslaw.biernacki@linaro.org>
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
Change-Id: Id0d8133e1fffc1b574b69aa2770ebc02bb837a9b
Haojian Zhuang [Sat, 14 Sep 2019 11:18:01 +0000 (19:18 +0800)]
hikey: fix to load FIP by partition table.
Avoid to load FIP by hacking address. Load it by partition table instead.
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
Change-Id: I0283fc2e6e459bff14de19d92db4158e05106ee4
Haojian Zhuang [Sat, 14 Sep 2019 10:43:51 +0000 (18:43 +0800)]
hikey960: fix to load FIP by partition table
Avoid to load FIP by hacking address. Load it by partition table instead.
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
Change-Id: Ib476d024a51e4b9705441a0007d78f9fdf0ca078
Haojian Zhuang [Sat, 14 Sep 2019 10:01:16 +0000 (18:01 +0800)]
drivers: partition: support different block size
The block size of some storage device is 4096-byte long, such as UFS. But
PARTITION_BLOCK_SIZE is defined as 512-byte long. So replace it by
PLAT_PARTITION_BLOCK_SIZE. Make it configurable in platform.
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
Change-Id: Iada05f7c646d0a0f2c0d3b8545540b3cb7153de3
Carlo Caione [Wed, 18 Sep 2019 10:03:10 +0000 (11:03 +0100)]
amlogic: makefile: Use PLAT variable when possible
To address the file names.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
Change-Id: Ib79b8dfa032a1db012c5031d47de61e1a16b5f9a
Carlo Caione [Wed, 18 Sep 2019 09:12:35 +0000 (10:12 +0100)]
amlogic: sha_dma: Move register mappings to platform header
The registers location for the SHA DMA driver is not unique for the
different platforms. Move the mapping out of the driver and into the
platform-specific header.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
Change-Id: Ice64637844a3cb384b01e466cb8c1cea5f764129
Carlo Caione [Mon, 16 Sep 2019 11:13:49 +0000 (12:13 +0100)]
amlogic: scpi: Add support to retrieve chip ID
Both kernel and U-Boot use a SMC call to the secure monitor to get the
chip ID. This call is translated by BL31 to a call to the SCP to
retrieve the ID. Add a new SiP call and the backing SCPI command.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
Change-Id: Ib128f5645ee92866e7ebbcd550dacd33f573524b
Sandrine Bailleux [Mon, 16 Sep 2019 15:17:11 +0000 (15:17 +0000)]
Merge changes from topic "raspberry-pi-4-support" into integration
* changes:
rpi3: Do prescaler and control setup in C
rpi3: Prepare for supporting a GIC (in RPi4)
rpi3: Make SHARED_RAM optional
rpi3: Rename RPI3_IO_BASE to RPI_IO_BASE
rpi3: Move shared rpi3 files into common directory
Sandrine Bailleux [Mon, 16 Sep 2019 14:21:04 +0000 (14:21 +0000)]
Merge changes from topic "raspberry-pi-4-support" into integration
* changes:
Add fdt_add_reserved_memory() helper function
qemu: Move and generalise FDT PSCI fixup
Sandrine Bailleux [Mon, 16 Sep 2019 12:31:55 +0000 (12:31 +0000)]
Merge changes from topic "raspberry-pi-4-support" into integration
* changes:
rpi3: Move rng driver to drivers
rpi3: Move VC mailbox driver into generic drivers directory
rpi3: Move rpi3_hw.h header file to include/rpi_hw.h
Sandrine Bailleux [Mon, 16 Sep 2019 12:14:18 +0000 (12:14 +0000)]
Merge "rpi3: Add "rpi" platform directory" into integration
kenny liang [Wed, 21 Aug 2019 14:49:49 +0000 (22:49 +0800)]
mediatek: mt8183: add MTK MCDI driver
Add MCDI driver for power saving.
Signed-off-by: kenny liang <kenny.liang@mediatek.com>
Change-Id: I93ecff4d7581f678be09dd8fb5dfaaccd5f2c22c
kenny liang [Wed, 21 Aug 2019 13:17:49 +0000 (21:17 +0800)]
mediatek: mt8183: add MTK SSPM driver
Add MTK SSPM driver.
Signed-off-by: kenny liang <kenny.liang@mediatek.com>
Change-Id: I30dd9a95456b8c3c8d18fd22120824eec97634ee
kenny liang [Wed, 21 Aug 2019 12:50:20 +0000 (20:50 +0800)]
mediatek: mt8183: add MTK SPM driver
Add MTK SPM driver for suspend/resume scenario.
Signed-off-by: kenny liang <kenny.liang@mediatek.com>
Change-Id: I8207eea95914da9e63c62f3afc8329f3ccd9a22c
kenny liang [Tue, 20 Aug 2019 14:27:44 +0000 (22:27 +0800)]
mediatek: mt8183: add MTK uart driver for controlling clock gate
Add uart clock gate contol for suspend/resume scenario.
Signed-off-by: kenny liang <kenny.liang@mediatek.com>
Change-Id: Id4197b0720630ec6c74aec206a9b206511bf515a
kenny liang [Wed, 21 Aug 2019 13:16:29 +0000 (21:16 +0800)]
mediatek: mt8183: configure MCUSYS DCM
Configure MCUSYS DCM.
Signed-off-by: kenny liang <kenny.liang@mediatek.com>
Change-Id: Ib810125b514cbcc43c770377bc71a29a05a19320
kenny liang [Thu, 2 May 2019 13:06:05 +0000 (21:06 +0800)]
mediatek: mt8173: refactor RTC and PMIC drivers
Refactor RTC and PMIC drivers.
Signed-off-by: kenny liang <kenny.liang@mediatek.com>
Change-Id: I74fca536cd61e00c962f080f1ba3759287682ecf
Deepika Bhavnani [Tue, 3 Sep 2019 18:51:09 +0000 (21:51 +0300)]
Unsigned long should not be used as per coding guidelines
We should either change them to `unsigned int` or `unsigned long long`
when the size of the variable is the same in AArch64 and AArch32 or
to `u_register_t` if it is supposed to be 32 bit wide in AArch32
and 64 bit wide in AArch64.
Signed-off-by: Deepika Bhavnani <deepika.bhavnani@arm.com>
Change-Id: I80e2a6edb33248ee88be395829abbd4c36c89abe
Deepika Bhavnani [Tue, 3 Sep 2019 18:08:51 +0000 (21:08 +0300)]
SCTLR and ACTLR are 32-bit for AArch32 and 64-bit for AArch64
AArch64 System register SCTLR_EL1[31:0] is architecturally mapped
to AArch32 System register SCTLR[31:0]
AArch64 System register ACTLR_EL1[31:0] is architecturally mapped
to AArch32 System register ACTLR[31:0].
`u_register_t` should be used when it's important to store the
contents of a register in its native size
Signed-off-by: Deepika Bhavnani <deepika.bhavnani@arm.com>
Change-Id: I0055422f8cc0454405e011f53c1c4ddcaceb5779
Andre Przywara [Mon, 15 Jul 2019 08:02:15 +0000 (09:02 +0100)]
rpi3: Do prescaler and control setup in C
To initialise the arch timer configuration and some clock prescaler, we
need to do two MMIO access *once*, early during boot.
As tempting as it may sound, plat_reset_handler() is not the right place
to do this, as it will be called on every CPU coming up, both for
secondary cores as well as during warmboots. So this access will be done
multiple times, and even during a rich OS' runtime. Whether doing so anyway
is actually harmful is hard to say, but we should definitely avoid this if
possible.
Move the initialisation of these registers to C code in
bl1_early_platform_setup(), where it will still be executed early enough
(before enabling the console), but only once during the whole boot
process.
Change-Id: I081c41a5476d424411411488ff8f633e87d3bcc5
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Andre Przywara [Mon, 15 Jul 2019 08:00:23 +0000 (09:00 +0100)]
Add fdt_add_reserved_memory() helper function
If a firmware component like TF-A reserves special memory regions for
its own or secure payload services, it should announce the location and
size of those regions to the non-secure world. This will avoid
disappointment when some rich OS tries to acccess this memory, which
will likely end in a crash.
The traditional way of advertising reserved memory using device tree is
using the special memreserve feature of the device tree blob (DTB).
However by definition those regions mentioned there do not prevent the
rich OS to map this memory, which may lead to speculative accesses to
this memory and hence spurious bus errors.
A safer way of carving out memory is to use the /reserved-memory node as
part of the normal DT structure. Besides being easier to setup, this
also defines an explicit "no-map" property to signify the secure-only
nature of certain memory regions, which avoids the rich OS to
accidentally step on it.
Add a helper function to allow platform ports to easily add a region.
Change-Id: I2b92676cf48fd3bdacda05b5c6b1c7952ebed68c
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Andre Przywara [Tue, 9 Jul 2019 13:29:24 +0000 (14:29 +0100)]
rpi3: Move rng driver to drivers
To allow sharing the driver between the RPi3 and RPi4, move the random
number generator driver into the generic driver directory.
Change-Id: Iae94d7cb22c6bce3af9bff709d76d4caf87b14d1
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Andre Przywara [Tue, 9 Jul 2019 10:18:59 +0000 (11:18 +0100)]
rpi3: Add "rpi" platform directory
With the incoming support for the Raspberry Pi 4 boards, one directory
to serve both versions will not end up well.
Create an additional layer by inserting a "rpi" directory betweeen /plat
and rpi3, so that we can more easily share or separate files between the
two later.
Change-Id: I75adbb054fe7902f34db0fd5e579a55612dd8a5f
Signed-off-by: Andre Przywara <andre.przywara@arm.com>