1. 10 9月, 2020 1 次提交
    • M
      drm: msm: fix common struct sg_table related issues · 7690a33f
      Marek Szyprowski 提交于
      The Documentation/DMA-API-HOWTO.txt states that the dma_map_sg() function
      returns the number of the created entries in the DMA address space.
      However the subsequent calls to the dma_sync_sg_for_{device,cpu}() and
      dma_unmap_sg must be called with the original number of the entries
      passed to the dma_map_sg().
      
      struct sg_table is a common structure used for describing a non-contiguous
      memory buffer, used commonly in the DRM and graphics subsystems. It
      consists of a scatterlist with memory pages and DMA addresses (sgl entry),
      as well as the number of scatterlist entries: CPU pages (orig_nents entry)
      and DMA mapped pages (nents entry).
      
      It turned out that it was a common mistake to misuse nents and orig_nents
      entries, calling DMA-mapping functions with a wrong number of entries or
      ignoring the number of mapped entries returned by the dma_map_sg()
      function.
      
      To avoid such issues, lets use a common dma-mapping wrappers operating
      directly on the struct sg_table objects and use scatterlist page
      iterators where possible. This, almost always, hides references to the
      nents and orig_nents entries, making the code robust, easier to follow
      and copy/paste safe.
      Signed-off-by: NMarek Szyprowski <m.szyprowski@samsung.com>
      Acked-by: NRob Clark <robdclark@gmail.com>
      7690a33f
  2. 09 9月, 2020 1 次提交
  3. 31 7月, 2020 1 次提交
    • A
      drm/msm: Fix a null pointer access in msm_gem_shrinker_count() · 3cbdc8d8
      Akhil P Oommen 提交于
      Adding an msm_gem_object object to the inactive_list before completing
      its initialization is a bad idea because shrinker may pick it up from the
      inactive_list. Fix this by making sure that the initialization is complete
      before moving the msm_obj object to the inactive list.
      
      This patch fixes the below error:
      [10027.553044] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000068
      [10027.573305] Mem abort info:
      [10027.590160]   ESR = 0x96000006
      [10027.597905]   EC = 0x25: DABT (current EL), IL = 32 bits
      [10027.614430]   SET = 0, FnV = 0
      [10027.624427]   EA = 0, S1PTW = 0
      [10027.632722] Data abort info:
      [10027.638039]   ISV = 0, ISS = 0x00000006
      [10027.647459]   CM = 0, WnR = 0
      [10027.654345] user pgtable: 4k pages, 39-bit VAs, pgdp=00000001e3a6a000
      [10027.672681] [0000000000000068] pgd=0000000198c31003, pud=0000000198c31003, pmd=0000000000000000
      [10027.693900] Internal error: Oops: 96000006 [#1] PREEMPT SMP
      [10027.738261] CPU: 3 PID: 214 Comm: kswapd0 Tainted: G S                5.4.40 #1
      [10027.745766] Hardware name: Qualcomm Technologies, Inc. SC7180 IDP (DT)
      [10027.752472] pstate: 80c00009 (Nzcv daif +PAN +UAO)
      [10027.757409] pc : mutex_is_locked+0x14/0x2c
      [10027.761626] lr : msm_gem_shrinker_count+0x70/0xec
      [10027.766454] sp : ffffffc011323ad0
      [10027.769867] x29: ffffffc011323ad0 x28: ffffffe677e4b878
      [10027.775324] x27: 0000000000000cc0 x26: 0000000000000000
      [10027.780783] x25: ffffff817114a708 x24: 0000000000000008
      [10027.786242] x23: ffffff8023ab7170 x22: 0000000000000001
      [10027.791701] x21: ffffff817114a080 x20: 0000000000000119
      [10027.797160] x19: 0000000000000068 x18: 00000000000003bc
      [10027.802621] x17: 0000000004a34210 x16: 00000000000000c0
      [10027.808083] x15: 0000000000000000 x14: 0000000000000000
      [10027.813542] x13: ffffffe677e0a3c0 x12: 0000000000000000
      [10027.819000] x11: 0000000000000000 x10: ffffff8174b94340
      [10027.824461] x9 : 0000000000000000 x8 : 0000000000000000
      [10027.829919] x7 : 00000000000001fc x6 : ffffffc011323c88
      [10027.835373] x5 : 0000000000000001 x4 : ffffffc011323d80
      [10027.840832] x3 : ffffffff0477b348 x2 : 0000000000000000
      [10027.846290] x1 : ffffffc011323b68 x0 : 0000000000000068
      [10027.851748] Call trace:
      [10027.854264]  mutex_is_locked+0x14/0x2c
      [10027.858121]  msm_gem_shrinker_count+0x70/0xec
      [10027.862603]  shrink_slab+0xc0/0x4b4
      [10027.866187]  shrink_node+0x4a8/0x818
      [10027.869860]  kswapd+0x624/0x890
      [10027.873097]  kthread+0x11c/0x12c
      [10027.876424]  ret_from_fork+0x10/0x18
      [10027.880102] Code: f9000bf3 910003fd aa0003f3 d503201f (f9400268)
      [10027.886362] ---[ end trace df5849a1a3543251 ]---
      [10027.891518] Kernel panic - not syncing: Fatal exception
      Signed-off-by: NAkhil P Oommen <akhilpo@codeaurora.org>
      Signed-off-by: NRob Clark <robdclark@chromium.org>
      3cbdc8d8
  4. 03 6月, 2020 1 次提交
    • D
      drm/msm: Don't call dma_buf_vunmap without _vmap · 8b6b7d84
      Daniel Vetter 提交于
      I honestly don't exactly understand what's going on here, but the
      current code is wrong for sure: It calls dma_buf_vunmap without ever
      calling dma_buf_vmap.
      
      What I'm not sure about is whether the WARN_ON is correct:
      - msm imports dma-buf using drm_prime_sg_to_page_addr_arrays. Which is
        a pretty neat layering violation of how you shouldn't peek behind
        the curtain of the dma-buf exporter, but par for course. Note that
        all the nice new helpers don't (and we should probably have a bit a
        warning about this in the kerneldoc).
      
      - but then in the get_vaddr() in msm_gem.c, we seems to happily wrap a
        vmap() around any object with ->pages set (so including imported
        dma-buf).
      
      - I'm not seeing any guarantees that userspace can't use an imported
        dma-buf for e.g. MSM_SUBMIT_CMD_BUF in a5xx_submit_in_rb, so no
        guarantees that an imported dma-buf won't end up with a ->vaddr set.
      
      But even if that WARN_ON is wrong, cleaning up a vmap() done by msm by
      calling dma_buf_vunmap is the wrong thing to do.
      
      v2: Rob said in review that we do indeed have a gap in get_vaddr() that
      needs to be plugged. But the users I've found aren't legit users on
      imported dma-buf, so we can just reject that.
      Reviewed-by: NRob Clark <robdclark@gmail.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      Cc: Rob Clark <robdclark@gmail.com>
      Cc: Sean Paul <sean@poorly.run>
      Cc: linux-arm-msm@vger.kernel.org
      Cc: freedreno@lists.freedesktop.org
      Link: https://patchwork.freedesktop.org/patch/msgid/20200514201117.465146-1-daniel.vetter@ffwll.ch
      8b6b7d84
  5. 20 5月, 2020 2 次提交
  6. 19 5月, 2020 2 次提交
  7. 05 9月, 2019 1 次提交
    • R
      drm/msm: Use the correct dma_sync calls harder · 9f614197
      Rob Clark 提交于
      Looks like the dma_sync calls don't do what we want on armv7 either.
      Fixes:
      
        Unable to handle kernel paging request at virtual address 50001000
        pgd = (ptrval)
        [50001000] *pgd=00000000
        Internal error: Oops: 805 [#1] SMP ARM
        Modules linked in:
        CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.3.0-rc6-00271-g9f159ae0 #4
        Hardware name: Freescale i.MX53 (Device Tree Support)
        PC is at v7_dma_clean_range+0x20/0x38
        LR is at __dma_page_cpu_to_dev+0x28/0x90
        pc : [<c011c76c>]    lr : [<c01181c4>]    psr: 20000013
        sp : d80b5a88  ip : de96c000  fp : d840ce6c
        r10: 00000000  r9 : 00000001  r8 : d843e010
        r7 : 00000000  r6 : 00008000  r5 : ddb6c000  r4 : 00000000
        r3 : 0000003f  r2 : 00000040  r1 : 50008000  r0 : 50001000
        Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
        Control: 10c5387d  Table: 70004019  DAC: 00000051
        Process swapper/0 (pid: 1, stack limit = 0x(ptrval))
      Signed-off-by: NRob Clark <robdclark@chromium.org>
      Fixes: 3de433c5 ("drm/msm: Use the correct dma_sync calls in msm_gem")
      Tested-by: NFabio Estevam <festevam@gmail.com>
      9f614197
  8. 04 9月, 2019 1 次提交
    • S
      drm/msm: drop use of drmP.h · feea39a8
      Sam Ravnborg 提交于
      Drop the deprecated drmP.h header file, and trim msm_drv.h
      to the relevant include files.
      
      This resulted in a suprisingly many edits as many files relied
      on headers included via msm_drv.h.
      But msm_drv.h is not supposed to carry include files it do not need, so
      the individual files have to include what extra they needs.
      
      v2:
      - Rebased on top of https://gitlab.freedesktop.org/drm/msm.git msm-next
      Signed-off-by: NSam Ravnborg <sam@ravnborg.org>
      Cc: Rob Clark <robdclark@gmail.com>
      Cc: Sean Paul <sean@poorly.run>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Daniel Vetter <daniel@ffwll.ch>
      Cc: Jordan Crouse <jcrouse@codeaurora.org>
      Cc: Jeykumar Sankaran <jsanka@codeaurora.org>
      Cc: Bruce Wang <bzwang@chromium.org>
      Cc: Shayenne Moura <shayenneluzmoura@gmail.com>
      Cc: Mamta Shukla <mamtashukla555@gmail.com>
      Cc: Jonathan Marek <jonathan@marek.ca>
      Cc: Carsten Behling <carsten.behling@googlemail.com>
      Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Cc: Maxime Ripard <maxime.ripard@bootlin.com>
      Cc: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
      Cc: Sibi Sankar <sibis@codeaurora.org>
      Cc: Todor Tomov <todor.tomov@linaro.org>
      Cc: linux-arm-msm@vger.kernel.org
      Cc: freedreno@lists.freedesktop.org
      Signed-off-by: NSean Paul <seanpaul@chromium.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190804065551.GA5211@ravnborg.org
      feea39a8
  9. 13 8月, 2019 1 次提交
  10. 01 8月, 2019 1 次提交
    • R
      drm/msm: Use the correct dma_sync calls in msm_gem · 3de433c5
      Rob Clark 提交于
      [subject was: drm/msm: shake fist angrily at dma-mapping]
      
      So, using dma_sync_* for our cache needs works out w/ dma iommu ops, but
      it falls appart with dma direct ops.  The problem is that, depending on
      display generation, we can have either set of dma ops (mdp4 and dpu have
      iommu wired to mdss node, which maps to toplevel drm device, but mdp5
      has iommu wired up to the mdp sub-node within mdss).
      
      Fixes this splat on mdp5 devices:
      
         Unable to handle kernel paging request at virtual address ffffffff80000000
         Mem abort info:
           ESR = 0x96000144
           Exception class = DABT (current EL), IL = 32 bits
           SET = 0, FnV = 0
           EA = 0, S1PTW = 0
         Data abort info:
           ISV = 0, ISS = 0x00000144
           CM = 1, WnR = 1
         swapper pgtable: 4k pages, 48-bit VAs, pgdp=00000000810e4000
         [ffffffff80000000] pgd=0000000000000000
         Internal error: Oops: 96000144 [#1] SMP
         Modules linked in: btqcomsmd btqca bluetooth cfg80211 ecdh_generic ecc rfkill libarc4 panel_simple msm wcnss_ctrl qrtr_smd drm_kms_helper venus_enc venus_dec videobuf2_dma_sg videobuf2_memops drm venus_core ipv6 qrtr qcom_wcnss_pil v4l2_mem2mem qcom_sysmon videobuf2_v4l2 qmi_helpers videobuf2_common crct10dif_ce mdt_loader qcom_common videodev qcom_glink_smem remoteproc bmc150_accel_i2c bmc150_magn_i2c bmc150_accel_core bmc150_magn snd_soc_lpass_apq8016 snd_soc_msm8916_analog mms114 mc nf_defrag_ipv6 snd_soc_lpass_cpu snd_soc_apq8016_sbc industrialio_triggered_buffer kfifo_buf snd_soc_lpass_platform snd_soc_msm8916_digital drm_panel_orientation_quirks
         CPU: 2 PID: 33 Comm: kworker/2:1 Not tainted 5.3.0-rc2 #1
         Hardware name: Samsung Galaxy A5U (EUR) (DT)
         Workqueue: events deferred_probe_work_func
         pstate: 80000005 (Nzcv daif -PAN -UAO)
         pc : __clean_dcache_area_poc+0x20/0x38
         lr : arch_sync_dma_for_device+0x28/0x30
         sp : ffff0000115736a0
         x29: ffff0000115736a0 x28: 0000000000000001
         x27: ffff800074830800 x26: ffff000011478000
         x25: 0000000000000000 x24: 0000000000000001
         x23: ffff000011478a98 x22: ffff800009fd1c10
         x21: 0000000000000001 x20: ffff800075ad0a00
         x19: 0000000000000000 x18: ffff0000112b2000
         x17: 0000000000000000 x16: 0000000000000000
         x15: 00000000fffffff0 x14: ffff000011455d70
         x13: 0000000000000000 x12: 0000000000000028
         x11: 0000000000000001 x10: ffff00001106c000
         x9 : ffff7e0001d6b380 x8 : 0000000000001000
         x7 : ffff7e0001d6b380 x6 : ffff7e0001d6b382
         x5 : 0000000000000000 x4 : 0000000000001000
         x3 : 000000000000003f x2 : 0000000000000040
         x1 : ffffffff80001000 x0 : ffffffff80000000
         Call trace:
          __clean_dcache_area_poc+0x20/0x38
          dma_direct_sync_sg_for_device+0xb8/0xe8
          get_pages+0x22c/0x250 [msm]
          msm_gem_get_and_pin_iova+0xdc/0x168 [msm]
          ...
      
      Fixes the combination of two patches:
      
      Fixes: 0036bc73 (drm/msm: stop abusing dma_map/unmap for cache)
      Fixes: 449fa54d (dma-direct: correct the physical addr in dma_direct_sync_sg_for_cpu/device)
      Tested-by: NStephan Gerhold <stephan@gerhold.net>
      Signed-off-by: NRob Clark <robdclark@chromium.org>
      [seanpaul changed subject to something more desriptive]
      Signed-off-by: NSean Paul <seanpaul@chromium.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190730214633.17820-1-robdclark@gmail.com
      3de433c5
  11. 23 7月, 2019 1 次提交
    • R
      drm/msm: stop abusing dma_map/unmap for cache · 0036bc73
      Rob Clark 提交于
      Recently splats like this started showing up:
      
         WARNING: CPU: 4 PID: 251 at drivers/iommu/dma-iommu.c:451 __iommu_dma_unmap+0xb8/0xc0
         Modules linked in: ath10k_snoc ath10k_core fuse msm ath mac80211 uvcvideo cfg80211 videobuf2_vmalloc videobuf2_memops vide
         CPU: 4 PID: 251 Comm: kworker/u16:4 Tainted: G        W         5.2.0-rc5-next-20190619+ #2317
         Hardware name: LENOVO 81JL/LNVNB161216, BIOS 9UCN23WW(V1.06) 10/25/2018
         Workqueue: msm msm_gem_free_work [msm]
         pstate: 80c00005 (Nzcv daif +PAN +UAO)
         pc : __iommu_dma_unmap+0xb8/0xc0
         lr : __iommu_dma_unmap+0x54/0xc0
         sp : ffff0000119abce0
         x29: ffff0000119abce0 x28: 0000000000000000
         x27: ffff8001f9946648 x26: ffff8001ec271068
         x25: 0000000000000000 x24: ffff8001ea3580a8
         x23: ffff8001f95ba010 x22: ffff80018e83ba88
         x21: ffff8001e548f000 x20: fffffffffffff000
         x19: 0000000000001000 x18: 00000000c00001fe
         x17: 0000000000000000 x16: 0000000000000000
         x15: ffff000015b70068 x14: 0000000000000005
         x13: 0003142cc1be1768 x12: 0000000000000001
         x11: ffff8001f6de9100 x10: 0000000000000009
         x9 : ffff000015b78000 x8 : 0000000000000000
         x7 : 0000000000000001 x6 : fffffffffffff000
         x5 : 0000000000000fff x4 : ffff00001065dbc8
         x3 : 000000000000000d x2 : 0000000000001000
         x1 : fffffffffffff000 x0 : 0000000000000000
         Call trace:
          __iommu_dma_unmap+0xb8/0xc0
          iommu_dma_unmap_sg+0x98/0xb8
          put_pages+0x5c/0xf0 [msm]
          msm_gem_free_work+0x10c/0x150 [msm]
          process_one_work+0x1e0/0x330
          worker_thread+0x40/0x438
          kthread+0x12c/0x130
          ret_from_fork+0x10/0x18
         ---[ end trace afc0dc5ab81a06bf ]---
      
      Not quite sure what triggered that, but we really shouldn't be abusing
      dma_{map,unmap}_sg() for cache maint.
      
      Cc: Stephen Boyd <sboyd@kernel.org>
      Tested-by: NStephen Boyd <swboyd@chromium.org>
      Reviewed-by: NJordan Crouse <jcrouse@codeaurora.org>
      Signed-off-by: NRob Clark <robdclark@chromium.org>
      Signed-off-by: NSean Paul <seanpaul@chromium.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190630124735.27786-1-robdclark@gmail.com
      0036bc73
  12. 26 6月, 2019 1 次提交
  13. 19 6月, 2019 2 次提交
  14. 15 5月, 2019 1 次提交
  15. 20 4月, 2019 1 次提交
  16. 19 4月, 2019 1 次提交
  17. 19 2月, 2019 1 次提交
  18. 29 1月, 2019 1 次提交
  19. 25 1月, 2019 1 次提交
  20. 10 1月, 2019 1 次提交
  21. 12 12月, 2018 11 次提交
  22. 03 8月, 2018 1 次提交
  23. 04 6月, 2018 1 次提交
  24. 19 4月, 2018 1 次提交
  25. 19 3月, 2018 1 次提交
  26. 20 2月, 2018 1 次提交
  27. 14 12月, 2017 1 次提交