Merge tag 'drm-next-2019-09-18' of git://anongit.freedesktop.org/drm/drm
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 19 Sep 2019 23:24:24 +0000 (16:24 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 19 Sep 2019 23:24:24 +0000 (16:24 -0700)
Pull drm updates from Dave Airlie:
 "This is the main pull request for 5.4-rc1 merge window. I don't think
  there is anything outstanding so next week should just be fixes, but
  we'll see if I missed anything. I landed some fixes earlier in the
  week but got delayed writing summary and sending it out, due to a mix
  of sick kid and jetlag!

  There are some fixes pending, but I'd rather get the main merge out of
  the way instead of delaying it longer.

  It's also pretty large in commit count and new amd header file size.
  The largest thing is four new amdgpu products (navi12/14, arcturus and
  renoir APU support).

  Otherwise it's pretty much lots of work across the board, i915 has
  started landing tigerlake support, lots of icelake fixes and lots of
  locking reworking for future gpu support, lots of header file rework
  (drmP.h is nearly gone), some old legacy hacks (DRM_WAIT_ON) have been
  put into the places they are needed.

  uapi:
   - content protection type property for HDCP

  core:
   - rework include dependencies
   - lots of drmP.h removals
   - link rate calculation robustness fix
   - make fb helper map only when required
   - add connector->DDC adapter link
   - DRM_WAIT_ON removed
   - drop DRM_AUTH usage from drivers

  dma-buf:
   - reservation object fence helper

  dma-fence:
   - shrink dma_fence struct
   - merge signal functions
   - store timestamps in dma_fence
   - selftests

  ttm:
   - embed drm_get_object struct into ttm_buffer_object
   - release_notify callback

  bridges:
   - sii902x - audio graph card support
   - tc358767 - aux data handling rework
   - ti-snd64dsi86 - debugfs support, DSI mode flags support

  panels:
   - Support for GiantPlus GPM940B0, Sharp LQ070Y3DG3B, Ortustech
     COM37H3M, Novatek NT39016, Sharp LS020B1DD01D, Raydium RM67191, Boe
     Himax8279d, Sharp LD-D5116Z01B
   - TI nspire, NEC NL8048HL11, LG Philips LB035Q02, Sharp LS037V7DW01,
     Sony ACX565AKM, Toppoly TD028TTEC1 Toppoly TD043MTEA1

  i915:
   - Initial tigerlake platform support
   - Locking simplification work, general all over refactoring.
   - Selftests
   - HDCP debug info improvements
   - DSI properties
   - Icelake display PLL fixes, colorspace fixes, bandwidth fixes, DSI
     suspend/resume
   - GuC fixes
   - Perf fixes
   - ElkhartLake enablement
   - DP MST fixes
   - GVT - command parser enhancements

  amdgpu:
   - add wipe memory on release flag for buffer creation
   - Navi12/14 support (may be marked experimental)
   - Arcturus support
   - Renoir APU support
   - mclk DPM for Navi
   - DC display fixes
   - Raven scatter/gather support
   - RAS support for GFX
   - Navi12 + Arcturus power features
   - GPU reset for Picasso
   - smu11 i2c controller support

  amdkfd:
   - navi12/14 support
   - Arcturus support

  radeon:
   - kexec fix

  nouveau:
   - improved display color management
   - detect lack of GPU power cables

  vmwgfx:
   - evicition priority support
   - remove unused security feature

  msm:
   - msm8998 display support
   - better async commit support for cursor updates

  etnaviv:
   - per-process address space support
   - performance counter fixes
   - softpin support

  mcde:
   - DCS transfers fix

  exynos:
   - drmP.h cleanup

  lima:
   - reduce logging

  kirin:
   - misc clenaups

  komeda:
   - dual-link support
   - DT memory regions

  hisilicon:
   - misc fixes

  imx:
   - IPUv3 image converter fixes
   - 32-bit RGB V4L2 pixel format support

  ingenic:
   - more support for panel related cases

  mgag200:
   - cursor support fix

  panfrost:
   - export GPU features register to userspace
   - gpu heap allocations
   - per-fd address space support

  pl111:
   - CLD pads wiring support removed from DT

  rockchip:
   - rework to use DRM PSR helpers
   - fix bug in VOP_WIN_GET macro
   - DSI DT binding rework

  sun4i:
   - improve support for color encoding and range
   - DDC enabled GPIO

  tinydrm:
   - rework SPI support
   - improve MIPI-DBI support
   - moved to drm/tiny

  vkms:
   - rework CRC tracking

  dw-hdmi:
   - get_eld and i2s improvements

  gm12u320:
   - misc fixes

  meson:
   - global code cleanup
   - vpu feature detect

  omap:
   - alpha/pixel blend mode properties

  rcar-du:
   - misc fixes"

* tag 'drm-next-2019-09-18' of git://anongit.freedesktop.org/drm/drm: (2112 commits)
  drm/nouveau/bar/gm20b: Avoid BAR1 teardown during init
  drm/nouveau: Fix ordering between TTM and GEM release
  drm/nouveau/prime: Extend DMA reservation object lock
  drm/nouveau: Fix fallout from reservation object rework
  drm/nouveau/kms/nv50-: Don't create MSTMs for eDP connectors
  drm/i915: Use NOEVICT for first pass on attemping to pin a GGTT mmap
  drm/i915: to make vgpu ppgtt notificaiton as atomic operation
  drm/i915: Flush the existing fence before GGTT read/write
  drm/i915: Hold irq-off for the entire fake lock period
  drm/i915/gvt: update RING_START reg of vGPU when the context is submitted to i915
  drm/i915/gvt: update vgpu workload head pointer correctly
  drm/mcde: Fix DSI transfers
  drm/msm: Use the correct dma_sync calls harder
  drm/msm: remove unlikely() from WARN_ON() conditions
  drm/msm/dsi: Fix return value check for clk_get_parent
  drm/msm: add atomic traces
  drm/msm/dpu: async commit support
  drm/msm: async commit support
  drm/msm: split power control from prepare/complete_commit
  drm/msm: add kms->flush_commit()
  ...

34 files changed:
1  2 
Documentation/devicetree/bindings/vendor-prefixes.yaml
Documentation/media/uapi/v4l/subdev-formats.rst
MAINTAINERS
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
drivers/gpu/drm/arm/display/komeda/komeda_dev.c
drivers/gpu/drm/arm/display/komeda/komeda_kms.c
drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h
drivers/gpu/drm/ast/ast_main.c
drivers/gpu/drm/ast/ast_mode.c
drivers/gpu/drm/ast/ast_post.c
drivers/gpu/drm/drm_modes.c
drivers/gpu/drm/exynos/exynos_drm_drv.c
drivers/gpu/drm/i915/display/intel_dp_mst.c
drivers/gpu/drm/i915/display/intel_vdsc.c
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
drivers/gpu/drm/i915/gem/i915_gem_userptr.c
drivers/gpu/drm/i915/gt/intel_workarounds.c
drivers/gpu/drm/i915/gvt/scheduler.c
drivers/gpu/drm/i915/i915_drv.c
drivers/gpu/drm/ingenic/ingenic-drm.c
drivers/gpu/drm/lima/lima_gem.c
drivers/gpu/drm/mcde/mcde_drv.c
drivers/gpu/drm/mediatek/mtk_drm_drv.c
drivers/gpu/drm/nouveau/dispnv50/disp.c
drivers/gpu/drm/omapdrm/omap_drv.c
drivers/gpu/drm/panfrost/panfrost_mmu.c
drivers/gpu/drm/qxl/qxl_drv.c
drivers/gpu/drm/rcar-du/rcar_lvds.c
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
drivers/gpu/drm/rockchip/rockchip_drm_drv.c
drivers/gpu/drm/sun4i/sun4i_tcon.c
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
drivers/gpu/drm/vc4/vc4_drv.c
drivers/gpu/drm/vmwgfx/vmwgfx_msg.c

diff --cc MAINTAINERS
Simple merge
index a78b2e295895070a8d12940f3e8847ba61fd76e0,320ac20146fd177cb5a307e26f190c7f5e04a2ea..6109815a0401a7c8835e961a0e43f7335d1d490c
@@@ -907,6 -746,10 +746,8 @@@ struct smu_func
        ((smu)->funcs->register_irq_handler ? (smu)->funcs->register_irq_handler(smu) : 0)
  #define smu_set_azalia_d3_pme(smu) \
        ((smu)->funcs->set_azalia_d3_pme ? (smu)->funcs->set_azalia_d3_pme((smu)) : 0)
 -#define smu_get_uclk_dpm_states(smu, clocks_in_khz, num_states) \
 -      ((smu)->ppt_funcs->get_uclk_dpm_states ? (smu)->ppt_funcs->get_uclk_dpm_states((smu), (clocks_in_khz), (num_states)) : 0)
+ #define smu_get_dpm_ultimate_freq(smu, param, min, max) \
+               ((smu)->funcs->get_dpm_ultimate_freq ? (smu)->funcs->get_dpm_ultimate_freq((smu), (param), (min), (max)) : 0)
  #define smu_get_max_sustainable_clocks_by_dc(smu, max_clocks) \
        ((smu)->funcs->get_max_sustainable_clocks_by_dc ? (smu)->funcs->get_max_sustainable_clocks_by_dc((smu), (max_clocks)) : 0)
  #define smu_get_uclk_dpm_states(smu, clocks_in_khz, num_states) \
index 9d4d5075cc647ef6686afba1cac57539bd64e7a6,0142ee99195779d5a5f7710d1b21f9232dd23d79..ca64a129c594ecc31f951cbc6ce5b903290501e0
@@@ -127,7 -129,8 +129,8 @@@ static int komeda_parse_pipe_dt(struct 
        pipe->of_output_port =
                of_graph_get_port_by_id(np, KOMEDA_OF_PORT_OUTPUT);
  
 -      pipe->of_node = np;
+       pipe->dual_link = pipe->of_output_links[0] && pipe->of_output_links[1];
 +      pipe->of_node = of_node_get(np);
  
        return 0;
  }
Simple merge
Simple merge
Simple merge
Simple merge
index 528b6167833456d9fc6c5a0f8a53197c980a80d1,74da35611d7c010cfc9d1269b4b132f8994f1c3d..11b231c187c500f104e85bc736a0a1f4b36f2f4a
@@@ -662,9 -662,25 +662,17 @@@ i915_gem_userptr_put_pages(struct drm_i
        __i915_gem_object_release_shmem(obj, pages, true);
        i915_gem_gtt_finish_pages(obj, pages);
  
+       /*
+        * We always mark objects as dirty when they are used by the GPU,
+        * just in case. However, if we set the vma as being read-only we know
+        * that the object will never have been written to.
+        */
+       if (i915_gem_object_is_readonly(obj))
+               obj->mm.dirty = false;
        for_each_sgt_page(page, sgt_iter, pages) {
                if (obj->mm.dirty)
 -                      /*
 -                       * As this may not be anonymous memory (e.g. shmem)
 -                       * but exist on a real mapping, we have to lock
 -                       * the page in order to dirty it -- holding
 -                       * the page reference is not sufficient to
 -                       * prevent the inode from being truncated.
 -                       * Play safe and take the lock.
 -                       */
 -                      set_page_dirty_lock(page);
 +                      set_page_dirty(page);
  
                mark_page_accessed(page);
                put_page(page);
Simple merge
Simple merge
Simple merge
index b609dc030d6ca906f61ffd8bba47dce8bf1e644d,ff3d9acc24fcf145d35621e620afefda9a30f98b..4da21353c3a20b5379a6e4ef74915538b5f351fe
@@@ -341,8 -341,8 +341,8 @@@ int lima_gem_wait(struct drm_file *file
  
        timeout = drm_timeout_abs_to_jiffies(timeout_ns);
  
-       ret = drm_gem_reservation_object_wait(file, handle, write, timeout);
+       ret = drm_gem_dma_resv_wait(file, handle, write, timeout);
 -      if (ret == 0)
 +      if (ret == -ETIME)
                ret = timeout ? -ETIMEDOUT : -EBUSY;
  
        return ret;
Simple merge
index 945bc20f1d33f0d5aada0a7d9d7c0e52fb15c28a,2ee809a6f3dc12f0fa984b2e4030e59b87fefaaa..352b81a7a67020b87465d47ddbe516df04fb91d0
@@@ -4,9 -4,16 +4,17 @@@
   * Author: YT SHEN <yt.shen@mediatek.com>
   */
  
- #include <drm/drmP.h>
+ #include <linux/component.h>
+ #include <linux/iommu.h>
+ #include <linux/module.h>
+ #include <linux/of_address.h>
+ #include <linux/of_platform.h>
+ #include <linux/pm_runtime.h>
++#include <linux/dma-mapping.h>
  #include <drm/drm_atomic.h>
  #include <drm/drm_atomic_helper.h>
+ #include <drm/drm_drv.h>
  #include <drm/drm_fb_helper.h>
  #include <drm/drm_gem.h>
  #include <drm/drm_gem_cma_helper.h>
@@@ -352,21 -314,8 +346,20 @@@ static const struct file_operations mtk
        .compat_ioctl = drm_compat_ioctl,
  };
  
 +/*
 + * We need to override this because the device used to import the memory is
 + * not dev->dev, as drm_gem_prime_import() expects.
 + */
 +struct drm_gem_object *mtk_drm_gem_prime_import(struct drm_device *dev,
 +                                              struct dma_buf *dma_buf)
 +{
 +      struct mtk_drm_private *private = dev->dev_private;
 +
 +      return drm_gem_prime_import_dev(dev, dma_buf, private->dma_dev);
 +}
 +
  static struct drm_driver mtk_drm_driver = {
-       .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME |
-                          DRIVER_ATOMIC,
+       .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
  
        .gem_free_object_unlocked = mtk_drm_gem_free_object,
        .gem_vm_ops = &drm_gem_cma_vm_ops,
  
        .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
        .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
-       .gem_prime_export = drm_gem_prime_export,
 +      .gem_prime_import = mtk_drm_gem_prime_import,
        .gem_prime_get_sg_table = mtk_gem_prime_get_sg_table,
        .gem_prime_import_sg_table = mtk_gem_prime_import_sg_table,
        .gem_prime_mmap = mtk_drm_gem_mmap_buf,
Simple merge
index 6e8145c36e933fc97dbf01214c8c93d9a4f10576,387d830cb7cf83b1d5c047dea1b62183b955bef9..6010f9ee7c1fd95487c74561d2d52501bae9c8ae
@@@ -222,55 -310,198 +310,206 @@@ void panfrost_mmu_unmap(struct panfrost
                size_t unmapped_page;
                size_t pgsize = get_pgsize(iova, len - unmapped_len);
  
-               unmapped_page = ops->unmap(ops, iova, pgsize, NULL);
-               if (!unmapped_page)
-                       break;
-               iova += unmapped_page;
-               unmapped_len += unmapped_page;
+               if (ops->iova_to_phys(ops, iova)) {
 -                      unmapped_page = ops->unmap(ops, iova, pgsize);
++                      unmapped_page = ops->unmap(ops, iova, pgsize, NULL);
+                       WARN_ON(unmapped_page != pgsize);
+               }
+               iova += pgsize;
+               unmapped_len += pgsize;
        }
  
-       mmu_hw_do_operation(pfdev, 0, bo->node.start << PAGE_SHIFT,
-                           bo->node.size << PAGE_SHIFT, AS_COMMAND_FLUSH_PT);
-       mutex_unlock(&pfdev->mmu->lock);
-       pm_runtime_mark_last_busy(pfdev->dev);
-       pm_runtime_put_autosuspend(pfdev->dev);
+       panfrost_mmu_flush_range(pfdev, bo->mmu, bo->node.start << PAGE_SHIFT, len);
        bo->is_mapped = false;
  }
  
  static void mmu_tlb_inv_context_s1(void *cookie)
- {
-       struct panfrost_device *pfdev = cookie;
-       mmu_hw_do_operation(pfdev, 0, 0, ~0UL, AS_COMMAND_FLUSH_MEM);
- }
+ {}
  
 -static void mmu_tlb_inv_range_nosync(unsigned long iova, size_t size,
 -                                   size_t granule, bool leaf, void *cookie)
 -{}
 -
  static void mmu_tlb_sync_context(void *cookie)
  {
        //struct panfrost_device *pfdev = cookie;
        // TODO: Wait 1000 GPU cycles for HW_ISSUE_6367/T60X
  }
  
 -static const struct iommu_gather_ops mmu_tlb_ops = {
 +static void mmu_tlb_flush_walk(unsigned long iova, size_t size, size_t granule,
 +                             void *cookie)
 +{
 +      mmu_tlb_sync_context(cookie);
 +}
 +
 +static void mmu_tlb_flush_leaf(unsigned long iova, size_t size, size_t granule,
 +                             void *cookie)
 +{
 +      mmu_tlb_sync_context(cookie);
 +}
 +
 +static const struct iommu_flush_ops mmu_tlb_ops = {
        .tlb_flush_all  = mmu_tlb_inv_context_s1,
 -      .tlb_add_flush  = mmu_tlb_inv_range_nosync,
 -      .tlb_sync       = mmu_tlb_sync_context,
 +      .tlb_flush_walk = mmu_tlb_flush_walk,
 +      .tlb_flush_leaf = mmu_tlb_flush_leaf,
  };
  
+ int panfrost_mmu_pgtable_alloc(struct panfrost_file_priv *priv)
+ {
+       struct panfrost_mmu *mmu = &priv->mmu;
+       struct panfrost_device *pfdev = priv->pfdev;
+       INIT_LIST_HEAD(&mmu->list);
+       mmu->as = -1;
+       mmu->pgtbl_cfg = (struct io_pgtable_cfg) {
+               .pgsize_bitmap  = SZ_4K | SZ_2M,
+               .ias            = FIELD_GET(0xff, pfdev->features.mmu_features),
+               .oas            = FIELD_GET(0xff00, pfdev->features.mmu_features),
+               .tlb            = &mmu_tlb_ops,
+               .iommu_dev      = pfdev->dev,
+       };
+       mmu->pgtbl_ops = alloc_io_pgtable_ops(ARM_MALI_LPAE, &mmu->pgtbl_cfg,
+                                             priv);
+       if (!mmu->pgtbl_ops)
+               return -EINVAL;
+       return 0;
+ }
+ void panfrost_mmu_pgtable_free(struct panfrost_file_priv *priv)
+ {
+       struct panfrost_device *pfdev = priv->pfdev;
+       struct panfrost_mmu *mmu = &priv->mmu;
+       spin_lock(&pfdev->as_lock);
+       if (mmu->as >= 0) {
+               pm_runtime_get_noresume(pfdev->dev);
+               if (pm_runtime_active(pfdev->dev))
+                       panfrost_mmu_disable(pfdev, mmu->as);
+               pm_runtime_put_autosuspend(pfdev->dev);
+               clear_bit(mmu->as, &pfdev->as_alloc_mask);
+               clear_bit(mmu->as, &pfdev->as_in_use_mask);
+               list_del(&mmu->list);
+       }
+       spin_unlock(&pfdev->as_lock);
+       free_io_pgtable_ops(mmu->pgtbl_ops);
+ }
+ static struct drm_mm_node *addr_to_drm_mm_node(struct panfrost_device *pfdev, int as, u64 addr)
+ {
+       struct drm_mm_node *node = NULL;
+       u64 offset = addr >> PAGE_SHIFT;
+       struct panfrost_mmu *mmu;
+       spin_lock(&pfdev->as_lock);
+       list_for_each_entry(mmu, &pfdev->as_lru_list, list) {
+               struct panfrost_file_priv *priv;
+               if (as != mmu->as)
+                       continue;
+               priv = container_of(mmu, struct panfrost_file_priv, mmu);
+               drm_mm_for_each_node(node, &priv->mm) {
+                       if (offset >= node->start && offset < (node->start + node->size))
+                               goto out;
+               }
+       }
+ out:
+       spin_unlock(&pfdev->as_lock);
+       return node;
+ }
+ #define NUM_FAULT_PAGES (SZ_2M / PAGE_SIZE)
+ int panfrost_mmu_map_fault_addr(struct panfrost_device *pfdev, int as, u64 addr)
+ {
+       int ret, i;
+       struct drm_mm_node *node;
+       struct panfrost_gem_object *bo;
+       struct address_space *mapping;
+       pgoff_t page_offset;
+       struct sg_table *sgt;
+       struct page **pages;
+       node = addr_to_drm_mm_node(pfdev, as, addr);
+       if (!node)
+               return -ENOENT;
+       bo = drm_mm_node_to_panfrost_bo(node);
+       if (!bo->is_heap) {
+               dev_WARN(pfdev->dev, "matching BO is not heap type (GPU VA = %llx)",
+                        node->start << PAGE_SHIFT);
+               return -EINVAL;
+       }
+       WARN_ON(bo->mmu->as != as);
+       /* Assume 2MB alignment and size multiple */
+       addr &= ~((u64)SZ_2M - 1);
+       page_offset = addr >> PAGE_SHIFT;
+       page_offset -= node->start;
+       mutex_lock(&bo->base.pages_lock);
+       if (!bo->base.pages) {
+               bo->sgts = kvmalloc_array(bo->base.base.size / SZ_2M,
+                                    sizeof(struct sg_table), GFP_KERNEL | __GFP_ZERO);
+               if (!bo->sgts) {
+                       mutex_unlock(&bo->base.pages_lock);
+                       return -ENOMEM;
+               }
+               pages = kvmalloc_array(bo->base.base.size >> PAGE_SHIFT,
+                                      sizeof(struct page *), GFP_KERNEL | __GFP_ZERO);
+               if (!pages) {
+                       kfree(bo->sgts);
+                       bo->sgts = NULL;
+                       mutex_unlock(&bo->base.pages_lock);
+                       return -ENOMEM;
+               }
+               bo->base.pages = pages;
+               bo->base.pages_use_count = 1;
+       } else
+               pages = bo->base.pages;
+       mapping = bo->base.base.filp->f_mapping;
+       mapping_set_unevictable(mapping);
+       for (i = page_offset; i < page_offset + NUM_FAULT_PAGES; i++) {
+               pages[i] = shmem_read_mapping_page(mapping, i);
+               if (IS_ERR(pages[i])) {
+                       mutex_unlock(&bo->base.pages_lock);
+                       ret = PTR_ERR(pages[i]);
+                       goto err_pages;
+               }
+       }
+       mutex_unlock(&bo->base.pages_lock);
+       sgt = &bo->sgts[page_offset / (SZ_2M / PAGE_SIZE)];
+       ret = sg_alloc_table_from_pages(sgt, pages + page_offset,
+                                       NUM_FAULT_PAGES, 0, SZ_2M, GFP_KERNEL);
+       if (ret)
+               goto err_pages;
+       if (!dma_map_sg(pfdev->dev, sgt->sgl, sgt->nents, DMA_BIDIRECTIONAL)) {
+               ret = -EINVAL;
+               goto err_map;
+       }
+       mmu_map_sg(pfdev, bo->mmu, addr, IOMMU_WRITE | IOMMU_READ | IOMMU_NOEXEC, sgt);
+       bo->is_mapped = true;
+       dev_dbg(pfdev->dev, "mapped page fault @ AS%d %llx", as, addr);
+       return 0;
+ err_map:
+       sg_free_table(sgt);
+ err_pages:
+       drm_gem_shmem_put_pages(&bo->base);
+       return ret;
+ }
  static const char *access_type_name(struct panfrost_device *pfdev,
                u32 fault_status)
  {
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge