Skip to content
  1. May 24, 2018
  2. May 23, 2018
  3. May 22, 2018
    • Chris Wilson's avatar
      drm/i915/query: nospec expects no more than an unsigned long · a33b1dc8
      Chris Wilson authored
      
      
      nospec quite reasonably asserts that it will never be used with an index
      larger than unsigned long (that being the largest possibly index into an
      C array). However, our ubi uses the convention of u64 for any large
      integer, running afoul of the assertion on 32b. Reduce our index to an
      unsigned long, checking for type overflow first.
      
        drivers/gpu/drm/i915/i915_query.c: In function 'i915_query_ioctl':
        include/linux/compiler.h:339:38: error: call to '__compiletime_assert_119' declared with attribute error: BUILD_BUG_ON failed: sizeof(_s) > sizeof(long)
      
      Reported-by: default avatar <kbuild-all@01.org>
      Fixes: 84b510e2
      
       ("drm/i915/query: Protect tainted function pointer lookup")
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Reviewed-by: default avatarLionel Landwerlin <lionel.g.landwerlin@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20180522121018.15199-1-chris@chris-wilson.co.uk
      a33b1dc8
    • Ville Syrjälä's avatar
      drm/i915: Eliminate the unused dev_priv->vbt.lvds_vbt · 59462a00
      Ville Syrjälä authored
      
      
      dev_priv->vbt.lvds_vbt is set but never actually used. Kill it.
      
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20180508124136.10969-3-ville.syrjala@linux.intel.com
      59462a00
    • Ville Syrjälä's avatar
      drm/i915: Replace vbt edp.support with int_lvds_support · 5255e2f8
      Ville Syrjälä authored
      
      
      Replace dev_priv->vbt.edp.support with
      dev_priv->vbt.int_lvds_support. We'll want to extend its
      use beyond the LVDS vs. eDP case in the future.
      
      v2: Nuke the edp.support from parse_edp() (Jani)
          Only clear int_lvds_support for gen5+ to preserve
          the current behaviour (Jani)
      
      Cc: Jani Nikula <jani.nikula@intel.com>
      Cc: Ondrej Zary <linux@rainbow-software.org>
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20180508140814.20105-1-ville.syrjala@linux.intel.com
      Reviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
      5255e2f8
    • Chris Wilson's avatar
      drm/i915/gtt: Allow pagedirectory allocations to fail · 1abb70f5
      Chris Wilson authored
      
      
      As we handle the allocation failure of the page directory and tables by
      propagating the failure back to userspace, allow it to fail if direct
      reclaim is unable to satisfy the request (i.e. disable the oomkiller).
      The premise being that if we are unable to allocate a single page for
      the pagetable, we will not be able to handle the multitude of pages
      required for the gfx operation and we should back off to allow the
      system to recover.
      
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106609
      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>
      Reviewed-by: default avatarMatthew Auld <matthew.william.auld@gmail.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20180522083643.29601-1-chris@chris-wilson.co.uk
      1abb70f5
    • Chris Wilson's avatar
      drm/i915/query: Protect tainted function pointer lookup · 84b510e2
      Chris Wilson authored
      Smatch identifies i915_query_ioctl() as being a potential victim of
      Spectre due to its use of a tainted user index into a function pointer
      array. Use array_index_nospec() to defang the user index before using it
      to lookup the function pointer.
      
      Fixes: a446ae2c
      
       ("drm/i915: add query uAPI")
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Reviewed-by: default avatarLionel Landwerlin <lionel.g.landwerlin@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20180521210530.26008-1-chris@chris-wilson.co.uk
      84b510e2
    • Jani Nikula's avatar
      Revert "drm/i915/edp: Allow alternate fixed mode for eDP if available." · d93fa1b4
      Jani Nikula authored
      This reverts commit dc911f5b
      
      .
      
      Per the report, no matter what display mode you select with xrandr, the
      i915 driver will always select the alternate fixed mode. For the
      reporter this means that the display will always run at 40Hz which is
      quite annoying. This may be due to the mode comparison.
      
      But there are some other potential issues. The choice of alt_fixed_mode
      seems dubious. It's the first non-preferred mode, but there are no
      guarantees that the only difference would be refresh rate. Similarly,
      there may be more than one preferred mode in the probed modes list, and
      the commit changes the preferred mode selection to choose the last one
      on the list instead of the first.
      
      (Note that the probed modes list is the raw, unfiltered, unsorted list
      of modes from drm_add_edid_modes(), not the pretty result after a
      drm_helper_probe_single_connector_modes() call.)
      
      Finally, we already have eerily similar code in place to find the
      downclock mode for DRRS that seems like could be reused here.
      
      Back to the drawing board.
      
      Note: This is a hand-crafted revert due to conflicts. If it fails to
      backport, please just try reverting the original commit directly.
      
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105469
      Reported-by: default avatarRune Petersen <rune@megahurts.dk>
      Reported-by: default avatarMark Spencer <n7u4722r35@ynzlx.anonbox.net>
      Fixes: dc911f5b
      
       ("drm/i915/edp: Allow alternate fixed mode for eDP if available.")
      Cc: Clint Taylor <clinton.a.taylor@intel.com>
      Cc: David Weinehall <david.weinehall@linux.intel.com>
      Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
      Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
      Cc: Jani Nikula <jani.nikula@intel.com>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: Jim Bride <jim.bride@linux.intel.com>
      Cc: Jani Nikula <jani.nikula@linux.intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: intel-gfx@lists.freedesktop.org
      Cc: <stable@vger.kernel.org> # v4.14+
      Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
      Reviewed-by: default avatarDhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20180516080110.22770-1-jani.nikula@intel.com
      d93fa1b4
    • Daniel Stone's avatar
      drm/i915: Move GEM BO inside drm_framebuffer · a268bcd7
      Daniel Stone authored
      
      
      Since drm_framebuffer can now store GEM objects directly, place them
      there rather than in our own subclass.
      
      v2: Only hold a single reference per framebuffer, not per plane. (Ville)
      v3: Drop NULL check in intel_fb_obj. (Ville)
      
      Signed-off-by: default avatarDaniel Stone <daniels@collabora.com>
      Reviewed-by: default avatarVille Syrjälä <ville.syrjala@intel.com>
      Cc: Jani Nikula <jani.nikula@linux.intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
      Cc: intel-gfx@lists.freedesktop.org
      Link: https://patchwork.freedesktop.org/patch/msgid/20180518143008.4120-2-daniels@collabora.com
      a268bcd7
    • Daniel Stone's avatar
      drm/i915: Use intel_fb_obj() everywhere · a5ff7a45
      Daniel Stone authored
      
      
      We already have a macro to pull the GEM object from a FB, so use it
      everywhere. We'll make use of this later to move the object storage.
      
      Signed-off-by: default avatarDaniel Stone <daniels@collabora.com>
      Reviewed-by: default avatarVille Syrjälä <ville.syrjala@intel.com>
      Cc: Jani Nikula <jani.nikula@linux.intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
      Cc: intel-gfx@lists.freedesktop.org
      Link: https://patchwork.freedesktop.org/patch/msgid/20180518143008.4120-1-daniels@collabora.com
      a5ff7a45
  4. May 21, 2018
    • Zhenyu Wang's avatar
      drm/i915/gvt: Fix crash after request->hw_context change · 6bb2a2af
      Zhenyu Wang authored
      When we do shadowing, workload's request might not be allocated yet,
      so we still require shadow context's object. And when complete workload,
      delay to zero workload's request pointer after used for update guest context.
      
      v2: Move request alloc earlier as already try to track shadow status
      depending on request state, which also facilitate to use request->hw_context
      for target engine context reference.
      
      Fixes: 1fc44d9b
      
       ("drm/i915: Store a pointer to intel_context in i915_request")
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Cc: Zhi Wang <zhi.a.wang@intel.com>
      Cc: Weinan Li <weinan.z.li@intel.com>
      Signed-off-by: default avatarZhenyu Wang <zhenyuw@linux.intel.com>
      Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Link: https://patchwork.freedesktop.org/patch/msgid/20180521081752.31056-1-zhenyuw@linux.intel.com
      6bb2a2af
  5. May 19, 2018
    • Chris Wilson's avatar
      drm/i915/selftests: Wait longer for the old active request · 39d3cc03
      Chris Wilson authored
      
      
      When testing reset, we wait for 1s on the main thread for the hang to
      start. Meanwhile, we continue submitting requests on all the background
      threads, and we may have more threads than cores and so potentially
      starve the waiter from being woken within the timeout. As the hang
      timeout and the active timeouts are the same, it is hard to distinguish
      which caused the timeout. Bump the active thread timeouts to 5s,
      compared to the 1s timeout for the hang, so that we preferentially
      report the hang timing out, while hopefully ensuring that we do at least
      wake up the hang thread first before declaring the background active
      timeout.
      
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Link: https://patchwork.freedesktop.org/patch/msgid/20180517142442.16979-1-chris@chris-wilson.co.uk
      Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
      39d3cc03
    • Chris Wilson's avatar
      drm/i915: Allow init_breadcrumbs to be used from irq context · 2399a4a6
      Chris Wilson authored
      
      
      In order to support engine reset from irq (timer) context, we need to be
      able to re-initialise the breadcrumbs. So we need to promote the plain
      spin_lock_irq to a safe spin_lock_irqsave.
      
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20180518090212.5349-3-chris@chris-wilson.co.uk
      2399a4a6
    • Chris Wilson's avatar
      drm/i915/execlists: Handle copying default context state for atomic reset · fe0c4935
      Chris Wilson authored
      We want to be able to reset the GPU from inside a timer callback
      (hardirq context). One step requires us to copy the default context
      state over to the guilty context, which means we need to plan in advance
      to have that object accessible from within an atomic context. The atomic
      context prevents us from pinning the object or from peeking into the
      shmemfs backing store (all may sleep), so we choose to pin the
      default_state into memory when the engine becomes active. This
      compromise allows us to swap out the default state when idle, when
      required.
      
      References: 5692251c
      
       ("drm/i915/lrc: Scrub the GPU state of the guilty hanging request")
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20180518090212.5349-2-chris@chris-wilson.co.uk
      fe0c4935
    • Chris Wilson's avatar
      drm/i915: Make intel_engine_dump irqsafe · d6d12ec0
      Chris Wilson authored
      
      
      To be useful later, enable intel_engine_dump() to be called from irq
      context (i.e. using saving and restoring irq start rather than assuming
      we enter with irqs enabled).
      
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20180518090212.5349-1-chris@chris-wilson.co.uk
      d6d12ec0
    • Chris Wilson's avatar
      drm/i915: Speed up idle detection by kicking the tasklets · dd0cf235
      Chris Wilson authored
      
      
      We rely on ksoftirqd to run in a timely fashion in order to drain the
      execlists queue. Quite frequently, it does not. In some cases we may see
      latencies of over 200ms triggering our idle timeouts and forcing us to
      declare the driver wedged!
      
      Thus we can speed up idle detection by bypassing ksoftirqd in these
      cases and flush our tasklet to confirm if we are indeed still waiting
      for the ELSP to drain.
      
      v2: Put the execlists.first check back; it is required for handling
      reset!
      
      References: https://bugs.freedesktop.org/show_bug.cgi?id=106373
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
      Reviewed-by: default avatarMika Kuoppala <mika.kuoppala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20180506171328.30034-1-chris@chris-wilson.co.uk
      dd0cf235
    • Chris Wilson's avatar
      drm/i915/lvds: Move acpi lid notification registration to registration phase · e578a570
      Chris Wilson authored
      Delay registering ourselves with the acpi lid notification mechanism
      until we are registering the connectors after initialisation is
      complete. This prevents a possibility of trying to handle the lid
      notification before we are ready with the danger of chasing
      uninitialised function pointers.
      
       BUG: unable to handle kernel NULL pointer dereference at 0000000000000000
       IP:           (null)
       PGD 0 P4D 0
       Oops: 0010 [#1] PREEMPT SMP PTI
       Modules linked in: arc4(+) iwldvm(+) i915(+) mac80211 i2c_algo_bit coretemp mei_wdt iwlwifi drm_kms_helper kvm_intel wmi_bmof iTCO_wdt iTCO_vendor_support kvm snd_hda_codec_conexant snd_hda_codec_generic drm psmouse cfg80211 irqbypass input_leds pcspkr i2c_i801 snd_hda_intel snd_hda_codec thinkpad_acpi snd_hda_core mei_me lpc_ich snd_hwdep e1000e wmi nvram snd_pcm mei snd_timer shpchp ptp pps_core rfkill syscopyarea snd intel_agp sysfillrect intel_gtt soundcore sysimgblt battery led_class fb_sys_fops ac rtc_cmos agpgart evdev mac_hid acpi_cpufreq ip_tables x_tables ext4 crc32c_generic crc16 mbcache jbd2 fscrypto crypto_simd glue_helper cryptd aes_x86_64 xts algif_skcipher af_alg dm_crypt dm_mod sd_mod uas usb_storage serio_raw atkbd libps2 ahci libahci uhci_hcd libata scsi_mod ehci_pci
        ehci_hcd usbcore usb_common i8042 serio
       CPU: 1 PID: 378 Comm: systemd-logind Not tainted 4.16.8-1-ARCH #1
       Hardware name: LENOVO 7454CTO/7454CTO, BIOS 6DET72WW (3.22 ) 10/25/2012
       RIP: 0010:          (null)
       RSP: 0018:ffffaf4580c33a18 EFLAGS: 00010287
       RAX: 0000000000000000 RBX: ffff947533558000 RCX: 000000000000003e
       RDX: ffffffffc0aa80c0 RSI: ffffaf4580c33a3c RDI: ffff947534e4c000
       RBP: ffff947533558338 R08: ffff947534598930 R09: ffffffffc0a928b1
       R10: ffffd8f181d5fd40 R11: 0000000000000000 R12: ffffffffc0a928b1
       R13: ffff947533558368 R14: ffffffffc0a928a9 R15: ffff947534e4c000
       FS:  00007f3dc4ddb940(0000) GS:ffff947539280000(0000) knlGS:0000000000000000
       CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
       CR2: 0000000000000000 CR3: 000000006e214000 CR4: 00000000000406e0
       Call Trace:
        ?  intel_modeset_setup_hw_state+0x385/0xf60 [i915]
        ? __intel_display_resume+0x1e/0xc0 [i915]
        ? intel_display_resume+0xcc/0x120 [i915]
        ? intel_lid_notify+0xbc/0xc0 [i915]
        ? notifier_call_chain+0x47/0x70
        ? blocking_notifier_call_chain+0x3e/0x60
        ? acpi_lid_notify_state+0x8f/0x1d0
        ? acpi_lid_update_state+0x49/0x70
        ? acpi_lid_input_open+0x60/0x90
        ? input_open_device+0x5d/0xa0
        ? evdev_open+0x1ba/0x1e0 [evdev]
        ? chrdev_open+0xa3/0x1b0
        ? cdev_put.part.0+0x20/0x20
        ? do_dentry_open+0x14c/0x300
        ? path_openat+0x30c/0x1240
        ? current_time+0x16/0x60
        ? do_filp_open+0x93/0x100
        ? __check_object_size+0xfb/0x180
        ? do_sys_open+0x186/0x210
        ? do_syscall_64+0x74/0x190
        ?  entry_SYSCALL_64_after_hwframe+0x3d/0xa2
       Code:  Bad RIP value.
       RIP:           (null) RSP: ffffaf4580c33a18
       CR2: 0000000000000000
      
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106559
      Fixes: c1c7af60
      
       ("drm/i915: force mode set at lid open time")
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Reviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20180518074840.16194-1-chris@chris-wilson.co.uk
      Cc: stable@vger.kernel.org
      e578a570
  6. May 18, 2018