Tvrtko Ursulin [Mon, 6 Mar 2017 15:03:19 +0000 (15:03 +0000)]
drm/i915: No need to save/restore irq status in __i915_request_irq_complete
It is always called from thread context.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Chris Wilson [Mon, 6 Mar 2017 09:29:16 +0000 (09:29 +0000)]
drm/i915: Take rpm wakelock for releasing the fence on unbind
Unbind the vma may happen at any time, outside of the normal GT wakeref.
As such it relies on having a wakeref of its own. However, we can forgo
clearing the register whilst the device is asleep and just mark it as
unused - so that when we do wake up the device, we will clear the unused
fence register (see i915_gem_restore_fences).
[22423.944631] WARNING: CPU: 3 PID: 26178 at drivers/gpu/drm/i915/intel_drv.h:1739 i915_vma_put_fence+0xf3/0x100 [i915]
[22423.946053] RPM wakelock ref not held during HW access
[22423.946056] Modules linked in: vgem(E) i915(E) nls_ascii(E) nls_cp437(E) vfat(E) fat(E) x86_pkg_temp_thermal(E) crct10dif_pclmul(E) crc32_pclmul(E) crc32c_intel(E) ghash_clmulni_intel(E) intel_gtt(E) i2c_algo_bit(E) drm_kms_helper(E) syscopyarea(E) sysfillrect(E) evdev(E) aesni_intel(E) aes_x86_64(E) crypto_simd(E) cryptd(E) glue_helper(E) sysimgblt(E) fb_sys_fops(E) prime_numbers(E) drm(E) efivars(E) mei_me(E) lpc_ich(E) mei(E) mfd_core(E) battery(E) video(E) acpi_pad(E) button(E) tpm_tis(E) tpm_tis_core(E) tpm(E) autofs4(E) i2c_i801(E) thermal(E) fan(E) i2c_designware_platform(E) i2c_designware_core(E)
[22423.946438] CPU: 2 PID: 26178 Comm: gem_concurrent_ Tainted: G E 4.10.0+ #101
[22423.946513] Hardware name: ��������������������������������� ���������������������������������/���������������������������������, BIOS RYBDWi35.86A.0246.2
[22423.946600] Call Trace:
[22423.946641] dump_stack+0x68/0x9f
[22423.946703] __warn+0x107/0x130
[22423.946763] warn_slowpath_fmt+0xa8/0xe0
[22423.946825] ? __warn+0x130/0x130
[22423.946868] ? free_hot_cold_page_list+0x53/0x70
[22423.946942] ? mark_lock+0xcc/0x7f0
[22423.946997] ? __lock_is_held+0x84/0x100
[22423.947115] ? i915_vma_put_fence+0x64/0x100 [i915]
[22423.947224] i915_vma_put_fence+0xf3/0x100 [i915]
[22423.947335] i915_vma_unbind+0x4da/0x560 [i915]
[22423.947387] ? rb_erase+0x812/0x8a0
[22423.947439] ? kfree+0xa2/0xd0
[22423.947562] i915_vma_close+0x159/0x180 [i915]
[22423.947674] intel_ring_free+0x31/0x50 [i915]
[22423.947776] i915_gem_context_free+0x1ff/0x3d0 [i915]
[22423.947887] context_close+0x106/0x110 [i915]
[22423.947989] context_idr_cleanup+0xc/0x10 [i915]
[22423.948041] idr_for_each+0x14d/0x1d0
[22423.948158] ? context_close+0x110/0x110 [i915]
[22423.948206] ? get_from_free_list+0x70/0x70
[22423.948261] ? __lock_is_held+0x84/0x100
[22423.948325] ? __mutex_unlock_slowpath+0xd4/0x400
[22423.948448] i915_gem_context_close+0x4b/0x90 [i915]
[22423.948544] i915_driver_preclose+0x28/0x50 [i915]
[22423.948620] drm_release+0x175/0x690 [drm]
[22423.948681] ? fcntl_setlk+0x5e0/0x5e0
[22423.948746] __fput+0x17d/0x300
[22423.948807] ____fput+0x9/0x10
[22423.948859] task_work_run+0xa7/0xe0
[22423.948924] do_exit+0x4d2/0x13e0
[22423.948986] ? mm_update_next_owner+0x320/0x320
[22423.949051] ? __do_page_fault+0x209/0x5c0
[22423.949110] ? mark_held_locks+0x23/0xc0
[22423.949166] ? entry_SYSCALL_64_fastpath+0x5/0xb1
[22423.949232] do_group_exit+0x93/0x160
[22423.949289] SyS_exit_group+0x18/0x20
[22423.949350] entry_SYSCALL_64_fastpath+0x1c/0xb1
[22423.949403] RIP: 0033:0x7f9cc2e154c8
[22423.949484] RSP: 002b:
00007ffd7e81b448 EFLAGS:
00000246 ORIG_RAX:
00000000000000e7
[22423.949557] RAX:
ffffffffffffffda RBX:
ffffffff810ef1f0 RCX:
00007f9cc2e154c8
[22423.949617] RDX:
0000000000000000 RSI:
000000000000003c RDI:
0000000000000000
[22423.949677] RBP:
ffff880367e9ff98 R08:
00000000000000e7 R09:
ffffffffffffff88
[22423.949741] R10:
00007f9cc1d5c000 R11:
0000000000000246 R12:
00007f9cc30f6c30
[22423.949798] R13:
0000000000000000 R14:
00007f9cc30f6c20 R15:
0000000000000003
[22423.949868] ? trace_hardirqs_off_caller+0xc0/0x110
v2: Move the rpm check down a layer so that we still perform the
vma/fence update required for the deferred mmio write on resume.
v3: Don't touch i915_gem_object_set_cache_level() and leave the rpm to
the low level routines (such as i915_vma_put_fence).
v4: vma may be null in fence_write, so extract drm_i915_private from
fence->i915
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/20170306092916.11623-3-chris@chris-wilson.co.uk
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Chris Wilson [Mon, 6 Mar 2017 09:29:15 +0000 (09:29 +0000)]
drm/i915: Wake up all waiters before idling
When we idle, we wakeup the first waiter (checking to see if it missed
an earlier wakeup) and disarm the breadcrumbs. However, we now assert
that there are no waiter when the interrupt is disabled, triggering an
assert if there were multiple waiters when we idled.
[ 420.842275] invalid opcode: 0000 [#1] PREEMPT SMP
[ 420.842285] Modules linked in: vgem snd_hda_codec_realtek x86_pkg_temp_thermal snd_hda_codec_generic intel_powerclamp coretemp crct10dif_pclmul crc32_pclmul ghash_clmulni_intel snd_hda_intel snd_hda_codec snd_hwdep mei_me snd_hda_core mei snd_pcm lpc_ich i915 r8169 mii prime_numbers
[ 420.842357] CPU: 4 PID: 8714 Comm: kms_pipe_crc_ba Tainted: G U W 4.10.0-CI-CI_DRM_2280+ #1
[ 420.842377] Hardware name: Hewlett-Packard HP Pro 3500 Series/2ABF, BIOS 8.11 10/24/2012
[ 420.842395] task:
ffff880117ddce40 task.stack:
ffffc90001114000
[ 420.842439] RIP: 0010:__intel_engine_remove_wait+0x1f4/0x200 [i915]
[ 420.842454] RSP: 0018:
ffffc90001117b18 EFLAGS:
00010046
[ 420.842467] RAX:
0000000000000000 RBX:
ffff88010c25c2a8 RCX:
0000000000000001
[ 420.842481] RDX:
0000000000000001 RSI:
00000000ffffffff RDI:
ffffc90001117c50
[ 420.842495] RBP:
ffffc90001117b58 R08:
0000000011e52352 R09:
c4d16acc00000000
[ 420.842511] R10:
ffffffff82789eb0 R11:
ffff880117ddce40 R12:
ffffc90001117c50
[ 420.842525] R13:
ffffc90001117c50 R14:
0000000000000078 R15:
0000000000000000
[ 420.842540] FS:
00007fe47dda0a40(0000) GS:
ffff88011fb00000(0000) knlGS:
0000000000000000
[ 420.842559] CS: 0010 DS: 0000 ES: 0000 CR0:
0000000080050033
[ 420.842571] CR2:
00007fd6c0a2cec4 CR3:
000000010a5e5000 CR4:
00000000001406e0
[ 420.842586] Call Trace:
[ 420.842595] ? do_raw_spin_lock+0xad/0xb0
[ 420.842635] intel_engine_remove_wait.part.3+0x26/0x40 [i915]
[ 420.842678] intel_engine_remove_wait+0xe/0x20 [i915]
[ 420.842721] i915_wait_request+0x4f0/0x8c0 [i915]
[ 420.842736] ? wake_up_q+0x70/0x70
[ 420.842747] ? wake_up_q+0x70/0x70
[ 420.842787] i915_gem_object_wait_fence+0x7d/0x1a0 [i915]
[ 420.842829] i915_gem_object_wait+0x30d/0x520 [i915]
[ 420.842842] ? __this_cpu_preempt_check+0x13/0x20
[ 420.842884] i915_gem_wait_ioctl+0x12e/0x2e0 [i915]
[ 420.842924] ? i915_gem_wait_ioctl+0x22/0x2e0 [i915]
[ 420.842939] drm_ioctl+0x200/0x450
[ 420.842976] ? i915_gem_set_wedged+0x90/0x90 [i915]
[ 420.842993] do_vfs_ioctl+0x90/0x6e0
[ 420.843003] ? entry_SYSCALL_64_fastpath+0x5/0xb1
[ 420.843017] ? __this_cpu_preempt_check+0x13/0x20
[ 420.843030] ? trace_hardirqs_on_caller+0xe7/0x200
[ 420.843042] SyS_ioctl+0x3c/0x70
[ 420.843054] entry_SYSCALL_64_fastpath+0x1c/0xb1
[ 420.843065] RIP: 0033:0x7fe47c4b9357
[ 420.843075] RSP: 002b:
00007ffc3c0633c8 EFLAGS:
00000246 ORIG_RAX:
0000000000000010
[ 420.843094] RAX:
ffffffffffffffda RBX:
ffffffff81482393 RCX:
00007fe47c4b9357
[ 420.843109] RDX:
00007ffc3c063400 RSI:
00000000c010646c RDI:
0000000000000004
[ 420.843123] RBP:
ffffc90001117f88 R08:
0000000000000008 R09:
0000000000000000
[ 420.843137] R10:
0000000000000000 R11:
0000000000000246 R12:
0000000000000000
[ 420.843151] R13:
0000000000000004 R14:
00000000c010646c R15:
0000000000000000
[ 420.843168] ? __this_cpu_preempt_check+0x13/0x20
[ 420.843180] Code: 81 48 c7 c1 40 6a 16 a0 48 c7 c2 47 29 15 a0 be 17 01 00 00 48 c7 c7 10 6a 16 a0 e8 c7 ea fe e0 e9 5d ff ff ff 0f 0b 0f 0b 0f 0b <0f> 0b 66 2e 0f 1f 84 00 00 00 00 00 55 48 89 e5 e8 67 41 7e e1
[ 420.843325] RIP: __intel_engine_remove_wait+0x1f4/0x200 [i915] RSP:
ffffc90001117b18
Fixes:
b66255f0f779 ("drm/i915: Refactor wakeup of the next breadcrumb waiter")
Fixes:
67b807a89230 ("drm/i915: Delay disabling the user interrupt for breadcrumbs")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170306092916.11623-2-chris@chris-wilson.co.uk
Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>
Maarten Lankhorst [Tue, 28 Feb 2017 14:28:48 +0000 (15:28 +0100)]
drm/i915: Complain if we take too long under vblank evasion.
Instead of only complaining when we actually miss a vblank, always
complain if we take longer than 100 us. This will make it easier to
find cases where we potentially miss vblanks.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1488292128-14540-2-git-send-email-maarten.lankhorst@linux.intel.com
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
[mlankhorst: Add commit message.]
Maarten Lankhorst [Tue, 28 Feb 2017 14:28:47 +0000 (15:28 +0100)]
drm/i915: Move updating color management to before vblank evasion
This cannot be done reliably during vblank evasasion
since the color management registers are not double buffered.
The original commit that moved it always during vblank evasion was
wrong, so revert it to before vblank evasion again.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Fixes:
20a34e78f0d7 ("drm/i915: Update color management during vblank evasion.")
Cc: stable@vger.kernel.org # v4.7+
Link: http://patchwork.freedesktop.org/patch/msgid/1488292128-14540-1-git-send-email-maarten.lankhorst@linux.intel.com
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Ander Conselvan de Oliveira [Mon, 6 Mar 2017 08:56:51 +0000 (10:56 +0200)]
drm/i915/glk: Remove MODULE_FIRMWARE() tag from Geminilake's DMC
Geminilake's DMC is not yet available in the linux-firmware repository.
To prevent userspace tools such as mkinitramfs to complain about
missing firmware, remove the MODULE_FIRMWARE() tag for now.
Fixes:
dbb28b5c3d3c ("drm/i915/DMC/GLK: Load DMC on GLK")
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Anusha Srivatsa <anusha.srivatsa@intel.com>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Cc: <drm-intel-fixes@lists.freedesktop.org>
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170306085651.14008-1-ander.conselvan.de.oliveira@intel.com
Daniel Vetter [Mon, 6 Mar 2017 07:34:44 +0000 (08:34 +0100)]
drm/i915: Update DRIVER_DATE to
20170306
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Michal Wajdeczko [Wed, 1 Mar 2017 20:26:15 +0000 (20:26 +0000)]
drm/i915: Don't use enums for hardware engine id
Generally we are using macros for any hardware identifiers as these
may change between Gens. Do the same with hardware engine ids.
v2: move hw engine defs to i915_reg.h (Chris)
Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/20170301202615.118632-1-michal.wajdeczko@intel.com
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Chris Wilson [Fri, 3 Mar 2017 19:08:24 +0000 (19:08 +0000)]
drm/i915: Split breadcrumbs spinlock into two
As we now take the breadcrumbs spinlock within the interrupt handler, we
wish to minimise its hold time. During the interrupt we do not care
about the state of the full rbtree, only that of the first element, so
we can guard that with a separate lock.
v2: Rename first_wait to irq_wait to make it clearer that it is guarded
by irq_lock.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170303190824.1330-1-chris@chris-wilson.co.uk
Chris Wilson [Fri, 3 Mar 2017 17:14:22 +0000 (17:14 +0000)]
drm/i915: Refactor wakeup of the next breadcrumb waiter
Refactor the common task of updating the first_waiter, serialised with
the interrupt handler. When we update the first_waiter, we also need to
wakeup the new bottom-half in order to complete the actions that we may
have delegated to it (such as checking the irq-seqno coherency or waking
up other lower priority concurrent waiters).
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170303171422.4735-1-chris@chris-wilson.co.uk
Chris Wilson [Fri, 3 Mar 2017 14:45:57 +0000 (14:45 +0000)]
drm/i915: Take reference for signaling the request from hardirq
Being inside a spinlock signaling that the hardware just completed a
request doesn't prevent a second thread already spotting that the
request is complete, freeing it and reallocating it! The code currently
tries to prevent this using RCU -- but that only prevents the request
from being freed, it doesn't prevent us from reallocating it - that
requires us to take a reference.
[ 206.922985] BUG: spinlock already unlocked on CPU#4, gem_exec_parall/7796
[ 206.922994] lock: 0xffff8801c6047120, .magic:
dead4ead, .owner: <none>/-1, .owner_cpu: -1
[ 206.923000] CPU: 4 PID: 7796 Comm: gem_exec_parall Not tainted 4.10.0-CI-Patchwork_4008+ #1
[ 206.923006] Hardware name: System manufacturer System Product Name/Z170M-PLUS, BIOS 1805 06/20/2016
[ 206.923012] Call Trace:
[ 206.923014] <IRQ>
[ 206.923019] dump_stack+0x67/0x92
[ 206.923023] spin_dump+0x73/0xc0
[ 206.923027] do_raw_spin_unlock+0x79/0xb0
[ 206.923031] _raw_spin_unlock_irqrestore+0x27/0x60
[ 206.923042] dma_fence_signal+0x160/0x230
[ 206.923060] notify_ring+0xae/0x2e0 [i915]
[ 206.923073] ? ibx_hpd_irq_handler+0xc0/0xc0 [i915]
[ 206.923086] gen8_gt_irq_handler+0x219/0x290 [i915]
[ 206.923100] gen8_irq_handler+0x8e/0x6b0 [i915]
[ 206.923105] __handle_irq_event_percpu+0x58/0x370
[ 206.923109] handle_irq_event_percpu+0x1e/0x50
[ 206.923113] handle_irq_event+0x34/0x60
[ 206.923117] handle_edge_irq+0xbe/0x150
[ 206.923122] handle_irq+0x15/0x20
[ 206.923126] do_IRQ+0x63/0x130
[ 206.923142] ? i915_mutex_lock_interruptible+0x39/0x140 [i915]
[ 206.923148] common_interrupt+0x90/0x90
[ 206.923153] RIP: 0010:osq_lock+0x77/0x110
[ 206.923157] RSP: 0018:
ffffc90001cabaa0 EFLAGS:
00000246 ORIG_RAX:
ffffffffffffff6e
[ 206.923164] RAX:
0000000000000000 RBX:
ffff880236d1abc0 RCX:
ffff8801ef642fc0
[ 206.923169] RDX:
ffff8801ef6427c0 RSI:
ffffffff81c6e7fd RDI:
ffffffff81c7c848
[ 206.923175] RBP:
ffffc90001cabab8 R08:
00000000692bb19b R09:
08c1493200000000
[ 206.923180] R10:
0000000000000001 R11:
0000000000000001 R12:
ffff880236cdabc0
[ 206.923185] R13:
ffff8802207f00b0 R14:
ffffffffa00b7cd9 R15:
ffff8802207f0070
[ 206.923191] </IRQ>
[ 206.923206] ? i915_mutex_lock_interruptible+0x39/0x140 [i915]
[ 206.923213] __mutex_lock+0x649/0x990
[ 206.923217] ? __mutex_lock+0xb0/0x990
[ 206.923221] ? _raw_spin_unlock+0x2c/0x50
[ 206.923226] ? __pm_runtime_resume+0x56/0x80
[ 206.923242] ? i915_mutex_lock_interruptible+0x39/0x140 [i915]
[ 206.923249] mutex_lock_interruptible_nested+0x16/0x20
[ 206.923264] i915_mutex_lock_interruptible+0x39/0x140 [i915]
[ 206.923270] ? __pm_runtime_resume+0x56/0x80
[ 206.923285] i915_gem_do_execbuffer.isra.15+0x442/0x1d10 [i915]
[ 206.923291] ? __lock_acquire+0x449/0x1b50
[ 206.923296] ? __might_fault+0x3e/0x90
[ 206.923301] ? __might_fault+0x87/0x90
[ 206.923305] ? __might_fault+0x3e/0x90
[ 206.923320] i915_gem_execbuffer2+0xb5/0x220 [i915]
[ 206.923327] drm_ioctl+0x200/0x450
[ 206.923341] ? i915_gem_execbuffer+0x330/0x330 [i915]
[ 206.923348] do_vfs_ioctl+0x90/0x6e0
[ 206.923352] ? __fget+0x108/0x200
[ 206.923356] ? expand_files+0x2b0/0x2b0
[ 206.923361] SyS_ioctl+0x3c/0x70
[ 206.923365] entry_SYSCALL_64_fastpath+0x1c/0xb1
[ 206.923369] RIP: 0033:0x7fdd75fc6357
[ 206.923373] RSP: 002b:
00007fdd20e59bf8 EFLAGS:
00000246 ORIG_RAX:
0000000000000010
[ 206.923380] RAX:
ffffffffffffffda RBX:
ffffffff81481ff3 RCX:
00007fdd75fc6357
[ 206.923385] RDX:
00007fdd20e59c70 RSI:
0000000040406469 RDI:
0000000000000003
[ 206.923390] RBP:
ffffc90001cabf88 R08:
0000000000000040 R09:
00000000000003f7
[ 206.923396] R10:
0000000000000000 R11:
0000000000000246 R12:
0000000000000000
[ 206.923401] R13:
0000000000000003 R14:
0000000040406469 R15:
0000000001cf9cb0
[ 206.923408] ? __this_cpu_preempt_check+0x13/0x20
Fixes:
56299fb7d904 ("drm/i915: Signal first fence from irq handler if complete")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100051
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170303144557.4815-1-chris@chris-wilson.co.uk
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Ville Syrjälä [Thu, 2 Mar 2017 17:15:08 +0000 (19:15 +0200)]
drm/i915: Add FIFO underrun tracepoints
Add tracepoints for display FIFO underruns. Makes it more convenient to
correlate the underruns with other display tracepoints.
v2: s/i915/intel/ in the tracepoint name
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170302171508.1666-19-ville.syrjala@linux.intel.com
Ville Syrjälä [Thu, 2 Mar 2017 17:15:07 +0000 (19:15 +0200)]
drm/i915: Add cxsr toggle tracepoint
Add a tracepoint for observing changes in the cxsr state. The tracepoint
will dump out the frame and scanline counters for each pipe so that the
information can be compared with eg. plane update tracepoints.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170302171508.1666-18-ville.syrjala@linux.intel.com
Ville Syrjälä [Thu, 2 Mar 2017 17:15:06 +0000 (19:15 +0200)]
drm/i915: Add VLV/CHV watermark/FIFO programming tracepoints
Add tracepoints for observing the WM/FIFO programming on VLV/CHV. When
compared with the plane and pipe update tracepoints this can be used
to verify that everything is performed in the right sequence.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170302171508.1666-17-ville.syrjala@linux.intel.com
Ville Syrjälä [Thu, 2 Mar 2017 17:15:05 +0000 (19:15 +0200)]
drm/i915: Add plane update/disable tracepoints
Add tracepoints for plane programming. The tracepoints will dump
the frame and scanline counters, so this can be used to verify eg. that
the plane gets reprogrammed at the right time with respect to watermark
programming (if we have appropriate tracepoints for that as well).
v2: Rebase due to legacy cursor changes
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170302171508.1666-16-ville.syrjala@linux.intel.com
Ville Syrjälä [Thu, 2 Mar 2017 17:15:04 +0000 (19:15 +0200)]
drm/i915: Kill level 0 wm hack for VLV/CHV
We now compute the watermarks correctly, so just return an error if we
can't support the configuration.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170302171508.1666-15-ville.syrjala@linux.intel.com
Ville Syrjälä [Thu, 2 Mar 2017 17:15:03 +0000 (19:15 +0200)]
drm/i915: Workaround VLV/CHV sprite1->sprite0 enable underrun
On VLV/CHV enabling sprite0 when sprite1 has already been enabled may
lead to an underrun. This only happens when sprite0 FIFO size is zero
prior to enabling it. Hence an effective workaround is to always
allocate at least one cacheline for sprite0 when sprite1 is active.
I've not observed this sort of failure during any other type of plane
enable/disable sequence.
v2: s/noninverted/raw/ for consistency with other platforms
Testcase: igt/kms_plane_blinker
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170302171508.1666-14-ville.syrjala@linux.intel.com
Ville Syrjälä [Thu, 2 Mar 2017 17:15:02 +0000 (19:15 +0200)]
drm/i915: Sanitize VLV/CHV watermarks properly
Clear out the watermark for all disabled planes to 0. This is required
to avoid falsely thinking that the inherited watermarks are bogus in
case the watermark is actually higher than the FIFO size.
v2: s/noninverted/raw/ for consistency with other platforms
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170302171508.1666-13-ville.syrjala@linux.intel.com
Ville Syrjälä [Thu, 2 Mar 2017 17:15:01 +0000 (19:15 +0200)]
drm/i915: Only use update_wm_{pre,post} for pre-ilk platforms
Now that vlv/chv have more proper wm programming support, let's reduce
the the update_wm_{pre,post} flags to only cover the pre-ilk platforms.
When we finally convert those as well we can drop these flags entirely.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170302171508.1666-12-ville.syrjala@linux.intel.com
Ville Syrjälä [Thu, 2 Mar 2017 17:15:00 +0000 (19:15 +0200)]
drm/i915: Nuke crtc->wm.cxsr_allowed
Remove crtc->wm.cxsr_allowed and just rely on crtc_state->disable_cxsr
instead. This was used only by vlv/chv to indicate whether to enable
cxsr in the wm computation. That doesn't really work anymore, and as far
as the optimal watermarks go we'll just consider the number of planes
and the current pipe, and for the intermediate watermarks we'll also
start to consider disable_cxsr which is set appropriately when planes
are being enabled/disabled.
We'll also flip over the crtc_state->wm.need_postvbl_update setup so
that it's the wm code that will set it. Previously the generic code set
it up, and then the wm code cleared it again if it thought it's not
needed after all.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170302171508.1666-11-ville.syrjala@linux.intel.com
Ville Syrjälä [Thu, 2 Mar 2017 17:14:59 +0000 (19:14 +0200)]
drm/i915: Compute proper intermediate wms for vlv/cvh
Since the watermark registers arent double buffered on VLV/CHV, we'll
need to play around with intermediate watermarks same was as we do on
ILK-BDW.
The watermark registers on VLV/CHV contain inverted values, so to find
the intermediate watermark value we just take the minimum of the
active and optimal values. This also means that, unlike ILK-BDW,
there's no chance that we'd fail to find a working intermediate
watermarks. As long as both the active and optimal watermarks are valid
the intermediate watermarks will come out valid as well.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170302171508.1666-10-ville.syrjala@linux.intel.com
Ville Syrjälä [Thu, 2 Mar 2017 17:14:58 +0000 (19:14 +0200)]
drm/i915: Skip useless watermark/FIFO related work on VLV/CHV when not needed
Check whether anything relevant has actually change when we compute new
watermarks for each plane in the state. If the watermarks for no
primary/sprite planes changed we don't have to recompute the FIFO split
or reprogram the DSBARB registers. And even the cursor watermarks didn't
change we can skip the merge+invert step between all the planes on
the pipe as well.
v2: s/noninverted/raw/ for consistency with other platforms
v3: Drop duplicated vlv_get_fifo_size() call during init
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170302171508.1666-9-ville.syrjala@linux.intel.com
Ville Syrjälä [Thu, 2 Mar 2017 17:14:57 +0000 (19:14 +0200)]
drm/i915: Compute vlv/chv wms the atomic way
Start computing the vlv/chv watermarks the atomic way, from the
.compute_pipe_wm() hook. We'll recompute the actual watermarks
for only planes that are part of the state, the other planes will
keep their watermark from the last time it was computed.
And the actual watermark programming will happen from the
.initial_watermarks() hook. For now we'll just compute the
optimal watermarks, and we'll hook up the intermediate
watermarks properly later.
The DSPARB registers responsible for the FIFO paritioning are
double buffered, so they will be programming from
intel_begin_crtc_commit().
v2: s/noninverted/raw/ for consistency with other platforms
s/vlv_plane_wm_set/vlv_raw_plane_wm_set/ for clarity
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170302171508.1666-8-ville.syrjala@linux.intel.com
Ville Syrjälä [Thu, 2 Mar 2017 17:14:56 +0000 (19:14 +0200)]
drm/i915: Compute VLV/CHV FIFO sizes based on the PM2 watermarks
Let's compute the watermarks first and the FIFO size second. This way we
can make sure the FIFO split is the most accommodating to the watermarks.
Previously we could have potentially computed a FIFO split that couldn't
accommodate the PM2 watermarks simply due to a bad split even if the
total FIFO size would have been sufficient.
It'll also allow us to avoid recomputing the wms for all planes whenever
the FIFO split would change. Thus we don't have to add any extra planes
to the state when the FIFO needs to be repartitioned.
To help with this we'll keep around copies of the non-inverted
watermarks in the crtc state. For now that doesn't help too much, but
once we start to do the watermark computation only for the planes
that change we'll need the non-inverted values around for the other
planes.
v2: s/noninverted/raw/ for consistency with other platforms
Fix the memset() of the "raw" watermarks
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170302171508.1666-7-ville.syrjala@linux.intel.com
Ville Syrjälä [Thu, 2 Mar 2017 17:14:55 +0000 (19:14 +0200)]
drm/i915: Plop vlv/chv fifo sizes into crtc state
Move the vlv/chv FIFO size tracking into the crtc_state. As with the wms
for now this just acts as temporary storage.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170302171508.1666-6-ville.syrjala@linux.intel.com
Ville Syrjälä [Thu, 2 Mar 2017 17:14:54 +0000 (19:14 +0200)]
drm/i915: Plop vlv wm state into crtc_state
Relocate the vlv/chv wm state to live under intel_crtc_state. Note
that for now this just behaves as a temporary storage. But it'll be
easier to conver the thing over to properly pre-computing the state
when it's already in the right place.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170302171508.1666-5-ville.syrjala@linux.intel.com
Ville Syrjälä [Thu, 2 Mar 2017 17:14:53 +0000 (19:14 +0200)]
drm/i915: Move vlv wms from crtc->wm_state to crtc->wm.active.vlv
In an effort to make the vlv/chv wm code look and behave more like the
ilk+ code, let's move the current active wms next to the
corresponding ilk wms.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170302171508.1666-4-ville.syrjala@linux.intel.com
Ville Syrjälä [Thu, 2 Mar 2017 17:14:52 +0000 (19:14 +0200)]
drm/i915: Track plane fifo sizes under intel_crtc
Track the plane fifo sizes under intel_crtc instead of under each
intel_plane. Avoids looping over the planes in a bunch of places,
and later we'll move this tracking into the crtc state properly.
v2: Nuke intel_plane_wm_parameters (Maarten)
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170302171508.1666-3-ville.syrjala@linux.intel.com
Ville Syrjälä [Thu, 2 Mar 2017 17:14:51 +0000 (19:14 +0200)]
drm/i915: Track visible planes in a bitmask
In a lot of place we wish to know which planes on the crtc are actually
visible, or how many of them there are. Let's start tracking that in a
bitmask in the crtc state.
We already track enabled planes (ie. ones with an fb and crtc specified by
the user) but that's not quite the same thing as enabled planes may
still end up being invisible due to clipping and whatnot.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170302171508.1666-2-ville.syrjala@linux.intel.com
Mika Kuoppala [Tue, 28 Feb 2017 15:28:11 +0000 (17:28 +0200)]
drm/i915/gtt: Setup vm callbacks late
If we manage to tangle errorpaths and get call to callbacks,
it is better to defensively keep them as null until object init is
finished so that we get clean null deref on callsite,
instead of more cryptic wreckage with partly initialized vm objects.
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/1488295691-9404-5-git-send-email-mika.kuoppala@intel.com
Mika Kuoppala [Tue, 28 Feb 2017 15:28:10 +0000 (17:28 +0200)]
drm/i915: Avoid using word legacy with ppgtt
The term legacy is subjective. Use 3lvl and 4lvl
where appropriate.
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/1488295691-9404-4-git-send-email-mika.kuoppala@intel.com
Mika Kuoppala [Tue, 28 Feb 2017 15:28:09 +0000 (17:28 +0200)]
drm/i915/gtt: Prefer i915_vm_is_48bit() over macro
If we setup the vm size early, we can use the newly introduced
i915_vm_is_48bit() in majority of callsites wanting to know the vm size.
As we operate either with 3lvl or 4lvl page table structure,
wrap the vm size query inside a function which tells us if
4lvl setup is needed for particular vm, as the following
code uses the function names where level is noted.
v2: use_4lvl (Chris)
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/1488295691-9404-3-git-send-email-mika.kuoppala@intel.com
Mika Kuoppala [Tue, 28 Feb 2017 15:28:08 +0000 (17:28 +0200)]
drm/i915: Don't mark pdps clear if pdps are not submitted
Don't mark pdps clear if never do the necessary actions
with the hardware to make them clear.
v2: totally get rid of confusing ppgtt bool (Chris)
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/1488295691-9404-2-git-send-email-mika.kuoppala@intel.com
Mika Kuoppala [Tue, 28 Feb 2017 15:28:07 +0000 (17:28 +0200)]
drm/i915/gtt: Make I915_PDPES_PER_PDP inline function
The macro takes a vm pointer at some sites, and dev_priv on others
We were saved as the internal macro never deferences the pointer
given.
As the number of pdpes depend on vm configuration, make it
as a inline function that accepts vm pointer.
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wsilon.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/1488295691-9404-1-git-send-email-mika.kuoppala@intel.com
Chris Wilson [Fri, 3 Mar 2017 12:19:47 +0000 (12:19 +0000)]
drm/i915: Generalise wait for execlists to be idle
The code to check for execlists completion is generic, so move it to
intel_engine_cs.c, where we can reuse the new intel_engine_is_idle().
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/20170303121947.20482-2-chris@chris-wilson.co.uk
Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>
Chris Wilson [Fri, 3 Mar 2017 12:19:46 +0000 (12:19 +0000)]
drm/i915: Ensure the engine is idle before manually changing HWS
During reset_all_global_seqno() on seqno rollover, we have to update the
HWS. This causes all in flight requests to be completed, so first we
wait. However, we were only waiting for the requests themselves to be
completed and clearing out the waiter rbtrees - what I had missed was
the extra reference in execlists->port[]. Since commit
fe9ae7a3bfdb
("drm/i915/execlists: Detect an out-of-order context switch") we can
detect when the request is retired before the context switch interrupt
is completed. The impact should be neglible outside of debugging.
Testcase: igt/gem_exec_whisper
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170303121947.20482-1-chris@chris-wilson.co.uk
Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>
Ander Conselvan de Oliveira [Thu, 2 Mar 2017 12:58:57 +0000 (14:58 +0200)]
drm/i915: Remove duplicate DDI enabling logic from MST path
The logic to enable a DDI in intel_mst_pre_enable_dp() is essentially
the same as in intel_ddi_pre_enable_dp(). So reuse the latter function
by calling the post_disable hook on the intel_dig_port instead of
duplicating that code.
v2: Don't oops because of a NULL encoder->crtc. (Ville)
v3: Warn for MST + PORT_E too. (Ville)
Cc: Imre Deak <imre.deak@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170302125857.14665-8-ander.conselvan.de.oliveira@intel.com
Ander Conselvan de Oliveira [Thu, 2 Mar 2017 12:58:56 +0000 (14:58 +0200)]
drm/i915: Remove direct usages of intel_crtc->config from DDI code
Remove direct usages of intel_crtc->config from the DDI code. Functions
that didn't yet take a pipe_config as an argument were coverted to do
so.
v2: s/pipe_config/const crtc_state/ (Ville)
- take crtc from crtc_state. (Ville)
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170302125857.14665-7-ander.conselvan.de.oliveira@intel.com
Ander Conselvan de Oliveira [Thu, 2 Mar 2017 12:58:55 +0000 (14:58 +0200)]
drm/i915: Pass intel_crtc to DDI functions called from crtc en/disable
Pass intel_crtc to functions intel_ddi_enable_transcoder_func(),
intel_ddi_set_pipe_settings() and intel_ddi_set_vc_payload_alloc(),
instead of the generic crtc type. By changing the functions
intel_ddi_get_crtc_encoder() so that it receives an intel_crtc
parameter, there is no need for the drm_crtc in the callers.
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170302125857.14665-6-ander.conselvan.de.oliveira@intel.com
Ander Conselvan de Oliveira [Thu, 2 Mar 2017 12:58:54 +0000 (14:58 +0200)]
drm/i915: Pass pipe_config to fdi_link_train() functions
It is preferred to pass pipe_config to functions instead of accessing
crtc->config directly. Follow suit and pass pipe_config to the fdi link
train functions.
v2: Add const; s/pipe_config/crtc_state/ (Ville)
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170302125857.14665-5-ander.conselvan.de.oliveira@intel.com
Ander Conselvan de Oliveira [Thu, 2 Mar 2017 12:58:53 +0000 (14:58 +0200)]
drm/i915: Pass pipe_config to pch_enable() functions
Using crtc->config directly is being removed in favor of passing a
pipe_config. Follow the trend and pass pipe_config to pch_enable()
functions.
v2: s/pipe_config/crtc_state/ (Ville)
- constify crtc_state. (Ville)
- take crtc from crtc_state. (Ville)
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170302125857.14665-4-ander.conselvan.de.oliveira@intel.com
Ander Conselvan de Oliveira [Thu, 2 Mar 2017 12:58:52 +0000 (14:58 +0200)]
drm/i915: Pass intel_crtc to intel_lpt_pch_enable()
The function intel_lpt_pch_enable() needs an intel_crtc so pass that
instead of the generic crtc type.
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170302125857.14665-3-ander.conselvan.de.oliveira@intel.com
Ander Conselvan de Oliveira [Thu, 2 Mar 2017 12:58:51 +0000 (14:58 +0200)]
drm/i915: Pass intel_crtc to fdi_link_train() hooks
The implementation of the fdi_link_train() hooks need an intel_crtc so
just pass that instead of the generic crtc type.
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170302125857.14665-2-ander.conselvan.de.oliveira@intel.com
Chris Wilson [Fri, 3 Mar 2017 09:00:56 +0000 (09:00 +0000)]
drm/i915: Differentiate between hangcheck waiting for timer or scheduler
Check timer_pending() as well as work_pending() to see if the timer for
the hangcheck has already expired and the work is pending execution on
some list somewhere.
v2: Use a more compact if-chain
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170303090056.19973-1-chris@chris-wilson.co.uk
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Chris Wilson [Thu, 2 Mar 2017 12:25:25 +0000 (12:25 +0000)]
drm/i915: Drop spinlocks around adding to the client request list
Adding to the tail of the client request list as the only other user is
in the throttle ioctl that iterates forwards over the list. It only
needs protection against deletion of a request as it reads it, it simply
won't see a new request added to the end of the list, or it would be too
early and rejected. We can further reduce the number of spinlocks
required when throttling by removing stale requests from the client_list
as we throttle.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170302122525.19675-1-chris@chris-wilson.co.uk
Ville Syrjälä [Mon, 20 Feb 2017 14:04:43 +0000 (16:04 +0200)]
drm/i915: Do .init_clock_gating() earlier to avoid it clobbering watermarks
Currently ILK-BDW explicitly disable LP1+ watermarks from their
.init_clock_gating() hooks. Unfortunately that hook gets called way too
late since by that time we've already initialized all the watermark
state tracking which then gets out of sync with the hardware state.
We may eventually want to consider killing off the explicit LP1+
disable from .init_clock_gating(). In the meantime however, we can
avoid the problem by reordering the init sequence such that
intel_modeset_init_hw()->intel_init_clock_gating() gets called
prior to the hardware state takeover.
I suppose prior to the two stage watermark programming we were
magically saved by something that forced the watermarks to be
reprogrammed fully after .init_clock_gating() got called. But
now that no longer happens.
Note that the diff might look a bit odd as it kills off one
call of intel_update_cdclk(), but that's fine because
intel_modeset_init_hw() does the exact same thing. Previously
we just did it twice.
Actually even this new init sequence is pretty bogus as
.init_clock_gating() really should be called before any gem
hardware init since it can configure various clock gating
workarounds and whatnot that affect the GT side as well. Also
intel_modeset_init() really should get split up into better
defined init stages. Another "fun" detail is that
intel_modeset_gem_init() is where RPS/RC6 gets configured.
Why that is done from the display code is beyond me. I've
decided to leave all this be for now, and just try to fix
the init sequence enough for watermarks to work.
Cc: stable@vger.kernel.org
Cc: Gabriele Mazzotta <gabriele.mzt@gmail.com>
Cc: David Purton <dcpurton@marshwiggle.net>
Cc: Matt Roper <matthew.d.roper@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reported-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
Reported-by: David Purton <dcpurton@marshwiggle.net>
Tested-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96645
Fixes:
ed4a6a7ca853 ("drm/i915: Add two-stage ILK-style watermark programming (v11)")
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170220140443.30891-1-ville.syrjala@linux.intel.com
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Chris Wilson [Thu, 2 Mar 2017 15:15:44 +0000 (15:15 +0000)]
drm/i915: Include power-management state in gpu error dump
Useful for double checking that the device is powered up when it hung,
include both the status of the power management and our rpm wakelock.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170302151544.16915-1-chris@chris-wilson.co.uk
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Chris Wilson [Thu, 2 Mar 2017 15:03:56 +0000 (15:03 +0000)]
drm/i915: Include GT/seqno activity in engine/hangcheck debugfs
Whilst investigating some mysterious failures with hangcheck not running
during gem_busy/basic-hang-default, the question is why did we decide to
cancel the retire_work (which queues the hangcheck)? That decision is
based around GT activity, so include that information in the debug
report.
v2: Include the GT awake status in the error state
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170302150356.9713-1-chris@chris-wilson.co.uk
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Chris Wilson [Thu, 2 Mar 2017 14:53:23 +0000 (14:53 +0000)]
drm/i915/guc: Disable irq for __i915_guc_submit wq_lock
__i915_guc_submit may be, despite my assertion, called from outside of
an irq-safe spinlock so we need to use a full spin_lock_irqsave and not
cheat using a spin_lock. (The initial notify callback from the completed
fence is called before the spinlock is taken to wake up all waiters and
call their callbacks.)
[ 48.166581] kernel BUG at drivers/gpu/drm/i915/i915_guc_submission.c:527!
[ 48.166617] invalid opcode: 0000 [#1] PREEMPT SMP
[ 48.166644] Modules linked in: i915 prime_numbers x86_pkg_temp_thermal intel_powerclamp coretemp crct10dif_pclmul crc32_pclmul ghash_clmulni_intel mei_me mei i2c_i801 netconsole i2c_hid [last unloaded: i915]
[ 48.166733] CPU: 2 PID: 5 Comm: kworker/u8:0 Tainted: G U 4.10.0nightly-170302-guc_scrub+ #19
[ 48.166778] Hardware name: /NUC6i5SYB, BIOS SYSKLi35.86A.0054.2016.0930.1102 09/30/2016
[ 48.166835] Workqueue: i915 __intel_autoenable_gt_powersave [i915]
[ 48.166865] task:
ffff88084ab7cf40 task.stack:
ffffc90000064000
[ 48.166921] RIP: 0010:__i915_guc_submit+0x1e6/0x2a0 [i915]
[ 48.166953] RSP: 0018:
ffffc90000067c80 EFLAGS:
00010202
[ 48.166979] RAX:
0000000000000202 RBX:
ffff8808465e0c68 RCX:
0000000000000201
[ 48.167016] RDX:
0000000080000201 RSI:
ffff88084ab7d798 RDI:
ffff88082b8a8040
[ 48.167054] RBP:
ffffc90000067cd8 R08:
0000000000000001 R09:
0000000000000000
[ 48.167085] R10:
0000000000000000 R11:
0000000000000000 R12:
ffff88082b8a8148
[ 48.167126] R13:
0000000000000000 R14:
ffff88082f440000 R15:
ffff88082e85e660
[ 48.167156] FS:
0000000000000000(0000) GS:
ffff88086ed00000(0000) knlGS:
0000000000000000
[ 48.167195] CS: 0010 DS: 0000 ES: 0000 CR0:
0000000080050033
[ 48.167226] CR2:
000055862ffcdc2c CR3:
0000000001e0f000 CR4:
00000000003406e0
[ 48.167257] Call Trace:
[ 48.168112] ? trace_hardirqs_on+0xd/0x10
[ 48.168966] ? _raw_spin_unlock_irqrestore+0x4a/0x80
[ 48.169831] i915_guc_submit+0x1a/0x20 [i915]
[ 48.170680] submit_notify+0x89/0xc0 [i915]
[ 48.171512] __i915_sw_fence_complete+0x175/0x220 [i915]
[ 48.172340] i915_sw_fence_complete+0x2a/0x50 [i915]
[ 48.173158] i915_sw_fence_commit+0x21/0x30 [i915]
[ 48.173968] __i915_add_request+0x238/0x530 [i915]
[ 48.174764] __intel_autoenable_gt_powersave+0x8b/0xb0 [i915]
[ 48.175549] process_one_work+0x218/0x690
[ 48.176318] ? process_one_work+0x197/0x690
[ 48.177183] worker_thread+0x4e/0x4a0
[ 48.178039] kthread+0x10c/0x140
[ 48.178878] ? process_one_work+0x690/0x690
[ 48.179718] ? kthread_create_on_node+0x40/0x40
[ 48.180568] ret_from_fork+0x31/0x40
[ 48.181423] Code: 02 00 00 43 89 84 ae 50 11 00 00 e8 75 01 62 e1 48 83 c4 30 5b 41 5c 41 5d 41 5e 41 5f 5d c3 48 c1 e0 20 48 09 c2 49 89 d0 eb 82 <0f> 0b 0f 0b 0f 0b 0f 0b 0f 0b 0f 0b 49 c1 e8 20 44 89 43 34 4a
[ 48.183336] RIP: __i915_guc_submit+0x1e6/0x2a0 [i915] RSP:
ffffc90000067c80
Reported-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Fixes:
349ab9192cc3 ("drm/i915/guc: Make wq_lock irq-safe")
Fixes:
67b807a89230 ("drm/i915: Delay disabling the user interrupt for breadcrumbs")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170302145323.12886-1-chris@chris-wilson.co.uk
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Tested-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Chris Wilson [Thu, 2 Mar 2017 13:28:01 +0000 (13:28 +0000)]
drm/i915: s/assert_spin_locked/lockdep_assert_held/
assert_spin_locked() becomes an unconditionally compiled BUG_ON(),
adding debug code right into the heart of critical routines like
interrupt handlers.
text data bss dec hex
1296480 19944 2272
1318696 141f28 before (lockdep disabled)
1295984 19944 2272
1318200 141d38 after
1336261 21139 3208
1360608 14c2e0 before (lockdep enabled)
1339920 21139 3208
1364267 14d12b after
Small saving for release; hopefully more instructive in debug.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170302132801.599-1-chris@chris-wilson.co.uk
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Chris Wilson [Thu, 2 Mar 2017 11:51:30 +0000 (11:51 +0000)]
drm/i915: Assert that fence->lock is held in an irq-safe manner
Everytime we take the fence->lock (aka request->lock), we must do so
with irqs disabled since it may be used from within an hardirq context.
As sometimes we are taking the lock in a nested manner, assert that the
caller did disable the irqs for us.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170302115130.28434-1-chris@chris-wilson.co.uk
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Ville Syrjälä [Fri, 17 Feb 2017 15:01:59 +0000 (17:01 +0200)]
drm/i915: Fix legacy cursor vs. watermarks for ILK-BDW
In order to make cursor updates actually safe wrt. watermark programming
we have to clear the legacy_cursor_update flag in the atomic state. That
will cause the regular atomic update path to do the necessary vblank
wait after the plane update if needed, otherwise the vblank wait would
be skipped and we'd feed the optimal watermarks to the hardware before
the plane update has actually happened.
To make the slow vs. fast path determination in
intel_legacy_cursor_update() a little simpler we can ignore the actual
visibility of the plane (which can only get computed once we've already
chosen out path) and instead we simply check whether the fb is being
set or cleared by the user. This means a fully clipped but logically
visible cursor will be considered visible as far as watermark
programming is concerned. We can do that for the cursor since it's a
fixed size plane and the clipped size doesn't play a role in the
watermark computation.
This should fix underruns that can occur when the cursor gets
enable/disabled or the size gets changed. Hopefully it's good enough
that only pure cursor movement and flips go through unthrottled.
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Uwe Kleine-König <uwe@kleine-koenig.org>
Reported-by: Uwe Kleine-König <uwe@kleine-koenig.org>
Fixes:
f79f26921ee1 ("drm/i915: Add a cursor hack to allow converting legacy page flip to atomic, v3.")
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170217150159.11683-1-ville.syrjala@linux.intel.com
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Tested-by: Rafael Ristovski <rafael.ristovski@gmail.com>
Madhav Chauhan [Wed, 1 Mar 2017 18:31:22 +0000 (00:01 +0530)]
drm/i915/glk: Fix DSI enable I/O sequence
One of the if statement covers the next line in enable I/O sequence.
This patch correct the same by adding error message.
Fixes:
4644848369c0 ("drm/i915/glk: Add MIPIIO Enable/disable sequence")
Reported-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Madhav Chauhan <madhav.chauhan@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1488393082-30660-1-git-send-email-madhav.chauhan@intel.com
Anusha Srivatsa [Wed, 1 Mar 2017 19:58:55 +0000 (11:58 -0800)]
i915/HuC: Add an extra check for platforms that do not have HUC
Return silently without producing much noise on platforms
that have a HuC but the firmware is absent.
Cc: Ander Conselvan De Oliveira <ander.conselvan.de.oliveira@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@itel.com>
Signed-off-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1488398335-13121-1-git-send-email-anusha.srivatsa@intel.com
Chris Wilson [Thu, 2 Mar 2017 07:41:57 +0000 (07:41 +0000)]
drm/i915: Restore the invalid access without RPM warning
A long time ago we turned off the warning as it was too painful, we had
too much broken code. Turn it back on now as we are mostly clean and
need to prevent returning to such orangeness.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Imre Deak <imre.deak@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170302074157.21631-2-chris@chris-wilson.co.uk
Reviewed-by: Imre Deak <imre.deak@intel.com>
Chris Wilson [Thu, 2 Mar 2017 08:30:29 +0000 (08:30 +0000)]
drm/i915: Hold rpm during GEM suspend in driver unload/suspend
i915_gem_suspend() tries to access the device to ensure it is idle and
all writes from the device are flushed to memory. It assumed is already
held the runtime pm wakeref, but we should explicitly acquire it for our
access to be safe.
[ 619.926287] WARNING: CPU: 3 PID: 9353 at drivers/gpu/drm/i915/intel_drv.h:1750 gen6_write32+0x23e/0x2a0 [i915]
[ 619.926300] RPM wakelock ref not held during HW access
[ 619.926311] Modules linked in: vgem x86_pkg_temp_thermal intel_powerclamp snd_hda_codec_hdmi snd_hda_codec_generic snd_hda_codec coretemp snd_hwdep crct10dif_pclmul snd_hda_core crc32_pclmul snd_pcm mei_me mei lpc_ich ghash_clmulni_intel i915(-) sdhci_pci sdhci mmc_core e1000e ptp pps_core prime_numbers [last unloaded: snd_hda_intel]
[ 619.926578] CPU: 3 PID: 9353 Comm: drv_module_relo Tainted: G U 4.10.0-CI-Trybot_609+ #1
[ 619.926585] Hardware name: LENOVO 42962WU/42962WU, BIOS 8DET56WW (1.26 ) 12/01/2011
[ 619.926592] Call Trace:
[ 619.926609] dump_stack+0x67/0x92
[ 619.926625] __warn+0xc6/0xe0
[ 619.926640] warn_slowpath_fmt+0x4a/0x50
[ 619.926726] gen6_write32+0x23e/0x2a0 [i915]
[ 619.926801] gen6_mm_switch+0x38/0x70 [i915]
[ 619.926871] i915_switch_context+0xec/0xa10 [i915]
[ 619.926942] i915_gem_switch_to_kernel_context+0x13c/0x2b0 [i915]
[ 619.927019] i915_gem_suspend+0x2b/0x180 [i915]
[ 619.927079] i915_driver_unload+0x22/0x200 [i915]
[ 619.927093] ? __this_cpu_preempt_check+0x13/0x20
[ 619.927105] ? trace_hardirqs_on_caller+0xe7/0x200
[ 619.927118] ? trace_hardirqs_on+0xd/0x10
[ 619.927128] ? _raw_spin_unlock_irqrestore+0x3d/0x60
[ 619.927192] i915_pci_remove+0x14/0x20 [i915]
[ 619.927205] pci_device_remove+0x34/0xb0
[ 619.927219] device_release_driver_internal+0x158/0x210
[ 619.927234] driver_detach+0x3b/0x80
[ 619.927245] bus_remove_driver+0x53/0xd0
[ 619.927256] driver_unregister+0x27/0x50
[ 619.927267] pci_unregister_driver+0x25/0xa0
[ 619.927351] i915_exit+0x1a/0xb1a [i915]
[ 619.927362] SyS_delete_module+0x193/0x1e0
[ 619.927378] entry_SYSCALL_64_fastpath+0x1c/0xb1
[ 619.927386] RIP: 0033:0x7f82b46c5d37
[ 619.927393] RSP: 002b:
00007ffdb6f610d8 EFLAGS:
00000246 ORIG_RAX:
00000000000000b0
[ 619.927408] RAX:
ffffffffffffffda RBX:
ffffffff81481ff3 RCX:
00007f82b46c5d37
[ 619.927415] RDX:
0000000000000001 RSI:
0000000000000800 RDI:
000000000224f558
[ 619.927422] RBP:
ffffc90001187f88 R08:
0000000000000000 R09:
00007ffdb6f61100
[ 619.927428] R10:
000000000224f4e0 R11:
0000000000000246 R12:
0000000000000000
[ 619.927435] R13:
00007ffdb6f612b0 R14:
0000000000000000 R15:
0000000000000000
[ 619.927451] ? __this_cpu_preempt_check+0x13/0x20
or
[ 641.646590] WARNING: CPU: 1 PID: 8913 at drivers/gpu/drm/i915/intel_drv.h:1750 intel_runtime_pm_get_noresume+0x8b/0x90 [i915]
[ 641.646595] RPM wakelock ref not held during HW access
[ 641.646600] Modules linked in: vgem snd_hda_codec_hdmi snd_hda_codec_generic x86_pkg_temp_thermal intel_powerclamp coretemp snd_hda_codec snd_hwdep crct10dif_pclmul snd_hda_core crc32_pclmul ghash_clmulni_intel snd_pcm mei_me mei i915(-) r8169 mii prime_numbers i2c_hid [last unloaded: snd_hda_intel]
[ 641.646825] CPU: 1 PID: 8913 Comm: drv_module_relo Tainted: G U 4.10.0-CI-Trybot_609+ #1
[ 641.646836] Hardware name: TOSHIBA SATELLITE P50-C/06F4 , BIOS 1.20 10/08/2015
[ 641.646843] Call Trace:
[ 641.646857] dump_stack+0x67/0x92
[ 641.646869] __warn+0xc6/0xe0
[ 641.646880] warn_slowpath_fmt+0x4a/0x50
[ 641.646893] ? __this_cpu_preempt_check+0x13/0x20
[ 641.646904] ? trace_hardirqs_on_caller+0xe7/0x200
[ 641.646957] intel_runtime_pm_get_noresume+0x8b/0x90 [i915]
[ 641.647022] __i915_add_request+0x423/0x540 [i915]
[ 641.647080] i915_gem_switch_to_kernel_context+0x148/0x2b0 [i915]
[ 641.647145] i915_gem_suspend+0x2b/0x180 [i915]
[ 641.647189] i915_driver_unload+0x22/0x200 [i915]
[ 641.647200] ? __this_cpu_preempt_check+0x13/0x20
[ 641.647210] ? trace_hardirqs_on_caller+0xe7/0x200
[ 641.647220] ? trace_hardirqs_on+0xd/0x10
[ 641.647231] ? _raw_spin_unlock_irqrestore+0x3d/0x60
[ 641.647276] i915_pci_remove+0x14/0x20 [i915]
[ 641.647293] pci_device_remove+0x34/0xb0
[ 641.647307] device_release_driver_internal+0x158/0x210
[ 641.647321] driver_detach+0x3b/0x80
[ 641.647330] bus_remove_driver+0x53/0xd0
[ 641.647338] driver_unregister+0x27/0x50
[ 641.647348] pci_unregister_driver+0x25/0xa0
[ 641.647415] i915_exit+0x1a/0xb1a [i915]
[ 641.647429] SyS_delete_module+0x193/0x1e0
[ 641.647444] entry_SYSCALL_64_fastpath+0x1c/0xb1
[ 641.647453] RIP: 0033:0x7fc622bd2d37
[ 641.647463] RSP: 002b:
00007ffff8ffb5c8 EFLAGS:
00000246 ORIG_RAX:
00000000000000b0
[ 641.647475] RAX:
ffffffffffffffda RBX:
ffffffff81481ff3 RCX:
00007fc622bd2d37
[ 641.647480] RDX:
0000000000000001 RSI:
0000000000000800 RDI:
0000000000d49118
[ 641.647485] RBP:
ffffc90000997f88 R08:
0000000000000000 R09:
00007ffff8ffb5f0
[ 641.647491] R10:
0000000000d490a0 R11:
0000000000000246 R12:
0000000000000000
[ 641.647498] R13:
00007ffff8ffb7a0 R14:
0000000000000000 R15:
0000000000000000
[ 641.647510] ? __this_cpu_preempt_check+0x13/0x20
v2: Keep holding rpm until the end to cover i915_gem_sanitize() as well.
Fixes:
5ab57c702069 ("drm/i915: Flush logical context image out to memory upon suspend")
Fixes:
1c777c5d1dc ("drm/i915/hsw: Fix GPU hang during resume from S3-devices state")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/20170302083029.19576-1-chris@chris-wilson.co.uk
Reviewed-by: Imre Deak <imre.deak@intel.com>
Cc: <stable@vger.kernel.org> # v4.9+
Ander Conselvan de Oliveira [Wed, 1 Mar 2017 14:13:11 +0000 (16:13 +0200)]
drm/i915: Enable DDI IO power domains in the DP MST path
Commit
62b695662a24 ("drm/i915: Only enable DDI IO power domains after
enabling DPLL") changed how the DDI IO power domains get enabled, but
neglected the need to enable those domains when enabling a DP connector
with MST enabled, leading to
Kernel panic - not syncing: Timeout: Not all CPUs entered broadcast exception handler
Fixes:
62b695662a24 ("drm/i915: Only enable DDI IO power domains after enabling DPLL")
Cc: Imre Deak <imre.deak@intel.com>
Cc: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Cc: David Weinehall <david.weinehall@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reported-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170301141318.3607-2-ander.conselvan.de.oliveira@intel.com
Chris Wilson [Wed, 1 Mar 2017 12:11:31 +0000 (12:11 +0000)]
drm/i915: Move w/a LRI debug message from context-init to driver load
The spam of every context initialisation saying the same thing is annoying
me! Move the information to the setup of the engine.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170301121131.11588-1-chris@chris-wilson.co.uk
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Chris Wilson [Wed, 1 Mar 2017 15:41:28 +0000 (15:41 +0000)]
drm/i915: Prevent concurrent tiling/framebuffer modifications
Reintroduce a lock around tiling vs framebuffer creation to prevent
modification of the obj->tiling_and_stride whilst the framebuffer is
being created. Rather than use struct_mutex once again, use the
per-object lock - this will also be required in future to prevent
changing the tiling whilst submitting rendering.
Reported-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Fixes:
24dbf51a5517 ("drm/i915: struct_mutex is not required for allocating the framebuffer")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170301154128.2841-2-chris@chris-wilson.co.uk
Chris Wilson [Wed, 1 Mar 2017 15:41:27 +0000 (15:41 +0000)]
drm/i915: Fix all intel_framebuffer_init failures to take the error path
No more direct return -EINVAL as we have to unwind the
obj->framebuffer_references.
Fixes:
24dbf51a5517 ("drm/i915: struct_mutex is not required for allocating the framebuffer")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170301154128.2841-1-chris@chris-wilson.co.uk
Hans de Goede [Wed, 1 Mar 2017 13:15:06 +0000 (15:15 +0200)]
drm/i915/dsi: Skip delays for v3 VBTs in vid-mode
For v3 VBTs in vid-mode the delays are part of the VBT sequences, so
we should not also delay ourselves otherwise we get double delays.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Bob Paauwe <bob.j.paauwe@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1488374106-4949-11-git-send-email-jani.nikula@intel.com
Hans de Goede [Wed, 1 Mar 2017 13:15:05 +0000 (15:15 +0200)]
drm/i915/dsi: Call MIPI_SEQ_TEAR_ON and DISPLAY_ON for cmd-mode (untested)
According to the spec we should call MIPI_SEQ_TEAR_ON and DISPLAY_ON
on enable for cmd-mode, just like we already call their counterparts
on disable. Note: untested, my panel is a vid-mode panel.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Bob Paauwe <bob.j.paauwe@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1488374106-4949-10-git-send-email-jani.nikula@intel.com
Hans de Goede [Wed, 1 Mar 2017 13:15:04 +0000 (15:15 +0200)]
drm/i915/dsi: Execute MIPI_SEQ_TEAR_OFF from intel_dsi_post_disable
For v3+ VBTs we should call MIPI_SEQ_TEAR_OFF before MIPI_SEQ_DISPLAY_OFF,
v2 VBTs do not have MIPI_SEQ_TEAR_OFF so there this is a nop.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Bob Paauwe <bob.j.paauwe@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1488374106-4949-9-git-send-email-jani.nikula@intel.com
Hans de Goede [Wed, 1 Mar 2017 13:15:03 +0000 (15:15 +0200)]
drm/i915/dsi: Document always using v3 SHUTDOWN / MIPI_SEQ_DISPLAY_OFF order
According to the spec for v2 VBTs we should call MIPI_SEQ_DISPLAY_OFF
before sending SHUTDOWN, where as for v3 VBTs we should send SHUTDOWN
first.
Since the v2 order has known issues, we use the v3 order everywhere,
add a comment documenting this.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Bob Paauwe <bob.j.paauwe@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1488374106-4949-8-git-send-email-jani.nikula@intel.com
Hans de Goede [Wed, 1 Mar 2017 13:15:02 +0000 (15:15 +0200)]
drm/i915/dsi: Group MIPI_SEQ_BACKLIGHT_ON/OFF with panel_[en|dis]able_backlight
Execute the MIPI_SEQ_BACKLIGHT_ON/OFF VBT sequences at the same time as
we call intel_panel_enable_backlight() / intel_panel_disable_backlight().
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Bob Paauwe <bob.j.paauwe@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1488374106-4949-7-git-send-email-jani.nikula@intel.com
Hans de Goede [Wed, 1 Mar 2017 13:15:01 +0000 (15:15 +0200)]
drm/i915/dsi: Execute MIPI_SEQ_DEASSERT_RESET before calling device_ready()
Execute MIPI_SEQ_DEASSERT_RESET before putting the device in ready
state (LP-11), this is the sequence in which things should be done
according to the spec.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Bob Paauwe <bob.j.paauwe@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1488374106-4949-6-git-send-email-jani.nikula@intel.com
Hans de Goede [Wed, 1 Mar 2017 13:15:00 +0000 (15:15 +0200)]
drm/i915/dsi: Group DPOunit clock gate workaround with PLL enable
Move the DPOunit clock gate workaround to directly after the PLL enable.
The exact location of the workaround does not matter and there are 2
reasons to group it with the PLL enable:
1) This moves it out of the middle of the init sequence from the spec,
making it easier to follow the init sequence / compare it to the spec
2) It is grouped with the pll disable call in intel_dsi_post_disable,
so for consistency it should be grouped with the pll enable in
intel_dsi_pre_enable
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Bob Paauwe <bob.j.paauwe@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1488374106-4949-5-git-send-email-jani.nikula@intel.com
Hans de Goede [Wed, 1 Mar 2017 13:14:59 +0000 (15:14 +0200)]
drm/i915/dsi: Move MIPI_SEQ_POWER_ON/OFF calls together with pmic gpio calls
Now that we are no longer bound to the drm_panel_ callbacks, call
MIPI_SEQ_POWER_ON/OFF at the proper place.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Bob Paauwe <bob.j.paauwe@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1488374106-4949-4-git-send-email-jani.nikula@intel.com
Hans de Goede [Wed, 1 Mar 2017 13:14:58 +0000 (15:14 +0200)]
drm/i915/dsi: Drop bogus MIPI_SEQ_ASSERT_RESET before POWER_ON
intel_dsi_post_disable(), which does the MIPI_SEQ_ASSERT_RESET,
will always be called at some point before intel_dsi_pre_enable()
making the MIPI_SEQ_ASSERT_RESET in intel_dsi_pre_enable() redundant.
In addition, calling MIPI_SEQ_ASSERT_RESET in the enable path goes
against the VBT spec.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Bob Paauwe <bob.j.paauwe@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1488374106-4949-3-git-send-email-jani.nikula@intel.com
Hans de Goede [Wed, 1 Mar 2017 13:14:57 +0000 (15:14 +0200)]
drm/i915/dsi: Document the panel enable / disable sequences from the spec
Document the DSI panel enable / disable sequences from the spec,
for easy comparison between the code and the spec.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Bob Paauwe <bob.j.paauwe@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1488374106-4949-2-git-send-email-jani.nikula@intel.com
Jani Nikula [Tue, 28 Feb 2017 11:11:43 +0000 (13:11 +0200)]
drm/i915: use BUILD_BUG_ON to ensure platform name has been set up
Leave the runtime check in place in case the platform variable itself
comes from bogus sources.
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1488280303-9323-1-git-send-email-jani.nikula@intel.com
Imre Deak [Fri, 24 Feb 2017 14:32:10 +0000 (16:32 +0200)]
drm/i915/gen9: Increase PCODE request timeout to 50ms
After
commit
2c7d0602c815277f7cb7c932b091288710d8aba7
Author: Imre Deak <imre.deak@intel.com>
Date: Mon Dec 5 18:27:37 2016 +0200
drm/i915/gen9: Fix PCODE polling during CDCLK change notification
there is still one report of the CDCLK-change request timing out on a
KBL machine, see the Reference link. On that machine the maximum time
the request took to succeed was 34ms, so increase the timeout to 50ms.
v2:
- Change timeout from 100 to 50 ms to maintain the current 50 ms limit
for atomic waits in the driver. (Chris, Tvrtko)
Reference: https://bugs.freedesktop.org/show_bug.cgi?id=99345
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Acked-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/1487946730-17162-1-git-send-email-imre.deak@intel.com
Deepak M [Wed, 1 Mar 2017 07:21:33 +0000 (12:51 +0530)]
drm/i915/glk: Add MIPIIO Enable/disable sequence
v2: Addressed Jani's Review comments(renamed bit field macros)
v3: Jani's Review comment for aligning code to platforms and added
wrapper functions.
v4: Corrected enable/disable seuqence as per BSPEC
v5: Corrected waiting twice for same bit (Review comments: Jani)
v6: Rebased to Han's patches(dsi restructuring code)
Signed-off-by: Deepak M <m.deepak@intel.com>
Signed-off-by: Madhav Chauhan <madhav.chauhan@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1488352893-29916-2-git-send-email-madhav.chauhan@intel.com
Chris Wilson [Tue, 28 Feb 2017 14:55:19 +0000 (14:55 +0000)]
drm/i915: Tighten mmio arrays for MIPI_PORT
drivers/gpu/drm/i915/intel_dsi.c: In function ‘intel_dsi_prepare’:
drivers/gpu/drm/i915/intel_dsi.c:1308:1: error: the frame size of 2488 bytes is larger than 2048 bytes [-Werror=frame-larger-than=]
which is caused by the compiling expanding every _MIPI_PORT into an
on-stack array of u32[3] at every callsite. Not sure why only one
machine/compiler appears susceptible, but with a minor tweak to _MIPI_PORT
we can defer the error until later.
This is a partial revert of commit
ce64645d86ac ("drm/i915: use variadic
macros and arrays to choose port/pipe based registers") for a particular
bad offender.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170228145519.18012-1-chris@chris-wilson.co.uk
Acked-by: Jani Nikula <jani.nikula@intel.com>
Chris Wilson [Tue, 28 Feb 2017 11:28:03 +0000 (11:28 +0000)]
drm/i915/guc: Reorder __i915_guc_submit to reduce spinlock holdtime
A couple of operations, the flushes and the tracepoint, do not require
serialisation by client->wq_lock, so move them before we take it.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170228112803.11646-3-chris@chris-wilson.co.uk
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Chris Wilson [Tue, 28 Feb 2017 11:28:02 +0000 (11:28 +0000)]
drm/i915/guc: Make wq_lock irq-safe
Following the use of dma_fence_signal() from within our interrupt
handler, we need to make guc->wq_lock also irq-safe. This was done
previously as part of the guc scheduler patch (which also started
mixing our fences with the interrupt handler), but is now required to
fix the current guc submission backend.
v4: Document that __i915_guc_submit is always under an irq disabled
section
v5: Move wq_rsvd adjustment to its own function
Fixes:
67b807a89230 ("drm/i915: Delay disabling the user interrupt for breadcrumbs")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Reviewed-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170228112803.11646-2-chris@chris-wilson.co.uk
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Hans de Goede [Tue, 28 Feb 2017 09:26:21 +0000 (11:26 +0200)]
drm/i915/dsi: VLV/CHT Only wait for LP00 on MIPI PORT A
On some devices only MIPI PORT C is used, in this case checking the
MIPI PORT A CTRL AFE_LATCHOUT bit (there is no such bit for PORT C
on VLV/CHT) will result in false positive "DSI LP not going Low" errors
as this checks the PORT A clk status.
In case both ports are used we have already checked the AFE_LATCHOUT
bit when going through the for_each_dsi_port() loop for PORT A and
checking the same bit again for PORT C is a no-op.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97061
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Bob Paauwe <bob.j.paauwe@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/242e4438bf29ebffc66eaa182f22b9d60d304bc2.1488273823.git.jani.nikula@intel.com
Hans de Goede [Tue, 28 Feb 2017 09:26:20 +0000 (11:26 +0200)]
drm/i915/dsi: Make intel_dsi_enable/disable directly exec VBT sequences
The drm_panel_enable/disable and drm_panel_prepare/unprepare calls are
not fine grained enough to abstract all the different steps we need to
take (and VBT sequences we need to exec) properly. So simply remove the
panel _enable/disable and prepare/unprepare callbacks and instead
export intel_dsi_exec_vbt_sequence() from intel_dsi_panel_vbt.c
and call that from intel_dsi_enable/disable().
No functional changes.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Bob Paauwe <bob.j.paauwe@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/b4ca5185d4788d92df2ed60837a24b8962a8e8ba.1488273823.git.jani.nikula@intel.com
Hans de Goede [Tue, 28 Feb 2017 09:26:19 +0000 (11:26 +0200)]
drm/i915/dsi: Move intel_dsi_clear_device_ready()
Move the intel_dsi_clear_device_ready() function to higher up in
intel_dsi.c this pairs it with intel_dsi_device_ready(); and pairs
intel_dsi_*enable* with intel_dsi_*disable without
intel_dsi_clear_device_ready() sitting in the middle of them.
This commit purely moves code around, it does not make any
changes what-so-ever.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Bob Paauwe <bob.j.paauwe@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/f971d18ea6d350890447860aeb541dba072a6e47.1488273823.git.jani.nikula@intel.com
Hans de Goede [Tue, 28 Feb 2017 09:26:18 +0000 (11:26 +0200)]
drm/i915/dsi: Add intel_dsi_unprepare() helper
The enable path has an intel_dsi_prepare() helper which prepares various
registers for the mode-set. Move the code undoing this to a new
intel_dsi_unprepare() helper function for better symmetry between the
enable and disable paths. No functional changes.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Bob Paauwe <bob.j.paauwe@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/cc0baaf04ea74a20031b4b5bb128591dcfa78406.1488273823.git.jani.nikula@intel.com
Hans de Goede [Tue, 28 Feb 2017 09:26:17 +0000 (11:26 +0200)]
drm/i915/dsi: Merge intel_dsi_disable/enable into their respective callers
intel_dsi_disable/enable only have one caller, merge them into their
respective callers.
Change msleep(2) into usleep_range(2000, 5000) to make checkpatch happy,
otherwise no functional changes.
The main advantage of this change is that it makes it easier to
follow all the steps of the panel enable / disable sequence when
reading the code.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Bob Paauwe <bob.j.paauwe@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/d7249612e6d2e9639ecd1d8d106ca37d5794f2a4.1488273823.git.jani.nikula@intel.com
Hans de Goede [Tue, 28 Feb 2017 09:26:16 +0000 (11:26 +0200)]
drm/i915/dsi: Move calling of wait_for_dsi_fifo_empty to mipi_exec_send_packet
Instead of calling wait_for_dsi_fifo_empty on all dsi ports after calling
a drm_panel_foo helper which calls VBT sequences, move it to the VBT
mipi_exec_send_packet helper, which is the one VBT instruction which
actually puts data in the fifo.
This results in a nice cleanup making it clearer what all the steps on
intel_dsi_enable / disable are and this also makes the VBT code properly
wait till a command has actually been send before executing the next
steps (typically a delay) in the VBT sequence.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Bob Paauwe <bob.j.paauwe@intel.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/289977b5699e252fea5c211d1d1645f9e79cca79.1488273823.git.jani.nikula@intel.com
Chris Wilson [Tue, 28 Feb 2017 08:50:18 +0000 (08:50 +0000)]
drm/i915: Consolidate reporting of "missed breadcrumbs"
Move the setting of gpu_error->missed_irq_ring bit to a common function
so that we can get the debug logging for either path.
v2: Add %pF caller
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170228085018.3225-1-chris@chris-wilson.co.uk
Madhav Chauhan [Fri, 17 Feb 2017 12:43:35 +0000 (18:13 +0530)]
drm/i915/glk: Validate only DSI PORT A PLL divider
As per BSPEC, GLK supports MIPI DSI 8X clk only on PORT A.
Therefore only for PORT A PLL divider value should be validated.
Signed-off-by: Madhav Chauhan <madhav.chauhan@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1487335415-14766-8-git-send-email-madhav.chauhan@intel.com
Deepak M [Fri, 17 Feb 2017 12:43:34 +0000 (18:13 +0530)]
drm/i915/glk: Program txesc clock divider for GLK
v2: Addressed Jani's Review comments(renamed bit field macros)
Txesc clock divider is calculated and programmed
for geminilake platform.
Signed-off-by: Deepak M <m.deepak@intel.com>
Signed-off-by: Madhav Chauhan <madhav.chauhan@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1487335415-14766-7-git-send-email-madhav.chauhan@intel.com
Deepak M [Fri, 17 Feb 2017 12:43:33 +0000 (18:13 +0530)]
drm/i915i/glk: Program MIPI_CLOCK_CTRL only for BXT
Register MIPI_CLOCK_CTRL is applicable only
for BXT platform. Future platform have other
registers to program the escape clock dividers.
Signed-off-by: Deepak M <m.deepak@intel.com>
Signed-off-by: Madhav Chauhan <madhav.chauhan@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1487335415-14766-6-git-send-email-madhav.chauhan@intel.com
Deepak M [Fri, 17 Feb 2017 12:43:32 +0000 (18:13 +0530)]
drm/i915/glk: Add DSI PLL divider range for glk
PLL divider range for GLK is different than that of
BXT, hence adding the GLK range check in this patch.
v2: Code restructure using min and max ratio variables (Ander)
v3: Code changes to avoid "maybe-uninitialized" warning (Jani)
Signed-off-by: Deepak M <m.deepak@intel.com>
Signed-off-by: Madhav Chauhan <madhav.chauhan@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1487335415-14766-5-git-send-email-madhav.chauhan@intel.com
Deepak M [Fri, 17 Feb 2017 12:43:30 +0000 (18:13 +0530)]
drm/i915/glk: Program new MIPI DSI PHY registers for GLK
Program the clk lane and tlpx time count registers
to configure DSI PHY.
v2: Addressed Jani's Review comments(renamed bit field macros)
v3: Program clk lane timing reg same as dphy param reg.
v4: Removed "line over 80 character" warning
Signed-off-by: Deepak M <m.deepak@intel.com>
Signed-off-by: Madhav Chauhan <madhav.chauhan@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1487335415-14766-3-git-send-email-madhav.chauhan@intel.com
Deepak M [Fri, 17 Feb 2017 12:43:29 +0000 (18:13 +0530)]
drm/i915/glk: Program dphy param reg for GLK
For GEMINILAKE, dphy param reg values are programmed in terms
of HS byte clock count while for older platforms in terms of
HS ddr clk count.
v2: Added comments to clarify ddr clock count calculation
v3: Use multiplier variable instead of IS_GEMINILAKE()
check everywhere (Jani)
Signed-off-by: Deepak M <m.deepak@intel.com>
Signed-off-by: Madhav Chauhan <madhav.chauhan@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1487335415-14766-2-git-send-email-madhav.chauhan@intel.com
Chris Wilson [Mon, 27 Feb 2017 20:58:50 +0000 (20:58 +0000)]
drm/i915: Delay disabling the user interrupt for breadcrumbs
A significant cost in setting up a wait is the overhead of enabling the
interrupt. As we disable the interrupt whenever the queue of waiters is
empty, if we are frequently waiting on alternating batches, we end up
re-enabling the interrupt on a frequent basis. We do want to disable the
interrupt during normal operations as under high load it may add several
thousand interrupts/s - we have been known in the past to occupy whole
cores with our interrupt handler after accidentally leaving user
interrupts enabled. As a compromise, leave the interrupt enabled until
the next IRQ, or the system is idle. This gives a small window for a
waiter to keep the interrupt active and not be delayed by having to
re-enable the interrupt.
v2: Restore hangcheck/missed-irq detection for continuations
v3: Be more careful restoring the hangcheck timer after reset
v4: Be more careful restoring the fake irq after reset (if required!)
v5: Redo changes to intel_engine_wakeup()
v6: Factor out __intel_engine_wakeup()
v7: Improve commentary for declaring a missed wakeup
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170227205850.2828-4-chris@chris-wilson.co.uk
Chris Wilson [Mon, 27 Feb 2017 20:58:49 +0000 (20:58 +0000)]
drm/i915: Defer enabling hangcheck to the first fake breadcrumb interrupt
By deferring hangcheck to the fake breadcrumb interrupt, we can simply
the enabling procedure slightly - as by enabling the fake, we then
enable the hangcheck. By always enabling the hangcheck from each fake
interrupt (it will be a no-op for an already queued hangcheck), it will
make restoring the breadcrumbs after a reset simpler in the next patch.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170227205850.2828-3-chris@chris-wilson.co.uk
Chris Wilson [Mon, 27 Feb 2017 20:58:48 +0000 (20:58 +0000)]
drm/i915: Signal first fence from irq handler if complete
As execlists and other non-semaphore multi-engine devices coordinate
between engines using interrupts, we can shave off a few 10s of
microsecond of scheduling latency by doing the fence signaling from the
interrupt as opposed to a RT kthread. (Realistically the delay adds
about 1% to an individual cross-engine workload.) We only signal the
first fence in order to limit the amount of work we move into the
interrupt handler. We also have to remember that our breadcrumbs may be
unordered with respect to the interrupt and so we still require the
waiter process to perform some heavyweight coherency fixups, as well as
traversing the tree of waiters.
v2: No need for early exit in irq handler - it breaks the flow between
patches and prevents the tracepoint
v3: Restore rcu hold across irq signaling of request
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170227205850.2828-2-chris@chris-wilson.co.uk
Chris Wilson [Mon, 27 Feb 2017 20:58:47 +0000 (20:58 +0000)]
drm/i915: Report both waiters and success from intel_engine_wakeup()
The two users of the return value from intel_engine_wakeup() are
expecting different results. In the breadcrumbs hangcheck, we are using
it to determine whether wake_up_process() detected the waiter was
currently running (and if so we presume that it hasn't yet missed the
interrupt). However, in the fake_irq path, we are using the return value
as a check as to whether there are any waiters, and so we may
incorrectly stop the fake-irq if that waiter was currently running.
To handle the two different needs, return both bits of information! We
uninline it from the irq path in preparation for the next patch which
makes the irq hotpath special and relegates intel_engine_wakeup() to the
slow fixup paths.
v2: s/ret/result/
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170227205850.2828-1-chris@chris-wilson.co.uk
Chris Wilson [Thu, 23 Feb 2017 14:10:20 +0000 (14:10 +0000)]
drm/i915: Distinguish between timeout and error in sideband transactions
After initiating a sideband transaction, we only want to wait for the
transaction to become idle. If, as we are, we wait for both the busy
and error flag to clear, if an error is raised we just spin until the
timeout. Once the hw is idle, we can then check to see if the hw flagged
an error, and report it distinctly.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170223141020.13250-1-chris@chris-wilson.co.uk
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Chris Wilson [Mon, 27 Feb 2017 13:59:13 +0000 (13:59 +0000)]
drm/i915: Reduce context alignment
No hardware was ever shipped that needed more than 4096 byte alignment
and future hardware will not use this legacy path. So reduce the
alignment to make it easier and quicker to launch workloads.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170227135913.8056-3-chris@chris-wilson.co.uk
Chris Wilson [Mon, 27 Feb 2017 13:59:12 +0000 (13:59 +0000)]
drm/i915: Remove redundant TLB invalidate on switching ppgtt
We are required to reload the TLBs around ppgtt switches. However, we
already do an unconditional TLB invalidate before every batch and a flush
afterwards, so this condition is already satisfied without extra flushes
around the LRI instructions.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170227135913.8056-2-chris@chris-wilson.co.uk
Chris Wilson [Mon, 27 Feb 2017 13:59:11 +0000 (13:59 +0000)]
drm/i915: Remove redundant TLB invalidate on switching contexts
We are required to reload the TLBs around context switches
(MI_SET_CONTEXT specifically) and the recommendation is do that before
the MI_SET_CONTEXT so that it is serialised with the switch and not
forgotten:
[DevSNB] If Flush TLB invalidation Mode is enabled it’s the driver’s
responsibility to invalidate the TLBs at least once after the previous
context switch after any GTT mappings changed (including new GTT entries).
This can be done by a pipeline PIPE_CONTROL with TLB inv bit set
immediately before MI_SET_CONTEXT.
However, we already do an unconditional TLB invalidate before every
batch so this condition is satifisfied.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170227135913.8056-1-chris@chris-wilson.co.uk
Mika Kuoppala [Wed, 15 Feb 2017 13:52:59 +0000 (15:52 +0200)]
drm/i915: Avoid tweaking evaluation thresholds on Baytrail v3
Certain Baytrails, namely the 4 cpu core variants, have been
plaqued by spurious system hangs, mostly occurring with light loads.
Multiple bisects by various people point to a commit which changes the
reclocking strategy for Baytrail to follow its bigger brethen:
commit
8fb55197e64d ("drm/i915: Agressive downclocking on Baytrail")
There is also a review comment attached to this commit from Deepak S
on avoiding punit access on Cherryview and thus it was excluded on
common reclocking path. By taking the same approach and omitting
the punit access by not tweaking the thresholds when the hardware
has been asked to move into different frequency, considerable gains
in stability have been observed.
With J1900 box, light render/video load would end up in system hang
in usually less than 12 hours. With this patch applied, the cumulative
uptime has now been 34 days without issues. To provoke system hang,
light loads on both render and bsd engines in parallel have been used:
glxgears >/dev/null 2>/dev/null &
mpv --vo=vaapi --hwdec=vaapi --loop=inf vid.mp4
So far, author has not witnessed system hang with above load
and this patch applied. Reports from the tenacious people at
kernel bugzilla are also promising.
Considering that the punit access frequency with this patch is
considerably less, there is a possibility that this will push
the, still unknown, root cause past the triggering point on most loads.
But as we now can reliably reproduce the hang independently,
we can reduce the pain that users are having and use a
static thresholds until a root cause is found.
v3: don't break debugfs and simplification (Chris Wilson)
References: https://bugzilla.kernel.org/show_bug.cgi?id=109051
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Len Brown <len.brown@intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: fritsch@xbmc.org
Cc: miku@iki.fi
Cc: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
CC: Michal Feix <michal@feix.cz>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Deepak S <deepak.s@linux.intel.com>
Cc: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Cc: <stable@vger.kernel.org> # v4.2+
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1487166779-26945-1-git-send-email-mika.kuoppala@intel.com
Chris Wilson [Mon, 27 Feb 2017 12:26:54 +0000 (12:26 +0000)]
drm/i915: Remove the vma from the drm_mm if binding fails
As we track whether a vma has been inserted into the drm_mm using the
vma->flags, if we fail to bind the vma into the GTT we do not update
those bits and will attempt to reinsert the vma into the drm_mm on
future passes. To prevent that, we want to unwind i915_vma_insert() if
we fail in our attempt to bind.
Fixes:
59bfa1248e22 ("drm/i915: Start passing around i915_vma from execbuffer")
Testcase: igt/drv_selftest/live_gtt
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.william.auld@gmail.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: <stable@vger.kernel.org> # v4.9+
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170227122654.27651-3-chris@chris-wilson.co.uk
Chris Wilson [Mon, 27 Feb 2017 12:26:53 +0000 (12:26 +0000)]
drm/i915: Unwind vma->pages allocation upon failure
If we fail to allocate the ppgtt range after allocating the pages for
the vma, we should unwind the local allocation before reporting back the
failure.
Fixes:
ff685975d97f ("drm/i915: Move allocate_va_range to GTT")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.auld@intel.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170227122654.27651-2-chris@chris-wilson.co.uk