linux-2.6-block.git
7 years agodrm/nouveau/disp/g94: remove unused sor implementation
Ben Skeggs [Thu, 22 Dec 2016 00:07:27 +0000 (10:07 +1000)]
drm/nouveau/disp/g94: remove unused sor implementation

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/fb/ram/gk104: remove unused best_clk variable
Ben Skeggs [Thu, 22 Dec 2016 00:06:54 +0000 (10:06 +1000)]
drm/nouveau/fb/ram/gk104: remove unused best_clk variable

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: clear halt interrupt after ACR is run
Alexandre Courbot [Wed, 14 Dec 2016 08:02:52 +0000 (17:02 +0900)]
drm/nouveau/secboot: clear halt interrupt after ACR is run

The halt interrupt must be cleared after ACR is run, otherwise the LS
PMU firmware will not be able to run.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: add lazy-bootstrap flag
Alexandre Courbot [Wed, 14 Dec 2016 08:02:50 +0000 (17:02 +0900)]
drm/nouveau/secboot: add lazy-bootstrap flag

When the PMU firmware is present, the falcons it manages need to have
the lazy-bootstrap flag of their WPR header set so the ACR does not boot
them. Add support for this.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: fix WPR descriptor generation
Alexandre Courbot [Wed, 14 Dec 2016 08:02:49 +0000 (17:02 +0900)]
drm/nouveau/secboot: fix WPR descriptor generation

Generate the WPR descriptor closer to what RM does. In particular, set
the expected masks, and only set the ucode members on Tegra.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: set default error value in error register
Alexandre Courbot [Wed, 14 Dec 2016 08:02:48 +0000 (17:02 +0900)]
drm/nouveau/secboot: set default error value in error register

Set a default error value in the mailbox 0 register so we can catch
cases where the secure boot binary fails early without being able to
report anything.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: add missing fields to BL structure
Alexandre Courbot [Wed, 14 Dec 2016 08:02:47 +0000 (17:02 +0900)]
drm/nouveau/secboot: add missing fields to BL structure

Since DMEM was initialized to zero, these fields went unnoticed. Add
them for safety.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: safer zeroing of BL descriptors
Alexandre Courbot [Wed, 14 Dec 2016 08:02:46 +0000 (17:02 +0900)]
drm/nouveau/secboot: safer zeroing of BL descriptors

Perform the zeroing of BL descriptors in the caller function instead of
trusting each generator will do it. This could avoid a few pulled hairs.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: abstract LS firmware loading functions
Alexandre Courbot [Wed, 14 Dec 2016 08:02:45 +0000 (17:02 +0900)]
drm/nouveau/secboot: abstract LS firmware loading functions

The WPR and LSB headers, used to generate the LS blob, may have a
different layout and sizes depending on the driver version they come
from. Abstract them and confine their use to driver-specific code.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: remove ls_ucode_mgr
Alexandre Courbot [Wed, 14 Dec 2016 08:02:44 +0000 (17:02 +0900)]
drm/nouveau/secboot: remove ls_ucode_mgr

This was used only locally to one function and can be replaced by ad-hoc
variables.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: remove unneeded ls_ucode_img member
Alexandre Courbot [Wed, 14 Dec 2016 08:02:43 +0000 (17:02 +0900)]
drm/nouveau/secboot: remove unneeded ls_ucode_img member

ucode_header is not used anywhere, so just get rid of it.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: disable falcon interrupts when running blob
Alexandre Courbot [Wed, 14 Dec 2016 08:02:42 +0000 (17:02 +0900)]
drm/nouveau/secboot: disable falcon interrupts when running blob

Make sure we are not disturbed by spurious interrupts, as we poll the
halt bit anyway.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: split reset function
Alexandre Courbot [Wed, 14 Dec 2016 08:02:41 +0000 (17:02 +0900)]
drm/nouveau/secboot: split reset function

Split the reset function into more meaningful and reusable ones.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: add LS flags to LS func structure
Alexandre Courbot [Wed, 14 Dec 2016 08:02:40 +0000 (17:02 +0900)]
drm/nouveau/secboot: add LS flags to LS func structure

Add a flag that can be set when declaring how a LS firmware should be
loaded. This allows us to remove falcon-specific code in the loader.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: reorganize into more files
Alexandre Courbot [Wed, 14 Dec 2016 08:02:39 +0000 (17:02 +0900)]
drm/nouveau/secboot: reorganize into more files

Split the act of building the ACR blob from firmware files from the rest
of the (chip-dependent) secure boot logic. ACR logic is moved into
acr_rxxx.c files, where rxxx corresponds to the compatible release of
the NVIDIA driver. At the moment r352 and r361 are supported since
firmwares have been released for these versions. Some abstractions are
added on top of r352 so r361 can easily be implemented on top of it by
just overriding a few hooks.

This split makes it possible and easy to reuse the same ACR version on
different chips. It also hopefully makes the code much more readable as
the different secure boot logics are separated. As more chips and
firmware versions will be supported, this is a necessity to not get lost
in code that is already quite complex.

This is a big commit, but it essentially moves things around (and split
the nvkm_secboot structure into two, nvkm_secboot and nvkm_acr). Code
semantics should not be affected.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: generate HS BL descriptor in hook
Alexandre Courbot [Wed, 14 Dec 2016 08:02:38 +0000 (17:02 +0900)]
drm/nouveau/secboot: generate HS BL descriptor in hook

Use the HS hook to completely generate the HS BL descriptor, similarly
to what is done in the LS hook, instead of (arbitrarily) using the
acr_v1 format as an intermediate.

This allows us to make the bootloader descriptor structures private to
each implementation, resulting in a cleaner an more consistent design.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: add low-secure firmware hooks
Alexandre Courbot [Wed, 14 Dec 2016 08:02:37 +0000 (17:02 +0900)]
drm/nouveau/secboot: add low-secure firmware hooks

Secure firmwares provided by NVIDIA will follow the same overall
principle, but may slightly differ in format, or not use the same
bootloader descriptor even on the same chip. In order to handle
this as gracefully as possible, turn the LS firmware functions into
hooks that can be overloaded as needed.

The current hooks cover the external firmware loading as well as the
bootloader descriptor generation.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: remove fixup_hs_desc hook
Alexandre Courbot [Wed, 14 Dec 2016 08:02:36 +0000 (17:02 +0900)]
drm/nouveau/secboot: remove fixup_hs_desc hook

This hook can be removed if the function writing the HS
descriptor is aware of WPR settings. Let's do that as it allows us to
make the ACR descriptor structure private and save some code.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: rename init() hook to oneinit()
Alexandre Courbot [Wed, 14 Dec 2016 08:02:35 +0000 (17:02 +0900)]
drm/nouveau/secboot: rename init() hook to oneinit()

The init() hook is called by the subdev's oneinit(). Rename it
accordingly to avoid confusion about the lifetime of objects allocated
in it.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: remove nvkm_secboot_start()
Alexandre Courbot [Tue, 13 Dec 2016 08:11:31 +0000 (17:11 +0900)]
drm/nouveau/secboot: remove nvkm_secboot_start()

Since GR has moved to using the falcon library to start the falcons,
this function is not needed anymore.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/gr/gf100: instantiate and reserve GR falcons
Alexandre Courbot [Tue, 13 Dec 2016 08:11:30 +0000 (17:11 +0900)]
drm/nouveau/gr/gf100: instantiate and reserve GR falcons

Create instances for the FECS and GPCCS falcons and use the init() and
fini() hooks to reserve them for as long as GR controls them.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/gr/gf100: split gf100_gr_init_ctxctl()
Alexandre Courbot [Tue, 13 Dec 2016 08:11:29 +0000 (17:11 +0900)]
drm/nouveau/gr/gf100: split gf100_gr_init_ctxctl()

gf100_gr_init_ctxctl() is basically two different functions (one for
use of internal firmware, the other for use of external firmware), but
its current layout makes it look more complex than it is. Split it to
better reflect that fact.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/gr: add fini() hook
Alexandre Courbot [Tue, 13 Dec 2016 08:11:28 +0000 (17:11 +0900)]
drm/nouveau/gr: add fini() hook

Add a fini() hook to the GR engine. This will be used by gf100+ to
properly release the FECS and GPCCS falcons.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: use falcon library
Alexandre Courbot [Tue, 13 Dec 2016 08:11:27 +0000 (17:11 +0900)]
drm/nouveau/secboot: use falcon library

Use the falcon library functions in secure boot. This removes a lot of
code and makes the secure boot flow easier to understand as no register
is directly accessed.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/secboot: fix functions definitions
Alexandre Courbot [Tue, 13 Dec 2016 08:11:26 +0000 (17:11 +0900)]
drm/nouveau/secboot: fix functions definitions

These functions should use the nvkm_secboot_falcon enum. Fix this.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/gm20b: add dummy PMU device
Alexandre Courbot [Tue, 13 Dec 2016 08:11:25 +0000 (17:11 +0900)]
drm/nouveau/gm20b: add dummy PMU device

Add a dummy PMU device so the PMU falcon is instanciated and can be used
by secure boot.

We could reuse gk20a's implementation here, but it would fight with
secboot over PMU falcon's ownership and secboot will reset the PMU,
preventing it from operating afterwards. Proper handout between secboot
and pmu is coming along with the actual gm20b PMU implementation, so
use this as a temporary solution.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/pmu/gk20a: use falcon library functions
Alexandre Courbot [Tue, 13 Dec 2016 08:11:24 +0000 (17:11 +0900)]
drm/nouveau/pmu/gk20a: use falcon library functions

Use the falcon library functions where relevant.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/pmu/gk20a: simplify code a bit
Alexandre Courbot [Tue, 13 Dec 2016 08:11:23 +0000 (17:11 +0900)]
drm/nouveau/pmu/gk20a: simplify code a bit

Some functions always succeed - change their return type to void and
remove the error-handling code in their caller.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/pmu/gk20a: use nvkm_pmu_ctor()
Alexandre Courbot [Tue, 13 Dec 2016 08:11:22 +0000 (17:11 +0900)]
drm/nouveau/pmu/gk20a: use nvkm_pmu_ctor()

Use the PMU constructor so that all base members (in particular the
falcon instance) are initialized properly.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/pmu: instanciate the falcon in PMU device
Alexandre Courbot [Tue, 13 Dec 2016 08:11:20 +0000 (17:11 +0900)]
drm/nouveau/pmu: instanciate the falcon in PMU device

Have an instance of nvkm_falcon in the PMU structure, ready to be used
by other subdevs (i.e. secboot).

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/pmu: add nvkm_pmu_ctor() function
Alexandre Courbot [Tue, 13 Dec 2016 08:11:21 +0000 (17:11 +0900)]
drm/nouveau/pmu: add nvkm_pmu_ctor() function

Add a PMU constructor so implementations that extend the nvkm_pmu
structure can have all base members properly initialized.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/core: add falcon library functions
Alexandre Courbot [Tue, 13 Dec 2016 08:11:19 +0000 (17:11 +0900)]
drm/nouveau/core: add falcon library functions

Falcon processors are used in various places of GPU chips. Although there
exist different versions of the falcon, and some variants exist, the
base set of actions performed on them is the same, which results in lots
of duplicated code.

This patch consolidates the current nvkm_falcon structure and extends it
with the following features:

* Ability for an engine to obtain and later release a given falcon,
* Abstractions for basic operations (IMEM/DMEM access, start, etc)
* Abstractions for secure operations if a falcon is secure

Abstractions make it easy to e.g. start a falcon, without having to care
about its details. For instance, falcons in secure mode need to be
started by writing to a different register.

Right now the abstractions variants only cover secure vs. non-secure
falcon, but more will come as e.g. SEC2 support is added.

This is still a WIP as other functions previously done by
engine/falcon.c need to be reimplemented. However this first step allows
to keep things simple and to discuss basic design.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/mc: add nvkm_mc_enabled() function
Alexandre Courbot [Tue, 13 Dec 2016 08:11:18 +0000 (17:11 +0900)]
drm/nouveau/mc: add nvkm_mc_enabled() function

Add a function that allows us to query whether a given subdev is
currently enabled or not.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agodrm/nouveau/core: constify nv*_printk macros
Alexandre Courbot [Tue, 13 Dec 2016 08:11:17 +0000 (17:11 +0900)]
drm/nouveau/core: constify nv*_printk macros

Constify the local variables declared in these macros so we can pass
const pointers to them.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7 years agoRevert "drm: Resurrect atomic rmfb code, v3"
Dave Airlie [Fri, 17 Feb 2017 02:38:46 +0000 (12:38 +1000)]
Revert "drm: Resurrect atomic rmfb code, v3"

This reverts commit 1592364de3912dad264262f4bcc61552984c9523.

This apparantly causes some regressions so pull it out for now.

Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoMerge tag 'omapdrm-4.11-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba...
Dave Airlie [Fri, 17 Feb 2017 02:04:09 +0000 (12:04 +1000)]
Merge tag 'omapdrm-4.11-fixes' of git://git./linux/kernel/git/tomba/linux into drm-next

omapdrm fixes for v4.11

Fix regressions:
- Planes might have been left enabled
- Scaling checks did not use the new config

Also limit downscaling decimation to prevent HW underflows.

* tag 'omapdrm-4.11-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux:
  drm/omapdrm: dispc: Refuse x-decimation above 4 for all but 8-bit formats
  drm/omapdrm: Move commit_modeset_enables() before commit_planes()
  Revert "drm: omapdrm: Let the DRM core skip plane commit on inactive CRTCs"

7 years agoMerge branch 'drm-next-4.11' of git://people.freedesktop.org/~agd5f/linux into drm...
Dave Airlie [Fri, 17 Feb 2017 01:55:12 +0000 (11:55 +1000)]
Merge branch 'drm-next-4.11' of git://people.freedesktop.org/~agd5f/linux into drm-next

Fixes for 4.11. Highlights:
- fix >2 displays on asics with 3 or 5 crtcs
- fix SI headless asics
- powerplay fixes for new polaris variants
- misc fixes

* 'drm-next-4.11' of git://people.freedesktop.org/~agd5f/linux:
  drm/amdgpu: fix warning on older gcc releases
  drm/ttm: make TTM_MAX_BO_PRIORITY unsigned
  drm/amd/amdgpu: Fix flow control in uvd_v4_2_stop()
  drm/amd/powerplay: add didt config table for polaris kicker
  drm/amd/powerplay: modify VddcPhase value for polaris kicker
  drm/amd/powerplay: add kicker flag into smumgr
  drm/amdgpu: Initialize pipe priority order on graphic initialization
  drm/amdgpu: read hw register to check pg status.
  drm/amdgpu: Add to initialization of mmVCE_VCPU_CNTL register
  drm/amdgpu/pm: check for headless before calling compute_clocks
  drm/amdgpu: use amdgpu_gem_va_check() in amdgpu_gem_va_update_vm()
  drm/amdgpu: add more cases to DCE11 possible crtc mask setup

7 years agodrm/amdgpu: fix warning on older gcc releases
Arnd Bergmann [Fri, 3 Feb 2017 16:47:26 +0000 (17:47 +0100)]
drm/amdgpu: fix warning on older gcc releases

gcc-4.8 warns about '{0}' being used an an initializer for nested structures:

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c: In function ‘gfx_v8_0_ring_emit_ce_meta_init’:
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c:7263:2: warning: missing braces around initializer [-Wmissing-braces]
  } ce_payload = {0};
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c: In function ‘gfx_v8_0_ring_emit_de_meta_init’:
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c:7290:2: warning: missing braces around initializer [-Wmissing-braces]
  } de_payload = {0};

Using an empty {} initializer however has the same effect and works on all versions.

Fixes: acad2b2a7b70 ("drm/amdgpu:implement CE/DE meta-init routines")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/ttm: make TTM_MAX_BO_PRIORITY unsigned
Nicolai Hähnle [Tue, 14 Feb 2017 10:06:52 +0000 (11:06 +0100)]
drm/ttm: make TTM_MAX_BO_PRIORITY unsigned

Fix a warning about different types in min() macro in amdgpu:

In file included from ./include/linux/list.h:8:0,
                 from drivers/gpu/drm/amd/amdgpu/amdgpu_object.c:32:
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c: In function ‘amdgpu_bo_create_restricted’:
./include/linux/kernel.h:739:16: warning: comparison of distinct pointer types lacks a cast
  (void) (&min1 == &min2);   \
                ^
./include/linux/kernel.h:742:2: note: in expansion of macro ‘__min’
  __min(typeof(x), typeof(y),   \
  ^~~~~
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c:434:21: note: in expansion of macro ‘min’
  bo->tbo.priority = min(bo->tbo.priority, TTM_MAX_BO_PRIORITY - 1);
                     ^~~

Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/amdgpu: Fix flow control in uvd_v4_2_stop()
Tom St Denis [Mon, 13 Feb 2017 19:11:40 +0000 (14:11 -0500)]
drm/amd/amdgpu: Fix flow control in uvd_v4_2_stop()

Break out of outer loop properly.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: add didt config table for polaris kicker
Huang Rui [Mon, 13 Feb 2017 02:38:08 +0000 (10:38 +0800)]
drm/amd/powerplay: add didt config table for polaris kicker

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: modify VddcPhase value for polaris kicker
Huang Rui [Fri, 10 Feb 2017 08:55:18 +0000 (16:55 +0800)]
drm/amd/powerplay: modify VddcPhase value for polaris kicker

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: add kicker flag into smumgr
Huang Rui [Fri, 10 Feb 2017 08:42:19 +0000 (16:42 +0800)]
drm/amd/powerplay: add kicker flag into smumgr

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/virtio: call drm_plane_cleanup() at destroy phase
Gustavo Padovan [Wed, 15 Feb 2017 18:00:08 +0000 (16:00 -0200)]
drm/virtio: call drm_plane_cleanup() at destroy phase

virtio was missing this call to clean up core plane usage.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/20170215180009.7091-1-gustavo@padovan.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agodrm/omapdrm: dispc: Refuse x-decimation above 4 for all but 8-bit formats
Jyri Sarha [Wed, 8 Feb 2017 14:08:06 +0000 (16:08 +0200)]
drm/omapdrm: dispc: Refuse x-decimation above 4 for all but 8-bit formats

Let's disable all scaling that requires horizontal decimation with
higher factor than 4, until we have better estimates of what we can
and can not do. However, NV12 color format appears to work Ok with
all decimation factors.

When decimating horizontally by more that 4 the dss is not able to
fetch the data in burst mode. When this happens it is hard to tell if
there enough bandwidth. Despite what theory says this appears to be
true also for 16-bit color formats.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
7 years agodrm/omapdrm: Move commit_modeset_enables() before commit_planes()
Jyri Sarha [Fri, 27 Jan 2017 10:04:55 +0000 (12:04 +0200)]
drm/omapdrm: Move commit_modeset_enables() before commit_planes()

Move drm_atomic_helper_commit_modeset_enables() call to before
drm_atomic_helper_commit_planes() call and have a
omap_atomic_wait_for_completion() call after both.

With the current dss dispc implementation we have to enable the new
modeset before we can commit planes. The dispc ovl configuration
relies on the video mode configuration been written into the HW when
the ovl configuration is calculated.

This approach is not ideal because after a mode change the plane
update is executed only after the first vblank interrupt. The dispc
implementation should be fixed so that it is able use uncommitted drm
state information.  information.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
7 years agoRevert "drm: omapdrm: Let the DRM core skip plane commit on inactive CRTCs"
Jyri Sarha [Fri, 27 Jan 2017 10:04:54 +0000 (12:04 +0200)]
Revert "drm: omapdrm: Let the DRM core skip plane commit on inactive CRTCs"

This reverts commit dadf4659d0608e034b6633f30300c2eff2dafb4c.

If planes are not disabled when the they are not on any crtc anymore
they will remain active and may show as "ghosts" when the crtc they
were last on is active again.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
7 years agodrm/i915: Fix not finding the VBT when it overlaps with OPREGION_ASLE_EXT
Hans de Goede [Tue, 14 Feb 2017 16:12:38 +0000 (18:12 +0200)]
drm/i915: Fix not finding the VBT when it overlaps with OPREGION_ASLE_EXT

If there is no OPREGION_ASLE_EXT then a VBT stored in mailbox #4 may
use the ASLE_EXT parts of the opregion. Adjust the vbt_size calculation
for a vbt in mailbox #4 for this.

This fixes the driver not finding the VBT on a jumper ezpad mini3
cherrytrail tablet and on a ACER SW5_017 machine.

Cc: stable@vger.kernel.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1487088758-30050-1-git-send-email-jani.nikula@intel.com
(cherry picked from commit dfb65e71ea2c1d97ac373cc0587dc60b3307581a)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
7 years agodrm/i915: Pass timeout==0 on to i915_gem_object_wait_fence()
Chris Wilson [Sun, 12 Feb 2017 21:53:43 +0000 (21:53 +0000)]
drm/i915: Pass timeout==0 on to i915_gem_object_wait_fence()

The i915_gem_object_wait_fence() uses an incoming timeout=0 to query
whether the current fence is busy or idle, without waiting. This can be
used by the wait-ioctl to implement a busy query.

Fixes: e95433c73a11 ("drm/i915: Rearrange i915_wait_request() accounting with callers")
Testcase: igt/gem_wait/basic-busy-write-all
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.william.auld@gmail.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: <drm-intel-fixes@lists.freedesktop.org> # v4.10-rc1+
Cc: stable@vger.kernel.org
Link: http://patchwork.freedesktop.org/patch/msgid/20170212215344.16600-1-chris@chris-wilson.co.uk
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
(cherry picked from commit d892e9398ecf6defc7972a62227b77dad6be20bd)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
7 years agodrm/i915/gvt: Disable access to stolen memory as a guest
Chris Wilson [Wed, 9 Nov 2016 10:39:05 +0000 (10:39 +0000)]
drm/i915/gvt: Disable access to stolen memory as a guest

Explicitly disable stolen memory when running as a guest in a virtual
machine, since the memory is not mediated between clients and reserved
entirely for the host. The actual size should be reported as zero, but
like every other quirk we want to tell the user what is happening.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99028
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20161109103905.17860-1-chris@chris-wilson.co.uk
Reviewed-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Cc: stable@vger.kernel.org
(cherry picked from commit 04a68a35ce6d7b54749989f943993020f48fed62)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
7 years agodrm/i915: Avoid spurious WARNs about the wrong pipe in the PPS code
Ville Syrjälä [Wed, 8 Feb 2017 17:52:54 +0000 (19:52 +0200)]
drm/i915: Avoid spurious WARNs about the wrong pipe in the PPS code

Until recently vlv_steal_power_sequencer() wasn't being called for
normal DP ports, and hence it could assert that it should only be
called for pipe A and B (since pipe C doesn't support eDP). However
that changed when we started to consider normal DP ports as well when
choosing a PPS. So we will now get spurious warnings when
vlv_steal_power_sequencer() does get called for pipe C. Avoid this by
moving the WARN down into vlv_detach_power_sequencer() where this
assertion should still hold.

Cc: Imre Deak <imre.deak@intel.com>
Cc: stable@vger.kernel.org
Fixes: 9f2bdb006a7e ("drm/i915: Prevent PPS stealing from a normal DP port on VLV/CHV")
References: https://bugs.freedesktop.org/show_bug.cgi?id=95287
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170208175254.10958-1-ville.syrjala@linux.intel.com
Reviewed-by: Imre Deak <imre.deak@intel.com>
(cherry picked from commit d158694f452252d0fef335a775aeb3eb74fe7af0)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
7 years agodrm/i915: Check for timeout completion when waiting for the rq to submitted
Chris Wilson [Wed, 8 Feb 2017 18:12:38 +0000 (18:12 +0000)]
drm/i915: Check for timeout completion when waiting for the rq to submitted

We first wait for a request to be submitted to hw and assigned a seqno,
before we can wait for the hw to signal completion (otherwise we don't
know the hw id we need to wait upon). Whilst waiting for the request to
be submitted, we may exceed the user's timeout and need to propagate the
error back.

v2: Make ETIME into an error from wait_for_execute for consistent exit
handling.

Reported-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Fixes: 4680816be336 ("drm/i915: Wait first for submission, before waiting for request completion")
Testcase: igt/gem_wait/basic-await
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: <drm-intel-fixes@lists.freedesktop.org> # v4.10-rc1+
Cc: stable@vger.kernel.org
Link: http://patchwork.freedesktop.org/patch/msgid/20170208181238.7232-1-chris@chris-wilson.co.uk
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
(cherry picked from commit 969bb72cbfd906d347cf76dc9b8c8dbaf83ba27a)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
7 years agodrm/i915: A hotfix for making aliasing PPGTT work for GVT-g
Zhi Wang [Wed, 8 Feb 2017 13:03:33 +0000 (21:03 +0800)]
drm/i915: A hotfix for making aliasing PPGTT work for GVT-g

This patch makes PPGTT page table non-shrinkable when using aliasing PPGTT
mode. It's just a temporary solution for making GVT-g work.

Fixes: 2ce5179fe826 ("drm/i915/gtt: Free unused lower-level page tables")
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: Michal Winiarski <michal.winiarski@intel.com>
Cc: Michel Thierry <michel.thierry@intel.com>
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
Cc: Zhiyuan Lv <zhiyuan.lv@intel.com>
Signed-off-by: Zhi Wang <zhi.a.wang@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1486559013-25251-2-git-send-email-zhi.a.wang@intel.com
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: <stable@vger.kernel.org> # v4.10
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
(cherry picked from commit e81ecb5e31db6c2a259d694738cf620d9fa70861)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
7 years agodrm/i915: Restore context and pd for ringbuffer submission after reset
Chris Wilson [Tue, 7 Feb 2017 15:24:37 +0000 (15:24 +0000)]
drm/i915: Restore context and pd for ringbuffer submission after reset

Following a reset, the context and page directory registers are lost.
However, the queue of requests that we resubmit after the reset may
depend upon them - the registers are restored from a context image, but
that restore may be inhibited and may simply be absent from the request
if it was in the middle of a sequence using the same context. If we
prime the CCID/PD registers with the first request in the queue (even
for the hung request), we prevent invalid memory access for the
following requests (and continually hung engines).

v2: Magic BIT(8), reserved for future use but still appears unused.
v3: Some commentary on handling innocent vs guilty requests
v4: Add a wait for PD_BASE fetch. The reload appears to be instant on my
Ivybridge, but this bit probably exists for a reason.

Fixes: 821ed7df6e2a ("drm/i915: Update reset path to fix incomplete requests")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170207152437.4252-1-chris@chris-wilson.co.uk
Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>
(cherry picked from commit c0dcb203fb009678e5be9e7782329dcfbbf16439)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
7 years agodrm/i915: Let execlist_update_context() cover !FULL_PPGTT mode.
Zhi Wang [Mon, 6 Feb 2017 10:37:16 +0000 (18:37 +0800)]
drm/i915: Let execlist_update_context() cover !FULL_PPGTT mode.

execlist_update_context() will try to update PDPs in a context before a
ELSP submission only for full PPGTT mode, while PDPs was populated during
context initialization. Now the latter code path is removed. Let
execlist_update_context() also cover !FULL_PPGTT mode.

Fixes: 34869776c76b ("drm/i915: check ppgtt validity when init reg state")
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: Michal Winiarski <michal.winiarski@intel.com>
Cc: Michel Thierry <michel.thierry@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
Cc: Zhiyuan Lv <zhiyuan.lv@intel.com>
Signed-off-by: Zhi Wang <zhi.a.wang@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1486377436-15380-1-git-send-email-zhi.a.wang@intel.com
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
(cherry picked from commit 04da811b3d821567e7a9a8a0baf48a6c1718b582)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
7 years agodrm/i915/lspcon: Fix resume time initialization due to unasserted HPD
Imre Deak [Fri, 27 Jan 2017 09:39:19 +0000 (11:39 +0200)]
drm/i915/lspcon: Fix resume time initialization due to unasserted HPD

During system resume time initialization the HPD level on LSPCON ports
can stay low for an extended amount of time, leading to failed AUX
transfers and LSPCON initialization. Fix this by waiting for HPD to get
asserted.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99178
Cc: Shashank Sharma <shashank.sharma@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: <stable@vger.kernel.org> # v4.9+
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1485509961-9010-3-git-send-email-imre.deak@intel.com
(cherry picked from commit 390b4e00241ce14ca3967c4698c8f6a158c5a674)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
7 years agodrm/i915/gen9+: Enable hotplug detection early
Imre Deak [Fri, 27 Jan 2017 09:39:18 +0000 (11:39 +0200)]
drm/i915/gen9+: Enable hotplug detection early

For LSPCON resume time initialization we need to sample the
corresponding pin's HPD level, but this is only available when HPD
detection is enabled. Currently we enable detection only when enabling
HPD interrupts which is too late, so bring the enabling of detection
earlier.

This is needed by the next patch.

Cc: Shashank Sharma <shashank.sharma@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: <stable@vger.kernel.org> # v4.9+
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Shashank Sharma <shashank.sharma@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1485509961-9010-2-git-send-email-imre.deak@intel.com
(cherry picked from commit 7fff8126d9cc902b2636d05d5d34894a75174993)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
7 years agodrm/i915: Reject set-tiling-ioctl with stride==0 and a tiling mode
Chris Wilson [Fri, 3 Feb 2017 10:56:52 +0000 (10:56 +0000)]
drm/i915: Reject set-tiling-ioctl with stride==0 and a tiling mode

In commit 957870f93412 ("drm/i915: Split out i915_gem_object_set_tiling()"),
I swapped an alignment check for IS_ALIGNED and in the process removed
the less-than check. That check turns out to be important as it was the
only rejection for stride == 0. Tvrtko did spot it, but I was
overconfident in the IS_ALIGNED() conversion.

Fixes: 957870f93412 ("drm/i915: Split out i915_gem_object_set_tiling()")
Testcase: igt/gem_tiling_max_stride
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170203105652.27819-1-chris@chris-wilson.co.uk
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
(cherry picked from commit 52da22e7aba155be238faff4f6e97b2eb9de64f3)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
7 years agodrm/i915: Recreate internal objects with single page segments if dmar fails
Chris Wilson [Thu, 2 Feb 2017 13:27:21 +0000 (13:27 +0000)]
drm/i915: Recreate internal objects with single page segments if dmar fails

If we fail to dma-map the object, the most common cause is lack of space
inside the SW-IOTLB due to fragmentation. If we recreate the_sg_table
using segments of PAGE_SIZE (and single page allocations), we may succeed
in remapping the scatterlist.

First became a significant problem for the mock selftests after commit
5584f1b1d73e ("drm/i915: fix i915 running as dom0 under Xen") increased
the max_order.

Fixes: 920cf4194954 ("drm/i915: Introduce an internal allocator for disposable private objects")
Fixes: 5584f1b1d73e ("drm/i915: fix i915 running as dom0 under Xen")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170202132721.12711-1-chris@chris-wilson.co.uk
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: <stable@vger.kernel.org> # v4.10
(cherry picked from commit bb96dcf5830e5d81a1da2e2a14e6c0f7dfc64348)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
7 years agoMerge tag 'gvt-next-2017-02-15' of https://github.com/01org/gvt-linux into drm-intel...
Jani Nikula [Thu, 16 Feb 2017 09:58:16 +0000 (11:58 +0200)]
Merge tag 'gvt-next-2017-02-15' of https://github.com/01org/gvt-linux into drm-intel-next-fixes

gvt-next-2017-02-15

- Chuanxiao's IOMMU workaround fix
- debug message cleanup from Changbin
- oops fix in fail path of workload submission when GPU reset from Changbin
- other misc fixes

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
7 years agoMerge tag 'gvt-next-2017-02-07' of https://github.com/01org/gvt-linux into drm-intel...
Jani Nikula [Thu, 16 Feb 2017 09:56:51 +0000 (11:56 +0200)]
Merge tag 'gvt-next-2017-02-07' of https://github.com/01org/gvt-linux into drm-intel-next-fixes

From Zhenyu, "These are GVT-g changes for 4.11 merge window, mostly for
gvt init order fix that impacted resource handling for device model, the
one i915 change has been reviewed and acked."

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
7 years agodma-buf/dma-fence: improve doc for dma_fence_add_callback()
Gustavo Padovan [Wed, 15 Feb 2017 17:57:25 +0000 (15:57 -0200)]
dma-buf/dma-fence: improve doc for dma_fence_add_callback()

Document return values for this function.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20170215175725.6692-1-gustavo@padovan.org
7 years agoMerge branch 'drm-rockchip-next-2017-02-16' of https://github.com/markyzq/kernel...
Dave Airlie [Thu, 16 Feb 2017 03:57:37 +0000 (13:57 +1000)]
Merge branch 'drm-rockchip-next-2017-02-16' of https://github.com/markyzq/kernel-drm-rockchip into drm-next

Use iommu for rockchip arm64 platform.

* 'drm-rockchip-next-2017-02-16' of https://github.com/markyzq/kernel-drm-rockchip:
  drm/rockchip: Use common IOMMU API to attach devices
  drm/rockchip: Do not use DMA mapping API if attached to IOMMU domain

7 years agoMerge tag 'drm-misc-next-fixes-2017-02-15' of git://anongit.freedesktop.org/git/drm...
Dave Airlie [Thu, 16 Feb 2017 03:27:55 +0000 (13:27 +1000)]
Merge tag 'drm-misc-next-fixes-2017-02-15' of git://anongit.freedesktop.org/git/drm-misc into drm-next

Fixes for the v4.11 merge window.

* tag 'drm-misc-next-fixes-2017-02-15' of git://anongit.freedesktop.org/git/drm-misc:
  drm: Resurrect atomic rmfb code, v3
  uapi: add missing install of dma-buf.h

7 years agoMerge tag 'sti-drm-next-2017-02-10' of https://github.com/vinceab/linux into drm...
Dave Airlie [Thu, 16 Feb 2017 03:27:24 +0000 (13:27 +1000)]
Merge tag 'sti-drm-next-2017-02-10' of https://github.com/vinceab/linux into drm-next

- remove deprecated stih416 chip functionnalities
- fix issues met around gdp panes
- fix STI driver unbind procedure
- DVI/HDMI mode is automatically detected
- allow fps statisitics resetting

* tag 'sti-drm-next-2017-02-10' of https://github.com/vinceab/linux:
  drm/sti: debug fps reset
  drm/sti: hdmi: automatically check DVI/HDMI mode
  drm/sti: unbind all components while driver cleanup
  drm/sti: do not post GDP command if no update
  drm/sti: do not set gdp pixel clock rate if mode is not set
  drm/sti: enable gdp pixel clock in atomic_update
  drm/sti: remove deprecated legacy vtg slave
  drm/sti: remove deprecated sink_term config
  drm/sti: do not check hw scaling if mode is not set
  drm/sti: Fix up crtc_state->event handling
  drm/sti: use atomic_helper for commit

7 years agodrm/vc4: Drop debug print at boot with DPI enabled.
Eric Anholt [Wed, 8 Feb 2017 20:47:01 +0000 (12:47 -0800)]
drm/vc4: Drop debug print at boot with DPI enabled.

Unlike the other encoders in the driver, I've also dropped the debug
dump function.  There's only really one register to this device, and
we have the debugfs reg entry still.

Signed-off-by: Eric Anholt <eric@anholt.net>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20170208204701.29013-1-eric@anholt.net
7 years agodrm: Resurrect atomic rmfb code, v3
Maarten Lankhorst [Wed, 25 Jan 2017 11:30:47 +0000 (12:30 +0100)]
drm: Resurrect atomic rmfb code, v3

This was somehow lost between v3 and the merged version in Maarten's
patch merged as:

commit f2d580b9a8149735cbc4b59c4a8df60173658140
Author: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Date:   Wed May 4 14:38:26 2016 +0200

    drm/core: Do not preserve framebuffer on rmfb, v4.

This introduces a slight behavioral change to rmfb. Instead of
disabling a crtc when the primary plane is disabled, we try to
preserve it.

Apart from old versions of the vmwgfx xorg driver, there is
nothing depending on rmfb disabling a crtc. Since vmwgfx is
a legacy driver we can safely only disable the plane with atomic.

If this commit is rejected by the driver then we will still fall
back to the old behavior and turn off the crtc.

v2:
- Remove plane->fb assignment, done by drm_atomic_clean_old_fb.
- Add WARN_ON when atomic_remove_fb fails.
- Always call drm_atomic_state_put.
v3:
- Use drm_drv_uses_atomic_modeset
- Handle the case where the first plane-disable-only commit fails
  with -EINVAL. Some drivers do not support this, fall back to
  disabling all crtc's in this case.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/66fc3da5-697b-1613-0a67-a5293209f0dc@linux.intel.com
7 years agodrm/rockchip: Use common IOMMU API to attach devices
Shunqian Zheng [Fri, 24 Jun 2016 02:13:32 +0000 (10:13 +0800)]
drm/rockchip: Use common IOMMU API to attach devices

Rockchip DRM used the arm special API, arm_iommu_*(), to attach
iommu for ARM32 SoCs. This patch convert to common iommu API
so it would support ARM64 like RK3399.

Since previous patch added support for direct IOMMU address space
management, there is no need to use DMA API anymore and this patch wires
things to use the new method.

Signed-off-by: Shunqian Zheng <zhengsq@rock-chips.com>
Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agodrm/rockchip: Do not use DMA mapping API if attached to IOMMU domain
Tomasz Figa [Fri, 24 Jun 2016 02:13:31 +0000 (10:13 +0800)]
drm/rockchip: Do not use DMA mapping API if attached to IOMMU domain

The API is not suitable for subsystems consisting of multiple devices
and requires severe hacks to use it. To mitigate this, this patch
implements allocation and address space management locally by using
helpers provided by DRM framework, like other DRM drivers do, e.g.
Tegra.

This patch should not introduce any functional changes until the driver
is made to attach subdevices into an IOMMU domain with the generic IOMMU
API, which will happen in following patch. Based heavily on GEM
implementation of Tegra DRM driver.

Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Shunqian Zheng <zhengsq@rock-chips.com>
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
Signed-off-by: rjan Eide <orjan.eide@arm.com>
7 years agodrm: Reduce EDID warnings from DRM_ERROR to DRM_NOTE
Chris Wilson [Fri, 10 Feb 2017 19:59:13 +0000 (19:59 +0000)]
drm: Reduce EDID warnings from DRM_ERROR to DRM_NOTE

The warnings from parsing the EDID are not driver errors, but the
"normal but significant" conditions from the external device. As such,
they do not need the ferocity of an *ERROR*, but can use the less harsh
DRM_NOTE instead.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20170210195913.9878-1-chris@chris-wilson.co.uk
7 years agouapi: add missing install of dma-buf.h
Denys Dmytriyenko [Tue, 14 Feb 2017 20:00:47 +0000 (15:00 -0500)]
uapi: add missing install of dma-buf.h

As part of c11e391da2a8fe973c3c2398452000bed505851e "dma-buf: Add ioctls to
allow userspace to flush" a new uapi header file dma-buf.h was added, but an
entry was not added on Kbuild to install it. This patch resolves this omission
so that "make headers_install" installs this header.

Signed-off-by: Denys Dmytriyenko <denys@ti.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: David Herrmann <dh.herrmann@gmail.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Tiago Vignatti <tiago.vignatti@intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1487102447-59265-1-git-send-email-denis@denix.org
7 years agodrm: ensure atomic messages consistently include the name of the component
Russell King [Mon, 13 Feb 2017 12:27:03 +0000 (12:27 +0000)]
drm: ensure atomic messages consistently include the name of the component

Most DRM messages include three pieces of information: the type of the
component (CRTC, ENCODER, CONNECTOR etc), the DRM object ID of the
component, and the component name.  However, there are some messages
which omit the last piece of identifying information.  This makes it
harder to debug failures when these messages are printed, because the
DRM object ID doesn't supply enough information to know which piece of
hardware had a problem.

Update the atomic modeset code to always print the component name along
with the type and DRM object ID.

Fixes: 4cba68507cf5 ("drm/atomic-helper: Reject legacy flips on a disabled pipe")
Fixes: 8d4d0d700dda ("drm/atomic-helper: Print an error if vblank wait times out")
Fixes: 5481c8fb1da2 ("drm/atomic-helper: Check encoder/crtc constraints")
Fixes: 99cf4a29fa24 ("drm/atomic: Add current-mode blob to CRTC state")
Fixes: cc4ceb484b37 ("drm: Global atomic state handling")
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Acked-by: Thierry Reding <treding@nvidia.com>
[danvet: Wiggle in conflicting hunk.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
7 years agodrm/msm/dsi: fix error return code in msm_dsi_host_init()
Wei Yongjun [Thu, 9 Feb 2017 15:19:07 +0000 (15:19 +0000)]
drm/msm/dsi: fix error return code in msm_dsi_host_init()

Fix to return error code -ENOMEM from the malloc error handling
case instead of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20170209151907.28800-1-weiyj.lk@gmail.com
7 years agodrm/atomic: Use new atomic iterator macros.
Maarten Lankhorst [Mon, 16 Jan 2017 09:37:40 +0000 (10:37 +0100)]
drm/atomic: Use new atomic iterator macros.

For consistency and all that, roll them out.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1484559464-27107-4-git-send-email-maarten.lankhorst@linux.intel.com
7 years agodrm/atomic: Make add_affected_connectors look at crtc_state.
Maarten Lankhorst [Mon, 16 Jan 2017 09:37:39 +0000 (10:37 +0100)]
drm/atomic: Make add_affected_connectors look at crtc_state.

This kills another dereference of connector->state. connector_mask
holds all unchanged connectors at least and any changed connectors
are already in state anyway.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1484559464-27107-3-git-send-email-maarten.lankhorst@linux.intel.com
7 years agodrm/atomic: Add new iterators over all state, v3.
Maarten Lankhorst [Mon, 16 Jan 2017 09:37:38 +0000 (10:37 +0100)]
drm/atomic: Add new iterators over all state, v3.

Add for_each_(old)(new)_(plane,connector,crtc)_in_state iterators to
replace the old for_each_xxx_in_state ones. This is useful for >1 flip
depth and getting rid of all xxx->state dereferences.

This requires extra fixups done when committing a state after
duplicating, which in general isn't valid but is used by suspend/resume.
To handle these, introduce drm_atomic_helper_commit_duplicated_state
which performs those fixups before checking & committing the state.

Changes since v1:
- Remove nonblock parameter for commit_duplicated_state.
Changes since v2:
- Use commit_duplicated_state for i915 load detection.
- Add WARN_ON(old_state != obj->state) before swapping.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1484559464-27107-2-git-send-email-maarten.lankhorst@linux.intel.com
7 years agodrm/i915/gvt: return error code if dma map iova failed
Chuanxiao Dong [Tue, 14 Feb 2017 09:15:54 +0000 (17:15 +0800)]
drm/i915/gvt: return error code if dma map iova failed

When doing dma map failed for a pfn, kvmgt should unpin the
pfn and return error code to device module driver

Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com>
Cc: xinda.zhao@intel.com
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
7 years agodrm/i915/gvt: optimize the inhibit context mmio load
Chuanxiao Dong [Tue, 14 Feb 2017 07:14:05 +0000 (15:14 +0800)]
drm/i915/gvt: optimize the inhibit context mmio load

For the inhibit ctx, load all mmio in render mmio list
into HW by MMIO write for ctx initialization.

For the none-inhibit ctx, only load the render mmio which
is not in_context into HW by MMIO write. Skip the MMIO write
for in_context mmio as context image will load it.

Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
7 years agodrm/i915/gvt: add sprite plane flip done support.
Xu Han [Tue, 14 Feb 2017 06:50:47 +0000 (14:50 +0800)]
drm/i915/gvt: add sprite plane flip done support.

* Add flip done event support for sprite plane on SKL platform.
* Fix bug #1452, "Call Trace:handle_default_event_virt+0xef/0x100
[i915]" while booting up guest.

Signed-off-by: Xu Han <xu.han@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
7 years agodrm/i915/gvt: add missing display part reset for vGPU reset
Changbin Du [Tue, 14 Feb 2017 06:50:18 +0000 (14:50 +0800)]
drm/i915/gvt: add missing display part reset for vGPU reset

We also need reset vGPU virtual display emulation. Since all vreg has
been cleared, we need reset display related vreg to reflect our display
setting.

Signed-off-by: Changbin Du <changbin.du@intel.com>
Cc: Ping Gao <ping.a.gao@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
7 years agodrm/i915/gvt: Fix shadow context descriptor
Zhenyu Wang [Mon, 13 Feb 2017 09:07:19 +0000 (17:07 +0800)]
drm/i915/gvt: Fix shadow context descriptor

We need to be careful to only update addr mode for gvt shadow context
descriptor but keep other valid config. This fixes GPU hang caused by
invalid descriptor submitted for gvt workload.

Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
7 years agodrm/i915/gvt: Fix alignment for GTT allocation
Zhenyu Wang [Mon, 13 Feb 2017 06:31:13 +0000 (14:31 +0800)]
drm/i915/gvt: Fix alignment for GTT allocation

We need to properly setup alignment for GTT start/end/size
as required. Fixed warning from i915 gem.

Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
7 years agodrm/amdgpu: Initialize pipe priority order on graphic initialization
ozeng [Fri, 10 Feb 2017 23:55:36 +0000 (17:55 -0600)]
drm/amdgpu: Initialize pipe priority order on graphic initialization

Initialized PIPE_ORDER_TS0/1/2/3 field of SPI_ARB_PRIORITY register to 2.
This set the pipe priority order to:
02 - HP3D, CS_H, GFX, CS_M, CS_L

Signed-off-by: Oak Zeng <Oak.Zeng@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: read hw register to check pg status.
Rex Zhu [Wed, 8 Feb 2017 09:17:55 +0000 (17:17 +0800)]
drm/amdgpu: read hw register to check pg status.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: Add to initialization of mmVCE_VCPU_CNTL register
Alan Harrison [Thu, 9 Feb 2017 21:01:57 +0000 (16:01 -0500)]
drm/amdgpu: Add to initialization of mmVCE_VCPU_CNTL register

Add a bit needed during initialization into the driver, where it is supposed
to be.  Currently, this is happening in the VCE firmware, and although
functional, this is the correct place to perform this initialization.

Reviewed-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Alan Harrison <Alan.Harrison@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/bridge/tfp410: Make symbol tfp410_platform_driver static
Wei Yongjun [Thu, 9 Feb 2017 15:25:49 +0000 (15:25 +0000)]
drm/bridge/tfp410: Make symbol tfp410_platform_driver static

Fixes the following sparse warning:

drivers/gpu/drm/bridge/ti-tfp410.c:223:24: warning:
 symbol 'tfp410_platform_driver' was not declared. Should it be static?

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20170209152549.30711-1-weiyj.lk@gmail.com
7 years agoLinux 4.10-rc8 v4.10-rc8
Linus Torvalds [Sun, 12 Feb 2017 21:03:20 +0000 (13:03 -0800)]
Linux 4.10-rc8

7 years agodrm: Constify drm_mode_config atomic helper private pointer
Laurent Pinchart [Mon, 2 Jan 2017 09:16:13 +0000 (11:16 +0200)]
drm: Constify drm_mode_config atomic helper private pointer

The drm_mode_config helper private field points to a structure of
function pointers that don't need to be modified at runtime. Make it
const.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
Acked-by: Brian Starkey <brian.starkey@arm.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20170102091613.6310-1-laurent.pinchart@ideasonboard.com
7 years agoMerge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sat, 11 Feb 2017 18:31:46 +0000 (10:31 -0800)]
Merge branch 'x86-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull x86 fixes from Ingo Molnar:
 "Last minute x86 fixes:

   - Fix a softlockup detector warning and long delays if using ptdump
     with KASAN enabled.

   - Two more TSC-adjust fixes for interesting firmware interactions.

   - Two commits to fix an AMD CPU topology enumeration bug that caused
     a measurable gaming performance regression"

* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/mm/ptdump: Fix soft lockup in page table walker
  x86/tsc: Make the TSC ADJUST sanitizing work for tsc_reliable
  x86/tsc: Avoid the large time jump when sanitizing TSC ADJUST
  x86/CPU/AMD: Fix Zen SMT topology
  x86/CPU/AMD: Bring back Compute Unit ID

7 years agoMerge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sat, 11 Feb 2017 18:24:16 +0000 (10:24 -0800)]
Merge branch 'timers-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull timer fix from Ingo Molnar:
 "Fix a sporadic missed timer hw reprogramming bug that can result in
  random delays"

* 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  tick/nohz: Fix possible missing clock reprog after tick soft restart

7 years agoMerge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sat, 11 Feb 2017 18:20:06 +0000 (10:20 -0800)]
Merge branch 'perf-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull perf fixes from Ingo Molnar:
 "A kernel crash fix plus three tooling fixes"

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  perf/core: Fix crash in perf_event_read()
  perf callchain: Reference count maps
  perf diff: Fix -o/--order option behavior (again)
  perf diff: Fix segfault on 'perf diff -o N' option

7 years agoMerge branch 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sat, 11 Feb 2017 18:16:05 +0000 (10:16 -0800)]
Merge branch 'locking-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull lockdep fix from Ingo Molnar:
 "This fixes an ugly lockdep stack trace output regression. (But also
  affects other stacktrace users such as kmemleak, KASAN, etc)"

* 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  stacktrace, lockdep: Fix address, newline ugliness

7 years agoMerge branch 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sat, 11 Feb 2017 18:14:24 +0000 (10:14 -0800)]
Merge branch 'irq-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull irq fixes from Ingo Molnar:
 "Two last minute ARM irqchip driver fixes"

* 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  irqchip/mxs: Enable SKIP_SET_WAKE and MASK_ON_SUSPEND
  irqchip/keystone: Fix "scheduling while atomic" on rt

7 years agoMerge branch 'for-linus-4.10' of git://git.kernel.org/pub/scm/linux/kernel/git/mason...
Linus Torvalds [Sat, 11 Feb 2017 17:15:58 +0000 (09:15 -0800)]
Merge branch 'for-linus-4.10' of git://git./linux/kernel/git/mason/linux-btrfs

Pull btrfs fixes from Chris Mason:
 "This has two last minute fixes. The highest priority here is a
  regression fix for the decompression code, but we also fixed up a
  problem with the 32-bit compat ioctls.

  The decompression bug could hand back the wrong data on big reads when
  zlib was used. I have a larger cleanup to make the math here less
  error prone, but at this stage in the release Omar's patch is the best
  choice"

* 'for-linus-4.10' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
  btrfs: fix btrfs_decompress_buf2page()
  btrfs: fix btrfs_compat_ioctl failures on non-compat ioctls

7 years agoMerge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Linus Torvalds [Sat, 11 Feb 2017 17:01:03 +0000 (09:01 -0800)]
Merge tag 'scsi-fixes' of git://git./linux/kernel/git/jejb/scsi

Pull SCSI fixes from James Bottomley:
 "Six fairly small fixes. None is a real show stopper, two automation
  detected problems: one memory leak, one use after free and four others
  each of which fixes something that has been a significant source of
  annoyance to someone"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  scsi: zfcp: fix use-after-free by not tracing WKA port open/close on failed send
  scsi: aacraid: Fix INTx/MSI-x issue with older controllers
  scsi: mpt3sas: disable ASPM for MPI2 controllers
  scsi: mpt3sas: Force request partial completion alignment
  scsi: qla2xxx: Avoid that issuing a LIP triggers a kernel crash
  scsi: qla2xxx: Fix a recently introduced memory leak

7 years agoBtrfs: fix btrfs_decompress_buf2page()
Omar Sandoval [Fri, 10 Feb 2017 23:03:35 +0000 (15:03 -0800)]
Btrfs: fix btrfs_decompress_buf2page()

If btrfs_decompress_buf2page() is handed a bio with its page in the
middle of the working buffer, then we adjust the offset into the working
buffer. After we copy into the bio, we advance the iterator by the
number of bytes we copied. Then, we have some logic to handle the case
of discontiguous pages and adjust the offset into the working buffer
again. However, if we didn't advance the bio to a new page, we may enter
this case in error, essentially repeating the adjustment that we already
made when we entered the function. The end result is bogus data in the
bio.

Previously, we only checked for this case when we advanced to a new
page, but the conversion to bio iterators changed that. This restores
the old, correct behavior.

A case I saw when testing with zlib was:

    buf_start = 42769
    total_out = 46865
    working_bytes = total_out - buf_start = 4096
    start_byte = 45056

The condition (total_out > start_byte && buf_start < start_byte) is
true, so we adjust the offset:

    buf_offset = start_byte - buf_start = 2287
    working_bytes -= buf_offset = 1809
    current_buf_start = buf_start = 42769

Then, we copy

    bytes = min(bvec.bv_len, PAGE_SIZE - buf_offset, working_bytes) = 1809
    buf_offset += bytes = 4096
    working_bytes -= bytes = 0
    current_buf_start += bytes = 44578

After bio_advance(), we are still in the same page, so start_byte is the
same. Then, we check (total_out > start_byte && current_buf_start < start_byte),
which is true! So, we adjust the values again:

    buf_offset = start_byte - buf_start = 2287
    working_bytes = total_out - start_byte = 1809
    current_buf_start = buf_start + buf_offset = 45056

But note that working_bytes was already zero before this, so we should
have stopped copying.

Fixes: 974b1adc3b10 ("btrfs: use bio iterators for the decompression handlers")
Reported-by: Pat Erley <pat-lkml@erley.org>
Reviewed-by: Chris Mason <clm@fb.com>
Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: Chris Mason <clm@fb.com>
Reviewed-by: Liu Bo <bo.li.liu@oracle.com>
Tested-by: Liu Bo <bo.li.liu@oracle.com>
7 years agodrm/amdgpu/pm: check for headless before calling compute_clocks
Alex Deucher [Fri, 10 Feb 2017 23:09:32 +0000 (18:09 -0500)]
drm/amdgpu/pm: check for headless before calling compute_clocks

Don't update display bandwidth on headless asics.

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

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
7 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Linus Torvalds [Fri, 10 Feb 2017 22:44:49 +0000 (14:44 -0800)]
Merge git://git./linux/kernel/git/davem/net

Pull networking fixes from David Miller:

 1) If the timing is wrong we can indefinitely stop generating new ipv6
    temporary addresses, from Marcus Huewe.

 2) Don't double free per-cpu stats in ipv6 SIT tunnel driver, from Cong
    Wang.

 3) Put protections in place so that AF_PACKET is not able to submit
    packets which don't even have a link level header to drivers. From
    Willem de Bruijn.

 4) Fix memory leaks in ipv4 and ipv6 multicast code, from Hangbin Liu.

 5) Don't use udp_ioctl() in l2tp code, UDP version expects a UDP socket
    and that doesn't go over very well when it is passed an L2TP one.
    Fix from Eric Dumazet.

 6) Don't crash on NULL pointer in phy_attach_direct(), from Florian
    Fainelli.

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net:
  l2tp: do not use udp_ioctl()
  xen-netfront: Delete rx_refill_timer in xennet_disconnect_backend()
  NET: mkiss: Fix panic
  net: hns: Fix the device being used for dma mapping during TX
  net: phy: Initialize mdio clock at probe function
  igmp, mld: Fix memory leak in igmpv3/mld_del_delrec()
  xen-netfront: Improve error handling during initialization
  sierra_net: Skip validating irrelevant fields for IDLE LSIs
  sierra_net: Add support for IPv6 and Dual-Stack Link Sense Indications
  kcm: fix 0-length case for kcm_sendmsg()
  xen-netfront: Rework the fix for Rx stall during OOM and network stress
  net: phy: Fix PHY module checks and NULL deref in phy_attach_direct()
  net: thunderx: Fix PHY autoneg for SGMII QLM mode
  net: dsa: Do not destroy invalid network devices
  ping: fix a null pointer dereference
  packet: round up linear to header len
  net: introduce device min_header_len
  sit: fix a double free on error path
  lwtunnel: valid encap attr check should return 0 when lwtunnel is disabled
  ipv6: addrconf: fix generation of new temporary addresses

7 years agoMerge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma
Linus Torvalds [Fri, 10 Feb 2017 22:41:16 +0000 (14:41 -0800)]
Merge tag 'for-linus' of git://git./linux/kernel/git/dledford/rdma

Pull rdma fixes from Doug Ledford:
 "Third round of -rc fixes for 4.10 kernel:

   - two security related issues in the rxe driver

   - one compile issue in the RDMA uapi header"

* tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma:
  RDMA: Don't reference kernel private header from UAPI header
  IB/rxe: Fix mem_check_range integer overflow
  IB/rxe: Fix resid update

7 years agoMerge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa...
Linus Torvalds [Fri, 10 Feb 2017 22:39:08 +0000 (14:39 -0800)]
Merge branch 'i2c/for-current' of git://git./linux/kernel/git/wsa/linux

Pull i2c bugfixes from Wolfram Sang:
 "Two bugfixes (proper IO mapping and use of mutex) for a driver feature
  we introduced in this cycle"

* 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
  i2c: piix4: Request the SMBUS semaphore inside the mutex
  i2c: piix4: Fix request_region size