]> git.baikalelectronics.ru Git - arm-tf.git/log
arm-tf.git
2 years agofeat(cpus): add support for chaberton cpu
Govindraj Raja [Fri, 10 Mar 2023 10:38:54 +0000 (10:38 +0000)]
feat(cpus): add support for chaberton cpu

Add basic CPU library code to support the Chaberton CPU,
Chaberton cores are based out of Hunter core, so overall
library code was adapted based on that.

Change-Id: I58321c77f2c364225a764da6fa65656d1bec33f1
Signed-off-by: Govindraj Raja <govindraj.raja@arm.com>
2 years agoMerge changes from topic "ethos-n" into integration
Joanna Farley [Tue, 4 Apr 2023 14:16:04 +0000 (16:16 +0200)]
Merge changes from topic "ethos-n" into integration

* changes:
  docs(maintainers): update NPU driver files
  docs(ethos-n): update porting-guide.rst for NPU
  feat(ethos-n): add separate RO and RW NSAIDs
  feat(ethos-n)!: add protected NPU firmware setup
  feat(ethos-n): add stream extends and attr support
  feat(ethos-n): add reserved memory address support
  feat(ethos-n): add event and aux control support
  feat(ethos-n): add SMC call to get FW properties
  refactor(ethos-n): split up SMC call handling
  feat(ethos-n): add NPU firmware validation
  feat(ethos-n): add check for NPU in SiP setup
  feat(ethos-n)!: load NPU firmware at BL2
  feat(juno): support ARM_IO_IN_DTB option for Juno
  fix(fconf): fix FCONF_ARM_IO_UUID_NUMBER value
  fix(fvp): incorrect UUID name in FVP tb_fw_config
  fix(ethos-n): add workaround for erratum 2838783
  feat(ethos-n): add support for NPU to cert_create
  feat(ethos-n): add NPU support in fiptool
  feat(ethos-n): add support to set up NSAID
  build(fiptool): add object dependency generation
  feat(ethos-n): add NPU sleeping SMC call
  feat(ethos-n): add multiple asset allocators
  feat(ethos-n): add reset type to reset SMC calls
  feat(ethos-n): add protected NPU TZMP1 regions
  build(ethos-n): add TZMP1 build flag

2 years agoMerge "fix(psci): remove unreachable switch/case blocks" into integration
Manish Pandey [Tue, 4 Apr 2023 11:58:19 +0000 (13:58 +0200)]
Merge "fix(psci): remove unreachable switch/case blocks" into integration

2 years agoMerge "docs(maintainers): update NPU driver owners" into integration
Joanna Farley [Tue, 4 Apr 2023 10:50:03 +0000 (12:50 +0200)]
Merge "docs(maintainers): update NPU driver owners" into integration

2 years agofix(psci): remove unreachable switch/case blocks
Andre Przywara [Wed, 29 Mar 2023 11:05:19 +0000 (12:05 +0100)]
fix(psci): remove unreachable switch/case blocks

The PSCI function dispatcher switch/case is split up between 32-bit and
64-bit function IDs, based on bit 30 of the encoding. This bit just
encodes the maximum size of the arguments, not necessarily whether they
are used from AArch64 or AArch32. So while some functions exist in both
worlds (CPU_ON, for instance), some functions take no or only 32-bit
arguments (CPU_OFF, PSCI_FEATURES), so they only exist as a 32-bit
function call.

Commit b88a4416b5e5 ("feat(psci): add support for PSCI_SET_SUSPEND_MODE"
, gerrit ID Iebf65f5f7846aef6b8643ad6082db99b4dcc4bef) and commit
9a70e69e0598 ("feat(psci): update PSCI_FEATURES", gerrit ID
I5da8a989b53419ad2ab55b73ddeee6e882c25554) introduced two "case"
sections for 32-bit function IDs in the 64-bit branch, which will never
trigger. The one small extra case caused the sun50i_a64 DEBUG build to
go beyond its RAM limit.

Removed the redundant switch/case blocks, to make sun50i_a64 build
again.

Change-Id: Ic65b7403d128837296a0c3af42c6f23f9f57778e
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agodocs(maintainers): update NPU driver owners
Mikael Olsson [Mon, 27 Mar 2023 16:52:39 +0000 (18:52 +0200)]
docs(maintainers): update NPU driver owners

Mikael Olsson will no longer be working with the Arm(R) Ethos(TM)-N NPU
so Ştefana Simion will take over the ownership of the driver.

Change-Id: If22bbdcb26af9bf851efc14ad96ed76c745eadfd
Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2 years agodocs(maintainers): update NPU driver files
Mikael Olsson [Tue, 28 Mar 2023 13:51:49 +0000 (15:51 +0200)]
docs(maintainers): update NPU driver files

New files have been added for the Arm(R) Ethos(TM)-N NPU driver with the
addition of TZMP1 support so the files in the maintainers list have been
updated accordingly.

Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
Change-Id: I3768b2ab78c117c1dd4fc03b38cf35f6811fa378

2 years agodocs(ethos-n): update porting-guide.rst for NPU
Rob Hughes [Mon, 20 Feb 2023 12:03:52 +0000 (12:03 +0000)]
docs(ethos-n): update porting-guide.rst for NPU

Add some missing configuration that must be done for supporting NPU on
other platforms.

Signed-off-by: Rob Hughes <robert.hughes@arm.com>
Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
Change-Id: Ic505ea60f73b970d0d7ded101830eb2ce8c7ab64

2 years agofeat(ethos-n): add separate RO and RW NSAIDs
Mikael Olsson [Tue, 14 Mar 2023 17:29:06 +0000 (18:29 +0100)]
feat(ethos-n): add separate RO and RW NSAIDs

To be able to further restrict the memory access for the Arm(R)
Ethos(TM)-N NPU, separate read-only and read/write NSAIDs for the
non-protected and protected memory have been added to the Juno
platform's TZMP1 TZC configuration for the NPU.

The platform definition has been updated accordingly and the NPU driver
will now only give read/write access to the streams that require it.

Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
Change-Id: I5a173500fc1943a5cd406a3b379e1f1f554eeda6

2 years agofeat(ethos-n)!: add protected NPU firmware setup
Mikael Olsson [Fri, 10 Feb 2023 15:59:23 +0000 (16:59 +0100)]
feat(ethos-n)!: add protected NPU firmware setup

When the Arm(R) Ethos(TM)-N NPU driver is built with TZMP1 support, the
NPU should use the firmware that has been loaded into the protected
memory by BL2. The Linux Kernel NPU driver in the non-secure world is
not allowed to configure the NPU to do this in a TZMP1 build so the SiP
service will now configure the NPU to boot with the firmware in the
protected memory.

BREAKING CHANGE: The Linux Kernel NPU driver can no longer directly
configure and boot the NPU in a TZMP1 build. The API version has
therefore been given a major version bump with this change.

Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
Change-Id: I65d00f54b3ade3665d7941e270da7a3dec02281a

2 years agofeat(ethos-n): add stream extends and attr support
Mikael Olsson [Fri, 10 Feb 2023 15:59:03 +0000 (16:59 +0100)]
feat(ethos-n): add stream extends and attr support

The SiP service for the Arm(R) Ethos(TM)-N NPU driver will now handle
setting up the address extension and attribute control for the NPU's
streams. The non-secure world will still be allowed to read the address
extension for stream0 but non-secure access to all other streams have
been removed.

The API version has been given a minor bump with this change to indicate
the added functionality.

Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
Change-Id: I2b041ca4a0a2b5cd6344a4ae144f75e137c72592

2 years agofeat(ethos-n): add reserved memory address support
Mikael Olsson [Fri, 10 Feb 2023 10:39:40 +0000 (11:39 +0100)]
feat(ethos-n): add reserved memory address support

The FCONF parsing of the HW_CONFIG for the Arm(R) Ethos(TM)-N NPU now
supports reading the address of the reserved memory setup for the NPU so
the address can be used in the SiP service for the NPU.

Change-Id: I0968255a966e84896b00ea935d6aa3d5232c5f7b
Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
2 years agofeat(ethos-n): add event and aux control support
Mikael Olsson [Fri, 10 Feb 2023 10:36:19 +0000 (11:36 +0100)]
feat(ethos-n): add event and aux control support

The SiP service for the Arm(R) Ethos(TM)-N NPU driver will now handle
setting up the NPU's event and aux control registers during the SMC
reset call. The aux control register will no longer be accessible by the
non-secure world.

The API version has been given a minor bump with this change to indicate
the added functionality.

Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
Change-Id: I5b099e25978aa4089c384eb17c5060c5b4eaf373

2 years agofeat(ethos-n): add SMC call to get FW properties
Mikael Olsson [Fri, 27 Jan 2023 17:53:48 +0000 (18:53 +0100)]
feat(ethos-n): add SMC call to get FW properties

When the Arm(R) Ethos(TM)-N NPU firmware is loaded by BL2 into protected
memory, the Linux kernel NPU driver cannot access the firmware. To still
allow the kernel driver to access some information about the firmware,
SMC calls have been added so it can check compatibility and get the
necessary information to map the firmware into the SMMU for the NPU.

The API version has been given a minor version bump with this change to
indicate the added functionality.

Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
Change-Id: Idb076b7bcf54ed7e8eb39be80114dc1d1c45336d

2 years agorefactor(ethos-n): split up SMC call handling
Mikael Olsson [Fri, 27 Jan 2023 17:26:36 +0000 (18:26 +0100)]
refactor(ethos-n): split up SMC call handling

Doing all the SMC call handling in a single function and using specific
names for the x1-4 parameters is no longer practical for upcoming
additions to the SiP service. Handling of the different SMC functions
have therefore been split into separate functions.

Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
Change-Id: If28da8df0f13c449d1fdb2bd9d792d818ec5e1af

2 years agofeat(ethos-n): add NPU firmware validation
Mikael Olsson [Fri, 13 Jan 2023 08:56:41 +0000 (09:56 +0100)]
feat(ethos-n): add NPU firmware validation

When the Arm(R) Ethos(TM)-N NPU driver is built with TZMP1 support, it
will now validate the NPU firmware binary that BL2 is expected to load
into the protected memory location specified by
ARM_ETHOSN_NPU_IMAGE_BASE.

Juno has been updated with a new BL31 memory mapping to allow the SiP
service to read the protected memory that contains the NPU firmware
binary.

Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
Change-Id: I633256ab7dd4f8f5a6f864c8c98a66bf9dfc37f3

2 years agofeat(ethos-n): add check for NPU in SiP setup
Mikael Olsson [Wed, 18 Jan 2023 17:05:15 +0000 (18:05 +0100)]
feat(ethos-n): add check for NPU in SiP setup

The SiP service in the Arm(R) Ethos(TM)-N NPU driver requires that there
is at least one NPU available. If there is no NPU available, the driver
is either used incorrectly or the HW config is incorrect.

To ensure that the SiP service is not incorrectly used, a setup handler
has been added to the service that will validate that there is at least
one NPU available.

Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
Change-Id: I8139a652f265cfc0db4a37464f39f1fb92868e10

2 years agofeat(ethos-n)!: load NPU firmware at BL2
Rob Hughes [Tue, 17 Jan 2023 16:10:26 +0000 (16:10 +0000)]
feat(ethos-n)!: load NPU firmware at BL2

BL2 on Juno now loads the Arm(R) Ethos(TM)-N NPU firmware into a fixed
address, using the existing image loading framework.

Includes support for TRUSTED_BOARD_BOOT, if enabled, using the firmware
content and key certificates from the FIP.

Supports the ARM_IO_IN_DTB option so can specify the firmware location
from the dtb rather than it being hardcoded to the FIP

Update makefile to automatically embed the appropriate images into the
FIP.

BREAKING CHANGE: Building the FIP when TZMP1 support is enabled in the
NPU driver now requires a parameter to specify the NPU firmware file.

Signed-off-by: Rob Hughes <robert.hughes@arm.com>
Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
Change-Id: I8cd64fb20d58f8bd539facb085606213d6cead06

2 years agofeat(juno): support ARM_IO_IN_DTB option for Juno
Rob Hughes [Fri, 20 Jan 2023 10:47:30 +0000 (10:47 +0000)]
feat(juno): support ARM_IO_IN_DTB option for Juno

Add UUIDs for loadable FIP images to Juno's tb_fw_config device tree, so
that it can be built with the ARM_IO_IN_DTB option. Increase the
max-size of the tb_fw-config image accordingly, as the new entries
enlarge that image(new size is 2,116 bytes, rounded up to 2,560 =
0xA00)

Signed-off-by: Rob Hughes <robert.hughes@arm.com>
Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
Change-Id: I557bca7dd32c3be084bbba11d84dfa2818cb6789

2 years agofix(fconf): fix FCONF_ARM_IO_UUID_NUMBER value
Rob Hughes [Fri, 20 Jan 2023 10:43:41 +0000 (10:43 +0000)]
fix(fconf): fix FCONF_ARM_IO_UUID_NUMBER value

The FCONF_ARM_IO_UUID_NUMBER macro is hardcoded to the number of entries
in the `load_info` array, but this number did not match the actual
length of the array in the case that TRUSTED_BOARD_BOOT is defined, but
SPD_spmd is not defined.

This patch fixes the hardcoded length by replacing it with a more
flexible calculation which sums up the various contributing groups of
entries.

Signed-off-by: Rob Hughes <robert.hughes@arm.com>
Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
Change-Id: I557bca7dd32c3be084bbba11d84dfa2818cb6790

2 years agofix(fvp): incorrect UUID name in FVP tb_fw_config
Rob Hughes [Fri, 20 Jan 2023 10:40:27 +0000 (10:40 +0000)]
fix(fvp): incorrect UUID name in FVP tb_fw_config

Signed-off-by: Rob Hughes <robert.hughes@arm.com>
Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
Change-Id: I557bca7dd32c3be084bbba11d84dfa2818cb6791

2 years agofix(ethos-n): add workaround for erratum 2838783
Mikael Olsson [Wed, 11 Jan 2023 09:36:22 +0000 (10:36 +0100)]
fix(ethos-n): add workaround for erratum 2838783

To workaround Arm(R) Ethos(TM)-N NPU erratum 2838783, the NPU has been
configured to allow being woken up by both secure and non-secure events
to make sure that an event always wakes up the NPU.

The API version has been given a minor version bump with this change to
indicate that this fix is included.

Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
Change-Id: I429cdd6bf1e633b4dedf2e94af28937dd892a0ba

2 years agofeat(ethos-n): add support for NPU to cert_create
Mohamed Elzahhar [Wed, 16 Nov 2022 12:05:37 +0000 (12:05 +0000)]
feat(ethos-n): add support for NPU to cert_create

Add Juno specific Makefile to the certificate tool build. That
Makefile is included by the certificate tool Makefile to add
information about the authentication data for the
Arm(R) Ethos(TM)-N NPU's firmware binary.

Signed-off-by: Mohamed Elzahhar <Mohamed.Elzahhar@arm.com>
Signed-off-by: Rob Hughes <robert.hughes@arm.com>
Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
Change-Id: Ie4b6a1c29d73b3ed5041b57f2cd88033be18a63a

2 years agofeat(ethos-n): add NPU support in fiptool
Daniele Castro [Thu, 24 Nov 2022 12:06:13 +0000 (12:06 +0000)]
feat(ethos-n): add NPU support in fiptool

Add platform specific Makefile to add UUIDs and command options
for the Arm(R) Ethos(TM)-N NPU firmware binary and certificate
data to the FIP so that the TF-A's BL2 can later be used to load
the Arm(R) Ethos(TM)-N NPU firmware binary into memory and verify
its integrity.

Add separate driver specific include header file for the
Arm(R) Ethos(TM)-N NPU images containing UUIDs and command options
to make it easy to port the FIP support to other platforms.

Signed-off-by: Daniele Castro <daniele.castro@arm.com>
Signed-off-by: Rob Hughes <robert.hughes@arm.com>
Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
Change-Id: I8cd64fb20d58f8bd539facb085606213d6cead05

2 years agofeat(ethos-n): add support to set up NSAID
Rajasekaran Kalidoss [Wed, 16 Nov 2022 16:16:44 +0000 (17:16 +0100)]
feat(ethos-n): add support to set up NSAID

For the TZC to allow the Arm(R) Ethos(TM)-N NPU to access the buffers
allocated in a protected memory region, it must include the correct
NSAID for that region in its transactions to the memory.  This change
updates the SiP service to configure the NSAIDs specified by a platform
define. When doing a protected access the SiP service now configures the
NSAIDs specified by the platform define. For unprotected access the
NSAID is set to zero.

Signed-off-by: Rajasekaran Kalidoss <rajasekaran.kalidoss@arm.com>
Signed-off-by: Rob Hughes <robert.hughes@arm.com>
Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
Change-Id: I3360ef33705162aba5c67670386922420869e331

2 years agobuild(fiptool): add object dependency generation
Mikael Olsson [Thu, 8 Dec 2022 16:07:06 +0000 (17:07 +0100)]
build(fiptool): add object dependency generation

The object target in the fiptool Makefile only depends on the
corresponding source file so it won't rebuild the object, if a header
file used by the source file is changed.

To make it rebuild the object file for both source and header file
changes, a dependency file will now be generated for each object and
included in the Makefile.

Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
Change-Id: I0468c6e9c54126242150667268d471f28e011b0d

2 years agofeat(ethos-n): add NPU sleeping SMC call
Mikael Olsson [Fri, 4 Nov 2022 14:01:02 +0000 (15:01 +0100)]
feat(ethos-n): add NPU sleeping SMC call

The non-secure world delegation of the register needed to determine if
the Arm(R) Ethos(TM)-N NPU is active or sleeping will be removed in the
future. In preparation for the change, a new SMC call has been added to
allow the non-secure world to ask the SiP service for the state instead.

A minor API version bump has been done with this change to indicate
support for the new functionality.

Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
Change-Id: I1338341be385cf1891f4809efb7083fae6d928bc

2 years agofeat(ethos-n): add multiple asset allocators
Joshua Pimm [Wed, 9 Nov 2022 11:26:11 +0000 (11:26 +0000)]
feat(ethos-n): add multiple asset allocators

Adds additional asset allocators to the device tree include
file as the non-secure world kernel module for the Arm(R)
Ethos(TM)-N NPU now fully supports having and using multiple
asset allocators.

Signed-off-by: Joshua Pimm <joshua.pimm@arm.com>
Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
Change-Id: I82d53667ef64968ee814f611d0a90abd3b3cf3de

2 years agofeat(ethos-n): add reset type to reset SMC calls
Joshua Pimm [Wed, 19 Oct 2022 14:46:27 +0000 (15:46 +0100)]
feat(ethos-n): add reset type to reset SMC calls

Adds a reset type argument for the soft and hard reset SMC calls to
indicate whether to perform a full reset and setup or only halt the
Arm(R) Ethos(TM)-N NPU. For use in cases where the NPU will not be
used but must be put into a known state, such as suspending the NPU
as part of power management.

Signed-off-by: Joshua Pimm <joshua.pimm@arm.com>
Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
Change-Id: I6018af85a28b0e977166ec29d26f04739123140c

2 years agofeat(ethos-n): add protected NPU TZMP1 regions
Bjorn Engstrom [Mon, 19 Sep 2022 06:34:03 +0000 (08:34 +0200)]
feat(ethos-n): add protected NPU TZMP1 regions

TZMP1 protected memory regions have been added in the Juno platform to
store sensitive data for the Arm(R) Ethos(TM)-N NPU
This is enabled when building TF-A with ARM_ETHOSN_NPU_TZMP1.

The NPU uses two protected memory regions:
 1) Firmware region to protect the NPU's firmware from being modified
    from the non-secure world
 2) Data region for sensitive data used by the NPU

Respective memory region can only be accessed with their unique NSAID.

Signed-off-by: Bjorn Engstrom <bjoern.engstroem@arm.com>
Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
Signed-off-by: Rob Hughes <robert.hughes@arm.com>
Change-Id: I65200047f10364ca18681ce348a6edb2ffb9b095

2 years agobuild(ethos-n): add TZMP1 build flag
Bjorn Engstrom [Fri, 26 Aug 2022 07:45:45 +0000 (09:45 +0200)]
build(ethos-n): add TZMP1 build flag

For the Arm(R) Ethos(TM)-N NPU Driver to support running inference with
protected memory the TZC must be configured with appropriate regions.

This is controlled in build time by the now added build flag.

The new build flag is only supported with the Arm Juno platform and the
TZC is configured with default memory regions as if TZMP1 wasn't
enabled to facilitate adding the new memory regions later.

Signed-off-by: Bjorn Engstrom <bjoern.engstroem@arm.com>
Signed-off-by: Rob Hughes <robert.hughes@arm.com>
Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
Change-Id: I9dc49ac5d091cfbc8c20d7c3ab394a2836438b0f

2 years agoMerge "fix(fvp): work around BL31 progbits exceeded" into integration
Joanna Farley [Mon, 3 Apr 2023 16:53:48 +0000 (18:53 +0200)]
Merge "fix(fvp): work around BL31 progbits exceeded" into integration

2 years agofix(fvp): work around BL31 progbits exceeded
Boyan Karatotev [Thu, 30 Mar 2023 13:56:45 +0000 (14:56 +0100)]
fix(fvp): work around BL31 progbits exceeded

It is useful to have a single build for the FVP that includes as much
stuff as possible. Such a build allows a single TF-A build to be used on
a wide variety of fvp command lines. Unfortunately, the fvp also has a
(somewhat arbitrary) SRAM limit and enabling a bunch of stuff overruns
what is available.

To workaround this limit, don't enable everything for all
configurations. The offending configuration is when tsp is enabled, so
try to slim the binary down only when building with it.

As this doesn't solve the issue of running out of space for BL31, update
the linker error to give some clue as to what has (likely) caused it
while more permanent fixes are found.

Also add FEAT_RNG to the mix as it got missed in the commotion.

Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
Change-Id: Icb27cc837c2d90ca182693e9b3121b51383d51fd

2 years agoMerge "docs(sve): update defaults for FEAT_SVE" into integration
Manish Pandey [Mon, 3 Apr 2023 16:17:30 +0000 (18:17 +0200)]
Merge "docs(sve): update defaults for FEAT_SVE" into integration

2 years agoMerge changes from topic "jc/sve" into integration
Manish Pandey [Mon, 3 Apr 2023 16:09:12 +0000 (18:09 +0200)]
Merge changes from topic "jc/sve" into integration

* changes:
  fix(qemu): enable dynamic feature detection of FEAT_SVE for NormalWorld
  fix(tc): enable dynamic feature detection of FEAT_SVE for NormalWorld

2 years agodocs(sve): update defaults for FEAT_SVE
Jayanth Dodderi Chidanand [Mon, 3 Apr 2023 10:24:26 +0000 (11:24 +0100)]
docs(sve): update defaults for FEAT_SVE

FEAT_SVE build macro, "ENABLE_SVE_FOR_NS" default value has been updated
to 2, to support its existing behavior of dynamic detection as well as
keep it aligned with the changes concerning STATE=FEAT_STATE_CHECKED(2),
part of Feature Detection procedure.

Change-Id: Iee43e899f19dc9d5eb57c235998758f462a8c397
Signed-off-by: Jayanth Dodderi Chidanand <jayanthdodderi.chidanand@arm.com>
2 years agofix(qemu): enable dynamic feature detection of FEAT_SVE for NormalWorld
Jayanth Dodderi Chidanand [Fri, 31 Mar 2023 09:42:10 +0000 (10:42 +0100)]
fix(qemu): enable dynamic feature detection of FEAT_SVE for NormalWorld

Currently, TF-A supports three states for feature flags:
0: FEAT_DISABLED
1: FEAT_STATE_ALWAYS ( for fixed/real platforms)
2: FEAT_STATE_CHECK  ( for configurable platforms)
to meet the feature detection requirements dynamically, mainly
targetting configurable/Fixed Virtual platforms.

With this mechanism in place, we are refactoring all the existing
feature flags to the FEAT_STATE_CHECK option(=2), including
FEAT_SVE explicitly for FVPs.

SVE Patch Reference:
https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/19888/25

This newly introduced change, breaks the existing behaviour especially
for virtual platforms, who have set the ENABLE_SVE_FOR_NS flag to 1.

Moving ahead, we advise the platforms to take the following steps while
enabling the features:

1. If the platform is configurable (virtual), and want to ensure feature
detection happens dynamically at runtime, set the build flags to
FEAT_STATE_CHECK(=2).

2. For real(fixed) platforms, depending on the features supported by the
hardware and platform wants to enable it, platforms could set build
flags to FEAT_STATE_ALWAYS(=1).

(Note: Only the non-secure world enablement related build flags have
been refactored to take the values within 0 to 2. As earlier Secure
world enablement flags will still remain boolean.)

Henceforth, in order to keep it aligned with this tri-state mechanism,
changing the qemu platform default to the now supported dynamic
option(=2), so the right decision can be made by the code at runtime.

Change-Id: Icc95b8b872378b7874d4345b631adfc314e4dada
Signed-off-by: Jayanth Dodderi Chidanand <jayanthdodderi.chidanand@arm.com>
2 years agofix(tc): enable dynamic feature detection of FEAT_SVE for NormalWorld
Jayanth Dodderi Chidanand [Fri, 31 Mar 2023 09:39:22 +0000 (10:39 +0100)]
fix(tc): enable dynamic feature detection of FEAT_SVE for NormalWorld

Currently, TF-A supports three states for feature flags:
0: FEAT_DISABLED
1: FEAT_STATE_ALWAYS (for fixed/real platforms)
2: FEAT_STATE_CHECK  (for configurable platforms)
to meet the feature detection requirements dynamically, mainly
targetting configurable/Fixed Virtual platforms.

With this mechanism in place, we are refactoring all the existing
feature flags to the FEAT_STATE_CHECK option(=2), including
FEAT_SVE explicitly for FVPs.

SVE Patch Reference:
https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/19888/25

This newly introduced change, breaks the existing behaviour especially
for virtual platforms, who have set the ENABLE_SVE_FOR_NS flag to 1.

Moving ahead, we advise the platforms to take the following steps while
enabling the features:

1. If the platform is configurable (virtual), and want to ensure feature
detection happens dynamically at runtime, set the build flags to
FEAT_STATE_CHECK(=2).

2. For real(fixed) platforms, depending on the features supported by the
hardware and platform wants to enable it, platforms could set build
flags to FEAT_STATE_ALWAYS(=1).

(Note: Only the non-secure world enablement related build flags have
been refactored to take the values within 0 to 2. As earlier Secure
world enablement flags will still remain boolean.)

Henceforth, in order to keep it aligned with this tri-state mechanism,
changing the TC platform default to the now supported dynamic
option(=2), so the right decision can be made by the code at runtime.

Change-Id: I4c1ebeb55a00a7f148fac1573a6694b7c02a0a81
Signed-off-by: Jayanth Dodderi Chidanand <jayanthdodderi.chidanand@arm.com>
2 years agoMerge changes I6b4a4d22,I06bde289,I86e39481,I7ea9b75c into integration
Madhukar Pappireddy [Mon, 3 Apr 2023 14:39:20 +0000 (16:39 +0200)]
Merge changes I6b4a4d22,I06bde289,I86e39481,I7ea9b75c into integration

* changes:
  feat(stm32mp1-fdts): use /omit-if-no-ref/ for pins nodes
  feat(st): mandate dtc version 1.4.7
  refactor(st): move mbedtls config files
  refactor(st): add common mk files

2 years agoMerge "fix(aarch64): allow build with ARM_ARCH_MINOR=4" into integration
Manish Pandey [Thu, 30 Mar 2023 12:12:09 +0000 (14:12 +0200)]
Merge "fix(aarch64): allow build with ARM_ARCH_MINOR=4" into integration

2 years agofix(aarch64): allow build with ARM_ARCH_MINOR=4
Andre Przywara [Tue, 28 Mar 2023 15:55:06 +0000 (16:55 +0100)]
fix(aarch64): allow build with ARM_ARCH_MINOR=4

When building the FVP platform with SPMD (which activates the context
switch code), but keeping ARM_ARCH_MINOR to 4 or lower, the assembler
will complain about the SCXTNUM_EL2 system register not being supported
by the "selected processor".

Allow building this combination of options by defining the SCXTNUM_EL2
register via the generic S3_ encoding, so any assembler, with any -march
settings, will generate the access without any warnings.

We do protect accesses to this register by runtime checks, if not
explicitly requested otherwise, so can override the toolchain in this
case.

Change-Id: I0941f4c4dcf541bd968c153b9c3fac61ca23f7ef
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agoMerge "fix(optee): return UUID for image loading service" into integration
Julius Werner [Wed, 29 Mar 2023 20:22:44 +0000 (22:22 +0200)]
Merge "fix(optee): return UUID for image loading service" into integration

2 years agoMerge "feat(mediatek): add APU init flow" into integration
Mark Dykes [Wed, 29 Mar 2023 12:33:37 +0000 (14:33 +0200)]
Merge "feat(mediatek): add APU init flow" into integration

2 years agoMerge changes from topic "jc/cpu_feat" into integration
Manish Pandey [Wed, 29 Mar 2023 09:21:55 +0000 (11:21 +0200)]
Merge changes from topic "jc/cpu_feat" into integration

* changes:
  feat(cpufeat): enable FEAT_SVE for FEAT_STATE_CHECKED
  feat(cpufeat): enable FEAT_SME for FEAT_STATE_CHECKED

2 years agofeat(mediatek): add APU init flow
Chungying Lu [Wed, 15 Mar 2023 06:16:28 +0000 (14:16 +0800)]
feat(mediatek): add APU init flow

The patch brings preparation steps before powering on APU
(AI processing unit)

Change-Id: Ica01e035153ec6f3af0de6ba2c66b17a064f8c89
Signed-off-by: Chungying Lu <chungying.lu@mediatek.com>
2 years agoMerge changes from topic "set-wake-source-for-versal-net" into integration
Joanna Farley [Tue, 28 Mar 2023 16:38:49 +0000 (18:38 +0200)]
Merge changes from topic "set-wake-source-for-versal-net" into integration

* changes:
  refactor(xilinx): move enum to common place
  fix(xilinx): fix misra defects
  fix(xilinx): remove unnecessary condition
  feat(versal): replace irq array with switch case
  feat(versal-net): add support for set wakeup source
  refactor(versal): move set wake src fn to common place

2 years agoMerge "feat(stm32mp15-fdts): add support for prtt1x board family" into integration
Manish Pandey [Tue, 28 Mar 2023 15:37:22 +0000 (17:37 +0200)]
Merge "feat(stm32mp15-fdts): add support for prtt1x board family" into integration

2 years agofeat(cpufeat): enable FEAT_SVE for FEAT_STATE_CHECKED
Jayanth Dodderi Chidanand [Tue, 7 Mar 2023 10:43:19 +0000 (10:43 +0000)]
feat(cpufeat): enable FEAT_SVE for FEAT_STATE_CHECKED

Add support for runtime detection (ENABLE_SVE_FOR_NS=2), by splitting
sve_supported() 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 do SVE specific setup.

Change the FVP platform default to the now supported dynamic
option (=2), so the right decision can be made by the code at runtime.

Change-Id: I1caaba2216e8e2a651452254944a003607503216
Signed-off-by: Jayanth Dodderi Chidanand <jayanthdodderi.chidanand@arm.com>
2 years agofeat(cpufeat): enable FEAT_SME for FEAT_STATE_CHECKED
Jayanth Dodderi Chidanand [Mon, 6 Mar 2023 23:56:14 +0000 (23:56 +0000)]
feat(cpufeat): enable FEAT_SME for FEAT_STATE_CHECKED

Add support for runtime detection (ENABLE_SME_FOR_NS=2), by splitting
feat_sme_supported() 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 do SME specific setup.

Change the FVP platform default to the now supported dynamic option
(=2),so the right decision can be made by the code at runtime.

Change-Id: Ida9ccf737db5be20865b84f42b1f9587be0626ab
Signed-off-by: Jayanth Dodderi Chidanand <jayanthdodderi.chidanand@arm.com>
2 years agoMerge "refactor(xilinx): rename gic macros to make common" into integration
Mark Dykes [Tue, 28 Mar 2023 15:10:29 +0000 (17:10 +0200)]
Merge "refactor(xilinx): rename gic macros to make common" into integration

2 years agoMerge changes from topic "set-wake-source-for-versal-net" into integration
Mark Dykes [Tue, 28 Mar 2023 15:09:55 +0000 (17:09 +0200)]
Merge changes from topic "set-wake-source-for-versal-net" into integration

* changes:
  feat(xilinx): add device node indexes
  fix(xilinx): initialize values to device enum members

2 years agoMerge "refactor(xilinx): move pm_defs.h to common place" into integration
Mark Dykes [Tue, 28 Mar 2023 15:09:32 +0000 (17:09 +0200)]
Merge "refactor(xilinx): move pm_defs.h to common place" into integration

2 years agoMerge "refactor(xilinx): move versal files to common place" into integration
Mark Dykes [Tue, 28 Mar 2023 15:06:14 +0000 (17:06 +0200)]
Merge "refactor(xilinx): move versal files to common place" into integration

2 years agoMerge changes from topic "psci-osi" into integration
Manish Pandey [Tue, 28 Mar 2023 10:27:37 +0000 (12:27 +0200)]
Merge changes from topic "psci-osi" into integration

* changes:
  feat(sc7280): add support for PSCI_OS_INIT_MODE
  feat(fvp): enable support for PSCI OS-initiated mode
  feat(psci): update PSCI_FEATURES
  feat(psci): add support for OS-initiated mode
  feat(psci): add support for PSCI_SET_SUSPEND_MODE
  build(psci): add build option for OS-initiated mode
  docs(psci): add design proposal for OS-initiated mode

2 years agoMerge changes from topic "feat_amu_rework" into integration
Manish Pandey [Tue, 28 Mar 2023 10:24:59 +0000 (12:24 +0200)]
Merge changes from topic "feat_amu_rework" into integration

* changes:
  refactor(amu): use new AMU feature check routines
  refactor(amu): unify ENABLE_AMU and ENABLE_FEAT_AMUv1

2 years agorefactor(xilinx): move enum to common place
Jay Buddhabhatti [Thu, 23 Mar 2023 12:02:50 +0000 (05:02 -0700)]
refactor(xilinx): move enum to common place

Moved IOCTL enum from ZynqMP to common place so that it can be used
for all the platforms.

Signed-off-by: Jay Buddhabhatti <jay.buddhabhatti@amd.com>
Change-Id: I6ad992da30f2def9f46c8ba79753d79ed00fe024

2 years agofix(xilinx): fix misra defects
Jay Buddhabhatti [Fri, 10 Feb 2023 06:56:53 +0000 (22:56 -0800)]
fix(xilinx): fix misra defects

This patch fixes defects 5.5, 10.1, 10.3, 10.4, 10.7 reported
by MISRA-2012 scan.

Signed-off-by: Jay Buddhabhatti <jay.buddhabhatti@amd.com>
Change-Id: Ie6f6e9bf2ce1335bbb61aa2e69a3a196865fd504

2 years agofix(xilinx): remove unnecessary condition
Jay Buddhabhatti [Fri, 3 Feb 2023 09:16:44 +0000 (01:16 -0800)]
fix(xilinx): remove unnecessary condition

Remove unnecessary condition check from pm_client_set_wakeup_sources()
as the code will never get to this condition.

Signed-off-by: Jay Buddhabhatti <jay.buddhabhatti@amd.com>
Change-Id: Ia046e1188fdf6e024a146d3f4dd3d8f87a285e7f

2 years agofeat(versal): replace irq array with switch case
Jay Buddhabhatti [Fri, 23 Dec 2022 06:27:01 +0000 (22:27 -0800)]
feat(versal): replace irq array with switch case

Replaced array of interrupt to PM node index map with switch-case for
Versal. As a result, the size of code got reduced by 527 bytes. In case
of error return invalid node index i.e. XPM_NODEIDX_DEV_MIN.

Signed-off-by: Jay Buddhabhatti <jay.buddhabhatti@amd.com>
Change-Id: Ifb17366362e2d1757d8933e1ce29083f7ad86b8f

2 years agofeat(versal-net): add support for set wakeup source
Jay Buddhabhatti [Fri, 23 Dec 2022 04:56:02 +0000 (20:56 -0800)]
feat(versal-net): add support for set wakeup source

Currently wakeup source is not getting setup during suspend resume.
Add support to set wakeup source as per IRQ enabled using switch-case
instead of static array as it is more efficient.

Signed-off-by: Jay Buddhabhatti <jay.buddhabhatti@amd.com>
Change-Id: I30d7ceb3a1d56ba5174fc7334f3a29081c918c92

2 years agorefactor(versal): move set wake src fn to common place
Jay Buddhabhatti [Tue, 28 Feb 2023 10:22:02 +0000 (02:22 -0800)]
refactor(versal): move set wake src fn to common place

Moved pm_client_set_wakeup_sources() to make common for both Versal and
Versal NET platforms.

Signed-off-by: Jay Buddhabhatti <jay.buddhabhatti@amd.com>
Change-Id: Ib82c5f85a0a27bc47940f6796f1cf68b2c38a908

2 years agorefactor(xilinx): rename gic macros to make common
Jay Buddhabhatti [Tue, 28 Feb 2023 09:23:04 +0000 (01:23 -0800)]
refactor(xilinx): rename gic macros to make common

Rename macros PLAT_VERSAL_GICD_BASE, PLAT_VERSAL_GICR_BASE,
PLAT_VERSAL_NET_GICD_BASE and PLAT_VERSAL_NET_GICR_BASE to
PLAT_GICD_BASE_VALUE and PLAT_GICR_BASE_VALUE to make common
for both Versal and Versal NET platforms.

Signed-off-by: Jay Buddhabhatti <jay.buddhabhatti@amd.com>
Change-Id: Ibcebfb8e741e828ef272b32cbedfb4dcbf8629b6

2 years agofeat(xilinx): add device node indexes
Jay Buddhabhatti [Thu, 22 Dec 2022 11:16:14 +0000 (03:16 -0800)]
feat(xilinx): add device node indexes

Add additional Versal NET device node indexes to the existing list
that are for new APU cores, RPU cores, OCM and TCM memories, USB 1
and WDT devices.

Signed-off-by: Jay Buddhabhatti <jay.buddhabhatti@amd.com>
Change-Id: Iea0570ae5d81de9c5b2793329ae1e7284b6c5a3f

2 years agofix(xilinx): initialize values to device enum members
Jay Buddhabhatti [Thu, 22 Dec 2022 11:05:59 +0000 (03:05 -0800)]
fix(xilinx): initialize values to device enum members

Initialized values explicitly to device enum members to avoid
value assignment from the compiler and for better readability.

Signed-off-by: Jay Buddhabhatti <jay.buddhabhatti@amd.com>
Change-Id: I20f24c3b4fb47b2b011def9f1f43ea8238c66b80

2 years agorefactor(xilinx): move pm_defs.h to common place
Jay Buddhabhatti [Fri, 3 Feb 2023 06:34:03 +0000 (22:34 -0800)]
refactor(xilinx): move pm_defs.h to common place

Moved pm_defs.h file to common place so that it can be used for
Versal NET and ZynqMP. Also moved common code from zynqmp_pm_defs.h to
common place.

Signed-off-by: Jay Buddhabhatti <jay.buddhabhatti@amd.com>
Change-Id: I2ee1e72258c6052cdd6467cdbcf4009afb98da49

2 years agorefactor(xilinx): move versal files to common place
Jay Buddhabhatti [Thu, 22 Dec 2022 07:03:35 +0000 (23:03 -0800)]
refactor(xilinx): move versal files to common place

Moved necessary files to common place so that it can be used for
Versal NET.

Signed-off-by: Jay Buddhabhatti <jay.buddhabhatti@amd.com>
Change-Id: I611fa849207b082e6599acfb65c55d27b9c99435

2 years agorefactor(amu): use new AMU feature check routines
Andre Przywara [Fri, 3 Mar 2023 10:30:06 +0000 (10:30 +0000)]
refactor(amu): use new AMU feature check routines

The AMU extension code was using its own feature detection routines.
Replace them with the generic CPU feature handlers (defined in
arch_features.h), which get updated to cover the v1p1 variant as well.

Change-Id: I8540f1e745d7b02a25a6c6cdf2a39d6f5e21f2aa
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agorefactor(amu): unify ENABLE_AMU and ENABLE_FEAT_AMUv1
Andre Przywara [Tue, 21 Mar 2023 13:53:19 +0000 (13:53 +0000)]
refactor(amu): unify ENABLE_AMU and ENABLE_FEAT_AMUv1

So far we have the ENABLE_AMU build option to include AMU register
handling code for enabling and context switch. There is also an
ENABLE_FEAT_AMUv1 option, solely to protect the HAFGRTR_EL2 system
register handling. The latter needs some alignment with the new feature
scheme, but it conceptually overlaps with the ENABLE_AMU option.

Since there is no real need for two separate options, unify both into a
new ENABLE_FEAT_AMU name in a first step. This is mostly just renaming at
this point, a subsequent patch will make use of the new feature handling
scheme.

Change-Id: I97d8a55bdee2ed1e1509fa9f2b09fd0bdd82736e
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agoMerge changes from topic "xlnx_zynqmp_changes" into integration
Joanna Farley [Mon, 27 Mar 2023 17:10:52 +0000 (19:10 +0200)]
Merge changes from topic "xlnx_zynqmp_changes" into integration

* changes:
  feat(zynqmp): build pm code as library
  chore(zynqmp): print entry address to Secure and NS world

2 years agofeat(zynqmp): build pm code as library
Amit Nagal [Thu, 23 Mar 2023 08:46:01 +0000 (14:16 +0530)]
feat(zynqmp): build pm code as library

Build Platform Management(PM) code as an Library.
Building PM code as library provides an option to switch to different
firmware interfaces like custom packages.

Change-Id: I872d45edf55ac83a6efb86591d12a0fef7b598cb
Signed-off-by: Amit Nagal <amit.nagal@amd.com>
Signed-off-by: Akshay Belsare <akshay.belsare@amd.com>
2 years agochore(zynqmp): print entry address to Secure and NS world
Akshay Belsare [Mon, 27 Mar 2023 05:11:54 +0000 (10:41 +0530)]
chore(zynqmp): print entry address to Secure and NS world

The base address for BL32 and BL33 is read from the FSBL to TF-A
handoff params.
Print the base address for BL32 and BL33 as entry to the secure and
non-secure world respectively in the release build.

Change-Id: Icc976fccb56b565f78001d87b02180ced6437a43
Signed-off-by: Akshay Belsare <akshay.belsare@amd.com>
2 years agoMerge changes from topic "feat_state_part4" into integration
Manish Pandey [Mon, 27 Mar 2023 11:08:26 +0000 (13:08 +0200)]
Merge changes from topic "feat_state_part4" into integration

* changes:
  refactor(cpufeat): enable FEAT_RNG for FEAT_STATE_CHECKED
  refactor(cpufeat): align FEAT_SEL2 to new feature handling
  refactor(cpufeat): enable FEAT_NV2 for FEAT_STATE_CHECKED
  refactor(cpufeat): enable FEAT_TWED for FEAT_STATE_CHECKED
  refactor(cpufeat): enable FEAT_CSV2_2 for FEAT_STATE_CHECKED
  refactor(cpufeat): enable FEAT_ECV for FEAT_STATE_CHECKED
  refactor(cpufeat): enable FEAT_PAN for FEAT_STATE_CHECKED
  refactor(cpufeat): align FEAT_SB to new feature handling
  refactor(cpufeat): use alternative encoding for "SB" barrier
  refactor(cpufeat): enable SYS_REG_TRACE for FEAT_STATE_CHECKED
  fix(cpufeat): make stub enable functions "static inline"
  fix(mpam): feat_detect: support major/minor

2 years agoMerge "docs(maintainers): add new maintainers for MediaTek SoCs" into integration
Joanna Farley [Mon, 27 Mar 2023 08:12:09 +0000 (10:12 +0200)]
Merge "docs(maintainers): add new maintainers for MediaTek SoCs" into integration

2 years agodocs(maintainers): add new maintainers for MediaTek SoCs
Bo-Chen Chen [Fri, 24 Mar 2023 02:35:45 +0000 (10:35 +0800)]
docs(maintainers): add new maintainers for MediaTek SoCs

Change-Id: Ie6afadf16921d084137b0e0b5f2a76ae504a6bc7
Signed-off-by: Bo-Chen Chen <rex-bc.chen@mediatek.com>
2 years agoMerge "fix(fvp): unconditionally include lib/psa headers" into integration
Manish Pandey [Fri, 24 Mar 2023 15:02:57 +0000 (16:02 +0100)]
Merge "fix(fvp): unconditionally include lib/psa headers" into integration

2 years agoMerge "fix(gicv3): workaround for NVIDIA erratum T241-FABRIC-4" into integration
Manish Pandey [Fri, 24 Mar 2023 15:02:16 +0000 (16:02 +0100)]
Merge "fix(gicv3): workaround for NVIDIA erratum T241-FABRIC-4" into integration

2 years agoMerge "fix(versal-net): use spin_lock instead of bakery_lock" into integration
Joanna Farley [Fri, 24 Mar 2023 09:38:12 +0000 (10:38 +0100)]
Merge "fix(versal-net): use spin_lock instead of bakery_lock" into integration

2 years agofix(fvp): unconditionally include lib/psa headers
Manish V Badarkhe [Fri, 24 Mar 2023 08:22:33 +0000 (08:22 +0000)]
fix(fvp): unconditionally include lib/psa headers

Included lib/psa headers uncondiitionally to leverage their
use across different FVP build configurations.

Change-Id: I3417925e544d9ec20606a2ffba3d46ef7adaa730
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
2 years agofeat(sc7280): add support for PSCI_OS_INIT_MODE
Maulik Shah [Tue, 14 Feb 2023 07:33:24 +0000 (13:03 +0530)]
feat(sc7280): add support for PSCI_OS_INIT_MODE

Enable PSCI_OS_INIT_MODE support for sc7280.

Change-Id: If94d59190c0bd876e748cd80b2641ce7616fd817
Signed-off-by: Maulik Shah <quic_mkshah@quicinc.com>
2 years agofeat(fvp): enable support for PSCI OS-initiated mode
Wing Li [Fri, 27 Jan 2023 02:33:43 +0000 (18:33 -0800)]
feat(fvp): enable support for PSCI OS-initiated mode

Change-Id: I4cd6d2bd7ec7f581bd525d5323a3b54e855e2e51
Signed-off-by: Wing Li <wingers@google.com>
2 years agofix(gicv3): workaround for NVIDIA erratum T241-FABRIC-4
Varun Wadekar [Wed, 8 Mar 2023 16:47:38 +0000 (16:47 +0000)]
fix(gicv3): workaround for NVIDIA erratum T241-FABRIC-4

The purpose of this patch is to address the T241 erratum T241-FABRIC-4,
which causes unexpected behavior in the GIC when multiple transactions
are received simultaneously from different sources. This hardware issue
impacts NVIDIA server platforms that use more than two T241 chips
interconnected. Each chip has support for 320 {E}SPIs.

This issue occurs when multiple packets from different GICs are
incorrectly interleaved at the target chip. The erratum text below
specifies exactly what can cause multiple transfer packets susceptible
to interleaving and GIC state corruption. GIC state corruption can
lead to a range of problems, including kernel panics, and unexpected
behavior.

Erratum documentation:
https://developer.nvidia.com/docs/t241-fabric-4/nvidia-t241-fabric-4-errata.pdf

The workaround is to ensure that MMIO accesses target the GIC on the
socket that holds the data, for example SPI ranges owned by the socket’s
GIC. This ensures that the GIC will not utilize the inter-socket AXI
Stream interface for servicing these GIC MMIO accesses.

This patch updates the functions that use the GICD_In{E} registers to
ensure that the accesses are directed to the chip that owns the SPI,
instead of using the global alias.

Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
Change-Id: I04e33ba64eb306bd5fdabb56e63cbe273d8cd632

2 years agoMerge "fix(fpga): include missing header file" into integration
Madhukar Pappireddy [Thu, 23 Mar 2023 16:38:42 +0000 (17:38 +0100)]
Merge "fix(fpga): include missing header file" into integration

2 years agoMerge "fix(versal-net): correct aff level for cpu off" into integration
Joanna Farley [Thu, 23 Mar 2023 16:16:13 +0000 (17:16 +0100)]
Merge "fix(versal-net): correct aff level for cpu off" into integration

2 years agoMerge "fix(build): partially fix qemu aarch32 build" into integration
Bipin Ravi [Thu, 23 Mar 2023 15:58:52 +0000 (16:58 +0100)]
Merge "fix(build): partially fix qemu aarch32 build" into integration

2 years agoMerge "refactor(fvp): use RSS API to retrieve attestation token and key" into integration
Sandrine Bailleux [Thu, 23 Mar 2023 13:56:38 +0000 (14:56 +0100)]
Merge "refactor(fvp): use RSS API to retrieve attestation token and key" into integration

2 years agofix(fpga): include missing header file
Andre Przywara [Thu, 23 Mar 2023 11:43:22 +0000 (11:43 +0000)]
fix(fpga): include missing header file

Since transitioning over FEAT_SPE to the new feature checking scheme, we
make use of the new is_feat_spe_supported() function in the Arm FPGA
platform code. However this missed to include the header file, so the
build broke.

Add the arch_features.h header to make arm_fpga compile again.

Change-Id: I5c8feecfcc6fb5845a6671842850df1943086a58
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agofix(versal-net): use spin_lock instead of bakery_lock
Jay Buddhabhatti [Thu, 2 Mar 2023 10:47:36 +0000 (02:47 -0800)]
fix(versal-net): use spin_lock instead of bakery_lock

In ARM v8.2 the cache will turn off automatically when cpu power down.
Therefore use the spin_lock instead of bakery_lock for the platform in
which HW_ASSISTED_COHERENCY is enabled.

In Versal NET platform HW_ASSISTED_COHERENCY is enabled so it will use
spin lock. In ZynqMP and Versal HW_ASSISTED_COHERENCY is not enabled so
it will use bakery_lock.

Also remove bakery_lock_init() because it is empty.

Signed-off-by: Jay Buddhabhatti <jay.buddhabhatti@amd.com>
Change-Id: I18ff939b51f16d7d3484d8564d6ee6c586f363d8

2 years agofix(versal-net): correct aff level for cpu off
Jay Buddhabhatti [Thu, 23 Mar 2023 05:44:16 +0000 (22:44 -0700)]
fix(versal-net): correct aff level for cpu off

CPU suspend is calling validate_power_state PSCI opps which returns
power domain state for CPU suspend according to PSTATE type. In case of
power down it assigns PLAT_MAX_OFF_STATE to all affinity level which is
incorrect since for CPU suspend we need to set only MPIDR_AFFLVL0 which
is CPU state. So correct affinity level for CPU suspend.

Signed-off-by: Jay Buddhabhatti <jay.buddhabhatti@amd.com>
Change-Id: I39f92790ea74e4cab8e87342e73e1ac211a46fcd

2 years agofix(build): partially fix qemu aarch32 build
Rebecca Cran [Wed, 7 Dec 2022 20:24:44 +0000 (13:24 -0700)]
fix(build): partially fix qemu aarch32 build

While aarch32 isn't currently supported on qemu, platform.mk contains
hard-coded references to aarch64 in BL1_SOURCES which should be ${ARCH}.

This improves the situation, but since aarch32/qemu_max.S doesn't exist
and there are other missing files for aarch32, this is only a partial
fix.

Signed-off-by: Rebecca Cran <rebecca@quicinc.com>
Change-Id: I3fa01483e572abfd781ceaecff16ecf57cda8316

2 years agorefactor(fvp): use RSS API to retrieve attestation token and key
Manish V Badarkhe [Sun, 12 Mar 2023 21:34:44 +0000 (21:34 +0000)]
refactor(fvp): use RSS API to retrieve attestation token and key

Retrieved the platform attestation token and delegated realm attestation
key through the PSA delegated attestation layer.

Even though FVP doesn't support RSS hardware today, it can still
leverage the RSS implementation of these PSA interfaces in their mocking
form (see PLAT_RSS_NOT_SUPPORTED).

Therefore, platform APIs now call these PSA interfaces instead of
directly providing these hardcoded values.

Change-Id: I31d0ca58f6f1a444f513d954da4e3e67757321ad
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
2 years agoMerge changes from topic "errata" into integration
Madhukar Pappireddy [Wed, 22 Mar 2023 14:36:48 +0000 (15:36 +0100)]
Merge changes from topic "errata" into integration

* changes:
  fix(cpus): workaround for Cortex-A78C erratum 1827440
  fix(cpus): workaround for Cortex-A78C erratum 1827430

2 years agorefactor(cpufeat): enable FEAT_RNG for FEAT_STATE_CHECKED
Andre Przywara [Wed, 22 Feb 2023 17:55:59 +0000 (17:55 +0000)]
refactor(cpufeat): enable FEAT_RNG for FEAT_STATE_CHECKED

At the moment we only support for FEAT_RNG to be either unconditionally
compiled in, or to be not supported at all.

Add support for runtime detection (FEAT_RNG=2), by splitting
is_armv8_5_rng_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 the RNDRRS system register.

Change the QEMU platform default to the now supported dynamic option (=2),
so the right decision can be made by the code at runtime.

Change-Id: I1a4a538d5ad395fead7324f297d0056bda4f84cb
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agorefactor(cpufeat): align FEAT_SEL2 to new feature handling
Andre Przywara [Wed, 22 Feb 2023 16:53:50 +0000 (16:53 +0000)]
refactor(cpufeat): align FEAT_SEL2 to new feature handling

In ARMv8.4, the EL2 exception level got added to the secure world.
Adapt and rename the existing is_armv8_4_sel2_present() function, to
align its handling with the other CPU features.

Change-Id: If11e1942fdeb63c63f36ab9e89be810347d1a952
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agorefactor(cpufeat): enable FEAT_NV2 for FEAT_STATE_CHECKED
Andre Przywara [Fri, 27 Jan 2023 14:09:20 +0000 (14:09 +0000)]
refactor(cpufeat): enable FEAT_NV2 for FEAT_STATE_CHECKED

At the moment we only support for FEAT_NV2 to be either unconditionally
compiled in, or to be not supported at all.

Add support for runtime detection (CTX_INCLUDE_NEVE_REGS=2), by
splitting get_armv8_4_feat_nv_support() 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 the VNCR_EL2 system register.
Also move the context saving code from assembly to C, and use the new
is_feat_nv2_supported() function to guard its execution.

Change the FVP platform default to the now supported dynamic option (=2),
so the right decision can be made by the code at runtime.

Change-Id: I85b080641995fb72cfd4ac933f7a3f75770c2cb9
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agorefactor(cpufeat): enable FEAT_TWED for FEAT_STATE_CHECKED
Andre Przywara [Fri, 27 Jan 2023 12:25:49 +0000 (12:25 +0000)]
refactor(cpufeat): enable FEAT_TWED for FEAT_STATE_CHECKED

At the moment we only support FEAT_TWED to be either unconditionally
compiled in, or to be not supported at all.

Add support for runtime detection (ENABLE_FEAT_TWED=2), by splitting
is_armv8_6_twed_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 set the trap delay time.

Change the FVP platform default to the now supported dynamic option (=2),
so the right decision can be made by the code at runtime.

Change-Id: I58626230ef0af49886c0a197abace01e81f661d2
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agorefactor(cpufeat): enable FEAT_CSV2_2 for FEAT_STATE_CHECKED
Andre Przywara [Thu, 17 Nov 2022 17:30:43 +0000 (17:30 +0000)]
refactor(cpufeat): enable FEAT_CSV2_2 for FEAT_STATE_CHECKED

At the moment we only support FEAT_CSV2_2 to be either unconditionally
compiled in, or to be not supported at all.

Add support for runtime detection (ENABLE_FEAT_CSV2_2=2), by splitting
is_armv8_0_feat_csv2_2_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 the SCXTNUM_EL2 system register.
Also move the context saving code from assembly to C, and use the new
is_feat_csv2_2_supported() function to guard its execution.

Change the FVP platform default to the now supported dynamic option (=2),
so the right decision can be made by the code at runtime.

Change-Id: I89c7bc883e6a65727fdbdd36eb3bfbffb2196da7
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agorefactor(cpufeat): enable FEAT_ECV for FEAT_STATE_CHECKED
Andre Przywara [Thu, 17 Nov 2022 17:30:43 +0000 (17:30 +0000)]
refactor(cpufeat): enable FEAT_ECV for FEAT_STATE_CHECKED

At the moment we only support FEAT_ECV to be either unconditionally
compiled in, or to be not supported at all.

Add support for runtime detection (ENABLE_FEAT_ECV=2), by splitting
is_feat_ecv_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 the CNTPOFF_EL2 system register.
Also move the context saving code from assembly to C, and use the new
is_feat_ecv_supported() function to guard its execution.

Change the FVP platform default to the now supported dynamic option (=2),
so the right decision can be made by the code at runtime.

Change-Id: I4acd5384929f1902b62a87ae073aafa1472cd66b
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agorefactor(cpufeat): enable FEAT_PAN for FEAT_STATE_CHECKED
Andre Przywara [Thu, 26 Jan 2023 15:27:38 +0000 (15:27 +0000)]
refactor(cpufeat): enable FEAT_PAN for FEAT_STATE_CHECKED

At the moment we only support FEAT_PAN to be either unconditionally
compiled in, or to be not supported at all.

Add support for runtime detection (ENABLE_FEAT_PAN=2), by splitting
is_armv8_1_pan_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 PAN specific setup.

Change the FVP platform default to the now supported dynamic option (=2),
so the right decision can be made by the code at runtime.

Change-Id: I58e5fe8d3c9332820391c7d93a8fb9dba4cf754a
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agorefactor(cpufeat): align FEAT_SB to new feature handling
Andre Przywara [Thu, 17 Nov 2022 16:42:09 +0000 (16:42 +0000)]
refactor(cpufeat): align FEAT_SB to new feature handling

FEAT_SB introduces a new speculation barrier instruction, that is more
lightweight than a "dsb; isb" combination. We use that in a hot path,
so cannot afford and don't want a runtime detection mechanism.
Nevertheless align the implementation of the feature detection part
with the other features, but renaming the detection function, and
updating the FEAT_DETECTION code. Also update the documentation.

Change-Id: I2b86dfd1ad259c3bb99ab5186e2911ace454b54c
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agorefactor(cpufeat): use alternative encoding for "SB" barrier
Andre Przywara [Fri, 25 Nov 2022 14:10:13 +0000 (14:10 +0000)]
refactor(cpufeat): use alternative encoding for "SB" barrier

The "sb" barrier instruction is a rather new addition to the AArch64
instruction set, so it is not recognised by all toolchains. On top of
that, the GNU assembler denies this instruction, unless a compatible
processor is selected:
asm_macros.S:223: Error: selected processor does not support `sb'

Provide an alternative encoding of the "sb" instruction, by using a
system register write, as this is the group where the barrier
instructions borrow their encoding space from.
This results in the exact same opcode to be generated, and any
disassembler will decode this instruction as "sb".

Change-Id: I5f44c8321e0cc04c784e02bd838e964602a96a8e
Signed-off-by: Andre Przywara <andre.przywara@arm.com>