1. 29 Oct, 2019 3 commits
    • Thierry Reding's avatar
      gpu: host1x: Overhaul host1x_bo_{pin,unpin}() API · 80327ce3
      Thierry Reding authored
      The host1x_bo_pin() and host1x_bo_unpin() APIs are used to pin and unpin
      buffers during host1x job submission. Pinning currently returns the SG
      table and the DMA address (an IOVA if an IOMMU is used or a physical
      address if no IOMMU is used) of the buffer. The DMA address is only used
      for buffers that are relocated, whereas the host1x driver will map
      gather buffers into its own IOVA space so that they can be processed by
      the CDMA engine.
      
      This approach has a couple of issues. On one hand it's not very useful
      to return a DMA address for the buffer if host1x doesn't need it. On the
      other hand, returning the SG table of the buffer is suboptimal because a
      single SG table cannot be shared for multiple mappings, because the DMA
      address is stored within the SG table, and the DMA address may be
      different for different devices.
      
      Subsequent patches will move the host1x driver over to the DMA API which
      doesn't work with a single shared SG table. Fix this by returning a new
      SG table each time a buffer is pinned. This allows the buffer to be
      referenced by multiple jobs for different engines.
      
      Change the prototypes of host1x_bo_pin() and host1x_bo_unpin() to take a
      struct device *, specifying the device for which the buffer should be
      pinned. This is required in order to be able to properly construct the
      SG table. While at it, make host1x_bo_pin() return the SG table because
      that allows us to return an ERR_PTR()-encoded error code if we need to,
      or return NULL to signal that we don't need the SG table to be remapped
      and can simply use the DMA address as-is. At the same time, returning
      the DMA address is made optional because in the example of command
      buffers, host1x doesn't need to know the DMA address since it will have
      to create its own mapping anyway.
      Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
      80327ce3
    • Thierry Reding's avatar
      drm/tegra: Simplify IOMMU group selection · 7edd7961
      Thierry Reding authored
      All the devices that make up the DRM device are now part of the same
      IOMMU group. This simplifies the handling of the IOMMU attachment and
      also avoids exhausting the number of IOMMUs available on early Tegra
      SoC generations.
      Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
      7edd7961
    • Thierry Reding's avatar
      drm/tegra: Do not use ->load() and ->unload() callbacks · a7303f77
      Thierry Reding authored
      The ->load() and ->unload() drivers are midlayers and should be avoided
      in modern drivers. Fix this by moving the code into the driver ->probe()
      and ->remove() implementations, respectively.
      
      v2: kick out conflicting framebuffers before initializing fbdev
      v3: rebase onto drm/tegra/for-next
      Tested-by: default avatarDmitry Osipenko <digetx@gmail.com>
      Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
      a7303f77
  2. 28 Oct, 2019 37 commits