1. 01 Aug, 2019 1 commit
    • Julius Werner's avatar
      Replace __ASSEMBLY__ with compiler-builtin __ASSEMBLER__ · d5dfdeb6
      Julius Werner authored
      
      
      NOTE: __ASSEMBLY__ macro is now deprecated in favor of __ASSEMBLER__.
      
      All common C compilers predefine a macro called __ASSEMBLER__ when
      preprocessing a .S file. There is no reason for TF-A to define it's own
      __ASSEMBLY__ macro for this purpose instead. To unify code with the
      export headers (which use __ASSEMBLER__ to avoid one extra dependency),
      let's deprecate __ASSEMBLY__ and switch the code base over to the
      predefined standard.
      
      Change-Id: Id7d0ec8cf330195da80499c68562b65cb5ab7417
      Signed-off-by: default avatarJulius Werner <jwerner@chromium.org>
      d5dfdeb6
  2. 03 Apr, 2019 1 commit
  3. 01 Mar, 2019 1 commit
    • Varun Wadekar's avatar
      Tegra: dummy support for the io_storage backend · 8d56e24b
      Varun Wadekar authored
      
      
      This patch provides dummy macros and platform files to compile
      the io_storage driver backend. This patch is necessary to
      remove the "--unresolved=el3_panic" linker flag from Tegra's
      makefiles and allow us to revert this workaround, previously
      suggested by the ARM toolchain team.
      
      The "--unresolved=el3_panic" flag actually was a big hammer that
      allowed Tegra platforms to work with armlink previously but it
      masks legit errors with the code as well.
      
      Change-Id: I0421d35657823215229f84231896b84167f90548
      Signed-off-by: default avatarVarun Wadekar <vwadekar@nvidia.com>
      8d56e24b
  4. 07 Feb, 2019 2 commits
  5. 31 Jan, 2019 20 commits
    • Varun Wadekar's avatar
      Tegra: restrict non-secure PMC accesses · a01b0f16
      Varun Wadekar authored
      
      
      Platforms that do not support bpmp firmware, do not need access
      to the PMC block from outside of the CPU complex. The agents
      running on the CPU can always access the PMC through the EL3
      exception space.
      
      This patch restricts non-secure world access to the PMC block on
      such platforms.
      
      Change-Id: I2c4318dc07ddf6407c1700595e0f4aac377ba258
      Signed-off-by: default avatarVarun Wadekar <vwadekar@nvidia.com>
      a01b0f16
    • Varun Wadekar's avatar
      Tegra: bpmp: mark device "not present" on boot timeout · e6712cf5
      Varun Wadekar authored
      
      
      This patch updates the state machine to "not present" if the bpmp
      firmware is not found in the system during boot. The suspend
      handler also checks now if the interface exists, before updating
      the internal state machine.
      
      Reported by: Kalyani Chidambaram Vaidyanathan <kalyanic@nvidia.com>
      
      Change-Id: If8fd7f8e412bb603944555c24826855226e7f48c
      Signed-off-by: default avatarVarun Wadekar <vwadekar@nvidia.com>
      e6712cf5
    • kalyani chidambaram's avatar
      Tegra210: clear PMC_DPD registers on resume · da0f4743
      kalyani chidambaram authored
      
      
      This patch clears the PMC's DPD registers on resuming from System
      Suspend, for all Tegra210 platforms that support the sc7entry-fw.
      
      Change-Id: I7881ef0a5f609ed28b158bc2f4016abea3c7f305
      Signed-off-by: default avatarkalyani chidambaram <kalyanic@nvidia.com>
      da0f4743
    • Varun Wadekar's avatar
      Tegra: bpmp: suspend/resume handlers · d37a1322
      Varun Wadekar authored
      
      
      This patch adds suspend and resume handlers for the BPMP
      interface. Mark the interface as "suspended" before entering
      System Suspend and verify that BPMP is alive on exit.
      
      Change-Id: I74ccbc86125079b46d06360fc4c7e8a5acfbdfb2
      Signed-off-by: default avatarVarun Wadekar <vwadekar@nvidia.com>
      d37a1322
    • Varun Wadekar's avatar
      Tegra210: skip past sc7entry-fw signature header · c33473d5
      Varun Wadekar authored
      
      
      This patch skips past the signature header added to the sc7entry-fw
      binary by the previous level bootloader. Currently, the size of
      the header is 1KB, so adjust the start address and the binary size
      at the time of copy.
      
      Change-Id: Id0494548009749035846d54df417a960c640c8f9
      Signed-off-by: default avatarVarun Wadekar <vwadekar@nvidia.com>
      c33473d5
    • kalyani chidambaram's avatar
      Tegra210: SiP handlers to allow PMC access · fdc08e2e
      kalyani chidambaram authored
      
      
      This patch adds SiP handler for Tegra210 platforms to service
      read/write requests for PMC block. None of the secure registers
      are accessible to the NS world though.
      
      Change-Id: I7dc1f10c6a6ee6efc642ddcfb1170fb36d3accff
      Signed-off-by: default avatarkalyani chidambaram <kalyanic@nvidia.com>
      fdc08e2e
    • Varun Wadekar's avatar
      Tegra210: power off all DMA masters before System Suspend entry · 2d5560f9
      Varun Wadekar authored
      
      
      This patch puts all the DMA masters in reset before starting the System
      Suspend sequence. This helps us make sure that there are no rogue agents
      in the system trying to over-write the SC7 Entry Firmware with their own.
      
      Change-Id: I7eb39999d229951e612fbfeb9f86c4efb8f98b5a
      Signed-off-by: default avatarVarun Wadekar <vwadekar@nvidia.com>
      2d5560f9
    • Varun Wadekar's avatar
      Tegra: support for System Suspend using sc7entry-fw binary · 3ca3c27c
      Varun Wadekar authored
      
      
      This patch adds support to enter System Suspend on Tegra210 platforms
      without the traditional BPMP firmware. The BPMP firmware will no longer
      be supported on Tegra210 platforms and its functionality will be
      divided across the CPU and sc7entry-fw.
      
      The sc7entry-fw takes care of performing the hardware sequence required
      to enter System Suspend (SC7 power state) from the COP. The CPU is required
      to load this firmware to the internal RAM of the COP and start the sequence.
      The CPU also make sure that the COP is off after cold boot and is only
      powered on when we want to start the actual System Suspend sequence.
      
      The previous bootloader loads the firmware to TZDRAM and passes its base and
      size as part of the boot parameters. The EL3 layer is supposed to sanitize
      the parameters before touching the firmware blob.
      
      To assist the warmboot code with the PMIC discovery, EL3 is also supposed to
      program PMC's scratch register #210, with appropriate values. Without these
      settings the warmboot code wont be able to get the device out of System
      Suspend.
      
      Change-Id: I5a7b868512dbfd6cfefd55acf3978a1fd7ebf1e2
      Signed-off-by: default avatarVarun Wadekar <vwadekar@nvidia.com>
      3ca3c27c
    • Varun Wadekar's avatar
      Tegra210: remove support for cluster power down · 93e3b0f3
      Varun Wadekar authored
      
      
      This patch removes support for powering down a CPU cluster on
      Tegra210 platforms as none of them actually use it.
      
      Change-Id: I9665634cf2b5b7b8a1b5a2700cae152dc9165fe3
      Signed-off-by: default avatarVarun Wadekar <vwadekar@nvidia.com>
      93e3b0f3
    • Varun Wadekar's avatar
      Tegra210: support for cluster idle from the CPU · 7db077f2
      Varun Wadekar authored
      
      
      This patch adds support to enter/exit to/from cluster idle power
      state on Tegra210 platforms that do not load BPMP firmware.
      
      The CPU initates the cluster idle sequence on the last standing
      CPU, by following these steps:
      
      Entry
      -----
      * stop other CPUs from waking up
      * program the PWM pinmux to tristate for OVR PMIC
      * program the flow controller to enter CC6 state
      * skip L1 $ flush during cluster power down, as L2 $ is inclusive
        of L1 $ on Cortex-A57 CPUs
      
      Exit
      ----
      * program the PWM pinmux to un-tristate for OVR PMIC
      * allow other CPUs to wake up
      
      This patch also makes sure that cluster idle state entry is not
      enabled until CL-DVFS is ready.
      
      Change-Id: I54cf31bf72b4a09d9bf9d2baaed6ee5a963c7808
      Signed-off-by: default avatarVarun Wadekar <vwadekar@nvidia.com>
      7db077f2
    • Varun Wadekar's avatar
      Tegra: pmc: helper function to find last ON CPU · a7a63e0e
      Varun Wadekar authored
      
      
      This patch adds a helper function to find the last standing CPU
      in a cluster.
      
      Change-Id: Id018f1958f458c772c7b0c52af8ddf7532b1cec5
      Signed-off-by: default avatarVarun Wadekar <vwadekar@nvidia.com>
      a7a63e0e
    • Steven Kao's avatar
      Tegra: platform dependent address space sizes · 1d11f73e
      Steven Kao authored
      
      
      This patch moves the PLAT_PHY_ADDR_SPACE_SIZE & PLAT_VIRT_ADDR_SPACE
      macros to tegra_def.h, to define the virtual/physical address space
      size on the platform.
      
      Change-Id: I1c5d264c7ffc1af0e7b14cc16ae2c0416efc76f6
      Signed-off-by: default avatarSteven Kao <skao@nvidia.com>
      1d11f73e
    • Varun Wadekar's avatar
      Tegra210: Enable WDT_CPU interrupt for FIQ Debugger · 51a5e593
      Varun Wadekar authored
      
      
      This patch enables the watchdog timer's interrupt as an FIQ
      interrupt to the CPU. The interrupt generated by the watchdog
      is connected to the flow controller for power management reasons,
      and needs to be routed to the GICD for it to reach the CPU.
      
      Change-Id: I9437b516da2c5d763eca72694ed7f3c7389b3d9e
      Signed-off-by: default avatarVarun Wadekar <vwadekar@nvidia.com>
      51a5e593
    • Varun Wadekar's avatar
      Tegra: flowctrl: helper functions to assist with cluster power states · 1483d4e0
      Varun Wadekar authored
      
      
      This patch adds helper functions to help platforms with cluster state entry
      and exit decisions.
      
      * tegra_fc_ccplex_pgexit_lock(): lock CPU power ungate
      * tegra_fc_ccplex_pgexit_unlock(): unlock CPU power ungate
      * tegra_fc_is_ccx_allowed(): CCx state entry allowed on this CPU?
      
      Change-Id: I6490d34bf380dc03ae203eb3028f61984f06931c
      Signed-off-by: default avatarVarun Wadekar <vwadekar@nvidia.com>
      1483d4e0
    • Varun Wadekar's avatar
      Tegra: flowctrl: support to enable/disable WDT's legacy FIQ routing · 2ed09b1e
      Varun Wadekar authored
      
      
      On earlier Tegra platforms, e.g. Tegra210, the watchdog timer's FIQ interrupt
      is not direclty wired to the GICD. It goes to the flow controller instead, for
      power state management. But the flow controller can route the FIQ to the GICD,
      as a PPI, which can then get routed to the target CPU.
      
      This patch adds routines to enable/disable routing the legacy FIQ used by
      the watchdog timers, to the GICD.
      
      Change-Id: Idd07c88c8d730b5f0e93e3a6e4fdc59bdcb2161b
      Signed-off-by: default avatarVarun Wadekar <vwadekar@nvidia.com>
      2ed09b1e
    • Jeetesh Burman's avatar
      Tegra: SiP: set GPU in reset after vpr resize · 3e28e935
      Jeetesh Burman authored
      
      
      Whenever the VPR memory is resized, the GPU is put into reset first
      and then the new VPR parameters are programmed to the memory controller
      block. There exists a scenario, where the GPU might be out before we
      program the new VPR parameters. This means, the GPU would still be
      using older settings and leak secrets.
      
      This patch puts the GPU back into reset, if it is out of reset after
      resizing VPR, to mitigate this hole.
      
      Change-Id: I38a1000e3803f80909efcb02e27da4bd46909931
      Signed-off-by: default avatarJeetesh Burman <jburman@nvidia.com>
      3e28e935
    • steven kao's avatar
      Tegra: bpmp_ipc: support to enable/disable module clocks · ff605ba2
      steven kao authored
      
      
      This patch adds support to the bpmp_ipc driver to allow clients to
      enable/disable clocks to hardware blocks. Currently, the API only
      supports SE devices.
      
      Change-Id: I9a361e380c0bcda59f5a92ca51c86a46555b2e90
      Signed-off-by: default avatarsteven kao <skao@nvidia.com>
      ff605ba2
    • Varun Wadekar's avatar
      Tegra: fix offset used to dump GICD registers from crash handler · 8510376c
      Varun Wadekar authored
      
      
      The GICD registers are 32-bits wide whereas the crash handler was reading
      them as 64-bit ones. This patch fixes the code to read the GICD registers,
      32-bits at a time, from the paltform's crash handler.
      
      Change-Id: If3d6608529684ecc02be6a1b715012310813b2a4
      Signed-off-by: default avatarVarun Wadekar <vwadekar@nvidia.com>
      8510376c
    • Varun Wadekar's avatar
      Tegra: default platform handler for the CPU_STANDBY state · 0887026e
      Varun Wadekar authored
      
      
      This patch adds a default implementation for the platform specific
      CPU standby power handler. Tegra SoCs can override this handler
      with their own implementations.
      
      Change-Id: I91e513842f194b1e2b1defa2d833bb4d9df5f06b
      Signed-off-by: default avatarVarun Wadekar <vwadekar@nvidia.com>
      0887026e
    • Pritesh Raithatha's avatar
      Tegra186: smmu: add support for backup multiple smmu regs · 28f45bb8
      Pritesh Raithatha authored
      
      
      Modifying smmu macros to pass base address of smmu so that it can be
      used with multiple smmus.
      
      Added macro for combining smmu backup regs that can be used for multiple
      smmus.
      
      Change-Id: I4f3bb83d66d5df14a3b91bc82f7fc26ec8e4592e
      Signed-off-by: default avatarPritesh Raithatha <praithatha@nvidia.com>
      28f45bb8
  6. 23 Jan, 2019 10 commits
    • Dilan Lee's avatar
      Tegra: add 'late' platform setup handler · 3e1923d9
      Dilan Lee authored
      
      
      This patch adds a platform setup handler that gets called after
      the MMU is enabled. Platforms wanting to make use of this handler
      should declare 'plat_late_platform_setup' handler in their platform
      files, to override the default weakly defined handler.
      
      Change-Id: Ibc97a2e5a24608ddea856d0bd543a9d5876f604c
      Signed-off-by: default avatarDilan Lee <dilee@nvidia.com>
      3e1923d9
    • Varun Wadekar's avatar
      Tegra186: save system suspend entry marker to TZDRAM · 539c62d7
      Varun Wadekar authored
      
      
      This patch adds support to save the system suspend entry and exit
      markers to TZDRAM to help the trampoline code decide if the current
      warmboot is actually an exit from System Suspend.
      
      The Tegra186 platform handler sets the system suspend entry marker
      before entering SC7 state and the trampoline flips the state back to
      system resume, on exiting SC7.
      
      Change-Id: I29d73f1693c89ebc8d19d7abb1df1e460eb5558e
      Signed-off-by: default avatarVarun Wadekar <vwadekar@nvidia.com>
      539c62d7
    • Varun Wadekar's avatar
      Tegra186: helper functions for CPU rst handler and SMMU ctx offset · 889c07c7
      Varun Wadekar authored
      
      
      This patch adds a helper function to get the SMMU context's offset
      and uses another helper function to get the CPU trampoline offset.
      These helper functions are used by the System Suspend entry sequence
      to save the SMMU context and CPU reset handler to TZDRAM.
      
      Change-Id: I95e2862fe37ccad00fa48ec165c6e4024df01147
      Signed-off-by: default avatarVarun Wadekar <vwadekar@nvidia.com>
      889c07c7
    • Steven Kao's avatar
      Tegra: rename secure scratch register macros · 601a8e54
      Steven Kao authored
      
      
      This patch renames all the secure scratch registers to reflect their
      usage.
      
      This is a list of all the macros being renamed:
      
      - SECURE_SCRATCH_RSV1_* -> SCRATCH_RESET_VECTOR_*
      - SECURE_SCRATCH_RSV6 -> SCRATCH_SECURE_BOOTP_FCFG
      - SECURE_SCRATCH_RSV11_* -> SCRATCH_SMMU_TABLE_ADDR_*
      - SECURE_SCRATCH_RSV53_* -> SCRATCH_BOOT_PARAMS_ADDR_*
      - SECURE_SCRATCH_RSV55_* -> SCRATCH_TZDRAM_ADDR_*
      
      NOTE: Future SoCs will have to define these macros to
            keep the drivers functioning.
      
      Change-Id: Ib3ba40dd32e77b92b47825f19c420e6fdfa8b987
      Signed-off-by: default avatarSteven Kao <skao@nvidia.com>
      601a8e54
    • Varun Wadekar's avatar
      Tegra: memctrl_v2: platform handler for TZDRAM settings · d5bd0de6
      Varun Wadekar authored
      
      
      The Tegra memctrl driver sets up the TZDRAM fence during boot and
      system suspend exit. This patch provides individual platforms with
      handlers to perform platform specific steps, e.g. enable encryption,
      save base/size to secure scratch registers.
      
      Change-Id: Ifaa2e0eac20b50f77ec734256544c36dd511bd63
      Signed-off-by: default avatarVarun Wadekar <vwadekar@nvidia.com>
      d5bd0de6
    • Varun Wadekar's avatar
      Tegra186: secondary: fix MISRA violations for Rules 8.6, 11.1 · 7191566c
      Varun Wadekar authored
      
      
      This patch fixes the following MISRA violations:
      
      Rule 8.6: Externally-linked object or function has "no" definition(s).
      Rule 11.1: A cast shall not convert a pointer to a function to
      any other type.
      
      Change-Id: Ic1f6fc14c744e54ff782c6987dab9c9430410f5e
      Signed-off-by: default avatarVarun Wadekar <vwadekar@nvidia.com>
      7191566c
    • Varun Wadekar's avatar
      Tegra: bpmp_ipc: IPC driver to communicate with BPMP firmware · 26e2b93a
      Varun Wadekar authored
      
      
      This patch adds the driver to communicate with the BPMP firmware on Tegra
      SoCs, starting Tegra186. BPMP firmware is responsible for clock enable/
      disable requests, module resets among other things.
      
      MRQ is short for Message ReQuest. This is the general purpose, multi channel
      messaging protocol that is widely used to communicate with BPMP. This is further
      divided into a common high level protocol and a peer-specific low level protocol.
      The higher level protocol specifies the peer identification, channel definition
      and allocation, message structure, message semantics and message dispatch process
      whereas the lower level protocol defines actual message transfer implementation
      details. Currently, BPMP supports two lower level protocols - Token Mail Operations
      (TMO), IVC Mail Operations (IMO).
      
      This driver implements the IMO protocol. IMO is implemented using the IVC (Inter-VM
      Communication) protocol which is a lockless, shared memory messaging queue management
      protocol.
      
      The IVC peer is expected to perform the following as part of establishing a connection
      with BPMP.
      
      1. Initialize the channels with tegra_ivc_init() or its equivalent.
      2. Reset the channel with tegra_ivc_channel_reset. The peer should also ensure that
         BPMP is notified via the doorbell.
      3. Poll until the channel connection is established [tegra_ivc_channel_notified() return
         0]. Interrupt BPMP with doorbell each time after tegra_ivc_channel_notified() return
         non zero.
      
      The IPC driver currently supports reseting the GPCDMAand XUSB_PADCTL hardware blocks. In
      future, more hardware blocks would be supported.
      
      Change-Id: I52a4bd3a853de6c4fa410904b6614ff1c63df364
      Signed-off-by: default avatarVarun Wadekar <vwadekar@nvidia.com>
      26e2b93a
    • Steven Kao's avatar
      Tegra: memctrl_v2: allow CPU accesses to TZRAM · d6306d14
      Steven Kao authored
      
      
      This patch enables CPU access configuration register to allow
      accesses to the TZRAM aperture on chips after Tegra186.
      
      Change-Id: I0898582f8bd6fd35360ecf8ca5cee21fe35f7aab
      Signed-off-by: default avatarSteven Kao <skao@nvidia.com>
      d6306d14
    • Harvey Hsieh's avatar
      Tegra: memctrl_v2: pack TZDRAM base to RSVD55_SCRATCH · b886c7c5
      Harvey Hsieh authored
      
      
      This patch saves the TZDRAM_BASE value to secure RSVD55
      scratch register. The warmboot code uses this register to
      restore the settings on exiting System Suspend.
      
      Change-Id: Id76175c2a7d931227589468511365599e2908411
      Signed-off-by: default avatarHarvey Hsieh <hhsieh@nvidia.com>
      b886c7c5
    • Puneet Saxena's avatar
      Tegra: memctrl_v2: platform handlers to program MSS · ab2eb455
      Puneet Saxena authored
      
      
      Introduce platform handlers to program the MSS settings.
      This allows the current driver to scale to future chips.
      
      Change-Id: I40a27648a1a3c73b1ce38dafddc1babb6f0b0d9b
      Signed-off-by: default avatarPuneet Saxena <puneets@nvidia.com>
      Signed-off-by: default avatarKrishna Reddy <vdumpa@nvidia.com>
      ab2eb455
  7. 18 Jan, 2019 5 commits
    • Harvey Hsieh's avatar
      Tegra: memctrl: clean MC INT status before exit to bootloader · 650d9c52
      Harvey Hsieh authored
      
      
      This patch cleans the Memory controller's interrupt status
      register, before exiting to the non-secure world during
      cold boot. This is required as we observed that the MC's
      arbitration bit is set before exiting the secure world.
      
      Change-Id: Iacd01994d03b3b9cbd7b8a57fe7ab5b04e607a9f
      Signed-off-by: default avatarHarvey Hsieh <hhsieh@nvidia.com>
      650d9c52
    • Harvey Hsieh's avatar
      Tegra: memctrl_v2: pack TZDRAM base into SCRATCH54_LO · 70da35b0
      Harvey Hsieh authored
      
      
      This patch moves the TZDRAM base address to SCRATCH55_LO due
      to security concerns. The HI and LO address bits are packed
      into SCRATCH55_LO for the warmboot firmware to restore.
      SCRATCH54_HI is still being used for backward compatibility,
      but would be removed eventually.
      
      The scratch registers are populated as:
      * RSV55_0 = CFG1[12:0] | CFG0[31:20]
      * RSV55_1 = CFG3[1:0]
      * RSV54_1 = CFG1[12:0]
      
      Change-Id: Idc20d165d8117488010fcc8dfd946f7ad475da58
      Signed-off-by: default avatarHarvey Hsieh <hhsieh@nvidia.com>
      70da35b0
    • Samuel Payne's avatar
      Tegra210_B01: SC7: Select RNG mode based on ECID · 620b2233
      Samuel Payne authored
      
      
      If ECID is valid, we can use force instantiation
      otherwise, we should use reseed for random data
      generation for RNG operations in SE context save
      DNI because we are not keeping software save
      sequence in main.
      
      Change-Id: I73d650e6f45db17b780834b8de4c10501e05c8f3
      Signed-off-by: default avatarSamuel Payne <spayne@nvidia.com>
      620b2233
    • Marvin Hsu's avatar
      Tegra210B01: SE/SE2 and PKA1 context save (SW) · 5ed1755a
      Marvin Hsu authored
      
      
      This change ports the software based SE context save routines.
      The software implements the context save sequence for SE/SE2 and
      PKA1. The context save routine is intended to be invoked from
      the ATF SC7 entry.
      
      Change-Id: I9aa156d6e7e22a394bb10cb0c3b05fc303f08807
      Signed-off-by: default avatarMarvin Hsu <marvinh@nvidia.com>
      5ed1755a
    • Varun Wadekar's avatar
      Tegra: lib: library for profiling the cold boot path · 087cf68a
      Varun Wadekar authored
      
      
      The non secure world would like to profile the boot path for
      the EL3 and S-EL1 firmwares. To allow it to do that, a non-secure
      DRAM region (4K) is allocated and the base address is passed to
      the EL3 firmware.
      
      This patch adds a library to allow the platform code to store the
      tag:timestamp pair to the shared memory. The tegra platform code
      then uses the `record` method to add timestamps.
      
      Original change by Akshay Sharan <asharan@nvidia.com>
      
      Change-Id: Idbbef9c83ed84a508b04d85a6637775960dc94ba
      Signed-off-by: default avatarVarun Wadekar <vwadekar@nvidia.com>
      087cf68a