1. 13 9月, 2018 1 次提交
  2. 16 7月, 2018 1 次提交
    • L
      drm/dp_helper: Add DP aux channel tracing · a18b2192
      Lyude Paul 提交于
      This is something we've needed for a very long time now, as it makes
      debugging issues with faulty MST hubs along with debugging issues
      regarding us interfacing with hubs correctly vastly easier to debug.
      Currently this can actually be done if you trace the i2c devices for DP
      using ftrace but that's significantly less useful for a couple of
      reasons:
      
      - Tracing the i2c devices through ftrace means all of the traces are
        going to contain a lot of "garbage" output that we're sending over the
        i2c line. Most of this garbage comes from retrying transactions, DRM's
        helper library adding extra transactions to work around bad hubs, etc.
      - Having a user set up ftrace so that they can provide debugging
        information is a lot more difficult then being able to say "just boot
        with drm.debug=0x100"
      - We can potentially expand upon this tracing in the future to print
        debugging information in regards to other DP transactions like MST
        sideband transactions
      
      This is inspired by a patch Rob Clark sent to do this a long time back.
      Neither of us could find the patch however, so we both assumed it would
      probably just be easier to rewrite it anyway.
      
      Cc: Rob Clark <robdclark@gmail.com>
      Signed-off-by: NLyude Paul <lyude@redhat.com>
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: https://patchwork.freedesktop.org/patch/msgid/20180716154432.13433-1-lyude@redhat.com
      a18b2192
  3. 10 7月, 2018 1 次提交
  4. 31 5月, 2018 1 次提交
  5. 11 5月, 2018 1 次提交
    • H
      drm: Match sysfs name in link removal to link creation · 7f6df440
      Haneen Mohammed 提交于
      This patch matches the sysfs name used in the unlinking with the
      linking function. Otherwise, remove_compat_control_link() fails to remove
      sysfs created by create_compat_control_link() in drm_dev_register().
      
      Fixes: 6449b088 ("drm: Add fake controlD* symlinks for backwards
      compat")
      Cc: Dave Airlie <airlied@gmail.com>
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Cc: Emil Velikov <emil.l.velikov@gmail.com>
      Cc: David Herrmann <dh.herrmann@gmail.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Daniel Vetter <daniel.vetter@intel.com>
      Cc: Gustavo Padovan <gustavo@padovan.org>
      Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Cc: Sean Paul <seanpaul@chromium.org>
      Cc: David Airlie <airlied@linux.ie>
      Cc: dri-devel@lists.freedesktop.org
      Cc: <stable@vger.kernel.org> # v4.10+
      Signed-off-by: NHaneen Mohammed <hamohammed.sa@gmail.com>
      [seanpaul added Fixes and Cc tags]
      Signed-off-by: NSean Paul <seanpaul@chromium.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20180511041542.GA4253@haneen-vb
      7f6df440
  6. 04 5月, 2018 1 次提交
  7. 29 3月, 2018 1 次提交
  8. 06 3月, 2018 1 次提交
  9. 25 10月, 2017 1 次提交
  10. 21 10月, 2017 1 次提交
  11. 26 9月, 2017 1 次提交
  12. 11 8月, 2017 3 次提交
  13. 11 7月, 2017 1 次提交
    • A
      drm: inhibit drm drivers register to uninitialized drm core · 371c2279
      Alexandru Moise 提交于
      If the DRM core fails to init for whatever reason, ensure that
      no driver ever calls drm_dev_register().
      
      This is best done at drm_dev_init() as it covers drivers that call
      drm_dev_alloc() as well as drivers that prefer to embed struct
      drm_device into their own device struct and call drm_dev_init()
      themselves.
      
      In my case I had so many dynamic device majors used that the major
      number for DRM (226) was stolen, causing DRM core init to fail after
      failing to register a chrdev, and ultimately calling debugfs_remove()
      on drm_debugfs_root in drm_core_exit().
      
      After drm core failed to init, VGEM was still calling drm_dev_register(),
      ultimately leading to drm_debugfs_init(), with drm_debugfs_root passed
      as the root for the new debugfs dir at debugfs_create_dir().
      
      This led to a kernel panic once we were either derefencing root->d_inode
      while it was NULL or calling root->d_inode->i_op->lookup() while it was
      NULL in debugfs at inode_lock() or lookup_*().
      Signed-off-by: NAlexandru Moise <00moses.alexander00@gmail.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170708214352.GA27205@gmail.com
      371c2279
  14. 02 6月, 2017 1 次提交
    • H
      drm: Fix oops + Xserver hang when unplugging USB drm devices · 75fb6363
      Hans de Goede 提交于
      commit a39be606 ("drm: Do a full device unregister when unplugging")
      causes backtraces like this one when unplugging an usb drm device while
      it is in use:
      
      usb 2-3: USB disconnect, device number 25
      ------------[ cut here ]------------
      WARNING: CPU: 0 PID: 242 at drivers/gpu/drm/drm_mode_config.c:424
         drm_mode_config_cleanup+0x220/0x280 [drm]
      ...
      RIP: 0010:drm_mode_config_cleanup+0x220/0x280 [drm]
      ...
      Call Trace:
       gm12u320_modeset_cleanup+0xe/0x10 [gm12u320]
       gm12u320_driver_unload+0x35/0x70 [gm12u320]
       drm_dev_unregister+0x3c/0xe0 [drm]
       drm_unplug_dev+0x12/0x60 [drm]
       gm12u320_usb_disconnect+0x36/0x40 [gm12u320]
       usb_unbind_interface+0x72/0x280
       device_release_driver_internal+0x158/0x210
       device_release_driver+0x12/0x20
       bus_remove_device+0x104/0x180
       device_del+0x1d2/0x350
       usb_disable_device+0x9f/0x270
       usb_disconnect+0xc6/0x260
      ...
      [drm:drm_mode_config_cleanup [drm]] *ERROR* connector Unknown-1 leaked!
      ------------[ cut here ]------------
      WARNING: CPU: 0 PID: 242 at drivers/gpu/drm/drm_mode_config.c:458
         drm_mode_config_cleanup+0x268/0x280 [drm]
      ...
      <same Call Trace>
      ---[ end trace 80df975dae439ed6 ]---
      general protection fault: 0000 [#1] SMP
      ...
      Call Trace:
       ? __switch_to+0x225/0x450
       drm_mode_rmfb_work_fn+0x55/0x70 [drm]
       process_one_work+0x193/0x3c0
       worker_thread+0x4a/0x3a0
      ...
      RIP: drm_framebuffer_remove+0x62/0x3f0 [drm] RSP: ffffb776c39dfd98
      ---[ end trace 80df975dae439ed7 ]---
      
      After which the system is unusable this is caused by drm_dev_unregister
      getting called immediately on unplug, which calls the drivers unload
      function which calls drm_mode_config_cleanup which removes the framebuffer
      object while userspace is still holding a reference to it.
      
      Reverting commit a39be606 ("drm: Do a full device unregister
      when unplugging") leads to the following oops on unplug instead,
      when userspace closes the last fd referencing the drm_dev:
      
      sysfs group 'power' not found for kobject 'card1-Unknown-1'
      ------------[ cut here ]------------
      WARNING: CPU: 0 PID: 2459 at fs/sysfs/group.c:237
         sysfs_remove_group+0x80/0x90
      ...
      RIP: 0010:sysfs_remove_group+0x80/0x90
      ...
      Call Trace:
       dpm_sysfs_remove+0x57/0x60
       device_del+0xfd/0x350
       device_unregister+0x1a/0x60
       drm_sysfs_connector_remove+0x39/0x50 [drm]
       drm_connector_unregister+0x5a/0x70 [drm]
       drm_connector_unregister_all+0x45/0xa0 [drm]
       drm_modeset_unregister_all+0x12/0x30 [drm]
       drm_dev_unregister+0xca/0xe0 [drm]
       drm_put_dev+0x32/0x60 [drm]
       drm_release+0x2f3/0x380 [drm]
       __fput+0xdf/0x1e0
      ...
      ---[ end trace ecfb91ac85688bbe ]---
      BUG: unable to handle kernel NULL pointer dereference at 00000000000000a8
      IP: down_write+0x1f/0x40
      ...
      Call Trace:
       debugfs_remove_recursive+0x55/0x1b0
       drm_debugfs_connector_remove+0x21/0x40 [drm]
       drm_connector_unregister+0x62/0x70 [drm]
       drm_connector_unregister_all+0x45/0xa0 [drm]
       drm_modeset_unregister_all+0x12/0x30 [drm]
       drm_dev_unregister+0xca/0xe0 [drm]
       drm_put_dev+0x32/0x60 [drm]
       drm_release+0x2f3/0x380 [drm]
       __fput+0xdf/0x1e0
      ...
      ---[ end trace ecfb91ac85688bbf ]---
      
      This is caused by the revert moving back to drm_unplug_dev calling
      drm_minor_unregister which does:
      
              device_del(minor->kdev);
              dev_set_drvdata(minor->kdev, NULL); /* safety belt */
              drm_debugfs_cleanup(minor);
      
      Causing the sysfs entries to already be removed even though we still
      have references to them in e.g. drm_connector.
      
      Note we must call drm_minor_unregister to notify userspace of the unplug
      of the device, so calling drm_dev_unregister is not completely wrong the
      problem is that drm_dev_unregister does too much.
      
      This commit fixes drm_unplug_dev by not only reverting
      commit a39be606 ("drm: Do a full device unregister when unplugging")
      but by also adding a call to drm_modeset_unregister_all before the
      drm_minor_unregister calls to make sure all sysfs entries are removed
      before calling device_del(minor->kdev) thereby also fixing the second
      set of oopses caused by just reverting the commit.
      
      Fixes: a39be606 ("drm: Do a full device unregister when unplugging")
      Cc: stable@vger.kernel.org
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: Jeffy <jeffy.chen@rock-chips.com>
      Cc: Marco Diego Aurélio Mesquita <marcodiegomesquita@gmail.com>
      Reported-by: NMarco Diego Aurélio Mesquita <marcodiegomesquita@gmail.com>
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NSean Paul <seanpaul@chromium.org>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170601115430.4113-1-hdegoede@redhat.com
      75fb6363
  15. 02 2月, 2017 1 次提交
    • C
      drm: Provide a driver hook for drm_dev_release() · f30c9257
      Chris Wilson 提交于
      Some state is coupled into the device lifetime outside of the
      load/unload timeframe and requires teardown during final unreference
      from drm_dev_release(). For example, dmabufs hold both a device and
      module reference and may live longer than expected (i.e. the current
      pattern of the driver tearing down its state and then releasing a
      reference to the drm device) and yet touch driver private state when
      destroyed.
      
      v2: Export drm_dev_fini() and move the responsibility for finalizing the
      drm_device and freeing it to the release callback. (If no callback is
      provided, the core will call drm_dev_fini() and kfree(dev) as before.)
      v3: Remember to add drm_dev_fini() to drm_drv.h
      v4: Tidy language for kerneldoc
      v5: Cross reference from drm_dev_init() to note that driver->release()
      allows for arbitrary embedding.
      v6: Refer to driver data rather than driver state, as state is now
      becoming associated with the struct drm_atomic_state and friends.
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Reviewed-by: NLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      [danvet: Use the proper reference for struct members, which is
      &drm_driver.release.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170202093632.31017-1-chris@chris-wilson.co.uk
      f30c9257
  16. 30 1月, 2017 1 次提交
  17. 27 1月, 2017 1 次提交
  18. 25 1月, 2017 1 次提交
  19. 30 12月, 2016 4 次提交
  20. 19 12月, 2016 1 次提交
  21. 11 12月, 2016 1 次提交
    • D
      drm: Add fake controlD* symlinks for backwards compat · 6449b088
      Daniel Vetter 提交于
      We thought that no userspace is using them, but oops libdrm is using
      them to figure out whether a driver supports modesetting. Check out
      drmCheckModesettingSupported but maybe don't because it's horrible and
      totally runs counter to where we want to go with libdrm device
      handling. The function looks in the device hierarchy for whether
      controlD* exist using the following format string:
      
      /sys/bus/pci/devices/%04x:%02x:%02x.%d/drm/controlD%d
      
      The "/drm" subdirectory is the glue directory from the sysfs class
      stuff, and the only way to get at it seems to through
      kdev->kobj.parent (when kdev is represents e.g. the card0 chardev
      instance in sysfs). Git grep says we're not the only ones touching
      that, so I hope it's ok we dig into such internals - I couldn't find a
      proper interface for getting at the glue directory.
      
      Quick git grep shows that at least -amdgpu, -ati are using this.
      -modesetting do not, and on -intel it's only about the 4th fallback
      path for device lookup, which is why this didn't blow up earlier.
      
      Oh well, we need to keep it working, and the simplest way is to add a
      symlink at the right place in sysfs from controlD* to card*.
      
      v2:
      - Fix error path handling by adding if (!minor) return checks (David)
      - Fix the controlD* numbers to match what's been there (David)
      - Add a comment what exactly userspace minimally needs.
      - Correct the analysis for -intel (Chris).
      
      Fixes: 8a357d10 ("drm: Nerf DRM_CONTROL nodes")
      Cc: Dave Airlie <airlied@gmail.com>
      Reported-and-tested-by: NAlex Deucher <alexander.deucher@amd.com>
      Acked-by: NEmil Velikov <emil.l.velikov@gmail.com>
      Reviewed-by: NDavid Herrmann <dh.herrmann@gmail.com>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Cc: David Herrmann <dh.herrmann@gmail.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20161209135656.14881-1-daniel.vetter@ffwll.ch
      6449b088
  22. 08 12月, 2016 1 次提交
  23. 17 11月, 2016 1 次提交
    • D
      drm: Nerf DRM_CONTROL nodes · 8a357d10
      Daniel Vetter 提交于
      Looking at the ioctl permission checks I noticed that it's impossible
      to import gem buffers into a control nodes, and fd2handle/handle2fd
      also don't work, so no joy with dma-bufs.
      
      The only way to do anything with a control node is by drawing stuff
      into a dumb buffer and displaying that. I suspect control nodes are an
      entirely unused thing, and a cursory check shows that there does not
      seem to be any callers of drmOpenControl nor of the other drmOpen
      functions using DRM_MODE_CONTROL.
      
      Since I don't like dead uabi, let's remove it. But since this would be
      a really big change I think it's better to start out small by simply
      not registering anything. We can garbage-collect the dead code later
      on, once we're sure it's really not used anywhere.
      Acked-by: NDave Airlie <airlied@gmail.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20161028081050.1042-1-daniel.vetter@ffwll.ch
      8a357d10
  24. 15 11月, 2016 2 次提交
  25. 11 11月, 2016 1 次提交
  26. 04 10月, 2016 1 次提交
  27. 22 9月, 2016 2 次提交
  28. 19 9月, 2016 2 次提交
    • D
      drm: cleanup drm_core_{init,exit}() · 2cc107dc
      David Herrmann 提交于
      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: NDavid Herrmann <dh.herrmann@gmail.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: http://patchwork.freedesktop.org/patch/msgid/20160901124837.680-7-dh.herrmann@gmail.com
      2cc107dc
    • D
      drm: drop obsolete drm_core.h · 82d5e73f
      David Herrmann 提交于
      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: NDavid Herrmann <dh.herrmann@gmail.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: http://patchwork.freedesktop.org/patch/msgid/20160901124837.680-6-dh.herrmann@gmail.com
      82d5e73f
  29. 23 8月, 2016 1 次提交
  30. 19 8月, 2016 1 次提交
  31. 08 8月, 2016 1 次提交
  32. 12 7月, 2016 1 次提交