Filip Drazic [Tue, 7 Feb 2017 11:03:56 +0000 (12:03 +0100)]
zynqmp: pm: Move pm_client_wakeup call from pm_req_wakeup
Call to pm_client_wakeup from pm_req_wakeup prevented the PM API
call to be used to wake up non-APU processor (e.g. from higher ELs),
since it clears power down request for specified APU processor.
Move this function out of pm_client_wakeup to allow passing wake up
requests to the PMU for other processor in the system.
Signed-off-by: Filip Drazic <filip.drazic@aggios.com>
Acked-by: Will Wong <willw@xilinx.com>
Mirela Simonovic [Mon, 30 Jan 2017 16:44:00 +0000 (17:44 +0100)]
zynqmp: pm: Remove unused NODE_AFI, add NODE_EXTERN
NODE_EXTERN is the slave node which represents an external wake
source.
Signed-off-by: Mirela Simonovic <mirela.simonovic@aggios.com>
Acked-by: Will Wong <willw@xilinx.com>
Siva Durga Prasad Paladugu [Fri, 27 Apr 2018 10:56:47 +0000 (16:26 +0530)]
zynqmp: pm: Add support for setting suspend-to-RAM mode
Beside standard suspend-to-RAM state, Zynq MPSoC supports
suspend-to-RAM state with additional power savings, called
power-off suspend-to-RAM. If this mode is set, only NODE_EXTERN
must be set as wake source. Standard suspend-to-RAM procedure
is unchanged.
This patch adds support for setting suspend mode from higher
ELs and ensuring that all conditions for power-off suspend mode
are set.
Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Filip Drazic <filip.drazic@aggios.com>
Anes Hadziahmetagic [Fri, 27 Jan 2017 17:42:44 +0000 (18:42 +0100)]
zynqmp: pm: Implement pm_get_node_status API function
pm_get_node_status API function returns 3 values:
-status: Current power state of the node
-requirements: Current requirements for the node
-usage: Current usage of the node
The last two values only apply to slave nodes.
Signed-off-by: Anes Hadziahmetagic <anes.hadziahmetagic@aggios.com>
Signed-off-by: Filip Drazic <filip.drazic@aggios.com>
Acked-by: Will Wong <willw@xilinx.com>
Dimitris Papastamos [Wed, 16 May 2018 14:23:18 +0000 (15:23 +0100)]
Merge pull request #1387 from vishwanathahg/sgi575/core_pos_calc
Sgi575/core pos calc
Dimitris Papastamos [Wed, 16 May 2018 13:27:06 +0000 (14:27 +0100)]
Merge pull request #1383 from sandrine-bailleux-arm/topics/sb/sp-access-fpregs
SPM: Do not trap S-EL0 access to SVE/SIMD/FP regs
Dimitris Papastamos [Wed, 16 May 2018 13:26:52 +0000 (14:26 +0100)]
Merge pull request #1382 from sandrine-bailleux-arm/topics/sb/fix-doc
Fix doc for bl31_plat_get_next_image_ep_info()
Dimitris Papastamos [Wed, 16 May 2018 13:26:28 +0000 (14:26 +0100)]
Merge pull request #1381 from antonio-nino-diaz-arm/an/kernel-boot
plat/arm: Introduce ARM_LINUX_KERNEL_AS_BL33 build option
Dimitris Papastamos [Wed, 16 May 2018 09:59:25 +0000 (10:59 +0100)]
Merge pull request #1378 from vwadekar/denver-cve-2017-5715
CVE-2017-5715 mitigation for Denver CPUs
Vishwanatha HG [Tue, 8 May 2018 11:45:37 +0000 (17:15 +0530)]
css/sgi: rework the core position calculation function
The MT bit in MPIDR is always set for SGI platforms and so the
core position calculation code is updated to take into account
the thread affinity value as well.
Change-Id: I7b2a52707f607dc3859c6bbcd2b145b7987cb4ed
Signed-off-by: Chandni Cherukuri <chandni.cherukuri@arm.com>
Signed-off-by: Vishwanatha HG <vishwanatha.hg@arm.com>
Vishwanatha HG [Tue, 8 May 2018 10:47:31 +0000 (16:17 +0530)]
css/sgi: remove redundant copy of gic driver data
Instead of instantiating a local copy of GICv3 driver data for SGI
platforms, reuse the existing instance of GICv3 driver data available
in the arm common platform code.
Change-Id: If6f38e15d1f0e20cea96fff98091da300015d295
Signed-off-by: Chandni Cherukuri <chandni.cherukuri@arm.com>
Signed-off-by: Vishwanatha HG <vishwanatha.hg@arm.com>
Varun Wadekar [Thu, 11 Jan 2018 01:03:22 +0000 (17:03 -0800)]
Workaround for CVE-2017-5715 on NVIDIA Denver CPUs
Flush the indirect branch predictor and RSB on entry to EL3 by issuing
a newly added instruction for Denver CPUs. Support for this operation
can be determined by comparing bits 19:16 of ID_AFR0_EL1 with 0b0001.
To achieve this without performing any branch instruction, a per-cpu
vbar is installed which executes the workaround and then branches off
to the corresponding vector entry in the main vector table. A side
effect of this change is that the main vbar is configured before any
reset handling. This is to allow the per-cpu reset function to override
the vbar setting.
Change-Id: Ief493cd85935bab3cfee0397e856db5101bc8011
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
Dimitris Papastamos [Tue, 15 May 2018 17:40:46 +0000 (18:40 +0100)]
Merge pull request #1376 from vwadekar/cm-init-actlr-el1
lib: el3_runtime: initialise actlr_el1 to hardware defaults
Dimitris Papastamos [Tue, 15 May 2018 17:40:19 +0000 (18:40 +0100)]
Merge pull request #1380 from CJKay/mmap-fix
Fix incorrect number of reserved memory map entries for Arm platforms
Dimitris Papastamos [Tue, 15 May 2018 17:40:03 +0000 (18:40 +0100)]
Merge pull request #1379 from CJKay/nsram-fix
Fix incorrect NSRAM memory map region for SGI-575
Jeenu Viswambharan [Tue, 15 May 2018 15:18:40 +0000 (16:18 +0100)]
Fix build error with correct format string
Change-Id: I11c12b113c4975efd3ac7ac2e8b93e6771a7e7ff
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
Dimitris Papastamos [Tue, 15 May 2018 14:34:20 +0000 (15:34 +0100)]
Merge pull request #1373 from jeenu-arm/ras-support
RAS support
Dimitris Papastamos [Tue, 15 May 2018 12:34:11 +0000 (13:34 +0100)]
Merge pull request #1385 from antonio-nino-diaz-arm/an/revert-console
Revert "plat/arm: Migrate AArch64 port to the multi console driver"
Antonio Nino Diaz [Tue, 15 May 2018 12:12:50 +0000 (13:12 +0100)]
Revert "plat/arm: Migrate AArch64 port to the multi console driver"
This reverts commit
2f18aa1fa35305f8feec25867473d30975b242fe.
It is causing some tests to fail. Until the cause is found and fixed, it
is needed to remove this commit from master.
Change-Id: Ic5ff7a841903a15613e00379e87cbbd8a0e85152
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Sandrine Bailleux [Wed, 9 May 2018 12:45:34 +0000 (14:45 +0200)]
SPM: Do not trap S-EL0 access to SVE/SIMD/FP regs
This allows secure partitions to access these registers. This is
needed in some cases. For example, it has been reported that in order
to implement secure storage services, a secure partition needs to
encrypt/decrypt some authentication variables, which requires FP/SIMD
support.
Note that SPM will not do any saving/restoring of these registers on
behalf of the SP. This falls under the SP's responsibility.
Also note that if the SP gets preempted, it might not get a chance to
save/restore FP/SIMD registers first. This patch does not address this
problem. It only serves as a temporary solution to unblock development
on the secure partition side.
Change-Id: I3b8ccdebdac0219f6ac96ad66ab2be0be8374ad3
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
Sandrine Bailleux [Mon, 14 May 2018 12:25:47 +0000 (14:25 +0200)]
Fix doc for bl31_plat_get_next_image_ep_info()
In the porting guide, fix the function name and the argument type to
reflect the code.
Change-Id: Iac8d69af403194de5586bc0d5890da531e3c8da2
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
Antonio Nino Diaz [Mon, 14 May 2018 08:12:34 +0000 (09:12 +0100)]
Replace bootwrapped kernel instructions from User Guide
The instructions to boot the bootwrapped kernel were outdated.
Also, the bootwrapped kernel boot flow isn't really useful. It was meant
to be a replacement for the Trusted Firmware-A, not to be used as the next
step during boot.
The instructions have been removed in favour of the new build option
ARM_LINUX_KERNEL_AS_BL33. This new system directly boots the Linux
kernel from BL31, and requires RESET_TO_BL31 to be 1. Also, the kernel
has to be preloaded in memory, so PRELOADED_BL33_BASE has to be set to its
address. This way, the runtime services of the Trusted Firmware-A are
available for the kernel in the least possible amount of time.
This new system requires the DTB to be patched so that the kernel knows
where the ramdisk is. A short script to add this information to the DTB
has been added to the User Guide. The information related to it can be
found in the following file in the Linux kernel tree:
``Documentation/devicetree/bindings/chosen.txt``
Change-Id: Ide135580959e09f6aa8e4425f37ea55d97439178
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Chris Kay [Thu, 10 May 2018 13:43:28 +0000 (14:43 +0100)]
css: Do not map the non-secure RAM as secure
Change-Id: I7e73c0ab134da11c49f990b739245110c59eac2b
Signed-off-by: Chris Kay <chris.kay@arm.com>
Chris Kay [Thu, 10 May 2018 13:27:45 +0000 (14:27 +0100)]
css: Fix erroneous non-secure RAM base address/size for SGI-575
SGI-575's NSRAM is neither in the same place nor the same size as Juno's.
Change-Id: Id6d692e9c7e9c1360014bb525eda966ebe29c823
Signed-off-by: Chris Kay <chris.kay@arm.com>
Chris Kay [Wed, 9 May 2018 14:46:07 +0000 (15:46 +0100)]
plat/arm: Fix incorrect bounds check in ARM_CASSERT_MMAP
The bounds check in ARM_CASSERT_MMAP does not take into account the
array sentinel in plat_arm_mmap. This commit fixes this, and adds an
additional check to ensure the number of entries in the array is
within the bounds of PLAT_ARM_MMAP_ENTRIES.
Change-Id: Ie6df10c0aa0890d62826bc3224ad7b3e36fd53e2
Signed-off-by: Chris Kay <chris.kay@arm.com>
Chris Kay [Wed, 9 May 2018 14:14:06 +0000 (15:14 +0100)]
plat/arm: Fix incorrect number of reserved memory map entries
There are three calls to mmap_add_region() that always occur in
arm_setup_page_tables(), and two further calls based on whether coherent
memory is enabled, and whether SPM is enabled in BL31.
This commit adapts the ARM_BL_REGIONS definition to match the number of
calls made inside arm_setup_page_tables() so that the MAX_MMAP_REGIONS
is realigned with what is actually occurring.
Change-Id: I7adc05951abccf2cbd5c86280eb874911e6a1566
Signed-off-by: Chris Kay <chris.kay@arm.com>
Dimitris Papastamos [Fri, 11 May 2018 11:04:52 +0000 (12:04 +0100)]
Merge pull request #1372 from antonio-nino-diaz-arm/an/arm-multi-console
Arm platforms: Migrate to multi console driver
Antonio Nino Diaz [Fri, 11 May 2018 10:15:10 +0000 (11:15 +0100)]
plat/arm: Introduce ARM_LINUX_KERNEL_AS_BL33 build option
Normally, BL33 needs to contain a boot loader like U-Boot or UEFI that
eventually gives control to the OS. However, in some cases, this boot
sequence may be too slow. For example, when doing tests in a
cycle-accurate emulator, the user may only be interested in the
interaction between the Trusted Firmware and the OS, not in the boot
process itself.
The new option ARM_LINUX_KERNEL_AS_BL33 allows BL33 to contain the Linux
kernel image by changing the value of registers x0-x3 to the values
expected by the kernel. This option requires the device tree blob (DTB)
to be present in memory. Its address must be specified in the newly
introduced ARM_PRELOADED_DTB_BASE build option. For now, it only supports
AArch64 kernels.
This option is only available when RESET_TO_BL31=1. For this reason
the BL33 binary must be preloaded in memory and PRELOADED_BL33_BASE must
be used.
For example, if the kernel is loaded at 0x80080000 and the DTB is loaded
at address 0x82000000, the firmware could be built like this:
CROSS_COMPILE=aarch64-linux-gnu- \
make PLAT=fvp DEBUG=1 \
RESET_TO_BL31=1 \
ARM_LINUX_KERNEL_AS_BL33=1 \
PRELOADED_BL33_BASE=0x80080000 \
ARM_PRELOADED_DTB_BASE=0x82000000 \
all fip
Change-Id: If9dc847c65ae2d0c27b51f0fd44fc06b28497db9
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Antonio Nino Diaz [Fri, 4 May 2018 11:59:45 +0000 (12:59 +0100)]
plat/arm: Migrate AArch64 port to the multi console driver
The old API is deprecated and will eventually be removed.
Arm platforms now use the multi console driver for boot and runtime
consoles. However, the crash console uses the direct console API because
it doesn't need any memory access to work. This makes it more robust
during crashes.
The AArch32 port of the Trusted Firmware doesn't support this new API
yet, so it is only enabled in AArch64 builds. Because of this, the
common code must maintain compatibility with both systems. SP_MIN
doesn't have to be updated because it's only used in AArch32 builds.
The TSP is only used in AArch64, so it only needs to support the new
API without keeping support for the old one.
Special care must be taken because of PSCI_SYSTEM_SUSPEND. In Juno, this
causes the UARTs to reset (except for the one used by the TSP). This
means that they must be unregistered when suspending and re-registered
when resuming. This wasn't a problem with the old driver because it just
restarted the UART, and there were no problems associated with
registering and unregistering consoles.
The size of BL31 has been increased in builds with SPM.
Change-Id: Icefd117dd1eb9c498921181a21318c2d2435c441
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Antonio Nino Diaz [Mon, 30 Apr 2018 19:14:07 +0000 (20:14 +0100)]
multi console: Assert that consoles aren't registered twice
In the multi console driver, allowing to register the same console more
than once may result in an infinte loop when putc is called.
If, for example, a boot message is trying to be printed, but the
consoles in the loop in the linked list are runtime consoles, putc will
iterate forever looking for a console that can print boot messages (or
a NULL pointer that will never come).
This loop in the linked list can occur after restoring the system from a
system suspend. The boot console is registered during the cold boot in
BL31, but the runtime console is registered even in the warm boot path.
Consoles are always added to the start of the linked list when they are
registered, so this it what should happen if they were actually
different structures:
console_list -> NULL
console_list -> BOOT -> NULL
console_list -> RUNTIME -> BOOT -> NULL
console_list -> RUNTIME -> RUNTIME -> BOOT -> NULL
In practice, the two runtime consoles are the same one, so they create
this loop:
console_list -> RUNTIME -. X -> BOOT -> NULL
^ |
`----'
This patch adds an assertion to detect this problem. The assertion will
fail whenever the same structure tries to be registered while being on
the list.
In order to assert this, console_is_registered() has been implemented.
It returns 1 if the specified console is registered, 0 if not.
Change-Id: I922485e743775ca9bd1af9cbd491ddd360526a6d
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Varun Wadekar [Tue, 8 May 2018 17:52:36 +0000 (10:52 -0700)]
lib: el3_runtime: initialise actlr_el1 to hardware defaults
The context management library initialises the CPU context for the
secure/non-secure worlds to zero. This leads to zeros being stored
to the actual registers when we restore the CPU context, during a
world switch. Denver CPUs dont expect zero to be written to the
implementation defined, actlr_el1 register, at any point of time.
Writing a zero to some fields of this register, results in an
UNDEFINED exception.
This patch bases the context actlr_el1 value on the actual hardware
register, to maintain parity with the expected settings
Change-Id: I1c806d7ff12daa7fd1e5c72825494b81454948f2
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
Dimitris Papastamos [Wed, 9 May 2018 12:40:35 +0000 (13:40 +0100)]
Merge pull request #1377 from robertovargas-arm/compiler-warnings
Compiler warnings
Roberto Vargas [Wed, 9 May 2018 10:27:30 +0000 (11:27 +0100)]
xlat: Fix warning in CHECK_VIRT_ADDR_SPACE_SIZE
When TF is compiled for aarch32 MAX_VIRT_ADDR_SPACE_SIZE is 2^32 in some cases,
which makes the test (size) <= MAX_VIRT_ADDR_SPACE_SIZE a tautology because
uintptr_t is a 32 bit value. The cast remove the warning for clang.
Change-Id: I1345f3400f8fbbe4ffd3caa990a90e7ba593dba5
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
Roberto Vargas [Wed, 9 May 2018 09:49:24 +0000 (10:49 +0100)]
Don't use variables as tf_printf format strings
Using variables as format strings can generate security problems when
the user can control those strings. Some compilers generate warnings
in that cases, even when the variables are constants and are not
controlled by the user.
Change-Id: I65dee1d1b66feab38cbf298290a86fa56e6cca40
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
danh-arm [Tue, 8 May 2018 10:22:27 +0000 (11:22 +0100)]
Merge pull request #1368 from EvanLloyd/editorconfig
Add .editorconfig file
danh-arm [Tue, 8 May 2018 10:21:04 +0000 (11:21 +0100)]
Merge pull request #1354 from robertovargas-arm/mem_protect
ARM platforms: Demonstrate mem_protect from el3_runtime
Jeenu Viswambharan [Tue, 6 Feb 2018 12:21:39 +0000 (12:21 +0000)]
ARM Platforms: Support RAS
- Assign 0x10 for RAS exceptions on ARM platforms, and install
EHF priority descriptor.
- Call the common RAS initialisation from ARM BL31 setup.
- Add empty definitions for platform error records and RAS interrupts.
Change-Id: I0675f299b7840be4c83a9c7a81073a95c605dc90
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
Jeenu Viswambharan [Fri, 8 Dec 2017 12:13:51 +0000 (12:13 +0000)]
RAS: Add fault injection support
The ARMv8.4 RAS extensions introduce architectural support for software
to inject faults into the system in order to test fault-handling
software. This patch introduces the build option FAULT_HANDLING_SUPPORT
to allow for lower ELs to use registers in the Standard Error Record to
inject fault. The build option RAS_EXTENSIONS must also be enabled along
with fault injection.
This feature is intended for testing purposes only, and is advisable to
keep disabled for production images.
Change-Id: I6f7a4454b15aec098f9505a10eb188c2f928f7ea
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
Jeenu Viswambharan [Tue, 12 Dec 2017 10:34:58 +0000 (10:34 +0000)]
RAS: Allow individual interrupt registration
EHF currently allows for registering interrupt handlers for a defined
priority ranges. This is primarily targeted at various EL3 dispatchers
to own ranges of secure interrupt priorities in order to delegate
execution to lower ELs.
The RAS support added by earlier patches necessitates registering
handlers based on interrupt number so that error handling agents shall
receive and handle specific Error Recovery or Fault Handling interrupts
at EL3.
This patch introduces a macro, RAS_INTERRUPTS() to declare an array of
interrupt numbers and handlers. Error handling agents can use this macro
to register handlers for individual RAS interrupts. The array is
expected to be sorted in the increasing order of interrupt numbers.
As part of RAS initialisation, the list of all RAS interrupts are sorted
based on their ID so that, given an interrupt, its handler can be looked
up with a simple binary search.
For an error handling agent that wants to handle a RAS interrupt,
platform must:
- Define PLAT_RAS_PRI to be the priority of all RAS exceptions.
- Enumerate interrupts to have the GIC driver program individual EL3
interrupts to the required priority range. This is required by EHF
even before this patch.
Documentation to follow.
Change-Id: I9471e4887ff541f8a7a63309e9cd8f771f76aeda
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
Jeenu Viswambharan [Fri, 8 Dec 2017 15:38:21 +0000 (15:38 +0000)]
RAS: Add support for node registration
Previous patches added frameworks for handling RAS errors. This patch
introduces features that the platform can use to enumerate and iterate
RAS nodes:
- The REGISTER_RAS_NODES() can be used to expose an array of
ras_node_info_t structures. Each ras_node_info_t describes a RAS
node, along with handlers for probing the node for error, and if
did record an error, another handler to handle it.
- The macro for_each_ras_node() can be used to iterate over the
registered RAS nodes, probe for, and handle any errors.
The common platform EA handler has been amended using error handling
primitives introduced by both this and previous patches.
Change-Id: I2e13f65a88357bc48cd97d608db6c541fad73853
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
Jeenu Viswambharan [Thu, 7 Dec 2017 08:43:05 +0000 (08:43 +0000)]
RAS: Add helpers to access Standard Error Records
The ARMv8 RAS Extensions introduced Standard Error Records which are a
set of standard registers through which:
- Platform can configure RAS node policy; e.g., notification
mechanism;
- RAS nodes can record and expose error information for error handling
agents.
Standard Error Records can either be accessed via. memory-mapped
or System registers. This patch adds helper functions to access
registers and fields within an error record.
Change-Id: I6594ba799f4a1789d7b1e45b3e17fd40e7e0ba5c
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
Jeenu Viswambharan [Wed, 4 Apr 2018 15:07:11 +0000 (16:07 +0100)]
AArch64: Introduce RAS handling
RAS extensions are mandatory for ARMv8.2 CPUs, but are also optional
extensions to base ARMv8.0 architecture.
This patch adds build system support to enable RAS features in ARM
Trusted Firmware. A boolean build option RAS_EXTENSION is introduced for
this.
With RAS_EXTENSION, an Exception Synchronization Barrier (ESB) is
inserted at all EL3 vector entry and exit. ESBs will synchronize pending
external aborts before entering EL3, and therefore will contain and
attribute errors to lower EL execution. Any errors thus synchronized are
detected via. DISR_EL1 register.
When RAS_EXTENSION is set to 1, HANDLE_EL3_EA_FIRST must also be set to 1.
Change-Id: I38a19d84014d4d8af688bd81d61ba582c039383a
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
Jeenu Viswambharan [Thu, 30 Nov 2017 12:54:15 +0000 (12:54 +0000)]
AArch64: Introduce External Abort handling
At present, any External Abort routed to EL3 is reported as an unhandled
exception and cause a panic. This patch enables ARM Trusted Firmware to
handle External Aborts routed to EL3.
With this patch, when an External Abort is received at EL3, its handling
is delegated to plat_ea_handler() function. Platforms can provide their
own implementation of this function. This patch adds a weak definition
of the said function that prints out a message and just panics.
In order to support handling External Aborts at EL3, the build option
HANDLE_EA_EL3_FIRST must be set to 1.
Before this patch, HANDLE_EA_EL3_FIRST wasn't passed down to
compilation; this patch fixes that too.
Change-Id: I4d07b7e65eb191ff72d63b909ae9512478cd01a1
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
Jeenu Viswambharan [Wed, 29 Nov 2017 16:59:34 +0000 (16:59 +0000)]
AArch64: Refactor GP register restore to separate function
At present, the function that restores general purpose registers also
does ERET. Refactor the restore code to restore general purpose
registers without ERET to complement the save function.
The macro save_x18_to_x29_sp_el0 was used only once, and is therefore
removed, and its contents expanded inline for readability.
No functional changes, but with this patch:
- The SMC return path will incur an branch-return and an additional
register load.
- The unknown SMC path restores registers x0 to x3.
Change-Id: I7a1a63e17f34f9cde810685d70a0ad13ca3b7c50
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
danh-arm [Thu, 3 May 2018 15:48:50 +0000 (16:48 +0100)]
Merge pull request #1374 from jonathanwright-ARM/jw/fix-memory-leaks-in-fiptool
Fix memory leaks in fiptool
danh-arm [Thu, 3 May 2018 15:48:14 +0000 (16:48 +0100)]
Merge pull request #1370 from antonio-nino-diaz-arm/an/fix-parange
xlat: Have all values of PARange for 8.x architectures
danh-arm [Thu, 3 May 2018 15:46:44 +0000 (16:46 +0100)]
Merge pull request #1367 from robertovargas-arm/ndebug
Remove the unused macro NDEBUG
danh-arm [Thu, 3 May 2018 15:46:25 +0000 (16:46 +0100)]
Merge pull request #1366 from antonio-nino-diaz-arm/an/ignore-spdx
checkpatch: Ignore SPDX_LICENSE_TAG
danh-arm [Thu, 3 May 2018 15:45:17 +0000 (16:45 +0100)]
Merge pull request #1365 from jonathanwright-ARM/jw/fix-cert-create-makefile
Fix the makefile to remove the cert_create executable on 'make realclean'
danh-arm [Thu, 3 May 2018 15:45:01 +0000 (16:45 +0100)]
Merge pull request #1364 from Yann-lms/bl2_at_el3_mmu
BL2_AT_EL3: do not try to disable MMU twice on AARCH32
danh-arm [Thu, 3 May 2018 15:42:07 +0000 (16:42 +0100)]
Merge pull request #1371 from antonio-nino-diaz-arm/an/fix-checkpatch
smccc: Fix checkpatch error in header file
Jonathan Wright [Thu, 3 May 2018 14:05:09 +0000 (15:05 +0100)]
tools/fiptool: fix memory leaks in fiptool
Free desc->image->buffer before freeing desc->image. We make sure that
the desc->image is non-null before attempting this.
Change-Id: I35c5674629a41d7cf1a78b7b41ca4b930d0fb688
Signed-off-by: Jonathan Wright <jonathan.wright@arm.com>
Antonio Nino Diaz [Wed, 2 May 2018 10:23:56 +0000 (11:23 +0100)]
xlat: Have all values of PARange for 8.x architectures
In AArch64, the field ID_AA64MMFR0_EL1.PARange has a different set of
allowed values depending on the architecture version.
Previously, we only compiled the Trusted Firmware with the values that
were allowed by the architecture. However, given that this field is
read-only, it is easier to compile the code with all values regardless
of the target architecture.
Change-Id: I57597ed103dd0189b1fb738a9ec5497391c10dd1
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Antonio Nino Diaz [Wed, 2 May 2018 08:52:35 +0000 (09:52 +0100)]
smccc: Fix checkpatch error in header file
Change-Id: Ice141dcc17f504025f922acace94d98f84acba9e
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Evan Lloyd [Wed, 6 Dec 2017 19:05:40 +0000 (19:05 +0000)]
Add .editorconfig file
The .editorconfig file provides an editor agnostic definition of a
project's file format requirements.
Details can be found at http://editorconfig.org/
This change should have little impact on users, but, it is hoped, will
help those who move across projects avoid making mistakes because of
foreign project editor configuration settings.
Change-Id: I8776526b5ab96b543d3d3e445c60e06b62049e68
Signed-off-by: Evan Lloyd <evan.lloyd@arm.com>
danh-arm [Tue, 1 May 2018 16:13:11 +0000 (17:13 +0100)]
Merge pull request #1362 from robertovargas-arm/dtc-warnings
Remove dtc warnings
danh-arm [Tue, 1 May 2018 16:12:51 +0000 (17:12 +0100)]
Merge pull request #1361 from vchong/tool_add_img
poplar: rename FIP_ADD_IMG to TOOL_ADD_IMG
Roberto Vargas [Fri, 15 Dec 2017 15:28:50 +0000 (15:28 +0000)]
Remove the unused macro NDEBUG
The C standards specify that this macro is used to
disable asserts but, in our code, the assert macro
is controlled with ENABLE_ASSERTIONS. Having this macro
here creates confusion about the behaviour of assert.
Change-Id: Iab8689a14dc2b8790729857d56585ce43c0c4f51
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
danh-arm [Tue, 1 May 2018 14:31:44 +0000 (15:31 +0100)]
Merge pull request #1363 from antonio-nino-diaz-arm/an/res1-ap
xlat: Set AP[1] to 1 when it is RES1
danh-arm [Tue, 1 May 2018 14:25:45 +0000 (15:25 +0100)]
Merge pull request #1360 from antonio-nino-diaz-arm/an/smccc-v2
Add support for the SMC Calling Convention 2.0
Roberto Vargas [Fri, 5 Jan 2018 16:00:05 +0000 (16:00 +0000)]
ARM platforms: Demonstrate mem_protect from el3_runtime
Previously mem_protect used to be only supported from BL2. This is not
helpful in the case when ARM TF-A BL2 is not used. This patch demonstrates
mem_protect from el3_runtime firmware on ARM Platforms specifically
when RESET_TO_BL31 or RESET_TO_SP_MIN flag is set as BL2 may be absent
in these cases. The Non secure DRAM is dynamically mapped into EL3 mmap
tables temporarily and then the protected regions are then cleared. This
avoids the need to map the non secure DRAM permanently to BL31/sp_min.
The stack size is also increased, because DYNAMIC_XLAT_TABLES require
a bigger stack.
Change-Id: Ia44c594192ed5c5adc596c0cff2c7cc18c001fde
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
danh-arm [Tue, 1 May 2018 14:06:56 +0000 (15:06 +0100)]
Merge pull request #1255 from masahir0y/int-ll64
Use consistent int-ll64 typedefs for aarch32 and aarch64
Jonathan Wright [Mon, 30 Apr 2018 14:04:02 +0000 (15:04 +0100)]
cert_create: fix makefile to remove executable on 'make realclean'
Spurious whitespace existed in the BINARY shell variable which meant
the cert_tool executable was not being removed on 'make realclean'.
Change-Id: Ibfd2fd17889514f6613e33c6df58d53b9232ec14
Signed-off-by: Jonathan Wright <jonathan.wright@arm.com>
Antonio Nino Diaz [Fri, 27 Apr 2018 08:29:20 +0000 (09:29 +0100)]
checkpatch: Ignore SPDX_LICENSE_TAG
The Linux kernel expects the SPDX license tag in the first line of each
source code file in a comment.
In the context of the Linux kernel repository this makes sense because
they have many different license headers across their codebase. Moving
the tag to the first line of the source code files makes it easier for
analyzers to see the license of each file.
In the Trusted Firmware, we control all headers and make sure that they
follow the same pattern, so this is not needed.
Change-Id: Ie19802c7b65b1bdd63da9ece64311aec1f8ad7fe
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Masahiro Yamada [Fri, 2 Feb 2018 06:09:36 +0000 (15:09 +0900)]
types: use int-ll64 for both aarch32 and aarch64
Since commit
031dbb122472 ("AArch32: Add essential Arch helpers"),
it is difficult to use consistent format strings for printf() family
between aarch32 and aarch64.
For example, uint64_t is defined as 'unsigned long long' for aarch32
and as 'unsigned long' for aarch64. Likewise, uintptr_t is defined
as 'unsigned int' for aarch32, and as 'unsigned long' for aarch64.
A problem typically arises when you use printf() in common code.
One solution could be, to cast the arguments to a type long enough
for both architectures. For example, if 'val' is uint64_t type,
like this:
printf("val = %llx\n", (unsigned long long)val);
Or, somebody may suggest to use a macro provided by <inttypes.h>,
like this:
printf("val = %" PRIx64 "\n", val);
But, both would make the code ugly.
The solution adopted in Linux kernel is to use the same typedefs for
all architectures. The fixed integer types in the kernel-space have
been unified into int-ll64, like follows:
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef signed short int16_t;
typedef unsigned short uint16_t;
typedef signed int int32_t;
typedef unsigned int uint32_t;
typedef signed long long int64_t;
typedef unsigned long long uint64_t;
[ Linux commit:
0c79a8e29b5fcbcbfd611daf9d500cfad8370fcf ]
This gets along with the codebase shared between 32 bit and 64 bit,
with the data model called ILP32, LP64, respectively.
The width for primitive types is defined as follows:
ILP32 LP64
int 32 32
long 32 64
long long 64 64
pointer 32 64
'long long' is 64 bit for both, so it is used for defining uint64_t.
'long' has the same width as pointer, so for uintptr_t.
We still need an ifdef conditional for (s)size_t.
All 64 bit architectures use "unsigned long" size_t, and most 32 bit
architectures use "unsigned int" size_t. H8/300, S/390 are known as
exceptions; they use "unsigned long" size_t despite their architecture
is 32 bit.
One idea for simplification might be to define size_t as 'unsigned long'
across architectures, then forbid the use of "%z" string format.
However, this would cause a distortion between size_t and sizeof()
operator. We have unknowledge about the native type of sizeof(), so
we need a guess of it anyway. I want the following formula to always
return 1:
__builtin_types_compatible_p(size_t, typeof(sizeof(int)))
Fortunately, ARM is probably a majority case. As far as I know, all
32 bit ARM compilers use "unsigned int" size_t.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Masahiro Yamada [Fri, 2 Feb 2018 12:19:17 +0000 (21:19 +0900)]
arch_helpers: use u_register_t for register read/write
u_register_t is preferred rather than uint64_t. This is more
consistent with the aarch32 implementation.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Masahiro Yamada [Wed, 18 Apr 2018 16:18:48 +0000 (01:18 +0900)]
Fix pointer type mismatch of handlers
Commit
4c0d03907652 ("Rework type usage in Trusted Firmware") changed
the type usage in struct declarations, but did not touch the definition
side. Fix the type mismatch.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Yann Gautier [Thu, 26 Apr 2018 17:07:17 +0000 (19:07 +0200)]
BL2_AT_EL3: do not try to disable MMU twice on AARCH32
If BL2_AT_EL3 is enabled, bl2_run_next_image is called at the end of BL2.
This function calls disable_mmu_icache_secure.
It is then useless to call it in bl2_main in that case.
fixes arm-software/tf-issues#582
Signed-off-by: Yann Gautier <yann.gautier@st.com>
Dimitris Papastamos [Thu, 26 Apr 2018 13:14:28 +0000 (14:14 +0100)]
Merge pull request #1345 from dbasehore/udelay
rockchip/rk3399: Fix sram_udelay
Antonio Nino Diaz [Thu, 26 Apr 2018 11:59:08 +0000 (12:59 +0100)]
xlat: Set AP[1] to 1 when it is RES1
According to the ARMv8 ARM issue C.a:
AP[1] is valid only for stage 1 of a translation regime that can
support two VA ranges. It is RES 1 when stage 1 translations can
support only one VA range.
This means that, even though this bit is ignored, it should be set to 1
in the EL3 and EL2 translation regimes.
For translation regimes consisting on EL0 and a higher regime this bit
selects between control at EL0 or at the higher Exception level. The
regimes that support two VA ranges are EL1&0 and EL2&0 (the later one
is only available since ARMv8.1).
This fix has to be applied to both versions of the translation tables
library.
Change-Id: If19aaf588551bac7aeb6e9a686cf0c2068e7c181
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Roberto Vargas [Mon, 23 Apr 2018 13:44:54 +0000 (14:44 +0100)]
Remove dtc warnings
DTC generates warnings when unit names begin with 0, or
when a node containing a reg or range property doesn't have a unit name
in the node name. This patch fixes those cases.
Change-Id: If24ec68ef3034fb3fcefb96c5625c47a0bbd8474
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
Victor Chong [Mon, 23 Apr 2018 14:52:51 +0000 (15:52 +0100)]
poplar: rename FIP_ADD_IMG to TOOL_ADD_IMG
Fixes: f3d522b ("poplar: Support Trusted OS extra image (OP-TEE header) parsing")
Signed-off-by: Victor Chong <victor.chong@linaro.org>
Antonio Nino Diaz [Mon, 23 Apr 2018 14:43:29 +0000 (15:43 +0100)]
Add support for the SMC Calling Convention 2.0
Due to differences in the bitfields of the SMC IDs, it is not possible
to support SMCCC 1.X and 2.0 at the same time.
The behaviour of `SMCCC_MAJOR_VERSION` has changed. Now, it is a build
option that specifies the major version of the SMCCC that the Trusted
Firmware supports. The only two allowed values are 1 and 2, and it
defaults to 1. The value of `SMCCC_MINOR_VERSION` is derived from it.
Note: Support for SMCCC v2.0 is an experimental feature to enable
prototyping of secure partition specifications. Support for this
convention is disabled by default and could be removed without notice.
Change-Id: I88abf9ccf08e9c66a13ce55c890edea54d9f16a7
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Masahiro Yamada [Wed, 18 Apr 2018 16:14:42 +0000 (01:14 +0900)]
spd: add static qualifier to locally used functions and data
These are used locally in a file.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Dimitris Papastamos [Wed, 18 Apr 2018 09:54:40 +0000 (10:54 +0100)]
Merge pull request #1358 from omasab/sgi575_mt_flag
css/sgi575: enable ARM_PLAT_MT flag
Dimitris Papastamos [Wed, 18 Apr 2018 09:54:26 +0000 (10:54 +0100)]
Merge pull request #1357 from antonio-nino-diaz-arm/an/fix-misra
Fix some MISRA defects in SPM code
Sudipto Paul [Mon, 16 Apr 2018 12:16:50 +0000 (17:46 +0530)]
css/sgi575: enable ARM_PLAT_MT flag
SGI-575 platform is based on Cortex-A75 processor which has its MT bit
in the MPIDR register set to '1'. So the Arm platform layer code has
to be made aware of this.
Signed-off-by: Sudipto Paul <sudipto.paul@arm.com>
Antonio Nino Diaz [Tue, 17 Apr 2018 14:10:18 +0000 (15:10 +0100)]
Fix some MISRA defects in SPM code
Change-Id: I989c1f4aef8e3cb20d5d19e6347575e6449bb60b
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Dimitris Papastamos [Tue, 17 Apr 2018 11:08:34 +0000 (12:08 +0100)]
Merge pull request #1250 from jollysxilinx/zynqmp-new-eemi-api
plat/xilinx: Add support for new platform management APIs for ZynqMP
Dimitris Papastamos [Mon, 16 Apr 2018 15:40:03 +0000 (16:40 +0100)]
Merge pull request #1346 from samarthp/sp/support-multiple-mhu-gen
plat/arm: Add MHUv2 support to SCMI driver
Samarth Parikh [Thu, 23 Nov 2017 08:53:21 +0000 (14:23 +0530)]
plat/arm: Add MHUv2 support to SCMI driver
Currently the SCMI driver supports MHUv1, but Arm platforms may have
varied versions of MHU driver, with MHUv2 controllers being in the
latest Arm platforms.
This patch updates the SCMI driver to support MHUv2, specifically that
the sender must send the wake-up to the receiver before initiating any
data transfer.
Also, the existing mhu driver files, css_mhu.c and css_mhu.h, have been
moved from the scpi directory to a new directory, css/drivers/mhu.
Change-Id: I9b46b492a3e1d9e26db12d83a9773958a8c8402f
Signed-off-by: Samarth Parikh <samarth.parikh@arm.com>
Dimitris Papastamos [Mon, 16 Apr 2018 14:04:28 +0000 (15:04 +0100)]
Merge pull request #1356 from robertovargas-arm/misra-changes
Misra changes
Roberto Vargas [Mon, 12 Feb 2018 12:36:17 +0000 (12:36 +0000)]
Fix MISRA rule 8.4 Part 4
Rule 8.4: A compatible declaration shall be visible when
an object or function with external linkage is defined
Fixed for:
make DEBUG=1 PLAT=fvp SPD=tspd TRUSTED_BOARD_BOOT=1 \
GENERATE_COT=1 ARM_ROTPK_LOCATION=devel_rsa \
ROT_KEY=arm_rotprivk_rsa.pem MBEDTLS_DIR=mbedtls all
Change-Id: Ie4cd6011b3e4fdcdd94ccb97a7e941f3b5b7aeb8
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
Roberto Vargas [Mon, 12 Feb 2018 12:36:17 +0000 (12:36 +0000)]
Fix MISRA rule 8.3 Part 4
Rule 8.3: All declarations of an object or function shall
use the same names and type qualifiers
Fixed for:
make DEBUG=1 PLAT=fvp SPD=tspd TRUSTED_BOARD_BOOT=1 \
GENERATE_COT=1 ARM_ROTPK_LOCATION=devel_rsa \
ROT_KEY=arm_rotprivk_rsa.pem MBEDTLS_DIR=mbedtls all
Change-Id: Ia34fe1ae1f142e89c9a6c19831e3daf4d28f5831
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
Roberto Vargas [Mon, 12 Feb 2018 12:36:17 +0000 (12:36 +0000)]
Fix MISRA rule 8.4 Part 3
Rule 8.4: A compatible declaration shall be visible when
an object or function with external linkage is defined
Fixed for:
make DEBUG=1 PLAT=fvp SPD=tspd all
Change-Id: I0a16cf68fef29cf00ec0a52e47786f61d02ca4ae
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
Roberto Vargas [Mon, 12 Feb 2018 12:36:17 +0000 (12:36 +0000)]
Fix MISRA rule 8.3 Part 3
Rule 8.3: All declarations of an object or function shall
use the same names and type qualifiers
Fixed for:
make DEBUG=1 PLAT=fvp SPD=tspd all
Change-Id: I4e31c93d502d433806dfc521479d5d428468b37c
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
Roberto Vargas [Mon, 12 Feb 2018 12:36:17 +0000 (12:36 +0000)]
Fix MISRA rule 8.3 Part 2
Rule 8.3: All declarations of an object or function shall
use the same names and type qualifiers.
Fixed for:
make DEBUG=1 PLAT=juno LOG_LEVEL=50 all
Change-Id: I0e4a03a0d2170cb1c632e079112a972091994a39
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
Roberto Vargas [Mon, 12 Feb 2018 12:36:17 +0000 (12:36 +0000)]
Fix MISRA rule 8.5 in common code
Rule 8.5: An external object or function shall be declared
once in one and only one file.
Change-Id: I7c3d4ec7d3ba763fdb4600008ba10b4b93ecdfce
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
Roberto Vargas [Mon, 12 Feb 2018 12:36:17 +0000 (12:36 +0000)]
Fix MISRA rule 8.4 Part 1
Rule 8.4: A compatible declaration shall be visible when
an object or function with external linkage is defined
Fixed for:
make DEBUG=1 PLAT=fvp LOG_LEVEL=50 all
Change-Id: I32b223251b8bf5924149d89431a65d3405a73d3e
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
Roberto Vargas [Mon, 12 Feb 2018 12:36:17 +0000 (12:36 +0000)]
Fix MISRA rule 8.3 Part 1
Rule 8.3: All declarations of an object or function shall
use the same names and type qualifiers.
Fixed for:
make DEBUG=1 PLAT=fvp LOG_LEVEL=50 all
Change-Id: I32d6fbce03bb4830ed5bf521afe7063505c6ed79
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
Dimitris Papastamos [Fri, 13 Apr 2018 08:54:29 +0000 (09:54 +0100)]
Merge pull request #1352 from hzhuang1/hikey_ddr
Hikey ddr
Dimitris Papastamos [Fri, 13 Apr 2018 08:53:56 +0000 (09:53 +0100)]
Merge pull request #1355 from jonathanwright-ARM/jw/REVIDR-errata-workaround
Check presence of hardware fix for 2 errata on Cortex A53
Jonathan Wright [Wed, 28 Mar 2018 15:55:54 +0000 (16:55 +0100)]
Check presence of fix for errata 835769 in Cortex-A53
A fix for errata 835769 may be available in revisions r0p2, r0p3 or r0p4
of the Cortex-A53 processor. The presence of the fix is determined by
checking bit 7 in the REVIDR register.
If the fix is present we report ERRATA_NOT_APPLIES which silences the
erroneous 'missing workaround' warning.
Change-Id: Ib75b008e755e9ac648554ca9398024fdbea4a91a
Signed-off-by: Jonathan Wright <jonathan.wright@arm.com>
Jonathan Wright [Wed, 28 Mar 2018 14:52:03 +0000 (15:52 +0100)]
Check presence of fix for errata 843419 in Cortex-A53
A fix for errata 843419 may be available in revision r0p4 of the
Cortex-A53 processor. The presence of the fix is determined by checking
bit 8 in the REVIDR register.
If the fix is present we report ERRATA_NOT_APPLIES which silences the
erroneous 'missing workaround' warning.
Change-Id: Ibd2a478df3e2a6325442a6a48a0bb0259dcfc1d7
Signed-off-by: Jonathan Wright <jonathan.wright@arm.com>
Dimitris Papastamos [Thu, 12 Apr 2018 09:47:14 +0000 (10:47 +0100)]
Merge pull request #1347 from davidcunado-arm/dc/affinities
FVP: Fix function for translating MPIDR to linear index
Dimitris Papastamos [Thu, 12 Apr 2018 08:20:12 +0000 (09:20 +0100)]
Merge pull request #1353 from JiafeiPan/upstream-platform-psci-bug
layerscape: fix integer handling issues
Jiafei Pan [Wed, 11 Apr 2018 12:12:24 +0000 (12:12 +0000)]
layerscape: fix integer handling issues
Assert before actually using.
Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
Haojian Zhuang [Wed, 11 Apr 2018 11:06:14 +0000 (19:06 +0800)]
hikey: clean sram before mcu used
Clean cache to flush parameters into SRAM before MCU using them.
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
Haojian Zhuang [Wed, 11 Apr 2018 11:05:59 +0000 (19:05 +0800)]
hikey: save ddr parameters into SRAM
Store those DDR parameters into SRAM. They may be used by MCU
firmware.
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
Haojian Zhuang [Wed, 11 Apr 2018 11:05:32 +0000 (19:05 +0800)]
hikey: update ddr initialization
Fix that DDR can't work at 533MHz. Now step to set DDR frequency
from 150MHz to 800MHz. DDR could work among these frequency, 150MHz,
266MHz, 400MHz, 533MHz and 800MHz.
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>