]> asedeno.scripts.mit.edu Git - linux.git/log
linux.git
7 years agodrm/i915/gvt: fix mem leakage in setup_vgpu_mmio for vgpu reset
Du, Changbin [Fri, 11 Nov 2016 02:31:37 +0000 (10:31 +0800)]
drm/i915/gvt: fix mem leakage in setup_vgpu_mmio for vgpu reset

Gvt gdrst handler handle_device_reset() invoke function
setup_vgpu_mmio() to reset mmio status. In this case,
the virtual mmio memory has been allocated already. The
new allocation just cause old mmio memory leakage.

Signed-off-by: Du, Changbin <changbin.du@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
7 years agodrm/i915/gvt: fix crash in vgpu_reset_execlist
Du, Changbin [Fri, 11 Nov 2016 08:33:06 +0000 (16:33 +0800)]
drm/i915/gvt: fix crash in vgpu_reset_execlist

We initiate vgpu->workload_q_head via for_each_engine
macro which may skip unavailable engines. So we should
follow this rule anywhere. The function
intel_vgpu_reset_execlist is not aware of this. Kernel
crash when touch a uninitiated vgpu->workload_q_head[x].
Let's fix it by using for_each_engine_masked and skip
unavailable engine ID. Meanwhile rename ring_bitmap to
general name engine_mask.

v2: remove unnecessary engine activation check (zhenyu)

Signed-off-by: Du, Changbin <changbin.du@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
7 years agodrm/i915/gvt: emulate right behavior for tlb_control
Ping Gao [Thu, 10 Nov 2016 07:27:20 +0000 (15:27 +0800)]
drm/i915/gvt: emulate right behavior for tlb_control

Emulate right behavior for tlb_control, set to ZERO upon write.

Signed-off-by: Ping Gao <ping.a.gao@intel.com>
Signed-off-by: Min He <min.he@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
7 years agodrm/i915/gvt: fix deadlock in workload_thread
Pei Zhang [Mon, 14 Nov 2016 10:02:57 +0000 (18:02 +0800)]
drm/i915/gvt: fix deadlock in workload_thread

It's a classical abba type deadlock when using 2 mutex objects, which
are gvt.lock(a) and drm.struct_mutex(b). Deadlock happens in threads:
1. intel_gvt_create/destroy_vgpu: P(a)->P(b)
2. workload_thread: P(b)->P(a)

Fix solution is align the lock acquire sequence in both threads. This
patch choose to adjust the sequence in workload_thread function.

This fixed lockup symptom for guest-reboot stress test.

v2: adjust sequence in workload_thread based on zhenyu's suggestion.
    adjust sequence in create/destroy_vgpu function.
v3: fix to still require struct_mutex for dispatch_workload()

Signed-off-by: Pei Zhang <pei.zhang@intel.com>
[zhenyuw: fix unused variables warnings.]
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
7 years agodrm/gma500: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops
Stefan Christ [Sun, 13 Nov 2016 23:03:28 +0000 (00:03 +0100)]
drm/gma500: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops

This refactoring leads to real functional changes in the driver.

Now the struct psbfb_ops implements two additional members:

       .fb_setcmap     = drm_fb_helper_setcmap,
       .fb_pan_display = drm_fb_helper_pan_display,

and the struct psbfb_roll_ops implements one additional member:

       .fb_setcmap     = drm_fb_helper_setcmap,

and the struct psbfb_unaccel_ops implements two additional members:

       .fb_setcmap     = drm_fb_helper_setcmap,
       .fb_pan_display = drm_fb_helper_pan_display,

These changes are not tested.

Cc: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Signed-off-by: Stefan Christ <contact@stefanchrist.eu>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1479078208-25221-19-git-send-email-contact@stefanchrist.eu
7 years agodrm/i915: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops
Stefan Christ [Sun, 13 Nov 2016 23:03:27 +0000 (00:03 +0100)]
drm/i915: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops

Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Signed-off-by: Stefan Christ <contact@stefanchrist.eu>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1479078208-25221-18-git-send-email-contact@stefanchrist.eu
7 years agodrm/omapdrm: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops
Stefan Christ [Sun, 13 Nov 2016 23:03:26 +0000 (00:03 +0100)]
drm/omapdrm: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops

Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Stefan Christ <contact@stefanchrist.eu>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1479078208-25221-17-git-send-email-contact@stefanchrist.eu
7 years agodrm/virtio: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops
Stefan Christ [Sun, 13 Nov 2016 23:03:25 +0000 (00:03 +0100)]
drm/virtio: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops

This patch removes a TODO comment in the code. I do not know whether it
is still relevant.

Cc: David Airlie <airlied@linux.ie>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Stefan Christ <contact@stefanchrist.eu>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1479078208-25221-16-git-send-email-contact@stefanchrist.eu
7 years agodrm/msm: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops
Stefan Christ [Sun, 13 Nov 2016 23:03:24 +0000 (00:03 +0100)]
drm/msm: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops

Cc: Rob Clark <robdclark@gmail.com>
Signed-off-by: Stefan Christ <contact@stefanchrist.eu>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1479078208-25221-15-git-send-email-contact@stefanchrist.eu
7 years agodrm/udl: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops
Stefan Christ [Sun, 13 Nov 2016 23:03:23 +0000 (00:03 +0100)]
drm/udl: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops

Cc: Dave Airlie <airlied@redhat.com>
Signed-off-by: Stefan Christ <contact@stefanchrist.eu>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1479078208-25221-14-git-send-email-contact@stefanchrist.eu
7 years agodrm/tegra: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops
Stefan Christ [Sun, 13 Nov 2016 23:03:22 +0000 (00:03 +0100)]
drm/tegra: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops

Cc: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Stefan Christ <contact@stefanchrist.eu>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1479078208-25221-13-git-send-email-contact@stefanchrist.eu
7 years agodrm/radeon: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops
Stefan Christ [Sun, 13 Nov 2016 23:03:21 +0000 (00:03 +0100)]
drm/radeon: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops

Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Stefan Christ <contact@stefanchrist.eu>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1479078208-25221-12-git-send-email-contact@stefanchrist.eu
7 years agodrm/rockchip: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops
Stefan Christ [Sun, 13 Nov 2016 23:03:20 +0000 (00:03 +0100)]
drm/rockchip: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops

Cc: Mark Yao <mark.yao@rock-chips.com>
Signed-off-by: Stefan Christ <contact@stefanchrist.eu>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1479078208-25221-11-git-send-email-contact@stefanchrist.eu
7 years agodrm/qxl: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops
Stefan Christ [Sun, 13 Nov 2016 23:03:19 +0000 (00:03 +0100)]
drm/qxl: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops

This patch removes a TODO comment in the code. I do not know whether it
is still relevant.

Cc: Dave Airlie <airlied@redhat.com>
Signed-off-by: Stefan Christ <contact@stefanchrist.eu>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1479078208-25221-10-git-send-email-contact@stefanchrist.eu
7 years agodrm/nouveau: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops
Stefan Christ [Sun, 13 Nov 2016 23:03:18 +0000 (00:03 +0100)]
drm/nouveau: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops

Cc: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Stefan Christ <contact@stefanchrist.eu>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1479078208-25221-9-git-send-email-contact@stefanchrist.eu
7 years agodrm/exynos: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops
Stefan Christ [Sun, 13 Nov 2016 23:03:17 +0000 (00:03 +0100)]
drm/exynos: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops

Cc: Inki Dae <inki.dae@samsung.com>
Cc: Joonyoung Shim <jy0922.shim@samsung.com>
Cc: Seung-Woo Kim <sw0312.kim@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Stefan Christ <contact@stefanchrist.eu>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1479078208-25221-8-git-send-email-contact@stefanchrist.eu
7 years agodrm/fb_cma_helper: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops
Stefan Christ [Sun, 13 Nov 2016 23:03:16 +0000 (00:03 +0100)]
drm/fb_cma_helper: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops

Cc: David Airlie <airlied@linux.ie>
Signed-off-by: Stefan Christ <contact@stefanchrist.eu>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1479078208-25221-7-git-send-email-contact@stefanchrist.eu
7 years agodrm/bochs: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops
Stefan Christ [Sun, 13 Nov 2016 23:03:15 +0000 (00:03 +0100)]
drm/bochs: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops

Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Stefan Christ <contact@stefanchrist.eu>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1479078208-25221-6-git-send-email-contact@stefanchrist.eu
7 years agodrm/armada: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops
Stefan Christ [Sun, 13 Nov 2016 23:03:14 +0000 (00:03 +0100)]
drm/armada: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops

Cc: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Stefan Christ <contact@stefanchrist.eu>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1479078208-25221-5-git-send-email-contact@stefanchrist.eu
7 years agodrm/amdgpu: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops
Stefan Christ [Sun, 13 Nov 2016 23:03:13 +0000 (00:03 +0100)]
drm/amdgpu: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Signed-off-by: Stefan Christ <contact@stefanchrist.eu>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1479078208-25221-4-git-send-email-contact@stefanchrist.eu
7 years agodrm/fb-helper: add fb_debug_* to DRM_FB_HELPER_DEFAULT_OPS
Stefan Christ [Sun, 13 Nov 2016 23:03:12 +0000 (00:03 +0100)]
drm/fb-helper: add fb_debug_* to DRM_FB_HELPER_DEFAULT_OPS

Add additional members fb_debug_enter and fb_debug_leave to helper
define. They are shared by all fb_ops implementations.

Suggested-by: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Stefan Christ <contact@stefanchrist.eu>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1479078208-25221-3-git-send-email-contact@stefanchrist.eu
7 years agodrm/fb-helper: fix segfaults in drm_fb_helper_debug_*
Stefan Christ [Sun, 13 Nov 2016 23:03:11 +0000 (00:03 +0100)]
drm/fb-helper: fix segfaults in drm_fb_helper_debug_*

A drm driver that is implementing

      fb_debug_enter and fb_debug_leave

in struct fb_ops with drm fb helper functions

     drm_fb_helper_debug_enter and drm_fb_helper_debug_leave

must also implement the callback 'mode_set_base_atomic' in struct
drm_crtc_helper_funcs. See Documentation/DocBook/kgdb.tmpl.  The current
implementation will segfault when 'mode_set_base_atomic' is a NULL
pointer.

Before this patch at least the drm drivers armada, ast, qxl, udl and
virtio do not have a 'mode_set_base_atomic' implementation but using
drm_fb_helper_debug_(enter|leave). So these drivers may segfault when
callbacks fb_debug_(enter|leave) are called.

Avoid the issue by just checking for NULL pointers. So all drivers can
unconditionally implement fb_debug_(enter|leave) with the drm_fb_helper
functions. If callback 'mode_set_base_atomic' is not implemented, the
code in drm_fb_helper_debug_(enter|leave) does effectively nothing.

Signed-off-by: Stefan Christ <contact@stefanchrist.eu>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1479078208-25221-2-git-send-email-contact@stefanchrist.eu
7 years agodrm/ast: free correct pointer in astfb_create() error paths
Andrew Donnellan [Mon, 14 Nov 2016 03:03:59 +0000 (14:03 +1100)]
drm/ast: free correct pointer in astfb_create() error paths

In the err_free_vram and err_release_fbi error paths in astfb_create(), we
attempt to free afbdev->sysram. The only jumps to these error paths occur
before we assign afbdev->sysram = sysram. Free sysram instead.

Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20161114030359.27852-1-andrew.donnellan@au1.ibm.com
7 years agodrm: rcar-du: Fix crash in encoder failure error path
Laurent Pinchart [Mon, 3 Oct 2016 17:03:22 +0000 (20:03 +0300)]
drm: rcar-du: Fix crash in encoder failure error path

When an encoder fails to initialize the driver prints an error message
to the kernel log. The message contains the name of the encoder's DT
node, which is NULL for internal encoders. Use the of_node_full_name()
macro to avoid dereferencing a NULL pointer, print the output number to
add more context to the error, and make sure we still own a reference to
the encoder's DT node by delaying the of_node_put() call.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
7 years agodrm: rcar-du: Remove memory allocation error message
Laurent Pinchart [Mon, 3 Oct 2016 14:42:07 +0000 (17:42 +0300)]
drm: rcar-du: Remove memory allocation error message

Memory allocation failures print messages to the kernel log, there's no
need to print an extra one. Remove the duplicate message.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
7 years agodrm: rcar-du: Remove test for impossible error condition
Laurent Pinchart [Mon, 3 Oct 2016 14:40:20 +0000 (17:40 +0300)]
drm: rcar-du: Remove test for impossible error condition

The driver has lost platform data support a long time ago. R-Car DU
devices can only be instantiated through DT now, making it impossible to
have a NULL DT node pointer. Remove the error check.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
7 years agodrm: rcar-du: Bring HDMI encoder comments in line with the driver
Laurent Pinchart [Thu, 25 Feb 2016 20:04:55 +0000 (22:04 +0200)]
drm: rcar-du: Bring HDMI encoder comments in line with the driver

Capitalize acronyms and use determiners and punctuation.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
7 years agodrm: rcar-du: Constify node argument to rcar_du_lvds_connector_init()
Laurent Pinchart [Mon, 3 Oct 2016 13:56:48 +0000 (16:56 +0300)]
drm: rcar-du: Constify node argument to rcar_du_lvds_connector_init()

The node passed as a pointer to the rcar_du_lvds_connector_init()
function is never modified, make it const.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
7 years agovideo: of: Constify node argument to display timing functions
Laurent Pinchart [Mon, 3 Oct 2016 13:55:48 +0000 (16:55 +0300)]
video: of: Constify node argument to display timing functions

The node pointer passed to the display timing functions is never
modified, make it const.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
7 years agodrm/sun4i: constify component_ops structures
Julia Lawall [Sat, 12 Nov 2016 17:19:58 +0000 (18:19 +0100)]
drm/sun4i: constify component_ops structures

These component_ops structures are only used as the second argument to
component_add and component_del, which are declared as const, so the
structures can be declared as const as well.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@

static struct component_ops i@p = { ... };

@ok1@
identifier r.i;
expression e1;
position p;
@@

component_add(e1,&i@p)

@ok2@
identifier r.i;
expression e1;
position p;
@@

component_del(e1, &i@p)

@bad@
position p != {r.p,ok1.p,ok2.p};
identifier r.i;
struct component_ops e;
@@

e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@

static
+const
 struct component_ops i = { ... };
// </smpl>

The result of the size command before the change is (arm):

   text       data         bss     dec      hex filename
   5266        236           8    5510     1586 sun4i_backend.o
   6393        236           8    6637     19ed sun4i_tcon.o
   3700        368           8    4076      fec sun4i_tv.o
   1668        108           0    1776      6f0 sun6i_drc.o

and after the change:

   text       data         bss     dec     hex filename
   5274        228           8    5510    1586 sun4i_backend.o
   6401        228           8    6637    19ed sun4i_tcon.o
   3708        360           8    4076     fec sun4i_tv.o
   1676        100           0    1776     6f0 sun6i_drc.o

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1478971198-3659-1-git-send-email-Julia.Lawall@lip6.fr
7 years agodrm: move allocation out of drm_get_format_name()
Eric Engestrom [Sat, 12 Nov 2016 01:12:56 +0000 (01:12 +0000)]
drm: move allocation out of drm_get_format_name()

The function's behaviour was changed in 90844f00049e, without changing
its signature, causing people to keep using it the old way without
realising they were now leaking memory.
Rob Clark also noticed it was also allocating GFP_KERNEL memory in
atomic contexts, breaking them.

Instead of having to allocate GFP_ATOMIC memory and fixing the callers
to make them cleanup the memory afterwards, let's change the function's
signature by having the caller take care of the memory and passing it to
the function.
The new parameter is a single-field struct in order to enforce the size
of its buffer and help callers to correctly manage their memory.

Fixes: 90844f00049e ("drm: make drm_get_format_name thread-safe")
Cc: Rob Clark <robdclark@gmail.com>
Cc: Christian König <christian.koenig@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Sinclair Yeh <syeh@vmware.com> (vmwgfx)
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20161112011309.9799-1-eric@engestrom.ch
7 years agodrm/i915: Stop skipping the final clflush back to system pages
Chris Wilson [Fri, 11 Nov 2016 14:58:09 +0000 (14:58 +0000)]
drm/i915: Stop skipping the final clflush back to system pages

When we release the shmem backing storage, we make sure that the pages
are coherent with the cpu cache. However, our clflush routine was
skipping the flush as the object had no pages at release time. Fix this by
explicitly flushing the sg_table we are decoupling.

Fixes: 03ac84f1830e ("drm/i915: Pass around sg_table to get_pages/put_pages backend")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20161111145809.9701-2-chris@chris-wilson.co.uk
7 years agodrm/i915: Only wait upon the execution timeline when unlocked
Chris Wilson [Fri, 11 Nov 2016 14:58:08 +0000 (14:58 +0000)]
drm/i915: Only wait upon the execution timeline when unlocked

In order to walk the list of all timelines, we currently require the
struct_mutex. We are sometimes called prior to the struct_mutex being
taken by the caller (i.e !I915_WAIT_LOCKED) in which case we can only
trust the global execution timelines (as these are owned by the device).
This means in the unlocked phase we can only wait upon the currently
executing requests and not all queued.

[  175.743243] general protection fault: 0000 [#1] SMP
[  175.743263] Modules linked in: nls_iso8859_1 intel_rapl x86_pkg_temp_thermal coretemp kvm_intel kvm irqbypass crct10dif_pclmul crc32_pclmul ghash_clmulni_intel iwlwifi aesni_intel aes_x86_64 lrw snd_soc_rt5640 gf128mul snd_soc_rl6231 snd_soc_core glue_helper snd_compress snd_pcm_dmaengine snd_hda_codec_hdmi ablk_helper snd_hda_codec_realtek cryptd snd_hda_codec_generic serio_raw cfg80211 snd_hda_intel snd_hda_codec ir_lirc_codec snd_hda_core lirc_dev snd_hwdep snd_pcm lpc_ich mei_me mei snd_seq_midi shpchp snd_seq_midi_event snd_rawmidi snd_seq snd_seq_device snd_timer rc_rc6_mce acpi_als nuvoton_cir kfifo_buf rc_core snd industrialio snd_soc_sst_acpi soundcore snd_soc_sst_match i2c_designware_platform 8250_dw i2c_designware_core dw_dmac spi_pxa2xx_platform mac_hid acpi_pad parport_pc ppdev lp parport
[  175.743509]  autofs4 i915 e1000e psmouse ptp pps_core xhci_pci ehci_pci ahci xhci_hcd ehci_hcd libahci video sdhci_acpi sdhci i2c_hid hid
[  175.743560] CPU: 2 PID: 2386 Comm: wtdg_monitor.sh Tainted: G     U          4.9.0-rc4-nightly+ #2
[  175.743581] Hardware name:                  /NUC5i7RYB, BIOS RYBDWi35.86A.0358.2016.0606.1423 06/06/2016
[  175.743603] task: ffff88024509ba80 task.stack: ffffc9007bd18000
[  175.743618] RIP: 0010:[<ffffffffa01af29b>]  [<ffffffffa01af29b>] i915_gem_wait_for_idle+0x3b/0x140 [i915]
[  175.743660] RSP: 0000:ffffc9007bd1b9b8  EFLAGS: 00010297
[  175.743674] RAX: ffff88024489d248 RBX: 0000000000000000 RCX: 0000000000000000
[  175.743691] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff880244898000
[  175.743708] RBP: ffffc9007bd1b9f0 R08: 0000000000000000 R09: 0000000000000001
[  175.743724] R10: 00000028eaf42792 R11: 0000000000000001 R12: dead000000000100
[  175.743741] R13: dead000000000148 R14: ffffc9007bd1ba5f R15: 0000000000000005
[  175.743758] FS:  00007f2638330700(0000) GS:ffff880256d00000(0000) knlGS:0000000000000000
[  175.743777] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  175.743791] CR2: 00007f885c8cea40 CR3: 00000002416b5000 CR4: 00000000003406e0
[  175.743808] Stack:
[  175.743816]  ffff88024489d248 000000004509ba80 ffff880244898000 ffff88024509ba80
[  175.743840]  00000000ffff8b69 ffffc9007bd1ba5f ffffc9007bd1ba5e ffffc9007bd1ba28
[  175.743863]  ffffffffa01b661d 00000000ffffffff 0000000000000000 ffff880244898000
[  175.743886] Call Trace:
[  175.743906]  [<ffffffffa01b661d>] i915_gem_shrinker_lock_uninterruptible.constprop.5+0x5d/0xc0 [i915]
[  175.743937]  [<ffffffffa01b6cd0>] i915_gem_shrinker_oom+0x30/0x1b0 [i915]
[  175.743955]  [<ffffffff8109ca79>] notifier_call_chain+0x49/0x70
[  175.743971]  [<ffffffff8109cd9d>] __blocking_notifier_call_chain+0x4d/0x70
[  175.743988]  [<ffffffff8109cdd6>] blocking_notifier_call_chain+0x16/0x20
[  175.744005]  [<ffffffff811885dc>] out_of_memory+0x22c/0x480
[  175.744020]  [<ffffffff81205542>] __alloc_pages_slowpath+0x851/0x8ec
[  175.744037]  [<ffffffff8118ca51>] __alloc_pages_nodemask+0x2c1/0x310
[  175.744054]  [<ffffffff811d8ea8>] alloc_pages_current+0x88/0x120
[  175.744070]  [<ffffffff811833a4>] __page_cache_alloc+0xb4/0xc0
[  175.744086]  [<ffffffff811865ca>] filemap_fault+0x29a/0x500
[  175.744101]  [<ffffffff81299aa6>] ext4_filemap_fault+0x36/0x50
[  175.744117]  [<ffffffff811b3d4a>] __do_fault+0x6a/0xe0
[  175.744131]  [<ffffffff811b97ee>] handle_mm_fault+0xd0e/0x1330
[  175.744147]  [<ffffffff8106738c>] __do_page_fault+0x23c/0x4d0
[  175.744162]  [<ffffffff81067650>] do_page_fault+0x30/0x80
[  175.744177]  [<ffffffff817ffbe8>] page_fault+0x28/0x30
[  175.744191] Code: 41 57 41 56 41 55 41 54 53 48 83 ec 10 4c 8b a7 48 52 00 00 89 75 d4 48 89 45 c8 49 39 c4 74 78 4d 8d 6c 24 48 41 bf 05 00 00 00 <49> 8b 5d 00 48 85 db 74 50 8b 83 20 01 00 00 85 c0 74 15 48 8b
[  175.744320] RIP  [<ffffffffa01af29b>] i915_gem_wait_for_idle+0x3b/0x140 [i915]
[  175.744351]  RSP <ffffc9007bd1b9b8>

Fixes: 80b204bce8f2 ("drm/i915: Enable multiple timelines")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20161111145809.9701-1-chris@chris-wilson.co.uk
7 years agodrm/i915: Convert i915_drv.c to INTEL_GEN
Tvrtko Ursulin [Fri, 4 Nov 2016 14:42:48 +0000 (14:42 +0000)]
drm/i915: Convert i915_drv.c to INTEL_GEN

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: David Weinehall <david.weinehall@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1478270568-7902-2-git-send-email-tvrtko.ursulin@linux.intel.com
7 years agodrm/i915: Pass dev_priv to INTEL_INFO everywhere apart from the gen use
Tvrtko Ursulin [Wed, 9 Nov 2016 11:30:45 +0000 (11:30 +0000)]
drm/i915: Pass dev_priv to INTEL_INFO everywhere apart from the gen use

After this patch only conversion of INTEL_INFO(p)->gen to
INTEL_GEN(dev_priv) remains before the __I915__ macro can
be removed.

v2: Tidy vlv_compute_wm. (David Weinehall)

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: David Weinehall <david.weinehall@linux.intel.com>
Reviewed-by: David Weinehall <david.weinehall@linux.intel.com>
7 years agodrm/i915: Further assorted dev_priv cleanups
Tvrtko Ursulin [Fri, 4 Nov 2016 14:42:46 +0000 (14:42 +0000)]
drm/i915: Further assorted dev_priv cleanups

A small selection of macros which can only accept dev_priv from
now on and a resulting trickle of fixups.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: David Weinehall <david.weinehall@linux.intel.com>
7 years agodrm/i915: More assorted dev_priv cleanups
Tvrtko Ursulin [Mon, 7 Nov 2016 09:29:20 +0000 (09:29 +0000)]
drm/i915: More assorted dev_priv cleanups

A small selection of macros which can only accept dev_priv from
now on and a resulting trickle of fixups.

v2: Keep original order. (Ville Syrjala)

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: David Weinehall <david.weinehall@linux.intel.com>
7 years agodrm/i915: Assorted dev_priv cleanups
Tvrtko Ursulin [Fri, 4 Nov 2016 14:42:44 +0000 (14:42 +0000)]
drm/i915: Assorted dev_priv cleanups

A small selection of macros which can only accept dev_priv from
now on and a resulting trickle of fixups.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: David Weinehall <david.weinehall@linux.intel.com>
7 years agodrm: Add missing mutex_destroy in drm_dev_init/release
Joonas Lahtinen [Thu, 10 Nov 2016 13:50:35 +0000 (15:50 +0200)]
drm: Add missing mutex_destroy in drm_dev_init/release

Add 3 missing mutex_destroy to drm_dev_init teardown and
drm_dev_release.

v2:
- Also include drm_dev_release

Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1478785835-4142-1-git-send-email-joonas.lahtinen@linux.intel.com
Link: http://patchwork.freedesktop.org/patch/msgid/1478785835-4142-1-git-send-email-joonas.lahtinen@linux.intel.com
7 years agodrm/i915: Split out i915_vma.c
Joonas Lahtinen [Fri, 11 Nov 2016 10:43:54 +0000 (12:43 +0200)]
drm/i915: Split out i915_vma.c

As a side product, had to split two other files;
- i915_gem_fence_reg.h
- i915_gem_object.h (only parts that needed immediate untanglement)

I tried to move code in as big chunks as possible, to make review
easier. i915_vma_compare was moved to a header temporarily.

v2:
- Use i915_gem_fence_reg.{c,h}

v3:
- Rebased

v4:
- Fix building when DEBUG_GEM is enabled by reordering a bit.

Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Acked-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1478861034-30643-1-git-send-email-joonas.lahtinen@linux.intel.com
7 years agoMerge tag 'zxdrm-4.10' of git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo...
Dave Airlie [Fri, 11 Nov 2016 00:03:15 +0000 (10:03 +1000)]
Merge tag 'zxdrm-4.10' of git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux into drm-next

ZTE zxdrm driver support for 4.10:

This is the initial ZTE VOU display controller DRM/KMS driver.  There
are still some features to be added, like overlay plane, scaling, and
more output devices support.  But it's already useful with dual CRTCs
and HDMI display working.

[airlied: use drm_format_plane_cpp instead of legacy api]
* tag 'zxdrm-4.10' of git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux:
  MAINTAINERS: add an entry for ZTE ZX DRM driver
  drm: zte: add initial vou drm driver
  dt-bindings: add bindings doc for ZTE VOU display controller

7 years agoMerge branch 'for-upstream/mali-dp' of git://linux-arm.org/linux-ld into drm-next
Dave Airlie [Fri, 11 Nov 2016 00:00:58 +0000 (10:00 +1000)]
Merge branch 'for-upstream/mali-dp' of git://linux-arm.org/linux-ld into drm-next

Here is the list of fixes that I have for drm/mali-dp. They've been on the mailing
lists for a while and merged into linux-next for a few weeks, but due to holiday and
travel to Linux Plumbers I did not send the pull request earlier. I don't know if
these patches can be pulled into v4.9 still (they will conflict with Ville Syrjälä's
cleanup of DRM_ROTATE series that is already in drm-next), but if you do that would
be great.

* 'for-upstream/mali-dp' of git://linux-arm.org/linux-ld:
  drm: mali-dp: Clear CVAL when leaving config mode
  drm/arm: mark symbols static where possible
  drm: mali-dp: Add support for setting plane's rotation property from userspace.
  drm: mali-dp: Don't set DRM_PLANE_COMMIT_ACTIVE_ONLY
  drm: mali-dp: Store internal format and n_planes in plane state
  drm: mali-dp: Enable alpha blending
  drm: mali-dp: Refactor plane initialisation
  arm: mali-dp: Extract mode_config cleanup into malidp_fini
  drm: mali-dp: Add pitch alignment check for planes
  drm: mali-dp: Add pitch alignment check function
  drm: mali-dp: Set the drm->irq_enabled flag to match driver's state.
  drm: mali-dp: Clear the config_valid flag before using it in wait_event.

7 years agoMerge tag 'dw-hdmi-next-2016-09-19' of git://git.pengutronix.de/git/pza/linux into...
Dave Airlie [Thu, 10 Nov 2016 23:57:54 +0000 (09:57 +1000)]
Merge tag 'dw-hdmi-next-2016-09-19' of git://git.pengutronix.de/git/pza/linux into drm-next

dw-hdmi i2c master controller

- add support for the HDMI I2C master controller, for boards that
  can have their DDC pins connected only to the HDMI TX directly.

* tag 'dw-hdmi-next-2016-09-19' of git://git.pengutronix.de/git/pza/linux:
  drm: bridge/dw_hdmi: add dw hdmi i2c bus adapter support
  drm: dw_hdmi: use of_get_i2c_adapter_by_node interface

7 years agoMerge tag 'imx-drm-next-2016-11-10' of git://git.pengutronix.de/git/pza/linux into...
Dave Airlie [Thu, 10 Nov 2016 23:31:27 +0000 (09:31 +1000)]
Merge tag 'imx-drm-next-2016-11-10' of git://git.pengutronix.de/git/pza/linux into drm-next

imx-drm plane update cleanup, YUV formats

- request modeset if plane offsets changed, only the plane base
  address can be changed without disabling the plane IDMAC channel.
- cleanup of plane atomic_update
- remove unused ipu_cpmem_set_yuv_planar function
- support YUV 4:4:4, 4:2:2, NV12 and NV16 plane formats
- not only mask interrupts during irq init, also clear them
- remove a legacy check from imx-ldb
- add support to set the CSI downsizing bits
- silence an obnoxious warning during modeset

* tag 'imx-drm-next-2016-11-10' of git://git.pengutronix.de/git/pza/linux:
  gpu: ipu-di: silence videomode logspam
  gpu: ipu-v3: add ipu_csi_set_downsize
  drm/imx: imx-ldb: remove unnecessary double disable check
  gpu: ipu-v3: initially clear all interrupts
  drm/imx: ipuv3-plane: add support for YUV 4:2:2 and 4:4:4, NV12, and NV16 formats
  gpu: ipu-v3: add YUV 4:4:4 support
  gpu: ipu-cpmem: remove unused ipu_cpmem_set_yuv_planar function
  drm/imx: ipuv3-plane: let drm_plane_state_to_ubo/vbo handle chroma subsampling other than 4:2:0
  drm/imx: ipuv3-plane: merge ipu_plane_atomic_set_base into atomic_update
  drm/imx: ipuv3-plane: request modeset if plane offsets changed

7 years agoMerge tag 'topic/drm-misc-2016-11-10' of git://anongit.freedesktop.org/drm-intel...
Dave Airlie [Thu, 10 Nov 2016 23:28:44 +0000 (09:28 +1000)]
Merge tag 'topic/drm-misc-2016-11-10' of git://anongit.freedesktop.org/drm-intel into drm-next

- better atomic state debugging from Rob
- fence prep from gustavo
- sumits flushed out his backlog of pending dma-buf/fence patches from
  various people
- drm_mm leak debugging plus trying to appease Kconfig (Chris)
- a few misc things all over

* tag 'topic/drm-misc-2016-11-10' of git://anongit.freedesktop.org/drm-intel: (35 commits)
  drm: Make DRM_DEBUG_MM depend on STACKTRACE_SUPPORT
  drm/i915: Restrict DRM_DEBUG_MM automatic selection
  drm: Restrict stackdepot usage to builtin drm.ko
  drm/msm: module param to dump state on error irq
  drm/msm/mdp5: add atomic_print_state support
  drm/atomic: add debugfs file to dump out atomic state
  drm/atomic: add new drm_debug bit to dump atomic state
  drm: add helpers to go from plane state to drm_rect
  drm: add helper for printing to log or seq_file
  drm: helper macros to print composite types
  reservation: revert "wait only with non-zero timeout specified (v3)" v2
  drm/ttm: fix ttm_bo_wait
  dma-buf/fence: revert "don't wait when specified timeout is zero" (v2)
  dma-buf/fence: make timeout handling in fence_default_wait consistent (v2)
  drm/amdgpu: add the interface of waiting multiple fences (v4)
  dma-buf: return index of the first signaled fence (v2)
  MAINTAINERS: update Sync File Framework files
  dma-buf/sw_sync: put fence reference from the fence creation
  dma-buf/sw_sync: mark sync_timeline_create() static
  drm: Add stackdepot include for DRM_DEBUG_MM
  ...

7 years agoMerge tag 'drm-intel-next-2016-11-08' of git://anongit.freedesktop.org/git/drm-intel...
Dave Airlie [Thu, 10 Nov 2016 23:25:32 +0000 (09:25 +1000)]
Merge tag 'drm-intel-next-2016-11-08' of git://anongit.freedesktop.org/git/drm-intel into drm-next

- gpu idling rework for s/r (Imre)
- vlv mappable scanout fix
- speed up probing in resume (Lyude)
- dp audio workarounds for gen9 (Dhinakaran)
- more conversion to using dev_priv internally (Ville)
- more gen9+ wm fixes and cleanups (Maarten)
- shrinker cleanup&fixes (Chris)
- reorg plane init code (Ville)
- implement support for multiple timelines (prep work for scheduler)
  from Chris and all
- untangle dev->struct_mutex locking as prep for multiple timelines
  (Chris)
- refactor bxt phy code and collect it all in intel_dpio_phy.c (Ander)
- another gvt with bugfixes all over from Zhenyu
- piles of lspcon fixes from Imre
- 90/270 rotation fixes (Ville)
- guc log buffer support (Akash+Sagar)
- fbc fixes from Paulo
- untangle rpm vs. tiling-fences/mmaps (Chris)
- fix atomic commit to wait on the right fences (Daniel Stone)

* tag 'drm-intel-next-2016-11-08' of git://anongit.freedesktop.org/git/drm-intel: (181 commits)
  drm/i915: Update DRIVER_DATE to 20161108
  drm/i915: Mark CPU cache as dirty when used for rendering
  drm/i915: Add assert for no pending GPU requests during suspend/resume in LR mode
  drm/i915: Make sure engines are idle during GPU idling in LR mode
  drm/i915: Avoid early GPU idling due to race with new request
  drm/i915: Avoid early GPU idling due to already pending idle work
  drm/i915: Limit Valleyview and earlier to only using mappable scanout
  drm/i915: Round tile chunks up for constructing partial VMAs
  drm/i915: Remove the vma from the object list upon close
  drm/i915: Reinit polling before hpd when resuming
  drm/i915: Remove redundant reprobe in i915_drm_resume
  drm/i915/dp: Extend BDW DP audio workaround to GEN9 platforms
  drm/i915/dp: BDW cdclk fix for DP audio
  drm/i915: Fix pages pin counting around swizzle quirk
  drm/i915: Fix test on inputs for vma_compare()
  drm/i915/guc: Cache the client mapping
  drm/i915: Tidy slab cache allocations
  drm/i915: Introduce HAS_64BIT_RELOC
  drm/i915: Show the execlist queue in debugfs/i915_engine_info
  drm/i915: Unify global_list into global_link
  ...

7 years agoMerge tag 'gvt-next-kvmgt-framework' of https://github.com/01org/gvt-linux into drm...
Daniel Vetter [Thu, 10 Nov 2016 18:07:30 +0000 (19:07 +0100)]
Merge tag 'gvt-next-kvmgt-framework' of https://github.com/01org/gvt-linux into drm-intel-next-queued

Zhenyu Wang writes:

gvt-next-kvmgt-framework

This adds initial KVMGT framework based on GVT-g MPT(Mediated Passthrough) interface.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
7 years agodrm/i915: Trim the object sg table
Tvrtko Ursulin [Wed, 9 Nov 2016 15:13:43 +0000 (15:13 +0000)]
drm/i915: Trim the object sg table

At the moment we allocate enough sg table entries assuming we
will not be able to do any coalescing. But since in practice
we most often can, and more so very effectively, this ends up
wasting a lot of memory.

A simple and effective way of trimming the over-allocated
entries is to copy the table over to a new one allocated to the
exact size.

Experiments on my freshly logged and idle desktop (KDE) showed
that by doing this we can save approximately 1 MiB of RAM, or
when running a typical benchmark like gl_manhattan I have
even seen a 6 MiB saving.

More complicated techniques such as only copying the last used
page and freeing the rest are left to the reader.

v2:
 * Update commit message.
 * Use temporary sg_table on stack. (Chris Wilson)

v3:
 * Commit message update.
 * Comment added.
 * Replace memcpy with copy assignment.
   (Chris Wilson)

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>
Link: http://patchwork.freedesktop.org/patch/msgid/1478704423-7447-1-git-send-email-tvrtko.ursulin@linux.intel.com
7 years agodrm/i915/gvt: add KVMGT support
Jike Song [Wed, 9 Nov 2016 12:30:59 +0000 (20:30 +0800)]
drm/i915/gvt: add KVMGT support

KVMGT is the MPT implementation based on VFIO/KVM. It provides
a kvmgt_mpt ops to gvt for vGPU access mediation, e.g. to
mediate and emulate the MMIO accesses, to inject interrupts
to vGPU user, to intercept the GTT writing and replace it with
DMA-able address, to write-protect guest PPGTT table for
shadowing synchronization, etc. This patch provides the MPT
implementation for GVT, not yet functional due to theabsence
of mdev.

It's built as kvmgt.ko, depends on vfio.ko, kvm.ko and mdev.ko,
and being required by i915.ko. To not introduce hard dependency
in i915.ko, we used indirect symbol reference. But that means
users have to include kvmgt.ko into init ramdisk if their
i915.ko is included.

Signed-off-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Xiaoguang Chen <xiaoguang.chen@intel.com>
Signed-off-by: Jike Song <jike.song@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
7 years agodrm/i915/gvt: refactor intel_gvt_io_emulation_ops to be intel_gvt_ops
Jike Song [Thu, 3 Nov 2016 10:38:35 +0000 (18:38 +0800)]
drm/i915/gvt: refactor intel_gvt_io_emulation_ops to be intel_gvt_ops

There are currently 4 methods in intel_gvt_io_emulation_ops
to emulate CFG/MMIO reading/writing for intel vGPU. A possibly
better scope is: add 3 more methods for vgpu create/destroy/reset
respectively, and rename the ops to 'intel_gvt_ops', then pass
it to the MPT module (say the future kvmgt) to use: they are
all methods for external usage.

Signed-off-by: Jike Song <jike.song@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
7 years agodrm/i915/gvt: allow several MPT methods to be NULL
Jike Song [Thu, 3 Nov 2016 10:38:34 +0000 (18:38 +0800)]
drm/i915/gvt: allow several MPT methods to be NULL

Hypervisors are different, the MPT ops is a only superset of
all possibly supported hypervisors. There might be other way
out of the MPT to achieve same target. e.g. vfio-based kvmgt
won't provide map_gfn_to_mfn method to establish guest EPT
mapping for aperture, since it will be done in QEMU/KVM, MMIO
is also trapped elsewhere, etc.

Signed-off-by: Jike Song <jike.song@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
7 years agodrm/i915/gvt: introduce host_init/host_exit to MPT
Jike Song [Thu, 3 Nov 2016 10:38:33 +0000 (18:38 +0800)]
drm/i915/gvt: introduce host_init/host_exit to MPT

GVT host needs init/exit hooks to do some initialization/cleanup
work, e.g.: vfio mdev host device register/unregister.

Signed-off-by: Jike Song <jike.song@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
7 years agodrm/i915/gvt: remove obsolete code for old kvmgt opregion
Jike Song [Thu, 3 Nov 2016 10:38:32 +0000 (18:38 +0800)]
drm/i915/gvt: remove obsolete code for old kvmgt opregion

Current GVT contains some obsolete logic originally cooked to
support the old, non-vfio kvmgt, which is actually workarounds.
We don't support that anymore, so it's safe to remove it and
make a better framework.

Signed-off-by: Jike Song <jike.song@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
7 years agodrm/i915/gvt: add intel vgpu types support
Zhenyu Wang [Thu, 3 Nov 2016 10:38:31 +0000 (18:38 +0800)]
drm/i915/gvt: add intel vgpu types support

By providing predefined vGPU types, users can choose which type a vgpu
to create and use, without specifying detailed parameters.

Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Jike Song <jike.song@intel.com>
7 years agodrm/i915/gvt: use kmap instead of kmap_atomic around guest memory access
Xiaoguang Chen [Thu, 3 Nov 2016 10:38:30 +0000 (18:38 +0800)]
drm/i915/gvt: use kmap instead of kmap_atomic around guest memory access

kmap_atomic doesn't allow sleep until unmapped. However,
it's necessary to allow sleep during reading/writing guest
memory, so use kmap instead.

Signed-off-by: Bing Niu <bing.niu@intel.com>
Signed-off-by: Xiaoguang Chen <xiaoguang.chen@intel.com>
Signed-off-by: Jike Song <jike.song@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
7 years agodrm/i915/gvt: don't rely on guest PPGTT entry to free old shadow data
Bing Niu [Mon, 7 Nov 2016 02:44:36 +0000 (10:44 +0800)]
drm/i915/gvt: don't rely on guest PPGTT entry to free old shadow data

On guest writing a PPGTT entry, if it contains value and the old
entry is valid, gvt will read it and find & free the corresponding
old data for it. However, with the KVM write protection provided
by page_track, the guest entry will be written with new value
before gvt handling. To avoid that, we should use the shadow
entry instead.

Signed-off-by: Bing Niu <bing.niu@intel.com>
Signed-off-by: Jike Song <jike.song@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
7 years agoMerge tag 'for-kvmgt' of git://git.kernel.org/pub/scm/virt/kvm/kvm into drm-intel...
Daniel Vetter [Thu, 10 Nov 2016 07:06:47 +0000 (08:06 +0100)]
Merge tag 'for-kvmgt' of git://git.kernel.org/pub/scm/virt/kvm/kvm into drm-intel-next-queued

Paulo Bonzini writes:

The three KVM patches that KVMGT needs.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
7 years agodrm: Make DRM_DEBUG_MM depend on STACKTRACE_SUPPORT
Chris Wilson [Wed, 9 Nov 2016 14:39:06 +0000 (14:39 +0000)]
drm: Make DRM_DEBUG_MM depend on STACKTRACE_SUPPORT

0day continues to complain about trying to save a stacktrace for the
users of the drm_mm range allocator. This time, it is that m68k has no
save_stack_trace(), which is apparently guarded by STACKTRACE_SUPPORT.
Make it depend so!

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20161109143906.11057-1-chris@chris-wilson.co.uk
7 years agodrm/i915: Spin until breadcrumb threads are complete
Chris Wilson [Tue, 8 Nov 2016 14:37:19 +0000 (14:37 +0000)]
drm/i915: Spin until breadcrumb threads are complete

When we need to reset the global seqno on wraparound, we have to wait
until the current rbtrees are drained (or otherwise the next waiter will
be out of sequence). The current mechanism to kick and spin until
complete, may exit too early as it would break if the target thread was
currently running. Instead, we must wake up the threads, but keep
spinning until the trees have been deleted.

In order to appease Tvrtko, busy spin rather than yield().

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20161108143719.32215-1-chris@chris-wilson.co.uk
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
7 years agodrm/i915: Pass atomic state to verify_connector_state
Maarten Lankhorst [Tue, 8 Nov 2016 12:55:41 +0000 (13:55 +0100)]
drm/i915: Pass atomic state to verify_connector_state

This gets rid of a warning that the connectors are used without locking
when doing a nonblocking modeset.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1478609742-13603-11-git-send-email-maarten.lankhorst@linux.intel.com
7 years agodrm/i915: Update atomic modeset state synchronously, v2.
Maarten Lankhorst [Tue, 8 Nov 2016 12:55:40 +0000 (13:55 +0100)]
drm/i915: Update atomic modeset state synchronously, v2.

All of this state should be updated as soon as possible. It shouldn't be
done later because then future updates may not depend on it.

Changes since v1:
- Move the modeset update to before drm_atomic_state_get. (Ville)

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1478609742-13603-10-git-send-email-maarten.lankhorst@linux.intel.com
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
7 years agodrm/edid: Remove drm_select_eld
Maarten Lankhorst [Tue, 8 Nov 2016 12:55:39 +0000 (13:55 +0100)]
drm/edid: Remove drm_select_eld

The only user was i915, which is now gone.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Dave Airlie <airlied@redhat.com> #irc
Cc: dri-devel@lists.freedesktop.org
Link: http://patchwork.freedesktop.org/patch/msgid/1478609742-13603-9-git-send-email-maarten.lankhorst@linux.intel.com
7 years agodrm/i915: Pass atomic state to intel_audio_codec_enable, v2.
Maarten Lankhorst [Tue, 8 Nov 2016 12:55:38 +0000 (13:55 +0100)]
drm/i915: Pass atomic state to intel_audio_codec_enable, v2.

drm_select_eld requires mode_config.mutex and connection_mutex
because it looks at the connector list and at the legacy encoders.

This is not required, because when we call audio_codec_enable we know
which connector it was called for, so pass the state.

This also removes having to look at crtc->config.

Changes since v1:
- Use intel_crtc->pipe instead of drm_crtc_index. (Ville)

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1478609742-13603-8-git-send-email-maarten.lankhorst@linux.intel.com
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
7 years agodrm/i915: Convert intel_hdmi to use atomic state
Maarten Lankhorst [Tue, 8 Nov 2016 12:55:37 +0000 (13:55 +0100)]
drm/i915: Convert intel_hdmi to use atomic state

This is the last connector still looking at crtc->config. Fix this.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1478609742-13603-7-git-send-email-maarten.lankhorst@linux.intel.com
7 years agogpu: ipu-di: silence videomode logspam
Lucas Stach [Tue, 8 Nov 2016 15:57:55 +0000 (16:57 +0100)]
gpu: ipu-di: silence videomode logspam

Adapting the videomode to the hardware constraints is something that
can and must happen during normal operation and isn't something that
the user can avoid. So printing a warning each time it happens isn't
helpful.

Demote this message to the debug level.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
7 years agodrm/i915: Restrict DRM_DEBUG_MM automatic selection
Chris Wilson [Tue, 8 Nov 2016 13:19:16 +0000 (13:19 +0000)]
drm/i915: Restrict DRM_DEBUG_MM automatic selection

DRM_DEBUG_MM is only valid if the DRM.ko is builtin as currently
depot_save_stack is not exported.

Fixes: 5c7fcf2db027 ("drm/i915: Enable drm_mm debug when enabling DRM_I915_DEBUG")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20161108131917.6253-1-chris@chris-wilson.co.uk
7 years agodrm: Restrict stackdepot usage to builtin drm.ko
Chris Wilson [Tue, 8 Nov 2016 13:19:17 +0000 (13:19 +0000)]
drm: Restrict stackdepot usage to builtin drm.ko

I misread the kbuild result thinking that we had missed the include
(which we had for completeness anyway), what kbuild was actually warning
me about was that depot_save_stack was not exported.

Temporarily fix this by only selecting STACKDEPOT iff drm.ko is builtin

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Fixes: 5705670d0463 ("drm: Track drm_mm allocators and show leaks on shutdown")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20161108131917.6253-2-chris@chris-wilson.co.uk
7 years agodrm/msm: module param to dump state on error irq
Rob Clark [Sat, 5 Nov 2016 15:08:12 +0000 (11:08 -0400)]
drm/msm: module param to dump state on error irq

Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1478358492-30738-8-git-send-email-robdclark@gmail.com
7 years agodrm/msm/mdp5: add atomic_print_state support
Rob Clark [Sat, 5 Nov 2016 15:08:11 +0000 (11:08 -0400)]
drm/msm/mdp5: add atomic_print_state support

We subclass drm_plane_state, so add mdp5_plane_atomic_print_state() to
dump out our own driver specific plane state.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1478358492-30738-7-git-send-email-robdclark@gmail.com
7 years agodrm/atomic: add debugfs file to dump out atomic state
Rob Clark [Sat, 5 Nov 2016 15:08:10 +0000 (11:08 -0400)]
drm/atomic: add debugfs file to dump out atomic state

Useful to dump current state from debugfs, if turning on the drm.debug
bit is too much overhead.

The drm_state_dump() can also be used by drivers, for example to
implement a module param that dumps state on error irqs.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1478358492-30738-6-git-send-email-robdclark@gmail.com
7 years agodrm/atomic: add new drm_debug bit to dump atomic state
Rob Clark [Sat, 5 Nov 2016 15:08:09 +0000 (11:08 -0400)]
drm/atomic: add new drm_debug bit to dump atomic state

The contents of drm_{plane,crtc,connector}_state is dumped before
commit.  If a driver extends any of the state structs, it can implement
the corresponding funcs->atomic_print_state() to add it's own driver
specific state.

Signed-off-by: Rob Clark <robdclark@gmail.com>
[seanpaul resolved conflict in drm_plane.h]
Signed-off-by: Sean Paul <seanpaul@chromium.org>
7 years agodrm: add helpers to go from plane state to drm_rect
Rob Clark [Sat, 5 Nov 2016 15:08:08 +0000 (11:08 -0400)]
drm: add helpers to go from plane state to drm_rect

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
[seanpaul resolved conflict in drm_plane.h]
Signed-off-by: Sean Paul <seanpaul@chromium.org>
7 years agodrm: add helper for printing to log or seq_file
Rob Clark [Sat, 5 Nov 2016 15:08:07 +0000 (11:08 -0400)]
drm: add helper for printing to log or seq_file

Sometimes it is nice not to duplicate equivalent printk() and
seq_printf() code.

v2: simplify things w/ va_format, and use dev_printk, docs

Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1478358492-30738-3-git-send-email-robdclark@gmail.com
7 years agodrm: helper macros to print composite types
Rob Clark [Sat, 5 Nov 2016 15:08:06 +0000 (11:08 -0400)]
drm: helper macros to print composite types

I'll want to print things in a similar way in a later patch.  This will
make it easier.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1478358492-30738-2-git-send-email-robdclark@gmail.com
7 years agoreservation: revert "wait only with non-zero timeout specified (v3)" v2
Christian König [Mon, 7 Nov 2016 21:16:16 +0000 (16:16 -0500)]
reservation: revert "wait only with non-zero timeout specified (v3)" v2

Reverts commit fb8b7d2b9d80
("reservation: wait only with non-zero timeout specified (v3)")

Otherwise signaling might never be activated on the fences. This can
result in infinite waiting with hardware which has unreliable interrupts.

v2: still return one when the timeout is zero and we don't have any fences.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com> (v1)
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
  [sumits: fix checkpatch warnings]
Link: http://patchwork.freedesktop.org/patch/msgid/1478553376-18575-4-git-send-email-alexander.deucher@amd.com
7 years agodrm/ttm: fix ttm_bo_wait
Christian König [Mon, 7 Nov 2016 21:16:15 +0000 (16:16 -0500)]
drm/ttm: fix ttm_bo_wait

reservation_object_wait_timeout_rcu() should enable signaling even with a
zero timeout, but ttm_bo_wait() can also be called from atomic context and
then it is not a good idea to do this.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
  [sumits: fix checkpatch warnings]
Link: http://patchwork.freedesktop.org/patch/msgid/1478553376-18575-3-git-send-email-alexander.deucher@amd.com
7 years agodma-buf/fence: revert "don't wait when specified timeout is zero" (v2)
Alex Deucher [Mon, 7 Nov 2016 21:16:14 +0000 (16:16 -0500)]
dma-buf/fence: revert "don't wait when specified timeout is zero" (v2)

Reverts commit 847b19a39e4c
("dma-buf/fence: don't wait when specified timeout is zero")

When we don't call the wait function software signaling might never be
activated. This can cause infinite polling loops with unreliable interrupt
driven hardware.

v2: rebase on drm-next

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
  [sumits: reword commit msg for checkpatch warnings]
Link: http://patchwork.freedesktop.org/patch/msgid/1478553376-18575-2-git-send-email-alexander.deucher@amd.com
7 years agodma-buf/fence: make timeout handling in fence_default_wait consistent (v2)
Alex Deucher [Mon, 7 Nov 2016 21:16:13 +0000 (16:16 -0500)]
dma-buf/fence: make timeout handling in fence_default_wait consistent (v2)

Kernel functions taking a timeout usually return 1 on success even
when they get a zero timeout.

v2: agd: rebase on drm-next

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1478553376-18575-1-git-send-email-alexander.deucher@amd.com
7 years agodrm/amdgpu: add the interface of waiting multiple fences (v4)
Junwei Zhang [Fri, 4 Nov 2016 20:16:10 +0000 (16:16 -0400)]
drm/amdgpu: add the interface of waiting multiple fences (v4)

v2: agd: rebase and squash in all the previous optimizations and
changes so everything compiles.
v3: squash in Slava's 32bit build fix
v4: rebase on drm-next (fence -> dma_fence),
    squash in Monk's ioctl update patch

Signed-off-by: Junwei Zhang <Jerry.Zhang@amd.com>
Reviewed-by: Monk Liu <monk.liu@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
 [sumits: fix checkpatch warnings]
Link: http://patchwork.freedesktop.org/patch/msgid/1478290570-30982-2-git-send-email-alexander.deucher@amd.com
7 years agodma-buf: return index of the first signaled fence (v2)
monk.liu [Fri, 4 Nov 2016 20:16:09 +0000 (16:16 -0400)]
dma-buf: return index of the first signaled fence (v2)

Return the index of the first signaled fence.  This information
is useful in some APIs like Vulkan.

v2: rebase on drm-next (fence -> dma_fence)

Signed-off-by: monk.liu <monk.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
 [sumits: fix warnings]
Link: http://patchwork.freedesktop.org/patch/msgid/1478290570-30982-1-git-send-email-alexander.deucher@amd.com
7 years agoMAINTAINERS: update Sync File Framework files
Gustavo Padovan [Wed, 26 Oct 2016 21:04:22 +0000 (19:04 -0200)]
MAINTAINERS: update Sync File Framework files

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1477515862-7980-1-git-send-email-gustavo@padovan.org
7 years agodma-buf/sw_sync: put fence reference from the fence creation
Gustavo Padovan [Wed, 26 Oct 2016 20:59:59 +0000 (18:59 -0200)]
dma-buf/sw_sync: put fence reference from the fence creation

Once sw_sync_ioctl_create_fence() returns we no longer have the
*pt pointer to the fence base object thus we need to put the reference
we have from the fence creation to keep a correct reference accounting.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1477515599-7685-1-git-send-email-gustavo@padovan.org
7 years agodma-buf/sw_sync: mark sync_timeline_create() static
Baoyou Xie [Sun, 18 Sep 2016 12:49:21 +0000 (20:49 +0800)]
dma-buf/sw_sync: mark sync_timeline_create() static

We get 1 warning when building kernel with W=1:
drivers/dma-buf/sw_sync.c:87:23: warning: no previous prototype for 'sync_timeline_create' [-Wmissing-prototypes]

In fact, this function is only used in the file in which it is
declared and don't need a declaration, but can be made static.
So this patch marks it 'static'.

Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1474202961-10099-1-git-send-email-baoyou.xie@linaro.org
7 years agodrm/i915: avoid harmless empty-body warning
Arnd Bergmann [Tue, 8 Nov 2016 13:58:17 +0000 (14:58 +0100)]
drm/i915: avoid harmless empty-body warning

The newly added assert_kernel_context_is_current introduces a warning
when built with W=1:

drivers/gpu/drm/i915/i915_gem.c: In function ‘assert_kernel_context_is_current’:
drivers/gpu/drm/i915/i915_gem.c:4417:63: error: suggest braces around empty body in an ‘else’ statement [-Werror=empty-body]

Changing the GEM_BUG_ON() macro from an empty definition to "do { } while (0)"
makes the macro more robust to use and avoids the warning.

Fixes: 3033acab07f9 ("drm/i915: Queue the idling context switch after all other timelines")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20161108135834.2166677-1-arnd@arndb.de
7 years agoMerge tag 'gvt-next-2016-11-07' of https://github.com/01org/gvt-linux into drm-intel...
Daniel Vetter [Tue, 8 Nov 2016 16:24:05 +0000 (17:24 +0100)]
Merge tag 'gvt-next-2016-11-07' of https://github.com/01org/gvt-linux into drm-intel-next-queued

gvt-next-2016-11-07

- Fix regression from e95433c73a11
- Some MMIO handler fixes
- Add better handling for guest reset control
- stratch page table tree for shadow ppgtt

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
7 years agodrm/i915: Use intel_fb_gtt_offset() also for gen2/3 primary plane
Ville Syrjälä [Mon, 7 Nov 2016 20:20:57 +0000 (22:20 +0200)]
drm/i915: Use intel_fb_gtt_offset() also for gen2/3 primary plane

The code to determine the primary plane offset for gen2/3 looks
different than the code for gen4+, but in fact it's doing the same
thing. Let's make it uniform. Allows us to eliminate the 'obj' from
the list of local variables as well.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1478550057-24864-6-git-send-email-ville.syrjala@linux.intel.com
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
7 years agodrm/i915: Fix error handling for cursor/sprite plane create failure
Ville Syrjälä [Mon, 7 Nov 2016 20:20:56 +0000 (22:20 +0200)]
drm/i915: Fix error handling for cursor/sprite plane create failure

intel_cursor_plane_create() and intel_sprite_plane_create() return
an error pointer, so let's not mistakenly look for a NULL pointer.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reported-by: Chris Wilson <chris@chris-wilson.co.uk>
References: https://lists.freedesktop.org/archives/intel-gfx/2016-November/110690.html
Fixes: b079bd17e301 ("drm/i915: Bail if plane/crtc init fails")
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1478550057-24864-5-git-send-email-ville.syrjala@linux.intel.com
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
7 years agodrm/i915: Grab the rotation from the passed plane state for VLV sprites
Ville Syrjälä [Mon, 7 Nov 2016 20:20:55 +0000 (22:20 +0200)]
drm/i915: Grab the rotation from the passed plane state for VLV sprites

Use the passed in plane_state instead of plane->state in
vlv_update_plane(). Currently the two are one and the same, but if we
start queuing up multiple plane updates they might not be.

Looks like this was rebase fail on my part.

Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Fixes: 8d0deca8c6e0 ("drm/i915: Pass 90/270 vs. 0/180 rotation info for intel_gen4_compute_page_offset()")
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1478550057-24864-4-git-send-email-ville.syrjala@linux.intel.com
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
7 years agodrm: Add stackdepot include for DRM_DEBUG_MM
Chris Wilson [Tue, 8 Nov 2016 11:56:01 +0000 (11:56 +0000)]
drm: Add stackdepot include for DRM_DEBUG_MM

0day found that stackdepot.h doesn't get automatically included on all
architectures, so remember to add our #include.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Fixes: 5705670d0463 ("drm: Track drm_mm allocators and show leaks on shutdown")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Christian König <christian.koenig@amd.com>.
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20161108115601.22873-1-chris@chris-wilson.co.uk
7 years agodrm: mali-dp: Clear CVAL when leaving config mode
Brian Starkey [Tue, 8 Nov 2016 11:36:14 +0000 (11:36 +0000)]
drm: mali-dp: Clear CVAL when leaving config mode

It's possible for CVAL to get set whilst we are in config mode. If this
happens, afer we leave config mode the HW will latch whatever
configuration is in the registers at the next vsync. Most likely this
will be a partial configuration, as we'll be racing against the ongoing
atomic_commit.

To avoid this, clear CVAL before leaving config mode.

Signed-off-by: Brian Starkey <brian.starkey@arm.com>
Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
7 years agodrm/i915: Remove chipset flush after cache flush
Chris Wilson [Sun, 6 Nov 2016 12:59:59 +0000 (12:59 +0000)]
drm/i915: Remove chipset flush after cache flush

We always flush the chipset prior to executing with the GPU, so we can
skip the flush during ordinary domain management.

This should help mitigate some of the potential performance regressions,
but likely trivial, from doing the flush unconditionally before execbuf
introduced in commit dcd79934b0dd ("drm/i915: Unconditionally flush any
chipset buffers before execbuf")

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/20161106130001.9509-1-chris@chris-wilson.co.uk
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
7 years agodrm/i915: Remove two sloppy inline functions from .h
Joonas Lahtinen [Tue, 8 Nov 2016 07:11:48 +0000 (09:11 +0200)]
drm/i915: Remove two sloppy inline functions from .h

Get rid of sloppy inline functions now that we don't have more users:

i915_gem_request_get_seqno
i915_gem_request_get_engine

v2:
- request->engine is always non-NULL (Chris)

Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/1478589108-3702-1-git-send-email-joonas.lahtinen@linux.intel.com
7 years agodrm/plane: add inline doc for struct drm_plane
Gustavo Padovan [Mon, 7 Nov 2016 10:03:33 +0000 (19:03 +0900)]
drm/plane: add inline doc for struct drm_plane

Some of the members of struct drm_plane had extra comments so for these
add inline kernel comment to consolidate all documentation in one place.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
[danvet: Bikeshed a bit more to have real paragraphs with real
sentences.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1478513013-3221-4-git-send-email-gustavo@padovan.org
7 years agodrm/msm: use drm_atomic_set_fence_for_plane() to set the fence
Gustavo Padovan [Mon, 7 Nov 2016 10:03:32 +0000 (19:03 +0900)]
drm/msm: use drm_atomic_set_fence_for_plane() to set the fence

drm_atomic_set_fence_for_plane() is smart and won't overwrite
plane_state->fence if the user already set an explicit fence there.

Cc: Rob Clark <robdclark@gmail.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1478513013-3221-3-git-send-email-gustavo@padovan.org
7 years agodrm/imx: use drm_atomic_set_fence_for_plane() to set the fence
Gustavo Padovan [Mon, 7 Nov 2016 10:03:31 +0000 (19:03 +0900)]
drm/imx: use drm_atomic_set_fence_for_plane() to set the fence

drm_atomic_set_fence_for_plane() is smart and won't overwrite
plane_state->fence if the user already set an explicit fence there.

Cc: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1478513013-3221-2-git-send-email-gustavo@padovan.org
7 years agodrm/atomic: add drm_atomic_set_fence_for_plane()
Gustavo Padovan [Mon, 7 Nov 2016 10:03:30 +0000 (19:03 +0900)]
drm/atomic: add drm_atomic_set_fence_for_plane()

This new function should be used by drivers when setting a implicit
fence for the plane. It abstracts the fact that the user might have
chosen explicit fencing instead.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1478513013-3221-1-git-send-email-gustavo@padovan.org
7 years agodrm: don't override possible_crtcs for primary/cursor planes
Rob Clark [Sat, 5 Nov 2016 14:52:01 +0000 (10:52 -0400)]
drm: don't override possible_crtcs for primary/cursor planes

It is kind of a pointless restriction.  If userspace does silly things
like using crtcA's cursor plane on crtcB, and then setcursor on crtcA,
it will end up with the overlay disabled on crtcB.  But userspace is
allowed to shoot itself like this.

v2: don't WARN_ON() if caller did not set ->possible_crtcs.  This keeps
    the existing behavior by default, if caller does not set the
    ->possible_crtcs.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1478357521-26542-1-git-send-email-robdclark@gmail.com
7 years agodrm/uapi: Add a warning that mode flags must match the xrandr definitions
Ville Syrjälä [Thu, 3 Nov 2016 14:10:01 +0000 (16:10 +0200)]
drm/uapi: Add a warning that mode flags must match the xrandr definitions

Existing userspace expected the mode flags to match the xrandr
definitions 1:1, and even adding new flags in he previously unused
bits is likely to break existing userspace. Add a comment warning
people about this potential trap.

Cc: Shashank Sharma <shashank.sharma@intel.com>
Cc: "Lin, Jia" <lin.a.jia@intel.com>
Cc: Akashdeep Sharma <akashdeep.sharma@intel.com>
Cc: Jim Bride <jim.bride@linux.intel.com>
Cc: Jose Abreu <Jose.Abreu@synopsys.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1478182201-26086-1-git-send-email-ville.syrjala@linux.intel.com
7 years agodrm/edid: Add the missing "Hz" to VIC 58,59 comment
Ville Syrjälä [Thu, 3 Nov 2016 12:53:28 +0000 (14:53 +0200)]
drm/edid: Add the missing "Hz" to VIC 58,59 comment

All the VICs apart from 58 and 59 have the word "Hz" included in the
comment. Include it for 59 and 59 as well.

Cc: Shashank Sharma <shashank.sharma@intel.com>
Cc: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1478177609-16762-1-git-send-email-ville.syrjala@linux.intel.com
7 years agodrm/gma500: remove unused ioctl declarations
Jiang Biao [Tue, 1 Nov 2016 09:01:19 +0000 (17:01 +0800)]
drm/gma500: remove unused ioctl declarations

psb_gem_create_ioctl and psb_gem_mmap_ioctl are not used currently,
their declarations are useless.

Signed-off-by: Jiang Biao <jiang.biao2@zte.com.cn>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1477990879-13139-1-git-send-email-jiang.biao2@zte.com.cn