1. 19 Aug, 2019 1 commit
  2. 09 Aug, 2019 9 commits
    • Joerg Roedel's avatar
      iommu/omap: Fix compilation warnings · 73499ad2
      Joerg Roedel authored
      A recent patch introduced a new compiler warning because
      two functions with non-void return type have no return
      statement in omap-iommu.h for CONFIG_OMAP_IOMMU=n.
      
      Fix this by adding return statements to these functions.
      
      Fixes: d9c4d8a6 ('iommu/omap: introduce new API for runtime suspend/resume control')
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      73499ad2
    • Tero Kristo's avatar
      iommu/omap: remove pm_runtime_irq_safe flag for OMAP IOMMUs · 1432ebbd
      Tero Kristo authored
      This is not needed for anything, and prevents proper PM transitions for
      parent devices which is bad in case of ti-sysc; this effectively kills
      PM completely. Thus, remove the flag.
      Signed-off-by: default avatarTero Kristo <t-kristo@ti.com>
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      1432ebbd
    • Tero Kristo's avatar
      iommu/omap: add support for late attachment of iommu devices · 604629bc
      Tero Kristo authored
      Current implementation of OMAP IOMMU enforces strict ordering of device
      probe, initiated by iommu and followed by remoteproc later. This doesn't
      work too well with the new setup done with ti-sysc changes which may
      have the devices probed at pretty much any order. To overcome this limitation,
      if iommu has not been probed yet when a consumer tries to attach to it,
      add the device to orphan device list which will be parsed during iommu
      probe to see if any orphan devices should be attached.
      Signed-off-by: default avatarTero Kristo <t-kristo@ti.com>
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      604629bc
    • Suman Anna's avatar
      iommu/omap: introduce new API for runtime suspend/resume control · d9c4d8a6
      Suman Anna authored
      This patch adds the support for the OMAP IOMMUs to be suspended
      during the auto suspend/resume of the OMAP remoteproc devices. The
      remote processors are auto suspended after a certain time of idle
      or inactivity period. This is done by introducing two new API,
      omap_iommu_domain_deactivate() and omap_iommu_domain_activate()
      to allow the client users/master devices of the IOMMU devices to
      deactivate & activate the IOMMU devices from their runtime
      suspend/resume operations. There is no API exposed by the IOMMU
      layer at present, and so these new API are added directly in the
      OMAP IOMMU driver to minimize framework changes.
      
      The API simply decrements and increments the runtime usage count
      of the IOMMU devices and let the context be saved/restored using
      the existing runtime pm callbacks.
      Signed-off-by: default avatarSuman Anna <s-anna@ti.com>
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      d9c4d8a6
    • Suman Anna's avatar
      iommu/omap: Add system suspend/resume support · c4206c4e
      Suman Anna authored
      The MMU registers for the remote processors lose their context
      in Open Switch Retention (OSWR) or device OFF modes. Hence, the
      context of the IOMMU needs to be saved before it is put into any
      of these lower power state (OSWR/OFF) and restored before it is
      powered up to ON again. The IOMMUs need to be active as long as
      the client devices that are present behind the IOMMU are active.
      
      This patch adds the dev_pm_ops callbacks to provide the system
      suspend/resume functionality through the appropriate runtime
      PM callbacks. The PM runtime_resume and runtime_suspend callbacks
      are already used to enable, configure and disable the IOMMUs during
      the attaching and detaching of the client devices to the IOMMUs,
      and the new PM callbacks reuse the same code by invoking the
      pm_runtime_force_suspend() and pm_runtime_force_resume() API. The
      functionality in dev_pm_ops .prepare() checks if the IOMMU device
      was already runtime suspended, and skips invoking the suspend/resume
      PM callbacks. The suspend/resume PM callbacks are plugged in through
      the 'late' pm ops to ensure that the IOMMU devices will be suspended
      only after its master devices (remoteproc devices) are suspended and
      restored before them.
      
      NOTE:
      There are two other existing API, omap_iommu_save_ctx() and
      omap_iommu_restore_ctx(). These are left as is to support
      suspend/resume of devices on legacy OMAP3 SoC.
      Signed-off-by: default avatarSuman Anna <s-anna@ti.com>
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      c4206c4e
    • Suman Anna's avatar
      iommu/omap: add logic to save/restore locked TLBs · c3b44a06
      Suman Anna authored
      The MMUs provide a mechanism to lock TLB entries to avoid
      eviction and fetching of frequently used page table entries.
      These TLBs lose context when the MMUs are turned OFF. Add the
      logic to save and restore these locked TLBS during suspend
      and resume respectively. There are no locked TLBs during
      initial power ON, and they need not be saved during final
      shutdown.
      Signed-off-by: default avatarSuman Anna <s-anna@ti.com>
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      c3b44a06
    • Suman Anna's avatar
      iommu/omap: streamline enable/disable through runtime pm callbacks · db8918f6
      Suman Anna authored
      The OMAP IOMMU devices are typically present within the respective
      client processor subsystem and have their own dedicated hard-reset
      line. Enabling an IOMMU requires the reset line to be deasserted
      and the clocks to be enabled before programming the necessary IOMMU
      registers. The IOMMU disable sequence follow the reverse order of
      enabling. The OMAP IOMMU driver programs the reset lines through
      pdata ops to invoke the omap_device_assert/deassert_hardreset API.
      The clocks are managed through the pm_runtime framework, and the
      callbacks associated with the device's pm_domain, implemented in
      the omap_device layer.
      
      Streamline the enable and disable sequences in the OMAP IOMMU
      driver by implementing all the above operations within the
      runtime pm callbacks. All the OMAP devices have device pm_domain
      callbacks plugged in the omap_device layer for automatic runtime
      management of the clocks. Invoking the reset management functions
      within the runtime pm callbacks in OMAP IOMMU driver therefore
      requires that the default device's pm domain callbacks in the
      omap_device layer be reset, as the ordering sequence for managing
      the reset lines and clocks from the pm_domain callbacks don't gel
      well with the implementation in the IOMMU driver callbacks. The
      omap_device_enable/omap_device_idle functions are invoked through
      the newly added pdata ops.
      
      Consolidating all the device management sequences within the
      runtime pm callbacks allows the driver to easily support both
      system suspend/resume and runtime suspend/resume using common
      code.
      Signed-off-by: default avatarSuman Anna <s-anna@ti.com>
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      db8918f6
    • Suman Anna's avatar
      iommu/omap: add pdata ops for omap_device_enable/idle · 74c116df
      Suman Anna authored
      Add two new platform data ops to allow the OMAP iommu driver to
      be able to invoke the omap_device_enable and omap_device_idle
      from within the driver. These are being added to streamline the
      sequence between managing the hard reset lines and the clocks
      during the suspend path, as the default device pm_domain callback
      sequences in omap_device layer are not conducive for the OMAP
      IOMMU driver.
      
      This could have been done by expanding the existing pdata ops
      for reset management (like in the OMAP remoteproc driver), but
      this was chosen to avoid adding additional code in the separate
      file in the mach-omap2 layer.
      Signed-off-by: default avatarSuman Anna <s-anna@ti.com>
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      74c116df
    • Suman Anna's avatar
      iommu/omap: fix boot issue on remoteprocs with AMMU/Unicache · 3846a3b9
      Suman Anna authored
      Support has been added to the OMAP IOMMU driver to fix a boot hang
      issue on OMAP remoteprocs with AMMU/Unicache, caused by an improper
      AMMU/Unicache state upon initial deassertion of the processor reset.
      The issue is described in detail in the next three paragraphs.
      
      All the Cortex M3/M4 IPU processor subsystems in OMAP SoCs have a
      AMMU/Unicache IP that dictates the memory attributes for addresses
      seen by the processor cores. The AMMU/Unicache is configured/enabled
      by the SCACHE_CONFIG.BYPASS bit - a value of 1 enables the cache and
      mandates all addresses accessed by M3/M4 be defined in the AMMU. This
      bit is not programmable from the host processor. The M3/M4 boot
      sequence starts out with the AMMU/Unicache in disabled state, and
      SYS/BIOS programs the AMMU regions and enables the Unicache during
      one of its initial boot steps. This SCACHE_CONFIG.BYPASS bit is
      however enabled by default whenever a RET reset is applied to the IP,
      irrespective of whether it was previously enabled or not. The AMMU
      registers lose their context whenever this reset is applied. The reset
      is effective as long as the MMU portion of the subsystem is enabled
      and clocked. This behavior is common to all the IPU and DSP subsystems
      that have an AMMU/Unicache.
      
      The IPU boot sequence involves enabling and programming the MMU, and
      loading the processor and releasing the reset(s) for the processor.
      The PM setup code currently sets the target state for most of the
      power domains to RET. The L2 MMU can be enabled, programmed and
      accessed properly just fine with the domain in hardware supervised
      mode, while the power domain goes through a RET->ON->RET transition
      during the programming sequence. However, the ON->RET transition
      asserts a RET reset, and the SCACHE_CONFIG.BYPASS bit gets auto-set.
      An AMMU fault is thrown immediately when the M3/M4 core's reset is
      released since the first instruction address itself will not be
      defined in any valid AMMU regions. The ON->RET transition happens
      automatically on the power domain after enabling the iommu due to
      the hardware supervised mode.
      
      This patch adds and invokes the .set_pwrdm_constraint pdata ops, if
      present, during the OMAP IOMMU enable and disable functions to resolve
      the above boot hang issue. The ops will allow to invoke a mach-omap2
      layer API pwrdm_set_next_pwrst() in a multi-arch kernel environment.
      The ops also returns the current power domain state while enforcing
      the constraint so that the driver can store it and use it to set back
      the power domain state while releasing the constraint. The pdata ops
      implementation restricts the target power domain to ON during enable,
      and back to the original power domain state during disable, and thereby
      eliminating the conditions for the boot issue. The implementation is
      effective only when the original power domain state is either RET or
      OFF, and is a no-op when it is ON or INACTIVE.
      
      The .set_pwrdm_constraint ops need to be plugged in pdata-quirks
      for the affected remote processors to be able to boot properly.
      
      Note that the current issue is seen only on kernels with the affected
      power domains programmed to enter RET. For eg., IPU1 on DRA7xx is in a
      separate domain and is susceptible to this bug, while the IPU2 subsystem
      is within CORE power domain, and CORE RET is not supported on this SoC.
      IPUs on OMAP4 and OMAP5 are also susceptible since they are in CORE power
      domain, and CORE RET is a valid power target on these SoCs.
      Signed-off-by: default avatarSuman Anna <s-anna@ti.com>
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      3846a3b9
  3. 05 Aug, 2019 1 commit
  4. 04 Aug, 2019 10 commits
  5. 03 Aug, 2019 19 commits