OpenCloudOS-Kernel/drivers/gpu/drm
Lyude Paul a0922278f8 drm/nouveau/kms/nv50-: Refactor and cleanup DP HPD handling
First some backstory here: Currently, we keep track of whether or not
we've enabled MST or not by trying to piggy-back off the MST helpers.
This means that in order to check whether MST is enabled or not, we
actually need to grab drm_dp_mst_topology_mgr.lock.

Back when I originally wrote this, I did this piggy-backing with the
intention that I'd eventually be teaching our MST helpers how to recover
when an MST device has stopped responding, which in turn would require
the MST helpers having a way of disabling MST independently of the
driver. Note that this was before I reworked locking in the MST helpers,
so at the time we were sticking random things under &mgr->lock - which
grabbing this lock was meant to protect against.

This never came to fruition because doing such a reset safely turned out
to be a lot more painful and impossible then it sounds, and also just
risks us working around issues with our MST handlers that should be
properly fixed instead. Even if it did though, simply calling
drm_dp_mst_topology_mgr_set_mst() from the MST helpers (with the
exception of when we're tearing down our MST managers, that's always OK)
wouldn't have been a bad idea, since drivers like nouveau and i915 need
to do their own book keeping immediately after disabling MST.
So-implementing that would likely require adding a hook for
helper-triggered MST disables anyway.

So, fast forward to now - we want to start adding support for all of the
miscellaneous bits of the DP protocol (for both SST and MST) we're
missing before moving on to supporting more complicated features like
supporting different BPP values on MST, DSC, etc. Since many of these
features only exist on SST and make use of DP HPD IRQs, we want to be
able to atomically check whether we're servicing an MST IRQ or SST IRQ
in nouveau_connector_hotplug(). Currently we literally don't do this at
all, and just handle any kind of possible DP IRQ we could get including
ESIs - even if MST isn't actually enabled.

This would be very complicated and difficult to fix if we need to hold
&mgr->lock while handling SST IRQs to ensure that the MST topology
state doesn't change under us. What we really want here is to do our own
tracking of whether MST is enabled or not, similar to drivers like i915,
and define our own locking order to decomplicate things and avoid
hitting locking issues in the future.

So, let's do this by refactoring our MST probing/enabling code to use
our own MST bookkeeping, along with adding a lock for protecting DP
state that needs to be checked outside of our connector probing
functions. While we're at it, we also remove a bunch of unneeded steps
we perform when probing/enabling MST:

* Enabling bits in MSTM_CTRL before calling drm_dp_mst_topology_mgr_set_mst().
  I don't think these ever actually did anything, since the nvif methods
  for enabling MST don't actually do anything DPCD related and merely
  indicate to nvkm that we've turned on MST.
* Checking the MSTM_CTRL bit is intact when checking the state of an
  enabled MST topology in nv50_mstm_detect(). I just added this to be safe
  originally, but now that we try reading the DPCD when probing DP
  connectors it shouldn't be needed as that will abort our hotplug probing
  if the device was removed well before we start checking for MST..
* All of the duplicate DPCD version checks.

This leaves us with much nicer looking code, a much more sensible
locking scheme, and an easy way of checking whether MST is enabled or
not for handling DP HPD IRQs.

v2:
* Get rid of accidental newlines
v4:
* Fix uninitialized usage of mstm in nv50_mstm_detect() - thanks kernel
  bot!

Signed-off-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200826182456.322681-9-lyude@redhat.com
2020-08-31 19:10:08 -04:00
..
amd drm/amdgpu/ttm: remove unused parameter to move blit 2020-08-31 12:41:50 +10:00
arc drm/arc: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS 2020-06-10 09:02:03 +02:00
arm drm/malidp: Use struct drm_gem_object_funcs.get_sg_table internally 2020-08-18 15:26:32 +02:00
armada drm-misc-next for v5.9: 2020-06-24 15:45:51 +10:00
aspeed Linux 5.8-rc6 2020-07-24 08:48:05 +10:00
ast drm: ast: fix double __iomem sparse warning 2020-08-19 09:14:40 +02:00
atmel-hlcdc drm/atomic-helper: reset vblank on crtc reset 2020-07-02 20:25:51 +02:00
bochs Linux 5.8 2020-08-11 11:58:31 +10:00
bridge drm/bridge: Fix the dsi remote end-points 2020-08-29 23:02:34 +02:00
etnaviv Merge branch 'etnaviv/next' of https://git.pengutronix.de/git/lst/linux into drm-next 2020-07-23 15:28:10 +10:00
exynos Linux 5.9-rc1 2020-08-18 14:14:25 +02:00
fsl-dcu drm: Remove unnecessary drm_panel_attach and drm_panel_detach 2020-08-08 09:06:33 +02:00
gma500 drm/gma500: fix error check 2020-08-19 15:49:10 +02:00
hisilicon drm/hisilicon: Removed the dependency on the mmu 2020-08-30 20:35:55 -04:00
i2c sound updates for 5.9 2020-08-06 14:27:31 -07:00
i810 drm/i810: switch from 'pci_' to 'dma_' API 2020-07-20 09:34:24 +02:00
i915 Linux 5.9-rc1 2020-08-18 14:14:25 +02:00
imx Merge drm/drm-next into drm-misc-next 2020-08-12 20:42:08 +02:00
ingenic drm/ingenic: ipu: Only enable clock when needed 2020-07-30 18:19:57 +02:00
lib
lima Linux 5.8 2020-08-11 11:58:31 +10:00
mcde drm/mcde: Retry DSI read/write transactions 2020-08-15 12:14:18 +02:00
mediatek drm: Remove unnecessary drm_panel_attach and drm_panel_detach 2020-08-08 09:06:33 +02:00
meson Linux 5.8-rc6 2020-07-24 08:48:05 +10:00
mga
mgag200 drm/mgag200: fix spelling mistake "expeced" -> "expected" 2020-08-27 11:17:52 +02:00
msm Linux 5.9-rc1 2020-08-18 14:14:25 +02:00
mxsfb drm: mxsfb: Support the alpha plane 2020-07-28 17:21:58 +02:00
nouveau drm/nouveau/kms/nv50-: Refactor and cleanup DP HPD handling 2020-08-31 19:10:08 -04:00
omapdrm drm/omap: fix spelling mistake "propert" -> "property" 2020-08-21 15:15:11 +03:00
panel drm: panel: Fix bpc for OrtusTech COM43H4M85ULC panel 2020-08-30 00:10:44 +02:00
panfrost Linux 5.9-rc1 2020-08-18 14:14:25 +02:00
pl111 drm: pl111: Update documentation 2020-07-23 10:06:22 +02:00
qxl drm/ttm: init mem->bus in common code. 2020-08-24 17:00:48 +10:00
r128 drm: delete drm_pci.h 2020-04-03 17:11:41 +02:00
radeon drm/radeon/ttm: don't store driver copy of device pointer. 2020-08-31 12:42:40 +10:00
rcar-du Merge drm/drm-next into drm-misc-next 2020-08-12 20:42:08 +02:00
rockchip Linux 5.9-rc1 2020-08-18 14:14:25 +02:00
savage
scheduler This tree adds the sched_set_fifo*() encapsulation APIs to remove 2020-08-06 11:55:43 -07:00
selftests drm/mm/selftests: fix wrong return type casting 2020-06-23 15:57:30 +02:00
shmobile drm/shmobile: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS 2020-06-10 09:05:18 +02:00
sis
sti Linux 5.9-rc1 2020-08-18 14:14:25 +02:00
stm drm/stm: repair runtime power management 2020-07-08 11:47:01 +02:00
sun4i drm/sun4i: lvds: Invert the LVDS polarity 2020-08-27 17:55:50 +02:00
tdfx
tegra Merge drm/drm-next into drm-misc-next 2020-08-12 20:42:08 +02:00
tidss drm/tidss: implement WA for AM65xx erratum i2000 2020-08-21 15:17:05 +03:00
tilcdc drm/tilcdc: Use standard drm_atomic_helper_commit 2020-07-14 10:32:33 +02:00
tiny drm/mipi-dbi: Remove ->enabled 2020-06-24 09:17:34 +02:00
ttm drm/ttm: drop bus.size from bus placement. 2020-08-24 17:06:08 +10:00
tve200 drm/tve200: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS 2020-06-10 09:06:11 +02:00
udl drm/udl: Use GEM vmap/mmap function from SHMEM helpers 2020-06-10 10:17:21 +02:00
v3d drm/v3d: convert to use module_platform_driver 2020-08-10 15:32:00 +02:00
vboxvideo drm/vboxvideo: Replace HTTP links with HTTPS ones 2020-07-16 22:12:50 +02:00
vc4 drm/vc4: crtc: Remove the feed_txp tests 2020-07-07 10:51:58 +02:00
vgem drm/vgem: add missing platform_device_unregister() in vgem_init() 2020-08-10 15:31:02 +02:00
via Merge branch 'akpm' (patches from Andrew) 2020-01-31 12:16:36 -08:00
virtio drm: virtio: fix kconfig dependency warning 2020-08-31 08:55:02 +02:00
vkms drm/vkms: avoid warning in vkms_get_vblank_timestamp 2020-08-30 09:27:06 -04:00
vmwgfx drm/ttm: init mem->bus in common code. 2020-08-24 17:00:48 +10:00
xen xen: branch for v5.9-rc1b 2020-08-14 13:34:37 -07:00
xlnx drm: xlnx: zynqmp: Use switch - case for link rate downshift 2020-08-01 01:56:10 +00:00
zte sound updates for 5.9 2020-08-06 14:27:31 -07:00
Kconfig drm: xlnx: DRM/KMS driver for Xilinx ZynqMP DisplayPort Subsystem 2020-07-18 02:59:16 +03:00
Makefile Xilinx ZynqMP DisplayPort Subsystem driver 2020-07-23 15:31:38 +10:00
drm_agpsupport.c
drm_atomic.c drm : Insert blank lines after declarations. 2020-07-02 15:26:00 +02:00
drm_atomic_helper.c drm: bridge: Pass drm_display_info to drm_bridge_funcs .mode_valid() 2020-06-23 19:53:27 +02:00
drm_atomic_state_helper.c drm/atomic-helper: reset vblank on crtc reset 2020-07-02 20:25:51 +02:00
drm_atomic_uapi.c drm : Insert blank lines after declarations. 2020-07-02 15:26:00 +02:00
drm_auth.c drm/auth: make drm_{set,drop}master_ioctl symmetrical 2020-06-15 14:49:50 +01:00
drm_blend.c drm: plane: Verify that no or all planes have a zpos property 2020-05-14 02:10:52 +03:00
drm_bridge.c drm: bridge: Pass drm_display_info to drm_bridge_funcs .mode_valid() 2020-06-23 19:53:27 +02:00
drm_bridge_connector.c drm/bridge_connector: Set default status connected for eDP connectors 2020-08-26 19:11:41 +02:00
drm_bufs.c drm : Insert blank lines after declarations. 2020-07-02 15:26:00 +02:00
drm_cache.c
drm_client.c drm/client: Add drm_client_framebuffer_flush() 2020-05-26 13:31:01 +02:00
drm_client_modeset.c drm: Nuke mode->vrefresh 2020-05-27 14:31:42 +03:00
drm_color_mgmt.c
drm_connector.c drm: report dp downstream port type as a subconnector property 2020-08-11 14:06:04 +02:00
drm_context.c drm: context: Clean up documentation 2020-03-16 09:23:55 +01:00
drm_crtc.c drm : Insert blank lines after declarations. 2020-07-02 15:26:00 +02:00
drm_crtc_helper.c drm : Insert blank lines after declarations. 2020-07-02 15:26:00 +02:00
drm_crtc_helper_internal.h drm/probe_helper: Add drm_connector_helper_funcs.mode_valid_ctx 2020-07-13 13:29:20 -04:00
drm_crtc_internal.h drm: convert .debugfs_init() hook to return void. 2020-03-18 17:53:28 +01:00
drm_damage_helper.c
drm_debugfs.c drm/debug: Expose connector VRR monitor range via debugfs 2020-06-25 15:47:14 -07:00
drm_debugfs_crc.c drm/crc: Actually allow to change the crc source 2020-01-28 16:49:22 +01:00
drm_dma.c drm: delete drm_pci.h 2020-04-03 17:11:41 +02:00
drm_dp_aux_dev.c
drm_dp_cec.c
drm_dp_dual_mode_helper.c
drm_dp_helper.c drm: report dp downstream port type as a subconnector property 2020-08-11 14:06:04 +02:00
drm_dp_mst_topology.c drm: fix drm_dp_mst_port refcount leaks in drm_dp_mst_allocate_vcpi 2020-08-04 12:21:11 -04:00
drm_dp_mst_topology_internal.h
drm_drv.c drm: Remove redundant NULL check 2020-07-27 22:06:13 +02:00
drm_dsc.c
drm_dumb_buffers.c
drm_edid.c drm next for 5.9-rc1 2020-08-05 19:50:06 -07:00
drm_edid_load.c
drm_encoder.c
drm_encoder_slave.c drm: encoder_slave: use new I2C API 2020-06-19 09:20:21 +02:00
drm_fb_cma_helper.c drm: Fix misspellings of "Analog Devices" 2020-04-21 08:15:03 +02:00
drm_fb_helper.c Linux 5.8 2020-08-11 11:58:31 +10:00
drm_file.c drm : Insert blank lines after declarations. 2020-07-02 15:26:00 +02:00
drm_flip_work.c
drm_format_helper.c drm/format-helper: Add drm_fb_swab() 2020-05-26 13:33:08 +02:00
drm_fourcc.c drm: drm_fourcc: add NV15, Q410, Q401 YUV formats 2020-06-19 13:33:40 +01:00
drm_framebuffer.c drm : Insert blank lines after declarations. 2020-07-02 15:26:00 +02:00
drm_gem.c * backmerge from drm-fixes at v5.8-rc7 2020-08-11 12:00:30 +10:00
drm_gem_cma_helper.c drm: core: Convert device logging to drm_* functions. 2020-07-20 09:34:24 +02:00
drm_gem_framebuffer_helper.c drm: remove _unlocked suffix in drm_gem_object_put_unlocked 2020-05-19 22:31:31 +01:00
drm_gem_shmem_helper.c drm/shmem-helper: Only dma-buf imports are private obj 2020-06-16 19:11:51 +02:00
drm_gem_ttm_helper.c drm: remove _unlocked suffix in drm_gem_object_put_unlocked 2020-05-19 22:31:31 +01:00
drm_gem_vram_helper.c drm/ttm: init mem->bus in common code. 2020-08-24 17:00:48 +10:00
drm_hashtab.c
drm_hdcp.c drm: Fix HDCP failures when SRM fw is missing 2020-05-05 14:01:53 -04:00
drm_internal.h drm/vblank: Add vblank works 2020-07-16 18:16:31 -04:00
drm_ioc32.c drm : Insert blank lines after declarations. 2020-07-02 15:26:00 +02:00
drm_ioctl.c drm-misc-next for v5.9: 2020-06-24 15:45:51 +10:00
drm_irq.c drm: use drm_dev_has_vblank more 2020-05-29 12:58:11 +02:00
drm_kms_helper_common.c
drm_lease.c drm : Insert blank lines after declarations. 2020-07-02 15:26:00 +02:00
drm_legacy.h
drm_legacy_misc.c
drm_lock.c drm : Insert blank lines after declarations. 2020-07-02 15:26:00 +02:00
drm_managed.c drm: Include internal header for managed function declarations 2020-05-18 16:27:54 +01:00
drm_memory.c
drm_mipi_dbi.c Linux 5.8 2020-08-11 11:58:31 +10:00
drm_mipi_dsi.c drm: mipi-dsi: Convert logging to drm_* functions. 2020-07-10 20:21:45 +02:00
drm_mm.c drm/mm: cleanup and improve next_hole_*_addr() 2020-06-23 15:46:40 +02:00
drm_mode_config.c drm : Insert blank lines after declarations. 2020-07-02 15:26:00 +02:00
drm_mode_object.c drm: Replace drm_modeset_lock/unlock_all with DRM_MODESET_LOCK_ALL_* helpers 2020-05-05 10:51:56 +02:00
drm_modes.c drm: Replace HTTP links with HTTPS ones 2020-07-20 11:47:28 +02:00
drm_modeset_helper.c
drm_modeset_lock.c
drm_of.c Linux 5.8 2020-08-11 11:58:31 +10:00
drm_panel.c drm/panel: Add helper for reading DT rotation 2020-08-16 17:12:18 +02:00
drm_panel_orientation_quirks.c drm: Added orientation quirk for ASUS tablet model T103HAF 2020-08-04 11:45:23 +02:00
drm_pci.c drm : Insert blank lines after declarations. 2020-07-02 15:26:00 +02:00
drm_plane.c drm : Insert blank lines after declarations. 2020-07-02 15:26:00 +02:00
drm_plane_helper.c
drm_prime.c drm : Insert blank lines after declarations. 2020-07-02 15:26:00 +02:00
drm_print.c
drm_probe_helper.c Merge tag 'drm-intel-next-2020-07-15' of git://anongit.freedesktop.org/drm/drm-intel into drm-next 2020-07-31 14:42:37 +10:00
drm_property.c
drm_rect.c
drm_scatter.c gpu/drm: remove the powerpc hack in drm_legacy_sg_alloc 2020-06-02 10:59:11 -07:00
drm_scdc_helper.c
drm_self_refresh_helper.c
drm_simple_kms_helper.c drm/simple-kms: Fix documentation for drm_simple_encoder_init() 2020-03-06 09:24:29 +01:00
drm_syncobj.c drm/syncobj: Tune down unordered timeline DRM_ERROR 2020-08-02 15:22:31 +02:00
drm_sysfs.c drm/connector: notify userspace on hotplug after register complete 2020-06-03 10:24:23 +02:00
drm_trace.h
drm_trace_points.c
drm_vblank.c drm/vblank: Use spin_(un)lock_irq() in drm_crtc_queue_sequence_ioctl() 2020-07-21 11:08:35 -04:00
drm_vblank_work.c This tree adds the sched_set_fifo*() encapsulation APIs to remove 2020-08-06 11:55:43 -07:00
drm_vm.c drm-misc-next for v5.9: 2020-06-24 15:45:51 +10:00
drm_vma_manager.c
drm_writeback.c drm/writeback: don't set fence->ops to default 2020-05-20 20:03:45 +02:00