1. 08 Nov, 2017 1 commit
    • Chris Wilson's avatar
      drm/i915: Read ilk FDI PLL frequency once during initialisation · 58ecd9d5
      Chris Wilson authored
      During intel_atomic_check(), we do not take the intel_runtime_pm_get()
      wakeref and so should do the atomic modeset precalculations without
      referring to the HW. However, on Ironlake we see
      
      <7>[   23.487557] [drm:intel_atomic_check [i915]] [CONNECTOR:47:VGA-1] checking for sink bpp constrains
      <7>[   23.487615] [drm:intel_atomic_check [i915]] clamping display bpp (was 36) to default limit of 24
      <4>[   23.487621] RPM wakelock ref not held during HW access
      <4>[   23.487652] ------------[ cut here ]------------
      <4>[   23.487697] WARNING: CPU: 0 PID: 1343 at drivers/gpu/drm/i915/intel_drv.h:1813 gen5_read32+0x183/0x200 [i915]
      <4>[   23.487701] Modules linked in: snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic i915 intel_powerclamp coretemp crct10dif_pclmul crc32_pclmul snd_hda_intel ghash_clmulni_intel snd_hda_codec snd_hwdep snd_hda_core snd_pcm lpc_ich e1000e mei_me ptp mei pps_core prime_numbers
      <4>[   23.487784] CPU: 0 PID: 1343 Comm: debugfs_test Tainted: G        W       4.14.0-rc7-CI-Trybot_1378+ #1
      <4>[   23.487788] Hardware name: Hewlett-Packard HP Compaq 8100 Elite SFF PC/304Ah, BIOS 786H1 v01.13 07/14/2011
      <4>[   23.487793] task: ffff8801f90aa6c0 task.stack: ffffc900013ec000
      <4>[   23.487838] RIP: 0010:gen5_read32+0x183/0x200 [i915]
      <4>[   23.487842] RSP: 0018:ffffc900013efb58 EFLAGS: 00010292
      <4>[   23.487849] RAX: 000000000000002a RBX: ffff880205c00000 RCX: 0000000000000006
      <4>[   23.487854] RDX: 000000000000140a RSI: ffffffff81d0eb14 RDI: ffffffff81cc26f6
      <4>[   23.487857] RBP: ffffc900013efb80 R08: ffff8801f90aaff8 R09: 0000000000000000
      <4>[   23.487861] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000001
      <4>[   23.487865] R13: 0000000000046000 R14: ffff88020ffaba78 R15: ffff88020b109bf8
      <4>[   23.487870] FS:  00007f53b5e40a40(0000) GS:ffff88021bc00000(0000) knlGS:0000000000000000
      <4>[   23.487874] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      <4>[   23.487878] CR2: 000055e41900c0e8 CR3: 00000001fa0d6005 CR4: 00000000000206f0
      <4>[   23.487882] Call Trace:
      <4>[   23.487931]  intel_atomic_check+0x745/0x1290 [i915]
      <4>[   23.487948]  drm_atomic_check_only+0x459/0x560
      <4>[   23.487956]  ? drm_atomic_set_crtc_for_connector+0xc9/0x100
      <4>[   23.488025]  drm_atomic_commit+0x18/0x50
      <4>[   23.488035]  restore_fbdev_mode_atomic+0x190/0x1f0
      <4>[   23.488059]  restore_fbdev_mode+0x32/0x120
      <4>[   23.488072]  drm_fb_helper_restore_fbdev_mode_unlocked+0x50/0xa0
      <4>[   23.488139]  intel_fbdev_restore_mode+0x34/0x90 [i915]
      <4>[   23.488194]  i915_driver_lastclose+0xe/0x10 [i915]
      <4>[   23.488208]  drm_lastclose+0x39/0xf0
      <4>[   23.488219]  drm_release+0x30c/0x3c0
      <4>[   23.488236]  __fput+0xb9/0x200
      <4>[   23.488252]  ____fput+0xe/0x10
      <4>[   23.488264]  task_work_run+0x89/0xc0
      <4>[   23.488278]  exit_to_usermode_loop+0x83/0x90
      <4>[   23.488290]  syscall_return_slowpath+0xd0/0x110
      <4>[   23.488304]  entry_SYSCALL_64_fastpath+0xaf/0xb1
      <4>[   23.488312] RIP: 0033:0x7f53b4317560
      <4>[   23.488320] RSP: 002b:00007ffca7e70748 EFLAGS: 00000246 ORIG_RAX: 0000000000000003
      <4>[   23.488333] RAX: 0000000000000000 RBX: 0000000000000001 RCX: 00007f53b4317560
      <4>[   23.488340] RDX: 0000000000000005 RSI: 00007ffca7e70640 RDI: 0000000000000004
      <4>[   23.488347] RBP: 000055e417783900 R08: 000055e418f9e290 R09: 0000000000000000
      <4>[   23.488356] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001
      <4>[   23.488363] R13: 00007f53b4302c40 R14: 0000000000000000 R15: 0000000000000000
      <4>[   23.488384] Code: b5 f2 f2 e0 0f ff e9 c5 fe ff ff 80 3d 0e 4b 10 00 00 0f 85 c6 fe ff ff 48 c7 c7 30 73 29 a0 c6 05 fa 4a 10 00 01 e8 8e f2 f2 e0 <0f> ff e9 ac fe ff ff e8 51 9d f3 e0 85 c0 0f 85 01 ff ff ff 48
      <4>[   23.488780] ---[ end trace 6bc72ce7f1596190 ]---
      <7>[   23.488844] [drm:intel_atomic_check [i915]] checking fdi config on pipe A, lanes 1
      <7>[   23.488911] [drm:intel_atomic_check [i915]] hw max bpp: 36, pipe bpp: 24, dithering: 0
      
      due to intel_fdi_link_freq() poking at FDI_PLL_BIOS_0. Avoid this by
      recording the fdi pll frequency during device initiailisation.
      
      v2: Also extract the static FDI PLL frequencies for Sandybridge and
      Ivybridge.
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20171107214713.18704-1-chris@chris-wilson.co.ukReviewed-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      58ecd9d5
  2. 07 Nov, 2017 8 commits
    • Chris Wilson's avatar
      drm/i915/selftests: Take rpm wakeref around partial tiling tests · 693b1cca
      Chris Wilson authored
      Since the partial tiling tests are poking into the GGTT to watch the
      fence registers in operation, it itself needs the device rpm wakeref in
      order for the GGTT to remain accessible.
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20171107115653.10716-1-chris@chris-wilson.co.ukReviewed-by: default avatarMatthew Auld <matthew.auld@intel.com>
      693b1cca
    • Chris Wilson's avatar
      drm/i915/selftests: Take rpm wakeref around GGTT lowlevel tests · c29ccb9f
      Chris Wilson authored
      The vma routines are responsible for acquiring the device rpm wakeref
      before they poke the HW. However, some of the selftests bypass the
      higher level vma routines in order to poke directly at the lowlevel GGTT
      functions; these are then responsible for managing rpm themselves.
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20171107114051.10583-1-chris@chris-wilson.co.ukReviewed-by: default avatarMatthew Auld <matthew.auld@intel.com>
      c29ccb9f
    • Chris Wilson's avatar
      drm/i915/selftests: Skip mixed page exhaustion if only small pages available · f6d03042
      Chris Wilson authored
      If we only have 4k pages, we can't mix together different combinations
      of hugepages to see if the world burns. However, as the loops did
      nothing, we never set err to 0 and reported ENODEV aborting the test.
      Teach the test to skip instead.
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: Matthew Auld <matthew.william.auld@gmail.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20171107110559.6098-1-chris@chris-wilson.co.ukReviewed-by: default avatarMatthew Auld <matthew.william.auld@gmail.com>
      f6d03042
    • Chris Wilson's avatar
      drm/i915: Prevent unbounded wm results in g4x_compute_wm() · 1a1f1287
      Chris Wilson authored
      Smatch warns of
      
      drivers/gpu/drm/i915/intel_pm.c:1161 g4x_compute_wm() warn: signedness bug returning '(-33554430)'
      
      which is a result of it believing that wm may be INT_MAX following
      g4x_tlb_miss_wa(). Just declaring g4x_tlb_miss_wa() as returning an
      unsigned integer is not sufficient, we need to tell smatch that wm itself
      is unsigned for it to not worry. So mark up the locals we expect to be
      non-negative, and so silence smatch.
      
      v2: Mark up vlv_compute_wm_level() as unsigned similarly.
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Dan Carpenter <dan.carpenter@oracle.com>
      Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> #v1
      Link: https://patchwork.freedesktop.org/patch/msgid/20171107140338.13748-1-chris@chris-wilson.co.uk
      1a1f1287
    • Chris Wilson's avatar
      drm/i915: Simplify onion for bxt_ddi_phy_init() · 0e870bf8
      Chris Wilson authored
      Older compilers (gcc-4.9) are not as able to track uninitialised
      variables as well as more recent compilers. In particular,
      
      drivers/gpu/drm/i915/intel_dpio_phy.c: In function ‘bxt_ddi_phy_init’:
      drivers/gpu/drm/i915/intel_dpio_phy.c:482:25: warning: ‘was_enabled’ may be used uninitialized in this function [-Wmaybe-uninitialized]
      
      In this case, we can rearrange code slightly to make the control flow
      clearer to the reader, as well as the compiler. That is we only call
      uninit using the same predicate as calling init
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
      Cc: Imre Deak <imre.deak@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20171107135324.28300-1-chris@chris-wilson.co.ukReviewed-by: default avatarGabriel Krisman Bertazi <krisman@collabora.co.uk>
      0e870bf8
    • Chris Wilson's avatar
      drm/i915: Silence compiler for csr_load_work_fn() · 2f59f1b3
      Chris Wilson authored
      gcc-4.7 is not very smart and can not tell that "si" is guarded by size
      being 0. So it complains,
      
      drivers/gpu/drm/i915/intel_csr.c: In function ‘csr_load_work_fn’:
      drivers/gpu/drm/i915/intel_csr.c:204:3: warning: ‘si’ may be used uninitialized in this function [-Wmaybe-uninitialized]
      drivers/gpu/drm/i915/intel_csr.c:190:30: note: ‘si’ was declared in
      
      Give in and mark si as NULL.
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: Anusha Srivatsa <anusha.srivatsa@intel.com>
      Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
      Cc: Imre Deak <imre.deak@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20171107145334.27154-1-chris@chris-wilson.co.ukReviewed-by: default avatarGabriel Krisman Bertazi <krisman@collabora.co.uk>
      Reviewed-by: default avatarMichal Wajdeczko <michal.wajdeczko@intel.com>
      2f59f1b3
    • Chris Wilson's avatar
      drm/i915: Silence smatch for cmdparser · 0ffba1fc
      Chris Wilson authored
      drivers/gpu/drm/i915/i915_cmd_parser.c:808:23: error: not an lvalue
      drivers/gpu/drm/i915/i915_cmd_parser.c:811:23: error: not an lvalue
      drivers/gpu/drm/i915/i915_cmd_parser.c:814:23: error: not an lvalue
      drivers/gpu/drm/i915/i915_cmd_parser.c:808:23: error: not an lvalue
      drivers/gpu/drm/i915/i915_cmd_parser.c:811:23: error: not an lvalue
      drivers/gpu/drm/i915/i915_cmd_parser.c:814:23: error: not an lvalue
      drivers/gpu/drm/i915/i915_cmd_parser.c:808:23: error: not an lvalue
      drivers/gpu/drm/i915/i915_cmd_parser.c:811:23: error: not an lvalue
      drivers/gpu/drm/i915/i915_cmd_parser.c:814:23: error: not an lvalue
      drivers/gpu/drm/i915/i915_cmd_parser.c:808:23: error: not an lvalue
      drivers/gpu/drm/i915/i915_cmd_parser.c:811:23: error: not an lvalue
      drivers/gpu/drm/i915/i915_cmd_parser.c:814:23: error: not an lvalue
      
      If we move the shift into each case not only do we kill the warning from
      smatch, but we shrink the code slightly:
      
         text	   data	    bss	    dec	    hex	filename
      1267906	  20587	   3168	1291661	 13b58d	before
      1267890	  20587	   3168	1291645	 13b57d	after
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
      Cc: Matthew Auld <matthew.william.auld@gmail.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20171107154055.19460-1-chris@chris-wilson.co.ukReviewed-by: default avatarMatthew Auld <matthew.william.auld@gmail.com>
      Reviewed-by: default avatarGabriel Krisman Bertazi <krisman@collabora.co.uk>
      0ffba1fc
    • Chris Wilson's avatar
      drm/i915: Deconstruct struct sgt_dma initialiser · 5684514b
      Chris Wilson authored
      gcc-4.4 complains about:
      
      	struct sgt_dma iter = {
      		.sg = vma->pages->sgl,
      		.dma = sg_dma_address(iter.sg),
      		.max = iter.dma + iter.sg->length,
      	};
      
      drivers/gpu/drm/i915/i915_gem_gtt.c: In function ‘gen8_ppgtt_insert_4lvl’:
      drivers/gpu/drm/i915/i915_gem_gtt.c:938: error: ‘iter.sg’ is used uninitialized in this function
      drivers/gpu/drm/i915/i915_gem_gtt.c:939: error: ‘iter.dma’ is used uninitialized in this function
      
      and worse generates invalid code that triggers a GPF:
      
      BUG: unable to handle kernel NULL pointer dereference at 0000000000000010
      IP: gen8_ppgtt_insert_4lvl+0x1b/0x1e0 [i915]
      PGD 0
      Oops: 0000 [#1] SMP
      Modules linked in: snd_aloop nf_conntrack_ipv6 nf_defrag_ipv6 nf_log_ipv6 ip6table_filter ip6_tables ctr ccm xt_state nf_log_ipv4
      nf_log_common xt_LOG xt_limit xt_recent xt_owner xt_addrtype iptable_filter ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat
      nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack libcrc32c ip_tables dm_mod vhost_net macvtap macvlan vhost tun kvm_intel kvm
      irqbypass uas usb_storage hid_multitouch btusb btrtl uvcvideo videobuf2_v4l2 videobuf2_core videodev media videobuf2_vmalloc videobuf2_memops
      sg ppdev dell_wmi sparse_keymap mei_wdt sd_mod iTCO_wdt iTCO_vendor_support rtsx_pci_ms memstick rtsx_pci_sdmmc mmc_core dell_smm_hwmon hwmon
      dell_laptop dell_smbios dcdbas joydev input_leds hci_uart btintel btqca btbcm bluetooth parport_pc parport i2c_hid
        intel_lpss_acpi intel_lpss pcspkr wmi int3400_thermal acpi_thermal_rel dell_rbtn mei_me mei snd_hda_codec_hdmi snd_hda_codec_realtek
      snd_hda_codec_generic ahci libahci acpi_pad xhci_pci xhci_hcd snd_hda_intel snd_hda_codec snd_hda_core snd_hwdep snd_seq snd_seq_device
      snd_pcm snd_timer snd soundcore int3403_thermal arc4 e1000e ptp pps_core i2c_i801 iwlmvm mac80211 rtsx_pci iwlwifi cfg80211 rfkill
      intel_pch_thermal processor_thermal_device int340x_thermal_zone intel_soc_dts_iosf i915 video fjes
      CPU: 2 PID: 2408 Comm: X Not tainted 4.10.0-rc5+ #1
      Hardware name: Dell Inc. Latitude E7470/0T6HHJ, BIOS 1.11.3 11/09/2016
      task: ffff880219fe4740 task.stack: ffffc90005f98000
      RIP: 0010:gen8_ppgtt_insert_4lvl+0x1b/0x1e0 [i915]
      RSP: 0018:ffffc90005f9b8c8 EFLAGS: 00010246
      RAX: 0000000000000000 RBX: ffff8802167d8000 RCX: 0000000000000001
      RDX: 00000000ffff7000 RSI: ffff880219f94140 RDI: ffff880228444000
      RBP: ffffc90005f9b948 R08: 0000000000000000 R09: 0000000000000000
      R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000080
      R13: 0000000000000001 R14: ffffc90005f9bcd7 R15: ffff88020c9a83c0
      FS:  00007fb53e1ee920(0000) GS:ffff88024dd00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000000000000010 CR3: 000000022ef95000 CR4: 00000000003406e0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
        ppgtt_bind_vma+0x40/0x50 [i915]
        i915_vma_bind+0xcb/0x1c0 [i915]
        __i915_vma_do_pin+0x6e/0xd0 [i915]
        i915_gem_execbuffer_reserve_vma+0x162/0x1d0 [i915]
        i915_gem_execbuffer_reserve+0x4fc/0x510 [i915]
        ? __kmalloc+0x134/0x250
        ? i915_gem_wait_for_error+0x25/0x100 [i915]
        ? i915_gem_wait_for_error+0x25/0x100 [i915]
        i915_gem_do_execbuffer+0x2df/0xa00 [i915]
        ? drm_malloc_gfp.clone.0+0x42/0x80 [i915]
        ? path_put+0x22/0x30
        ? __check_object_size+0x62/0x1f0
        ? terminate_walk+0x44/0x90
        i915_gem_execbuffer2+0x95/0x1e0 [i915]
        drm_ioctl+0x243/0x490
        ? handle_pte_fault+0x1d7/0x220
        ? i915_gem_do_execbuffer+0xa00/0xa00 [i915]
        ? handle_mm_fault+0x10d/0x2a0
        vfs_ioctl+0x18/0x30
        do_vfs_ioctl+0x14b/0x3f0
        SyS_ioctl+0x92/0xa0
        entry_SYSCALL_64_fastpath+0x1a/0xa9
      RIP: 0033:0x7fb53b4fcb77
      RSP: 002b:00007ffe0c572898 EFLAGS: 00003246 ORIG_RAX: 0000000000000010
      RAX: ffffffffffffffda RBX: 00007fb53e17c038 RCX: 00007fb53b4fcb77
      RDX: 00007ffe0c572900 RSI: 0000000040406469 RDI: 000000000000000b
      RBP: 00007fb5376d67e0 R08: 0000000000000000 R09: 0000000000000000
      R10: 0000000000000028 R11: 0000000000003246 R12: 0000000000000000
      R13: 0000000000000000 R14: 000055eecb314d00 R15: 000055eecb315460
      Code: 0f 84 5d ff ff ff eb a2 0f 1f 84 00 00 00 00 00 55 48 89 e5 41 57 41 56 41 55 41 54 53 48 83 ec 58 0f 1f 44 00 00 31 c0 89 4d b0 <4c>
      8b 60 10 44 8b 70 0c 48 89 d0 4c 8b 2e 48 c1 e8 27 25 ff 01
      RIP: gen8_ppgtt_insert_4lvl+0x1b/0x1e0 [i915] RSP: ffffc90005f9b8c8
      CR2: 0000000000000010
      
      Recent gccs, such as 4.9, 6.3 or 7.2, do not generate the warning nor do
      they explode on use. If we manually create the struct using locals from
      the stack, this should eliminate this issue, and does not alter code
      generation with gcc-7.2.
      
      Fixes: 894ccebe ("drm/i915: Micro-optimise gen8_ppgtt_insert_entries()")
      Reported-by: default avatarKelly French <kfrench@federalhill.net>
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: Kelly French <kfrench@federalhill.net>
      Cc: Mika Kuoppala <mika.kuoppala@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20171106211128.12538-1-chris@chris-wilson.co.ukTested-by: default avatarKelly French <kfrench@federalhill.net>
      Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
      5684514b
  3. 06 Nov, 2017 8 commits
  4. 03 Nov, 2017 3 commits
  5. 02 Nov, 2017 6 commits
  6. 01 Nov, 2017 5 commits
  7. 31 Oct, 2017 3 commits
  8. 30 Oct, 2017 6 commits