Re: [Intel-gfx] [PULL] drm-intel-next

2019-02-03 Thread Dave Airlie
On Sat, 2 Feb 2019 at 18:29, Rodrigo Vivi  wrote:
>
> Hi Dave and Daniel,
>
> Here goes another pull request for 5.1.

dim complained:

Chris committed this without an S-O-B, now because it's all Intel this
probably doesn't matter, so I'll pull it, put please try and let it
not happen again.

Dave.

commit 8e525cb4a622148fbe30134ee3a1a34ad839a43a
Author: Tvrtko Ursulin 
Commit: Chris Wilson 

drm/i915/execlists: Move RPCS setup to context pin

Configuring RPCS in context image just before pin is sufficient and will
come extra handy in one of the following patches.

v2:
 * Split image setup a bit differently. (Chris Wilson)

v3:
 * Update context image after reset as well - otherwise the application
   of pinned default state clears the RPCS.

v4:
 * Use local variable throughout the function. (Chris Wilson)

Signed-off-by: Tvrtko Ursulin 
Suggested-by: Chris Wilson 
Cc: Chris Wilson 
Reviewed-by: Chris Wilson 
Reviewed-by: Joonas Lahtinen 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20190125023005.1007-1-ch...@chris-wilson.co.uk

>
> Maybe I will still send another next week.
>
> This pull also include a GVT one with:
> "
> Here is gvt-next stuff. This includes Coffeelake support for GVT,
> making kvmgt as self load module to have better dependence with
> vfio/mdev, with some const treatment and kernel type change.
> "
>
> And also it includes a drm change for constify drm_color_lut_check.
>
> Rest of details are on the tags below.
>
> drm-intel-next-2019-02-02:
> - Make background color and LUT more robust (Matt)
> - Icelake display fixes (Ville, Imre)
> - Workarounds fixes and reorg (Tvrtko, Talha)
> - Enable fastboot by default on VLV and CHV (Hans)
> - Add another PCI ID for Coffee Lake (Rodrigo)
>
> drm-intel-next-2019-01-29:
> - MOCS table rework for simplification and to add ICL (Lucas, Tomasz)
> - Move RPCS setup to context pin (Tvrtko)
> - Breadcrumb simplification and GPU Reset improvements (Chris)
> - Many fixes for TV modeset (Ville)
> - Clean up on atomic plane checks (Ville)
> - NV12 pich check fix (Raviraj)
> - Disable -Wuninitialized (Nathan)
> - Sanitize DPLL state for broken BIOSes on SNB (Ville)
> - Rework on vma locking and counting and introduce a concept of per-timeline
>   HWSP (Chris)
> - Enable fastboot by default on Skylake and newer platforms (Hans)
> - Fix slk srckey mask bits (Ville)
> - Selftests fixes (Chris)
> - Execlists and preemption improvements and fixes (Chris)
> - drm consitify drm_color_lut_check (Ville)
> - Ice Lake clock fixes (Lucas)
>
> Thanks,
> Rodrigo.
>
> The following changes since commit 85baa5dbf79163026dcb78f742294c522e176432:
>
>   drm/i915: Update DRIVER_DATE to 20190124 (2019-01-24 15:00:59 -0800)
>
> are available in the Git repository at:
>
>   git://anongit.freedesktop.org/drm/drm-intel tags/drm-intel-next-2019-02-02
>
> for you to fetch changes up to 46c0cd8c562bc3e4a99cbaa4ba0904b6871b7b4b:
>
>   drm/i915: Update DRIVER_DATE to 20190202 (2019-02-02 00:14:28 -0800)
>
> 
> - Make background color and LUT more robust (Matt)
> - Icelake display fixes (Ville, Imre)
> - Workarounds fixes and reorg (Tvrtko, Talha)
> - Enable fastboot by default on VLV and CHV (Hans)
> - Add another PCI ID for Coffee Lake (Rodrigo)
>
> 
> Chris Wilson (27):
>   drm/i915: Measure the required reserved size for request emission
>   drm/i915: Remove manual breadcumb counting
>   drm/i915: Compute the HWS offsets explicitly
>   drm/i915: Make all GPU resets atomic
>   drm/i915/guc: Disable global reset
>   drm/i915: Remove GPU reset dependence on struct_mutex
>   drm/i915/selftests: Trim struct_mutex duration for set-wedged selftest
>   drm/i915: Issue engine resets onto idle engines
>   drm/i915: Wait for a moment before forcibly resetting the device
>   drm/i915: Stop tracking MRU activity on VMA
>   drm/i915: Pull VM lists under the VM mutex.
>   drm/i915: Move vma lookup to its own lock
>   drm/i915: Always allocate an object/vma for the HWSP
>   drm/i915: Move list of timelines under its own lock
>   drm/i915: Introduce concept of per-timeline (context) HWSP
>   drm/i915: Enlarge vma->pin_count
>   drm/i915: Allocate a status page for each timeline
>   drm/i915: Share per-timeline HWSP using a slab suballocator
>   drm/i915: Track the context's seqno in its own timeline HWSP
>   drm/i915: Track active timelines
>   drm/i915/selftests: Apply a subtest filter
>   drm/i915: Identify active requests
>   drm/i915: Rename execlists->queue_priority to queue_priority_hint
>   drm/i915/execlists: Suppress preempting self
>   drm/i915: Remove the intel_engine_notify tracepoint
>   drm/i915: Replace global breadcrumbs with per-context interrupt tracking
>   drm/i915: Drop fake 

[Intel-gfx] ✓ Fi.CI.IGT: success for drm/drv: Remove drm_dev_unplug()

2019-02-03 Thread Patchwork
== Series Details ==

Series: drm/drv: Remove drm_dev_unplug()
URL   : https://patchwork.freedesktop.org/series/56153/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5530_full -> Patchwork_12122_full


Summary
---

  **SUCCESS**

  No regressions found.

  

Known issues


  Here are the changes found in Patchwork_12122_full that come from known 
issues:

### IGT changes ###

 Issues hit 

  * igt@i915_suspend@shrink:
- shard-apl:  NOTRUN -> DMESG-WARN [fdo#107886] / [fdo#109244]

  * igt@kms_available_modes_crc@available_mode_test_crc:
- shard-glk:  PASS -> FAIL [fdo#106641]

  * igt@kms_busy@extended-pageflip-hang-newfb-render-b:
- shard-apl:  NOTRUN -> DMESG-WARN [fdo#107956]

  * igt@kms_cursor_crc@cursor-256x256-dpms:
- shard-apl:  PASS -> FAIL [fdo#103232]

  * igt@kms_cursor_crc@cursor-64x64-sliding:
- shard-glk:  PASS -> FAIL [fdo#103232] +1

  * igt@kms_flip@wf_vblank-ts-check:
- shard-apl:  PASS -> INCOMPLETE [fdo#103927]

  * igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-mmap-gtt:
- shard-apl:  PASS -> FAIL [fdo#103167]

  * igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-wc:
- shard-glk:  PASS -> FAIL [fdo#103167] +2

  * igt@kms_plane_alpha_blend@pipe-c-alpha-7efc:
- shard-kbl:  NOTRUN -> FAIL [fdo#108145] / [fdo#108590]
- shard-apl:  NOTRUN -> FAIL [fdo#108145] +2

  * igt@kms_plane_multiple@atomic-pipe-a-tiling-x:
- shard-glk:  PASS -> FAIL [fdo#103166]

  * igt@kms_plane_multiple@atomic-pipe-a-tiling-y:
- shard-apl:  PASS -> FAIL [fdo#103166]

  
 Possible fixes 

  * igt@kms_busy@extended-modeset-hang-newfb-render-a:
- shard-hsw:  DMESG-WARN [fdo#107956] -> PASS

  * igt@kms_busy@extended-pageflip-hang-oldfb-render-b:
- shard-apl:  DMESG-WARN [fdo#103558] / [fdo#105602] -> PASS

  * igt@kms_color@pipe-b-ctm-max:
- shard-apl:  FAIL [fdo#108147] -> PASS

  * igt@kms_cursor_crc@cursor-128x42-random:
- shard-glk:  INCOMPLETE [fdo#103359] / [k.org#198133] -> PASS

  * igt@kms_cursor_crc@cursor-256x85-onscreen:
- shard-apl:  FAIL [fdo#103232] -> PASS +7
- shard-glk:  FAIL [fdo#103232] -> PASS +2

  * igt@kms_cursor_crc@cursor-64x64-suspend:
- shard-apl:  FAIL [fdo#103191] / [fdo#103232] -> PASS +1

  * igt@kms_flip@flip-vs-expired-vblank:
- shard-glk:  FAIL [fdo#102887] / [fdo#105363] -> PASS

  * igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-pwrite:
- shard-apl:  FAIL [fdo#103167] -> PASS +2

  * igt@kms_frontbuffer_tracking@fbc-2p-primscrn-spr-indfb-draw-mmap-wc:
- shard-glk:  FAIL [fdo#103167] -> PASS +3

  * igt@kms_frontbuffer_tracking@fbc-2p-rte:
- shard-glk:  FAIL [fdo#103167] / [fdo#105682] -> PASS

  * igt@kms_plane@pixel-format-pipe-a-planes-source-clamping:
- shard-glk:  FAIL [fdo#108948] -> PASS

  * igt@kms_plane@pixel-format-pipe-b-planes:
- shard-apl:  FAIL [fdo#103166] -> PASS

  * igt@kms_plane_multiple@atomic-pipe-c-tiling-none:
- shard-glk:  FAIL [fdo#103166] -> PASS +3

  * igt@kms_setmode@basic:
- shard-kbl:  FAIL [fdo#99912] -> PASS

  
  {name}: This element is suppressed. This means it is ignored when computing
  the status of the difference (SUCCESS, WARNING, or FAILURE).

  [fdo#102887]: https://bugs.freedesktop.org/show_bug.cgi?id=102887
  [fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166
  [fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
  [fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
  [fdo#103232]: https://bugs.freedesktop.org/show_bug.cgi?id=103232
  [fdo#103359]: https://bugs.freedesktop.org/show_bug.cgi?id=103359
  [fdo#103558]: https://bugs.freedesktop.org/show_bug.cgi?id=103558
  [fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
  [fdo#105363]: https://bugs.freedesktop.org/show_bug.cgi?id=105363
  [fdo#105602]: https://bugs.freedesktop.org/show_bug.cgi?id=105602
  [fdo#105682]: https://bugs.freedesktop.org/show_bug.cgi?id=105682
  [fdo#106641]: https://bugs.freedesktop.org/show_bug.cgi?id=106641
  [fdo#107886]: https://bugs.freedesktop.org/show_bug.cgi?id=107886
  [fdo#107956]: https://bugs.freedesktop.org/show_bug.cgi?id=107956
  [fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
  [fdo#108147]: https://bugs.freedesktop.org/show_bug.cgi?id=108147
  [fdo#108590]: https://bugs.freedesktop.org/show_bug.cgi?id=108590
  [fdo#108948]: https://bugs.freedesktop.org/show_bug.cgi?id=108948
  [fdo#109244]: https://bugs.freedesktop.org/show_bug.cgi?id=109244
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
  [fdo#99912]: 

[Intel-gfx] ✓ Fi.CI.BAT: success for drm/drv: Remove drm_dev_unplug()

2019-02-03 Thread Patchwork
== Series Details ==

Series: drm/drv: Remove drm_dev_unplug()
URL   : https://patchwork.freedesktop.org/series/56153/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5530 -> Patchwork_12122


Summary
---

  **SUCCESS**

  No regressions found.

  External URL: 
https://patchwork.freedesktop.org/api/1.0/series/56153/revisions/1/mbox/

Known issues


  Here are the changes found in Patchwork_12122 that come from known issues:

### IGT changes ###

 Issues hit 

  * igt@i915_selftest@live_execlists:
- fi-apl-guc: PASS -> INCOMPLETE [fdo#103927]

  * igt@kms_busy@basic-flip-b:
- fi-gdg-551: PASS -> FAIL [fdo#103182]

  
 Possible fixes 

  * igt@i915_selftest@live_hangcheck:
- {fi-icl-u3}:INCOMPLETE [fdo#108569] -> PASS

  * igt@kms_busy@basic-flip-a:
- fi-gdg-551: FAIL [fdo#103182] -> PASS

  * igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
- fi-byt-clapper: FAIL [fdo#103191] / [fdo#107362] -> PASS +1

  
  {name}: This element is suppressed. This means it is ignored when computing
  the status of the difference (SUCCESS, WARNING, or FAILURE).

  [fdo#103182]: https://bugs.freedesktop.org/show_bug.cgi?id=103182
  [fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
  [fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
  [fdo#105998]: https://bugs.freedesktop.org/show_bug.cgi?id=105998
  [fdo#107362]: https://bugs.freedesktop.org/show_bug.cgi?id=107362
  [fdo#108569]: https://bugs.freedesktop.org/show_bug.cgi?id=108569
  [fdo#108622]: https://bugs.freedesktop.org/show_bug.cgi?id=108622
  [fdo#109276]: https://bugs.freedesktop.org/show_bug.cgi?id=109276
  [fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
  [fdo#109284]: https://bugs.freedesktop.org/show_bug.cgi?id=109284
  [fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
  [fdo#109289]: https://bugs.freedesktop.org/show_bug.cgi?id=109289
  [fdo#109294]: https://bugs.freedesktop.org/show_bug.cgi?id=109294
  [fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
  [fdo#109527]: https://bugs.freedesktop.org/show_bug.cgi?id=109527
  [fdo#109528]: https://bugs.freedesktop.org/show_bug.cgi?id=109528
  [fdo#109530]: https://bugs.freedesktop.org/show_bug.cgi?id=109530


Participating hosts (46 -> 44)
--

  Additional (1): fi-icl-y 
  Missing(3): fi-ilk-m540 fi-byt-squawks fi-bsw-cyan 


Build changes
-

* Linux: CI_DRM_5530 -> Patchwork_12122

  CI_DRM_5530: 172243f0dd47614186ed35cba3a001ab9c2ad00a @ 
git://anongit.freedesktop.org/gfx-ci/linux
  IGT_4804: 0b9ac934a6aad9ed5c1fdfd48d2b0faa10bfbbc4 @ 
git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_12122: ae4d00bc6397b304dd464f5d3067674c02e029e9 @ 
git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

ae4d00bc6397 drm/drv: Remove drm_dev_unplug()
cb65ca53743b drm/xen: Use drm_dev_unregister()
35b3891a748a drm/udl: Use drm_dev_unregister()
e21d21016df4 drm/amd: Use drm_dev_unregister()
f7989771f688 drm/drv: Prepare to remove drm_dev_unplug()
31c4690158a7 drm: Fix drm_release() and device unplug

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12122/
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 4/6] drm/udl: Use drm_dev_unregister()

2019-02-03 Thread Noralf Trønnes
drm_dev_unplug() has been stripped down and is going away. Open code its
2 remaining function calls.

Cc: Dave Airlie 
Cc: Sean Paul 
Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/udl/udl_drv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/udl/udl_drv.c b/drivers/gpu/drm/udl/udl_drv.c
index 22cd2d13e272..063e8e1e2641 100644
--- a/drivers/gpu/drm/udl/udl_drv.c
+++ b/drivers/gpu/drm/udl/udl_drv.c
@@ -106,7 +106,8 @@ static void udl_usb_disconnect(struct usb_interface 
*interface)
drm_kms_helper_poll_disable(dev);
udl_fbdev_unplug(dev);
udl_drop_usb(dev);
-   drm_dev_unplug(dev);
+   drm_dev_unregister(dev);
+   drm_dev_put(dev);
 }
 
 /*
-- 
2.20.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 1/6] drm: Fix drm_release() and device unplug

2019-02-03 Thread Noralf Trønnes
If userspace has open fd(s) when drm_dev_unplug() is run, it will result
in drm_dev_unregister() being called twice. First in drm_dev_unplug() and
then later in drm_release() through the call to drm_put_dev().

Since userspace already holds a ref on drm_device through the drm_minor,
it's not necessary to add extra ref counting based on no open file
handles. Instead just drm_dev_put() unconditionally in drm_dev_unplug().

We now has this:
- Userpace holds a ref on drm_device as long as there's open fd(s)
- The driver holds a ref on drm_device as long as it's bound to the
  struct device

When both sides are done with drm_device, it is released.

Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/drm_drv.c  | 6 +-
 drivers/gpu/drm/drm_file.c | 6 ++
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 381581b01d48..05bbc2b622fc 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -376,11 +376,7 @@ void drm_dev_unplug(struct drm_device *dev)
synchronize_srcu(_unplug_srcu);
 
drm_dev_unregister(dev);
-
-   mutex_lock(_global_mutex);
-   if (dev->open_count == 0)
-   drm_dev_put(dev);
-   mutex_unlock(_global_mutex);
+   drm_dev_put(dev);
 }
 EXPORT_SYMBOL(drm_dev_unplug);
 
diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c
index 46f48f245eb5..3f20f598cd7c 100644
--- a/drivers/gpu/drm/drm_file.c
+++ b/drivers/gpu/drm/drm_file.c
@@ -479,11 +479,9 @@ int drm_release(struct inode *inode, struct file *filp)
 
drm_file_free(file_priv);
 
-   if (!--dev->open_count) {
+   if (!--dev->open_count)
drm_lastclose(dev);
-   if (drm_dev_is_unplugged(dev))
-   drm_put_dev(dev);
-   }
+
mutex_unlock(_global_mutex);
 
drm_minor_release(minor);
-- 
2.20.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 5/6] drm/xen: Use drm_dev_unregister()

2019-02-03 Thread Noralf Trønnes
drm_dev_unplug() has been stripped down and is going away. Open code its
2 remaining function calls.

Also remove the drm_dev_is_unplugged() check since this can't be true
before drm_dev_unregister() is called which happens after the check.

Cc: Oleksandr Andrushchenko 
Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/xen/xen_drm_front.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/xen/xen_drm_front.c 
b/drivers/gpu/drm/xen/xen_drm_front.c
index 3e78a832d7f9..5c5eb24c6342 100644
--- a/drivers/gpu/drm/xen/xen_drm_front.c
+++ b/drivers/gpu/drm/xen/xen_drm_front.c
@@ -576,12 +576,9 @@ static void xen_drm_drv_fini(struct xen_drm_front_info 
*front_info)
if (!dev)
return;
 
-   /* Nothing to do if device is already unplugged */
-   if (drm_dev_is_unplugged(dev))
-   return;
-
drm_kms_helper_poll_fini(dev);
-   drm_dev_unplug(dev);
+   drm_dev_unregister(dev);
+   drm_dev_put(dev);
 
front_info->drm_info = NULL;
 
-- 
2.20.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 6/6] drm/drv: Remove drm_dev_unplug()

2019-02-03 Thread Noralf Trønnes
There are no users left.

Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/drm_drv.c | 17 -
 include/drm/drm_drv.h |  1 -
 2 files changed, 18 deletions(-)

diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index e0941200edc6..87210d4a9e53 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -354,23 +354,6 @@ void drm_dev_exit(int idx)
 }
 EXPORT_SYMBOL(drm_dev_exit);
 
-/**
- * drm_dev_unplug - unplug a DRM device
- * @dev: DRM device
- *
- * This unplugs a hotpluggable DRM device, which makes it inaccessible to
- * userspace operations. Entry-points can use drm_dev_enter() and
- * drm_dev_exit() to protect device resources in a race free manner. This
- * essentially unregisters the device like drm_dev_unregister(), but can be
- * called while there are still open users of @dev.
- */
-void drm_dev_unplug(struct drm_device *dev)
-{
-   drm_dev_unregister(dev);
-   drm_dev_put(dev);
-}
-EXPORT_SYMBOL(drm_dev_unplug);
-
 /*
  * DRM internal mount
  * We want to be able to allocate our own "struct address_space" to control
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index c50696c82a42..b8765a6fc092 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -730,7 +730,6 @@ void drm_dev_put(struct drm_device *dev);
 void drm_put_dev(struct drm_device *dev);
 bool drm_dev_enter(struct drm_device *dev, int *idx);
 void drm_dev_exit(int idx);
-void drm_dev_unplug(struct drm_device *dev);
 
 /**
  * drm_dev_is_unplugged - is a DRM device unplugged
-- 
2.20.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 0/6] drm/drv: Remove drm_dev_unplug()

2019-02-03 Thread Noralf Trønnes
This series removes drm_dev_unplug() and moves the unplugged state
setting to drm_dev_unregister(). All drivers will now have access to the
unplugged state if they so desire.

The drm_device ref handling wrt to the last fd closed after unregister
have been simplified, which also fixed a double drm_dev_unregister()
situation.

Noralf.

Noralf Trønnes (6):
  drm: Fix drm_release() and device unplug
  drm/drv: Prepare to remove drm_dev_unplug()
  drm/amd: Use drm_dev_unregister()
  drm/udl: Use drm_dev_unregister()
  drm/xen: Use drm_dev_unregister()
  drm/drv: Remove drm_dev_unplug()

 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c |  3 +-
 drivers/gpu/drm/drm_drv.c   | 48 -
 drivers/gpu/drm/drm_file.c  |  6 ++--
 drivers/gpu/drm/udl/udl_drv.c   |  3 +-
 drivers/gpu/drm/xen/xen_drm_front.c |  7 ++--
 include/drm/drm_drv.h   | 11 +++---
 6 files changed, 27 insertions(+), 51 deletions(-)

-- 
2.20.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 2/6] drm/drv: Prepare to remove drm_dev_unplug()

2019-02-03 Thread Noralf Trønnes
The only thing now that makes drm_dev_unplug() special is that it sets
drm_device->unplugged. Move this code to drm_dev_unregister() so that we
can remove drm_dev_unplug().

Signed-off-by: Noralf Trønnes 
---

Maybe s/unplugged/unregistered/ ?

I looked at drm_device->registered, but using that would mean that
drm_dev_is_unplugged() would return before drm_device is registered.
And given that its current purpose is to prevent race against connector
registration, I stayed away from it.

Noralf.


 drivers/gpu/drm/drm_drv.c | 27 +++
 include/drm/drm_drv.h | 10 --
 2 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 05bbc2b622fc..e0941200edc6 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -366,15 +366,6 @@ EXPORT_SYMBOL(drm_dev_exit);
  */
 void drm_dev_unplug(struct drm_device *dev)
 {
-   /*
-* After synchronizing any critical read section is guaranteed to see
-* the new value of ->unplugged, and any critical section which might
-* still have seen the old value of ->unplugged is guaranteed to have
-* finished.
-*/
-   dev->unplugged = true;
-   synchronize_srcu(_unplug_srcu);
-
drm_dev_unregister(dev);
drm_dev_put(dev);
 }
@@ -832,11 +823,14 @@ EXPORT_SYMBOL(drm_dev_register);
  * drm_dev_register() but does not deallocate the device. The caller must call
  * drm_dev_put() to drop their final reference.
  *
- * A special form of unregistering for hotpluggable devices is 
drm_dev_unplug(),
- * which can be called while there are still open users of @dev.
+ * This function can be called while there are still open users of @dev as long
+ * as the driver protects its device resources using drm_dev_enter() and
+ * drm_dev_exit().
  *
  * This should be called first in the device teardown code to make sure
- * userspace can't access the device instance any more.
+ * userspace can't access the device instance any more. Drivers that support
+ * device unplug will probably want to call drm_atomic_helper_shutdown() first
+ * in order to disable the hardware on regular driver module unload.
  */
 void drm_dev_unregister(struct drm_device *dev)
 {
@@ -845,6 +839,15 @@ void drm_dev_unregister(struct drm_device *dev)
if (drm_core_check_feature(dev, DRIVER_LEGACY))
drm_lastclose(dev);
 
+   /*
+* After synchronizing any critical read section is guaranteed to see
+* the new value of ->unplugged, and any critical section which might
+* still have seen the old value of ->unplugged is guaranteed to have
+* finished.
+*/
+   dev->unplugged = true;
+   synchronize_srcu(_unplug_srcu);
+
dev->registered = false;
 
drm_client_dev_unregister(dev);
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index ca46a45a9cce..c50696c82a42 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -736,13 +736,11 @@ void drm_dev_unplug(struct drm_device *dev);
  * drm_dev_is_unplugged - is a DRM device unplugged
  * @dev: DRM device
  *
- * This function can be called to check whether a hotpluggable is unplugged.
- * Unplugging itself is singalled through drm_dev_unplug(). If a device is
- * unplugged, these two functions guarantee that any store before calling
- * drm_dev_unplug() is visible to callers of this function after it completes
+ * This function can be called to check whether @dev is unregistered. This can
+ * be used to detect that the underlying parent device is gone.
  *
- * WARNING: This function fundamentally races against drm_dev_unplug(). It is
- * recommended that drivers instead use the underlying drm_dev_enter() and
+ * WARNING: This function fundamentally races against drm_dev_unregister(). It
+ * is recommended that drivers instead use the underlying drm_dev_enter() and
  * drm_dev_exit() function pairs.
  */
 static inline bool drm_dev_is_unplugged(struct drm_device *dev)
-- 
2.20.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 3/6] drm/amd: Use drm_dev_unregister()

2019-02-03 Thread Noralf Trønnes
drm_dev_unplug() has been stripped down and is going away. Open code its
2 remaining function calls.

Cc: Alex Deucher 
Cc: Christian König 
Cc: David (ChunMing) Zhou 
Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index a1bb3773087b..1265fc07120a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -970,7 +970,8 @@ amdgpu_pci_remove(struct pci_dev *pdev)
struct drm_device *dev = pci_get_drvdata(pdev);
 
DRM_ERROR("Device removal is currently not supported outside of 
fbcon\n");
-   drm_dev_unplug(dev);
+   drm_dev_unregister(dev);
+   drm_dev_put(dev);
pci_disable_device(pdev);
pci_set_drvdata(pdev, NULL);
 }
-- 
2.20.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx