GitHub/moto-9609/android_kernel_motorola_exynos9610.git
8 years agodrm/vblank: Use drm_event_reserve_init
Daniel Vetter [Thu, 28 Jan 2016 11:01:04 +0000 (12:01 +0100)]
drm/vblank: Use drm_event_reserve_init

Well we can't use that directly since that code must hold
dev->event_lock already. Extract an _unlocked version.

Embarrassingly I've totally forgotten about this patch and any kind of
event-based vblank wait totally blew up, killing the kernel.

v2: Pick the right base struct, someone didn't noticed that gcc was
unhappy. No bug since the addresses at least matched (Daniel Stone)

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Daniel Stone <daniels@collabora.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1453978864-1513-1-git-send-email-daniel.vetter@ffwll.ch
8 years agodrm/vmwgfx: fix a NULL dereference
Dan Carpenter [Thu, 28 Jan 2016 09:06:46 +0000 (12:06 +0300)]
drm/vmwgfx: fix a NULL dereference

We dereference "eaction->event" inside the call to drm_send_event_locked()
so should hold off on setting it to NULL until afterward.

Fixes: fb740cf2492c ("drm: Create drm_send_event helpers")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20160128090646.GA5824@mwanda
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
8 years agodrm/crtc-helper: Add caveat to disable_unused_functions doc
Daniel Vetter [Wed, 13 Jan 2016 14:31:16 +0000 (15:31 +0100)]
drm/crtc-helper: Add caveat to disable_unused_functions doc

This shouldn't be used by atomic drivers any more, it confuses the
state tracking.

Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1452695476-31147-1-git-send-email-daniel.vetter@ffwll.ch
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
8 years agodrm/gma500: Remove empty preclose hook
Daniel Vetter [Mon, 11 Jan 2016 21:41:02 +0000 (22:41 +0100)]
drm/gma500: Remove empty preclose hook

I'm auditing them all, empty ones just confuse ...

Cc: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1452548477-15905-9-git-send-email-daniel.vetter@ffwll.ch
Acked-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
8 years agodrm/armada: Remove NULL open/pre/postclose hooks
Daniel Vetter [Mon, 11 Jan 2016 21:41:01 +0000 (22:41 +0100)]
drm/armada: Remove NULL open/pre/postclose hooks

The compiler will do this, but the void hits when grepping all the
hooks for a subsystem wide audit are slightly annoying. So remove them
for next time around.

Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1452548477-15905-8-git-send-email-daniel.vetter@ffwll.ch
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
8 years agodrm/fsl: Remove preclose hook
Daniel Vetter [Mon, 11 Jan 2016 21:41:00 +0000 (22:41 +0100)]
drm/fsl: Remove preclose hook

Doesn't do anything, but annoys when auditing them all.

Cc: Jianwei Wang <jianwei.wang.chn@gmail.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1452548477-15905-7-git-send-email-daniel.vetter@ffwll.ch
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
8 years agodrm: Create drm_send_event helpers
Daniel Vetter [Mon, 11 Jan 2016 21:40:59 +0000 (22:40 +0100)]
drm: Create drm_send_event helpers

Use them in the core vblank code and exynos/vmwgfx drivers.

Note that the difference between wake_up_all and _interruptible in
vmwgfx doesn't matter since the only waiter is the core code in
drm_fops.c. And that is interruptible.

v2: Adjust existing kerneldoc too.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com> (v1)
Acked-by: Daniel Stone <daniels@collabora.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Thomas Hellstrom <thellstrom@vmware.com>
Cc: Inki Dae <inki.dae@samsung.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1452548477-15905-6-git-send-email-daniel.vetter@ffwll.ch
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
[danvet: Squash in compile fixup, spotted by 0-day.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
8 years agodrm/vmwgfx: Use the new event init/free functions
Daniel Vetter [Mon, 11 Jan 2016 21:40:58 +0000 (22:40 +0100)]
drm/vmwgfx: Use the new event init/free functions

Cc: Rob Clark <robdclark@gmail.com
Cc: Thomas Hellstrom <thellstrom@vmware.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1452548477-15905-5-git-send-email-daniel.vetter@ffwll.ch
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
8 years agodrm/exynos: Use the new event init/free functions
Daniel Vetter [Mon, 11 Jan 2016 21:40:57 +0000 (22:40 +0100)]
drm/exynos: Use the new event init/free functions

Also fixes a bug in IPP with not correctly checking/allocating for
space in the event space. Not a too serious bug since it's not a
real ringbuffer, just a limit to avoid too much kernel allocations.

Cc: Rob Clark <robdclark@gmail.com>
Cc: Inki Dae <inki.dae@samsung.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1452548477-15905-4-git-send-email-daniel.vetter@ffwll.ch
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
8 years agodrm: Add functions to setup/tear down drm_events.
Daniel Vetter [Mon, 11 Jan 2016 21:40:56 +0000 (22:40 +0100)]
drm: Add functions to setup/tear down drm_events.

An attempt at not spreading out the file_priv->event_space stuff out
quite so far and wide.  And I think fixes something in ipp_get_event()
that is broken (or if they are doing something more weird/subtle, then
breaks it in a fun way).

Based upon a patch from Rob Clark, rebased and polished.

v2: Spelling fixes (Alex).

Cc: Alex Deucher <alexdeucher@gmail.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Cc: Rob Clark <robdclark@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1452548477-15905-3-git-send-email-daniel.vetter@ffwll.ch
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
8 years agodrm: kerneldoc for drm_fops.c
Daniel Vetter [Mon, 11 Jan 2016 21:40:55 +0000 (22:40 +0100)]
drm: kerneldoc for drm_fops.c

Just prep work before I throw more drm_event refactorings on top.

Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1452548477-15905-2-git-send-email-daniel.vetter@ffwll.ch
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
8 years agodrm/fbdev-helper: Explain how to debug console_lock fun
Daniel Vetter [Fri, 22 Jan 2016 07:53:45 +0000 (08:53 +0100)]
drm/fbdev-helper: Explain how to debug console_lock fun

Every new KMS driver writer seems to run into this and wonder how
exactly drm_fb_helper_initial_config can die doing nothing at all.
Set up some big warnings signs around this newbie trap to avoid future
frustration and wasting everyone's time.

v2: Edits from Laurent.

Cc: Carlos Palminha <CARLOS.PALMINHA@synopsys.com>
Cc: Xinliang Liu <xinliang.liu@linaro.org>
Cc: laurent.pinchart@ideasonboard.com
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1453449225-10954-1-git-send-email-daniel.vetter@ffwll.ch
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
8 years agodrm/fb_cma_helper: remove duplicate const from drm_fb_cma_alloc
Colin Ian King [Wed, 20 Jan 2016 10:59:34 +0000 (10:59 +0000)]
drm/fb_cma_helper: remove duplicate const from drm_fb_cma_alloc

Duplicated const, only one is required.  Also reformat line to ensure
it is less than 80 columns wide.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1453287574-3645-1-git-send-email-colin.king@canonical.com
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
8 years agodrm: initialize default rotation value to DRM_ROTATE_0
Marek Szyprowski [Tue, 19 Jan 2016 08:26:48 +0000 (09:26 +0100)]
drm: initialize default rotation value to DRM_ROTATE_0

When no console framebuffer is enabled, the default plane state is
defined by plane reset function. If driver uses generic helper, then
rotation property is set to zero. This is not a valid value for that
enum. This patch sets default rotation value to DRM_ROTATE_0.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1453192008-13283-1-git-send-email-m.szyprowski@samsung.com
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
8 years agodrm/atomic-helper: Remove redundant local var old_crtc_state in disable_outputs
Liu Ying [Mon, 18 Jan 2016 03:36:35 +0000 (11:36 +0800)]
drm/atomic-helper: Remove redundant local var old_crtc_state in disable_outputs

One of the two local variables old_crtc_state is redundantly defined in the
function disable_outputs().  It has only a scope partway through the block
for_each_connector_in_state.  So, let's remove it and use the one which
has the scope within the function disable_outputs().

Signed-off-by: Liu Ying <gnuiyl@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1453088195-2564-1-git-send-email-gnuiyl@gmail.com
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
8 years agodrm/crtc_helper/set_config: Remove redundant NULL pointer check on set->mode
Liu Ying [Thu, 14 Jan 2016 06:00:10 +0000 (14:00 +0800)]
drm/crtc_helper/set_config: Remove redundant NULL pointer check on set->mode

We've done sanity NULL pointer check on set->mode at the beginning of
drm_crtc_helper_set_config() and bailed out if necessary, thus any later on
check is redundant.

Signed-off-by: Liu Ying <gnuiyl@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1452751210-19216-2-git-send-email-gnuiyl@gmail.com
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
8 years agodrm/crtc_helper/set_config: Remove redundant handling when set->fb is NULL
Liu Ying [Thu, 14 Jan 2016 06:00:09 +0000 (14:00 +0800)]
drm/crtc_helper/set_config: Remove redundant handling when set->fb is NULL

We've done sanity NULL pointer check on set->fb at the beginning of
drm_crtc_helper_set_config() and bailed out if necessary, thus any later on
check or case handling is redundant.

Signed-off-by: Liu Ying <gnuiyl@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1452751210-19216-1-git-send-email-gnuiyl@gmail.com
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
8 years agoMerge tag 'drm-intel-next-fixes-2016-01-14' of git://anongit.freedesktop.org/drm...
Dave Airlie [Sun, 17 Jan 2016 21:02:19 +0000 (07:02 +1000)]
Merge tag 'drm-intel-next-fixes-2016-01-14' of git://anongit.freedesktop.org/drm-intel into drm-next

misc i915 fixes all over the place.

* tag 'drm-intel-next-fixes-2016-01-14' of git://anongit.freedesktop.org/drm-intel:
  drm/i915/gen9: Set PIN_ZONE_4G end to 4GB - 1 page
  drm/i915: Widen return value for reservation_object_wait_timeout_rcu to long.
  drm/i915: intel_hpd_init(): Fix suspend/resume reprobing
  drm/i915: shut up gen8+ SDE irq dmesg noise, again
  drm/i915: Restore inhibiting the load of the default context
  drm/i915: Tune down rpm wakelock debug checks
  drm/i915: Avoid writing relocs with addresses in non-canonical form
  drm/i915: Move Braswell stop_machine GGTT insertion workaround

8 years agoMerge tag 'topic/drm-misc-2016-01-17' of git://anongit.freedesktop.org/drm-intel...
Dave Airlie [Sun, 17 Jan 2016 21:01:16 +0000 (07:01 +1000)]
Merge tag 'topic/drm-misc-2016-01-17' of git://anongit.freedesktop.org/drm-intel into drm-next

Since your main drm-next pull isn't out of the door yet I figured I might
as well flush out drm-misc instead of delaying for 4.6. It's really just
random stuff all over, biggest thing probably connector_mask tracking from
Maarten.

* tag 'topic/drm-misc-2016-01-17' of git://anongit.freedesktop.org/drm-intel: (24 commits)
  drm/fb_cma_helper: Remove implicit call to disable_unused_functions
  drm/sysfs: use kobj_to_dev()
  drm/i915: Init power domains early in driver load
  drm: Do not set connector->encoder in drivers
  apple-gmux: Add initial documentation
  drm: move MODULE_PARM_DESC to other file
  drm/edid: index CEA/HDMI mode tables using the VIC
  drm/atomic: Remove drm_atomic_connectors_for_crtc.
  drm/i915: Update connector_mask during readout, v2.
  drm: Remove opencoded drm_gem_object_release_handle()
  drm: Do not set outparam on error during GEM handle allocation
  drm/docs: more leftovers from the big vtable documentation pile
  drm/atomic-helper: Reject legacy flips on a disabled pipe
  drm/atomic: add connector mask to drm_crtc_state.
  drm/tegra: Use __drm_atomic_helper_reset_connector for subclassing connector state, v2.
  drm/atomic: Add __drm_atomic_helper_connector_reset, v2.
  drm/i915: Set connector_state->connector using the helper.
  drm: Use a normal idr allocation for the obj->name
  drm: Only bump object-reference count when adding first handle
  drm: Balance error path for GEM handle allocation
  ...

8 years agodrm/fb_cma_helper: Remove implicit call to disable_unused_functions
Maxime Ripard [Thu, 14 Jan 2016 15:24:56 +0000 (16:24 +0100)]
drm/fb_cma_helper: Remove implicit call to disable_unused_functions

The drm_fbdev_cma_init function always calls the
drm_helper_disable_unused_functions. Since it's part of the usual probe
process, all the drivers using that helper will end up having their encoder
and CRTC disable functions called at probe if their device has not been
reported as enabled.

This could be fixed by reading out from the registers the current state of
the device if it is enabled, but even that will not handle the case where
the device is actually disabled.

Moreover, the drivers using the atomic modesetting expect that their enable
and disable callback to be called when the device is already enabled or
disabled (respectively).

We can however fix this issue by moving the call to
drm_helper_disable_unused_functions out of drm_fbdev_cma_init and make the
drivers needing it (all the drivers calling drm_fbdev_cma_init and not
using the atomic modesetting) explicitly call it.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1452785109-6172-14-git-send-email-maxime.ripard@free-electrons.com
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
8 years agodrm/amdgpu: add missing irq.h include
Dave Airlie [Wed, 13 Jan 2016 22:07:55 +0000 (08:07 +1000)]
drm/amdgpu: add missing irq.h include

this fixes the build on arm.

Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agoMerge branch 'exynos-drm-next' of git://git.kernel.org/pub/scm/linux/kernel/git/daein...
Dave Airlie [Wed, 13 Jan 2016 21:59:21 +0000 (07:59 +1000)]
Merge branch 'exynos-drm-next' of git://git./linux/kernel/git/daeinki/drm-exynos into drm-next

 This 2nd pull request includes the following,
   - add configurable plane support and relevant cleanups.
   - fixup kernel panic issue at drm releasing.
   - remove unnecessary codes.

   This has been delayed to resolve a critical issue - which incurrs
   a kernel panic when driver is released - and review it.

* 'exynos-drm-next' of git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos:
  drm/exynos: fix kernel panic issue at drm releasing
  drm/exynos: crtc: do not wait for the scanout completion
  drm/exynos: mixer: properly update all planes on the same vblank event
  drm/exynos: crtc: rework atomic_{begin,flush}
  drm/exynos: mixer: unify a check for video-processor window
  drm/exynos: mixer: also allow ARGB1555 and ARGB4444
  drm/exynos: mixer: refactor layer setup
  drm/exynos: mixer: remove all static blending setup
  drm/exynos: mixer: set window priority based on zpos
  drm/exynos: make zpos property configurable
  drm/exynos: rename zpos to index

8 years agoMerge branch 'drm-etnaviv-fixes' of git://git.pengutronix.de/git/lst/linux into drm...
Dave Airlie [Wed, 13 Jan 2016 21:58:06 +0000 (07:58 +1000)]
Merge branch 'drm-etnaviv-fixes' of git://git.pengutronix.de/git/lst/linux into drm-next

etnaviv fixes.

* 'drm-etnaviv-fixes' of git://git.pengutronix.de/git/lst/linux:
  drm/etnaviv: fix workaround for GC500
  drm/etnaviv: unlock on error in etnaviv_gem_get_iova()

8 years agoMerge branch 'drm-rockchip-next-2016-01-06' of https://github.com/markyzq/kernel...
Dave Airlie [Wed, 13 Jan 2016 21:57:24 +0000 (07:57 +1000)]
Merge branch 'drm-rockchip-next-2016-01-06' of https://github.com/markyzq/kernel-drm-rockchip into drm-next

new rockchip bits.

* 'drm-rockchip-next-2016-01-06' of https://github.com/markyzq/kernel-drm-rockchip:
  drm: rockchip: Support Synopsys DW MIPI DSI
  Documentation: dt-bindings: Add bindings for rk3288 DW MIPI DSI driver
  drm/rockchip: return a true clock rate to adjusted_mode

8 years agodrm/vmwgfx: Fix a width / pitch mismatch on framebuffer updates
Thomas Hellstrom [Fri, 8 Jan 2016 19:29:40 +0000 (20:29 +0100)]
drm/vmwgfx: Fix a width / pitch mismatch on framebuffer updates

When the framebuffer is a vmwgfx dma buffer and a proxy surface is
created, the vmw_kms_update_proxy() function requires that the proxy
surface width and the framebuffer pitch are compatible, otherwise
display corruption occurs as seen in gnome-shell/native with software
3D. Since the framebuffer pitch is determined by user-space, allocate
a proxy surface the width of which is based on the framebuffer pitch
rather than on the framebuffer width.

Cc: <stable@vger.kernel.org>
Reported-by: Raphael Hertzog <buxy@kali.org>
Tested-by: Mati Aharoni <muts@kali.org>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodrm/vmwgfx: Fix an incorrect lock check
Thomas Hellstrom [Fri, 8 Jan 2016 19:29:39 +0000 (20:29 +0100)]
drm/vmwgfx: Fix an incorrect lock check

With CONFIG_SMP=n and CONFIG_DEBUG_SPINLOCK=y the vmwgfx kernel module
would unconditionally throw a bug when checking for a held spinlock
in the command buffer code. Fix this by using a lockdep check.

Cc: <stable@vger.kernel.org>
Reported-and-tested-by: Tetsuo Handa <penguin-kernel@i-love-sakura.ne.jp>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodrm: nouveau: fix nouveau_debugfs_init prototype
Arnd Bergmann [Wed, 13 Jan 2016 13:48:13 +0000 (14:48 +0100)]
drm: nouveau: fix nouveau_debugfs_init prototype

The new debugfs initialization code fails to build when CONFIG_DEBUG_FS
is disabled:

In file included from /git/arm-soc/drivers/gpu/drm/nouveau/nouveau_drm.c:57:0:
drivers/gpu/drm/nouveau/nouveau_debugfs.h: In function 'nouveau_debugfs_init':
drivers/gpu/drm/nouveau/nouveau_debugfs.h:37:29: error: parameter name omitted
 nouveau_debugfs_init(struct nouveau_drm *)

This fixes the prototypes so we can build it again.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: b126a200e9db ("drm/nouveau/debugfs: we need a ctrl object for debugfs")
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodrm/nouveau/pci: fix check in nvkm_pcie_set_link
Karol Herbst [Tue, 12 Jan 2016 21:52:14 +0000 (22:52 +0100)]
drm/nouveau/pci: fix check in nvkm_pcie_set_link

v2: remove unneeded pci check

Signed-off-by: Karol Herbst <nouveau@karolherbst.de>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agoMerge branch 'drm-next-4.5' of git://people.freedesktop.org/~agd5f/linux into drm...
Dave Airlie [Wed, 13 Jan 2016 21:56:07 +0000 (07:56 +1000)]
Merge branch 'drm-next-4.5' of git://people.freedesktop.org/~agd5f/linux into drm-next

A few more misc things for radeon and amdgpu for 4.5:
- TTM fixes for imported buffers
- amdgpu fixes to avoid -ENOMEM in CS ioctl
- CZ UVD and VCE clock force options for debugging video issues
- A couple of ACP prerequisites
- Misc fixes

* 'drm-next-4.5' of git://people.freedesktop.org/~agd5f/linux:
  drm/amdgpu: validate duplicates first
  drm/amdgpu: move VM page tables to the LRU end on CS v2
  drm/ttm: add ttm_bo_move_to_lru_tail function v2
  drm/ttm: fix adding foreign BOs to the swap LRU
  drm/ttm: fix adding foreign BOs to the LRU during init v2
  drm/radeon: use kobj_to_dev()
  drm/amdgpu: use kobj_to_dev()
  drm/amdgpu/cz: force vce clocks when sclks are forced
  drm/amdgpu/cz: force uvd clocks when sclks are forced
  drm/amdgpu/cz: add code to enable forcing VCE clocks
  drm/amdgpu/cz: add code to enable forcing UVD clocks
  drm/amdgpu: fix lost sync_to if scheduler is enabled.
  drm/amd/powerplay: fix static checker warning for return meaningless value.
  drm/amdgpu: add irq domain support
  drm/amdgpu/cgs: add an interface to access PCI resources

8 years agodrm/amdgpu: validate duplicates first
Christian König [Mon, 11 Jan 2016 14:35:22 +0000 (15:35 +0100)]
drm/amdgpu: validate duplicates first

Most VM BOs end up in the duplicates list, validate it
first make -ENOMEM less likely.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <David1.Zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: move VM page tables to the LRU end on CS v2
Christian König [Mon, 11 Jan 2016 14:35:21 +0000 (15:35 +0100)]
drm/amdgpu: move VM page tables to the LRU end on CS v2

This makes it less likely to run into an ENOMEM because
VM page tables are evicted last.

v2: move the BOs in the LRU tail after validation

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/ttm: add ttm_bo_move_to_lru_tail function v2
Christian König [Mon, 11 Jan 2016 14:35:20 +0000 (15:35 +0100)]
drm/ttm: add ttm_bo_move_to_lru_tail function v2

This allows the drivers to move a BO to the end of the LRU
without removing and adding it again.

v2: Make it more robust, handle pinned and swapable BOs as well.

Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/ttm: fix adding foreign BOs to the swap LRU
Christian König [Mon, 11 Jan 2016 14:35:19 +0000 (15:35 +0100)]
drm/ttm: fix adding foreign BOs to the swap LRU

It doesn't make any sense to try to swap out imported BOs.

Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/ttm: fix adding foreign BOs to the LRU during init v2
Christian König [Mon, 11 Jan 2016 14:35:18 +0000 (15:35 +0100)]
drm/ttm: fix adding foreign BOs to the LRU during init v2

If we import a BO with an external reservation object we don't
reserve/unreserve it. So we never add it to the LRU causing a possible
denial of service.

v2: fix typo in commit message

Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/radeon: use kobj_to_dev()
Geliang Tang [Wed, 13 Jan 2016 14:48:43 +0000 (22:48 +0800)]
drm/radeon: use kobj_to_dev()

Use kobj_to_dev() instead of open-coding it.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: use kobj_to_dev()
Geliang Tang [Wed, 13 Jan 2016 14:48:42 +0000 (22:48 +0800)]
drm/amdgpu: use kobj_to_dev()

Use kobj_to_dev() instead of open-coding it.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu/cz: force vce clocks when sclks are forced
Alex Deucher [Fri, 18 Dec 2015 16:33:30 +0000 (11:33 -0500)]
drm/amdgpu/cz: force vce clocks when sclks are forced

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu/cz: force uvd clocks when sclks are forced
Alex Deucher [Fri, 18 Dec 2015 16:28:49 +0000 (11:28 -0500)]
drm/amdgpu/cz: force uvd clocks when sclks are forced

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu/cz: add code to enable forcing VCE clocks
Alex Deucher [Fri, 18 Dec 2015 16:25:16 +0000 (11:25 -0500)]
drm/amdgpu/cz: add code to enable forcing VCE clocks

VCE DPM works similarly to SCLK DPM.  Add a similar interface
for VCE for forcing the VCE clocks.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu/cz: add code to enable forcing UVD clocks
Alex Deucher [Fri, 18 Dec 2015 16:06:42 +0000 (11:06 -0500)]
drm/amdgpu/cz: add code to enable forcing UVD clocks

UVD DPM works similarly to SCLK DPM.  Add a similar interface
for UVD for forcing the UVD clocks.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: fix lost sync_to if scheduler is enabled.
Chunming Zhou [Wed, 13 Jan 2016 04:55:18 +0000 (12:55 +0800)]
drm/amdgpu: fix lost sync_to if scheduler is enabled.

when scheduler is enabled, the semaphore isn't used at all.

Signed-off-by: Chunming Zhou <David1.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Cc: stable@vger.kernel.org
8 years agodrm/amd/powerplay: fix static checker warning for return meaningless value.
Rex Zhu [Mon, 11 Jan 2016 03:25:18 +0000 (11:25 +0800)]
drm/amd/powerplay: fix static checker warning for return meaningless value.

The return value should be either negative or zero, no positive.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/sysfs: use kobj_to_dev()
Geliang Tang [Wed, 13 Jan 2016 14:48:41 +0000 (22:48 +0800)]
drm/sysfs: use kobj_to_dev()

Use kobj_to_dev() instead of open-coding it.

Link: http://patchwork.freedesktop.org/patch/msgid/3fea991541fbfc4ffece2c174adeb02cb9436c90.1452696179.git.geliangtang@163.com
Signed-off-by: Geliang Tang <geliangtang@163.com>
8 years agodrm/i915: Init power domains early in driver load
Daniel Vetter [Wed, 13 Jan 2016 10:55:28 +0000 (11:55 +0100)]
drm/i915: Init power domains early in driver load

Since

commit ac9b8236551d1177fd07b56aef9b565d1864420d
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
Date:   Fri Nov 27 18:55:26 2015 +0200

    drm/i915: Introduce a gmbus power domain

gmbus also needs the power domain infrastructure right from the start,
since as soon as we register the i2c controllers someone can use them.

v2: Adjust cleanup paths too (Chris).

v3: Rebase onto -nightly (totally bogus tree I had lying around) and
also move dpio init head (Ville).

v4: Ville instead suggested to move gmbus setup later in the sequence,
since it's only needed by the modeset code.

v5: Move even close to the actual user, right next to the comment that
states where we really need gmbus (and interrupts!).

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Patrik Jakobsson <patrik.jakobsson@linux.intel.com>
Cc: Imre Deak <imre.deak@intel.com>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Meelis Roos <mroos@linux.ee>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Fixes: ac9b8236551d ("drm/i915: Introduce a gmbus power domain")
Cc: stable@vger.kernel.org
References: http://www.spinics.net/lists/intel-gfx/msg83075.html
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1452682528-19437-1-git-send-email-daniel.vetter@ffwll.ch
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
8 years agodrm: Do not set connector->encoder in drivers
Thierry Reding [Mon, 16 Nov 2015 17:19:53 +0000 (18:19 +0100)]
drm: Do not set connector->encoder in drivers

An encoder is associated with a connector by the DRM core as a result of
setting up a configuration. Drivers using the atomic or legacy helpers
should never set up this link, even if it is a static one.

While at it, try to catch this kind of error in the future by adding a
WARN_ON() in drm_mode_connector_attach_encoder(). Note that this doesn't
cover all the cases, since drivers could set this up after attaching.
Drivers that use the atomic helpers will get a warning later on, though,
so hopefully the two combined cover enough to help people avoid this in
the future.

Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Liviu Dudau <Liviu.Dudau@arm.com>
Cc: Mark yao <mark.yao@rock-chips.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1447694393-24700-1-git-send-email-thierry.reding@gmail.com
8 years agodrm/i915/gen9: Set PIN_ZONE_4G end to 4GB - 1 page
Michel Thierry [Mon, 11 Jan 2016 11:39:27 +0000 (11:39 +0000)]
drm/i915/gen9: Set PIN_ZONE_4G end to 4GB - 1 page

Kernel and userspace are able to handle 4GB (1<<32) address space range,
but "A32 Stateless Model" is not. According to documentation, A32 accesses
are based on General State Base Address and bound checking is in place.
Because size field (instruction State Base Address) limitation, it is not
possible to address full 4GB memory region.

A32 Stateless Model is used by some libraries and without this patch, the
last page of 4GB address space is not accessible in 32bit processes.

Reported-by: Artur Harasimiuk <artur.harasimiuk@intel.com>
Signed-off-by: Michel Thierry <michel.thierry@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1452512367-23614-1-git-send-email-michel.thierry@intel.com
Cc: drm-intel-fixes@lists.freedesktop.org
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 1892faa9ec5d51b07d646cbd5597cd30e049aa51)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
8 years agodrm/i915: Widen return value for reservation_object_wait_timeout_rcu to long.
Maarten Lankhorst [Tue, 8 Dec 2015 14:52:56 +0000 (15:52 +0100)]
drm/i915: Widen return value for reservation_object_wait_timeout_rcu to long.

This fixes a spurious warning from an integer overflow on 64-bits systems.
The function may return MAX_SCHEDULE_TIMEOUT which gets truncated to -1.

Explicitly handling this by casting to lret fixes it.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reported-and-tested-by: Joseph Yasi <joe.yasi@gmail.com>
Tested-by: Andreas Reis <andreas.reis@gmail.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: drm-intel-fixes@lists.freedesktop.org
Fixes: 3c28ff22f6e20c ("i915: wait for fence in prepare_plane_fb")
Link: http://patchwork.freedesktop.org/patch/msgid/5666EEC8.2000403@linux.intel.com
(cherry picked from commit bcf8be279c79df6a8a17d9c3e1f9bc926444a87c)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
8 years agodrm/i915: intel_hpd_init(): Fix suspend/resume reprobing
Lyude [Thu, 7 Jan 2016 15:43:28 +0000 (10:43 -0500)]
drm/i915: intel_hpd_init(): Fix suspend/resume reprobing

This fixes reprobing of display connectors on resume.  After some
talking with danvet on IRC, I learned that calling
drm_helper_hpd_irq_event() does actually trigger a full reprobe of each
connector's status. It turns out this is the actual reason reprobing on
resume hasn't been working (this was observed on a T440s):

- We call hpd_init()
- We check each connector for a couple of things before marking
  connector->polled with DRM_CONNECTOR_POLL_HPD, one of which is an
  active encoder. Of course, a disconnected port won't have an
  active encoder, so we don't add the flag to any of the
  connectors.
- We call drm_helper_hpd_irq_event()
- drm_helper_irq_event() checks each connector for the
  DRM_CONNECTOR_POLL_HPD flag. The only one that has it is eDP-1,
  so we skip reprobing each connector except that one.

In addition, we also now avoid setting connector->polled to
DRM_CONNECTOR_POLL_HPD for MST connectors, since their reprobing is
handled by the mst helpers. This is probably what was originally
intended to happen here.

Changes since V1:
* Use the explanation of the issue as the commit message instead
* Change the title of the commit, since this does more then just stop a
  check for an encoder now
* Add "Fixes" line for the patch that introduced this regression
* Don't enable DRM_CONNECTOR_POLL_HPD for mst connectors

Changes since V2:
* Put patch changelog above Signed-off-by
* Follow Daniel Vetter's suggestion for making the code here a bit more
  legible

Fixes: 0e32b39ceed6 ("drm/i915: add DP 1.2 MST support (v0.7)")
Cc: stable@vger.kernel.org
Signed-off-by: Lyude <cpaul@redhat.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1452181408-14777-1-git-send-email-cpaul@redhat.com
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 07c519134417d92c2e1a536e2b66d4ffff4b3be0)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
8 years agodrm/i915: shut up gen8+ SDE irq dmesg noise, again
Jani Nikula [Thu, 7 Jan 2016 08:29:10 +0000 (10:29 +0200)]
drm/i915: shut up gen8+ SDE irq dmesg noise, again

We still keep getting

[    4.249930] [drm:gen8_irq_handler [i915]] *ERROR* The master control interrupt lied (SDE)!

This reverts

commit 820da7ae46332fa709b171eb7ba57cbd023fa6df
Author: Jani Nikula <jani.nikula@intel.com>
Date:   Wed Nov 25 16:47:23 2015 +0200

    Revert "drm/i915: shut up gen8+ SDE irq dmesg noise"

which in itself is a revert, so this is just doing

commit 97e5ed1111dcc5300a0f59a55248cd243937a8ab
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Fri Oct 23 10:56:12 2015 +0200

    drm/i915: shut up gen8+ SDE irq dmesg noise

all over again. I'll stop pretending I understand what's going on like I
did when I thought I'd fixed this for good in

commit 6a39d7c986be4fd18eb019e9cdbf774ec36c9f77
Author: Jani Nikula <jani.nikula@intel.com>
Date:   Wed Nov 25 16:47:22 2015 +0200

    drm/i915: fix the SDE irq dmesg warnings properly

Reported-by: Chris Wilson <chris@chris-wilson.co.uk>
Reference: http://mid.gmane.org/20151213124945.GA5715@nuc-i3427.alporthouse.com
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92084
Cc: drm-intel-fixes@lists.freedesktop.org
Fixes: 820da7ae4633 ("Revert "drm/i915: shut up gen8+ SDE irq dmesg noise"")
Acked-by: Chris Wilson <chris@chris-wilson.co.uk>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1452155350-14658-1-git-send-email-jani.nikula@intel.com
(cherry picked from commit 2dfb0b816d224379efc534764388745c474abeb4)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
8 years agodrm/i915: Restore inhibiting the load of the default context
Chris Wilson [Fri, 27 Nov 2015 13:28:55 +0000 (13:28 +0000)]
drm/i915: Restore inhibiting the load of the default context

Following a GPU reset, we may leave the context in a poorly defined
state, and reloading from that context will leave the GPU flummoxed. For
secondary contexts, this will lead to that context being banned - but
currently it is also causing the default context to become banned,
leading to turmoil in the shared state.

This is a regression from

commit 6702cf16e0ba8b0129f5aa1b6609d4e9c70bc13b [v4.1]
Author: Ben Widawsky <benjamin.widawsky@intel.com>
Date:   Mon Mar 16 16:00:58 2015 +0000

    drm/i915: Initialize all contexts

which quietly introduced the removal of the MI_RESTORE_INHIBIT on the
default context.

v2: Mark the global default context as uninitialized on GPU reset so
that the context-local workarounds are reloaded upon re-enabling.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Michel Thierry <michel.thierry@intel.com>
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1448630935-27377-1-git-send-email-chris@chris-wilson.co.uk
Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>
Cc: stable@vger.kernel.org
[danvet: This seems to fix a gpu hand on after the first resume,
resulting in any future suspend operation failing with -EIO because
the gpu seems to be in a funky state. Somehow this patch fixes that.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 42f1cae8c079bcceb3cff079fddc3ff8852c788f)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
8 years agodrm/i915: Tune down rpm wakelock debug checks
Daniel Vetter [Tue, 5 Jan 2016 16:54:07 +0000 (17:54 +0100)]
drm/i915: Tune down rpm wakelock debug checks

They're causing massive amounts of dmesg noise and hence CI noise all
over the place. Enabling them for a bit was good enough to refresh our
task list of what's still needed to enable rpm by default.

To make sure we're not forgetting to make this noisy again add a FIXME
comment.

Fixes: da5827c36607 ("drm/i915: add assert_rpm_wakelock_held helper")
Cc: Imre Deak <imre.deak@intel.com>
Cc: drm-intel-fixes@lists.freedesktop.org
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Acked-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/1452012847-4737-1-git-send-email-daniel.vetter@ffwll.ch
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
(cherry picked from commit becd9ca2de656ccd8d02c434742388aead336147)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
8 years agodrm/i915: Avoid writing relocs with addresses in non-canonical form
Michał Winiarski [Tue, 29 Dec 2015 17:24:52 +0000 (18:24 +0100)]
drm/i915: Avoid writing relocs with addresses in non-canonical form

According to PRM, some parts of HW require the addresses to be in
a canonical form, where bits [63:48] == [47]. Let's convert addresses to
canonical form prior to relocating and return converted offsets to
userspace. We also need to make sure that userspace is using addresses
in canonical form in case of softpin.

v2: Whitespace fixup, gen8_canonical_addr description (Chris, Ville)
v3: Rebase on top of softpin, fix a hole in relocate_entry,
    s/expect/require (Chris)
v4: Handle softpin in validate_exec_list (Chris)
v5: Convert back to canonical form at copy_to_user time (Chris)
v6: Don't use struct exec_object2 in place of exec_object
v7: Use sign_extend64 for converting to canonical form (Joonas),
    reject non-canonical and non-page-aligned offset for softpin (Chris)
v8: Convert back to non-canonical form in a function,
    split the test for EXEC_OBJECT_PINNED (Chris)
v9: s/canonial/canonical, drop accidental double newline (Chris)

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Michel Thierry <michel.thierry@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1451409892-13708-1-git-send-email-michal.winiarski@intel.com
Testcase: igt/gem_bad_reloc/negative-reloc-blt
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92699
Cc: drm-intel-fixes@lists.freedesktop.org
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 934acce3c069a3d8b14085957248444145d9ec1b)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
8 years agodrm/exynos: fix kernel panic issue at drm releasing
Inki Dae [Tue, 5 Jan 2016 10:50:31 +0000 (19:50 +0900)]
drm/exynos: fix kernel panic issue at drm releasing

This patch fixes a kernel panic issue which happened
when drm driver is closed while modetest.

This issue could be reproduced easily by launching modetest
with page flip repeatedly.

The reason is that invalid drm_file object could be accessed by
send_vblank_event function when finishing page flip if the drm_file
object was removed by drm_release and there was a pended page
flip event which was already committed to hardware.

So this patch makes the pended page flip event to be cancelled by
preclose callback which is called at front of drm_release function.

Changelog v2:
- free vblank event objects belonging to the request process,
  increment event space and decrease pending_update when cancelling
  the event

Signed-off-by: Inki Dae <inki.dae@samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Daniel Vetter <daniel@ffwll.ch>
8 years agodrm/exynos: crtc: do not wait for the scanout completion
Inki Dae [Thu, 24 Dec 2015 08:24:35 +0000 (17:24 +0900)]
drm/exynos: crtc: do not wait for the scanout completion

This patch removes exynos_drm_crtc_complete_scanout function call
which makes sure for overlay data to be updated to real hardware
when drm driver is released.

With atomic modeset support, it doesn't need the funtion anymore
because atomic modeset interface makes sure that.

Signed-off-by: Inki Dae <inki.dae@samsung.com>
8 years agodrm/exynos: mixer: properly update all planes on the same vblank event
Marek Szyprowski [Tue, 5 Jan 2016 12:52:52 +0000 (13:52 +0100)]
drm/exynos: mixer: properly update all planes on the same vblank event

This patch also moves mixer_vsync_set_update() to newly introduced
mixer_atomic_begin/flush callbacks. This ensures that all mixer planes
will be updated on the same vsync event.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
8 years agodrm/exynos: crtc: rework atomic_{begin,flush}
Marek Szyprowski [Tue, 5 Jan 2016 12:52:51 +0000 (13:52 +0100)]
drm/exynos: crtc: rework atomic_{begin,flush}

Some CRTC drivers (like Exynos DRM Mixer) can handle blocking register
updates only on per-device level, not per-plane level. This patch changes
exynos_crts atomic_begin/atomic_flush callbacks to handle the entire crtc,
instead of given planes, so driver can handle both cases on their own.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
8 years agodrm/exynos: mixer: unify a check for video-processor window
Marek Szyprowski [Wed, 16 Dec 2015 12:21:48 +0000 (13:21 +0100)]
drm/exynos: mixer: unify a check for video-processor window

Always use macro instead of hard-coded '2' value in conditions related
to video processor window. Additional checks are not needed, because
video layer is registered only when video processor is available.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
8 years agodrm/exynos: mixer: also allow ARGB1555 and ARGB4444
Tobias Jakobi [Wed, 16 Dec 2015 12:21:47 +0000 (13:21 +0100)]
drm/exynos: mixer: also allow ARGB1555 and ARGB4444

Allow the remaining alpha formats now that blending
is properly setup.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
8 years agodrm/exynos: mixer: refactor layer setup
Marek Szyprowski [Wed, 16 Dec 2015 12:21:46 +0000 (13:21 +0100)]
drm/exynos: mixer: refactor layer setup

Properly configure blending properties of given hardware layer based on
the selected pixel format. Currently only per-pixel-based alpha is possible
when respective pixel format has been selected. Configuration of global,
per-plane alpha value, color key and background color will be added later.

This patch is heavily inspired by earlier work done by Tobias Jakobi
<tjakobi@math.uni-bielefeld.de>.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
8 years agodrm/exynos: mixer: remove all static blending setup
Tobias Jakobi [Wed, 16 Dec 2015 12:21:45 +0000 (13:21 +0100)]
drm/exynos: mixer: remove all static blending setup

Previously blending setup was static and most of it was
done in mixer_win_reset().

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
8 years agodrm/exynos: mixer: set window priority based on zpos
Marek Szyprowski [Wed, 16 Dec 2015 12:21:44 +0000 (13:21 +0100)]
drm/exynos: mixer: set window priority based on zpos

'zpos' plane property is configurable, so adjust hardware layers
priority based on the zpos value. 'zpos' value shifted by one can be
used directly as hw priority value and stored to the registers, because
mixer accepts priority values from 1 to 15 (0 means that layer is
disabled).

This patch also changes the default layer priority to match already
exposed initial zpos values. The initial configuration is now:
[top] video > gfx layer1 > gfx layer0 [bottom].

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
8 years agodrm/exynos: make zpos property configurable
Marek Szyprowski [Wed, 16 Dec 2015 12:21:43 +0000 (13:21 +0100)]
drm/exynos: make zpos property configurable

This patch adds all infrastructure to make zpos plane property
configurable from userspace.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
8 years agodrm/exynos: rename zpos to index
Marek Szyprowski [Wed, 16 Dec 2015 12:21:42 +0000 (13:21 +0100)]
drm/exynos: rename zpos to index

This patch renames zpos entry to index, because in most places it is
used as index for selecting hardware layer/window instead of
configurable layer position. This will later enable to make the zpos
property configurable.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
8 years agodrm/amdgpu/powerplay: include asm/div64.h for do_div()
Stephen Rothwell [Thu, 31 Dec 2015 10:20:20 +0000 (21:20 +1100)]
drm/amdgpu/powerplay: include asm/div64.h for do_div()

Fixes: 1e4854e96c35 ("drm/amdgpu/powerplay: implement thermal control for tonga.")
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agoapple-gmux: Add initial documentation
Lukas Wunner [Sun, 10 Jan 2016 23:08:35 +0000 (00:08 +0100)]
apple-gmux: Add initial documentation

Document what I've learned so far about the gmux so that we can
collaboratively reverse-engineer its remaining unknown bits
without everyone having to start from scratch.

The DOC sections are bound together in the gpu.tmpl DocBook
under a new vga_switcheroo "Handlers" chapter. Eventually
this should be amended with documentation about the four other
handlers that exist so far (nouveau v1 DSM, nouveau Optimus DSM,
radeon ATPX, amdgpu ATPX).

Requires kernel-doc with asciidoc support.

The EFI variable was reverse-engineered by Bruno Bierbaumer
<bruno@bierbaumer.net> and Andreas Heider <andreas@meetr.de>.

Some of the remaining open questions:

* How are vblank intervals synchronized on retinas to achieve seamless
  switching? Is the DP mux capable of this? It's not mentioned in the
  data sheets. Or is it done at the OS level, i.e. do we have to
  synchronize vblank intervals between DRM drivers? There's a signal
  coming from the panel connector and going into gmux, could this be
  the vblank signal as received by the panel to properly time the
  switch?

* On retinas there's an I2C bus between gmux and the connector of the
  right I/O board, apparently leading to the Parade PS8401A HDMI
  repeater. What is this for, is it controlled via gmux registers?
  Data sheet:
  http://www.paradetech.com/products/jitter-cleaning-repeaters/ps8401/

* On retinas there's an I2C bus between gmux and the LED driver.
  Pre-retinas connected the LED driver to SMBUS. Are there additional
  gmux registers on retinas to control it?

* The MacPro6,1 2013 also has a gmux, the same Renesas R4F2113 as the
  retina MacBook Pro. The Mac Pro doesn't have a built-in display,
  so what is its purpose? Power control of the dual FirePro GPUs?
  Switching of the external DP/Thunderbolt ports? The iFixit teardown
  clearly shows one TI HD3SS212 DisplayPort mux on the logic board next
  to one of the three Thunderbolt controllers. However six muxes would
  be necessary to switch all six ports between GPUs. The mux is probably
  necessary for one of the display configurations allowed by Apple,
  but which one?
  https://www.ifixit.com/Teardown/Mac+Pro+Late+2013+Teardown/20778
  https://d3nevzfk7ii3be.cloudfront.net/igi/fELBTnt31QhnDsqq.huge
  https://support.apple.com/en-us/HT202801

* Registers we haven't decoded yet:
  0x700 32 Bit configmap?
  0x708 32 Bit power sequence?
  0x712  8 Bit status of clock from panel on retinas?
  0x713  8 Bit dito?
  0x724 16 Bit backlight, raw value?
  0x760 32 Bit backlight
  0x764 32 Bit backlight
  0x768  8 Bit backlight
  0x76a 16 Bit backlight
  0x76c 16 Bit backlight
  0x76e 16 Bit backlight
  0x77f        edp/dp/hdmi probe? retina only.

* Addition by Bruno Prémont <bonbons@linux-vserver.org>:
  "Missing is also precise knowledge as to what the gmux depends on.
  From behavioral reports, it is somehow sensitive to VGA IO/MEM
  routing (it apparently needs the routing to go to integrated GPU,
  not discrete GPU).
  When the routing is inappropriate backlight control IO just reads back
  as 0xFF (and eventually gmux IO in general does so)."

Signed-off-by: Lukas Wunner <lukas@wunner.de>
Acked-by: Darren Hart <dvhart@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/da309e436fbeac886477d80376457b7d83ea4b2d.1452431795.git.lukas@wunner.de
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
8 years agodrm/amdgpu: add irq domain support
Alex Deucher [Fri, 6 Nov 2015 06:29:08 +0000 (01:29 -0500)]
drm/amdgpu: add irq domain support

Hardware blocks on the GPU like ACP generate interrupts in
the GPU interrupt controller, but are driven by a separate
driver.  Add an irq domain to the GPU driver so that
blocks like ACP can register a Linux interrupt.

Acked-by: Dave Airlie <airlied@redhat.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu/cgs: add an interface to access PCI resources
Alex Deucher [Wed, 23 Dec 2015 16:25:43 +0000 (11:25 -0500)]
drm/amdgpu/cgs: add an interface to access PCI resources

This provides an interface to get access to the base address
of PCI resources (MMIO, DOORBELL, etc.).  Only MMIO and
DOORBELL are implemented right now.  This is necessary to
properly utilize shared drivers on platform devices.  IP
modules can use this interface to get the base address
of the resource and add any additional offset and set the
size when setting up the platform driver(s).

Acked-by: Dave Airlie <airlied@redhat.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agoMerge branch 'linux-4.5' of git://github.com/skeggsb/linux into drm-next
Dave Airlie [Mon, 11 Jan 2016 01:48:18 +0000 (11:48 +1000)]
Merge branch 'linux-4.5' of git://github.com/skeggsb/linux into drm-next

- gk20a instmem fixes / improvements
- more gm10x vs gm20x differences deal with
- better support for high-frequency hdmi modes
- pstate control interfaces moved to debugfs
- support for pcie link speed changes
- misc other fixes across the board

* 'linux-4.5' of git://github.com/skeggsb/linux: (50 commits)
  drm/nouveau/pmu: prevent falcon from acking interrupts routed to the host
  drm/nouveau/perf: change pcie speed on pstate change
  drm/nouveau/perf: add fields for pci speed and width and use it for the pstates
  drm/nouveau/bios/perf: parse the pci speed from the bios for tesla and newer cards
  drm/nouveau/pci: implement pcie speed change for kepler+
  drm/nouveau/pci: implement pcie speed change for Fermi
  drm/nouveau/pci: implement pcie speed change for tesla
  drm/nouveau/pci: implement generic code for pcie speed change
  drm/nouveau/pci: add gk104 variant
  drm/nouveau/pci: add gf106 variant
  drm/nouveau/kms: take mode_config mutex in connector hotplug path
  drm/nouveau/nouveau/perfmon: add interface files for current core voltage
  drm/nouveau/sysfs: remove pstate interface
  drm/nouveau/debugfs: add copy of sysfs pstate interface ported to debugfs
  drm/nouveau/debugfs: we need a ctrl object for debugfs
  drm/nouveau/debugfs: rename functions to indicate they are used inside drm
  drm/nouveau/debugfs: add infrastructure to add files with other fops than only read
  drm/nouveau/fifo/gf100: remove references to "daemon"
  drm/nouveau/fb/nv50: remove references to "daemon"
  drm/nouveau/clk: remove references to "daemon"
  ...

8 years agodrm/nouveau/pmu: prevent falcon from acking interrupts routed to the host
Ben Skeggs [Mon, 11 Jan 2016 00:29:08 +0000 (10:29 +1000)]
drm/nouveau/pmu: prevent falcon from acking interrupts routed to the host

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/perf: change pcie speed on pstate change
Karol Herbst [Tue, 15 Sep 2015 16:49:32 +0000 (18:49 +0200)]
drm/nouveau/perf: change pcie speed on pstate change

v2: remove error and only set link for pcie devices
v6: remove check for pcie device

Signed-off-by: Karol Herbst <nouveau@karolherbst.de>
8 years agodrm/nouveau/perf: add fields for pci speed and width and use it for the pstates
Karol Herbst [Tue, 15 Sep 2015 16:49:08 +0000 (18:49 +0200)]
drm/nouveau/perf: add fields for pci speed and width and use it for the pstates

Signed-off-by: Karol Herbst <nouveau@karolherbst.de>
8 years agodrm/nouveau/bios/perf: parse the pci speed from the bios for tesla and newer cards
Karol Herbst [Tue, 15 Sep 2015 16:47:12 +0000 (18:47 +0200)]
drm/nouveau/bios/perf: parse the pci speed from the bios for tesla and newer cards

Signed-off-by: Karol Herbst <nouveau@karolherbst.de>
8 years agodrm/nouveau/pci: implement pcie speed change for kepler+
Karol Herbst [Tue, 5 Jan 2016 20:44:52 +0000 (21:44 +0100)]
drm/nouveau/pci: implement pcie speed change for kepler+

v2: rename functions
v3: remove pcie2 accessors
v6: fix alignement and line width, also remove useless code

Signed-off-by: Karol Herbst <nouveau@karolherbst.de>
8 years agodrm/nouveau/pci: implement pcie speed change for Fermi
Karol Herbst [Tue, 5 Jan 2016 20:44:39 +0000 (21:44 +0100)]
drm/nouveau/pci: implement pcie speed change for Fermi

v5: don't set kepler func pointers
v6: fix alignment and line length

8 years agodrm/nouveau/pci: implement pcie speed change for tesla
Karol Herbst [Tue, 5 Jan 2016 20:44:18 +0000 (21:44 +0100)]
drm/nouveau/pci: implement pcie speed change for tesla

v5: don't set fermi or kepler func pointers
v6: fix alignment

8 years agodrm/nouveau/pci: implement generic code for pcie speed change
Karol Herbst [Tue, 15 Sep 2015 16:48:37 +0000 (18:48 +0200)]
drm/nouveau/pci: implement generic code for pcie speed change

v2: rename and group functions
v4: change copyright information
    move printing of pcie speeds into oneinit,
    rename all pcie functions to nvkm_pcie_*
    don't try to raise the pcie version when no higher one is supported
v5: revert Copyright changes and rename nvkm_pcie_raise_version to nvkm_pcie_set_version
v6: remove some useless pci_is_pcie checks and rework messages

Signed-off-by: Karol Herbst <nouveau@karolherbst.de>
8 years agodrm/nouveau/pci: add gk104 variant
Karol Herbst [Sun, 30 Aug 2015 18:06:16 +0000 (20:06 +0200)]
drm/nouveau/pci: add gk104 variant

v2: change email used in header
v4: change Copyright information
v5: revert Copyright changes

Signed-off-by: Karol Herbst <nouveau@karolherbst.de>
8 years agodrm/nouveau/pci: add gf106 variant
Karol Herbst [Sun, 27 Sep 2015 00:41:34 +0000 (02:41 +0200)]
drm/nouveau/pci: add gf106 variant

v2: change email used in header
v4: change Copyright information
v5: revert Copyright changes

Signed-off-by: Karol Herbst <nouveau@karolherbst.de>
8 years agodrm/nouveau/kms: take mode_config mutex in connector hotplug path
Ben Skeggs [Thu, 7 Jan 2016 22:56:51 +0000 (08:56 +1000)]
drm/nouveau/kms: take mode_config mutex in connector hotplug path

fdo#93634

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Cc: stable@vger.kernel.org
8 years agodrm/nouveau/nouveau/perfmon: add interface files for current core voltage
Karol Herbst [Sun, 20 Sep 2015 12:40:27 +0000 (14:40 +0200)]
drm/nouveau/nouveau/perfmon: add interface files for current core voltage

Signed-off-by: Karol Herbst <nouveau@karolherbst.de>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/sysfs: remove pstate interface
Karol Herbst [Thu, 30 Jul 2015 09:56:20 +0000 (11:56 +0200)]
drm/nouveau/sysfs: remove pstate interface

Signed-off-by: Karol Herbst <nouveau@karolherbst.de>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/debugfs: add copy of sysfs pstate interface ported to debugfs
Karol Herbst [Thu, 30 Jul 2015 09:53:31 +0000 (11:53 +0200)]
drm/nouveau/debugfs: add copy of sysfs pstate interface ported to debugfs

Signed-off-by: Karol Herbst <nouveau@karolherbst.de>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/debugfs: we need a ctrl object for debugfs
Karol Herbst [Thu, 30 Jul 2015 09:52:23 +0000 (11:52 +0200)]
drm/nouveau/debugfs: we need a ctrl object for debugfs

Signed-off-by: Karol Herbst <nouveau@karolherbst.de>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/debugfs: rename functions to indicate they are used inside drm
Karol Herbst [Thu, 30 Jul 2015 22:35:42 +0000 (00:35 +0200)]
drm/nouveau/debugfs: rename functions to indicate they are used inside drm

We will need our own debugfs_init and cleanup functions, because
nouveau_drm isn't ready while the DRM ones are called by DRM.

Signed-off-by: Karol Herbst <nouveau@karolherbst.de>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/debugfs: add infrastructure to add files with other fops than only read
Karol Herbst [Wed, 29 Jul 2015 11:44:21 +0000 (13:44 +0200)]
drm/nouveau/debugfs: add infrastructure to add files with other fops than only read

v2: use the same object for private data as with the drm debugfs functions

Signed-off-by: Karol Herbst <nouveau@karolherbst.de>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/fifo/gf100: remove references to "daemon"
Ben Skeggs [Mon, 4 Jan 2016 02:24:46 +0000 (12:24 +1000)]
drm/nouveau/fifo/gf100: remove references to "daemon"

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/fb/nv50: remove references to "daemon"
Ben Skeggs [Mon, 4 Jan 2016 02:22:54 +0000 (12:22 +1000)]
drm/nouveau/fb/nv50: remove references to "daemon"

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/clk: remove references to "daemon"
Ben Skeggs [Mon, 4 Jan 2016 02:17:52 +0000 (12:17 +1000)]
drm/nouveau/clk: remove references to "daemon"

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/gr/gf100: provide a bit more info for various errors
Ilia Mirkin [Sat, 2 Jan 2016 22:54:51 +0000 (17:54 -0500)]
drm/nouveau/gr/gf100: provide a bit more info for various errors

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/bios: parse 8.1 Gbps DP link rate
Ben Skeggs [Sun, 20 Dec 2015 23:27:49 +0000 (09:27 +1000)]
drm/nouveau/bios: parse 8.1 Gbps DP link rate

From DCB 4.1 spec.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/ltc/gm204: split implementation from gm107
Ben Skeggs [Sat, 19 Dec 2015 06:48:34 +0000 (16:48 +1000)]
drm/nouveau/ltc/gm204: split implementation from gm107

Differences from GM10x:
- GM20x LTC count detection differs from GM10x
- GM20x init doesn't require large page size setting

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/ltc/gm107: use nvkm_mask to set cbc_ctrl1
Ben Skeggs [Sat, 19 Dec 2015 06:42:22 +0000 (16:42 +1000)]
drm/nouveau/ltc/gm107: use nvkm_mask to set cbc_ctrl1

resman and nvgpu both do this, presumably for good reason.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/ibus/gm204: split implementation from gk104
Ben Skeggs [Sat, 19 Dec 2015 06:24:10 +0000 (16:24 +1000)]
drm/nouveau/ibus/gm204: split implementation from gk104

GM20x doesn't require the priv ring timeout bumps that GK/GM10x have.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/gr/gf100-: subclass nvkm_object to store channel pointer
Ben Skeggs [Tue, 15 Dec 2015 09:22:49 +0000 (19:22 +1000)]
drm/nouveau/gr/gf100-: subclass nvkm_object to store channel pointer

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/nvif: modify nvif_unvers/nvif_unpack macros to be more obvious
Ben Skeggs [Sun, 8 Nov 2015 23:21:27 +0000 (09:21 +1000)]
drm/nouveau/nvif: modify nvif_unvers/nvif_unpack macros to be more obvious

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/nvif: split out client interface definitions
Ben Skeggs [Sun, 8 Nov 2015 02:26:01 +0000 (12:26 +1000)]
drm/nouveau/nvif: split out client interface definitions

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/nvif: split out device interface definitions
Ben Skeggs [Sun, 8 Nov 2015 02:23:16 +0000 (12:23 +1000)]
drm/nouveau/nvif: split out device interface definitions

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/nvif: split out ctxdma interface definitions
Ben Skeggs [Sun, 8 Nov 2015 02:16:40 +0000 (12:16 +1000)]
drm/nouveau/nvif: split out ctxdma interface definitions

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/nvif: split out perfmon interface definitions
Ben Skeggs [Sun, 8 Nov 2015 02:12:15 +0000 (12:12 +1000)]
drm/nouveau/nvif: split out perfmon interface definitions

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/nvif: split out device control interface definitions
Ben Skeggs [Sun, 8 Nov 2015 01:56:00 +0000 (11:56 +1000)]
drm/nouveau/nvif: split out device control interface definitions

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>