sfrench/cifs-2.6.git
7 years agodrm/radeon: Prevent races on pre DCE4 between flip submission and completion.
Mario Kleiner [Sat, 17 Sep 2016 12:25:39 +0000 (14:25 +0200)]
drm/radeon: Prevent races on pre DCE4 between flip submission and completion.

Pre DCE4 hw doesn't have reliable pageflip completion
interrupts, so instead polling for flip completion is
used from within the vblank irq handler to complete
page flips.

This causes a race if pageflip ioctl is called close to
vblank:

1. pageflip ioctl queues execution of radeon_flip_work_func.

2. vblank irq fires, radeon_crtc_handle_vblank checks for
   flip_status == FLIP_SUBMITTED finds none, no-ops.

3. radeon_flip_work_func runs inside vblank, decides to
   set flip_status == FLIP_SUBMITTED and programs the
   flip into hw.

4. hw executes flip immediately (because in vblank), but
   as 2 already happened, the flip completion routine only
   emits the flip completion event one refresh later ->
   wrong vblank count/timestamp for completion and no
   performance gain, as instead of delaying the flip until
   next vblank, we now delay the next flip by 1 refresh
   while waiting for the delayed flip completion event.

Given we often don't gain anything due to this race, but
lose precision, prevent the programmed flip from executing
in vblank on pre DCE4 asics to avoid this race.

On pre-AVIVO hw we can't program the hw for edge-triggered
flips, they always execute anywhere in vblank. Therefore delay
the actual flip programming until after vblank on pre-AVIVO.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/radeon: Slightly more robust flip completion handling for < DCE-4
Mario Kleiner [Sat, 17 Sep 2016 12:25:38 +0000 (14:25 +0200)]
drm/radeon: Slightly more robust flip completion handling for < DCE-4

Pre DCE4 hardware doesn't have (reliable) pageflip completion
irqs, therefore we have to use the old polling method for flip
completion handling in vblank irq.

As vblank irqs fire a bit before start of vblank (when the
linebuffer fifo read position reaches end of scanout), we
have some fudge for flip completion handling in the last
lines of active scanout. Old code assumed the threshold to
be 99% of active scanout height, a ballpark estimate which
worked ok. Since we know since a while how to calculate the
actual threshold from linebuffer size, lets make use of it
to get a more accurate threshold.

This completion path is still prone to some races in corner
cases, especially on pre-AVIVO hardware, so document them
a bit better in the code comments.

Acked-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm: virtio: reinstate drm_virtio_set_busid()
Laszlo Ersek [Mon, 3 Oct 2016 17:43:03 +0000 (19:43 +0200)]
drm: virtio: reinstate drm_virtio_set_busid()

Before commit a325725633c2 ("drm: Lobotomize set_busid nonsense for !pci
drivers"), several DRM drivers for platform devices used to expose an
explicit "drm_driver.set_busid" callback, invariably backed by
drm_platform_set_busid().

Commit a325725633c2 removed drm_platform_set_busid(), along with the
referring .set_busid field initializations. This was justified because
interchangeable functionality had been implemented in drm_dev_alloc() /
drm_dev_init(), which DRM_IOCTL_SET_VERSION would rely on going forward.

However, commit a325725633c2 also removed drm_virtio_set_busid(), for
which the same consolidation was not appropriate: this .set_busid callback
had been implemented with drm_pci_set_busid(), and not
drm_platform_set_busid(). The error regressed Xorg/xserver on QEMU's
"virtio-vga" card; the drmGetBusid() function from libdrm would no longer
return stable PCI identifiers like "pci:0000:00:02.0", but rather unstable
platform ones like "virtio0".

Reinstate drm_virtio_set_busid() with judicious use of

  git checkout -p a325725633c2^ -- drivers/gpu/drm/virtio

Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Emil Velikov <emil.l.velikov@gmail.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Joachim Frieben <jfrieben@hotmail.com>
Cc: stable@vger.kernel.org # v4.8
Reported-by: Joachim Frieben <jfrieben@hotmail.com>
Fixes: a325725633c26aa66ab940f762a6b0778edf76c0
Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1366842
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agodrm: Undo damage to page_flip_ioctl
Daniel Vetter [Mon, 3 Oct 2016 08:28:27 +0000 (10:28 +0200)]
drm: Undo damage to page_flip_ioctl

I screwed up rebasing of my patch in

commit 43968d7b806d7a7e021261294c583a216fddf0e5
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Wed Sep 21 10:59:24 2016 +0200

    drm: Extract drm_plane.[hc]

which meant on error paths drm_crtc_vblank_put could be called without
a get, leading to an underrun of the refcount.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98020
Reported-and-tested-by: Andy Furniss <adf.lists@gmail.com>
Cc: Sean Paul <seanpaul@chromium.org>
Cc: Michel Dänzer <michel@daenzer.net>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20161003082827.11586-1-daniel.vetter@ffwll.ch
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agodrm: Restore lost drm_framebuffer_unreference in drm_mode_page_flip_ioctl
Chris Wilson [Wed, 28 Sep 2016 22:25:00 +0000 (23:25 +0100)]
drm: Restore lost drm_framebuffer_unreference in drm_mode_page_flip_ioctl

Commit 43968d7b806d ("drm: Extract drm_plane.[hc]") was not the simple
cut'n'paste we presumed, somehow it introduced a leak of the page flip
target's framebuffer.

Fixes: 43968d7b806d ("drm: Extract drm_plane.[hc]")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20160928222500.11827-1-chris@chris-wilson.co.uk
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoMerge branch 'exynos-drm-next' of git://git.kernel.org/pub/scm/linux/kernel/git/daein...
Dave Airlie [Tue, 4 Oct 2016 02:43:31 +0000 (12:43 +1000)]
Merge branch 'exynos-drm-next' of git://git./linux/kernel/git/daeinki/drm-exynos into drm-next

This pull request includes,
    - Code refactoring on HDMI DDC and PHY.
    - Regression fixup on deadlock issue with G2D pm integration.
    - Fixup on page fault issue with wait_for_vblank mechianism specific to Exynos drm.
    - And some cleanups.

* 'exynos-drm-next' of git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos:
  drm/exynos: g2d: simplify g2d_free_runqueue_node()
  drm/exynos: g2d: use autosuspend mode for PM runtime
  drm/exynos: g2d: wait for engine to finish
  drm/exynos: g2d: remove runqueue nodes in g2d_{close,remove}()
  drm/exynos: g2d: move PM management to runqueue worker
  Revert "drm/exynos: g2d: fix system and runtime pm integration"
  drm/exynos: use drm core to handle page-flip event
  drm/exynos: mark exynos_dp_crtc_clock_enable() static
  drm/exynos/fimd: add clock rate checking
  drm/exynos: fix pending update handling
  drm/exynos/vidi: use timer for vblanks instead of sleeping worker
  drm/exynos: g2d: beautify probing message
  drm/exynos: mixer: simplify loop in vp_win_reset()
  drm/exynos: mixer: convert booleans to flags in mixer context
  gpu: drm: exynos_hdmi: Remove duplicate initialization of regulator bulk consumer
  gpu: drm: exynos_hdmi: Move PHY logic into single function
  gpu: drm: exynos_hdmi: Move DDC logic into single function

7 years agodrm/exynos: g2d: simplify g2d_free_runqueue_node()
Tobias Jakobi [Tue, 27 Sep 2016 15:59:57 +0000 (17:59 +0200)]
drm/exynos: g2d: simplify g2d_free_runqueue_node()

The function is never called with zero 'runqueue_node'.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
7 years agodrm/exynos: g2d: use autosuspend mode for PM runtime
Tobias Jakobi [Tue, 27 Sep 2016 15:59:56 +0000 (17:59 +0200)]
drm/exynos: g2d: use autosuspend mode for PM runtime

The runqueue worker currently issues a get() when a new
node is processed, and a put() once a node is completed.

The corresponding suspend and resume calls currently only
do clock gating, but with the upcoming introduction of
IOMMU runpm also the corresponding IOMMU domain gets
enabled (for get()) and disabled (for put()). This
introduces performance regressions with we mitigate here.

Switch PM runtime to autosuspend, such that clock gating
and IOMMU control only happens when the engine is idle for
a 'long' time.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
7 years agodrm/exynos: g2d: wait for engine to finish
Tobias Jakobi [Tue, 27 Sep 2016 15:50:09 +0000 (17:50 +0200)]
drm/exynos: g2d: wait for engine to finish

While the engine works on a runqueue node it does memory access to
the buffers associated with that node.
Make sure that the engine is idle when g2d_close() and/or
g2d_remove() are called, i.e. buffer associated with the process (for
g2d_close()), or all buffers (for g2d_remove()) can be safely be
unmapped.

We have to take into account that the engine might be in an undefined
state, i.e. it hangs and doesn't become idle. In this case, we issue
a hardware reset to return the hardware and the driver context into a
proper state.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
7 years agodrm/exynos: g2d: remove runqueue nodes in g2d_{close,remove}()
Tobias Jakobi [Tue, 27 Sep 2016 15:50:08 +0000 (17:50 +0200)]
drm/exynos: g2d: remove runqueue nodes in g2d_{close,remove}()

The driver might be closed (and/or removed) while there are still
nodes queued for processing.
Make sure to remove these nodes, which means all of them in
the case of g2d_remove() and only those belonging to the
corresponding process in g2d_close().

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
7 years agodrm/exynos: g2d: move PM management to runqueue worker
Tobias Jakobi [Tue, 27 Sep 2016 15:50:07 +0000 (17:50 +0200)]
drm/exynos: g2d: move PM management to runqueue worker

Do all pm_runtime_{get,put}() calls in the runqueue worker.
Also keep track of the engine's idle/busy state.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
7 years agoRevert "drm/exynos: g2d: fix system and runtime pm integration"
Tobias Jakobi [Tue, 27 Sep 2016 15:50:06 +0000 (17:50 +0200)]
Revert "drm/exynos: g2d: fix system and runtime pm integration"

This reverts commit b05984e21a7e000bf5074ace00d7a574944b2c16.

The change, i.e. merging the sleep and runpm operations, produces
a deadlock situation:
(1) exynos_g2d_exec_ioctl() prepares a runqueue node and
    calls g2d_exec_runqueue()
(2) g2d_exec_runqueue() calls g2d_dma_start() which gets
    runtime PM sync
(3) runtime PM core calls g2d_runtime_resume()
(4) g2d_runtime_resume() calls g2d_exec_runqueue(), which
    loops back to (2)

Due to mutexes that are in place, a deadlock situation is created.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
7 years agodrm/exynos: use drm core to handle page-flip event
Andrzej Hajda [Fri, 23 Sep 2016 13:21:38 +0000 (15:21 +0200)]
drm/exynos: use drm core to handle page-flip event

Exynos DRM framework handled page-flip event with custom code.
The patch replaces it with drm-core vblank queue.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
7 years agodrm/exynos: mark exynos_dp_crtc_clock_enable() static
Baoyou Xie [Sun, 25 Sep 2016 07:54:59 +0000 (15:54 +0800)]
drm/exynos: mark exynos_dp_crtc_clock_enable() static

We get 1 warning when building kernel with W=1:
drivers/gpu/drm/exynos/exynos_dp.c:46:5: warning: no previous prototype for 'exynos_dp_crtc_clock_enable' [-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>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
7 years agodrm/exynos/fimd: add clock rate checking
Andrzej Hajda [Fri, 23 Sep 2016 10:43:29 +0000 (12:43 +0200)]
drm/exynos/fimd: add clock rate checking

In case of some platforms fimd clocks can be configured to
very low values, as a result refresh rate can be very low and
driver/drm-core will timeout waiting for vblanks, it will result
in premature removal of framebuffers and will cause oopses.
The patch adds atomic_check callback to fimd to prevent setting
such modes.

Reported-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
7 years agodrm/exynos: fix pending update handling
Andrzej Hajda [Mon, 26 Sep 2016 07:50:21 +0000 (16:50 +0900)]
drm/exynos: fix pending update handling

Exynos DRM devices update their registers at vblank time. Exynos-DRM uses
custom mechanism to wait for vblank. This mechanism is error prone -
variables are not updated atomically. As a result in certain circumstances
user space can try to free buffers which are still in use by hardware,
in such cases IOMMU can throw OOPS.
The patch instead of fixing the mechanism replaces it with drm core helper.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
7 years agodrm/exynos/vidi: use timer for vblanks instead of sleeping worker
Andrzej Hajda [Fri, 23 Sep 2016 08:15:23 +0000 (10:15 +0200)]
drm/exynos/vidi: use timer for vblanks instead of sleeping worker

VIDI driver uses fake vblank handler to generate vblank events.
It was implemented using worker which slept for vblank time, additionally
it did not work if there were no page flips. The patch replaces it with
timer, uses drm_crtc_vblank_(on|off) helpers to manage it and fixes
behavior for non-page-flip cases.
This change allows further improvements of vblank in exynos-drm framework.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
7 years agodrm/exynos: g2d: beautify probing message
Tobias Jakobi [Thu, 22 Sep 2016 14:57:20 +0000 (16:57 +0200)]
drm/exynos: g2d: beautify probing message

Apply some 'make-up' in g2d_probe().

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
7 years agodrm/exynos: mixer: simplify loop in vp_win_reset()
Tobias Jakobi [Thu, 22 Sep 2016 14:57:19 +0000 (16:57 +0200)]
drm/exynos: mixer: simplify loop in vp_win_reset()

A simple while loop should do the same here.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
7 years agodrm/exynos: mixer: convert booleans to flags in mixer context
Tobias Jakobi [Thu, 22 Sep 2016 02:36:13 +0000 (11:36 +0900)]
drm/exynos: mixer: convert booleans to flags in mixer context

The mixer context struct already has a 'flags' field, so
we can use it to store the 'interlace', 'vp_enabled' and
'has_sclk' booleans.
We use the non-atomic helper functions to access these bits.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
7 years agogpu: drm: exynos_hdmi: Remove duplicate initialization of regulator bulk consumer
Milo Kim [Wed, 31 Aug 2016 06:14:27 +0000 (15:14 +0900)]
gpu: drm: exynos_hdmi: Remove duplicate initialization of regulator bulk consumer

The helper, devm_regulator_bulk_get() initializes the consumer as NULL,
so this code can be ignored.

Signed-off-by: Milo Kim <woogyom.kim@gmail.com>
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
7 years agogpu: drm: exynos_hdmi: Move PHY logic into single function
Milo Kim [Wed, 31 Aug 2016 06:14:26 +0000 (15:14 +0900)]
gpu: drm: exynos_hdmi: Move PHY logic into single function

Paring DT properties and getting PHY IO (memory mapped or I2C) in one
function.

Signed-off-by: Milo Kim <woogyom.kim@gmail.com>
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
7 years agogpu: drm: exynos_hdmi: Move DDC logic into single function
Milo Kim [Wed, 31 Aug 2016 06:14:25 +0000 (15:14 +0900)]
gpu: drm: exynos_hdmi: Move DDC logic into single function

Paring DT properties and getting the I2C adapter in one function.

Signed-off-by: Milo Kim <woogyom.kim@gmail.com>
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
7 years agoMerge branch 'drm-next-4.9' of git://people.freedesktop.org/~agd5f/linux into drm...
Dave Airlie [Fri, 30 Sep 2016 03:18:26 +0000 (13:18 +1000)]
Merge branch 'drm-next-4.9' of git://people.freedesktop.org/~agd5f/linux into drm-next

Some additional fixes for 4.9:
- The rest of Christian's GTT rework which fixes a long standing bug
  in the GPUVM code among other things
- Changes to the pci shutdown callbacks for certain hypervisors
- Fix hpd interrupt storms on eDP panels which have the hpd interrupt
  enabled by the bios
- misc cleanups and bug fixes

* 'drm-next-4.9' of git://people.freedesktop.org/~agd5f/linux: (33 commits)
  drm/radeon: always apply pci shutdown callbacks
  drm/amdgpu: always apply pci shutdown callbacks (v2)
  drm/amdgpu: improve VM PTE trace points
  drm/amdgpu: fix GART_DEBUGFS define
  drm/amdgpu: free userptrs even if GTT isn't bound
  drm/amd/amdgpu: Various cleanups for DCEv6
  drm/amdgpu: fix BO move offsets
  drm/amdgpu: fix amdgpu_move_blit on 32bit systems
  drm/amdgpu: fix gtt_mgr bo's offset
  drm/amdgpu: fix initializing the VM BO shadow
  drm/amdgpu: fix initializing the VM last eviction counter
  drm/amdgpu: cleanup VM shadow BO unreferencing
  drm/amdgpu: allocate GTT space for shadow VM page tables
  drm/amdgpu: rename all rbo variable to abo v2
  drm/amdgpu: remove unused member from struct amdgpu_bo
  drm/amdgpu: add a custom GTT memory manager v2
  drm/amdgpu/dce6: disable hpd on local panels
  drm/amdgpu/dce8: disable hpd on local panels
  drm/amdgpu/dce11: disable hpd on local panels
  drm/amdgpu/dce10: disable hpd on local panels
  ...

7 years agoMerge tag 'drm/tegra/for-4.9-rc1' of git://anongit.freedesktop.org/tegra/linux into...
Dave Airlie [Fri, 30 Sep 2016 03:00:36 +0000 (13:00 +1000)]
Merge tag 'drm/tegra/for-4.9-rc1' of git://anongit.freedesktop.org/tegra/linux into drm-next

drm/tegra: Changes for v4.9-rc1

One bugfix that avoids overwriting the Y plane base address when
displaying buffers with one of the YUV/YVU formats.

* tag 'drm/tegra/for-4.9-rc1' of git://anongit.freedesktop.org/tegra/linux:
  drm/tegra: Fix window[0] base address corruption

7 years agoMerge tag 'drm/panel/for-4.9-rc1' of git://anongit.freedesktop.org/tegra/linux into...
Dave Airlie [Fri, 30 Sep 2016 02:56:31 +0000 (12:56 +1000)]
Merge tag 'drm/panel/for-4.9-rc1' of git://anongit.freedesktop.org/tegra/linux into drm-next

drm/panel: Changes for v4.9-rc1

Adds support for one more panel to the simple-panel driver, fixes up a
couple of delays and flags for existing panels and finally adds a new
driver for the DSI panel found on Nexus 7 devices.

* tag 'drm/panel/for-4.9-rc1' of git://anongit.freedesktop.org/tegra/linux:
  drm/panel: Add JDI LT070ME05000 WUXGA DSI Panel
  dt-bindings: Add JDI LT070ME05000 panel bindings
  drm/panel: simple: Fix bus_format for the Olimex LCD-OLinuXino-4.3TS
  drm/panel: simple-panel: Add delay timings for Starry KR122EA0SRA
  drm/panel: simple: Fix bus flags for Ortustech com43h4m85ulc
  drm/panel: simple: Add Innolux G101ICE-L01 panel
  drm/panel: simple: Add delay timing for Sharp LQ123P1JX31
  drm/dsi: Implement DCS set/get display brightness
  drm/dsi: Order DCS helpers by command code

7 years agodrm/radeon: always apply pci shutdown callbacks
Alex Deucher [Thu, 22 Sep 2016 18:43:50 +0000 (14:43 -0400)]
drm/radeon: always apply pci shutdown callbacks

We can't properly detect all hypervisors and we
need this to properly tear down the hardware.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: always apply pci shutdown callbacks (v2)
Alex Deucher [Thu, 22 Sep 2016 18:40:29 +0000 (14:40 -0400)]
drm/amdgpu: always apply pci shutdown callbacks (v2)

We can't properly detect all hypervisors and we
need this to properly tear down the hardware.

v2: trivial warning fix

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: improve VM PTE trace points
Christian König [Sun, 25 Sep 2016 14:11:52 +0000 (16:11 +0200)]
drm/amdgpu: improve VM PTE trace points

Use a separate one for the copy operation and
log all the interesting parameters.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: fix GART_DEBUGFS define
Christian König [Sun, 25 Sep 2016 14:10:06 +0000 (16:10 +0200)]
drm/amdgpu: fix GART_DEBUGFS define

Obviously missed during the rename.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: free userptrs even if GTT isn't bound
Christian König [Thu, 22 Sep 2016 12:19:50 +0000 (14:19 +0200)]
drm/amdgpu: free userptrs even if GTT isn't bound

This fixes a memory leak since binding GTT only on demand.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/amdgpu: Various cleanups for DCEv6
Tom St Denis [Thu, 22 Sep 2016 16:29:40 +0000 (12:29 -0400)]
drm/amd/amdgpu: Various cleanups for DCEv6

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: fix BO move offsets
Christian König [Wed, 21 Sep 2016 07:38:14 +0000 (09:38 +0200)]
drm/amdgpu: fix BO move offsets

It's pretty pointless to get the offset first and then initialize it.

Should fix issues with the new GTT manager.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: fix amdgpu_move_blit on 32bit systems
Christian König [Wed, 17 Aug 2016 07:45:25 +0000 (09:45 +0200)]
drm/amdgpu: fix amdgpu_move_blit on 32bit systems

This bug seems to be present for a very long time.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
7 years agodrm/amdgpu: fix gtt_mgr bo's offset
Flora Cui [Tue, 20 Sep 2016 09:07:31 +0000 (17:07 +0800)]
drm/amdgpu: fix gtt_mgr bo's offset

Signed-off-by: Flora Cui <Flora.Cui@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: fix initializing the VM BO shadow
Christian König [Fri, 16 Sep 2016 12:07:46 +0000 (14:07 +0200)]
drm/amdgpu: fix initializing the VM BO shadow

We need to clear the shadows as well.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: fix initializing the VM last eviction counter
Christian König [Fri, 16 Sep 2016 11:11:45 +0000 (13:11 +0200)]
drm/amdgpu: fix initializing the VM last eviction counter

Close a very small window where something can go wrong.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: cleanup VM shadow BO unreferencing
Christian König [Fri, 16 Sep 2016 11:06:09 +0000 (13:06 +0200)]
drm/amdgpu: cleanup VM shadow BO unreferencing

Unreference the shadow BOs in the error path as well and drop the NULL checks.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: allocate GTT space for shadow VM page tables
Christian König [Fri, 16 Sep 2016 09:46:23 +0000 (11:46 +0200)]
drm/amdgpu: allocate GTT space for shadow VM page tables

We need to access those with the system domain.

Fixes fallout from only allocating GTT space on demand.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: rename all rbo variable to abo v2
Christian König [Thu, 15 Sep 2016 13:06:50 +0000 (15:06 +0200)]
drm/amdgpu: rename all rbo variable to abo v2

Just to cleanup some radeon leftovers.

sed -i "s/rbo/abo/g" drivers/gpu/drm/amd/amdgpu/*.c
sed -i "s/rbo/abo/g" drivers/gpu/drm/amd/amdgpu/*.h

v2: rebased

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: remove unused member from struct amdgpu_bo
Christian König [Thu, 15 Sep 2016 12:10:48 +0000 (14:10 +0200)]
drm/amdgpu: remove unused member from struct amdgpu_bo

Not used in a while.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: add a custom GTT memory manager v2
Christian König [Fri, 9 Sep 2016 14:32:33 +0000 (16:32 +0200)]
drm/amdgpu: add a custom GTT memory manager v2

Only allocate address space when we really need it.

v2: fix a typo, add correct function description,
    stop leaking the node in the error case.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu/dce6: disable hpd on local panels
Alex Deucher [Wed, 28 Sep 2016 16:44:59 +0000 (12:44 -0400)]
drm/amdgpu/dce6: disable hpd on local panels

Otherwise we can get a hotplug interrupt storm when
we turn the panel off if hpd interrupts were enabled
by the bios.

bug:
https://bugs.freedesktop.org/show_bug.cgi?id=97471

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu/dce8: disable hpd on local panels
Alex Deucher [Wed, 28 Sep 2016 16:44:20 +0000 (12:44 -0400)]
drm/amdgpu/dce8: disable hpd on local panels

Otherwise we can get a hotplug interrupt storm when
we turn the panel off if hpd interrupts were enabled
by the bios.

bug:
https://bugs.freedesktop.org/show_bug.cgi?id=97471

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
7 years agodrm/amdgpu/dce11: disable hpd on local panels
Alex Deucher [Wed, 28 Sep 2016 16:43:33 +0000 (12:43 -0400)]
drm/amdgpu/dce11: disable hpd on local panels

Otherwise we can get a hotplug interrupt storm when
we turn the panel off if hpd interrupts were enabled
by the bios.

bug:
https://bugs.freedesktop.org/show_bug.cgi?id=97471

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
7 years agodrm/amdgpu/dce10: disable hpd on local panels
Alex Deucher [Wed, 28 Sep 2016 16:41:50 +0000 (12:41 -0400)]
drm/amdgpu/dce10: disable hpd on local panels

Otherwise we can get a hotplug interrupt storm when
we turn the panel off if hpd interrupts were enabled
by the bios.

bug:
https://bugs.freedesktop.org/show_bug.cgi?id=97471

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
7 years agodrm/amdgpu/si/dpm: fix phase shedding setup
Alex Deucher [Tue, 27 Sep 2016 18:57:35 +0000 (14:57 -0400)]
drm/amdgpu/si/dpm: fix phase shedding setup

Used the wrong index to setup the phase shedding mask.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/radeon/si/dpm: fix phase shedding setup
Alex Deucher [Tue, 27 Sep 2016 18:51:53 +0000 (14:51 -0400)]
drm/radeon/si/dpm: fix phase shedding setup

Used the wrong index to setup the phase shedding mask.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
7 years agodrm/amdgpu/si/dpm: sync up quirks from radeon
Alex Deucher [Mon, 26 Sep 2016 19:36:19 +0000 (15:36 -0400)]
drm/amdgpu/si/dpm: sync up quirks from radeon

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agoMerge tag 'drm-qemu-20160921' of git://git.kraxel.org/linux into drm-next
Dave Airlie [Wed, 28 Sep 2016 03:23:07 +0000 (13:23 +1000)]
Merge tag 'drm-qemu-20160921' of git://git.kraxel.org/linux into drm-next

bugfixes for qemu (bochs, qxl and virtio-gpu) drm drivers

* tag 'drm-qemu-20160921' of git://git.kraxel.org/linux:
  drm/virtio: add real fence context and seqno
  drm/virtio: drop virtio_gpu_execbuffer_ioctl() wrapping
  virtio-gpu: avoid possible NULL pointer dereference
  drm/qxl: reapply cursor after SetCrtc calls
  bochs: ignore device if there isn't enougth memory

7 years agoMerge tag 'v4.8-rc8' into drm-next
Dave Airlie [Wed, 28 Sep 2016 02:08:49 +0000 (12:08 +1000)]
Merge tag 'v4.8-rc8' into drm-next

Linux 4.8-rc8

There was a lot of fallout in the imx/amdgpu/i915 drivers, so backmerge
it now to avoid troubles.

* tag 'v4.8-rc8': (1442 commits)
  Linux 4.8-rc8
  fault_in_multipages_readable() throws set-but-unused error
  mm: check VMA flags to avoid invalid PROT_NONE NUMA balancing
  radix tree: fix sibling entry handling in radix_tree_descend()
  radix tree test suite: Test radix_tree_replace_slot() for multiorder entries
  fix memory leaks in tracing_buffers_splice_read()
  tracing: Move mutex to protect against resetting of seq data
  MIPS: Fix delay slot emulation count in debugfs
  MIPS: SMP: Fix possibility of deadlock when bringing CPUs online
  mm: delete unnecessary and unsafe init_tlb_ubc()
  huge tmpfs: fix Committed_AS leak
  shmem: fix tmpfs to handle the huge= option properly
  blk-mq: skip unmapped queues in blk_mq_alloc_request_hctx
  MIPS: Fix pre-r6 emulation FPU initialisation
  arm64: kgdb: handle read-only text / modules
  arm64: Call numa_store_cpu_info() earlier.
  locking/hung_task: Fix typo in CONFIG_DETECT_HUNG_TASK help text
  nvme-rdma: only clear queue flags after successful connect
  i2c: qup: skip qup_i2c_suspend if the device is already runtime suspended
  perf/core: Limit matching exclusive events to one PMU
  ...

7 years agoMerge branch 'drm-next-4.9' of git://people.freedesktop.org/~agd5f/linux into drm...
Dave Airlie [Wed, 28 Sep 2016 01:27:05 +0000 (11:27 +1000)]
Merge branch 'drm-next-4.9' of git://people.freedesktop.org/~agd5f/linux into drm-next

Last set of radeon and amdgpu changes for 4.9.  This is
mostly just the powerplay cleanup for dGPUs.  Beyond that,
just misc code cleanups and bug fixes.

* 'drm-next-4.9' of git://people.freedesktop.org/~agd5f/linux: (49 commits)
  drm/amd/amdgpu: Clean up afmt allocation in DCEv6. (v2)
  drm/amd/amdgpu: Remove division from vblank_wait
  drm/radeon/atif: Send a hotplug event when we get dgpu display request
  drm/radeon/atpx: check for ATIF dGPU wake for display events support
  drm/amdgpu/atif: Send a hotplug event when we get dgpu display request
  drm/amdgpu/atpx: check for ATIF dGPU wake for display events support
  drm/amdgpu: bump version for new vce packet support
  drm/amdgpu/vce: allow the clock table packet
  drm/amdgpu:cleanup virt related define
  drm/amdgpu: use powerplay module for dgpu in Vi.
  drm/amdgpu: set gfx clock gating for tonga/polaris.
  drm/amdgpu: set system clock gating for tonga/polaris.
  drm/amd/powerplay: export function to help to set cg by smu.
  drm/amdgpu: avoid out of bounds access on array interrupt_status_offsets
  drm/amdgpu: mark symbols static where possible
  drm/amdgpu: remove unused functions
  drm/amd/powerplay:  Replace per-asic print_performance with generic
  drm/radeon: narrow asic_init for virtualization
  drm/amdgpu:add fw version entry to info
  drm/amdgpu:determine if vPost is needed indeed
  ...

7 years agoMerge branch 'drm-etnaviv-next' of git://git.pengutronix.de/git/lst/linux into drm...
Dave Airlie [Wed, 28 Sep 2016 01:24:05 +0000 (11:24 +1000)]
Merge branch 'drm-etnaviv-next' of git://git.pengutronix.de/git/lst/linux into drm-next

Notable changes:

- Cleanups from Fabio to some error paths and proper error propagation.

- Lots of refactoring and new code to support the new MMU version 2,
still relatively unoptimized and doesn't yet provide better process
isolation than MMUv1, but enough to get newer cores up and running.

- New hardware support: GC3000, as found on the NXP i.MX6 QuadPlus SoC.

* 'drm-etnaviv-next' of git://git.pengutronix.de/git/lst/linux: (25 commits)
  drm/etnaviv: mark whole context as lost in recover worker
  drm/etnaviv: record correct cmdbuf IOVA in dump
  drm/etnaviv: space out IOVA layout for cmdbufs on MMUv2
  drm/etnaviv: fix up model and revision for GC2000+
  drm/etnaviv: implement IOMMUv2 translation
  drm/etnaviv: handle MMU exception in IRQ handler
  drm/etnaviv: add flushing logic for MMUv2
  drm/etnaviv: add function to construct MMUv2 init buffer
  drm/etnaviv: map cmdbuf through MMU on version 2
  drm/etnaviv: split out iova search and MMU reaping logic
  drm/etnaviv: split out FE start
  drm/etnaviv: split out wait for gpu idle
  drm/etnaviv: move gpu_va() to etnaviv mmu
  drm/etnaviv: remove unused iommu_v2 header
  drm/etnaviv: move IOMMU domain allocation into etnaviv MMU
  drm/etnaviv: indirect IOMMU restore through etnaviv MMU
  drm/etnaviv: move linear window setup into etnaviv_iommuv1_restore
  drm/etnaviv: rename etnaviv_iommu_domain_restore to etnaviv_iommuv1_restore
  drm/etnaviv: only check if the cmdbuf is inside the linear window on MMUv1
  drm/etnaviv: only try to use the linear window on MMUv1
  ...

7 years agoMerge tag 'sunxi-drm-fixes-for-4.9' of https://git.kernel.org/pub/scm/linux/kernel...
Dave Airlie [Wed, 28 Sep 2016 01:23:15 +0000 (11:23 +1000)]
Merge tag 'sunxi-drm-fixes-for-4.9' of https://git./linux/kernel/git/mripard/linux into drm-next

Allwinner sun4i DRM fixes for 4.9

A few fixes for the sun4i drm driver that range, including some fixes that
might prevent multiple planes from working depending on the sequence where
they are enabled.

* tag 'sunxi-drm-fixes-for-4.9' of https://git.kernel.org/pub/scm/linux/kernel/git/mripard/linux:
  drm/sun4i: Fix the high buffer address mask
  drm/sun4i: tv: Check mode pointer
  drm/sun4i: Fix formats usable by the primary plane
  drm/sun4i: dotclock: Round to closest clock rate
  drm/sun4i: Fix sparse warnings
  drm/sun4i: dotclock: Allow divider = 127
  drm/sun4i: dotclock: Fix clock rate read back calcation
  drm/sun4i: backend: remove redundant dev_err call in sun4i_backend_bind()

7 years agoMerge branch 'for-next' of ssh://people.freedesktop.org/~seanpaul/dogwood into drm...
Dave Airlie [Wed, 28 Sep 2016 01:22:27 +0000 (11:22 +1000)]
Merge branch 'for-next' of ssh://people.freedesktop.org/~seanpaul/dogwood into drm-next

I've included some improvements to PSR from myself, as well as a great
series from Tomasz to clean up and tighten up vblank/flip handling.

The last patch is one from Tomeu that has been floating around for a
while, and since rockchip is one of the beneficiaries, I figured this
would be a good place to pick it up.

* 'for-next' of ssh://people.freedesktop.org/~seanpaul/dogwood:
  drm/rockchip: Balance irq refcount on failure
  drm/rockchip: Kill vop_plane_state
  drm/rockchip: Always signal event in next vblank after cfg_done
  drm/rockchip: Do not enable vblank without event
  drm/rockchip: Replace custom wait_for_vblanks with helper
  drm/rockchip: Unreference framebuffers from flip work
  drm/rockchip: Avoid race with vblank count increment
  drm/rockchip: Get rid of some unnecessary code
  drm/rockchip: Clear interrupt status bits before enabling
  drm/rockchip: Fix up bug in psr state machine
  drm/bridge: analogix_dp: Remove duplicated code
  drm/rockchip: Reduce psr flush time to 100ms
  drm/rockchip: Don't key off vblank for psr

7 years agoMerge tag 'tilcdc-4.9-3.1' of https://github.com/jsarha/linux into drm-next
Dave Airlie [Wed, 28 Sep 2016 01:17:26 +0000 (11:17 +1000)]
Merge tag 'tilcdc-4.9-3.1' of https://github.com/jsarha/linux into drm-next

Second attempt for 3rd drm/tilcdc pull request for v4.9.

* tag 'tilcdc-4.9-3.1' of https://github.com/jsarha/linux:
  drm/tilcdc: fix wrong error handling
  drm/tilcdc: Return directly after a failed kfree_table_init() in tilcdc_convert_slave_node()
  drm/tilcdc: Remove "default" from blue-and-red-wiring property binding
  drm/tilcdc: Fix non static symbol warning
  drm/tilcdc: mark symbols static where possible
  drm/tilcdc: add missing header dependencies
  drm/tilcdc: WARN if CRTC is touched without CRTC lock
  drm/tilcdc: Take CRTC lock when calling tilcdc_crtc_disable()
  drm/tilcdc: Remove unnecessary tilcdc_crtc_disable() from tilcdc_unload()
  drm/tilcdc: Flush flip-work workqueue before drm_flip_work_cleanup()
  drm/tilcdc: Clean up LCDC functional clock rate setting code
  drm/tilcdc: Take crtc modeset lock while updating the crtc clock rate

7 years agoMerge branch 'sti-drm-next-2016-09-20' of https://github.com/vinceab/linux into drm...
Dave Airlie [Wed, 28 Sep 2016 01:14:58 +0000 (11:14 +1000)]
Merge branch 'sti-drm-next-2016-09-20' of https://github.com/vinceab/linux into drm-next

Here are some patches for drm-next.
It contains:
- minor fixes for typo and warning.
- sparse and coccicheck warning fixes
- bunch of patches fixing issues found while testing drm/sti with an
atomic version of weston
- the removal of the support of stih415-416 sti platform

* 'sti-drm-next-2016-09-20' of https://github.com/vinceab/linux:
  drm/sti: remove stih415-416 platform support
  drm/sti: fix compositor debugfs creation
  drm/sti: use valid video mode
  drm/sti: in crtc_atomic_flush, enable only planes of this crtc
  drm/sti: use vtg array instead of vtg_main/aux
  drm/sti: use different notifier_block for each pipe
  drm/sti: fix atomic_disable check
  drm/sti: run gdp init sequence only once
  drm/sti: run hqvdp init sequence only once
  drm/sti: fix debug logs
  drm/sti: dpms function missing for HDMI connector
  drm/sti: Fix sparse warnings
  drm: sti: fix coccicheck warnings
  drm: sti: Replace drm_fb_get_bpp_depth() with drm_format_plane_cpp()

7 years agoMerge branch 'msm-next' of git://people.freedesktop.org/~robclark/linux into drm...
Dave Airlie [Wed, 28 Sep 2016 01:09:59 +0000 (11:09 +1000)]
Merge branch 'msm-next' of git://people.freedesktop.org/~robclark/linux into drm-next

A bit smaller pull-req this time around.  Some continued DT binding
cleanup to get the corresponding dts bits merged upstream (through
other trees).  And explicit fence-fd support for submit ioctl.

* 'msm-next' of git://people.freedesktop.org/~robclark/linux:
  drm/msm: bump kernel api version for explicit fencing
  drm/msm: submit support for out-fences
  drm/msm: move fence allocation out of msm_gpu_submit()
  drm/msm: submit support for in-fences
  drm/msm: extend the submit ioctl to pass in flags
  drm/msm/mdp5: Set rotation property initial value to DRM_ROTATE_0 insted of 0
  drm/msm/hdmi: don't print error when adding i2c adapter fails
  drm/msm/mdp4: mark symbols static where possible
  drm/msm: Remove call to reservation_object_test_signaled_rcu before wait
  drm/msm/hdmi: Clean up HDMI gpio DT bindings
  drm/msm/mdp4: Fix issue with LCDC/LVDS port parsing

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

- more core cleanup patches to prep drm_file to be used for
  kernel-internal contexts (David Herrmann)
- more split-up+docs for drm_crtc.c
- lots of small fixes and polish all over

* tag 'topic/drm-misc-2016-09-25' of git://anongit.freedesktop.org/drm-intel: (37 commits)
  drm: bridge: analogix/dp: mark symbols static where possible
  drm/bochs: mark bochs_connector_get_modes() static
  drm/bridge: analogix_dp: Improve panel on time
  drm/bridge: analogix_dp: Don't read EDID if panel present
  drm/bridge: analogix_dp: Remove duplicated code
  Revert "drm/i2c: tda998x: don't register the connector"
  drm: Fix plane type uabi breakage
  dma-buf/sync_file: free fences array in num_fences is 1
  drm/i2c: tda998x: don't register the connector
  drm: Don't swallow error codes in drm_dev_alloc()
  drm: Distinguish no name from ENOMEM in set_unique()
  drm: Remove dirty property from docs
  drm/doc: Document color space handling
  drm: Extract drm_color_mgmt.[hc]
  drm/doc: Polish plane composition property docs
  drm: Conslidate blending properties in drm_blend.[hc]
  drm/doc: Polish for drm_plane.[hc]
  drm: Extract drm_plane.[hc]
  drm/tilcdc: Add atomic and crtc headers to crtc.c
  drm: Fix typo in encoder docs
  ...

7 years agoMerge tag 'drm-amdkfd-next-2016-09-19' of git://people.freedesktop.org/~gabbayo/linux...
Dave Airlie [Wed, 28 Sep 2016 00:25:42 +0000 (10:25 +1000)]
Merge tag 'drm-amdkfd-next-2016-09-19' of git://people.freedesktop.org/~gabbayo/linux into drm-next

This is amdkfd's pull request for kernel 4.9. It contains a fix to a possible
infinite loop bug and a couple of other minor "cleaning" patches.

* tag 'drm-amdkfd-next-2016-09-19' of git://people.freedesktop.org/~gabbayo/linux:
  drm/amdkfd: Pass 'struct queue_propertices' by reference
  drm/amdkfd: Unify multiple calls to pr_debug() into one
  drm/amdkfd: Fix possible infinite loop
  drm/amdkfd: Reuse function to find a process through pasid
  drm/amdkfd: Add some missing memset zero'ing in queue init func
  drm/amdkfd: Tidy up kfd_generate_gpu_id() uint64_t bitshift unpack

7 years agodrm/amdgpu/vce3: don't forget to tear down some rings
Grazvydas Ignotas [Sun, 25 Sep 2016 20:34:49 +0000 (23:34 +0300)]
drm/amdgpu/vce3: don't forget to tear down some rings

We can use .num_rings for that.

Fixes: 6f0359ff7307 ("vce3: add support for third vce ring")
Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu/i2c: add const where appropriate
Grazvydas Ignotas [Sun, 25 Sep 2016 20:34:50 +0000 (23:34 +0300)]
drm/amdgpu/i2c: add const where appropriate

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: don't leave dangling pointers around
Grazvydas Ignotas [Sun, 25 Sep 2016 20:34:46 +0000 (23:34 +0300)]
drm/amdgpu: don't leave dangling pointers around

Right now it's possible to trigger fence_drv.fences[] dereference after
the array has been freed. While the real problem is elsewhere, this still
results in confusing errors that depend on how the freed memory was
reused (I've seen "kernel tried to execute NX-protected page"), it's
better to clear them and get NULL dereference so that it's obvious what's
going wrong.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: clear ring pointer in amdgpu_device on teardown
Grazvydas Ignotas [Sun, 25 Sep 2016 20:34:47 +0000 (23:34 +0300)]
drm/amdgpu: clear ring pointer in amdgpu_device on teardown

This is in symmetry to setup done in amdgpu_ring_init.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu/vce: take all rings into account for idle checks
Alex Deucher [Mon, 26 Sep 2016 19:19:14 +0000 (15:19 -0400)]
drm/amdgpu/vce: take all rings into account for idle checks

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: add version bump for raster config programming
Alex Deucher [Mon, 26 Sep 2016 20:44:54 +0000 (16:44 -0400)]
drm/amdgpu: add version bump for raster config programming

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: fix addr handling in amdgpu_vm_bo_update_mapping
Christian König [Sun, 25 Sep 2016 09:54:00 +0000 (11:54 +0200)]
drm/amdgpu: fix addr handling in amdgpu_vm_bo_update_mapping

Otherwise we will look at the wrong place in the IB when GART
mappings are split into smaller updates.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Tom StDenis <Tom.StDenis@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: bypass vce clock if vce is idle on Fiji.
Rex Zhu [Sat, 24 Sep 2016 08:34:59 +0000 (16:34 +0800)]
drm/amdgpu: bypass vce clock if vce is idle on Fiji.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agoLinux 4.8-rc8 v4.8-rc8
Linus Torvalds [Mon, 26 Sep 2016 01:47:13 +0000 (18:47 -0700)]
Linux 4.8-rc8

7 years agoMerge tag 'trace-v4.8-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt...
Linus Torvalds [Mon, 26 Sep 2016 01:40:13 +0000 (18:40 -0700)]
Merge tag 'trace-v4.8-rc7' of git://git./linux/kernel/git/rostedt/linux-trace

Pull tracefs fixes from Steven Rostedt:
 "Al Viro has been looking at the tracefs code, and has pointed out some
  issues.  This contains one fix by me and one by Al.  I'm sure that
  he'll come up with more but for now I tested these patches and they
  don't appear to have any negative impact on tracing"

* tag 'trace-v4.8-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
  fix memory leaks in tracing_buffers_splice_read()
  tracing: Move mutex to protect against resetting of seq data

7 years agofault_in_multipages_readable() throws set-but-unused error
Dave Chinner [Sun, 25 Sep 2016 23:57:33 +0000 (09:57 +1000)]
fault_in_multipages_readable() throws set-but-unused error

When building XFS with -Werror, it now fails with:

  include/linux/pagemap.h: In function 'fault_in_multipages_readable':
  include/linux/pagemap.h:602:16: error: variable 'c' set but not used [-Werror=unused-but-set-variable]
    volatile char c;
                  ^

This is a regression caused by commit e23d4159b109 ("fix
fault_in_multipages_...() on architectures with no-op access_ok()").
Fix it by re-adding the "(void)c" trick taht was previously used to make
the compiler think the variable is used.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
7 years agomm: check VMA flags to avoid invalid PROT_NONE NUMA balancing
Lorenzo Stoakes [Sun, 11 Sep 2016 22:54:25 +0000 (23:54 +0100)]
mm: check VMA flags to avoid invalid PROT_NONE NUMA balancing

The NUMA balancing logic uses an arch-specific PROT_NONE page table flag
defined by pte_protnone() or pmd_protnone() to mark PTEs or huge page
PMDs respectively as requiring balancing upon a subsequent page fault.
User-defined PROT_NONE memory regions which also have this flag set will
not normally invoke the NUMA balancing code as do_page_fault() will send
a segfault to the process before handle_mm_fault() is even called.

However if access_remote_vm() is invoked to access a PROT_NONE region of
memory, handle_mm_fault() is called via faultin_page() and
__get_user_pages() without any access checks being performed, meaning
the NUMA balancing logic is incorrectly invoked on a non-NUMA memory
region.

A simple means of triggering this problem is to access PROT_NONE mmap'd
memory using /proc/self/mem which reliably results in the NUMA handling
functions being invoked when CONFIG_NUMA_BALANCING is set.

This issue was reported in bugzilla (issue 99101) which includes some
simple repro code.

There are BUG_ON() checks in do_numa_page() and do_huge_pmd_numa_page()
added at commit c0e7cad to avoid accidentally provoking strange
behaviour by attempting to apply NUMA balancing to pages that are in
fact PROT_NONE.  The BUG_ON()'s are consistently triggered by the repro.

This patch moves the PROT_NONE check into mm/memory.c rather than
invoking BUG_ON() as faulting in these pages via faultin_page() is a
valid reason for reaching the NUMA check with the PROT_NONE page table
flag set and is therefore not always a bug.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=99101
Reported-by: Trevor Saunders <tbsaunde@tbsaunde.org>
Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com>
Acked-by: Rik van Riel <riel@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Mel Gorman <mgorman@techsingularity.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
7 years agoMerge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus
Linus Torvalds [Sun, 25 Sep 2016 20:59:52 +0000 (13:59 -0700)]
Merge branch 'upstream' of git://git.linux-mips.org/ralf/upstream-linus

Pull MIPS fixes from Ralf Baechle:
 "A round of 4.8 fixes:

  MIPS generic code:
   - Add a missing ".set pop" in an early commit
   - Fix memory regions reaching top of physical
   - MAAR: Fix address alignment
   - vDSO: Fix Malta EVA mapping to vDSO page structs
   - uprobes: fix incorrect uprobe brk handling
   - uprobes: select HAVE_REGS_AND_STACK_ACCESS_API
   - Avoid a BUG warning during PR_SET_FP_MODE prctl
   - SMP: Fix possibility of deadlock when bringing CPUs online
   - R6: Remove compact branch policy Kconfig entries
   - Fix size calc when avoiding IPIs for small icache flushes
   - Fix pre-r6 emulation FPU initialisation
   - Fix delay slot emulation count in debugfs

  ATH79:
   - Fix test for error return of clk_register_fixed_factor.

  Octeon:
   - Fix kernel header to work for VDSO build.
   - Fix initialization of platform device probing.

  paravirt:
   - Fix undefined reference to smp_bootstrap"

* 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus:
  MIPS: Fix delay slot emulation count in debugfs
  MIPS: SMP: Fix possibility of deadlock when bringing CPUs online
  MIPS: Fix pre-r6 emulation FPU initialisation
  MIPS: vDSO: Fix Malta EVA mapping to vDSO page structs
  MIPS: Select HAVE_REGS_AND_STACK_ACCESS_API
  MIPS: Octeon: Fix platform bus probing
  MIPS: Octeon: mangle-port: fix build failure with VDSO code
  MIPS: Avoid a BUG warning during prctl(PR_SET_FP_MODE, ...)
  MIPS: c-r4k: Fix size calc when avoiding IPIs for small icache flushes
  MIPS: Add a missing ".set pop" in an early commit
  MIPS: paravirt: Fix undefined reference to smp_bootstrap
  MIPS: Remove compact branch policy Kconfig entries
  MIPS: MAAR: Fix address alignment
  MIPS: Fix memory regions reaching top of physical
  MIPS: uprobes: fix incorrect uprobe brk handling
  MIPS: ath79: Fix test for error return of clk_register_fixed_factor().

7 years agodrm: bridge: analogix/dp: mark symbols static where possible
Baoyou Xie [Sun, 25 Sep 2016 07:32:44 +0000 (15:32 +0800)]
drm: bridge: analogix/dp: mark symbols static where possible

We get 2 warnings when building kernel with W=1:
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c:1053:5: warning: no previous prototype for 'analogix_dp_get_modes' [-Wmissing-prototypes]
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c:1097:1: warning: no previous prototype for 'analogix_dp_detect' [-Wmissing-prototypes]

In fact, both functions are only used in the file in which they are
declared and don't need a declaration, but can be made static.
So this patch marks both functions with 'static'.

Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1474788764-6069-1-git-send-email-baoyou.xie@linaro.org
7 years agodrm/bochs: mark bochs_connector_get_modes() static
Baoyou Xie [Sun, 25 Sep 2016 07:25:34 +0000 (15:25 +0800)]
drm/bochs: mark bochs_connector_get_modes() static

We get 1 warning when building kernel with W=1:
drivers/gpu/drm/bochs/bochs_kms.c:181:5: warning: no previous prototype for 'bochs_connector_get_modes' [-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>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1474788334-11007-1-git-send-email-baoyou.xie@linaro.org
7 years agoMerge tag 'powerpc-4.8-7' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc...
Linus Torvalds [Sun, 25 Sep 2016 20:52:59 +0000 (13:52 -0700)]
Merge tag 'powerpc-4.8-7' of git://git./linux/kernel/git/powerpc/linux

Pull one more powerpc fix from Michael Ellerman:
 "powernv/pci: Fix m64 checks for SR-IOV and window alignment from
  Russell Currey"

* tag 'powerpc-4.8-7' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
  powerpc/powernv/pci: Fix m64 checks for SR-IOV and window alignment

7 years agoradix tree: fix sibling entry handling in radix_tree_descend()
Linus Torvalds [Sun, 25 Sep 2016 20:32:46 +0000 (13:32 -0700)]
radix tree: fix sibling entry handling in radix_tree_descend()

The fixes to the radix tree test suite show that the multi-order case is
broken.  The basic reason is that the radix tree code uses tagged
pointers with the "internal" bit in the low bits, and calculating the
pointer indices was supposed to mask off those bits.  But gcc will
notice that we then use the index to re-create the pointer, and will
avoid doing the arithmetic and use the tagged pointer directly.

This cleans the code up, using the existing is_sibling_entry() helper to
validate the sibling pointer range (instead of open-coding it), and
using entry_to_node() to mask off the low tag bit from the pointer.  And
once you do that, you might as well just use the now cleaned-up pointer
directly.

[ Side note: the multi-order code isn't actually ever used in the kernel
  right now, and the only reason I didn't just delete all that code is
  that Kirill Shutemov piped up and said:

    "Well, my ext4-with-huge-pages patchset[1] uses multi-order entries.
     It also converts shmem-with-huge-pages and hugetlb to them.

     I'm okay with converting it to other mechanism, but I need
     something.  (I looked into Konstantin's RFC patchset[2].  It looks
     okay, but I don't feel myself qualified to review it as I don't
     know much about radix-tree internals.)"

  [1] http://lkml.kernel.org/r/20160915115523.29737-1-kirill.shutemov@linux.intel.com
  [2] http://lkml.kernel.org/r/147230727479.9957.1087787722571077339.stgit@zurg ]

Reported-by: Matthew Wilcox <mawilcox@microsoft.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Konstantin Khlebnikov <koct9i@gmail.com>
Cc: Cedric Blancher <cedric.blancher@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
7 years agoradix tree test suite: Test radix_tree_replace_slot() for multiorder entries
Matthew Wilcox [Thu, 22 Sep 2016 18:53:34 +0000 (11:53 -0700)]
radix tree test suite: Test radix_tree_replace_slot() for multiorder entries

When we replace a multiorder entry, check that all indices reflect the
new value.

Also, compile the test suite with -O2, which shows other problems with
the code due to some dodgy pointer operations in the radix tree code.

Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
7 years agofix memory leaks in tracing_buffers_splice_read()
Al Viro [Sat, 17 Sep 2016 22:31:46 +0000 (18:31 -0400)]
fix memory leaks in tracing_buffers_splice_read()

Cc: stable@vger.kernel.org
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
7 years agotracing: Move mutex to protect against resetting of seq data
Steven Rostedt (Red Hat) [Sat, 24 Sep 2016 02:57:13 +0000 (22:57 -0400)]
tracing: Move mutex to protect against resetting of seq data

The iter->seq can be reset outside the protection of the mutex. So can
reading of user data. Move the mutex up to the beginning of the function.

Fixes: d7350c3f45694 ("tracing/core: make the read callbacks reentrants")
Cc: stable@vger.kernel.org # 2.6.30+
Reported-by: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
7 years agoMIPS: Fix delay slot emulation count in debugfs
Paul Burton [Thu, 22 Sep 2016 14:47:40 +0000 (15:47 +0100)]
MIPS: Fix delay slot emulation count in debugfs

Commit 432c6bacbd0c ("MIPS: Use per-mm page to execute branch delay slot
instructions") accidentally removed use of the MIPS_FPU_EMU_INC_STATS
macro from do_dsemulret, leading to the ds_emul file in debugfs always
returning zero even though we perform delay slot emulations.

Fix this by re-adding the use of the MIPS_FPU_EMU_INC_STATS macro.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Fixes: 432c6bacbd0c ("MIPS: Use per-mm page to execute branch delay slot instructions")
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/14301/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
7 years agoMIPS: SMP: Fix possibility of deadlock when bringing CPUs online
Matt Redfearn [Thu, 22 Sep 2016 16:15:47 +0000 (17:15 +0100)]
MIPS: SMP: Fix possibility of deadlock when bringing CPUs online

This patch fixes the possibility of a deadlock when bringing up
secondary CPUs.
The deadlock occurs because the set_cpu_online() is called before
synchronise_count_slave(). This can cause a deadlock if the boot CPU,
having scheduled another thread, attempts to send an IPI to the
secondary CPU, which it sees has been marked online. The secondary is
blocked in synchronise_count_slave() waiting for the boot CPU to enter
synchronise_count_master(), but the boot cpu is blocked in
smp_call_function_many() waiting for the secondary to respond to it's
IPI request.

Fix this by marking the CPU online in cpu_callin_map and synchronising
counters before declaring the CPU online and calculating the maps for
IPIs.

Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com>
Reported-by: Justin Chen <justinpopo6@gmail.com>
Tested-by: Justin Chen <justinpopo6@gmail.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: stable@vger.kernel.org # v4.1+
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/14302/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
7 years agoMerge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sat, 24 Sep 2016 19:44:28 +0000 (12:44 -0700)]
Merge branch 'perf-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull perf fixes from Thomas Gleixner:
 "Three fixlets for perf:

   - add a missing NULL pointer check in the intel BTS driver

   - make BTS an exclusive PMU because BTS can only handle one event at
     a time

   - ensure that exclusive events are limited to one PMU so that several
     exclusive events can be scheduled on different PMU instances"

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  perf/core: Limit matching exclusive events to one PMU
  perf/x86/intel/bts: Make it an exclusive PMU
  perf/x86/intel/bts: Make sure debug store is valid

7 years agoMerge branch 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sat, 24 Sep 2016 19:41:19 +0000 (12:41 -0700)]
Merge branch 'locking-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull locking fixes from Thomas Gleixner:
 "Two smallish fixes:

   - use the proper asm constraint in the Super-H atomic_fetch_ops

   - a trivial typo fix in the Kconfig help text"

* 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  locking/hung_task: Fix typo in CONFIG_DETECT_HUNG_TASK help text
  locking/atomic, arch/sh: Fix ATOMIC_FETCH_OP()

7 years agoMerge branch 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sat, 24 Sep 2016 19:35:26 +0000 (12:35 -0700)]
Merge branch 'efi-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull EFI fixes from Thomas Gleixner:
 "Two fixes for EFI/PAT:

   - a 32bit overflow bug in the PAT code which was unearthed by the
     large EFI mappings

   - prevent a boot hang on large systems when EFI mixed mode is enabled
     but not used"

* 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/efi: Only map RAM into EFI page tables if in mixed-mode
  x86/mm/pat: Prevent hang during boot when mapping pages

7 years agoMerge branch 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sat, 24 Sep 2016 19:30:12 +0000 (12:30 -0700)]
Merge branch 'irq-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull irq fixes from Thomas Gleixner:
 "Three fixes for irq core and irq chip drivers:

   - Do not set the irq type if type is NONE.  Fixes a boot regression
     on various SoCs

   - Use the proper cpu for setting up the GIC target list.  Discovered
     by the cpumask debugging code.

   - A rather large fix for the MIPS-GIC so per cpu local interrupts
     work again.  This was discovered late because the code falls back
     to slower timers which use normal device interrupts"

* 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  irqchip/mips-gic: Fix local interrupts
  irqchip/gicv3: Silence noisy DEBUG_PER_CPU_MAPS warning
  genirq: Skip chained interrupt trigger setup if type is IRQ_TYPE_NONE

7 years agoMerge branch 'hughd-fixes' (patches from Hugh Dickins)
Linus Torvalds [Sat, 24 Sep 2016 18:31:45 +0000 (11:31 -0700)]
Merge branch 'hughd-fixes' (patches from Hugh Dickins)

Merge VM fixes from High Dickins:
 "I get the impression that Andrew is away or busy at the moment, so I'm
  going to send you three independent uncontroversial little mm fixes
  directly - though none is strictly a 4.8 regression fix.

   - shmem: fix tmpfs to handle the huge= option properly from Toshi
     Kani is a one-liner to fix a major embarrassment in 4.8's hugepages
     on tmpfs feature: although Hillf pointed it out in June, somehow
     both Kirill and I repeatedly dropped the ball on this one.  You
     might wonder if the feature got tested at all with that bug in:
     yes, it did, but for wider testing coverage, Kirill and I had each
     relied too much on an override which bypasses that condition.

   - huge tmpfs: fix Committed_AS leak just a run-of-the-mill accounting
     fix in the same feature.

   - mm: delete unnecessary and unsafe init_tlb_ubc() is an unrelated
     fix to 4.3's TLB flush batching in reclaim: the bug would be rare,
     and none of us will be shamed if this one misses 4.8; but it got
     such a quick ack from Mel today that I'm inclined to offer it along
     with the first two"

* emailed patches from Hugh Dickins <hughd@google.com>:
  mm: delete unnecessary and unsafe init_tlb_ubc()
  huge tmpfs: fix Committed_AS leak
  shmem: fix tmpfs to handle the huge= option properly

7 years agomm: delete unnecessary and unsafe init_tlb_ubc()
Hugh Dickins [Sat, 24 Sep 2016 03:27:04 +0000 (20:27 -0700)]
mm: delete unnecessary and unsafe init_tlb_ubc()

init_tlb_ubc() looked unnecessary to me: tlb_ubc is statically
initialized with zeroes in the init_task, and copied from parent to
child while it is quiescent in arch_dup_task_struct(); so I went to
delete it.

But inserted temporary debug WARN_ONs in place of init_tlb_ubc() to
check that it was always empty at that point, and found them firing:
because memcg reclaim can recurse into global reclaim (when allocating
biosets for swapout in my case), and arrive back at the init_tlb_ubc()
in shrink_node_memcg().

Resetting tlb_ubc.flush_required at that point is wrong: if the upper
level needs a deferred TLB flush, but the lower level turns out not to,
we miss a TLB flush.  But fortunately, that's the only part of the
protocol that does not nest: with the initialization removed, cpumask
collects bits from upper and lower levels, and flushes TLB when needed.

Fixes: 72b252aed506 ("mm: send one IPI per CPU to TLB flush all entries after unmapping pages")
Signed-off-by: Hugh Dickins <hughd@google.com>
Acked-by: Mel Gorman <mgorman@techsingularity.net>
Cc: stable@vger.kernel.org # 4.3+
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
7 years agohuge tmpfs: fix Committed_AS leak
Hugh Dickins [Sat, 24 Sep 2016 03:24:23 +0000 (20:24 -0700)]
huge tmpfs: fix Committed_AS leak

Under swapping load on huge tmpfs, /proc/meminfo's Committed_AS grows
bigger and bigger: just a cosmetic issue for most users, but disabling
for those who run without overcommit (/proc/sys/vm/overcommit_memory 2).

shmem_uncharge() was forgetting to unaccount __vm_enough_memory's
charge, and shmem_charge() was forgetting it on the filesystem-full
error path.

Fixes: 800d8c63b2e9 ("shmem: add huge pages support")
Signed-off-by: Hugh Dickins <hughd@google.com>
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
7 years agoshmem: fix tmpfs to handle the huge= option properly
Toshi Kani [Sat, 24 Sep 2016 03:21:56 +0000 (20:21 -0700)]
shmem: fix tmpfs to handle the huge= option properly

shmem_get_unmapped_area() checks SHMEM_SB(sb)->huge incorrectly, which
leads to a reversed effect of "huge=" mount option.

Fix the check in shmem_get_unmapped_area().

Note, the default value of SHMEM_SB(sb)->huge remains as
SHMEM_HUGE_NEVER.  User will need to specify "huge=" option to enable
huge page mappings.

Reported-by: Hillf Danton <hillf.zj@alibaba-inc.com>
Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
7 years agodrm/bridge: analogix_dp: Improve panel on time
Sean Paul [Wed, 7 Sep 2016 11:23:15 +0000 (07:23 -0400)]
drm/bridge: analogix_dp: Improve panel on time

In order to reduce the time required to turn on the panel, this patch
makes 2 assumptions:
1- In detect(): if there's a panel, we're connected.
2- In get_modes(): if there's a panel, let the panel driver decide if
   it should prepare/unprepare in order to get the modes.

The first is straightforward, and shouldn't need further explanation. The
second should eliminate the prepare/unprepare delays from get_modes() in
most cases, since panels generally hardcode their modes in the driver as
opposed to reading EDID. If a panel does need to read EDID, it should be
responsible for ensuring it's in a state in which it can.

Signed-off-by: Sean Paul <seanpaul@chromium.org>
7 years agodrm/bridge: analogix_dp: Don't read EDID if panel present
Sean Paul [Wed, 24 Aug 2016 14:58:26 +0000 (10:58 -0400)]
drm/bridge: analogix_dp: Don't read EDID if panel present

If there's a panel connected to the analogix_dp bridge, rely on
the panel driver for modes, rather than reading EDID *and* calling
get_modes() on the panel.

This allows panels with a valid EDID to read it in the panel driver
(e.g. simple_panel), and panels with invalid EDID to homebrew modes
in their get_modes implementation.

Signed-off-by: Sean Paul <seanpaul@chromium.org>
7 years agodrm/bridge: analogix_dp: Remove duplicated code
Tomeu Vizoso [Wed, 24 Aug 2016 14:54:41 +0000 (10:54 -0400)]
drm/bridge: analogix_dp: Remove duplicated code

Remove code for reading the EDID and DPCD fields and use the helpers
instead.

Besides the obvious code reduction, other helpers are being added to the
core that could be used in this driver and will be good to be able to
use them instead of duplicating them.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Tested-by: Javier Martinez Canillas <javier@osg.samsung.com>
Tested-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Cc: Javier Martinez Canillas <javier@osg.samsung.com>
Cc: Mika Kahola <mika.kahola@intel.com>
Cc: Yakir Yang <ykk@rock-chips.com>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Archit Taneja <architt@codeaurora.org>
7 years agoMerge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa...
Linus Torvalds [Fri, 23 Sep 2016 23:44:12 +0000 (16:44 -0700)]
Merge branch 'i2c/for-current' of git://git./linux/kernel/git/wsa/linux

Pull i2c fixes from Wolfram Sang:
 "Three driver bugfixes: fixing uninitialized memory pointers (eg20t),
  pm/clock imbalance (qup), and a wrongly set cached variable (pc954x)"

* 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
  i2c: qup: skip qup_i2c_suspend if the device is already runtime suspended
  i2c: mux: pca954x: retry updating the mux selection on failure
  i2c-eg20t: fix race between i2c init and interrupt enable

7 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Linus Torvalds [Fri, 23 Sep 2016 23:34:24 +0000 (16:34 -0700)]
Merge branch 'for-linus' of git://git./linux/kernel/git/dtor/input

Pull input updates from Dmitry Torokhov:
 "Just a fix up for the firmware handling to the Silead driver (which is
  a new driver in this release)"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
  Input: silead_gsl1680 - use "silead/" prefix for firmware loading
  Input: silead_gsl1680 - document firmware-name, fix implementation

7 years agoMerge branch 'for-linus' of git://git.kernel.dk/linux-block
Linus Torvalds [Fri, 23 Sep 2016 23:24:36 +0000 (16:24 -0700)]
Merge branch 'for-linus' of git://git.kernel.dk/linux-block

Pull block fixes from Jens Axboe:
 "Three fixes, two regressions and one that poses a problem in blk-mq
  with the new nvmef code"

* 'for-linus' of git://git.kernel.dk/linux-block:
  blk-mq: skip unmapped queues in blk_mq_alloc_request_hctx
  nvme-rdma: only clear queue flags after successful connect
  blk-throttle: Extend slice if throttle group is not empty

7 years agoMerge branch 'for-linus-4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/mason...
Linus Torvalds [Fri, 23 Sep 2016 20:39:37 +0000 (13:39 -0700)]
Merge branch 'for-linus-4.8' of git://git./linux/kernel/git/mason/linux-btrfs

Pull btrfs fixes from Chris Mason:
 "Josef fixed a problem when quotas are enabled with his latest ENOSPC
  rework, and Jeff added more checks into the subvol ioctls to avoid
  tripping up lookup_one_len"

* 'for-linus-4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
  btrfs: ensure that file descriptor used with subvol ioctls is a dir
  Btrfs: handle quota reserve failure properly

7 years agoMerge tag 'regmap-fix-v4.8-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Fri, 23 Sep 2016 18:50:49 +0000 (11:50 -0700)]
Merge tag 'regmap-fix-v4.8-rc7' of git://git./linux/kernel/git/broonie/regmap

Pull regmap fix from Mark Brown:
 "A fix for an issue with double locking that was introduced earlier
  this release.  I'd missed in review that we were already in a locked
  region when trying to drop part of the cache"

* tag 'regmap-fix-v4.8-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap:
  regmap: fix deadlock on _regmap_raw_write() error path

7 years agoMerge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Linus Torvalds [Fri, 23 Sep 2016 18:28:04 +0000 (11:28 -0700)]
Merge branch 'linus' of git://git./linux/kernel/git/herbert/crypto-2.6

Pull crypto fixes from Herbert Xu:
 "This fixes a regression in RSA that was only half-fixed earlier in the
  cycle.  It also fixes an older regression that breaks the keyring
  subsystem"

* 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
  crypto: rsa-pkcs1pad - Handle leading zero for decryption
  KEYS: Fix skcipher IV clobbering

7 years agoMerge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
Linus Torvalds [Fri, 23 Sep 2016 18:24:42 +0000 (11:24 -0700)]
Merge tag 'arm64-fixes' of git://git./linux/kernel/git/arm64/linux

Pull arm64 fixes from Catalin Marinas:
 "A couple of last-minute arm64 fixes for 4.8:

   - Fix secondary CPU to NUMA node assignment

   - Fix kgdb breakpoint insertion in read-only text sections (when
     CONFIG_DEBUG_RODATA or CONFIG_DEBUG_SET_MODULE_RONX are enabled)"

* tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
  arm64: kgdb: handle read-only text / modules
  arm64: Call numa_store_cpu_info() earlier.