08 Apr, 2020

1 commit


26 Mar, 2020

1 commit

  • Improve the help text for the CONFIG_DMABUF_MOVE_NOTIFY symbol by:
    1. Removing duplicated single quotes,
    2. Adding a missing subject,
    3. Fixing a misspelling of "yet",
    4. Wrapping long lines.

    Fixes: bb42df4662a44765 ("dma-buf: add dynamic DMA-buf handling v15")
    Reviewed-by: Christian König
    Signed-off-by: Geert Uytterhoeven
    Signed-off-by: Alex Deucher
    Link: https://patchwork.freedesktop.org/patch/msgid/20200324125442.21983-1-geert+renesas@glider.be

    Geert Uytterhoeven
     

12 Mar, 2020

1 commit

  • drm-misc-next for 5.7:

    UAPI Changes:

    Cross-subsystem Changes:

    Core Changes:

    Driver Changes:
    - fb-helper: Remove drm_fb_helper_{add,add_all,remove}_one_connector
    - fbdev: some cleanups and dead-code removal
    - Conversions to simple-encoder
    - zero-length array removal
    - Panel: panel-dpi support in panel-simple, Novatek NT35510, Elida
    KD35T133,

    Signed-off-by: Dave Airlie

    From: Maxime Ripard
    Link: https://patchwork.freedesktop.org/patch/msgid/20200309135439.dicfnbo4ikj4tkz7@gilmour

    Dave Airlie
     

11 Mar, 2020

1 commit


27 Feb, 2020

4 commits

  • This makes the move_notify callback mandatory when the importer_ops are
    provided. Since amdgpu is now migrated it doesn't make much sense
    anymore to allow this.

    Signed-off-by: Christian König
    Reviewed-by: Daniel Vetter
    Link: https://patchwork.freedesktop.org/patch/353995/?series=73646&rev=1

    Christian König
     
  • Instead use the pin() callback to detect dynamic DMA-buf handling.
    Since amdgpu is now migrated it doesn't make much sense to keep
    the extra flag.

    Signed-off-by: Christian König
    Reviewed-by: Daniel Vetter
    Link: https://patchwork.freedesktop.org/patch/353997/?series=73646&rev=1

    Christian König
     
  • On the exporter side we add optional explicit pinning callbacks. Which are
    called when the importer doesn't implement dynamic handling, move notification
    or need the DMA-buf locked in place for its use case.

    On the importer side we add an optional move_notify callback. This callback is
    used by the exporter to inform the importers that their mappings should be
    destroyed as soon as possible.

    This allows the exporter to provide the mappings without the need to pin
    the backing store.

    v2: don't try to invalidate mappings when the callback is NULL,
    lock the reservation obj while using the attachments,
    add helper to set the callback
    v3: move flag for invalidation support into the DMA-buf,
    use new attach_info structure to set the callback
    v4: use importer_priv field instead of mangling exporter priv.
    v5: drop invalidation_supported flag
    v6: squash together with pin/unpin changes
    v7: pin/unpin takes an attachment now
    v8: nuke dma_buf_attachment_(map|unmap)_locked,
    everything is now handled backward compatible
    v9: always cache when export/importer don't agree on dynamic handling
    v10: minimal style cleanup
    v11: drop automatically re-entry avoidance
    v12: rename callback to move_notify
    v13: add might_lock in appropriate places
    v14: rebase on separated locking change
    v15: add EXPERIMENTAL flag, some more code comments

    Signed-off-by: Christian König
    Reviewed-by: Daniel Vetter
    Link: https://patchwork.freedesktop.org/patch/353993/?series=73646&rev=1

    Christian König
     
  • dma-buf name can be set via DMA_BUF_SET_NAME ioctl, but once set
    it never gets freed.

    Free it in dma_buf_release().

    Fixes: bb2bb9030425 ("dma-buf: add DMA_BUF_SET_NAME ioctls")
    Reported-by: syzbot+b2098bc44728a4efb3e9@syzkaller.appspotmail.com
    Cc: Greg Hackmann
    Cc: Chenbo Feng
    Cc: Sumit Semwal
    Signed-off-by: Cong Wang
    Acked-by: Chenbo Feng
    Signed-off-by: Sumit Semwal
    Link: https://patchwork.freedesktop.org/patch/msgid/20191227063204.5813-1-xiyou.wangcong@gmail.com

    Cong Wang
     

17 Feb, 2020

1 commit


03 Jan, 2020

1 commit

  • drm-misc-next for v5.6:

    UAPI Changes:
    - Commandline parser: Add support for panel orientation, and per-mode options.
    - Fix IOCTL naming for dma-buf heaps.

    Cross-subsystem Changes:
    - Rename DMA_HEAP_IOC_ALLOC to DMA_HEAP_IOCTL_ALLOC before it becomes abi.
    - Change DMA-BUF system-heap's name to system.
    - Fix leak in error handling in dma_heap_ioctl(), and make a symbol static.
    - Fix udma-buf cpu access.
    - Fix ti devicetree bindings.

    Core Changes:
    - Add CTA-861-G modes with VIC >= 193.
    - Change error handling and remove bug_on in *drm_dev_init.
    - Export drm_panel_of_backlight() correctly once more.
    - Add support for lvds decoders.
    - Convert drm/client and drm/(gem-,)fb-helper to drm-device based logging and update logging todo.

    Driver Changes:
    - Add support for dsi/px30 to rockchip.
    - Add fb damage support to virtio.
    - Use dma_resv locking wrappers in vc4, msm, etnaviv.
    - Make functions in virtio static, and perform some simplifications.
    - Add suspend support to sun4i.
    - Add A64 mipi dsi support to sun4i.
    - Add runtime pm suspend to komeda.
    - Associated driver fixes.

    Signed-off-by: Dave Airlie

    From: Maarten Lankhorst
    Link: https://patchwork.freedesktop.org/patch/msgid/efc11139-1653-86bc-1b0f-0aefde219850@linux.intel.com

    Dave Airlie
     

18 Dec, 2019

5 commits

  • I'm just going to put Chia's review comment here since it sums
    the issue rather nicely:

    "(1) Semantically, a dma-buf is in DMA domain. CPU access from the
    importer must be surrounded by {begin,end}_cpu_access. This gives the
    exporter a chance to move the buffer to the CPU domain temporarily.

    (2) When the exporter itself has other means to do CPU access, it is
    only reasonable for the exporter to move the buffer to the CPU domain
    before access, and to the DMA domain after access. The exporter can
    potentially reuse {begin,end}_cpu_access for that purpose.

    Because of (1), udmabuf does need to implement the
    {begin,end}_cpu_access hooks. But "begin" should mean
    dma_sync_sg_for_cpu and "end" should mean dma_sync_sg_for_device.

    Because of (2), if userspace wants to continuing accessing through the
    memfd mapping, it should call udmabuf's {begin,end}_cpu_access to
    avoid cache issues."

    Reported-by: Chia-I Wu
    Suggested-by: Chia-I Wu
    Fixes: 284562e1f348 ("udmabuf: implement begin_cpu_access/end_cpu_access hooks")
    Signed-off-by: Gurchetan Singh
    Link: http://patchwork.freedesktop.org/patch/msgid/20191217230228.453-1-gurchetansingh@chromium.org
    Signed-off-by: Gerd Hoffmann

    Gurchetan Singh
     
  • Fix the following sparse warning.

    drivers/dma-buf/dma-heap.c:109:14: warning: symbol 'dma_heap_ioctl_cmds'
    was not declared. Should it be static?

    Acked-by: Andrew F. Davis
    Acked-by: John Stultz
    Signed-off-by: zhong jiang
    Signed-off-by: Sumit Semwal
    [sumits: rebased over IOCTL rename patches]
    Link: https://patchwork.freedesktop.org/patch/msgid/20191217190822.1969-1-sumit.semwal@linaro.org

    zhong jiang
     
  • The -ENOTTY error return path does not free the allocated
    kdata as it returns directly. Fix this by returning via the
    error handling label err.

    Addresses-Coverity: ("Resource leak")
    Fixes: c02a81fba74f ("dma-buf: Add dma-buf heaps framework")
    Signed-off-by: Colin Ian King
    Acked-by: John Stultz
    Signed-off-by: Sumit Semwal
    Link: https://patchwork.freedesktop.org/patch/msgid/20191216161059.269492-1-colin.king@canonical.com

    Colin Ian King
     
  • The heaps are already in a directory of heaps, adding _heap to a heap
    name is redundant. This patch is only a name change, no logic is changed.

    Signed-off-by: Andrew F. Davis
    Acked-by: John Stultz
    Signed-off-by: Sumit Semwal
    Link: https://patchwork.freedesktop.org/patch/msgid/20191216133405.1001-3-afd@ti.com

    Andrew F. Davis
     
  • This is more consistent with the DMA and DRM frameworks convention. This
    patch is only a name change, no logic is changed.

    Signed-off-by: Andrew F. Davis
    Acked-by: John Stultz
    Signed-off-by: Sumit Semwal
    Link: https://patchwork.freedesktop.org/patch/msgid/20191216133405.1001-2-afd@ti.com

    Andrew F. Davis
     

17 Dec, 2019

1 commit

  • drm-misc-next for v5.6:

    UAPI Changes:
    - Add support for DMA-BUF HEAPS.

    Cross-subsystem Changes:
    - mipi dsi definition updates, pulled into drm-intel as well.
    - Add lockdep annotations for dma_resv vs mmap_sem and fs_reclaim.
    - Remove support for dma-buf kmap/kunmap.
    - Constify fb_ops in all fbdev drivers, including drm drivers and drm-core, and media as well.

    Core Changes:
    - Small cleanups to ttm.
    - Fix SCDC definition.
    - Assorted cleanups to core.
    - Add todo to remove load/unload hooks, and use generic fbdev emulation.
    - Assorted documentation updates.
    - Use blocking ww lock in ttm fault handler.
    - Remove drm_fb_helper_fbdev_setup/teardown.
    - Warning fixes with W=1 for atomic.
    - Use drm_debug_enabled() instead of drm_debug flag testing in various drivers.
    - Fallback to nontiled mode in fbdev emulation when not all tiles are present. (Later on reverted)
    - Various kconfig indentation fixes in core and drivers.
    - Fix freeing transactions in dp-mst correctly.
    - Sean Paul is steping down as core maintainer. :-(
    - Add lockdep annotations for atomic locks vs dma-resv.
    - Prevent use-after-free for a bad job in drm_scheduler.
    - Fill out all block sizes in the P01x and P210 definitions.
    - Avoid division by zero in drm/rect, and fix bounds.
    - Add drm/rect selftests.
    - Add aspect ratio and alternate clocks for HDMI 4k modes.
    - Add todo for drm_framebuffer_funcs and fb_create cleanup.
    - Drop DRM_AUTH for prime import/export ioctls.
    - Clear DP-MST payload id tables downstream when initializating.
    - Fix for DSC throughput definition.
    - Add extra FEC definitions.
    - Fix fake offset in drm_gem_object_funs.mmap.
    - Stop using encoder->bridge in core directly
    - Handle bridge chaining slightly better.
    - Add backlight support to drm/panel, and use it in many panel drivers.
    - Increase max number of y420 modes from 128 to 256, as preparation to add the new modes.

    Driver Changes:
    - Small fixes all over.
    - Fix documentation in vkms.
    - Fix mmap_sem vs dma_resv in nouveau.
    - Small cleanup in komeda.
    - Add page flip support in gma500 for psb/cdv.
    - Add ddc symlink in the connector sysfs directory for many drivers.
    - Add support for analogic an6345, and fix small bugs in it.
    - Add atomic modesetting support to ast.
    - Fix radeon fault handler VMA race.
    - Switch udl to use generic shmem helpers.
    - Unconditional vblank handling for mcde.
    - Miscellaneous fixes to mcde.
    - Tweak debug output from komeda using debugfs.
    - Add gamma and color transform support to komeda for DOU-IPS.
    - Add support for sony acx424AKP panel.
    - Various small cleanups to gma500.
    - Use generic fbdev emulation in udl, and replace udl_framebuffer with generic implementation.
    - Add support for Logic PD Type 28 panel.
    - Use drm_panel_* wrapper functions in exynos/tegra/msm.
    - Add devicetree bindings for generic DSI panels.
    - Don't include drm_pci.h directly in many drivers.
    - Add support for begin/end_cpu_access in udmabuf.
    - Stop using drm_get_pci_dev in gma500 and mga200.
    - Fixes to UDL damage handling, and use dma_buf_begin/end_cpu_access.
    - Add devfreq thermal support to panfrost.
    - Fix hotplug with daisy chained monitors by removing VCPI when disabling topology manager.
    - meson: Add support for OSD1 plane AFBC commit.
    - Stop displaying garbage when toggling ast primary plane on/off.
    - More cleanups and fixes to UDL.
    - Add D32 suport to komeda.
    - Remove globle copy of drm_dev in gma500.
    - Add support for Boe Himax8279d MIPI-DSI LCD panel.
    - Add support for ingenic JZ4770 panel.
    - Small null pointer deference fix in ingenic.
    - Remove support for the special tfp420 driver, as there is a generic way to do it.

    Signed-off-by: Daniel Vetter

    From: Maarten Lankhorst
    Link: https://patchwork.freedesktop.org/patch/msgid/ba73535a-9334-5302-2e1f-5208bd7390bd@linux.intel.com

    Daniel Vetter
     

11 Dec, 2019

4 commits

  • This adds a CMA heap, which allows userspace to allocate
    a dma-buf of contiguous memory out of a CMA region.

    This code is an evolution of the Android ION implementation, so
    thanks to its original author and maintainters:
    Benjamin Gaignard, Laura Abbott, and others!

    NOTE: This patch only adds the default CMA heap. We will enable
    selectively adding other CMA memory regions to the dmabuf heaps
    interface with a later patch (which requires a dt binding)

    Cc: Laura Abbott
    Cc: Benjamin Gaignard
    Cc: Sumit Semwal
    Cc: Liam Mark
    Cc: Pratik Patel
    Cc: Brian Starkey
    Cc: Vincent Donnefort
    Cc: Sudipto Paul
    Cc: Andrew F. Davis
    Cc: Christoph Hellwig
    Cc: Chenbo Feng
    Cc: Alistair Strachan
    Cc: Hridya Valsaraju
    Cc: Sandeep Patil
    Cc: Hillf Danton
    Cc: Dave Airlie
    Cc: dri-devel@lists.freedesktop.org
    Reviewed-by: Benjamin Gaignard
    Reviewed-by: Brian Starkey
    Acked-by: Sandeep Patil
    Acked-by: Laura Abbott
    Tested-by: Ayan Kumar Halder
    Signed-off-by: John Stultz
    Signed-off-by: Sumit Semwal
    Link: https://patchwork.freedesktop.org/patch/msgid/20191203172641.66642-5-john.stultz@linaro.org

    John Stultz
     
  • This patch adds system heap to the dma-buf heaps framework.

    This allows applications to get a page-allocator backed dma-buf
    for non-contiguous memory.

    This code is an evolution of the Android ION implementation, so
    thanks to its original authors and maintainters:
    Rebecca Schultz Zavin, Colin Cross, Laura Abbott, and others!

    Cc: Laura Abbott
    Cc: Benjamin Gaignard
    Cc: Sumit Semwal
    Cc: Liam Mark
    Cc: Pratik Patel
    Cc: Brian Starkey
    Cc: Vincent Donnefort
    Cc: Sudipto Paul
    Cc: Andrew F. Davis
    Cc: Christoph Hellwig
    Cc: Chenbo Feng
    Cc: Alistair Strachan
    Cc: Hridya Valsaraju
    Cc: Sandeep Patil
    Cc: Hillf Danton
    Cc: Dave Airlie
    Cc: dri-devel@lists.freedesktop.org
    Reviewed-by: Benjamin Gaignard
    Reviewed-by: Brian Starkey
    Acked-by: Sandeep Patil
    Acked-by: Laura Abbott
    Tested-by: Ayan Kumar Halder
    Signed-off-by: John Stultz
    Signed-off-by: Sumit Semwal
    Link: https://patchwork.freedesktop.org/patch/msgid/20191203172641.66642-4-john.stultz@linaro.org

    John Stultz
     
  • Add generic helper dmabuf ops for dma heaps, so we can reduce
    the amount of duplicative code for the exported dmabufs.

    This code is an evolution of the Android ION implementation, so
    thanks to its original authors and maintainters:
    Rebecca Schultz Zavin, Colin Cross, Laura Abbott, and others!

    Cc: Laura Abbott
    Cc: Benjamin Gaignard
    Cc: Sumit Semwal
    Cc: Liam Mark
    Cc: Pratik Patel
    Cc: Brian Starkey
    Cc: Vincent Donnefort
    Cc: Sudipto Paul
    Cc: Andrew F. Davis
    Cc: Christoph Hellwig
    Cc: Chenbo Feng
    Cc: Alistair Strachan
    Cc: Hridya Valsaraju
    Cc: Sandeep Patil
    Cc: Hillf Danton
    Cc: Dave Airlie
    Cc: dri-devel@lists.freedesktop.org
    Reviewed-by: Benjamin Gaignard
    Reviewed-by: Brian Starkey
    Acked-by: Sandeep Patil
    Acked-by: Laura Abbott
    Tested-by: Ayan Kumar Halder
    Signed-off-by: John Stultz
    Signed-off-by: Sumit Semwal
    Link: https://patchwork.freedesktop.org/patch/msgid/20191203172641.66642-3-john.stultz@linaro.org

    John Stultz
     
  • This framework allows a unified userspace interface for dma-buf
    exporters, allowing userland to allocate specific types of memory
    for use in dma-buf sharing.

    Each heap is given its own device node, which a user can allocate
    a dma-buf fd from using the DMA_HEAP_IOC_ALLOC.

    This code is an evoluiton of the Android ION implementation,
    and a big thanks is due to its authors/maintainers over time
    for their effort:
    Rebecca Schultz Zavin, Colin Cross, Benjamin Gaignard,
    Laura Abbott, and many other contributors!

    Cc: Laura Abbott
    Cc: Benjamin Gaignard
    Cc: Sumit Semwal
    Cc: Liam Mark
    Cc: Pratik Patel
    Cc: Brian Starkey
    Cc: Vincent Donnefort
    Cc: Sudipto Paul
    Cc: Andrew F. Davis
    Cc: Christoph Hellwig
    Cc: Chenbo Feng
    Cc: Alistair Strachan
    Cc: Hridya Valsaraju
    Cc: Sandeep Patil
    Cc: Hillf Danton
    Cc: Dave Airlie
    Cc: dri-devel@lists.freedesktop.org
    Reviewed-by: Brian Starkey
    Acked-by: Sandeep Patil
    Signed-off-by: Andrew F. Davis
    Signed-off-by: John Stultz
    Signed-off-by: Sumit Semwal
    Link: https://patchwork.freedesktop.org/patch/msgid/20191203172641.66642-2-john.stultz@linaro.org

    Andrew F. Davis
     

09 Dec, 2019

1 commit


05 Dec, 2019

4 commits


02 Dec, 2019

1 commit

  • Pull removal of most of fs/compat_ioctl.c from Arnd Bergmann:
    "As part of the cleanup of some remaining y2038 issues, I came to
    fs/compat_ioctl.c, which still has a couple of commands that need
    support for time64_t.

    In completely unrelated work, I spent time on cleaning up parts of
    this file in the past, moving things out into drivers instead.

    After Al Viro reviewed an earlier version of this series and did a lot
    more of that cleanup, I decided to try to completely eliminate the
    rest of it and move it all into drivers.

    This series incorporates some of Al's work and many patches of my own,
    but in the end stops short of actually removing the last part, which
    is the scsi ioctl handlers. I have patches for those as well, but they
    need more testing or possibly a rewrite"

    * tag 'compat-ioctl-5.5' of git://git.kernel.org:/pub/scm/linux/kernel/git/arnd/playground: (42 commits)
    scsi: sd: enable compat ioctls for sed-opal
    pktcdvd: add compat_ioctl handler
    compat_ioctl: move SG_GET_REQUEST_TABLE handling
    compat_ioctl: ppp: move simple commands into ppp_generic.c
    compat_ioctl: handle PPPIOCGIDLE for 64-bit time_t
    compat_ioctl: move PPPIOCSCOMPRESS to ppp_generic
    compat_ioctl: unify copy-in of ppp filters
    tty: handle compat PPP ioctls
    compat_ioctl: move SIOCOUTQ out of compat_ioctl.c
    compat_ioctl: handle SIOCOUTQNSD
    af_unix: add compat_ioctl support
    compat_ioctl: reimplement SG_IO handling
    compat_ioctl: move WDIOC handling into wdt drivers
    fs: compat_ioctl: move FITRIM emulation into file systems
    gfs2: add compat_ioctl support
    compat_ioctl: remove unused convert_in_user macro
    compat_ioctl: remove last RAID handling code
    compat_ioctl: remove /dev/raw ioctl translation
    compat_ioctl: remove PCI ioctl translation
    compat_ioctl: remove joystick ioctl translation
    ...

    Linus Torvalds
     

26 Nov, 2019

2 commits

  • Commit 7f0de8d80816 ("dma-buf: Drop dma_buf_k(un)map") removed map/unmap
    handlers, but they still existed in udmabuf. Remove them there as well

    Signed-off-by: Maarten Lankhorst
    Fixes: 7f0de8d80816 ("dma-buf: Drop dma_buf_k(un)map")
    Cc: Sumit Semwal
    Cc: Daniel Vetter
    Cc: linux-media@vger.kernel.org
    Cc: linaro-mm-sig@lists.linaro.org
    Cc: dri-devel@lists.freedesktop.org
    Reviewed-by: Daniel Vetter
    Link: https://patchwork.freedesktop.org/patch/msgid/20191126142516.630200-1-maarten.lankhorst@linux.intel.com

    Maarten Lankhorst
     
  • It's unused.

    10 years ago, back when 32bit was still fairly common and trying to
    not exhaust vmalloc space sounded like a worthwhile goal, adding these
    to dma_buf made sense.

    Reality is that they simply never caught on, and nowadays everyone who
    needs plenty of buffers will run in 64bit mode anyway.

    Also update the docs in this area to adjust them to reality.

    The actual hooks in dma_buf_ops will be removed once all the
    implementations are gone.

    Acked-by: Sumit Semwal
    Signed-off-by: Daniel Vetter
    Cc: Sumit Semwal
    Cc: linux-media@vger.kernel.org
    Cc: linaro-mm-sig@lists.linaro.org
    Link: https://patchwork.freedesktop.org/patch/msgid/20191118103536.17675-10-daniel.vetter@ffwll.ch

    Daniel Vetter
     

25 Nov, 2019

1 commit

  • In the implementation of sync_file_merge() the allocated sync_file is
    leaked if number of fences overflows. Release sync_file by goto err.

    Fixes: a02b9dc90d84 ("dma-buf/sync_file: refactor fence storage in struct sync_file")
    Signed-off-by: Navid Emamdoost
    Cc: stable@vger.kernel.org
    Signed-off-by: Daniel Vetter
    Link: https://patchwork.freedesktop.org/patch/msgid/20191122220957.30427-1-navid.emamdoost@gmail.com

    Navid Emamdoost
     

21 Nov, 2019

1 commit

  • Semnatically it really doesn't matter where we grab the ticket. But
    since the ticket is a fake lockdep lock, it matters for lockdep
    validation purposes.

    This means stuff like grabbing a ticket and then doing
    copy_from/to_user isn't allowed anymore. This is a changed compared to
    the current ttm fault handler, which doesn't bother with having a full
    reservation. Since I'm looking into fixing the TODO entry in
    ttm_mem_evict_wait_busy() I think that'll have to change sooner or
    later anyway, better get started. A bit more context on why I'm
    looking into this: For backwards compat with existing i915 gem code I
    think we'll have to do full slowpath locking in the i915 equivalent of
    the eviction code. And with dynamic dma-buf that will leak across
    drivers, so another thing we need to standardize and make sure it's
    done the same way everyway.

    Unfortunately this means another full audit of all drivers:

    - gem helpers: acquire_init is done right before taking locks, so no
    problem. Same for acquire_fini and unlocking, which means nothing
    that's not already covered by the dma_resv_lock rules will be caught
    with this extension here to the acquire_ctx.

    - etnaviv: An absolute massive amount of code is run between the
    acquire_init and the first lock acquisition in submit_lock_objects.
    But nothing that would touch user memory and could cause a fault.
    Furthermore nothing that uses the ticket, so even if I missed
    something, it would be easy to fix by pushing the acquire_init right
    before the first use. Similar on the unlock/acquire_fini side.

    - i915: Right now (and this will likely change a lot rsn) the acquire
    ctx and actual locks are right next to each another. No problem.

    - msm has a problem: submit_create calls acquire_init, but then
    submit_lookup_objects() has a bunch of copy_from_user to do the
    object lookups. That's the only thing before submit_lock_objects
    call dma_resv_lock(). Despite all the copypasta to etnaviv, etnaviv
    does not have this issue since it copies all the userspace structs
    earlier. submit_cleanup does not have any such issues.

    With the prep patch to pull out the acquire_ctx and reorder it msm
    is going to be safe too.

    - nouveau: acquire_init is right next to ttm_bo_reserve, so all good.
    Similar on the acquire_fini/ttm_bo_unreserve side.

    - ttm execbuf utils: acquire context and locking are even in the same
    functions here (one function to reserve everything, the other to
    unreserve), so all good.

    - vc4: Another case where acquire context and locking are handled in
    the same functions (one function to lock everything, the other to
    unlock).

    Cc: Maarten Lankhorst
    Cc: Chris Wilson
    Cc: Christian König
    Cc: Sumit Semwal
    Cc: linux-media@vger.kernel.org
    Cc: linaro-mm-sig@lists.linaro.org
    Cc: Huang Rui
    Cc: Eric Anholt
    Cc: Ben Skeggs
    Cc: Alex Deucher
    Cc: Rob Herring
    Cc: Lucas Stach
    Cc: Russell King
    Cc: Christian Gmeiner
    Cc: Rob Clark
    Cc: Sean Paul
    Acked-by: Christian König
    Reviewed-by: Maarten Lankhorst
    Signed-off-by: Daniel Vetter
    Link: https://patchwork.freedesktop.org/patch/msgid/20191119210844.16947-3-daniel.vetter@ffwll.ch

    Daniel Vetter
     

20 Nov, 2019

1 commit

  • From d07ea81611ed6e4fb8cc290f42d23dbcca2da2f8 Mon Sep 17 00:00:00 2001
    From: Steven Price
    Date: Mon, 11 Nov 2019 13:07:19 +0000
    Subject: [PATCH] dma_resv: Correct return type of dma_resv_lockdep()

    subsys_initcall() expects a function which returns 'int'. Fix
    dma_resv_lockdep() so it returns an 'int' error code.

    Fixes: b2a8116e2592 ("dma_resv: prime lockdep annotations")
    Signed-off-by: Steven Price
    Signed-off-by: Daniel Vetter
    Link: https://patchwork.freedesktop.org/patch/msgid/c0a0c70d-e6fe-1103-2888-1ce1425f4a5d@arm.com

    Steven Price
     

06 Nov, 2019

1 commit

  • Full audit of everyone:

    - i915, radeon, amdgpu should be clean per their maintainers.

    - vram helpers should be fine, they don't do command submission, so
    really no business holding struct_mutex while doing copy_*_user. But
    I haven't checked them all.

    - panfrost seems to dma_resv_lock only in panfrost_job_push, which
    looks clean.

    - v3d holds dma_resv locks in the tail of its v3d_submit_cl_ioctl(),
    copying from/to userspace happens all in v3d_lookup_bos which is
    outside of the critical section.

    - vmwgfx has a bunch of ioctls that do their own copy_*_user:
    - vmw_execbuf_process: First this does some copies in
    vmw_execbuf_cmdbuf() and also in the vmw_execbuf_process() itself.
    Then comes the usual ttm reserve/validate sequence, then actual
    submission/fencing, then unreserving, and finally some more
    copy_to_user in vmw_execbuf_copy_fence_user. Glossing over tons of
    details, but looks all safe.
    - vmw_fence_event_ioctl: No ttm_reserve/dma_resv_lock anywhere to be
    seen, seems to only create a fence and copy it out.
    - a pile of smaller ioctl in vmwgfx_ioctl.c, no reservations to be
    found there.
    Summary: vmwgfx seems to be fine too.

    - virtio: There's virtio_gpu_execbuffer_ioctl, which does all the
    copying from userspace before even looking up objects through their
    handles, so safe. Plus the getparam/getcaps ioctl, also both safe.

    - qxl only has qxl_execbuffer_ioctl, which calls into
    qxl_process_single_command. There's a lovely comment before the
    __copy_from_user_inatomic that the slowpath should be copied from
    i915, but I guess that never happened. Try not to be unlucky and get
    your CS data evicted between when it's written and the kernel tries
    to read it. The only other copy_from_user is for relocs, but those
    are done before qxl_release_reserve_list(), which seems to be the
    only thing reserving buffers (in the ttm/dma_resv sense) in that
    code. So looks safe.

    - A debugfs file in nouveau_debugfs_pstate_set() and the usif ioctl in
    usif_ioctl() look safe. nouveau_gem_ioctl_pushbuf() otoh breaks this
    everywhere and needs to be fixed up.

    v2: Thomas pointed at that vmwgfx calls dma_resv_init while it holds a
    dma_resv lock of a different object already. Christian mentioned that
    ttm core does this too for ghost objects. intel-gfx-ci highlighted
    that i915 has similar issues.

    Unfortunately we can't do this in the usual module init functions,
    because kernel threads don't have an ->mm - we have to wait around for
    some user thread to do this.

    Solution is to spawn a worker (but only once). It's horrible, but it
    works.

    v3: We can allocate mm! (Chris). Horrible worker hack out, clean
    initcall solution in.

    v4: Annotate with __init (Rob Herring)

    Cc: Rob Herring
    Cc: Alex Deucher
    Cc: Christian König
    Cc: Chris Wilson
    Cc: Thomas Zimmermann
    Cc: Rob Herring
    Cc: Tomeu Vizoso
    Cc: Eric Anholt
    Cc: Dave Airlie
    Cc: Gerd Hoffmann
    Cc: Ben Skeggs
    Cc: "VMware Graphics"
    Cc: Thomas Hellstrom
    Reviewed-by: Thomas Hellstrom
    Reviewed-by: Christian König
    Reviewed-by: Chris Wilson
    Tested-by: Chris Wilson
    Signed-off-by: Daniel Vetter
    Link: https://patchwork.freedesktop.org/patch/msgid/20191104173801.2972-1-daniel.vetter@ffwll.ch

    Daniel Vetter
     

31 Oct, 2019

4 commits

  • This reverts commit a69b0e855d3fd278ff6f09a23e1edf929538e304.

    This patchset doesn't meet the UAPI requirements set out in [1] for the DRM
    subsystem. Once the userspace component is reviewed and ready for merge
    we can try again.

    [1]- https://01.org/linuxgraphics/gfx-docs/drm/gpu/drm-uapi.html#open-source-userspace-requirements

    Fixes: a69b0e855d3f ("dma-buf: Add dma-buf heaps framework")
    Cc: Laura Abbott
    Cc: Benjamin Gaignard
    Cc: Sumit Semwal
    Cc: Liam Mark
    Cc: Pratik Patel
    Cc: Brian Starkey
    Cc: Vincent Donnefort
    Cc: Sudipto Paul
    Cc: Andrew F. Davis
    Cc: Christoph Hellwig
    Cc: Chenbo Feng
    Cc: Alistair Strachan
    Cc: Hridya Valsaraju
    Cc: Hillf Danton
    Cc: dri-devel@lists.freedesktop.org
    Cc: Brian Starkey
    Cc: John Stultz
    Cc: Mauro Carvalho Chehab
    Cc: "David S. Miller"
    Cc: Greg Kroah-Hartman
    Cc: Rob Herring
    Cc: Jonathan Cameron
    Cc: "Paul E. McKenney"
    Cc: Sean Paul
    Cc: "Andrew F. Davis"
    Cc: linux-media@vger.kernel.org
    Cc: linaro-mm-sig@lists.linaro.org
    Acked-by: David Airlie
    Signed-off-by: Sean Paul
    Link: https://patchwork.freedesktop.org/patch/msgid/20191030203003.101156-6-sean@poorly.run

    Sean Paul
     
  • This reverts commit 7b87ea704fd9606eaafa9150116536d72f5c4b1f.

    This patchset doesn't meet the UAPI requirements set out in [1] for the DRM
    subsystem. Once the userspace component is reviewed and ready for merge
    we can try again.

    [1]- https://01.org/linuxgraphics/gfx-docs/drm/gpu/drm-uapi.html#open-source-userspace-requirements

    Fixes: 7b87ea704fd9 ("dma-buf: heaps: Add heap helpers")
    Cc: Laura Abbott
    Cc: Benjamin Gaignard
    Cc: Sumit Semwal
    Cc: Liam Mark
    Cc: Pratik Patel
    Cc: Brian Starkey
    Cc: Vincent Donnefort
    Cc: Sudipto Paul
    Cc: Andrew F. Davis
    Cc: Christoph Hellwig
    Cc: Chenbo Feng
    Cc: Alistair Strachan
    Cc: Hridya Valsaraju
    Cc: Hillf Danton
    Cc: dri-devel@lists.freedesktop.org
    Cc: Brian Starkey
    Cc: John Stultz
    Cc: "Andrew F. Davis"
    Cc: linux-media@vger.kernel.org
    Cc: linaro-mm-sig@lists.linaro.org
    Acked-by: David Airlie
    Signed-off-by: Sean Paul
    Link: https://patchwork.freedesktop.org/patch/msgid/20191030203003.101156-5-sean@poorly.run

    Sean Paul
     
  • This reverts commit 47a32f9c12266d450b92089148c6039591bd9909.

    This patchset doesn't meet the UAPI requirements set out in [1] for the DRM
    subsystem. Once the userspace component is reviewed and ready for merge
    we can try again.

    [1]- https://01.org/linuxgraphics/gfx-docs/drm/gpu/drm-uapi.html#open-source-userspace-requirements

    Fixes: 47a32f9c1226 ("dma-buf: heaps: Add system heap to dmabuf heaps")
    Cc: Laura Abbott
    Cc: Benjamin Gaignard
    Cc: Sumit Semwal
    Cc: Liam Mark
    Cc: Pratik Patel
    Cc: Brian Starkey
    Cc: Vincent Donnefort
    Cc: Sudipto Paul
    Cc: Andrew F. Davis
    Cc: Christoph Hellwig
    Cc: Chenbo Feng
    Cc: Alistair Strachan
    Cc: Hridya Valsaraju
    Cc: Hillf Danton
    Cc: dri-devel@lists.freedesktop.org
    Cc: Brian Starkey
    Cc: John Stultz
    Cc: "Andrew F. Davis"
    Cc: linux-media@vger.kernel.org
    Cc: linaro-mm-sig@lists.linaro.org
    Acked-by: David Airlie
    Signed-off-by: Sean Paul
    Link: https://patchwork.freedesktop.org/patch/msgid/20191030203003.101156-4-sean@poorly.run

    Sean Paul
     
  • This reverts commit 43d7238fb9ac897b29912368b3359e72bae469c4.

    This patchset doesn't meet the UAPI requirements set out in [1] for the DRM
    subsystem. Once the userspace component is reviewed and ready for merge
    we can try again.

    [1]- https://01.org/linuxgraphics/gfx-docs/drm/gpu/drm-uapi.html#open-source-userspace-requirements

    Fixes: 43d7238fb9ac ("dma-buf: heaps: Add CMA heap to dmabuf heaps")
    Cc: Laura Abbott
    Cc: Benjamin Gaignard
    Cc: Sumit Semwal
    Cc: Liam Mark
    Cc: Pratik Patel
    Cc: Brian Starkey
    Cc: Vincent Donnefort
    Cc: Sudipto Paul
    Cc: Andrew F. Davis
    Cc: Christoph Hellwig
    Cc: Chenbo Feng
    Cc: Alistair Strachan
    Cc: Hridya Valsaraju
    Cc: Hillf Danton
    Cc: dri-devel@lists.freedesktop.org
    Cc: Brian Starkey
    Cc: John Stultz
    Cc: "Andrew F. Davis"
    Cc: linux-media@vger.kernel.org
    Cc: linaro-mm-sig@lists.linaro.org
    Acked-by: David Airlie
    Signed-off-by: Sean Paul
    Link: https://patchwork.freedesktop.org/patch/msgid/20191030203003.101156-3-sean@poorly.run

    Sean Paul
     

25 Oct, 2019

4 commits

  • This adds a CMA heap, which allows userspace to allocate
    a dma-buf of contiguous memory out of a CMA region.

    This code is an evolution of the Android ION implementation, so
    thanks to its original author and maintainters:
    Benjamin Gaignard, Laura Abbott, and others!

    NOTE: This patch only adds the default CMA heap. We will enable
    selectively adding other CMA memory regions to the dmabuf heaps
    interface with a later patch (which requires a dt binding)

    Cc: Laura Abbott
    Cc: Benjamin Gaignard
    Cc: Sumit Semwal
    Cc: Liam Mark
    Cc: Pratik Patel
    Cc: Brian Starkey
    Cc: Vincent Donnefort
    Cc: Sudipto Paul
    Cc: Andrew F. Davis
    Cc: Christoph Hellwig
    Cc: Chenbo Feng
    Cc: Alistair Strachan
    Cc: Hridya Valsaraju
    Cc: Hillf Danton
    Cc: dri-devel@lists.freedesktop.org
    Reviewed-by: Benjamin Gaignard
    Reviewed-by: Brian Starkey
    Acked-by: Laura Abbott
    Tested-by: Ayan Kumar Halder
    Signed-off-by: John Stultz
    Signed-off-by: Sumit Semwal
    Link: https://patchwork.freedesktop.org/patch/msgid/20191021190310.85221-5-john.stultz@linaro.org

    John Stultz
     
  • This patch adds system heap to the dma-buf heaps framework.

    This allows applications to get a page-allocator backed dma-buf
    for non-contiguous memory.

    This code is an evolution of the Android ION implementation, so
    thanks to its original authors and maintainters:
    Rebecca Schultz Zavin, Colin Cross, Laura Abbott, and others!

    Cc: Laura Abbott
    Cc: Benjamin Gaignard
    Cc: Sumit Semwal
    Cc: Liam Mark
    Cc: Pratik Patel
    Cc: Brian Starkey
    Cc: Vincent Donnefort
    Cc: Sudipto Paul
    Cc: Andrew F. Davis
    Cc: Christoph Hellwig
    Cc: Chenbo Feng
    Cc: Alistair Strachan
    Cc: Hridya Valsaraju
    Cc: Hillf Danton
    Cc: dri-devel@lists.freedesktop.org
    Reviewed-by: Benjamin Gaignard
    Reviewed-by: Brian Starkey
    Acked-by: Laura Abbott
    Tested-by: Ayan Kumar Halder
    Signed-off-by: John Stultz
    Signed-off-by: Sumit Semwal
    Link: https://patchwork.freedesktop.org/patch/msgid/20191021190310.85221-4-john.stultz@linaro.org

    John Stultz
     
  • Add generic helper dmabuf ops for dma heaps, so we can reduce
    the amount of duplicative code for the exported dmabufs.

    This code is an evolution of the Android ION implementation, so
    thanks to its original authors and maintainters:
    Rebecca Schultz Zavin, Colin Cross, Laura Abbott, and others!

    Cc: Laura Abbott
    Cc: Benjamin Gaignard
    Cc: Sumit Semwal
    Cc: Liam Mark
    Cc: Pratik Patel
    Cc: Brian Starkey
    Cc: Vincent Donnefort
    Cc: Sudipto Paul
    Cc: Andrew F. Davis
    Cc: Christoph Hellwig
    Cc: Chenbo Feng
    Cc: Alistair Strachan
    Cc: Hridya Valsaraju
    Cc: Hillf Danton
    Cc: dri-devel@lists.freedesktop.org
    Reviewed-by: Benjamin Gaignard
    Reviewed-by: Brian Starkey
    Acked-by: Laura Abbott
    Tested-by: Ayan Kumar Halder
    Signed-off-by: John Stultz
    Signed-off-by: Sumit Semwal
    Link: https://patchwork.freedesktop.org/patch/msgid/20191021190310.85221-3-john.stultz@linaro.org

    John Stultz
     
  • This framework allows a unified userspace interface for dma-buf
    exporters, allowing userland to allocate specific types of memory
    for use in dma-buf sharing.

    Each heap is given its own device node, which a user can allocate
    a dma-buf fd from using the DMA_HEAP_IOC_ALLOC.

    This code is an evoluiton of the Android ION implementation,
    and a big thanks is due to its authors/maintainers over time
    for their effort:
    Rebecca Schultz Zavin, Colin Cross, Benjamin Gaignard,
    Laura Abbott, and many other contributors!

    Cc: Laura Abbott
    Cc: Benjamin Gaignard
    Cc: Sumit Semwal
    Cc: Liam Mark
    Cc: Pratik Patel
    Cc: Brian Starkey
    Cc: Vincent Donnefort
    Cc: Sudipto Paul
    Cc: Andrew F. Davis
    Cc: Christoph Hellwig
    Cc: Chenbo Feng
    Cc: Alistair Strachan
    Cc: Hridya Valsaraju
    Cc: Hillf Danton
    Cc: dri-devel@lists.freedesktop.org
    Reviewed-by: Benjamin Gaignard
    Reviewed-by: Brian Starkey
    Acked-by: Laura Abbott
    Tested-by: Ayan Kumar Halder
    Signed-off-by: Andrew F. Davis
    Signed-off-by: John Stultz
    Signed-off-by: Sumit Semwal
    Link: https://patchwork.freedesktop.org/patch/msgid/20191021190310.85221-2-john.stultz@linaro.org

    Andrew F. Davis