GitHub/moto-9609/android_kernel_motorola_exynos9610.git
10 years agodrm: Make drm_crtc_check_viewport non-static
Matt Roper [Tue, 1 Apr 2014 22:22:34 +0000 (15:22 -0700)]
drm: Make drm_crtc_check_viewport non-static

This function will be used by the universal plane helpers and may also
be useful for individual drivers.

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
10 years agodrm/shmobile: Restrict plane loops to only operate on legacy planes
Matt Roper [Tue, 1 Apr 2014 22:22:33 +0000 (15:22 -0700)]
drm/shmobile: Restrict plane loops to only operate on legacy planes

Ensure that existing driver loops over all planes do not change behavior
when we begin adding new types of planes (primary and cursor) to the DRM
plane list in future patches.

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
10 years agodrm/i915: Restrict plane loops to only operate on overlay planes (v2)
Matt Roper [Tue, 1 Apr 2014 22:22:32 +0000 (15:22 -0700)]
drm/i915: Restrict plane loops to only operate on overlay planes (v2)

Ensure that existing driver loops over all planes do not change behavior
when we begin adding new types of planes (primary and cursor) to the DRM
plane list in future patches.

v2: Switch to using drm_for_each_legacy_plane()

Cc: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
10 years agodrm/exynos: Restrict plane loops to only operate on overlay planes (v2)
Matt Roper [Tue, 1 Apr 2014 22:22:31 +0000 (15:22 -0700)]
drm/exynos: Restrict plane loops to only operate on overlay planes (v2)

Ensure that existing driver loops over all planes do not change behavior
when we begin adding new types of planes (primary and cursor) to the DRM
plane list in future patches.

v2: Switch to using drm_for_each_legacy_plane()

Cc: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
10 years agodrm: Add support for multiple plane types (v2)
Matt Roper [Tue, 1 Apr 2014 22:22:30 +0000 (15:22 -0700)]
drm: Add support for multiple plane types (v2)

The DRM core currently only tracks "overlay"-style planes.  Start
refactoring the plane handling to allow other plane types (primary and
cursor) to also be placed on the DRM plane list.

v2: Add drm_for_each_legacy_plane() iterator to smooth transition
    of drivers with plane loops.

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
10 years agoMerge tag 'vmwgfx-next-2014-03-28' of git://people.freedesktop.org/~thomash/linux...
Dave Airlie [Mon, 31 Mar 2014 01:29:38 +0000 (11:29 +1000)]
Merge tag 'vmwgfx-next-2014-03-28' of git://people.freedesktop.org/~thomash/linux into drm-next

vmwgfx render-node support and drm + ttm changes it depends upon.

Pull request of 2014-03-28

* tag 'vmwgfx-next-2014-03-28' of git://people.freedesktop.org/~thomash/linux:
  drm/vmwgfx: Bump driver minor and date
  drm/vmwgfx: Enable render nodes
  drm/vmwgfx: Tighten the security around buffer maps
  drm/ttm: Add a ttm_ref_object_exists function
  drm/vmwgfx: Tighten security around surface sharing v2
  drm/vmwgfx: Allow prime fds in the surface reference ioctls
  drm/vmwgfx: Drop authentication requirement on UNREF ioctls
  drm/vmwgfx: Reinstate and tighten security around legacy master model
  drm/vmwgfx: Use a per-device semaphore for reservation protection
  drm: Add a function to get the ioctl flags
  drm: Protect the master management with a drm_device::master_mutex v3
  drm: Remove the minor master list
  drm: Improve on minor type helpers v3
  drm: Make control nodes master-less v3
  drm: Break out ioctl permission check to a separate function v2
  drm: Have the crtc code only reference master from legacy nodes v2

10 years agodrm/vmwgfx: Bump driver minor and date
Thomas Hellstrom [Thu, 20 Mar 2014 12:07:44 +0000 (13:07 +0100)]
drm/vmwgfx: Bump driver minor and date

Signal availability of prime fd reference ioctls and render nodes.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agodrm/vmwgfx: Enable render nodes
Thomas Hellstrom [Thu, 20 Mar 2014 12:06:34 +0000 (13:06 +0100)]
drm/vmwgfx: Enable render nodes

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agodrm/vmwgfx: Tighten the security around buffer maps
Thomas Hellstrom [Wed, 19 Mar 2014 14:06:21 +0000 (15:06 +0100)]
drm/vmwgfx: Tighten the security around buffer maps

Make sure only buffer objects that are referenced by the client can be mapped.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agodrm/ttm: Add a ttm_ref_object_exists function
Thomas Hellstrom [Wed, 19 Mar 2014 12:23:20 +0000 (13:23 +0100)]
drm/ttm: Add a ttm_ref_object_exists function

A function to be used to check whether a caller has put a ref object
(opened) a struct ttm_base_object

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agodrm/vmwgfx: Tighten security around surface sharing v2
Thomas Hellstrom [Wed, 19 Mar 2014 09:45:11 +0000 (10:45 +0100)]
drm/vmwgfx: Tighten security around surface sharing v2

If using legacy (non-prime) surface sharing, only allow surfaces
to be shared between clients with the same master. This will block
malicious clients from peeking at contents at surfaces from other
(possibly vt-switched) masters.

v2:
s/legacy_client/primary_client/

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agodrm/vmwgfx: Allow prime fds in the surface reference ioctls
Thomas Hellstrom [Tue, 18 Mar 2014 14:00:56 +0000 (15:00 +0100)]
drm/vmwgfx: Allow prime fds in the surface reference ioctls

Allow prime fds and at the same time block legacy handles for render-nodes
in the surface reference ioctls. This means these ioctls can be used
directly from prime-aware clients, and that they can be called from
render-nodes.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agodrm/vmwgfx: Drop authentication requirement on UNREF ioctls
Thomas Hellstrom [Thu, 27 Feb 2014 12:24:17 +0000 (13:24 +0100)]
drm/vmwgfx: Drop authentication requirement on UNREF ioctls

These ioctls will anyway only succeed if the client previously opened
referenced the object. Furthermore, closing the client would implicitly
execute the same action. This prevents clients from blocking on UNREF if
their master dropped, and will allow masters to UNREF after dropping
master privileges.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agodrm/vmwgfx: Reinstate and tighten security around legacy master model
Thomas Hellstrom [Thu, 27 Feb 2014 11:56:08 +0000 (12:56 +0100)]
drm/vmwgfx: Reinstate and tighten security around legacy master model

The following restrictions affect clients connecting using legacy nodes:

*) Masters that have dropped master privilieges are not considered
   authenticated until they regain master privileges.
*) Clients whose master have dropped master privileges block interruptibly on
   ioctls  requiring authentication until their master regains master
   privileges. If their master exits, they are killed.

This is primarily designed to prevent clients authenticated with one master to
access data from clients authenticated with another master.
(Think fast user-switching or data sniffers enabled while X is vt-switched).

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agodrm/vmwgfx: Use a per-device semaphore for reservation protection
Thomas Hellstrom [Thu, 27 Feb 2014 11:34:51 +0000 (12:34 +0100)]
drm/vmwgfx: Use a per-device semaphore for reservation protection

Don't use a per-master semaphore (ttm lock) for reservation protection, but
rather a per-device semaphore. This is needed since clients connecting using
render nodes aren't master aware.

The ttm lock used should probably be replaced with a reader-write semaphore
once the function down_xx_interruptible() is available.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agodrm: Add a function to get the ioctl flags
Thomas Hellstrom [Wed, 26 Feb 2014 14:51:57 +0000 (15:51 +0100)]
drm: Add a function to get the ioctl flags

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agodrm: Protect the master management with a drm_device::master_mutex v3
Thomas Hellstrom [Tue, 25 Feb 2014 18:57:44 +0000 (19:57 +0100)]
drm: Protect the master management with a drm_device::master_mutex v3

The master management was previously protected by the drm_device::struct_mutex.
In order to avoid locking order violations in a reworked dropped master
security check in the vmwgfx driver, break it out into a separate master_mutex.
Locking order is master_mutex -> struct_mutex.

Also remove drm_master::blocked since it's not used.

v2: Add an inline comment about what drm_device::master_mutex is protecting.
v3: Remove unneeded struct_mutex locks. Fix error returns in
    drm_setmaster_ioctl().

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Acked-by: Daniel Vetter <daniel@ffwll.ch>
10 years agodrm: Remove the minor master list
Thomas Hellstrom [Wed, 19 Feb 2014 13:37:44 +0000 (14:37 +0100)]
drm: Remove the minor master list

It doesn't appear to be used anywhere.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
10 years agodrm: Improve on minor type helpers v3
Thomas Hellstrom [Thu, 13 Mar 2014 10:07:44 +0000 (11:07 +0100)]
drm: Improve on minor type helpers v3

Add a drm_is_legacy() helper, constify argument to drm_is_render_client(),
and use / change helpers where appropriate.

v2: s/drm_is_legacy/drm_is_legacy_client/ and adapt to new code context.
v3: s/legacy_client/primary_client/

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agodrm: Make control nodes master-less v3
Thomas Hellstrom [Wed, 19 Feb 2014 13:21:48 +0000 (14:21 +0100)]
drm: Make control nodes master-less v3

Like for render-nodes, there is no point in maintaining the master concept
for control nodes, so set the struct drm_file::master pointer to NULL.

At the same time, make sure DRM_MASTER | DRM_CONTROL_ALLOW ioctls are always
allowed when called through the control node. Previously the caller also
needed to be master.

v2: Adapt to refactoring of ioctl permission check.
v3: Formatting of logical expression. Use drm_is_control_client() instead of
    drm_is_control().

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
10 years agodrm: Break out ioctl permission check to a separate function v2
Thomas Hellstrom [Thu, 13 Mar 2014 09:30:25 +0000 (10:30 +0100)]
drm: Break out ioctl permission check to a separate function v2

Helps reviewing and understanding these checks.
v2: Remove misplaced newlines.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
10 years agodrm: Have the crtc code only reference master from legacy nodes v2
Thomas Hellstrom [Thu, 13 Mar 2014 09:00:42 +0000 (10:00 +0100)]
drm: Have the crtc code only reference master from legacy nodes v2

control- and render nodes are intended to be master-less.

v2: Replace tests for !legacy with tests for !mode_group for readability.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
10 years agodrm/i915: fix build warning on 32-bit (v2)
Dave Airlie [Fri, 28 Mar 2014 03:03:48 +0000 (13:03 +1000)]
drm/i915: fix build warning on 32-bit (v2)

/ssd/git/drm-next/drivers/gpu/drm/i915/i915_cmd_parser.c: In function ‘i915_parse_cmds’:
/ssd/git/drm-next/drivers/gpu/drm/i915/i915_cmd_parser.c:405:4: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 5 has type ‘int’ [-Wformat=]
    DRM_DEBUG_DRIVER("CMD: Command length exceeds batch length: 0x%08X length=%d batchlen=%ld\n",
    ^

Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm: Remove the ', ' after the function name in debug logs
Lespiau, Damien [Mon, 24 Mar 2014 15:53:18 +0000 (15:53 +0000)]
drm: Remove the ', ' after the function name in debug logs

Right now a debug message looks like:

  [drm:drm_ioctl], pid=860, dev=0xe200, auth=1, DRM_IOCTL_MODE_GETCRTC

That first comma looks weird as we already have ']' as a separator.
Remove it.

If anyone sees this commit message and also thinks that auth=1 isn't the
most useful info to have here, let's just say I'd happily review a patch
removing it. If I don't get annoyed enough to submit a patch, that is.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm: Remove the prefix argument of drm_ut_debug_printk()
Lespiau, Damien [Mon, 24 Mar 2014 15:53:17 +0000 (15:53 +0000)]
drm: Remove the prefix argument of drm_ut_debug_printk()

This is always DRM_NAME, so we can just make it part of the format
string instead of asking prink to do it for us.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm: drm_ut_debug_printk() isn't called with NULL anywmore
Lespiau, Damien [Mon, 24 Mar 2014 15:53:16 +0000 (15:53 +0000)]
drm: drm_ut_debug_printk() isn't called with NULL anywmore

The DRM_LOG* macros where the only sites where drm_ut_debug_printk was
called with NULL arguments for prefix and function_name. Now that they
are gone, we can remove that case.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm: Pull the test on drm_debug in the logging macros
Lespiau, Damien [Mon, 24 Mar 2014 15:53:15 +0000 (15:53 +0000)]
drm: Pull the test on drm_debug in the logging macros

In the logging code, we are currently checking is we need to output in
drm_ut_debug_printk(). This is too late. The problem is that when we write
something like:

    DRM_DEBUG_DRIVER("ELD on [CONNECTOR:%d:%s], [ENCODER:%d:%s]\n",
                     connector->base.id,
                     drm_get_connector_name(connector),
                     connector->encoder->base.id,
                     drm_get_encoder_name(connector->encoder));

We start by evaluating the arguments (so call drm_get_connector_name() and
drm_get_connector_name()) before ending up in drm_ut_debug_printk() which will
then does nothing.

This means we execute a lot of instructions (drm_get_connector_name(), in turn,
calls snprintf() for example) to happily discard them in the normal case,
drm.debug=0.

So, let's put the test on drm_debug earlier, in the macros themselves.
Sprinkle an unlikely() as well for good measure.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm: Remove the now unused DRM_LOG* macros
Lespiau, Damien [Mon, 24 Mar 2014 15:53:14 +0000 (15:53 +0000)]
drm: Remove the now unused DRM_LOG* macros

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agostaging: imx-drm: Replace DRM_LOG_KMS() by DRM_DEBUG_KMS()
Lespiau, Damien [Mon, 24 Mar 2014 15:53:13 +0000 (15:53 +0000)]
staging: imx-drm: Replace DRM_LOG_KMS() by DRM_DEBUG_KMS()

There are only a few users of the DRM_LOG_KMS() macro. We can simplify
the DRM code a bit by replacing them by DRM_DEBUG_KMS().

Cc: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm/i915: Replace DRM_LOG_KMS() by DRM_DEBUG_KMS()
Lespiau, Damien [Mon, 24 Mar 2014 15:53:12 +0000 (15:53 +0000)]
drm/i915: Replace DRM_LOG_KMS() by DRM_DEBUG_KMS()

There are only a few users of the DRM_LOG_KMS() macro. We can simplify
the DRM code a bit by replacing them by DRM_DEBUG_KMS().

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm/gma500: Replace DRM_LOG_KMS() by DRM_DEBUG_KMS()
Lespiau, Damien [Mon, 24 Mar 2014 15:53:11 +0000 (15:53 +0000)]
drm/gma500: Replace DRM_LOG_KMS() by DRM_DEBUG_KMS()

There are only a few users of the DRM_LOG_KMS() macro. We can simplify
the DRM code a bit by replacing them by DRM_DEBUG_KMS().

Cc: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Acked-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm/exynos: Replace DRM_LOG_KMS() by DRM_DEBUG_KMS()
Lespiau, Damien [Mon, 24 Mar 2014 15:53:10 +0000 (15:53 +0000)]
drm/exynos: Replace DRM_LOG_KMS() by DRM_DEBUG_KMS()

There are only a few users of the DRM_LOG_KMS() macro. We can simplify
the DRM code a bit by replacing them by DRM_DEBUG_KMS().

Cc: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm: Remove the unused (and unusable) DRM_LOG_MODE()
Lespiau, Damien [Mon, 24 Mar 2014 15:53:09 +0000 (15:53 +0000)]
drm: Remove the unused (and unusable) DRM_LOG_MODE()

This macro was trying to use the non existing DRM_UT_MODE debug category
and looks like it should be covered by DRM_LOG_KMS().

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm: Refresh the explanation of debug categories
Lespiau, Damien [Mon, 24 Mar 2014 15:53:08 +0000 (15:53 +0000)]
drm: Refresh the explanation of debug categories

That comment wasn't super-readable, so I tried to improve it:

- Put the comment before the values it's documenting
- Add a mention to PRIME
- Reword things a bit to be a lighter read
- Add a note about the option to set the debug value at run-time

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm/bridge: PTN3460 needs DRM_KMS_HELPER
Arnd Bergmann [Tue, 25 Mar 2014 11:06:46 +0000 (12:06 +0100)]
drm/bridge: PTN3460 needs DRM_KMS_HELPER

The recently added PTN3460 device driver uses interfaces that
are provided by the KMS helper infrastructure, so we should
explicitly select that to avoid this linker error:

ERROR: "drm_helper_probe_single_connector_modes" [drivers/gpu/drm/bridge/ptn3460.ko] undefined!
ERROR: "drm_helper_connector_dpms" [drivers/gpu/drm/bridge/ptn3460.ko] undefined!

We have to drop the I2C dependency to avoid a circular dependency
chain, but that's ok because DRM already selects I2C.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agoMerge branch 'drm-nouveau-next' of git://anongit.freedesktop.org/git/nouveau/linux...
Dave Airlie [Wed, 26 Mar 2014 04:34:16 +0000 (14:34 +1000)]
Merge branch 'drm-nouveau-next' of git://anongit.freedesktop.org/git/nouveau/linux-2.6 into drm-next

- first stage of (ongoing) gpu fault recovery work
- initial support for maxwell (binary driver fw needed)
- various random fixes across the board

* 'drm-nouveau-next' of git://anongit.freedesktop.org/git/nouveau/linux-2.6: (87 commits)
  drm/nouveau: fix missing newline
  drm/nouveau/bios: fetch the vbios from PROM using only aligned 32-bit accesses
  drm/nouveau/therm: let the vbios decide on the automatic fan management mode
  drm/nvd7/therm: handle another kind of PWM fans
  drm/nouveau/pm/fan: drop the fan lock in fan_update() before rescheduling
  drm/nouveau: fix small thinko in vblank timestamping.
  drm/nouveau/therm: check for sensor presence with requested mode, not current
  drm/nouveau/disp/dp: allow 540MHz data rate
  drm/nouveau: recognise higher link rate for available dp bw calculations
  drm/nouveau/disp: limit dp capabilities as per dcb
  drm/nva3/fbram: restrict training pattern setup to GT218
  drm/nva3/devinit: restrict script access to some PFB regs
  drm/nouveau/devinit: add interface to check if a mmio access by scripts is ok
  drm/nouveau/bios: have strap reads show on devinit spam debug level
  drm/nv50/gpio: fixup reset for gpios >= 16
  drm/nv50/gpio: exclude sense value from mask when changing registers
  drm/gk104/gr: therm magic needed on some kepler boards
  drm/gm107/gr: initial support
  drm/gf100-/gf: fix a stupid typo, waiting on wrong signal for mmctx
  drm/nouveau/bios: parsing of some random table needed to bring up gr
  ...

10 years agodrm/nouveau: fix missing newline
Alexandre Courbot [Mon, 24 Mar 2014 08:42:23 +0000 (17:42 +0900)]
drm/nouveau: fix missing newline

Add a missing newline at the end of a DRM_INFO message.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/bios: fetch the vbios from PROM using only aligned 32-bit accesses
Martin Peres [Tue, 25 Mar 2014 21:23:23 +0000 (22:23 +0100)]
drm/nouveau/bios: fetch the vbios from PROM using only aligned 32-bit accesses

Other kind of accesses are unreliable on Kepler cards. As advised by NVIDIA,
let's only use 32-bit accesses to fetch the vbios from PROM.

This fixes vbios fetching on my nve7 which failed in certain specific
conditions.

I suggest we Cc stable, for all kernels they still maintain after the big
rewrite.

Suggested-by: Christian Zander <czander@nvidia.com>
Signed-off-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/therm: let the vbios decide on the automatic fan management mode
Martin Peres [Wed, 19 Feb 2014 00:04:56 +0000 (01:04 +0100)]
drm/nouveau/therm: let the vbios decide on the automatic fan management mode

This should fix automatic fan management on fermi cards who do not have
0x46 entries in the thermal table.

On my nve6, the blob sets the default linear range from 40°C to 100°C
but my nvcf's default values are 40°C to 85°C. Let's keep 85 as a default
for everyone.

Signed-off-by: Martin Peres <martin.peres@labri.fr>
Tested-by: Timothée Ravier <tim@siosm.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nvd7/therm: handle another kind of PWM fans
Martin Peres [Tue, 18 Feb 2014 02:56:11 +0000 (03:56 +0100)]
drm/nvd7/therm: handle another kind of PWM fans

This should fix fan management on many nvd7+ chipsets.

Signed-off-by: Martin Peres <martin.peres@labri.fr>
Tested-by: Timothée Ravier <tim@siosm.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/pm/fan: drop the fan lock in fan_update() before rescheduling
Martin Peres [Thu, 13 Mar 2014 23:26:52 +0000 (00:26 +0100)]
drm/nouveau/pm/fan: drop the fan lock in fan_update() before rescheduling

This should fix a deadlock that has been reported to us where fan_update()
would hold the fan lock and try to grab the alarm_program_lock to reschedule
an update. On an other CPU, the alarm_program_lock would have been taken
before calling fan_update(), leading to a deadlock.

We should Cc: <stable@vger.kernel.org> # 3.9+

Reported-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Tested-by: Timothée Ravier <tim@siosm.fr>
Tested-by: Boris Fersing (IRC nick fersingb, no public email address)
Signed-off-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: fix small thinko in vblank timestamping.
Mario Kleiner [Wed, 19 Mar 2014 09:02:11 +0000 (10:02 +0100)]
drm/nouveau: fix small thinko in vblank timestamping.

*hpos horizontal scanout position doesn't need to be corrected
to count the pixels between hactive end and htotal negative.
That is only needed for *vpos to count lines until end of
vblank for the vblank timestamping.

Use hpos as is without correction.

Removes occassional spikes in timestamps of up to 1 scanline
duration, thereby improves accuracy to about +/- 2 usecs instead
of +/- 12 usecs, wrt. true onset time as measured with high
precision equipment on NV-A5.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/therm: check for sensor presence with requested mode, not current
Ben Skeggs [Mon, 24 Mar 2014 03:34:47 +0000 (13:34 +1000)]
drm/nouveau/therm: check for sensor presence with requested mode, not current

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/disp/dp: allow 540MHz data rate
Ilia Mirkin [Wed, 19 Mar 2014 14:45:55 +0000 (10:45 -0400)]
drm/nouveau/disp/dp: allow 540MHz data rate

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76319
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: recognise higher link rate for available dp bw calculations
Ben Skeggs [Wed, 19 Mar 2014 23:32:01 +0000 (09:32 +1000)]
drm/nouveau: recognise higher link rate for available dp bw calculations

I should resurrect/merge that cleanup branch to remove the weird
duplication.. One day.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/disp: limit dp capabilities as per dcb
Ben Skeggs [Wed, 19 Mar 2014 23:28:00 +0000 (09:28 +1000)]
drm/nouveau/disp: limit dp capabilities as per dcb

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nva3/fbram: restrict training pattern setup to GT218
Ben Skeggs [Tue, 18 Mar 2014 19:23:10 +0000 (05:23 +1000)]
drm/nva3/fbram: restrict training pattern setup to GT218

It doesn't look like the others have the registers.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nva3/devinit: restrict script access to some PFB regs
Ben Skeggs [Tue, 18 Mar 2014 17:08:21 +0000 (03:08 +1000)]
drm/nva3/devinit: restrict script access to some PFB regs

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/devinit: add interface to check if a mmio access by scripts is ok
Ben Skeggs [Tue, 18 Mar 2014 16:56:29 +0000 (02:56 +1000)]
drm/nouveau/devinit: add interface to check if a mmio access by scripts is ok

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/bios: have strap reads show on devinit spam debug level
Ben Skeggs [Tue, 18 Mar 2014 14:55:02 +0000 (00:55 +1000)]
drm/nouveau/bios: have strap reads show on devinit spam debug level

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nv50/gpio: fixup reset for gpios >= 16
Ben Skeggs [Tue, 18 Mar 2014 14:46:47 +0000 (00:46 +1000)]
drm/nv50/gpio: fixup reset for gpios >= 16

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nv50/gpio: exclude sense value from mask when changing registers
Ben Skeggs [Tue, 18 Mar 2014 14:35:44 +0000 (00:35 +1000)]
drm/nv50/gpio: exclude sense value from mask when changing registers

Shouldn't effect anything, was just momentarily confusing while looking
at traces.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gk104/gr: therm magic needed on some kepler boards
Ben Skeggs [Wed, 5 Mar 2014 04:46:48 +0000 (14:46 +1000)]
drm/gk104/gr: therm magic needed on some kepler boards

Not needed everywhere, and potentially not safe to do depending on how
the rest of PTHERM is configured...

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gm107/gr: initial support
Ben Skeggs [Tue, 4 Mar 2014 01:00:41 +0000 (11:00 +1000)]
drm/gm107/gr: initial support

Our ucode only partially works at this point, so requiring binary fw
image for now.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gf100-/gf: fix a stupid typo, waiting on wrong signal for mmctx
Ben Skeggs [Fri, 7 Mar 2014 02:33:56 +0000 (12:33 +1000)]
drm/gf100-/gf: fix a stupid typo, waiting on wrong signal for mmctx

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/bios: parsing of some random table needed to bring up gr
Ben Skeggs [Tue, 4 Mar 2014 10:57:50 +0000 (20:57 +1000)]
drm/nouveau/bios: parsing of some random table needed to bring up gr

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nv50/bar: fix plymouth issues on certain efi macbooks
Ben Skeggs [Tue, 4 Mar 2014 05:45:35 +0000 (15:45 +1000)]
drm/nv50/bar: fix plymouth issues on certain efi macbooks

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: fix fbcon not being accelerated after suspend
Ben Skeggs [Mon, 3 Mar 2014 06:18:56 +0000 (16:18 +1000)]
drm/nouveau: fix fbcon not being accelerated after suspend

This does *not* (and is not intended to) fix the issue reported by
Christoph Rudorff on the nouveau mailinglist.

The patch proposed (which is similar to this one, but also reorders
whether we disable accel or call fb_set_suspend first), papers over
another problem entirely by avoiding touching the framebuffer.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gf100-/gr: split ppc state into its subunits
Ben Skeggs [Mon, 3 Mar 2014 06:18:56 +0000 (16:18 +1000)]
drm/gf100-/gr: split ppc state into its subunits

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gf100-/gf: split tpc state into its subunits
Ben Skeggs [Mon, 3 Mar 2014 06:18:56 +0000 (16:18 +1000)]
drm/gf100-/gf: split tpc state into its subunits

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gf100-/gr: split gpc state into its subunits
Ben Skeggs [Mon, 3 Mar 2014 06:18:56 +0000 (16:18 +1000)]
drm/gf100-/gr: split gpc state into its subunits

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gf100-/gr: tidy reg/ctx initval lists, mostly by giving them names
Ben Skeggs [Mon, 3 Mar 2014 06:18:55 +0000 (16:18 +1000)]
drm/gf100-/gr: tidy reg/ctx initval lists, mostly by giving them names

Unit names come from the Android GK20A driver.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gk110/gr: minor adjustment to some random initval
Ben Skeggs [Mon, 3 Mar 2014 06:18:55 +0000 (16:18 +1000)]
drm/gk110/gr: minor adjustment to some random initval

Change from traces of a newer binary driver version.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gk104/gr: minor adjustment to some random initval
Ben Skeggs [Mon, 3 Mar 2014 06:18:55 +0000 (16:18 +1000)]
drm/gk104/gr: minor adjustment to some random initval

Change from traces of a newer binary driver version.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gf119/gr: fix bug in some random initval
Ben Skeggs [Mon, 3 Mar 2014 06:18:55 +0000 (16:18 +1000)]
drm/gf119/gr: fix bug in some random initval

Bug noticed vs traces.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gf110/gr: fixup gpc/tpc initvals lists
Ben Skeggs [Mon, 3 Mar 2014 06:18:55 +0000 (16:18 +1000)]
drm/gf110/gr: fixup gpc/tpc initvals lists

Differences noted vs traces.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gk208/gr: minor adjustment to some random initval
Ben Skeggs [Mon, 3 Mar 2014 06:18:55 +0000 (16:18 +1000)]
drm/gk208/gr: minor adjustment to some random initval

Change from traces of a newer binary driver version.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gf108/gr: minor adjustment to some random initval
Ben Skeggs [Mon, 3 Mar 2014 06:18:55 +0000 (16:18 +1000)]
drm/gf108/gr: minor adjustment to some random initval

Bug noticed vs traces.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gf104/gr: rename gf104 (nvc4), it came before gf106 (nvc3)
Ben Skeggs [Mon, 3 Mar 2014 06:18:55 +0000 (16:18 +1000)]
drm/gf104/gr: rename gf104 (nvc4), it came before gf106 (nvc3)

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nvc0-/graph: fix gpccs fuc stack setup
Ben Skeggs [Wed, 26 Feb 2014 02:02:08 +0000 (12:02 +1000)]
drm/nvc0-/graph: fix gpccs fuc stack setup

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/bios: add more checks to PRAMIN image fetching
Ben Skeggs [Wed, 26 Feb 2014 00:14:15 +0000 (10:14 +1000)]
drm/nouveau/bios: add more checks to PRAMIN image fetching

Prevents an attempt to access VRAM on an un-posted board, which, on a
particular system with a GRID K1 installed, causes a MCE and chokes
the entire system.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agosupport for platform devices
Alexandre Courbot [Mon, 17 Feb 2014 06:17:26 +0000 (15:17 +0900)]
support for platform devices

Upcoming mobile Kepler GPUs (such as GK20A) use the platform bus instead
of PCI to which Nouveau is tightly dependent. This patch allows Nouveau
to handle platform devices by:

- abstracting PCI-dependent functions that were typically used for
  resource querying and page mapping,
- introducing a nv_device_is_pci() function that allows to make
  PCI-dependent code conditional,
- providing a nouveau_drm_platform_probe() function that takes a GPU
  platform device to be probed.

Core code as well as engine/subdev drivers are updated wherever possible
to make use of these functions. Some older drivers are too dependent on
PCI to be properly updated, but all newer code on which future chips may
depend should at least be runnable with platform devices.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: support modesetting on GM107
Ben Skeggs [Mon, 24 Feb 2014 04:29:55 +0000 (14:29 +1000)]
drm/nouveau: support modesetting on GM107

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gm100/device: recognise GM107
Ben Skeggs [Mon, 24 Feb 2014 01:28:37 +0000 (11:28 +1000)]
drm/gm100/device: recognise GM107

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gm107/disp: initial implementation
Ben Skeggs [Mon, 24 Feb 2014 04:26:44 +0000 (14:26 +1000)]
drm/gm107/disp: initial implementation

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gm107/ltcg: initial implementation
Ben Skeggs [Mon, 24 Feb 2014 04:17:49 +0000 (14:17 +1000)]
drm/gm107/ltcg: initial implementation

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/bios: add HDMI-C (mini) connector type
Ben Skeggs [Mon, 24 Feb 2014 03:41:08 +0000 (13:41 +1000)]
drm/nouveau/bios: add HDMI-C (mini) connector type

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gm107/fb: initial implementation
Ben Skeggs [Mon, 24 Feb 2014 03:28:33 +0000 (13:28 +1000)]
drm/gm107/fb: initial implementation

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gk20a/timer: initial implementation
Ben Skeggs [Mon, 24 Feb 2014 02:41:57 +0000 (12:41 +1000)]
drm/gk20a/timer: initial implementation

A bit different from NVIDIA's RFC patch, but I want this now for GM107.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gm100/bios: hw disable register has moved
Ben Skeggs [Mon, 24 Feb 2014 02:30:06 +0000 (12:30 +1000)]
drm/gm100/bios: hw disable register has moved

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gm107/devinit: initial implementation
Ben Skeggs [Mon, 24 Feb 2014 02:28:37 +0000 (12:28 +1000)]
drm/gm107/devinit: initial implementation

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nve0/fifo: bind intr
Ben Skeggs [Mon, 24 Feb 2014 05:33:27 +0000 (15:33 +1000)]
drm/nve0/fifo: bind intr

Error code names from Android GK20A driver.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nve0/fifo: attempt to recover from engine ctxsw timeouts
Ben Skeggs [Sun, 23 Feb 2014 13:50:50 +0000 (23:50 +1000)]
drm/nve0/fifo: attempt to recover from engine ctxsw timeouts

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agoMerge branch 'drm-next-3.15' of git://people.freedesktop.org/~deathsimple/linux into...
Dave Airlie [Wed, 26 Mar 2014 04:00:53 +0000 (14:00 +1000)]
Merge branch 'drm-next-3.15' of git://people.freedesktop.org/~deathsimple/linux into drm-next

this is the third pull request for 3.15 radeon changes. Highlights this time:
- More DP work from Alex, especially making use of the new DP aux helpers
- Marek's 1D and linear tiling fixes for CIK

* 'drm-next-3.15' of git://people.freedesktop.org/~deathsimple/linux:
  drm/radeon: set PIPE_CONFIG for 1D and linear tiling modes on CIK
  drm/radeon: use drm_dp_dpcd_read_link_status()
  drm/radeon: use the new drm helpers for dp aux
  drm/dp: make aux retries less chatty
  drm/radeon: clarify special handling in i2c over aux
  drm/radeon/atom: rework encoder enable/disable sequence
  drm/radeon/dp: move sink power control to a separate function
  drm/radeon/dp: use i2c_get_adapdata rather than casting

10 years agodrm/nve0/fifo: attempt to recover engines from mmu faults
Ben Skeggs [Sun, 23 Feb 2014 13:30:11 +0000 (23:30 +1000)]
drm/nve0/fifo: attempt to recover engines from mmu faults

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nve0/fifo: allow copy engine channel to be looked up by instance
Ben Skeggs [Mon, 13 Jan 2014 23:38:50 +0000 (09:38 +1000)]
drm/nve0/fifo: allow copy engine channel to be looked up by instance

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nve0/fifo: use runlist event instead of polling
Ben Skeggs [Sun, 23 Feb 2014 13:27:25 +0000 (23:27 +1000)]
drm/nve0/fifo: use runlist event instead of polling

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nve0/fifo: allow channels to be marked as unrunnable
Ben Skeggs [Sun, 23 Feb 2014 13:24:25 +0000 (23:24 +1000)]
drm/nve0/fifo: allow channels to be marked as unrunnable

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nve0/fifo: single printk for sched error data
Ben Skeggs [Sun, 23 Feb 2014 13:20:46 +0000 (23:20 +1000)]
drm/nve0/fifo: single printk for sched error data

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nve0/fifo: single printk for mmu fault data
Ben Skeggs [Sun, 23 Feb 2014 13:19:45 +0000 (23:19 +1000)]
drm/nve0/fifo: single printk for mmu fault data

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nve0/fifo: ack pb intr individually after handling each unit
Ben Skeggs [Sun, 23 Feb 2014 13:15:22 +0000 (23:15 +1000)]
drm/nve0/fifo: ack pb intr individually after handling each unit

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nve0/fifo: runlist intr
Ben Skeggs [Sun, 23 Feb 2014 13:12:37 +0000 (23:12 +1000)]
drm/nve0/fifo: runlist intr

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nve0/fifo: engine intr
Ben Skeggs [Sun, 23 Feb 2014 13:08:00 +0000 (23:08 +1000)]
drm/nve0/fifo: engine intr

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nve0/fifo: mask unhandled intr bits when seen, rather than all intrs
Ben Skeggs [Sun, 23 Feb 2014 13:06:22 +0000 (23:06 +1000)]
drm/nve0/fifo: mask unhandled intr bits when seen, rather than all intrs

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nvc0/fifo: attempt to recover from engine ctxsw timeouts
Ben Skeggs [Sat, 22 Feb 2014 02:44:23 +0000 (12:44 +1000)]
drm/nvc0/fifo: attempt to recover from engine ctxsw timeouts

My test cases don't seem to trigger this on all Fermi boards, not sure
if they're broken tests or it didn't work until later versions.

GF119 definitely works.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nvc0/fifo: attempt to recover engines from mmu faults
Ben Skeggs [Wed, 5 Feb 2014 01:18:38 +0000 (11:18 +1000)]
drm/nvc0/fifo: attempt to recover engines from mmu faults

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nvc0/fifo: use subdev identifiers for bar/ifb fault recovery cases
Ben Skeggs [Fri, 21 Feb 2014 15:29:26 +0000 (01:29 +1000)]
drm/nvc0/fifo: use subdev identifiers for bar/ifb fault recovery cases

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nvc0/fifo: use runlist event instead of polling
Ben Skeggs [Fri, 21 Feb 2014 15:05:01 +0000 (01:05 +1000)]
drm/nvc0/fifo: use runlist event instead of polling

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nvc0/fifo: allow channels to be marked as unrunnable
Ben Skeggs [Fri, 21 Feb 2014 14:52:45 +0000 (00:52 +1000)]
drm/nvc0/fifo: allow channels to be marked as unrunnable

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nvc0/fifo: sched intr
Ben Skeggs [Fri, 21 Feb 2014 15:18:46 +0000 (01:18 +1000)]
drm/nvc0/fifo: sched intr

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