project/bcm63xx/atf.git
7 years agofiptool: Provide malloc/strdup wrappers to simplify error checking
dp-arm [Fri, 4 Nov 2016 10:56:25 +0000 (10:56 +0000)]
fiptool: Provide malloc/strdup wrappers to simplify error checking

Change-Id: Ie3e43e9f7d31df40a5997047b9bddec0a06fd47f
Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
7 years agofiptool: Use getopt for the top level command parsing
dp-arm [Mon, 7 Nov 2016 10:45:59 +0000 (10:45 +0000)]
fiptool: Use getopt for the top level command parsing

Change-Id: I18a4327e41fc090dcea9a647f7673182ca0ed1d9
Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
7 years agofiptool: Initialize opt_index to 0 for getopt(3)
dp-arm [Mon, 7 Nov 2016 11:13:54 +0000 (11:13 +0000)]
fiptool: Initialize opt_index to 0 for getopt(3)

Change-Id: I62c1a636eb0d9f73fa3a6356e32b5a44f268d421
Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
7 years agofiptool: Constify various function params
dp-arm [Fri, 4 Nov 2016 10:52:25 +0000 (10:52 +0000)]
fiptool: Constify various function params

Additionally, remove the -o option for the create command
as it is not supported.

Change-Id: I27993a6fc5e3b0b9710e2ec5322e4296bc87d0df
Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
7 years agoMerge pull request #761 from soby-mathew/sm/bakery_lock_fixes
davidcunado-arm [Wed, 30 Nov 2016 17:38:41 +0000 (17:38 +0000)]
Merge pull request #761 from soby-mathew/sm/bakery_lock_fixes

Fix normal memory bakery lock implementation

7 years agoMerge pull request #765 from Xilinx/rk3399-cfi
davidcunado-arm [Fri, 25 Nov 2016 09:42:37 +0000 (09:42 +0000)]
Merge pull request #765 from Xilinx/rk3399-cfi

rk3399: Add CFI debug information to SRAM functions

7 years agork3399: Add CFI debug information to SRAM functions
Soren Brinkmann [Thu, 24 Nov 2016 22:04:38 +0000 (14:04 -0800)]
rk3399: Add CFI debug information to SRAM functions

Commit b91d935feebdf2c3edef19949023645b6cb34b20
("Add CFI debug frame information for ASM functions") modifies the
assembly macros 'func' and 'endfunc' to include CFI debug frame
information.

The rockchip platform uses a custom version of the 'func' macro with the
common 'endfunc' macro. The custom macro wasn't updated in
b91d935feebdf2c3edef19949023645b6cb34b20 resulting in the following
build error:
  plat/rockchip/rk3399/drivers/pmu/plat_pmu_macros.S: Assembler messages:
  plat/rockchip/rk3399/drivers/pmu/plat_pmu_macros.S:155: Error: .cfi_endproc without corresponding .cfi_startproc
  Makefile:532: recipe for target 'build/rk3399/release/bl31/plat_helpers.o' failed
  make: *** [build/rk3399/release/bl31/plat_helpers.o] Error 1

Fixing this by updating the sram_func macro in the rk3399 port.

Fixes: b91d935feebdf2c3edef19949023645b6cb34b20 ("Add CFI debug frame information for ASM functions")
Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
7 years agoMerge pull request #763 from douglas-raillard-arm/dr/add_debug_frame_info
danh-arm [Wed, 23 Nov 2016 18:16:15 +0000 (18:16 +0000)]
Merge pull request #763 from douglas-raillard-arm/dr/add_debug_frame_info

Add CFI debug frame information for ASM functions

7 years agoMerge pull request #764 from sandrine-bailleux-arm/sb/fix-trusty-build
danh-arm [Wed, 23 Nov 2016 18:15:36 +0000 (18:15 +0000)]
Merge pull request #764 from sandrine-bailleux-arm/sb/fix-trusty-build

Minor fixes in the Trusty SPD code

7 years agoFix a coding style issue in trusty.c
Sandrine Bailleux [Wed, 23 Nov 2016 10:53:07 +0000 (10:53 +0000)]
Fix a coding style issue in trusty.c

This patch fixes the following coding style error reported
by the checkpatch.pl script:

  Bad function definition - void el3_exit() should probably
  be void el3_exit(void)

There is another one but it's a false positive so there's no
point in fixing it:

  space prohibited after that '&' (ctx:WxW)
  +#define SMC_NR(entity, fn, fastcall, smc64) ((((fastcall) & 0x1) << 31) | \
                                                            ^
Change-Id: I34de0337c7216dabd16395879f13845a60ee6df0

Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
7 years agoFix compilation warning in Trusty SPD
Sandrine Bailleux [Wed, 23 Nov 2016 09:50:53 +0000 (09:50 +0000)]
Fix compilation warning in Trusty SPD

In release builds, the Trusty SPD fails to build because of an unused
variable. Note that this warning message doesn't show in debug builds
because INFO() messages are not compiled out like in release mode.

This patch fixes this issue by removing this variable and using its
value in place directly in the INFO() macro call.

Change-Id: I1f552421181a09412315eef4eaca586012022018
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
7 years agoMerge pull request #762 from douglas-raillard-arm/dr/doc_build_info
danh-arm [Tue, 22 Nov 2016 10:49:57 +0000 (10:49 +0000)]
Merge pull request #762 from douglas-raillard-arm/dr/doc_build_info

Clarify dependency for PSCI_EXTENDED_STATE_ID

7 years agoMerge pull request #760 from Xilinx/zynqmp-2016-11
danh-arm [Tue, 22 Nov 2016 10:47:51 +0000 (10:47 +0000)]
Merge pull request #760 from Xilinx/zynqmp-2016-11

ZynqMP Updates

7 years agoMerge pull request #755 from vwadekar/trusty-spd
danh-arm [Tue, 22 Nov 2016 10:47:34 +0000 (10:47 +0000)]
Merge pull request #755 from vwadekar/trusty-spd

spd: dispatcher for interacting with the Trusty TEE

7 years agoClarify dependency for PSCI_EXTENDED_STATE_ID
Douglas Raillard [Mon, 7 Nov 2016 17:29:34 +0000 (17:29 +0000)]
Clarify dependency for PSCI_EXTENDED_STATE_ID

Add dependency information in the user guide for ARM_RECOM_STATE_ID_ENC
that needs to be set when using PSCI_EXTENDED_STATE_ID on ARM
platforms. Also clarify the build error message.

Change-Id: Id125a0299b179f5f222bca4e2503204bf89a3c59
Signed-off-by: Douglas Raillard <douglas.raillard@arm.com>
7 years agoFix normal memory bakery lock implementation
Soby Mathew [Mon, 14 Nov 2016 17:19:35 +0000 (17:19 +0000)]
Fix normal memory bakery lock implementation

This patch fixes an issue in the normal memory bakery lock
implementation. During assertion of lock status, there is a possibility
that the assertion could fail. This is because the previous update done
to the lock status by the owning CPU when not participating in cache
coherency could result in stale data in the cache due to cache maintenance
operations not propagating to all the caches. This patch fixes this issue
by doing an extra read cache maintenance operation prior to the assertion.

Fixes ARM-software/tf-issues#402

Change-Id: I0f38a7c52476a4f58e17ebe0141d256d198be88d
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
7 years agoAdd CFI debug frame information for ASM functions
Douglas Raillard [Mon, 21 Nov 2016 14:12:32 +0000 (14:12 +0000)]
Add CFI debug frame information for ASM functions

This allows the debugger to print the callstack when there is an
assembly function in the callstack.

It will work as long as the CFA pointer (frame pointer) location is not
modified (i.e. x29 is not touched in AArch64 state). It is the case in
almost all assembly functions, so this patch improves the average
debugging experience. Call stacks from the debugger should still be
interpreted with care. In more complex functions, one could use .cfi*
directives to inform the debugger about the new location of the CFA
pointer.

Change-Id: I9dabfbc033b45e8528e67f4823c17de7bf02fa24
Signed-off-by: Douglas Raillard <douglas.raillard@arm.com>
7 years agoMerge pull request #759 from douglas-raillard-arm/dr/cosmetic_vectors_tables
danh-arm [Mon, 21 Nov 2016 16:40:29 +0000 (16:40 +0000)]
Merge pull request #759 from douglas-raillard-arm/dr/cosmetic_vectors_tables

Cosmetic change to exception table

7 years agoMerge pull request #758 from douglas-raillard-arm/dr/doc_interrupt_handler
danh-arm [Mon, 21 Nov 2016 16:38:11 +0000 (16:38 +0000)]
Merge pull request #758 from douglas-raillard-arm/dr/doc_interrupt_handler

Docs: Clarify IRQ/FIQ handler API in Interrupt Design Guide

7 years agoDocs: Clarify IRQ/FIQ handler API in Interrupt Design Guide
Douglas Raillard [Wed, 9 Nov 2016 14:02:13 +0000 (14:02 +0000)]
Docs: Clarify IRQ/FIQ handler API in Interrupt Design Guide

The API description currently states that interrupt handlers
(interrupt_type_handler_t pointers) SHOULD return a pointer
to the target cpu_context.

This patch rewords the description of the interrupts handlers to state
that it MUST return a pointer to the target security context. It also
warns about potential portability issue. Specifically, this pointer is
not used on AArch64 and calls to context library APIs must be used to
ask BL31 to return to a specific context. However, this could change in
the future and interrupt handlers must always return the pointer.

Change-Id: I3f82a046de4d7a5b51a8cbebe7eb2a00dbbdb4f0
Signed-off-by: Douglas Raillard <douglas.raillard@arm.com>
7 years agozynqmp: pm: Add SiP call to obtain PM callback data
Soren Brinkmann [Fri, 30 Sep 2016 21:24:25 +0000 (14:24 -0700)]
zynqmp: pm: Add SiP call to obtain PM callback data

The callback IRQ is delivered to the NS OS. Provide an interface to
allow the NS OS to obtain the callback data from the secure HW.

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
7 years agozynqmp: pm: Enable IPI IRQ when API version is probed
Soren Brinkmann [Fri, 30 Sep 2016 18:30:21 +0000 (11:30 -0700)]
zynqmp: pm: Enable IPI IRQ when API version is probed

The IPI hardware is secure and managed by ATF, nevertheless we deliver
the IRQ to the rich OS. The IRQ is needed to receive PM callbacks.
Enable the IPI interrupt when the rich OS probes the API version.

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
7 years agozynqmp: Remove dead code
Soren Brinkmann [Wed, 16 Nov 2016 23:50:14 +0000 (15:50 -0800)]
zynqmp: Remove dead code

Remove dead code pieces and stale comments.

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
7 years agozynqmp: Fix UART1 base address
Soren Brinkmann [Fri, 27 May 2016 15:56:53 +0000 (08:56 -0700)]
zynqmp: Fix UART1 base address

Cc: Michal Simek <michal.simek@xilinx.com>
Reported-by: Jonas Karlsson <jonas.karlsson@atero.se>
Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Acked-by: Michal Simek <michal.simek@xilinx.com>
7 years agozynqmp: PM: Migrate to new shutdown interface
Soren Brinkmann [Fri, 2 Sep 2016 16:50:54 +0000 (09:50 -0700)]
zynqmp: PM: Migrate to new shutdown interface

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
7 years agozynqmp: pm: Plumb get_chipid through FW interface
Soren Brinkmann [Thu, 22 Sep 2016 19:21:11 +0000 (12:21 -0700)]
zynqmp: pm: Plumb get_chipid through FW interface

Use the PMUFW get_chipid call to obtain IDCODE and version register.

Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
7 years agozynqmp: pm: Allow obtaining additional return values from FW
Soren Brinkmann [Thu, 22 Sep 2016 18:35:47 +0000 (11:35 -0700)]
zynqmp: pm: Allow obtaining additional return values from FW

Allow reading more than just a single value from the message buffer.

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
7 years agozynqmp: Do not alter system counter
Soren Brinkmann [Fri, 16 Sep 2016 17:31:06 +0000 (10:31 -0700)]
zynqmp: Do not alter system counter

On ZynqMP the FSBL will configure the system counter. Hence, remove the
initialization of the system counter with hardcoded values from the ATF
and use the setup provided by the bootloader.

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Acked-by: Michal Simek <michal.simek@xilinx.com>
7 years agozynqmp: Read silicon ID register only once
Soren Brinkmann [Fri, 16 Sep 2016 17:34:47 +0000 (10:34 -0700)]
zynqmp: Read silicon ID register only once

The silicon ID does not change at runtime. Skip the IO access if the
ID has been read before.

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Acked-by: Michal Simek <michal.simek@xilinx.com>
7 years agoMerge pull request #757 from douglas-raillard-arm/dr/doc_plat_psci_ops
danh-arm [Wed, 16 Nov 2016 11:36:01 +0000 (11:36 +0000)]
Merge pull request #757 from douglas-raillard-arm/dr/doc_plat_psci_ops

Document plat_psci_ops.(system_off|system_reset)

7 years agoMerge pull request #756 from douglas-raillard-arm/dr/doc_fix_link_fw_design
danh-arm [Wed, 16 Nov 2016 11:35:49 +0000 (11:35 +0000)]
Merge pull request #756 from douglas-raillard-arm/dr/doc_fix_link_fw_design

firmware-design.md: Fix broken link

7 years agoMerge pull request #754 from davidcunado-arm/dc/reset_debug_reg
danh-arm [Wed, 16 Nov 2016 11:35:31 +0000 (11:35 +0000)]
Merge pull request #754 from davidcunado-arm/dc/reset_debug_reg

Reset debug registers MDCR-EL3/SDCR and MDCR_EL2/HDCR

7 years agoCosmetic change to exception table
Douglas Raillard [Wed, 9 Nov 2016 17:48:27 +0000 (17:48 +0000)]
Cosmetic change to exception table

* Move comments on unhandled exceptions at the right place.
* Reformat the existing comments to highlight the start of
  each block of 4 entries in the exception table to ease
  navigation (lines of dash reserved for head comments).
* Reflow comments to 80 columns.

Change-Id: I5ab88a93d0628af8e151852cb5b597eb34437677
Signed-off-by: Douglas Raillard <douglas.raillard@arm.com>
7 years agofirmware-design.md: Fix broken link
Douglas Raillard [Wed, 9 Nov 2016 14:00:04 +0000 (14:00 +0000)]
firmware-design.md: Fix broken link

Fix a link broken by a missing space that turned
it into a link to an non-existent anchor.

Change-Id: Ie863e963db28afa3a28b69d3f63bd7638bdf5af9
Signed-off-by: Douglas Raillard <douglas.raillard@arm.com>
7 years agoDocument plat_psci_ops.(system_off|system_reset)
Douglas Raillard [Mon, 31 Oct 2016 13:26:03 +0000 (13:26 +0000)]
Document plat_psci_ops.(system_off|system_reset)

fixes ARM-Software/tf-issues#346

Change-Id: I946c8eab650bba7407775462ce91f394d767e079
Signed-off-by: Douglas Raillard <douglas.raillard@arm.com>
7 years agoReset debug registers MDCR-EL3/SDCR and MDCR_EL2/HDCR
David Cunado [Mon, 31 Oct 2016 17:37:34 +0000 (17:37 +0000)]
Reset debug registers MDCR-EL3/SDCR and MDCR_EL2/HDCR

In order to avoid unexpected traps into EL3/MON mode, this patch
resets the debug registers, MDCR_EL3 and MDCR_EL2 for AArch64,
and SDCR and HDCR for AArch32.

MDCR_EL3/SDCR is zero'ed when EL3/MON mode is entered, at the
start of BL1 and BL31/SMP_MIN.

For MDCR_EL2/HDCR, this patch zero's the bits that are
architecturally UNKNOWN values on reset. This is done when
exiting from EL3/MON mode but only on platforms that support
EL2/HYP mode but choose to exit to EL1/SVC mode.

Fixes ARM-software/tf-issues#430

Change-Id: Idb992232163c072faa08892251b5626ae4c3a5b6
Signed-off-by: David Cunado <david.cunado@arm.com>
7 years agoMerge pull request #753 from douglas-raillard-arm/dr/readme_linaro_release
danh-arm [Wed, 9 Nov 2016 15:38:26 +0000 (15:38 +0000)]
Merge pull request #753 from douglas-raillard-arm/dr/readme_linaro_release

readme.md: Add tested Linaro release information for FVPs

7 years agoreadme.md: Add tested Linaro release information for FVPs
Douglas Raillard [Wed, 26 Oct 2016 10:32:41 +0000 (11:32 +0100)]
readme.md: Add tested Linaro release information for FVPs

The platform testing information in the readme currently states which
Linaro release has been tested on Juno platform.

This patch adds the same information for the AArch64/32 FVPs platforms.

Change-Id: Ifa89843ee1744e5030367197648b7a2f4c44cc24
Signed-off-by: Douglas Raillard <douglas.raillard@arm.com>
7 years agospd: dispatcher for interacting with the Trusty TEE
Varun Wadekar [Tue, 8 Nov 2016 23:46:48 +0000 (15:46 -0800)]
spd: dispatcher for interacting with the Trusty TEE

This patch adds the secure payload dispatcher for interacting
with Google's Trusty TEE. Documentation for Trusty can be found
at https://source.android.com/security/trusty

Original authors:
-----------------
* Arve Hjønnevåg <arve@android.com>
* Michael Ryleev <gmar@google.com>

Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoMerge pull request #752 from rockchip-linux/rk3399/fixes-s2r-1107
danh-arm [Tue, 8 Nov 2016 12:17:44 +0000 (12:17 +0000)]
Merge pull request #752 from rockchip-linux/rk3399/fixes-s2r-1107

rk3399: fixes and updates for s2r

7 years agoMerge pull request #751 from jeenu-arm/ug-reorder
danh-arm [Tue, 8 Nov 2016 11:30:31 +0000 (11:30 +0000)]
Merge pull request #751 from jeenu-arm/ug-reorder

Alphabetical reordering for build options and make files

7 years agoMerge pull request #750 from jwerner-chromium/m0_build
danh-arm [Tue, 8 Nov 2016 11:29:43 +0000 (11:29 +0000)]
Merge pull request #750 from jwerner-chromium/m0_build

RK3399 M0 build system improvements

7 years agobuild: Reorder build variables alphabetically
Jeenu Viswambharan [Mon, 24 Oct 2016 13:31:51 +0000 (14:31 +0100)]
build: Reorder build variables alphabetically

When build variables are assigned or processed en masse, they'd appear
neater in alphabetical order.

Static initializations are moved to a separate file,
make_helpers/defaults.mk, which in itself is sorted alphabetically.

No functional changes.

Change-Id: I966010042b33de6b67592fb9ffcef8fc44d7d128
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
7 years agodocs: Reorder build options alphabetically
Jeenu Viswambharan [Mon, 24 Oct 2016 13:31:51 +0000 (14:31 +0100)]
docs: Reorder build options alphabetically

At present, build options in the user guide aren't listed in any
specific order. Ordering them alphabetically is a standard practice, and
is also easier on the reader.

Contents unchanged.

Change-Id: Ibc36f3a2a576edb86c1a402430d2ef5adcb2f144
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
7 years agorockchip: remove no needed code for rk3399
Caesar Wang [Wed, 26 Oct 2016 00:14:40 +0000 (17:14 -0700)]
rockchip: remove no needed code for rk3399

We have do something for clocks gate.

Fox example as the below:
susped:
clk_gate_con_save();
clk_gate_con_disable();

resume:
clk_gate_con_restore();
--

SO, add the plls_suspend_prepare() and plls_resume_finish() are not
necessary to S2R, that will save S2R time if remove them.

BRANCH=none
BUG=chrome-os-partner:58870,chrome-os-partner:55934
TEST=build kevin, two dogfooders with suspend_stress_test
passing 3000 cycles and still going on.

Change-Id: Icfbabc0b3ea8d2b5108d4f3de99a803b6d459669
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
7 years agorockchip: disable watchdog during suspend
Caesar Wang [Fri, 4 Nov 2016 13:13:01 +0000 (21:13 +0800)]
rockchip: disable watchdog during suspend

The CA53 and CM0 WDT clock gating in rk3399 SGRF, and ATF is in charge of
it because the kernel can't touch SGRF.

Basically the WDT didn't stop at suspend time, it just switched from the
24M to the 32k clock. That meant that the WDT would fire if you slept for
long enough. In other word, the watchdog timer over count will increase to
750 (24*1000/32) times.
The RK3399 HW watchdog interval is 21 seconds. When machine enters the
suspend, the watchdog will reset the system after 35.7 (750/21) hours.

BUG=chrome-os-partner:59257
TEST=daisydog checked and set value, powerd_dbus_suspend to verify.

Change-Id: I88bb2a05b7d67d5ffd292f9d05d033ae9a6a3593
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
7 years agorockchip: Add proper dependency tracking to M0 Makefile
Julius Werner [Thu, 3 Nov 2016 19:25:48 +0000 (12:25 -0700)]
rockchip: Add proper dependency tracking to M0 Makefile

This patch adds dependency rule generation and inclusion to the M0
Makefile, so that M0 objects will get correctly remade with an
incremental build if a header file they included changed.

Change-Id: I2067bd9fd4d9dad3e77a09cbf09c7b4db3c1eda5
Signed-off-by: Julius Werner <jwerner@chromium.org>
7 years agorockchip: Clean up parent directory creation for M0
Julius Werner [Tue, 1 Nov 2016 02:18:47 +0000 (19:18 -0700)]
rockchip: Clean up parent directory creation for M0

The dependencies in the M0 Makefile are not correctly laid out, which
may lead to errors with make -j if the binary target gets evaluated
before the target that creates the directory. In addition, the M0
Makefile just calls mkdir without using the platform-independent macros
from the main ARM TF build system. This patch fixes those issues,
removes some unused (and broken) M0 build targets and merges the two M0
output directories into one (since there's no real point splitting it up
and it creates more hassle).

Change-Id: Ia5002479cf9c57fea7aefa8ca88e373df3a51f61
Signed-off-by: Julius Werner <jwerner@chromium.org>
7 years agoMerge pull request #749 from sandrine-bailleux-arm/sb/fix-bl1_plat_mem_check-doc
danh-arm [Thu, 3 Nov 2016 17:49:32 +0000 (17:49 +0000)]
Merge pull request #749 from sandrine-bailleux-arm/sb/fix-bl1_plat_mem_check-doc

Porting guide: Improve bl1_plat_mem_check() doc

7 years agoMerge pull request #748 from dp-arm/dp/arm-sip
danh-arm [Thu, 3 Nov 2016 17:49:16 +0000 (17:49 +0000)]
Merge pull request #748 from dp-arm/dp/arm-sip

BL31 runtime instrumentation fixes and documentation update

7 years agoPorting guide: Improve bl1_plat_mem_check() doc
Sandrine Bailleux [Thu, 3 Nov 2016 14:26:37 +0000 (14:26 +0000)]
Porting guide: Improve bl1_plat_mem_check() doc

This patch fixes the type of the return value of bl1_plat_mem_check()
in the porting guide. It also specifies the expected return value.

Change-Id: I7c437342b8bfb1e621d74b2edf0aaf97b913216a
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
7 years agoPerform a cache flush after ENTER PSCI timestamp capture
dp-arm [Mon, 31 Oct 2016 17:17:21 +0000 (17:17 +0000)]
Perform a cache flush after ENTER PSCI timestamp capture

Without an explicit cache flush, the next timestamp captured might have
a bogus value.

This can happen if the following operations happen in order,
on a CPU that's being powered down.

1) ENTER PSCI timestamp is captured with caches enabled.

2) The next timestamp (ENTER_HW_LOW_PWR) is captured with caches
   disabled.

3) On a system that uses a write-back cache configuration, the
   cache line that holds the PMF timestamps is evicted.

After step 1), the ENTER_PSCI timestamp is cached and not in main memory.
After step 2), the ENTER_HW_LOW_PWR timestamp is stored in main memory.
Before the CPU power down happens, the hardware evicts the cache line that
contains the PMF timestamps for this service.  As a result, the timestamp
captured in step 2) is overwritten with a bogus value.

Change-Id: Ic1bd816498d1a6d4dc16540208ed3a5efe43f529
Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
7 years agouser guide: Document `ENABLE_RUNTIME_INSTRUMENTATION` option
dp-arm [Fri, 14 Oct 2016 10:18:09 +0000 (11:18 +0100)]
user guide: Document `ENABLE_RUNTIME_INSTRUMENTATION` option

Change-Id: I8e50df67e860b9589834445761a7b9927690fdce
Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
7 years agoMerge pull request #745 from rockchip-linux/support-rk3399-dram
danh-arm [Thu, 3 Nov 2016 15:13:36 +0000 (15:13 +0000)]
Merge pull request #745 from rockchip-linux/support-rk3399-dram

Support rk3399 dram

7 years agoMerge pull request #746 from antonio-nino-diaz-arm/an/fix-checkpatch
danh-arm [Thu, 3 Nov 2016 12:17:38 +0000 (12:17 +0000)]
Merge pull request #746 from antonio-nino-diaz-arm/an/fix-checkpatch

Fix format of patches passed to checkpatch

7 years agoMerge pull request #742 from masahir0y/misc
davidcunado-arm [Mon, 31 Oct 2016 23:12:03 +0000 (23:12 +0000)]
Merge pull request #742 from masahir0y/misc

Comment fixes and .gitignore update

7 years agoMerge pull request #744 from masahir0y/fiptool
davidcunado-arm [Fri, 28 Oct 2016 22:18:16 +0000 (23:18 +0100)]
Merge pull request #744 from masahir0y/fiptool

fiptool: fix Segmentation fault when only --verbose option is given

7 years agoFix format of patches passed to checkpatch
Antonio Nino Diaz [Thu, 27 Oct 2016 08:36:09 +0000 (09:36 +0100)]
Fix format of patches passed to checkpatch

Checkpatch is a script developed to verify the style of Linux kernel
patches. As Kernel developers use emails to send patches for review,
checkpatch is prepared for that specific format. This change adapts
the Makefile to use said format.

As a result, indentation in the commit message has been removed, thus
fixing the warnings about Signed-off-by lines being preceded by
whitespace.

Fixes ARM-software/tf-issues#432

Change-Id: I00cb86365fe15f7e2c3a99a306c8eb51cf02fe86
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
7 years agoMerge pull request #741 from sandrine-bailleux-arm/sb/checkpatch-signoff
davidcunado-arm [Thu, 27 Oct 2016 08:31:29 +0000 (09:31 +0100)]
Merge pull request #741 from sandrine-bailleux-arm/sb/checkpatch-signoff

Mandate 'Signed-off-by' line in commit messages

7 years agoMerge pull request #738 from dp-arm/dp/fiptool-uuid
davidcunado-arm [Thu, 27 Oct 2016 08:31:00 +0000 (09:31 +0100)]
Merge pull request #738 from dp-arm/dp/fiptool-uuid

fiptool: Link `toc_entry` and `image` structures via UUID

7 years agorockchip: close the PD center logic during suspend
Caesar Wang [Wed, 26 Oct 2016 17:13:34 +0000 (01:13 +0800)]
rockchip: close the PD center logic during suspend

The RK3399 supports close the center logic enter power mode,
so we can close PD_CENTER to save more power during suspend.
Therefore, we need to support save/restore the DDR PHY and
controller registers during suspend/resume.

Also, need CL (http://crosreview.com/397399) to check disabling
center logic.

Change-Id: I288defd8e9caa3846d9fa663a33e4d51df1aaa5d
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
Signed-off-by: Derek Basehore <dbasehore@chromium.org>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
7 years agorockchip: add support save/restore configuration for DDR during enter S3
Caesar Wang [Wed, 26 Oct 2016 17:13:16 +0000 (01:13 +0800)]
rockchip: add support save/restore configuration for DDR during enter S3

This patch intend to support save the registers of the DDR controller
and PHY before suspend, and restore them after resume.

Change-Id: Ia10b476c0b837628ac0f365416a7118292753e96
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
Signed-off-by: Derek Basehore <dbasehore@chromium.org>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
7 years agorockchip: Change dmc register accesses to ATF style for rk3399
Caesar Wang [Wed, 26 Oct 2016 17:12:47 +0000 (01:12 +0800)]
rockchip: Change dmc register accesses to ATF style for rk3399

This changes the style of dmc register accesses to be a read/write on
a base address plus a register offset instead of reinterpretting a
base address as a struct and accessing members within that struct.

Change-Id: Iead097cd6afdb830d8bc193608cd39d01ce5a6bc
Signed-off-by: Derek Basehore <dbasehore@chromium.org>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
7 years agorockchip: Break out common dram code for rk3399
Caesar Wang [Wed, 26 Oct 2016 17:12:34 +0000 (01:12 +0800)]
rockchip: Break out common dram code for rk3399

This renames dram.c and dram.h to dfs.c and dfs.h respectively. This
is to make room for common functionality between frequency scaling and
suspend code for the DRAM in a pair of common files named dram.c and
dram.h. It also removes a duplicate enum definition from
dram_spec_timing.h

Change-Id: Ibfa1041f8781401f9d27901fe8c61862bcb05562
Signed-off-by: Derek Basehore <dbasehore@chromium.org>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
7 years agorockchip: move pmu registers into another header for rk3399
Caesar Wang [Wed, 26 Oct 2016 17:10:28 +0000 (01:10 +0800)]
rockchip: move pmu registers into another header for rk3399

This moves the PMU register definitions into another file for use in
later patches.

Change-Id: I8b5f1e7938b63ada6a743cf9661c3e474e96e4e4
Signed-off-by: Derek Basehore <dbasehore@chromium.org>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
7 years agofiptool: fix Segmentation fault when only --verbose option is given
Masahiro Yamada [Wed, 26 Oct 2016 04:24:26 +0000 (13:24 +0900)]
fiptool: fix Segmentation fault when only --verbose option is given

Fix the following bug:

  $ tools/fiptool/fiptool -v
  Segmentation fault (core dumped)

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
7 years agoMerge pull request #724 from rockchip-linux/support-rk3399-sdram
davidcunado-arm [Wed, 26 Oct 2016 08:54:36 +0000 (09:54 +0100)]
Merge pull request #724 from rockchip-linux/support-rk3399-sdram

rockchip: optimize the link mechanism for SRAM code

7 years agoMerge pull request #739 from rockchip-linux/fixes-latency
davidcunado-arm [Wed, 26 Oct 2016 08:53:34 +0000 (09:53 +0100)]
Merge pull request #739 from rockchip-linux/fixes-latency

rockchip: fix A72 L2CTLR_DATA_RAM_LATENCY to 5

7 years agorockchip: fix A72 L2CTLR_DATA_RAM_LATENCY to 5
Caesar Wang [Thu, 4 Aug 2016 12:46:35 +0000 (20:46 +0800)]
rockchip: fix A72 L2CTLR_DATA_RAM_LATENCY to 5

The default value of L2CTLR_DATA_RAM_LATENCY is 2, depends to
the test result on rk3399, the A72 will need lower voltage for
high frequency if it's set to be 5, and almost no effect on performance.

Change-Id: I99a6a43edcc0c58f7775c10f4b85669dc3eff66d
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
7 years agorockchip: clear the power mode status via M0
Caesar Wang [Tue, 11 Oct 2016 17:47:51 +0000 (01:47 +0800)]
rockchip: clear the power mode status via M0

Due to the PMU design, the PMU may not clear the WAKEUP bit after
wakeup, therefore, the state machine at the power mode may enter
the infinite loop during WFI.

There is a solution that we can use the M0 to monitor the WAKEUP
bit and clear it during power mode, then the state machine will be
recovered immediately. Then, the DUT can exit the WFI normally.

Change-Id: I303628553b728c214bf2d436bd3122032b5e669c
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
7 years agorockchip: add M0 source code and build system for RK3399
Caesar Wang [Wed, 12 Oct 2016 00:10:12 +0000 (08:10 +0800)]
rockchip: add M0 source code and build system for RK3399

This CL supports add M0 source code to built into the bl31.bin, the
goal is that we can load the M0 code binary into SRAM and execute it.

We need the M0 help us to clean the power_mode_en bit during the AP
PMU enter the state machine with interrupt, and avoid to the AP can
not exit the loop forever.

Change-Id: I844582c54a1f0d44ca41290d44618df58679f341
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
7 years agorockchip: optimize the link mechanism for SRAM code
Caesar Wang [Tue, 11 Oct 2016 01:36:00 +0000 (09:36 +0800)]
rockchip: optimize the link mechanism for SRAM code

Add the common extra.ld.S and customized rk3399.ld.S to extend
to more features for different platforms.
For example, we can add SRAM section and specific address to
load there if we need it, and the common bl31.ld.S not need to
be modified.

Therefore, we can remove the unused codes which copying explicitly
from the function pmusram_prepare(). It looks like more clear.

Change-Id: Ibffa2da5e8e3d1d2fca80085ebb296ceb967fce8
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
7 years ago.gitignore: ignore editor backup files
Masahiro Yamada [Sat, 3 Sep 2016 02:40:24 +0000 (11:40 +0900)]
.gitignore: ignore editor backup files

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
7 years agoFix comment of plat_reset_handler stub
Masahiro Yamada [Sat, 24 Sep 2016 09:07:46 +0000 (18:07 +0900)]
Fix comment of plat_reset_handler stub

As described in the Porting Guide, plat_reset_handler should
preserve x19 to x29.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
7 years agoDocs: fix a typo in Porting Guide about plat_get_my_entrypoint()
Masahiro Yamada [Sat, 22 Oct 2016 16:15:21 +0000 (01:15 +0900)]
Docs: fix a typo in Porting Guide about plat_get_my_entrypoint()

Do not double the phrase "called with the".

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
7 years agoMandate 'Signed-off-by' line in commit messages
Sandrine Bailleux [Mon, 24 Oct 2016 12:09:08 +0000 (13:09 +0100)]
Mandate 'Signed-off-by' line in commit messages

This patch updates the configuration file for the checkpatch.pl
script to check for the presence of a 'Signed-off-by' line in the
commit message. This is now required by TF contribution process.

Change-Id: I8bcd6d39a5dcd85547244d60c10a7cd2148c404f

Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
7 years agoMerge pull request #740 from rockchip-linux/rk3399/fixes-cru-typo
davidcunado-arm [Mon, 24 Oct 2016 11:36:03 +0000 (12:36 +0100)]
Merge pull request #740 from rockchip-linux/rk3399/fixes-cru-typo

rockchip: fixes the wrong CLKSEL_CON count for CRU

7 years agorockchip: fixes the wrong CLKSEL_CON count for CRU
Caesar Wang [Thu, 20 Oct 2016 21:14:45 +0000 (14:14 -0700)]
rockchip: fixes the wrong CLKSEL_CON count for CRU

The CRU_CLKSEL_COUNT value is 108, not 0x108.

Signed-off-by: Caesar Wang <wxt@rock-chips.com>
Change-Id: Ib9db066b8b3ecafcee7f645dd5633b55a808e3d7

7 years agoMerge pull request #677 from hzhuang1/gpt
danh-arm [Tue, 18 Oct 2016 15:32:57 +0000 (16:32 +0100)]
Merge pull request #677 from hzhuang1/gpt

partition: check GPT partition table

7 years agofiptool: Link `toc_entry` and `image` structures via UUID
dp-arm [Tue, 30 Aug 2016 13:18:58 +0000 (14:18 +0100)]
fiptool: Link `toc_entry` and `image` structures via UUID

The `toc_entry` and `image` data structures had a cyclic
relationship.  This patch removes the explicit dependencies and introduces
functions to link them via the UUID.

This change highlights the intent of the code better and makes it more
flexible for future enhancements.

Change-Id: I0c3dd7bfda2a631a3827c8ba4831849c500affe9
Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
7 years agoMerge pull request #735 from soby-mathew/sm/aarch32_sctlr
danh-arm [Mon, 17 Oct 2016 11:20:18 +0000 (12:20 +0100)]
Merge pull request #735 from soby-mathew/sm/aarch32_sctlr

Unify SCTLR initialization for AArch32 normal world

7 years agoMerge pull request #734 from afaerber/make-help
danh-arm [Mon, 17 Oct 2016 11:19:45 +0000 (12:19 +0100)]
Merge pull request #734 from afaerber/make-help

Makefile: Add missing space in help output

7 years agoMerge pull request #730 from dp-arm/dp/uuid-cleanup
danh-arm [Mon, 17 Oct 2016 11:19:34 +0000 (12:19 +0100)]
Merge pull request #730 from dp-arm/dp/uuid-cleanup

Remove non-standard <sys/cdefs.h> include from uuid.h

7 years agoMerge pull request #729 from dp-arm/dp/arm-sip
danh-arm [Mon, 17 Oct 2016 11:19:20 +0000 (12:19 +0100)]
Merge pull request #729 from dp-arm/dp/arm-sip

Add instrumentation support for PSCI

7 years agoMerge pull request #721 from rockchip-linux/fixes-the-clock-select-and-divide-register
davidcunado-arm [Fri, 14 Oct 2016 11:25:06 +0000 (12:25 +0100)]
Merge pull request #721 from rockchip-linux/fixes-the-clock-select-and-divide-register

rockchip: fixes the clock select and divide register for rk3399

7 years agoUnify SCTLR initialization for AArch32 normal world
Soby Mathew [Thu, 29 Sep 2016 13:15:57 +0000 (14:15 +0100)]
Unify SCTLR initialization for AArch32 normal world

The values of CP15BEN, nTWI & nTWE bits in SCTLR_EL1 are architecturally
unknown if EL3 is AARCH64 whereas they reset to 1 if EL3 is AArch32. This
might be a compatibility break for legacy AArch32 normal world software if
these bits are not set to 1 when EL3 is AArch64. This patch enables the
CP15BEN, nTWI and nTWE bits in the SCTLR_EL1 if the lower non-secure EL is
AArch32. This unifies the SCTLR settings for lower non-secure EL in AArch32
mode for both AArch64 and AArch32 builds of Trusted Firmware.

Fixes ARM-software/tf-issues#428

Change-Id: I3152d1580e4869c0ea745c5bd9da765f9c254947
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
7 years agoMerge pull request #733 from danh-arm/dh/v1.3-final
davidcunado-arm [Thu, 13 Oct 2016 16:49:06 +0000 (17:49 +0100)]
Merge pull request #733 from danh-arm/dh/v1.3-final

Final updates for v1.3 release

7 years agoMerge pull request #736 from davidcunado-arm/dc/v1.3_update
davidcunado-arm [Thu, 13 Oct 2016 16:48:29 +0000 (17:48 +0100)]
Merge pull request #736 from davidcunado-arm/dc/v1.3_update

Release v1.3: Minor updates to user guide

7 years agoRelease v1.3: Minor updates to user guide
David Cunado [Thu, 13 Oct 2016 15:04:12 +0000 (16:04 +0100)]
Release v1.3: Minor updates to user guide

Updated the user guide to clarify building FIP for AArch32.
The instructions were previously specific to building a FIP for AArch64.

Change-Id: I7bd1a6b8e810cfda411f707e04f479006817858e
Signed-off-by: David Cunado <david.cunado@arm.com>
7 years agoUpdate readme.md for v1.3
Dan Handley [Tue, 11 Oct 2016 15:17:11 +0000 (16:17 +0100)]
Update readme.md for v1.3

Update the release notes (readme.md) for the ARM Trusted Firmware
v1.3 release.

Change-Id: Ia1f4eb1897e63eeab7d69a593ba0ad91d50043f5
Signed-off-by: Dan Handley <dan.handley@arm.com>
7 years agoRelease v1.3: Update minor version number to 3
David Cunado [Tue, 4 Oct 2016 15:06:37 +0000 (16:06 +0100)]
Release v1.3: Update minor version number to 3

Change-Id: I05991543d28e70b67be600b714990af6a8d7ba29

7 years agoRelease v1.3: update change-log.md
David Cunado [Mon, 3 Oct 2016 17:20:35 +0000 (18:20 +0100)]
Release v1.3: update change-log.md

Updated change-log.md with summary of changes since release v1.2.

Change-Id: Ia1e18ff4b0da567cf12dfcb53e6317e995100bdf

7 years agoMerge pull request #732 from dp-arm/dp/pmf-doc
danh-arm [Wed, 12 Oct 2016 16:17:19 +0000 (17:17 +0100)]
Merge pull request #732 from dp-arm/dp/pmf-doc

PMF: Add documentation

7 years agoPMF: Add documentation
dp-arm [Thu, 8 Sep 2016 10:54:22 +0000 (11:54 +0100)]
PMF: Add documentation

Add a Performance Measurement Framework (PMF) section
to the firmware design document.

Change-Id: I5953bd3b1067501f190164c8827d2b0d8022fc0b
Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
7 years agoRemove non-standard <sys/cdefs.h> include from uuid.h
dp-arm [Fri, 16 Sep 2016 14:46:47 +0000 (15:46 +0100)]
Remove non-standard <sys/cdefs.h> include from uuid.h

This include provides nothing useful for TF and prevents building
the fiptool using musl libc[0].

[0] https://www.musl-libc.org/

Change-Id: Ied35e16b9ea2b40213433f2a8185dddc59077884
Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
7 years agoAdd PMF instrumentation points in TF
dp-arm [Mon, 19 Sep 2016 10:18:44 +0000 (11:18 +0100)]
Add PMF instrumentation points in TF

In order to quantify the overall time spent in the PSCI software
implementation, an initial collection of PMF instrumentation points
has been added.

Instrumentation has been added to the following code paths:

- Entry to PSCI SMC handler.  The timestamp is captured as early
  as possible during the runtime exception and stored in memory
  before entering the PSCI SMC handler.

- Exit from PSCI SMC handler.  The timestamp is captured after
  normal return from the PSCI SMC handler or if a low power state
  was requested it is captured in the bl31 warm boot path before
  return to normal world.

- Entry to low power state.  The timestamp is captured before entry
  to a low power state which implies either standby or power down.
  As these power states are mutually exclusive, only one timestamp
  is defined to describe both.  It is possible to differentiate between
  the two power states using the PSCI STAT interface.

- Exit from low power state.  The timestamp is captured after a standby
  or power up operation has completed.

To calculate the number of cycles spent running code in Trusted Firmware
one can perform the following calculation:

(exit_psci - enter_psci) - (exit_low_pwr - enter_low_pwr).

The resulting number of cycles can be converted to time given the
frequency of the counter.

Change-Id: Ie3b8f3d16409b6703747093b3a2d5c7429ad0166
Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
7 years agoIntroduce ARM SiP service
dp-arm [Mon, 19 Sep 2016 10:21:03 +0000 (11:21 +0100)]
Introduce ARM SiP service

This patch adds ARM SiP service for use by ARM standard platforms.
This service is added to support the SMC interface for the Performance
measurement framework(PMF).

Change-Id: I26f5712f9ab54f5f721dd4781e35a16f40aacc44
Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
7 years agoMerge pull request #731 from danh-arm/an/fix-juno-doc
danh-arm [Wed, 12 Oct 2016 10:52:57 +0000 (11:52 +0100)]
Merge pull request #731 from danh-arm/an/fix-juno-doc

Fix documentation of bootwrapper boot on juno

7 years agoFix documentation of bootwrapper boot on juno
Antonio Nino Diaz [Wed, 20 Apr 2016 10:55:14 +0000 (11:55 +0100)]
Fix documentation of bootwrapper boot on juno

The user guide incorrectly claimed that it is possible to load a
bootwrapped kernel over JTAG on Juno in the same manner as an EL3
payload. In the EL3 payload boot flow, some of the platform
initialisations in BL2 are modified. In particular, the TZC settings
are modified to allow unrestricted access to DRAM. This in turn allows
the debugger to access the DRAM and therefore to load the image there.

In the BL33-preloaded boot flow though, BL2 uses the default TZC
programming, which prevent access to most of the DRAM from secure state.
When execution reaches the SPIN_ON_BL1_EXIT loop, the MMU is disabled
and thus DS-5 presumably issues secure access transactions while trying
to load the image, which fails.

One way around it is to stop execution at the end of BL2 instead. At
this point, the MMU is still enabled and the DRAM is mapped as
non-secure memory. Therefore, the debugger is allowed to access this
memory in this context and to sucessfully load the bootwrapped kernel in
DRAM. The user guide is updated to suggest this alternative method.

Co-Authored-By: Sandrine Bailleux <sandrine.bailleux@arm.com>
Signed-off-by: Dan Handley <dan.handley@arm.com>
Change-Id: I537ea1c6d2f96edc06bc3f512e770c748bcabe94

7 years agoMerge pull request #728 from yatharth-arm/yk/AArch32_porting_doc
danh-arm [Wed, 12 Oct 2016 10:15:35 +0000 (11:15 +0100)]
Merge pull request #728 from yatharth-arm/yk/AArch32_porting_doc

AArch32: Update firmware-design.md