GitHub/moto-9609/android_kernel_motorola_exynos9610.git
10 years agodrm/nouveau/core: don't leak oclass type bits to user
Ben Skeggs [Thu, 4 Sep 2014 23:01:21 +0000 (09:01 +1000)]
drm/nouveau/core: don't leak oclass type bits to user

Fixes not being able to init fence subsystem when multiple boards are
present.

Reported-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/platform: fix compilation error
Alexandre Courbot [Tue, 12 Aug 2014 22:16:53 +0000 (15:16 -0700)]
drm/nouveau/platform: fix compilation error

nouveau_platform.c was still using the old nouveau_dev() macro,
triggering a compilation error. Fix this.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/gk20a: add LTC device
Alexandre Courbot [Tue, 12 Aug 2014 22:16:52 +0000 (15:16 -0700)]
drm/nouveau/gk20a: add LTC device

LTC device is now required for PGRAPH to work, add it.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: warn if we fail to re-pin fb on resume
Ben Skeggs [Tue, 12 Aug 2014 13:35:35 +0000 (23:35 +1000)]
drm/nouveau: warn if we fail to re-pin fb on resume

Spotted by Coverity.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/nvif: fix dac load detect method definition
Ben Skeggs [Tue, 12 Aug 2014 13:16:04 +0000 (23:16 +1000)]
drm/nouveau/nvif: fix dac load detect method definition

A thinko made me turn this into a u16 when cleaning up.

Spotted by coverity.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gf100-/gr: fix -ENOSPC detection when allocating zbc table entries
Ben Skeggs [Tue, 12 Aug 2014 13:11:18 +0000 (23:11 +1000)]
drm/gf100-/gr: fix -ENOSPC detection when allocating zbc table entries

Spotted by Coverity.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/nvif: return null pointers on failure, in addition to ret != 0
Ben Skeggs [Tue, 12 Aug 2014 12:56:09 +0000 (22:56 +1000)]
drm/nouveau/nvif: return null pointers on failure, in addition to ret != 0

Reported by Coverity.  The intention is that the return value is
checked, but let's be more paranoid and make it extremely obvious
if something forgets to.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/ltc: fix tag base address getting truncated if above 4GiB
Ben Skeggs [Mon, 11 Aug 2014 23:27:54 +0000 (09:27 +1000)]
drm/nouveau/ltc: fix tag base address getting truncated if above 4GiB

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nvc0-/fb/ram: fix use of non-existant ram if partitions aren't uniform
Ben Skeggs [Mon, 11 Aug 2014 23:17:41 +0000 (09:17 +1000)]
drm/nvc0-/fb/ram: fix use of non-existant ram if partitions aren't uniform

Likely a large part of the GK106 woes..

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/bar: behave better if ioremap failed
Ben Skeggs [Mon, 11 Aug 2014 01:52:44 +0000 (11:52 +1000)]
drm/nouveau/bar: behave better if ioremap failed

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/kms: nouveau_fbcon_accel_fini can be static
Fengguang Wu [Sun, 10 Aug 2014 02:36:26 +0000 (12:36 +1000)]
drm/nouveau/kms: nouveau_fbcon_accel_fini can be static

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: kill unused variable warning if !__OS_HAS_AGP
Ben Skeggs [Sun, 10 Aug 2014 02:39:09 +0000 (12:39 +1000)]
drm/nouveau: kill unused variable warning if !__OS_HAS_AGP

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/nvif: fix a number of notify thinkos
Ben Skeggs [Mon, 11 Aug 2014 01:36:45 +0000 (11:36 +1000)]
drm/nouveau/nvif: fix a number of notify thinkos

Note to self: more sleep

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: expose the full object/event interfaces to userspace
Ben Skeggs [Sat, 9 Aug 2014 18:10:31 +0000 (04:10 +1000)]
drm/nouveau: expose the full object/event interfaces to userspace

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: fix headless mode
Ben Skeggs [Sat, 9 Aug 2014 18:10:31 +0000 (04:10 +1000)]
drm/nouveau: fix headless mode

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: hide sysfs pstate file behind an option again
Ben Skeggs [Sat, 9 Aug 2014 18:10:30 +0000 (04:10 +1000)]
drm/nouveau: hide sysfs pstate file behind an option again

No-one has yet had time to move this to debugfs as discussed during
the last merge window.  Until this happens, hide the option to make
it clear it's not going to be here forever.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nv50/disp: shhh compiler
Ben Skeggs [Sat, 9 Aug 2014 18:10:30 +0000 (04:10 +1000)]
drm/nv50/disp: shhh compiler

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gf100-/gr: implement the proper SetShaderExceptions method
Ben Skeggs [Sat, 9 Aug 2014 18:10:30 +0000 (04:10 +1000)]
drm/gf100-/gr: implement the proper SetShaderExceptions method

We have another version of it implemented in SW, however, that version
isn't serialised with normal PGRAPH operation and can possibly clobber
the enables for another context.

This is the same method that's implemented by the NVIDIA binary driver.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gf100-/gr: remove some broken ltc bashing, for now
Ben Skeggs [Sat, 9 Aug 2014 18:10:30 +0000 (04:10 +1000)]
drm/gf100-/gr: remove some broken ltc bashing, for now

... and hope that the defaults are good enough.  This was always
supposed to be a read/modify/write thing anyway, so we're writing
very wrong stuff for some boards already.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gf100-/gr: unhardcode attribute cb config
Ben Skeggs [Sat, 9 Aug 2014 18:10:30 +0000 (04:10 +1000)]
drm/gf100-/gr: unhardcode attribute cb config

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gf100-/gr: fetch tpcs-per-ppc info on startup
Ben Skeggs [Sat, 9 Aug 2014 18:10:29 +0000 (04:10 +1000)]
drm/gf100-/gr: fetch tpcs-per-ppc info on startup

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gf100-/gr: unhardcode pagepool config
Ben Skeggs [Sat, 9 Aug 2014 18:10:29 +0000 (04:10 +1000)]
drm/gf100-/gr: unhardcode pagepool config

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gf100-/gr: unhardcode bundle cb config
Ben Skeggs [Sat, 9 Aug 2014 18:10:29 +0000 (04:10 +1000)]
drm/gf100-/gr: unhardcode bundle cb config

Should be the same values as before, except:

GF117 has smaller buffer allocated, as per register setup.
GK20A now uses values from Tegra driver, not GK104's.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gf100-/gr: improve initial context patch list helpers
Ben Skeggs [Sat, 9 Aug 2014 18:10:29 +0000 (04:10 +1000)]
drm/gf100-/gr: improve initial context patch list helpers

Removes need for fixed buffer indices, and allows the functions
utilising them to also be run outside of context generation.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gf100-/gr: add support for zero bandwidth clear
Ben Skeggs [Sat, 9 Aug 2014 18:10:29 +0000 (04:10 +1000)]
drm/gf100-/gr: add support for zero bandwidth clear

Default ZBC table is compatible with binary driver defaults.

Userspace will need to be updated to take full advantage of this
feature, however, some applications will see a performance boost
without updated drivers.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/ltc: add zbc drivers
Ben Skeggs [Sat, 9 Aug 2014 18:10:28 +0000 (04:10 +1000)]
drm/nouveau/ltc: add zbc drivers

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/ltc: s/ltcg/ltc/ + cleanup
Ben Skeggs [Sat, 9 Aug 2014 18:10:28 +0000 (04:10 +1000)]
drm/nouveau/ltc: s/ltcg/ltc/ + cleanup

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: use ram info from nvif_device
Ben Skeggs [Sat, 9 Aug 2014 18:10:28 +0000 (04:10 +1000)]
drm/nouveau: use ram info from nvif_device

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/disp: implement nvif event sources for vblank/connector notifiers
Ben Skeggs [Sat, 9 Aug 2014 18:10:28 +0000 (04:10 +1000)]
drm/nouveau/disp: implement nvif event sources for vblank/connector notifiers

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/disp: allow user direct access to channel control registers
Ben Skeggs [Sat, 9 Aug 2014 18:10:28 +0000 (04:10 +1000)]
drm/nouveau/disp: allow user direct access to channel control registers

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/disp: audit and version display classes
Ben Skeggs [Sat, 9 Aug 2014 18:10:27 +0000 (04:10 +1000)]
drm/nouveau/disp: audit and version display classes

The full object interfaces are about to be exposed to userspace, so we
need to check for any security-related issues and version the structs
to make it easier to handle any changes we may need in the future.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/disp: audit and version SCANOUTPOS method
Ben Skeggs [Sat, 9 Aug 2014 18:10:27 +0000 (04:10 +1000)]
drm/nouveau/disp: audit and version SCANOUTPOS method

The full object interfaces are about to be exposed to userspace, so we
need to check for any security-related issues and version the structs
to make it easier to handle any changes we may need in the future.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nv50-/disp: audit and version PIOR_PWR method
Ben Skeggs [Sat, 9 Aug 2014 18:10:27 +0000 (04:10 +1000)]
drm/nv50-/disp: audit and version PIOR_PWR method

The full object interfaces are about to be exposed to userspace, so we
need to check for any security-related issues and version the structs
to make it easier to handle any changes we may need in the future.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nv50-/disp: audit and version SOR_DP_PWR method
Ben Skeggs [Sat, 9 Aug 2014 18:10:27 +0000 (04:10 +1000)]
drm/nv50-/disp: audit and version SOR_DP_PWR method

The full object interfaces are about to be exposed to userspace, so we
need to check for any security-related issues and version the structs
to make it easier to handle any changes we may need in the future.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nv50-/disp: audit and version LVDS_SCRIPT method
Ben Skeggs [Sat, 9 Aug 2014 18:10:27 +0000 (04:10 +1000)]
drm/nv50-/disp: audit and version LVDS_SCRIPT method

The full object interfaces are about to be exposed to userspace, so we
need to check for any security-related issues and version the structs
to make it easier to handle any changes we may need in the future.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nv50-/disp: audit and version SOR_HDMI_PWR method
Ben Skeggs [Sat, 9 Aug 2014 18:10:26 +0000 (04:10 +1000)]
drm/nv50-/disp: audit and version SOR_HDMI_PWR method

The full object interfaces are about to be exposed to userspace, so we
need to check for any security-related issues and version the structs
to make it easier to handle any changes we may need in the future.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nv50-/disp: audit and version SOR_HDA_ELD method
Ben Skeggs [Sat, 9 Aug 2014 18:10:26 +0000 (04:10 +1000)]
drm/nv50-/disp: audit and version SOR_HDA_ELD method

The full object interfaces are about to be exposed to userspace, so we
need to check for any security-related issues and version the structs
to make it easier to handle any changes we may need in the future.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nv50-/disp: audit and version SOR_PWR method
Ben Skeggs [Sat, 9 Aug 2014 18:10:26 +0000 (04:10 +1000)]
drm/nv50-/disp: audit and version SOR_PWR method

The full object interfaces are about to be exposed to userspace, so we
need to check for any security-related issues and version the structs
to make it easier to handle any changes we may need in the future.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nv50-/disp: audit and version DAC_LOAD method
Ben Skeggs [Sat, 9 Aug 2014 18:10:26 +0000 (04:10 +1000)]
drm/nv50-/disp: audit and version DAC_LOAD method

The full object interfaces are about to be exposed to userspace, so we
need to check for any security-related issues and version the structs
to make it easier to handle any changes we may need in the future.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nv50-/disp: audit and version DAC_PWR method
Ben Skeggs [Sat, 9 Aug 2014 18:10:26 +0000 (04:10 +1000)]
drm/nv50-/disp: audit and version DAC_PWR method

The full object interfaces are about to be exposed to userspace, so we
need to check for any security-related issues and version the structs
to make it easier to handle any changes we may need in the future.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nv50-/disp: share channel creation between nv50/gf110 impls
Ben Skeggs [Sat, 9 Aug 2014 18:10:25 +0000 (04:10 +1000)]
drm/nv50-/disp: share channel creation between nv50/gf110 impls

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nv50/kms: don't assume same class versions for all channels
Ben Skeggs [Sat, 9 Aug 2014 18:10:25 +0000 (04:10 +1000)]
drm/nv50/kms: don't assume same class versions for all channels

One of the next commits will remove some of the class IDs, leaving only
the ones used by NVIDIA which, presumably, mark where functionality
changes actually happened.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/fifo: implement nvif event source
Ben Skeggs [Sat, 9 Aug 2014 18:10:25 +0000 (04:10 +1000)]
drm/nouveau/fifo: implement nvif event source

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/fifo: allow direct access to channel control registers where possible
Ben Skeggs [Sat, 9 Aug 2014 18:10:25 +0000 (04:10 +1000)]
drm/nouveau/fifo: allow direct access to channel control registers where possible

The indirect method has been left in-place here as a fallback path, as
it may not be possible to map the non-PAGE_SIZE aligned control areas
across some chipset+interface combinations.

This isn't a problem for the primary use-case where the core and drm
are linked together in kernel-land, but across a VM or (in the case
where it applies now) between the core in the kernel and a userspace
test tool.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/fifo: audit and version fifo channel classes
Ben Skeggs [Sat, 9 Aug 2014 18:10:25 +0000 (04:10 +1000)]
drm/nouveau/fifo: audit and version fifo channel classes

The full object interfaces are about to be exposed to userspace, so we
need to check for any security-related issues and version the structs
to make it easier to handle any changes we may need in the future.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/device: audit and version NVIF_CONTROL class and methods
Ben Skeggs [Sat, 9 Aug 2014 18:10:25 +0000 (04:10 +1000)]
drm/nouveau/device: audit and version NVIF_CONTROL class and methods

The full object interfaces are about to be exposed to userspace, so we
need to check for any security-related issues and version the structs
to make it easier to handle any changes we may need in the future.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/pm: audit and version NVIF_PERFMON class and methods
Ben Skeggs [Sat, 9 Aug 2014 18:10:24 +0000 (04:10 +1000)]
drm/nouveau/pm: audit and version NVIF_PERFMON class and methods

The full object interfaces are about to be exposed to userspace, so we
need to check for any security-related issues and version the structs
to make it easier to handle any changes we may need in the future.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/dma: audit and version NV_DMA classes
Ben Skeggs [Sat, 9 Aug 2014 18:10:24 +0000 (04:10 +1000)]
drm/nouveau/dma: audit and version NV_DMA classes

The full object interfaces are about to be exposed to userspace, so we
need to check for any security-related issues and version the structs
to make it easier to handle any changes we may need in the future.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/dmaobj: switch to a slightly saner design
Ben Skeggs [Sat, 9 Aug 2014 18:10:24 +0000 (04:10 +1000)]
drm/nouveau/dmaobj: switch to a slightly saner design

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/dmaobj: update to an improved style of class definition
Ben Skeggs [Sat, 9 Aug 2014 18:10:24 +0000 (04:10 +1000)]
drm/nouveau/dmaobj: update to an improved style of class definition

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/device: audit and version NV_DEVICE class
Ben Skeggs [Sat, 9 Aug 2014 18:10:24 +0000 (04:10 +1000)]
drm/nouveau/device: audit and version NV_DEVICE class

The full object interfaces are about to be exposed to userspace, so we
need to check for any security-related issues and version the structs
to make it easier to handle any changes we may need in the future.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: use ioctl interface for abi16 gpuobj free
Ben Skeggs [Sat, 9 Aug 2014 18:10:23 +0000 (04:10 +1000)]
drm/nouveau: use ioctl interface for abi16 gpuobj free

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: use ioctl interface for abi16 ntfy alloc
Ben Skeggs [Sat, 9 Aug 2014 18:10:23 +0000 (04:10 +1000)]
drm/nouveau: use ioctl interface for abi16 ntfy alloc

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: use ioctl interface for abi16 grobj alloc
Ben Skeggs [Sat, 9 Aug 2014 18:10:23 +0000 (04:10 +1000)]
drm/nouveau: use ioctl interface for abi16 grobj alloc

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: remove as much direct use of core headers as possible
Ben Skeggs [Sat, 9 Aug 2014 18:10:23 +0000 (04:10 +1000)]
drm/nouveau: remove as much direct use of core headers as possible

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: remove (most) hardcoded object handle usage
Ben Skeggs [Sat, 9 Aug 2014 18:10:23 +0000 (04:10 +1000)]
drm/nouveau: remove (most) hardcoded object handle usage

The PFIFO<->EVO sync buffers will be fixed up later when inter-channel
sync in general is improved.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: port to nvif client/device/objects
Ben Skeggs [Sat, 9 Aug 2014 18:10:22 +0000 (04:10 +1000)]
drm/nouveau: port to nvif client/device/objects

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: initial pass at moving to struct nvif_device
Ben Skeggs [Sat, 9 Aug 2014 18:10:22 +0000 (04:10 +1000)]
drm/nouveau: initial pass at moving to struct nvif_device

This is an attempt at isolating some of the changes necessary to port
to NVIF in a separate commit.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: kill nouveau_dev() + wrap register macros
Ben Skeggs [Sat, 9 Aug 2014 18:10:22 +0000 (04:10 +1000)]
drm/nouveau: kill nouveau_dev() + wrap register macros

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: fix some usages of the wrong print function
Ben Skeggs [Sat, 9 Aug 2014 18:10:22 +0000 (04:10 +1000)]
drm/nouveau: fix some usages of the wrong print function

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/nvif: import library functions for the ioctl/event interfaces
Ben Skeggs [Sat, 9 Aug 2014 18:10:21 +0000 (04:10 +1000)]
drm/nouveau/nvif: import library functions for the ioctl/event interfaces

This is a wrapper around the interfaces defined in an earlier commit,
and is also used by various userspace (either by a libdrm backend, or
libpciaccess) tools/tests.

In the future this will be extended to handle channels, replacing some
long-unloved code we currently use, and allow fifo/display/mpeg (hi
Ilia ;)) engines to all be exposed in the same way.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/client: add method to retrieve device list
Ben Skeggs [Sat, 9 Aug 2014 18:10:21 +0000 (04:10 +1000)]
drm/nouveau/client: add method to retrieve device list

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/core: remove NV_D0 family
Ben Skeggs [Sat, 9 Aug 2014 18:10:21 +0000 (04:10 +1000)]
drm/nouveau/core: remove NV_D0 family

The one place where it mattered has been replaced with a class check,
which is more appropriate anyway.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/device: add method to retrieve some basic device info
Ben Skeggs [Sat, 9 Aug 2014 18:10:21 +0000 (04:10 +1000)]
drm/nouveau/device: add method to retrieve some basic device info

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/core: import ioctl/event interfaces
Ben Skeggs [Sat, 9 Aug 2014 18:10:20 +0000 (04:10 +1000)]
drm/nouveau/core: import ioctl/event interfaces

This forms the basis for the new APIs that will be exposed to userspace,
giving it access to:

- Object method calls, the immediately useful of which is performance
  counters and the abiity to manipulate the ZBC tables.
- Information on the child classes an object supports, in order to avoid
  having to try all supported classes until successful.
- Notifications, which will be used in the future to inform the client
  if its channel was killed due to a lockup, etc.

This commit imports the interfaces, but are not currently used.  The DRM
portion of the driver will be ported to speak to the core using these
interfaces as much as possible.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/core: add function to return list of supported children
Ben Skeggs [Sat, 9 Aug 2014 18:10:20 +0000 (04:10 +1000)]
drm/nouveau/core: add function to return list of supported children

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/core: rework event interface
Ben Skeggs [Sat, 9 Aug 2014 18:10:20 +0000 (04:10 +1000)]
drm/nouveau/core: rework event interface

This is a lot of prep-work for being able to send event notifications
back to userspace.  Events now contain data, rather than a "something
just happened" signal.

Handler data is now embedded into a containing structure, rather than
being kmalloc()'d, and can optionally have the notify routine handled
in a workqueue.

Various races between suspend/unload with display HPD/DP IRQ handlers
automagically solved as a result.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/core: move handle-based object apis to handle.c
Ben Skeggs [Sat, 9 Aug 2014 18:10:20 +0000 (04:10 +1000)]
drm/nouveau/core: move handle-based object apis to handle.c

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/core: fail creation of zero-argument objects, when arguments are passed
Ben Skeggs [Sat, 9 Aug 2014 18:10:20 +0000 (04:10 +1000)]
drm/nouveau/core: fail creation of zero-argument objects, when arguments are passed

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: store a pointer to vm in nouveau_cli
Ben Skeggs [Sat, 9 Aug 2014 18:10:20 +0000 (04:10 +1000)]
drm/nouveau: store a pointer to vm in nouveau_cli

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: store vblank event handler data in nv_crtc
Ben Skeggs [Sat, 9 Aug 2014 18:10:19 +0000 (04:10 +1000)]
drm/nouveau: store vblank event handler data in nv_crtc

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nv50/kms: create ctxdma objects for framebuffers as required
Ben Skeggs [Sat, 9 Aug 2014 18:10:19 +0000 (04:10 +1000)]
drm/nv50/kms: create ctxdma objects for framebuffers as required

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nv50/kms: move framebuffer wrangling out of common code
Ben Skeggs [Sat, 9 Aug 2014 18:10:19 +0000 (04:10 +1000)]
drm/nv50/kms: move framebuffer wrangling out of common code

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: Bump version from 1.1.1 to 1.1.2
Mario Kleiner [Wed, 6 Aug 2014 04:09:44 +0000 (06:09 +0200)]
drm/nouveau: Bump version from 1.1.1 to 1.1.2

Linux 3.16 fixed multiple bugs in kms pageflip completion events
and timestamping, which were originally introduced in Linux 3.13.

These fixes have been backported to all stable kernels since 3.13.

However, the userspace nouveau-ddx needs to be aware if it is
running on a kernel on which these bugs are fixed, or not.

Bump the patchlevel of the drm driver version to signal this,
so backporting this patch to stable 3.13+ kernels will give the
ddx the required info.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: <stable@vger.kernel.org> #v3.13+
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nv50-/sw: use nv50_software_context_dtor....
Ben Skeggs [Thu, 7 Aug 2014 21:21:53 +0000 (07:21 +1000)]
drm/nv50-/sw: use nv50_software_context_dtor....

You would not believe the troubles this caused me...

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nv50-/fb: use dma_mapping_error() to check dma_map_page() result
Ben Skeggs [Tue, 5 Aug 2014 12:03:49 +0000 (22:03 +1000)]
drm/nv50-/fb: use dma_mapping_error() to check dma_map_page() result

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: Dis/Enable vblank irqs during suspend/resume.
Mario Kleiner [Tue, 29 Jul 2014 00:36:44 +0000 (02:36 +0200)]
drm/nouveau: Dis/Enable vblank irqs during suspend/resume.

Vblank irqs don't get disabled during suspend or driver
unload, which causes irq delivery after "suspend" or
driver unload, at least until the gpu is powered off.
This could race with drm_vblank_cleanup() in the case
of nouveau and cause a use-after-free bug if the driver
is unloaded.

More annoyingly during everyday use, at least on nv50
display engine (likely also others), vblank irqs are
off after a resume from suspend, but the drm doesn't
know this, so all vblank related functionality is dead
after a resume. E.g., all windowed OpenGL clients will
hang at swapbuffers time, as well as many fullscreen
clients in many cases. This makes suspend/resume useless
if one wants to use any OpenGL apps after the resume.

In Linux 3.16, drm_vblank_on() was added, complementing
the older drm_vblank_off()  to solve these problems
elegantly, so use those calls in nouveaus suspend/resume
code.

For kernels 3.8 - 3.15, we need to cherry-pick the
drm_vblank_on() patch to support this patch.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: <stable@vger.kernel.org> #v3.16
Cc: <stable@vger.kernel.org> #v3.8+: f275228: drm: Add drm_vblank_on()
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: platform: update moved Tegra header
Alexandre Courbot [Sat, 26 Jul 2014 09:36:02 +0000 (18:36 +0900)]
drm/nouveau: platform: update moved Tegra header

Header for tegra_powergate functions has moved to soc/tegra/pmc.h.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/gk20a: reclocking support
Alexandre Courbot [Sat, 26 Jul 2014 09:41:41 +0000 (18:41 +0900)]
drm/nouveau/gk20a: reclocking support

Add support for reclocking on GK20A, using a statically-defined pstates
table. The algorithms for calculating the coefficients and setting the
clocks are directly taken from the ChromeOS kernel.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/clk: support for non-BIOS pstates
Alexandre Courbot [Sat, 26 Jul 2014 09:41:40 +0000 (18:41 +0900)]
drm/nouveau/clk: support for non-BIOS pstates

Make nouveau_clock_create() take new two optional arguments: an array
of pstates and its size. When these are specified,
nouveau_clock_create() will use the provided pstates instead of
probing them using the BIOS.

This is useful for platforms which do not provide a BIOS, like Tegra.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/clk: make therm and volt devices optional
Alexandre Courbot [Sat, 26 Jul 2014 09:41:39 +0000 (18:41 +0900)]
drm/nouveau/clk: make therm and volt devices optional

Allow the clock subsystem to operate even if voltage and thermal devices
are not set for the device (for people with watercooling! ;))

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/perfmon: do not forget to destroy the engine context
Samuel Pitoiset [Mon, 21 Jul 2014 09:59:44 +0000 (11:59 +0200)]
drm/nouveau/perfmon: do not forget to destroy the engine context

This fixes a crash when we reload Nouveau DRM.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: map pages using DMA API
Alexandre Courbot [Thu, 31 Jul 2014 09:09:42 +0000 (18:09 +0900)]
drm/nouveau: map pages using DMA API

The DMA API is the recommended way to map pages no matter what the
underlying bus is. Use the DMA functions for page mapping and remove
currently existing wrappers.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/pwr/macros: Stop playing Russian roulette on data memory
Roy Spliet [Sat, 2 Aug 2014 15:15:01 +0000 (17:15 +0200)]
drm/nouveau/pwr/macros: Stop playing Russian roulette on data memory

Signed-off-by: Roy Spliet <rspliet@eclipso.eu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nve4/graph: do not crash if no power device present
Alexandre Courbot [Tue, 15 Jul 2014 01:36:11 +0000 (10:36 +0900)]
drm/nve4/graph: do not crash if no power device present

Detect and workaround the absence of a power device so chips that do not
feature one (e.g. GK20A) can still use this driver.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gk20a: add BAR instance
Alexandre Courbot [Fri, 27 Jun 2014 11:36:54 +0000 (20:36 +0900)]
drm/gk20a: add BAR instance

GK20A's BAR is functionally identical to NVC0's, but do not support
being ioremapped write-combined. Create a BAR instance for GK20A that
reflect that state.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
10 years agodrm/nouveau/bar: add noncached ioremap property
Alexandre Courbot [Fri, 27 Jun 2014 10:28:50 +0000 (19:28 +0900)]
drm/nouveau/bar: add noncached ioremap property

Some BARs (like GK20A's) do not support being ioremapped write-combined.
Add a boolean property to the BAR structure and handle that case in the
Nouveau BO implementation.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
10 years agodrm/nouveau: support for probing platform devices
Alexandre Courbot [Thu, 26 Jun 2014 05:33:32 +0000 (14:33 +0900)]
drm/nouveau: support for probing platform devices

Add a platform driver for Nouveau devices declared using the device tree
or platform data. This driver currently supports GK20A on Tegra
platforms and is only compiled for these platforms if Nouveau is
enabled.

Nouveau will probe the chip type itself using the BOOT0 register, so all
this driver really needs to do is to make sure the module is powered and
its clocks active before calling nouveau_drm_platform_probe().

Heavily based on work done by Thierry Reding.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/kms: restore acceleration before fb_set_suspend() resumes
Ben Skeggs [Mon, 30 Jun 2014 03:18:48 +0000 (13:18 +1000)]
drm/nouveau/kms: restore acceleration before fb_set_suspend() resumes

This *should* be safe these days.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/kms: take more care when pulling down accelerated fbcon
Ben Skeggs [Sat, 28 Jun 2014 10:44:07 +0000 (20:44 +1000)]
drm/nouveau/kms: take more care when pulling down accelerated fbcon

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: expose pstate selection per-power source in sysfs
Ben Skeggs [Fri, 13 Jun 2014 04:17:09 +0000 (14:17 +1000)]
drm/nouveau: expose pstate selection per-power source in sysfs

echo ac:id >> pstate # select mode when on mains power
echo dc:id >> pstate # select mode when on battery
echo id >> pstate # select mode for both

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/clk: allow selection of different power state for ac vs battery
Ben Skeggs [Fri, 13 Jun 2014 03:23:42 +0000 (13:23 +1000)]
drm/nouveau/clk: allow selection of different power state for ac vs battery

v2:
- s/init/fini/ typo, reported by Alex

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/clk: schedule pstate changes through a workqueue
Ben Skeggs [Fri, 13 Jun 2014 04:58:21 +0000 (14:58 +1000)]
drm/nouveau/clk: schedule pstate changes through a workqueue

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/device: register for acpi events
Ben Skeggs [Fri, 13 Jun 2014 02:42:21 +0000 (12:42 +1000)]
drm/nouveau/device: register for acpi events

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gk208-/gr: stop touching 0x260 inappropriately
Ben Skeggs [Thu, 12 Jun 2014 12:15:21 +0000 (22:15 +1000)]
drm/gk208-/gr: stop touching 0x260 inappropriately

As a side note.. It's a bit hard to figure out how to name this commit..
GK20A is NVEA, which is before NV108 (GK208).. Confusing.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gk110b/gr: initvals differ from gk110
Ben Skeggs [Thu, 12 Jun 2014 11:22:32 +0000 (21:22 +1000)]
drm/gk110b/gr: initvals differ from gk110

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gk104/gr: disable PGOB at init time
Ben Skeggs [Thu, 12 Jun 2014 09:49:08 +0000 (19:49 +1000)]
drm/gk104/gr: disable PGOB at init time

This removes the previous hack that worked on some boards.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gk104/pwr: implement PGOB disable method
Ben Skeggs [Thu, 12 Jun 2014 08:58:05 +0000 (18:58 +1000)]
drm/gk104/pwr: implement PGOB disable method

As documented at:

ftp://download.nvidia.com/open-gpu-doc/gk104-disable-graphics-power-gating/1/gk104-disable-graphics-power-gating.txt

NVIDIA were not able document the steps necessary to detect whether this
is required or not at this time.  However, they did confirm that this
procedure is safe to perform unconditionally on GK104/6.  GK107 does not
have the power gating feature, and it was recommended that we do not
perform these steps there as the effects were not verified.

The disable path is from observing the binary driver, and not
documented in the link above.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/pwr: tidy
Ben Skeggs [Thu, 12 Jun 2014 08:31:32 +0000 (18:31 +1000)]
drm/nouveau/pwr: tidy

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/ttm: expose CPU address of DMA-allocated pages
Alexandre Courbot [Mon, 4 Aug 2014 09:28:54 +0000 (18:28 +0900)]
drm/ttm: expose CPU address of DMA-allocated pages

Pages allocated using the DMA API have a coherent memory mapping. Make
this mapping visible to drivers so they can decide to use it instead of
creating their own redundant one.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Acked-by: David Airlie <airlied@linux.ie>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>