1. 19 Sep, 2016 5 commits
    • David Herrmann's avatar
      drm: cleanup drm_core_{init,exit}() · 2cc107dc
      David Herrmann authored
      Various cleanups to the DRM core initialization and exit handlers:
      
       - Register chrdev last: Once register_chrdev() returns, open() will
         succeed on the given chrdevs. This is usually not an issue, as no
         chardevs are registered, yet. However, nodes can be created by
         user-space via mknod(2), even though such major/minor combinations are
         unknown to the kernel. Avoid calling into drm_stub_open() in those
         cases.
         Again, drm_stub_open() would just bail out as the inode is unknown,
         but it's really non-obvious if you hack on drm_stub_open().
      
       - Unify error-paths into just one label. All the error-path helpers can
         be called even though the constructors were not called yet, or failed.
         Hence, just call all cleanups unconditionally.
      
       - Call into drm_global_release(). This is a no-op, but provides
         debugging helpers in case there're GLOBALS left on module unload. This
         function was unused until now.
      
       - Use DRM_ERROR() instead of printk(), and also print the error-code on
         failure (even if it is static!).
      
       - Don't throw away error-codes of register_chrdev()!
      
       - Don't hardcode -1 as errno. This is just plain wrong.
      
       - Order exit-handlers in the exact reverse order of initialization
         (except if the order actually matters for syncing-reasons, which is
         not the case here, though).
      
      v2:
       - Call drm_core_exit() directly from the init-error-handler. Requires to
         drop __exit annotation, though.
      Signed-off-by: default avatarDavid Herrmann <dh.herrmann@gmail.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: http://patchwork.freedesktop.org/patch/msgid/20160901124837.680-7-dh.herrmann@gmail.com
      2cc107dc
    • David Herrmann's avatar
      drm: drop obsolete drm_core.h · 82d5e73f
      David Herrmann authored
      The drm_core.h header contains a set of constants meant to be used
      throughout DRM. However, as it turns out, they're each used just once and
      don't bring any benefit. They're also grossly mis-named and lack
      name-spacing. This patch inlines them, or moves them into drm_internal.h
      as appropriate:
      
       - CORE_AUTHOR and CORE_DESC are inlined into corresponding MODULE_*()
         macros. It's just confusing having to follow 2 pointers when trying to
         find the definition of these fields. Grep'ping for MODULE_AUTHOR()
         should reveal the full information, if there's no strong reason not to.
      
       - CORE_NAME, CORE_DATE, CORE_MAJOR, CORE_MINOR, and CORE_PATCHLEVEL are
         inlined into the sysfs 'version' attribute. They're stripped
         everywhere else (which is just some printk() statements). CORE_NAME
         just doesn't make *any* sense, as we hard-code it in many places,
         anyway. The other constants are outdated and just serve
         binary-compatibility purposes. Hence, inline them in 'version' sysfs
         attribute (we might even try dropping it..).
      
       - DRM_IF_MAJOR and DRM_IF_MINOR are moved into drm_internal.h as they're
         only used by the global ioctl handlers. Furthermore, versioning
         interfaces breaks backports and as such is deprecated, anyway. We just
         keep them for historic reasons. I doubt anyone will ever modify them
         again.
      Signed-off-by: default avatarDavid Herrmann <dh.herrmann@gmail.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: http://patchwork.freedesktop.org/patch/msgid/20160901124837.680-6-dh.herrmann@gmail.com
      82d5e73f
    • David Herrmann's avatar
      drm: use drm_file to tag vm-bos · d9a1f0b4
      David Herrmann authored
      Rather than using "struct file*", use "struct drm_file*" as tag VM tag for
      BOs. This will pave the way for "struct drm_file*" without any "struct
      file*" back-pointer.
      Signed-off-by: default avatarDavid Herrmann <dh.herrmann@gmail.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: http://patchwork.freedesktop.org/patch/msgid/20160901124837.680-3-dh.herrmann@gmail.com
      d9a1f0b4
    • David Herrmann's avatar
      drm: remove redundant drm_file->uid · 75ae95a7
      David Herrmann authored
      Each DRM file-context caches the EUID of the process that opened the file.
      It is used exclusively for debugging purposes in /proc/dri/ and friends.
      
      Note, however, that we can already fetch the EUID from
      priv->pid->task->creds. The pointer-chasing will not hurt us, since it is
      only about debugging, anyway.
      
      Since we already are in an rcu-read-side, we can use __task_cred() rather
      than task_cred_xxx().
      Signed-off-by: default avatarDavid Herrmann <dh.herrmann@gmail.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: http://patchwork.freedesktop.org/patch/msgid/20160901124837.680-2-dh.herrmann@gmail.com
      75ae95a7
    • Dave Airlie's avatar
      Merge tag 'topic/drm-misc-2016-09-19' of git://anongit.freedesktop.org/drm-intel into drm-next · 9f8cf165
      Dave Airlie authored
      Just random misc stuff that Sean/Sumit&Archit picked up while I relaxed.
      Well except for one commit:
      
      * tag 'topic/drm-misc-2016-09-19' of git://anongit.freedesktop.org/drm-intel:
        drm: Only use compat ioctl for addfb2 on X86/IA64
        drm/qxl: squash lines for simple wrapper functions
        drm/bridge: analogix_dp: squash lines for simple wrapper functions
        drm/radeon: squash lines for simple wrapper functions
        drm/amdgpu: squash lines for simple wrapper functions
        dma-buf/sync-file: Avoid enable fence signaling if poll(.timeout=0)
        drm/fence: allow fence waiting to be interrupted by userspace
        drm: Move property validation to a helper, v2.
        drm/bridge: adv7511: add support for the 2nd chip
      9f8cf165
  2. 15 Sep, 2016 5 commits
  3. 13 Sep, 2016 4 commits
  4. 12 Sep, 2016 3 commits
  5. 08 Sep, 2016 6 commits
  6. 07 Sep, 2016 5 commits
  7. 06 Sep, 2016 3 commits
    • Haixia Shi's avatar
      drm/udl: implement usb_driver suspend/resume. · 737ba109
      Haixia Shi authored
      The usb_driver suspend and resume function pointers must be populated
      to prevent forced unbinding of USB interface driver. See usb/core/driver.c:
      unbind_no_pm_drivers_interfaces().
      
      Restore mode and damage the entire frame buffer upon resume.
      
      TEST=suspend and resume with the same UDL device connected
      TEST=suspend with UDL, unplug UDL and resume
      TEST=suspend with UDL, unplug and connect another UDL device then resume
      Signed-off-by: default avatarHaixia Shi <hshi@chromium.org>
      Reviewed-by: default avatarStéphane Marchesin <marcheu@chromium.org>
      [seanpaul fixed checkpatch warnings and gave marcheu his é back]
      Signed-off-by: default avatarSean Paul <seanpaul@chromium.org>
      Link: http://patchwork.freedesktop.org/patch/msgid/1472593821-38429-2-git-send-email-hshi@chromium.org
      737ba109
    • Xie XiuQi's avatar
      drm: fix signed integer overflow · ae0119f5
      Xie XiuQi authored
      Use 1UL for unsigned long, or we'll meet a overflow issue with UBSAN.
      
      [   15.589489] UBSAN: Undefined behaviour in drivers/gpu/drm/drm_hashtab.c:145:35
      [   15.589500] signed integer overflow:
      [   15.589999] -2147483648 - 1 cannot be represented in type 'int'
      [   15.590434] CPU: 2 PID: 294 Comm: plymouthd Not tainted 3.10.0-327.28.3.el7.x86_64 #1
      [   15.590653] Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 01/07/2011
      [   15.591001]  1ffff1000670fe83 000000000d6b385e ffff88003387f3e0 ffffffff81ee3140
      [   15.591028]  ffff88003387f3f8 ffffffff81ee31fd ffffffffa032f460 ffff88003387f560
      [   15.591044]  ffffffff81ee46e2 0000002d00000009 0000000000000001 0000000041b58ab3
      [   15.591059] Call Trace:
      [   15.591078]  [<ffffffff81ee3140>] dump_stack+0x1e/0x20
      [   15.591093]  [<ffffffff81ee31fd>] ubsan_epilogue+0x12/0x55
      [   15.591109]  [<ffffffff81ee46e2>] handle_overflow+0x1ba/0x215
      [   15.591126]  [<ffffffff81ee4528>] ? __ubsan_handle_negate_overflow+0x162/0x162
      [   15.591146]  [<ffffffff8103416c>] ? print_context_stack+0x9c/0x160
      [   15.591163]  [<ffffffff81031df2>] ? dump_trace+0x252/0x750
      [   15.591181]  [<ffffffff81739023>] ? __list_add+0x93/0x160
      [   15.591197]  [<ffffffff81ee4798>] __ubsan_handle_sub_overflow+0x2a/0x31
      [   15.591261]  [<ffffffffa0282140>] drm_ht_just_insert_please+0x1e0/0x200 [drm]
      [   15.591290]  [<ffffffffa0528c7a>] ttm_base_object_init+0x10a/0x270 [ttm]
      [   15.591316]  [<ffffffffa052a34c>] ttm_vt_lock+0x28c/0x3a0 [ttm]
      [   15.591343]  [<ffffffffa052a0c0>] ? ttm_write_lock+0x180/0x180 [ttm]
      [   15.591362]  [<ffffffff81419526>] ? kasan_unpoison_shadow+0x36/0x50
      [   15.591379]  [<ffffffff81419526>] ? kasan_unpoison_shadow+0x36/0x50
      [   15.591396]  [<ffffffff81419526>] ? kasan_unpoison_shadow+0x36/0x50
      [   15.591413]  [<ffffffff81419526>] ? kasan_unpoison_shadow+0x36/0x50
      [   15.591442]  [<ffffffffa061cbe1>] vmw_master_set+0x121/0x470 [vmwgfx]
      [   15.591459]  [<ffffffff811773a5>] ? __init_waitqueue_head+0x45/0x70
      [   15.591487]  [<ffffffffa061cac0>] ? vmw_master_drop+0x310/0x310 [vmwgfx]
      [   15.591535]  [<ffffffffa026946a>] drm_open+0x92a/0xc00 [drm]
      [   15.591563]  [<ffffffffa0619ff0>] ? vmw_driver_open+0x170/0x170 [vmwgfx]
      [   15.591610]  [<ffffffffa0268b40>] ? drm_poll+0xe0/0xe0 [drm]
      [   15.591661]  [<ffffffffa02797b4>] drm_stub_open+0x224/0x330 [drm]
      [   15.591711]  [<ffffffffa0279590>] ? drm_minor_acquire+0x240/0x240 [drm]
      [   15.591727]  [<ffffffff8145fa8a>] chrdev_open+0x1fa/0x3f0
      [   15.591742]  [<ffffffff8145f890>] ? cdev_put+0x50/0x50
      [   15.591761]  [<ffffffff814f6dc3>] ? __fsnotify_parent+0x53/0x210
      [   15.591778]  [<ffffffff8144fde1>] do_dentry_open+0x351/0x670
      [   15.591792]  [<ffffffff8145f890>] ? cdev_put+0x50/0x50
      [   15.591807]  [<ffffffff814503c2>] vfs_open+0xa2/0x170
      [   15.591824]  [<ffffffff8147b5df>] do_last+0xccf/0x2c80
      [   15.591842]  [<ffffffff8147a910>] ? filename_create+0x320/0x320
      [   15.591858]  [<ffffffff81472549>] ? path_init+0x1b9/0xa90
      [   15.591875]  [<ffffffff81472390>] ? mountpoint_last+0x9a0/0x9a0
      [   15.591894]  [<ffffffff815f9ccf>] ? selinux_file_alloc_security+0xcf/0x130
      [   15.591911]  [<ffffffff8147d777>] path_openat+0x1e7/0xcc0
      [   15.591927]  [<ffffffff81031df2>] ? dump_trace+0x252/0x750
      [   15.591943]  [<ffffffff8147d590>] ? do_last+0x2c80/0x2c80
      [   15.591959]  [<ffffffff81739023>] ? __list_add+0x93/0x160
      [   15.591974]  [<ffffffff8104b48d>] ? save_stack_trace+0x7d/0xb0
      [   15.591989]  [<ffffffff81480824>] do_filp_open+0xa4/0x160
      [   15.592004]  [<ffffffff81480780>] ? user_path_mountpoint_at+0x50/0x50
      [   15.592022]  [<ffffffff8149d755>] ? __alloc_fd+0x175/0x300
      [   15.592039]  [<ffffffff81453127>] do_sys_open+0x1b7/0x3f0
      [   15.592054]  [<ffffffff81452f70>] ? filp_open+0x80/0x80
      [   15.592070]  [<ffffffff81453392>] SyS_open+0x32/0x40
      [   15.592088]  [<ffffffff81f08989>] system_call_fastpath+0x16/0x1b
      Signed-off-by: default avatarXie XiuQi <xiexiuqi@huawei.com>
      [seanpaul tweaked subject to remove "gpu/"]
      Signed-off-by: default avatarSean Paul <seanpaul@chromium.org>
      Link: http://patchwork.freedesktop.org/patch/msgid/1473152138-25335-1-git-send-email-xiexiuqi@huawei.com
      ae0119f5
    • Maarten Lankhorst's avatar
      drm/atomic: Reject properties not part of the object. · 4e9951d9
      Maarten Lankhorst authored
      The legacy setprop ioctl doesn't attempt to set properties
      that are not enumerated on the object. The atomic ioctl does,
      fix this by validating first.
      Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Signed-off-by: default avatarSean Paul <seanpaul@chromium.org>
      Link: http://patchwork.freedesktop.org/patch/msgid/1473062773-5045-1-git-send-email-maarten.lankhorst@linux.intel.com
      4e9951d9
  8. 02 Sep, 2016 2 commits
  9. 01 Sep, 2016 7 commits