<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-stable.git/drivers/gpu/drm, branch v4.4.196</title>
<subtitle>Linux kernel stable tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/'/>
<entry>
<title>gpu: drm: radeon: Fix a possible null-pointer dereference in radeon_connector_set_property()</title>
<updated>2019-10-07T19:00:59+00:00</updated>
<author>
<name>Jia-Ju Bai</name>
<email>baijiaju1990@gmail.com</email>
</author>
<published>2019-07-29T08:36:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=3c803c1552920d689177874bb49c7610fd7fdc9b'/>
<id>3c803c1552920d689177874bb49c7610fd7fdc9b</id>
<content type='text'>
[ Upstream commit f3eb9b8f67bc28783eddc142ad805ebdc53d6339 ]

In radeon_connector_set_property(), there is an if statement on line 743
to check whether connector-&gt;encoder is NULL:
    if (connector-&gt;encoder)

When connector-&gt;encoder is NULL, it is used on line 755:
    if (connector-&gt;encoder-&gt;crtc)

Thus, a possible null-pointer dereference may occur.

To fix this bug, connector-&gt;encoder is checked before being used.

This bug is found by a static analysis tool STCheck written by us.

Signed-off-by: Jia-Ju Bai &lt;baijiaju1990@gmail.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit f3eb9b8f67bc28783eddc142ad805ebdc53d6339 ]

In radeon_connector_set_property(), there is an if statement on line 743
to check whether connector-&gt;encoder is NULL:
    if (connector-&gt;encoder)

When connector-&gt;encoder is NULL, it is used on line 755:
    if (connector-&gt;encoder-&gt;crtc)

Thus, a possible null-pointer dereference may occur.

To fix this bug, connector-&gt;encoder is checked before being used.

This bug is found by a static analysis tool STCheck written by us.

Signed-off-by: Jia-Ju Bai &lt;baijiaju1990@gmail.com&gt;
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>drm: Flush output polling on shutdown</title>
<updated>2019-10-05T10:27:40+00:00</updated>
<author>
<name>Chris Wilson</name>
<email>chris@chris-wilson.co.uk</email>
</author>
<published>2019-06-03T13:58:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=736a524bf6efe6fc324609fe49ded340049df4de'/>
<id>736a524bf6efe6fc324609fe49ded340049df4de</id>
<content type='text'>
[ Upstream commit 3b295cb1a411d9c82bbfaa66bc17a8508716ed07 ]

We need to mark the output polling as disabled to prevent concurrent
irqs from queuing new work as shutdown the probe -- causing that work to
execute after we have freed the structs:

&lt;4&gt; [341.846490] DEBUG_LOCKS_WARN_ON(mutex_is_locked(lock))
&lt;4&gt; [341.846497] WARNING: CPU: 3 PID: 3300 at kernel/locking/mutex-debug.c:103 mutex_destroy+0x49/0x50
&lt;4&gt; [341.846508] Modules linked in: i915(-) vgem thunderbolt snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic mei_hdcp x86_pkg_temp_thermal coretemp crct10dif_pclmul crc32_pclmul ghash_clmulni_intel snd_hda_codec snd_hwdep snd_hda_core snd_pcm mcs7830 btusb usbnet btrtl mii btbcm btintel bluetooth ecdh_generic ecc mei_me mei prime_numbers i2c_hid pinctrl_sunrisepoint pinctrl_intel [last unloaded: i915]
&lt;4&gt; [341.846546] CPU: 3 PID: 3300 Comm: i915_module_loa Tainted: G     U            5.2.0-rc2-CI-CI_DRM_6175+ #1
&lt;4&gt; [341.846553] Hardware name: Dell Inc. XPS 13 9360/0823VW, BIOS 2.9.0 07/09/2018
&lt;4&gt; [341.846560] RIP: 0010:mutex_destroy+0x49/0x50
&lt;4&gt; [341.846565] Code: 00 00 5b c3 e8 a8 9f 3b 00 85 c0 74 ed 8b 05 3e 55 23 01 85 c0 75 e3 48 c7 c6 00 d0 08 82 48 c7 c7 a8 aa 07 82 e8 e7 08 fa ff &lt;0f&gt; 0b eb cc 0f 1f 00 48 b8 11 11 11 11 11 11 11 11 48 89 76 20 48
&lt;4&gt; [341.846578] RSP: 0018:ffffc900006cfdb0 EFLAGS: 00010286
&lt;4&gt; [341.846583] RAX: 0000000000000000 RBX: ffff88826759a168 RCX: 0000000000000000
&lt;4&gt; [341.846589] RDX: 0000000000000002 RSI: 0000000000000000 RDI: ffffffff8112844c
&lt;4&gt; [341.846595] RBP: ffff8882708fa548 R08: 0000000000000000 R09: 0000000000039600
&lt;4&gt; [341.846601] R10: 0000000000000000 R11: 0000000000000ce4 R12: ffffffffa07de1e0
&lt;4&gt; [341.846607] R13: 0000000000000000 R14: 0000000000000000 R15: ffffffffa07de2d0
&lt;4&gt; [341.846613] FS:  00007f62b5ae0e40(0000) GS:ffff888276380000(0000) knlGS:0000000000000000
&lt;4&gt; [341.846620] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
&lt;4&gt; [341.846626] CR2: 000055a4e064f4a0 CR3: 0000000266b16006 CR4: 00000000003606e0
&lt;4&gt; [341.846632] Call Trace:
&lt;4&gt; [341.846639]  drm_fb_helper_fini.part.17+0xb3/0x100
&lt;4&gt; [341.846682]  intel_fbdev_fini+0x20/0x80 [i915]
&lt;4&gt; [341.846722]  intel_modeset_cleanup+0x9a/0x140 [i915]
&lt;4&gt; [341.846750]  i915_driver_unload+0xa3/0x100 [i915]
&lt;4&gt; [341.846778]  i915_pci_remove+0x19/0x30 [i915]
&lt;4&gt; [341.846784]  pci_device_remove+0x36/0xb0
&lt;4&gt; [341.846790]  device_release_driver_internal+0xd3/0x1b0
&lt;4&gt; [341.846795]  driver_detach+0x3f/0x80
&lt;4&gt; [341.846800]  bus_remove_driver+0x53/0xd0
&lt;4&gt; [341.846805]  pci_unregister_driver+0x25/0xa0
&lt;4&gt; [341.846843]  i915_exit+0x16/0x1c [i915]
&lt;4&gt; [341.846849]  __se_sys_delete_module+0x162/0x210
&lt;4&gt; [341.846855]  ? trace_hardirqs_off_thunk+0x1a/0x1c
&lt;4&gt; [341.846859]  ? do_syscall_64+0xd/0x1c0
&lt;4&gt; [341.846864]  do_syscall_64+0x55/0x1c0
&lt;4&gt; [341.846869]  entry_SYSCALL_64_after_hwframe+0x49/0xbe
&lt;4&gt; [341.846875] RIP: 0033:0x7f62b51871b7
&lt;4&gt; [341.846881] Code: 73 01 c3 48 8b 0d d1 8c 2c 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 b8 b0 00 00 00 0f 05 &lt;48&gt; 3d 01 f0 ff ff 73 01 c3 48 8b 0d a1 8c 2c 00 f7 d8 64 89 01 48
&lt;4&gt; [341.846897] RSP: 002b:00007ffe7a227138 EFLAGS: 00000206 ORIG_RAX: 00000000000000b0
&lt;4&gt; [341.846904] RAX: ffffffffffffffda RBX: 00007ffe7a2272b0 RCX: 00007f62b51871b7
&lt;4&gt; [341.846910] RDX: 0000000000000001 RSI: 0000000000000800 RDI: 0000557cd6b55948
&lt;4&gt; [341.846916] RBP: 0000557cd6b558e0 R08: 0000557cd6b5594c R09: 00007ffe7a227160
&lt;4&gt; [341.846922] R10: 00007ffe7a226134 R11: 0000000000000206 R12: 0000000000000000
&lt;4&gt; [341.846927] R13: 00007ffe7a227820 R14: 0000000000000000 R15: 0000000000000000
&lt;4&gt; [341.846936] irq event stamp: 3547847
&lt;4&gt; [341.846940] hardirqs last  enabled at (3547847): [&lt;ffffffff819aad2c&gt;] _raw_spin_unlock_irqrestore+0x4c/0x60
&lt;4&gt; [341.846949] hardirqs last disabled at (3547846): [&lt;ffffffff819aab9d&gt;] _raw_spin_lock_irqsave+0xd/0x50
&lt;4&gt; [341.846957] softirqs last  enabled at (3547376): [&lt;ffffffff81c0033a&gt;] __do_softirq+0x33a/0x4b9
&lt;4&gt; [341.846966] softirqs last disabled at (3547367): [&lt;ffffffff810b6379&gt;] irq_exit+0xa9/0xc0
&lt;4&gt; [341.846973] WARNING: CPU: 3 PID: 3300 at kernel/locking/mutex-debug.c:103 mutex_destroy+0x49/0x50
&lt;4&gt; [341.846980] ---[ end trace ba94ca8952ba970e ]---
&lt;7&gt; [341.866547] [drm:intel_dp_detect [i915]] MST support? port A: no, sink: no, modparam: yes
&lt;7&gt; [341.890480] [drm:drm_add_display_info] non_desktop set to 0
&lt;7&gt; [341.890530] [drm:drm_add_edid_modes] ELD: no CEA Extension found
&lt;7&gt; [341.890537] [drm:drm_add_display_info] non_desktop set to 0
&lt;7&gt; [341.890578] [drm:drm_helper_probe_single_connector_modes] [CONNECTOR:86:eDP-1] probed modes :
&lt;7&gt; [341.890589] [drm:drm_mode_debug_printmodeline] Modeline "3200x1800": 60 373250 3200 3248 3280 3360 1800 1803 1808 1852 0x48 0xa
&lt;7&gt; [341.890602] [drm:drm_mode_debug_printmodeline] Modeline "3200x1800": 48 298600 3200 3248 3280 3360 1800 1803 1808 1852 0x40 0xa
&lt;4&gt; [341.890628] general protection fault: 0000 [#1] PREEMPT SMP PTI
&lt;4&gt; [341.890636] CPU: 0 PID: 508 Comm: kworker/0:4 Tainted: G     U  W         5.2.0-rc2-CI-CI_DRM_6175+ #1
&lt;4&gt; [341.890646] Hardware name: Dell Inc. XPS 13 9360/0823VW, BIOS 2.9.0 07/09/2018
&lt;4&gt; [341.890655] Workqueue: events output_poll_execute
&lt;4&gt; [341.890663] RIP: 0010:drm_setup_crtcs+0x13e/0xbe0
&lt;4&gt; [341.890669] Code: 00 41 8b 44 24 58 85 c0 0f 8e f9 01 00 00 44 8b 6c 24 20 44 8b 74 24 28 31 db 31 ed 49 8b 44 24 60 48 63 d5 44 89 ee 83 c5 01 &lt;48&gt; 8b 04 d0 44 89 f2 48 8b 38 48 8b 87 88 01 00 00 48 8b 40 20 e8
&lt;4&gt; [341.890686] RSP: 0018:ffffc9000033fd40 EFLAGS: 00010202
&lt;4&gt; [341.890692] RAX: 6b6b6b6b6b6b6b6b RBX: 0000000000000002 RCX: 0000000000000000
&lt;4&gt; [341.890700] RDX: 0000000000000001 RSI: 0000000000000c80 RDI: 00000000ffffffff
&lt;4&gt; [341.890707] RBP: 0000000000000002 R08: 0000000000000000 R09: 0000000000000000
&lt;4&gt; [341.890715] R10: 0000000000000c80 R11: 0000000000000000 R12: ffff888267599fe8
&lt;4&gt; [341.890722] R13: 0000000000000c80 R14: 0000000000000708 R15: 0000000000000007
&lt;4&gt; [341.890730] FS:  0000000000000000(0000) GS:ffff888276200000(0000) knlGS:0000000000000000
&lt;4&gt; [341.890739] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
&lt;4&gt; [341.890745] CR2: 000055a4e064f4a0 CR3: 000000026d234003 CR4: 00000000003606f0
&lt;4&gt; [341.890752] Call Trace:
&lt;4&gt; [341.890760]  drm_fb_helper_hotplug_event.part.24+0x89/0xb0
&lt;4&gt; [341.890768]  drm_kms_helper_hotplug_event+0x21/0x30
&lt;4&gt; [341.890774]  output_poll_execute+0x9d/0x1a0
&lt;4&gt; [341.890782]  process_one_work+0x245/0x610
&lt;4&gt; [341.890790]  worker_thread+0x37/0x380
&lt;4&gt; [341.890796]  ? process_one_work+0x610/0x610
&lt;4&gt; [341.890802]  kthread+0x119/0x130
&lt;4&gt; [341.890808]  ? kthread_park+0x80/0x80
&lt;4&gt; [341.890815]  ret_from_fork+0x3a/0x50

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109964
Signed-off-by: Chris Wilson &lt;chris@chris-wilson.co.uk&gt;
Reviewed-by: Imre Deak &lt;imre.deak@intel.com&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20190603135910.15979-2-chris@chris-wilson.co.uk
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit 3b295cb1a411d9c82bbfaa66bc17a8508716ed07 ]

We need to mark the output polling as disabled to prevent concurrent
irqs from queuing new work as shutdown the probe -- causing that work to
execute after we have freed the structs:

&lt;4&gt; [341.846490] DEBUG_LOCKS_WARN_ON(mutex_is_locked(lock))
&lt;4&gt; [341.846497] WARNING: CPU: 3 PID: 3300 at kernel/locking/mutex-debug.c:103 mutex_destroy+0x49/0x50
&lt;4&gt; [341.846508] Modules linked in: i915(-) vgem thunderbolt snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic mei_hdcp x86_pkg_temp_thermal coretemp crct10dif_pclmul crc32_pclmul ghash_clmulni_intel snd_hda_codec snd_hwdep snd_hda_core snd_pcm mcs7830 btusb usbnet btrtl mii btbcm btintel bluetooth ecdh_generic ecc mei_me mei prime_numbers i2c_hid pinctrl_sunrisepoint pinctrl_intel [last unloaded: i915]
&lt;4&gt; [341.846546] CPU: 3 PID: 3300 Comm: i915_module_loa Tainted: G     U            5.2.0-rc2-CI-CI_DRM_6175+ #1
&lt;4&gt; [341.846553] Hardware name: Dell Inc. XPS 13 9360/0823VW, BIOS 2.9.0 07/09/2018
&lt;4&gt; [341.846560] RIP: 0010:mutex_destroy+0x49/0x50
&lt;4&gt; [341.846565] Code: 00 00 5b c3 e8 a8 9f 3b 00 85 c0 74 ed 8b 05 3e 55 23 01 85 c0 75 e3 48 c7 c6 00 d0 08 82 48 c7 c7 a8 aa 07 82 e8 e7 08 fa ff &lt;0f&gt; 0b eb cc 0f 1f 00 48 b8 11 11 11 11 11 11 11 11 48 89 76 20 48
&lt;4&gt; [341.846578] RSP: 0018:ffffc900006cfdb0 EFLAGS: 00010286
&lt;4&gt; [341.846583] RAX: 0000000000000000 RBX: ffff88826759a168 RCX: 0000000000000000
&lt;4&gt; [341.846589] RDX: 0000000000000002 RSI: 0000000000000000 RDI: ffffffff8112844c
&lt;4&gt; [341.846595] RBP: ffff8882708fa548 R08: 0000000000000000 R09: 0000000000039600
&lt;4&gt; [341.846601] R10: 0000000000000000 R11: 0000000000000ce4 R12: ffffffffa07de1e0
&lt;4&gt; [341.846607] R13: 0000000000000000 R14: 0000000000000000 R15: ffffffffa07de2d0
&lt;4&gt; [341.846613] FS:  00007f62b5ae0e40(0000) GS:ffff888276380000(0000) knlGS:0000000000000000
&lt;4&gt; [341.846620] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
&lt;4&gt; [341.846626] CR2: 000055a4e064f4a0 CR3: 0000000266b16006 CR4: 00000000003606e0
&lt;4&gt; [341.846632] Call Trace:
&lt;4&gt; [341.846639]  drm_fb_helper_fini.part.17+0xb3/0x100
&lt;4&gt; [341.846682]  intel_fbdev_fini+0x20/0x80 [i915]
&lt;4&gt; [341.846722]  intel_modeset_cleanup+0x9a/0x140 [i915]
&lt;4&gt; [341.846750]  i915_driver_unload+0xa3/0x100 [i915]
&lt;4&gt; [341.846778]  i915_pci_remove+0x19/0x30 [i915]
&lt;4&gt; [341.846784]  pci_device_remove+0x36/0xb0
&lt;4&gt; [341.846790]  device_release_driver_internal+0xd3/0x1b0
&lt;4&gt; [341.846795]  driver_detach+0x3f/0x80
&lt;4&gt; [341.846800]  bus_remove_driver+0x53/0xd0
&lt;4&gt; [341.846805]  pci_unregister_driver+0x25/0xa0
&lt;4&gt; [341.846843]  i915_exit+0x16/0x1c [i915]
&lt;4&gt; [341.846849]  __se_sys_delete_module+0x162/0x210
&lt;4&gt; [341.846855]  ? trace_hardirqs_off_thunk+0x1a/0x1c
&lt;4&gt; [341.846859]  ? do_syscall_64+0xd/0x1c0
&lt;4&gt; [341.846864]  do_syscall_64+0x55/0x1c0
&lt;4&gt; [341.846869]  entry_SYSCALL_64_after_hwframe+0x49/0xbe
&lt;4&gt; [341.846875] RIP: 0033:0x7f62b51871b7
&lt;4&gt; [341.846881] Code: 73 01 c3 48 8b 0d d1 8c 2c 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 b8 b0 00 00 00 0f 05 &lt;48&gt; 3d 01 f0 ff ff 73 01 c3 48 8b 0d a1 8c 2c 00 f7 d8 64 89 01 48
&lt;4&gt; [341.846897] RSP: 002b:00007ffe7a227138 EFLAGS: 00000206 ORIG_RAX: 00000000000000b0
&lt;4&gt; [341.846904] RAX: ffffffffffffffda RBX: 00007ffe7a2272b0 RCX: 00007f62b51871b7
&lt;4&gt; [341.846910] RDX: 0000000000000001 RSI: 0000000000000800 RDI: 0000557cd6b55948
&lt;4&gt; [341.846916] RBP: 0000557cd6b558e0 R08: 0000557cd6b5594c R09: 00007ffe7a227160
&lt;4&gt; [341.846922] R10: 00007ffe7a226134 R11: 0000000000000206 R12: 0000000000000000
&lt;4&gt; [341.846927] R13: 00007ffe7a227820 R14: 0000000000000000 R15: 0000000000000000
&lt;4&gt; [341.846936] irq event stamp: 3547847
&lt;4&gt; [341.846940] hardirqs last  enabled at (3547847): [&lt;ffffffff819aad2c&gt;] _raw_spin_unlock_irqrestore+0x4c/0x60
&lt;4&gt; [341.846949] hardirqs last disabled at (3547846): [&lt;ffffffff819aab9d&gt;] _raw_spin_lock_irqsave+0xd/0x50
&lt;4&gt; [341.846957] softirqs last  enabled at (3547376): [&lt;ffffffff81c0033a&gt;] __do_softirq+0x33a/0x4b9
&lt;4&gt; [341.846966] softirqs last disabled at (3547367): [&lt;ffffffff810b6379&gt;] irq_exit+0xa9/0xc0
&lt;4&gt; [341.846973] WARNING: CPU: 3 PID: 3300 at kernel/locking/mutex-debug.c:103 mutex_destroy+0x49/0x50
&lt;4&gt; [341.846980] ---[ end trace ba94ca8952ba970e ]---
&lt;7&gt; [341.866547] [drm:intel_dp_detect [i915]] MST support? port A: no, sink: no, modparam: yes
&lt;7&gt; [341.890480] [drm:drm_add_display_info] non_desktop set to 0
&lt;7&gt; [341.890530] [drm:drm_add_edid_modes] ELD: no CEA Extension found
&lt;7&gt; [341.890537] [drm:drm_add_display_info] non_desktop set to 0
&lt;7&gt; [341.890578] [drm:drm_helper_probe_single_connector_modes] [CONNECTOR:86:eDP-1] probed modes :
&lt;7&gt; [341.890589] [drm:drm_mode_debug_printmodeline] Modeline "3200x1800": 60 373250 3200 3248 3280 3360 1800 1803 1808 1852 0x48 0xa
&lt;7&gt; [341.890602] [drm:drm_mode_debug_printmodeline] Modeline "3200x1800": 48 298600 3200 3248 3280 3360 1800 1803 1808 1852 0x40 0xa
&lt;4&gt; [341.890628] general protection fault: 0000 [#1] PREEMPT SMP PTI
&lt;4&gt; [341.890636] CPU: 0 PID: 508 Comm: kworker/0:4 Tainted: G     U  W         5.2.0-rc2-CI-CI_DRM_6175+ #1
&lt;4&gt; [341.890646] Hardware name: Dell Inc. XPS 13 9360/0823VW, BIOS 2.9.0 07/09/2018
&lt;4&gt; [341.890655] Workqueue: events output_poll_execute
&lt;4&gt; [341.890663] RIP: 0010:drm_setup_crtcs+0x13e/0xbe0
&lt;4&gt; [341.890669] Code: 00 41 8b 44 24 58 85 c0 0f 8e f9 01 00 00 44 8b 6c 24 20 44 8b 74 24 28 31 db 31 ed 49 8b 44 24 60 48 63 d5 44 89 ee 83 c5 01 &lt;48&gt; 8b 04 d0 44 89 f2 48 8b 38 48 8b 87 88 01 00 00 48 8b 40 20 e8
&lt;4&gt; [341.890686] RSP: 0018:ffffc9000033fd40 EFLAGS: 00010202
&lt;4&gt; [341.890692] RAX: 6b6b6b6b6b6b6b6b RBX: 0000000000000002 RCX: 0000000000000000
&lt;4&gt; [341.890700] RDX: 0000000000000001 RSI: 0000000000000c80 RDI: 00000000ffffffff
&lt;4&gt; [341.890707] RBP: 0000000000000002 R08: 0000000000000000 R09: 0000000000000000
&lt;4&gt; [341.890715] R10: 0000000000000c80 R11: 0000000000000000 R12: ffff888267599fe8
&lt;4&gt; [341.890722] R13: 0000000000000c80 R14: 0000000000000708 R15: 0000000000000007
&lt;4&gt; [341.890730] FS:  0000000000000000(0000) GS:ffff888276200000(0000) knlGS:0000000000000000
&lt;4&gt; [341.890739] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
&lt;4&gt; [341.890745] CR2: 000055a4e064f4a0 CR3: 000000026d234003 CR4: 00000000003606f0
&lt;4&gt; [341.890752] Call Trace:
&lt;4&gt; [341.890760]  drm_fb_helper_hotplug_event.part.24+0x89/0xb0
&lt;4&gt; [341.890768]  drm_kms_helper_hotplug_event+0x21/0x30
&lt;4&gt; [341.890774]  output_poll_execute+0x9d/0x1a0
&lt;4&gt; [341.890782]  process_one_work+0x245/0x610
&lt;4&gt; [341.890790]  worker_thread+0x37/0x380
&lt;4&gt; [341.890796]  ? process_one_work+0x610/0x610
&lt;4&gt; [341.890802]  kthread+0x119/0x130
&lt;4&gt; [341.890808]  ? kthread_park+0x80/0x80
&lt;4&gt; [341.890815]  ret_from_fork+0x3a/0x50

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109964
Signed-off-by: Chris Wilson &lt;chris@chris-wilson.co.uk&gt;
Reviewed-by: Imre Deak &lt;imre.deak@intel.com&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20190603135910.15979-2-chris@chris-wilson.co.uk
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>drm/virtio: Add memory barriers for capset cache.</title>
<updated>2019-08-04T07:34:56+00:00</updated>
<author>
<name>David Riley</name>
<email>davidriley@chromium.org</email>
</author>
<published>2019-06-10T21:18:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=25d2b1b5f27b3b559ade1a4024e746bb41106c80'/>
<id>25d2b1b5f27b3b559ade1a4024e746bb41106c80</id>
<content type='text'>
[ Upstream commit 9ff3a5c88e1f1ab17a31402b96d45abe14aab9d7 ]

After data is copied to the cache entry, atomic_set is used indicate
that the data is the entry is valid without appropriate memory barriers.
Similarly the read side was missing the corresponding memory barriers.

Signed-off-by: David Riley &lt;davidriley@chromium.org&gt;
Link: http://patchwork.freedesktop.org/patch/msgid/20190610211810.253227-5-davidriley@chromium.org
Signed-off-by: Gerd Hoffmann &lt;kraxel@redhat.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit 9ff3a5c88e1f1ab17a31402b96d45abe14aab9d7 ]

After data is copied to the cache entry, atomic_set is used indicate
that the data is the entry is valid without appropriate memory barriers.
Similarly the read side was missing the corresponding memory barriers.

Signed-off-by: David Riley &lt;davidriley@chromium.org&gt;
Link: http://patchwork.freedesktop.org/patch/msgid/20190610211810.253227-5-davidriley@chromium.org
Signed-off-by: Gerd Hoffmann &lt;kraxel@redhat.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>drm/panel: simple: Fix panel_simple_dsi_probe</title>
<updated>2019-08-04T07:34:56+00:00</updated>
<author>
<name>Peter Ujfalusi</name>
<email>peter.ujfalusi@ti.com</email>
</author>
<published>2019-02-26T08:11:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=309e8863eba750a058354c3c42aa04352bbacb53'/>
<id>309e8863eba750a058354c3c42aa04352bbacb53</id>
<content type='text'>
[ Upstream commit 7ad9db66fafb0f0ad53fd2a66217105da5ddeffe ]

In case mipi_dsi_attach() fails remove the registered panel to avoid added
panel without corresponding device.

Signed-off-by: Peter Ujfalusi &lt;peter.ujfalusi@ti.com&gt;
Signed-off-by: Thierry Reding &lt;treding@nvidia.com&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20190226081153.31334-1-peter.ujfalusi@ti.com
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit 7ad9db66fafb0f0ad53fd2a66217105da5ddeffe ]

In case mipi_dsi_attach() fails remove the registered panel to avoid added
panel without corresponding device.

Signed-off-by: Peter Ujfalusi &lt;peter.ujfalusi@ti.com&gt;
Signed-off-by: Thierry Reding &lt;treding@nvidia.com&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20190226081153.31334-1-peter.ujfalusi@ti.com
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>drm/nouveau/i2c: Enable i2c pads &amp; busses during preinit</title>
<updated>2019-08-04T07:34:51+00:00</updated>
<author>
<name>Lyude Paul</name>
<email>lyude@redhat.com</email>
</author>
<published>2019-06-26T18:10:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=37717b3975adeb42d3c01acff0fb980f9341ded7'/>
<id>37717b3975adeb42d3c01acff0fb980f9341ded7</id>
<content type='text'>
commit 7cb95eeea6706c790571042a06782e378b2561ea upstream.

It turns out that while disabling i2c bus access from software when the
GPU is suspended was a step in the right direction with:

commit 342406e4fbba ("drm/nouveau/i2c: Disable i2c bus access after
-&gt;fini()")

We also ended up accidentally breaking the vbios init scripts on some
older Tesla GPUs, as apparently said scripts can actually use the i2c
bus. Since these scripts are executed before initializing any
subdevices, we end up failing to acquire access to the i2c bus which has
left a number of cards with their fan controllers uninitialized. Luckily
this doesn't break hardware - it just means the fan gets stuck at 100%.

This also means that we've always been using our i2c busses before
initializing them during the init scripts for older GPUs, we just didn't
notice it until we started preventing them from being used until init.
It's pretty impressive this never caused us any issues before!

So, fix this by initializing our i2c pad and busses during subdev
pre-init. We skip initializing aux busses during pre-init, as those are
guaranteed to only ever be used by nouveau for DP aux transactions.

Signed-off-by: Lyude Paul &lt;lyude@redhat.com&gt;
Tested-by: Marc Meledandri &lt;m.meledandri@gmail.com&gt;
Fixes: 342406e4fbba ("drm/nouveau/i2c: Disable i2c bus access after -&gt;fini()")
Cc: stable@vger.kernel.org
Signed-off-by: Ben Skeggs &lt;bskeggs@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 7cb95eeea6706c790571042a06782e378b2561ea upstream.

It turns out that while disabling i2c bus access from software when the
GPU is suspended was a step in the right direction with:

commit 342406e4fbba ("drm/nouveau/i2c: Disable i2c bus access after
-&gt;fini()")

We also ended up accidentally breaking the vbios init scripts on some
older Tesla GPUs, as apparently said scripts can actually use the i2c
bus. Since these scripts are executed before initializing any
subdevices, we end up failing to acquire access to the i2c bus which has
left a number of cards with their fan controllers uninitialized. Luckily
this doesn't break hardware - it just means the fan gets stuck at 100%.

This also means that we've always been using our i2c busses before
initializing them during the init scripts for older GPUs, we just didn't
notice it until we started preventing them from being used until init.
It's pretty impressive this never caused us any issues before!

So, fix this by initializing our i2c pad and busses during subdev
pre-init. We skip initializing aux busses during pre-init, as those are
guaranteed to only ever be used by nouveau for DP aux transactions.

Signed-off-by: Lyude Paul &lt;lyude@redhat.com&gt;
Tested-by: Marc Meledandri &lt;m.meledandri@gmail.com&gt;
Fixes: 342406e4fbba ("drm/nouveau/i2c: Disable i2c bus access after -&gt;fini()")
Cc: stable@vger.kernel.org
Signed-off-by: Ben Skeggs &lt;bskeggs@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>drm/vmwgfx: NULL pointer dereference from vmw_cmd_dx_view_define()</title>
<updated>2019-06-22T06:18:24+00:00</updated>
<author>
<name>Murray McAllister</name>
<email>murray.mcallister@gmail.com</email>
</author>
<published>2019-05-11T06:01:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=8f6b0e59d2a072cb19841b13fd8acba993ba55b3'/>
<id>8f6b0e59d2a072cb19841b13fd8acba993ba55b3</id>
<content type='text'>
commit bcd6aa7b6cbfd6f985f606c6f76046d782905820 upstream.

If SVGA_3D_CMD_DX_DEFINE_RENDERTARGET_VIEW is called with a surface
ID of SVGA3D_INVALID_ID, the srf struct will remain NULL after
vmw_cmd_res_check(), leading to a null pointer dereference in
vmw_view_add().

Cc: &lt;stable@vger.kernel.org&gt;
Fixes: d80efd5cb3de ("drm/vmwgfx: Initial DX support")
Signed-off-by: Murray McAllister &lt;murray.mcallister@gmail.com&gt;
Reviewed-by: Thomas Hellstrom &lt;thellstrom@vmware.com&gt;
Signed-off-by: Thomas Hellstrom &lt;thellstrom@vmware.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;


</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit bcd6aa7b6cbfd6f985f606c6f76046d782905820 upstream.

If SVGA_3D_CMD_DX_DEFINE_RENDERTARGET_VIEW is called with a surface
ID of SVGA3D_INVALID_ID, the srf struct will remain NULL after
vmw_cmd_res_check(), leading to a null pointer dereference in
vmw_view_add().

Cc: &lt;stable@vger.kernel.org&gt;
Fixes: d80efd5cb3de ("drm/vmwgfx: Initial DX support")
Signed-off-by: Murray McAllister &lt;murray.mcallister@gmail.com&gt;
Reviewed-by: Thomas Hellstrom &lt;thellstrom@vmware.com&gt;
Signed-off-by: Thomas Hellstrom &lt;thellstrom@vmware.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;


</pre>
</div>
</content>
</entry>
<entry>
<title>drm/vmwgfx: integer underflow in vmw_cmd_dx_set_shader() leading to an invalid read</title>
<updated>2019-06-22T06:18:24+00:00</updated>
<author>
<name>Murray McAllister</name>
<email>murray.mcallister@gmail.com</email>
</author>
<published>2019-05-20T09:57:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=6e0c7e73232f4c1e3a87aa9b2149717f92e2302c'/>
<id>6e0c7e73232f4c1e3a87aa9b2149717f92e2302c</id>
<content type='text'>
commit 5ed7f4b5eca11c3c69e7c8b53e4321812bc1ee1e upstream.

If SVGA_3D_CMD_DX_SET_SHADER is called with a shader ID
of SVGA3D_INVALID_ID, and a shader type of
SVGA3D_SHADERTYPE_INVALID, the calculated binding.shader_slot
will be 4294967295, leading to an out-of-bounds read in vmw_binding_loc()
when the offset is calculated.

Cc: &lt;stable@vger.kernel.org&gt;
Fixes: d80efd5cb3de ("drm/vmwgfx: Initial DX support")
Signed-off-by: Murray McAllister &lt;murray.mcallister@gmail.com&gt;
Reviewed-by: Thomas Hellstrom &lt;thellstrom@vmware.com&gt;
Signed-off-by: Thomas Hellstrom &lt;thellstrom@vmware.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;


</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 5ed7f4b5eca11c3c69e7c8b53e4321812bc1ee1e upstream.

If SVGA_3D_CMD_DX_SET_SHADER is called with a shader ID
of SVGA3D_INVALID_ID, and a shader type of
SVGA3D_SHADERTYPE_INVALID, the calculated binding.shader_slot
will be 4294967295, leading to an out-of-bounds read in vmw_binding_loc()
when the offset is calculated.

Cc: &lt;stable@vger.kernel.org&gt;
Fixes: d80efd5cb3de ("drm/vmwgfx: Initial DX support")
Signed-off-by: Murray McAllister &lt;murray.mcallister@gmail.com&gt;
Reviewed-by: Thomas Hellstrom &lt;thellstrom@vmware.com&gt;
Signed-off-by: Thomas Hellstrom &lt;thellstrom@vmware.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;


</pre>
</div>
</content>
</entry>
<entry>
<title>drm/bridge: adv7511: Fix low refresh rate selection</title>
<updated>2019-06-22T06:18:19+00:00</updated>
<author>
<name>Matt Redfearn</name>
<email>matt.redfearn@thinci.com</email>
</author>
<published>2019-04-24T13:22:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=25be7d51a0124f52e1dd803cb14c9f16948530b6'/>
<id>25be7d51a0124f52e1dd803cb14c9f16948530b6</id>
<content type='text'>
[ Upstream commit 67793bd3b3948dc8c8384b6430e036a30a0ecb43 ]

The driver currently sets register 0xfb (Low Refresh Rate) based on the
value of mode-&gt;vrefresh. Firstly, this field is specified to be in Hz,
but the magic numbers used by the code are Hz * 1000. This essentially
leads to the low refresh rate always being set to 0x01, since the
vrefresh value will always be less than 24000. Fix the magic numbers to
be in Hz.
Secondly, according to the comment in drm_modes.h, the field is not
supposed to be used in a functional way anyway. Instead, use the helper
function drm_mode_vrefresh().

Fixes: 9c8af882bf12 ("drm: Add adv7511 encoder driver")
Reviewed-by: Laurent Pinchart &lt;laurent.pinchart@ideasonboard.com&gt;
Signed-off-by: Matt Redfearn &lt;matt.redfearn@thinci.com&gt;
Signed-off-by: Sean Paul &lt;seanpaul@chromium.org&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20190424132210.26338-1-matt.redfearn@thinci.com
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit 67793bd3b3948dc8c8384b6430e036a30a0ecb43 ]

The driver currently sets register 0xfb (Low Refresh Rate) based on the
value of mode-&gt;vrefresh. Firstly, this field is specified to be in Hz,
but the magic numbers used by the code are Hz * 1000. This essentially
leads to the low refresh rate always being set to 0x01, since the
vrefresh value will always be less than 24000. Fix the magic numbers to
be in Hz.
Secondly, according to the comment in drm_modes.h, the field is not
supposed to be used in a functional way anyway. Instead, use the helper
function drm_mode_vrefresh().

Fixes: 9c8af882bf12 ("drm: Add adv7511 encoder driver")
Reviewed-by: Laurent Pinchart &lt;laurent.pinchart@ideasonboard.com&gt;
Signed-off-by: Matt Redfearn &lt;matt.redfearn@thinci.com&gt;
Signed-off-by: Sean Paul &lt;seanpaul@chromium.org&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20190424132210.26338-1-matt.redfearn@thinci.com
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>drm/gma500/cdv: Check vbt config bits when detecting lvds panels</title>
<updated>2019-06-11T10:24:13+00:00</updated>
<author>
<name>Patrik Jakobsson</name>
<email>patrik.r.jakobsson@gmail.com</email>
</author>
<published>2019-04-16T11:46:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=0f5fab865ae9b1969dbefa9f0f8bc96d16fd900f'/>
<id>0f5fab865ae9b1969dbefa9f0f8bc96d16fd900f</id>
<content type='text'>
commit 7c420636860a719049fae9403e2c87804f53bdde upstream.

Some machines have an lvds child device in vbt even though a panel is
not attached. To make detection more reliable we now also check the lvds
config bits available in the vbt.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1665766
Cc: stable@vger.kernel.org
Reviewed-by: Hans de Goede &lt;hdegoede@redhat.com&gt;
Signed-off-by: Patrik Jakobsson &lt;patrik.r.jakobsson@gmail.com&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20190416114607.1072-1-patrik.r.jakobsson@gmail.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 7c420636860a719049fae9403e2c87804f53bdde upstream.

Some machines have an lvds child device in vbt even though a panel is
not attached. To make detection more reliable we now also check the lvds
config bits available in the vbt.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1665766
Cc: stable@vger.kernel.org
Reviewed-by: Hans de Goede &lt;hdegoede@redhat.com&gt;
Signed-off-by: Patrik Jakobsson &lt;patrik.r.jakobsson@gmail.com&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20190416114607.1072-1-patrik.r.jakobsson@gmail.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>drm/nouveau/i2c: Disable i2c bus access after -&gt;fini()</title>
<updated>2019-06-11T10:24:09+00:00</updated>
<author>
<name>Lyude Paul</name>
<email>lyude@redhat.com</email>
</author>
<published>2019-04-09T20:23:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=986adddb9d8f4f5a18aa78e46d4e4303746146e6'/>
<id>986adddb9d8f4f5a18aa78e46d4e4303746146e6</id>
<content type='text'>
commit 342406e4fbba9a174125fbfe6aeac3d64ef90f76 upstream.

For a while, we've had the problem of i2c bus access not grabbing
a runtime PM ref when it's being used in userspace by i2c-dev, resulting
in nouveau spamming the kernel log with errors if anything attempts to
access the i2c bus while the GPU is in runtime suspend. An example:

[  130.078386] nouveau 0000:01:00.0: i2c: aux 000d: begin idle timeout ffffffff

Since the GPU is in runtime suspend, the MMIO region that the i2c bus is
on isn't accessible. On x86, the standard behavior for accessing an
unavailable MMIO region is to just return ~0.

Except, that turned out to be a lie. While computers with a clean
concious will return ~0 in this scenario, some machines will actually
completely hang a CPU on certian bad MMIO accesses. This was witnessed
with someone's Lenovo ThinkPad P50, where sensors-detect attempting to
access the i2c bus while the GPU was suspended would result in a CPU
hang:

  CPU: 5 PID: 12438 Comm: sensors-detect Not tainted 5.0.0-0.rc4.git3.1.fc30.x86_64 #1
  Hardware name: LENOVO 20EQS64N17/20EQS64N17, BIOS N1EET74W (1.47 ) 11/21/2017
  RIP: 0010:ioread32+0x2b/0x30
  Code: 81 ff ff ff 03 00 77 20 48 81 ff 00 00 01 00 76 05 0f b7 d7 ed c3
  48 c7 c6 e1 0c 36 96 e8 2d ff ff ff b8 ff ff ff ff c3 8b 07 &lt;c3&gt; 0f 1f
  40 00 49 89 f0 48 81 fe ff ff 03 00 76 04 40 88 3e c3 48
  RSP: 0018:ffffaac3c5007b48 EFLAGS: 00000292 ORIG_RAX: ffffffffffffff13
  RAX: 0000000001111000 RBX: 0000000001111000 RCX: 0000043017a97186
  RDX: 0000000000000aaa RSI: 0000000000000005 RDI: ffffaac3c400e4e4
  RBP: ffff9e6443902c00 R08: ffffaac3c400e4e4 R09: ffffaac3c5007be7
  R10: 0000000000000004 R11: 0000000000000001 R12: ffff9e6445dd0000
  R13: 000000000000e4e4 R14: 00000000000003c4 R15: 0000000000000000
  FS:  00007f253155a740(0000) GS:ffff9e644f600000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  CR2: 00005630d1500358 CR3: 0000000417c44006 CR4: 00000000003606e0
  DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
  DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
  Call Trace:
   g94_i2c_aux_xfer+0x326/0x850 [nouveau]
   nvkm_i2c_aux_i2c_xfer+0x9e/0x140 [nouveau]
   __i2c_transfer+0x14b/0x620
   i2c_smbus_xfer_emulated+0x159/0x680
   ? _raw_spin_unlock_irqrestore+0x1/0x60
   ? rt_mutex_slowlock.constprop.0+0x13d/0x1e0
   ? __lock_is_held+0x59/0xa0
   __i2c_smbus_xfer+0x138/0x5a0
   i2c_smbus_xfer+0x4f/0x80
   i2cdev_ioctl_smbus+0x162/0x2d0 [i2c_dev]
   i2cdev_ioctl+0x1db/0x2c0 [i2c_dev]
   do_vfs_ioctl+0x408/0x750
   ksys_ioctl+0x5e/0x90
   __x64_sys_ioctl+0x16/0x20
   do_syscall_64+0x60/0x1e0
   entry_SYSCALL_64_after_hwframe+0x49/0xbe
  RIP: 0033:0x7f25317f546b
  Code: 0f 1e fa 48 8b 05 1d da 0c 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff
  ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa b8 10 00 00 00 0f 05 &lt;48&gt; 3d 01
  f0 ff ff 73 01 c3 48 8b 0d ed d9 0c 00 f7 d8 64 89 01 48
  RSP: 002b:00007ffc88caab68 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
  RAX: ffffffffffffffda RBX: 00005630d0fe7260 RCX: 00007f25317f546b
  RDX: 00005630d1598e80 RSI: 0000000000000720 RDI: 0000000000000003
  RBP: 00005630d155b968 R08: 0000000000000001 R09: 00005630d15a1da0
  R10: 0000000000000070 R11: 0000000000000246 R12: 00005630d1598e80
  R13: 00005630d12f3d28 R14: 0000000000000720 R15: 00005630d12f3ce0
  watchdog: BUG: soft lockup - CPU#5 stuck for 23s! [sensors-detect:12438]

Yikes! While I wanted to try to make it so that accessing an i2c bus on
nouveau would wake up the GPU as needed, airlied pointed out that pretty
much any usecase for userspace accessing an i2c bus on a GPU (mainly for
the DDC brightness control that some displays have) is going to only be
useful while there's at least one display enabled on the GPU anyway, and
the GPU never sleeps while there's displays running.

Since teaching the i2c bus to wake up the GPU on userspace accesses is a
good deal more difficult than it might seem, mostly due to the fact that
we have to use the i2c bus during runtime resume of the GPU, we instead
opt for the easiest solution: don't let userspace access i2c busses on
the GPU at all while it's in runtime suspend.

Changes since v1:
* Also disable i2c busses that run over DP AUX

Signed-off-by: Lyude Paul &lt;lyude@redhat.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Ben Skeggs &lt;bskeggs@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 342406e4fbba9a174125fbfe6aeac3d64ef90f76 upstream.

For a while, we've had the problem of i2c bus access not grabbing
a runtime PM ref when it's being used in userspace by i2c-dev, resulting
in nouveau spamming the kernel log with errors if anything attempts to
access the i2c bus while the GPU is in runtime suspend. An example:

[  130.078386] nouveau 0000:01:00.0: i2c: aux 000d: begin idle timeout ffffffff

Since the GPU is in runtime suspend, the MMIO region that the i2c bus is
on isn't accessible. On x86, the standard behavior for accessing an
unavailable MMIO region is to just return ~0.

Except, that turned out to be a lie. While computers with a clean
concious will return ~0 in this scenario, some machines will actually
completely hang a CPU on certian bad MMIO accesses. This was witnessed
with someone's Lenovo ThinkPad P50, where sensors-detect attempting to
access the i2c bus while the GPU was suspended would result in a CPU
hang:

  CPU: 5 PID: 12438 Comm: sensors-detect Not tainted 5.0.0-0.rc4.git3.1.fc30.x86_64 #1
  Hardware name: LENOVO 20EQS64N17/20EQS64N17, BIOS N1EET74W (1.47 ) 11/21/2017
  RIP: 0010:ioread32+0x2b/0x30
  Code: 81 ff ff ff 03 00 77 20 48 81 ff 00 00 01 00 76 05 0f b7 d7 ed c3
  48 c7 c6 e1 0c 36 96 e8 2d ff ff ff b8 ff ff ff ff c3 8b 07 &lt;c3&gt; 0f 1f
  40 00 49 89 f0 48 81 fe ff ff 03 00 76 04 40 88 3e c3 48
  RSP: 0018:ffffaac3c5007b48 EFLAGS: 00000292 ORIG_RAX: ffffffffffffff13
  RAX: 0000000001111000 RBX: 0000000001111000 RCX: 0000043017a97186
  RDX: 0000000000000aaa RSI: 0000000000000005 RDI: ffffaac3c400e4e4
  RBP: ffff9e6443902c00 R08: ffffaac3c400e4e4 R09: ffffaac3c5007be7
  R10: 0000000000000004 R11: 0000000000000001 R12: ffff9e6445dd0000
  R13: 000000000000e4e4 R14: 00000000000003c4 R15: 0000000000000000
  FS:  00007f253155a740(0000) GS:ffff9e644f600000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  CR2: 00005630d1500358 CR3: 0000000417c44006 CR4: 00000000003606e0
  DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
  DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
  Call Trace:
   g94_i2c_aux_xfer+0x326/0x850 [nouveau]
   nvkm_i2c_aux_i2c_xfer+0x9e/0x140 [nouveau]
   __i2c_transfer+0x14b/0x620
   i2c_smbus_xfer_emulated+0x159/0x680
   ? _raw_spin_unlock_irqrestore+0x1/0x60
   ? rt_mutex_slowlock.constprop.0+0x13d/0x1e0
   ? __lock_is_held+0x59/0xa0
   __i2c_smbus_xfer+0x138/0x5a0
   i2c_smbus_xfer+0x4f/0x80
   i2cdev_ioctl_smbus+0x162/0x2d0 [i2c_dev]
   i2cdev_ioctl+0x1db/0x2c0 [i2c_dev]
   do_vfs_ioctl+0x408/0x750
   ksys_ioctl+0x5e/0x90
   __x64_sys_ioctl+0x16/0x20
   do_syscall_64+0x60/0x1e0
   entry_SYSCALL_64_after_hwframe+0x49/0xbe
  RIP: 0033:0x7f25317f546b
  Code: 0f 1e fa 48 8b 05 1d da 0c 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff
  ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa b8 10 00 00 00 0f 05 &lt;48&gt; 3d 01
  f0 ff ff 73 01 c3 48 8b 0d ed d9 0c 00 f7 d8 64 89 01 48
  RSP: 002b:00007ffc88caab68 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
  RAX: ffffffffffffffda RBX: 00005630d0fe7260 RCX: 00007f25317f546b
  RDX: 00005630d1598e80 RSI: 0000000000000720 RDI: 0000000000000003
  RBP: 00005630d155b968 R08: 0000000000000001 R09: 00005630d15a1da0
  R10: 0000000000000070 R11: 0000000000000246 R12: 00005630d1598e80
  R13: 00005630d12f3d28 R14: 0000000000000720 R15: 00005630d12f3ce0
  watchdog: BUG: soft lockup - CPU#5 stuck for 23s! [sensors-detect:12438]

Yikes! While I wanted to try to make it so that accessing an i2c bus on
nouveau would wake up the GPU as needed, airlied pointed out that pretty
much any usecase for userspace accessing an i2c bus on a GPU (mainly for
the DDC brightness control that some displays have) is going to only be
useful while there's at least one display enabled on the GPU anyway, and
the GPU never sleeps while there's displays running.

Since teaching the i2c bus to wake up the GPU on userspace accesses is a
good deal more difficult than it might seem, mostly due to the fact that
we have to use the i2c bus during runtime resume of the GPU, we instead
opt for the easiest solution: don't let userspace access i2c busses on
the GPU at all while it's in runtime suspend.

Changes since v1:
* Also disable i2c busses that run over DP AUX

Signed-off-by: Lyude Paul &lt;lyude@redhat.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Ben Skeggs &lt;bskeggs@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
</feed>
