openwrt/staging/blogic.git
8 years agodrm/amdgpu/powerplay: include asm/div64.h for do_div()
Stephen Rothwell [Thu, 31 Dec 2015 10:20:20 +0000 (21:20 +1100)]
drm/amdgpu/powerplay: include asm/div64.h for do_div()

Fixes: 1e4854e96c35 ("drm/amdgpu/powerplay: implement thermal control for tonga.")
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agoMerge branch 'linux-4.5' of git://github.com/skeggsb/linux into drm-next
Dave Airlie [Mon, 11 Jan 2016 01:48:18 +0000 (11:48 +1000)]
Merge branch 'linux-4.5' of git://github.com/skeggsb/linux into drm-next

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

fdo#93634

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

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

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

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

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

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

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

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

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

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

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

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

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

From DCB 4.1 spec.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/nvif: split out nvsw interface definitons
Ben Skeggs [Sun, 8 Nov 2015 00:34:50 +0000 (10:34 +1000)]
drm/nouveau/nvif: split out nvsw interface definitons

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

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/nvif: move internal class identifiers to class.h
Ben Skeggs [Sun, 8 Nov 2015 00:18:19 +0000 (10:18 +1000)]
drm/nouveau/nvif: move internal class identifiers to class.h

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/gr/gm107-: make use of gpc_addr() macro for tpc ramchain setup
Ben Skeggs [Sun, 22 Nov 2015 19:28:52 +0000 (05:28 +1000)]
drm/nouveau/gr/gm107-: make use of gpc_addr() macro for tpc ramchain setup

Should be no functional change here.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/instmem/gk20a: use DMA API CPU mapping
Alexandre Courbot [Wed, 11 Nov 2015 08:07:51 +0000 (17:07 +0900)]
drm/nouveau/instmem/gk20a: use DMA API CPU mapping

Commit 69c4938249fb ("drm/nouveau/instmem/gk20a: use direct CPU access")
tried to be smart while using the DMA-API by managing the CPU mappings of
buffers allocated with the DMA-API by itself. In doing so, it relied
on dma_to_phys() which is an architecture-private function not
available everywhere. This broke the build on several architectures.

Since there is no reliable and portable way to obtain the physical
address of a DMA-API buffer, stop trying to be smart and just use the
CPU mapping that the DMA-API can provide. This means that buffers will
be CPU-mapped for all their life as opposed to when we need them, but
anyway using the DMA-API here is a fallback for when no IOMMU is
available so we should not expect optimal behavior.

This makes the IOMMU and DMA-API implementations of instmem diverge
enough that we should maybe put them into separate files...

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/instmem/gk20a: fix race conditions
Alexandre Courbot [Mon, 9 Nov 2015 07:37:53 +0000 (16:37 +0900)]
drm/nouveau/instmem/gk20a: fix race conditions

The LRU list used for recycling CPU mappings was handling concurrency
very poorly. For instance, if an instobj was acquired twice before being
released once, it would end up into the LRU list even though there is
still a client accessing it.

This patch fixes this by properly counting how many clients are
currently using a given instobj.

While at it, we also raise errors when inconsistencies are detected, and
factorize some code.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/gk20a: Add MODULE_FIRMWARE for gk20a
Nicolas Chauvet [Mon, 28 Sep 2015 15:08:13 +0000 (17:08 +0200)]
drm/nouveau/gk20a: Add MODULE_FIRMWARE for gk20a

This patch is needed by initramfs tools to detect
the required firmware files for the module.

This patch tests for either TEGRA_124_SOC or TEGRA_132_SOC
for the firmwares related to the Tegra K1 generation.

v2: move the MODULE_FIRMWARE to the nvidia_platform.c file.
 This will avoid to test for NOUVEAU_PLATFORM_DRIVER

Signed-off-by: Nicolas Chauvet <kwizart@gmail.com>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/fifo/gk104: fix engine status register offset
Vince Hsu [Mon, 16 Nov 2015 07:38:30 +0000 (15:38 +0800)]
drm/nouveau/fifo/gk104: fix engine status register offset

The offset should be 8 on Kepler and later.

Signed-off-by: Vince Hsu <vinceh@nvidia.com>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/ce/gk104: attempt at better handling of LAUNCHERR
Ben Skeggs [Wed, 11 Nov 2015 03:06:10 +0000 (13:06 +1000)]
drm/nouveau/ce/gk104: attempt at better handling of LAUNCHERR

Very rough, no idea how correct it is at this point, but it prevents
getteximage-depth from piglit from hanging the GPU.

v2: updated with NV_PCE_FE_LAUNCHERR_REPORT values provided by NVIDIA

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/fifo/gf100: fix race condition when updating engine runlists
Ben Skeggs [Wed, 11 Nov 2015 00:07:22 +0000 (10:07 +1000)]
drm/nouveau/fifo/gf100: fix race condition when updating engine runlists

Similar in spirit to the gk104 fix with a similar title.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/fifo/gk104: fix race condition when updating engine runlists
Ben Skeggs [Tue, 10 Nov 2015 23:37:05 +0000 (09:37 +1000)]
drm/nouveau/fifo/gk104: fix race condition when updating engine runlists

The CPU-side tracking of engine runlists was not protected by a lock,
leading to list corruption, eventually causing runlist_update() to
overrun the GPU-side runlist, triggering an OOPS.

Fixes some of the issues noticed during parallel piglit runs.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/nvkm: add/remove 0's to make 7 (or 9)-nibble constants use 8 nibbles
Ilia Mirkin [Thu, 5 Nov 2015 07:33:40 +0000 (02:33 -0500)]
drm/nouveau/nvkm: add/remove 0's to make 7 (or 9)-nibble constants use 8 nibbles

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/kms: no need to check for empty edid before drm_detect_hdmi_monitor
Ilia Mirkin [Wed, 4 Nov 2015 02:14:26 +0000 (21:14 -0500)]
drm/nouveau/kms: no need to check for empty edid before drm_detect_hdmi_monitor

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/core: fix return in error path of device probe
Alexandre Courbot [Mon, 26 Oct 2015 05:55:37 +0000 (14:55 +0900)]
drm/nouveau/core: fix return in error path of device probe

We want to unlock nv_devices_mutex in this error path as well.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/kms: allow 225/297MHz pixel clocks for HDMI on Fermi/Kepler
Ilia Mirkin [Wed, 4 Nov 2015 02:00:11 +0000 (21:00 -0500)]
drm/nouveau/kms: allow 225/297MHz pixel clocks for HDMI on Fermi/Kepler

Some Fermi's apparently alow allow 297MHz clocks, so create a parameter
which allows end-users to set it themselves until we have a reliable way
to determine the board's maximum pixel clocks.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agodrm/nouveau/disp: activate dual link TMDS links only when possible
Hauke Mehrtens [Wed, 4 Nov 2015 02:00:10 +0000 (21:00 -0500)]
drm/nouveau/disp: activate dual link TMDS links only when possible

Without this patch a pixel clock rate above 165 MHz on a TMDS link is
assumed to be dual link. This is true for DVI, but not for HDMI. HDMI
supports no dual link, but it supports pixel clock rates above 165 MHz.
Only activate Dual Link mode when it is actually possible and requested.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
[imirkin: check for hdmi monitor for computing proto, use sor ctrl to
 enable extra config bit]
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8 years agoMerge branch 'drm-next-4.5' of git://people.freedesktop.org/~agd5f/linux into drm...
Dave Airlie [Mon, 11 Jan 2016 00:00:38 +0000 (10:00 +1000)]
Merge branch 'drm-next-4.5' of git://people.freedesktop.org/~agd5f/linux into drm-next

Misc fixes for amdgpu and radeon for 4.5.  The bulk of the changes
are smatch fixes and cleanups.  This also includes the DP MST fixes
from Mykola.  Beyond that some fixes from Christian to avoid -ENOMEM
errors in some corner cases in the CS ioctl, some suspend and resume
fixes, and some powerplay fixes.

* 'drm-next-4.5' of git://people.freedesktop.org/~agd5f/linux: (33 commits)
  drm/radeon: fix trivial typo in warning message
  radeon: r100: Silence 'may be used uninitialized' warnings
  drm/amdgpu: add warning to amdgpu_bo_gpu_offset() v2
  drm/amd/powerplay: implement power down asic task for CZ
  drm/amd/powerplay: enable power down asic task. (v2)
  drm/amd/powerplay: enable set boot state task
  drm/amd/powerplay: add thermal control task when resume.
  drm/amdgpu: fix hex/decimal bug when show gpu load.
  drm/amdgpu: Show gpu load when display gpu performance for Fiji of VI.
  drm/amdgpu: Show gpu load when display gpu performance for Ci.
  drm/amd/powerplay: Reload and initialize the smc firmware on powerplay resume.
  drm/amd/powerplay: add powerplay valid check to avoid null point. (v2)
  drm/amd/powerplay: fix Smatch static checker warnings
  drm/amd/powerplay: fix Smatch static checker warnings with indenting (v2)
  drm/amd/powerplay: fix bug that NULL checks are reversed.
  amdgpu/dce11:  Add test for crtc < 0 to various DCEv11 functions
  amdgpu/dce11: Remove division from dce_v11_0_vblank_wait()
  amdgpu/vce3: Simplify vce_v3_0_hw_init and ensure both rings default to not ready.
  amdgpu/vce3: Remove magic constants from harvest register masks.
  amdgpu/vce3: Simplify vce_v3_0_process_interrupt()
  ...

8 years agodrm/radeon: fix trivial typo in warning message
Alexandre Demers [Fri, 8 Jan 2016 00:22:44 +0000 (19:22 -0500)]
drm/radeon: fix trivial typo in warning message

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alexandre Demers <alexandre.f.demers@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agoradeon: r100: Silence 'may be used uninitialized' warnings
Tim Gardner [Thu, 7 Jan 2016 17:31:32 +0000 (10:31 -0700)]
radeon: r100: Silence 'may be used uninitialized' warnings

  CC [M]  drivers/gpu/drm/radeon/r100.o
In file included from drivers/gpu/drm/radeon/radeon_mode.h:37:0,
                 from drivers/gpu/drm/radeon/radeon.h:80,
                 from drivers/gpu/drm/radeon/r100.c:33:
drivers/gpu/drm/radeon/r100.c: In function 'r100_bandwidth_update':
include/drm/drm_fixed.h:64:13: warning: 'crit_point_ff.full' may be used uninitialized in this function [-Wmaybe-uninitialized]
  u64 tmp = ((u64)A.full << 13);
             ^
drivers/gpu/drm/radeon/r100.c:3153:63: note: 'crit_point_ff.full' was declared here
  fixed20_12 peak_disp_bw, mem_bw, pix_clk, pix_clk2, temp_ff, crit_point_ff;
                                                               ^
drivers/gpu/drm/radeon/r100.c:3583:42: warning: 'disp_drain_rate.full' may be used uninitialized in this function [-Wmaybe-uninitialized]
     temp_ff.full = read_return_rate.full - disp_drain_rate.full;

gcc version 5.3.1 20151219 (Ubuntu 5.3.1-4ubuntu1)

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: David Airlie <airlied@linux.ie>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: add warning to amdgpu_bo_gpu_offset() v2
Christian König [Tue, 15 Dec 2015 10:10:30 +0000 (11:10 +0100)]
drm/amdgpu: add warning to amdgpu_bo_gpu_offset() v2

Check if there really is a valid offset for the BO.

v2: user WARN_ON_ONCE

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com> (v1)
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amd/powerplay: implement power down asic task for CZ
Rex Zhu [Tue, 29 Dec 2015 03:23:16 +0000 (11:23 +0800)]
drm/amd/powerplay: implement power down asic task for CZ

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>
8 years agodrm/amd/powerplay: enable power down asic task. (v2)
Rex Zhu [Tue, 29 Dec 2015 03:22:34 +0000 (11:22 +0800)]
drm/amd/powerplay: enable power down asic task. (v2)

v2: AGD: rebase on upstream

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>
8 years agodrm/amd/powerplay: enable set boot state task
Rex Zhu [Tue, 29 Dec 2015 03:19:14 +0000 (11:19 +0800)]
drm/amd/powerplay: enable set boot state task

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>
8 years agodrm/amd/powerplay: add thermal control task when resume.
Rex Zhu [Tue, 29 Dec 2015 03:23:57 +0000 (11:23 +0800)]
drm/amd/powerplay: add thermal control task when resume.

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>
8 years agodrm/amdgpu: fix hex/decimal bug when show gpu load.
Rex Zhu [Wed, 6 Jan 2016 09:17:53 +0000 (17:17 +0800)]
drm/amdgpu: fix hex/decimal bug when show gpu load.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: Show gpu load when display gpu performance for Fiji of VI.
Rex Zhu [Wed, 6 Jan 2016 09:15:59 +0000 (17:15 +0800)]
drm/amdgpu: Show gpu load when display gpu performance for Fiji of VI.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu: Show gpu load when display gpu performance for Ci.
Rex Zhu [Wed, 6 Jan 2016 09:08:46 +0000 (17:08 +0800)]
drm/amdgpu: Show gpu load when display gpu performance for Ci.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amd/powerplay: Reload and initialize the smc firmware on powerplay resume.
Rex Zhu [Tue, 29 Dec 2015 02:25:19 +0000 (10:25 +0800)]
drm/amd/powerplay: Reload and initialize the smc firmware on powerplay resume.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amd/powerplay: add powerplay valid check to avoid null point. (v2)
Rex Zhu [Tue, 29 Dec 2015 05:56:03 +0000 (13:56 +0800)]
drm/amd/powerplay: add powerplay valid check to avoid null point. (v2)

In case CONFIG_DRM_AMD_POWERPLAY is defined and amdgpu.powerplay=0.
some functions in powrplay can also be called by DAL. and the input parameter is *adev.
if just check point not NULL was not enough and will lead to NULL point error.

V2: AGD: rebase on upstream

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>
8 years agodrm/amd/powerplay: fix Smatch static checker warnings
Rex Zhu [Wed, 6 Jan 2016 08:48:38 +0000 (16:48 +0800)]
drm/amd/powerplay: fix Smatch static checker warnings

1. return -1 instead of -ENOMEM
2. The struct type mismatch warnings.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Ken Wang <Qingqing.Wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amd/powerplay: fix Smatch static checker warnings with indenting (v2)
Rex Zhu [Wed, 6 Jan 2016 08:38:48 +0000 (16:38 +0800)]
drm/amd/powerplay: fix Smatch static checker warnings with indenting (v2)

v2: AGD: rebase on upstream

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Ken Wang <Qingqing.Wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amd/powerplay: fix bug that NULL checks are reversed.
Rex Zhu [Wed, 6 Jan 2016 08:22:07 +0000 (16:22 +0800)]
drm/amd/powerplay: fix bug that NULL checks are reversed.

&& was used instead of ||.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Ken Wang <Qingqing.Wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agoamdgpu/dce11: Add test for crtc < 0 to various DCEv11 functions
Tom St Denis [Tue, 15 Dec 2015 18:03:43 +0000 (13:03 -0500)]
amdgpu/dce11:  Add test for crtc < 0 to various DCEv11 functions

To be consistent with other DCE11 functions test for crtc < 0.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agoamdgpu/dce11: Remove division from dce_v11_0_vblank_wait()
Tom St Denis [Tue, 15 Dec 2015 18:01:49 +0000 (13:01 -0500)]
amdgpu/dce11: Remove division from dce_v11_0_vblank_wait()

Mimics odd behaviour where (i++ % 100 == 0) is true in the first iteration of each loop...

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agoamdgpu/vce3: Simplify vce_v3_0_hw_init and ensure both rings default to not ready.
Tom St Denis [Tue, 15 Dec 2015 15:55:34 +0000 (10:55 -0500)]
amdgpu/vce3: Simplify vce_v3_0_hw_init and ensure both rings default to not ready.

Simplified the ring test and added logic to ensure rings are marked not ready
by default.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
8 years agoamdgpu/vce3: Remove magic constants from harvest register masks.
Tom St Denis [Mon, 4 Jan 2016 15:46:41 +0000 (10:46 -0500)]
amdgpu/vce3: Remove magic constants from harvest register masks.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agoamdgpu/vce3: Simplify vce_v3_0_process_interrupt()
Tom St Denis [Tue, 15 Dec 2015 15:42:39 +0000 (10:42 -0500)]
amdgpu/vce3: Simplify vce_v3_0_process_interrupt()

Fold two cases into one for a LOC reduction.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
8 years agoamdgpu/vce3: Simplify vce_v3_0_soft_reset()
Tom St Denis [Tue, 15 Dec 2015 15:40:16 +0000 (10:40 -0500)]
amdgpu/vce3: Simplify vce_v3_0_soft_reset()

LOC reduction and simplification.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
8 years agoamdgpu/vce3: Simplify idle and wait for idle code
Tom St Denis [Tue, 15 Dec 2015 15:35:56 +0000 (10:35 -0500)]
amdgpu/vce3: Simplify idle and wait for idle code

More LOC reductions in VCE3 code.  This patch simplifies the is_idle and
wait_for_idle logic.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
8 years agoamdgpu/vce3: Cleanup harvest config function.
Tom St Denis [Tue, 15 Dec 2015 15:21:46 +0000 (10:21 -0500)]
amdgpu/vce3: Cleanup harvest config function.

Basic LOC reduction.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
8 years agodrm/amdgpu: fix NULL in vm_grab_id while S3 back
Chunming Zhou [Tue, 29 Dec 2015 03:57:38 +0000 (11:57 +0800)]
drm/amdgpu: fix NULL in vm_grab_id while S3 back

vm_manager_fini shouldn't be in suspend phase.

Signed-off-by: Chunming Zhou <David1.Zhou@amd.com>
Reviewed-by: Ken Wang <Qingqing.Wang@amd.com>
8 years agodrm/amd/powerplay: precedence bug in init_non_clock_fields()
Dan Carpenter [Mon, 4 Jan 2016 20:44:24 +0000 (23:44 +0300)]
drm/amd/powerplay: precedence bug in init_non_clock_fields()

The cast to uint8_t happens before the right shift so this always sets
.m3arb to zero.  The cast is actually a no-op so we can remove it.

Fixes: 3bace3591493 ('drm/amd/powerplay: add hardware manager sub-component')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amdgpu/cgs: cleanup some indenting
Dan Carpenter [Mon, 4 Jan 2016 20:43:47 +0000 (23:43 +0300)]
drm/amdgpu/cgs: cleanup some indenting

This code is indented too far.  Also we normally use spaces to align if
statement conditions.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/amd/powerplay: fix a reversed condition
Dan Carpenter [Mon, 4 Jan 2016 20:42:55 +0000 (23:42 +0300)]
drm/amd/powerplay: fix a reversed condition

This test was reversed so it would end up leading to a NULL dereference.

Fixes: 4630f0faae80 ('drm/amd/powerplay: add Carrizo smu support')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/radeon: Drop unnecessary unsigned int < 0 check
Thierry Reding [Mon, 4 Jan 2016 17:19:12 +0000 (18:19 +0100)]
drm/radeon: Drop unnecessary unsigned int < 0 check

Unsigned integers can never be negative, so drop this check.

Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
8 years agodrm/dp/mst: fix in RAD element access
Mykola Lysenko [Fri, 25 Dec 2015 08:14:48 +0000 (16:14 +0800)]
drm/dp/mst: fix in RAD element access

This is needed to receive correct port
number from RAD, so MSTB could be found

Acked-by: Dave Airlie <airlied@gmail.com>
Signed-off-by: Mykola Lysenko <Mykola.Lysenko@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
8 years agodrm/dp/mst: fix in MSTB RAD initialization
Mykola Lysenko [Fri, 25 Dec 2015 08:14:47 +0000 (16:14 +0800)]
drm/dp/mst: fix in MSTB RAD initialization

This fix is needed to support more then two
branch displays, so RAD address consist at
least of 2 elements

Acked-by: Dave Airlie <airlied@gmail.com>
Signed-off-by: Mykola Lysenko <Mykola.Lysenko@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
8 years agodrm/dp/mst: always send reply for UP request
Mykola Lysenko [Fri, 18 Dec 2015 22:14:43 +0000 (17:14 -0500)]
drm/dp/mst: always send reply for UP request

We should always send reply for UP request in order
to make downstream device clean-up resources appropriately.

Issue was that reply for UP request was sent only once.

Acked-by: Dave Airlie <airlied@gmail.com>
Signed-off-by: Mykola Lysenko <Mykola.Lysenko@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
8 years agodrm/dp/mst: process broadcast messages correctly
Mykola Lysenko [Fri, 18 Dec 2015 22:14:42 +0000 (17:14 -0500)]
drm/dp/mst: process broadcast messages correctly

In case broadcast message received in UP request,
RAD cannot be used to identify message originator.
Message should be parsed, originator should be found
by GUID from parsed message.

Also reply with broadcast in case broadcast message
received (for now it is always broadcast)

Acked-by: Dave Airlie <airlied@gmail.com>
Signed-off-by: Mykola Lysenko <Mykola.Lysenko@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
8 years agodrm: powerplay: use div64_s64 instead of do_div
Arnd Bergmann [Fri, 1 Jan 2016 13:07:41 +0000 (14:07 +0100)]
drm: powerplay: use div64_s64 instead of do_div

The newly added code for Fiji creates a correct compiler warning
about invalid use of the do_div macro:

In file included from powerplay/hwmgr/ppatomctrl.c:31:0:
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/ppevvmath.h: In function 'fDivide':
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/ppevvmath.h:382:89: warning: comparison of distinct pointer types lacks a cast
     do_div(longlongX, longlongY); /*Q(32,32) divided by Q(16,16) = Q(16,16) Back to original format */

do_div() divides an unsigned 64-bit number by an unsigned 32-bit number.
The code instead wants to divide two signed 64-bit numbers, which is done
using the div64_s64 function.

Reviewed-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 770911a3cfbb ("drm/amd/powerplay: add/update headers for Fiji SMU and DPM")
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agoMerge tag 'omapdrm-4.5-resolved' of git://git.kernel.org/pub/scm/linux/kernel/git...
Dave Airlie [Thu, 31 Dec 2015 21:41:52 +0000 (07:41 +1000)]
Merge tag 'omapdrm-4.5-resolved' of git://git./linux/kernel/git/tomba/linux into drm-next

omapdrm changes for v4.5

* enable DRIVER_ATOMIC
* improved TILER performance
* cleanups preparing for DMAbuf import
* fbdev emulation is now optional
* minor fixes

* tag 'omapdrm-4.5-resolved' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux:
  drm/omap: remove obsolete manager assignment
  drm/omap: set DRIVER_ATOMIC for omapdrm
  drm/omap: remove unused plugin defines
  drm/omap: Use bitmaps for TILER placement
  drm: omapdrm: gem: Remove check for impossible condition
  drm: omapdrm: gem: Simplify error handling when creating GEM object
  drm: omapdrm: gem: Don't free mmap offset twice
  drm: omapdrm: gem: Fix GEM object destroy in error path
  drm: omapdrm: gem: Free the correct memory object
  drm: omapdrm: gem: Mask out private flags passed from userspace
  drm: omapdrm: gem: Move global usergart variable to omap_drm_private
  drm: omapdrm: gem: Group functions by purpose
  drm: omapdrm: gem: Remove forward declarations
  drm: omapdrm: gem: Remove unused function prototypes
  drm: omapdrm: Make fbdev emulation optional
  drm: omapdrm: Fix plane state free in plane reset handler
  drm: omapdrm: move omap_plane_reset()
  drm/omap: Use platform_register/unregister_drivers()
  drm: omapdrm: tiler: Remove unneded module alias for tiler

9 years agodrm/omap: remove obsolete manager assignment
Tomi Valkeinen [Wed, 4 Nov 2015 15:10:59 +0000 (17:10 +0200)]
drm/omap: remove obsolete manager assignment

omap_encoder_update() assigns an overlay manager to
dssdev->src->manager. This assignment is not needed, as the connections
in the display chain have already been made at connect step.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm/omap: set DRIVER_ATOMIC for omapdrm
Tomi Valkeinen [Fri, 2 Oct 2015 08:10:41 +0000 (11:10 +0300)]
drm/omap: set DRIVER_ATOMIC for omapdrm

omapdrm supports atomic modesetting, and it seems to work ok. So let's
set the flag to enable the atomic modesetting API support.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
9 years agodrm/omap: remove unused plugin defines
Tomi Valkeinen [Fri, 28 Aug 2015 08:23:03 +0000 (11:23 +0300)]
drm/omap: remove unused plugin defines

Remove unused defines related to SGX plugin which are not used.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
9 years agodrm/omap: Use bitmaps for TILER placement
Andy Gross [Wed, 12 Aug 2015 08:24:38 +0000 (11:24 +0300)]
drm/omap: Use bitmaps for TILER placement

Modified Tiler placement to utilize bitmaps for bookkeeping and
all placement algorithms.  This resulted in a substantial savings
in time for all Tiler reservation and free operations.  Typical
savings are in the range of 28% decrease in time taken with larger
buffers showing a 80%+ decrease.

Signed-off-by: Andy Gross <andy.gross@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: gem: Remove check for impossible condition
Laurent Pinchart [Mon, 14 Dec 2015 20:39:42 +0000 (22:39 +0200)]
drm: omapdrm: gem: Remove check for impossible condition

The GEM object can't be tiled without a usergart as that condition is
checked and considered as an error when creating the GEM object.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: gem: Simplify error handling when creating GEM object
Laurent Pinchart [Mon, 14 Dec 2015 20:39:41 +0000 (22:39 +0200)]
drm: omapdrm: gem: Simplify error handling when creating GEM object

The goto error statement end up just returning NULL without performing
any cleanup, replace it with a direct return.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: gem: Don't free mmap offset twice
Laurent Pinchart [Mon, 14 Dec 2015 20:39:40 +0000 (22:39 +0200)]
drm: omapdrm: gem: Don't free mmap offset twice

The drm_gem_free_mmap_offset() call in omap_gem_free_object() is
redundant as the same function is called from drm_gem_object_release().
Remove it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: gem: Fix GEM object destroy in error path
Laurent Pinchart [Mon, 14 Dec 2015 20:39:39 +0000 (22:39 +0200)]
drm: omapdrm: gem: Fix GEM object destroy in error path

Use the omap_gem_free_object() function to destroy the GEM object in the
omap_gem_new_handle() error path instead of doing it manually (and
incorrectly).

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: gem: Free the correct memory object
Laurent Pinchart [Mon, 14 Dec 2015 20:39:38 +0000 (22:39 +0200)]
drm: omapdrm: gem: Free the correct memory object

The GEM object free handler frees memory allocated by the driver using
the pointer to the drm_gem_object instead of the pointer to the
omap_gem_object that embeds it. This doesn't cause any issue in practice
as the drm_gem_object is the first field of omap_gem_object, but would
cause memory corruption if the structure layout changes. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: gem: Mask out private flags passed from userspace
Laurent Pinchart [Mon, 14 Dec 2015 20:39:36 +0000 (22:39 +0200)]
drm: omapdrm: gem: Mask out private flags passed from userspace

The 8 high order bits of the buffer flags are reserved for internal use.
Mask them out from the flags passed by userspace.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: gem: Move global usergart variable to omap_drm_private
Laurent Pinchart [Mon, 14 Dec 2015 20:39:34 +0000 (22:39 +0200)]
drm: omapdrm: gem: Move global usergart variable to omap_drm_private

The structure contains data related to a device instance, it shouldn't
be a global variable.

While at it rename the usergart structures with an omap_drm_ prefix.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: gem: Group functions by purpose
Laurent Pinchart [Mon, 14 Dec 2015 20:39:33 +0000 (22:39 +0200)]
drm: omapdrm: gem: Group functions by purpose

Divide the GEM implementation in groups of functions to improve
readability.

No code change is performed by this commit.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
9 years agodrm: omapdrm: gem: Remove forward declarations
Laurent Pinchart [Mon, 14 Dec 2015 20:39:32 +0000 (22:39 +0200)]
drm: omapdrm: gem: Remove forward declarations

Reorder functions to get rid of forward declarations

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>