BACKPORT: drm/crtc-helper: remove LOCKING from kerneldoc

- It yells.
- WARNing about incorrect locking is harder to ignore, so better
  than kerneldoc.
- Since those have been written per-crtc locks were added ...

So remove them and replace them by appropriate WARNs.

BUG=chromium:344930
TEST=test modeset, external monitor, general operation on daisy and
panther

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 62ff94a5492175759546f8bc61383189d6b49122)
Signed-off-by: David Sodman <dsodman@chromium.org>

Conflicts:
	drivers/gpu/drm/drm_crtc_helper.c

Change-Id: I0438b267674877d6f43bcbd20125347372a97fef
Reviewed-on: https://chromium-review.googlesource.com/212728
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Commit-Queue: David Sodman <dsodman@chromium.org>
Tested-by: David Sodman <dsodman@chromium.org>
BACKPORT: drm: Handle ->disable_plane failures correctly

The ->disable_plane hook always had a return value, but only since the
introduction of primary planes was there any implementation that
actually failed.

So handle such failures correctly.

Note that drm_plane_force_disable is special: In the modeset cleanup
case we first disable all crtc, so primary planes should all be freed
already. And in the fb helper we only reset non-primary planes. Still
better be paranoid and add an early return.

I don't see how this could happen, but it might fix the fb refcount
underrun Thierry is seeing. Matt Roper spotted this issue.

BUG=chromium:344930
TEST=test modeset, external monitor, general operation on daisy and
panther

Cc: Thierry Reding <treding@nvidia.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 731cce487ab0485c6607e44a0759d92bef1c144e)
Signed-off-by: David Sodman <dsodman@chromium.org>

Conflicts:
	drivers/gpu/drm/drm_crtc.c

Change-Id: I41d574dda196c51888ddedb816fc37a19f9f18f8
Reviewed-on: https://chromium-review.googlesource.com/212729
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Commit-Queue: David Sodman <dsodman@chromium.org>
Tested-by: David Sodman <dsodman@chromium.org>
CHROMIUM: iwl7000: mac80211: use bss_conf->dtim_period instead of conf.ps_dtim_period

sta_set_sinfo is obviously takes data for specific station.
This specific station is attached to a specific virtual
interface. Hence we should use the dtim_period from this
virtual interface rather than the system wide dtim_period.

BUG=chrome-os-partner:30201
TEST=run network_WiFi_DTIMPeriod test (many times)

Change-Id: I8a49582b1db046f07445b2381d1790a102c16930
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/214256
Reviewed-by: Paul Stewart <pstew@chromium.org>
Reviewed-by: Matt Chen <matt.chen@intel.com>
CHROMIUM: iwl7000: mvm: use bss_conf->dtim_period instead of conf.ps_dtim_period

The latter is meant for software implementation of power
save and is not per-virtual interface. Since our driver
supports multiple virtual interfaces, we need to use
vif->bss_conf.dtim_period.

BUG=chrome-os-partner:30201
TEST=run network_WiFi_DTIMPeriod test (many times)

Change-Id: Ida5656eec686deb606bf144e4d16ee391f59c1a5
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/214257
Reviewed-by: Paul Stewart <pstew@chromium.org>
Reviewed-by: Matt Chen <matt.chen@intel.com>
Merge branch 'chromeos-3.8' of https://chromium.googlesource.com/chromiumos/third_party/kernel into chromeos-3.8
BACKPORT: drm/i915: Pre-compute pipe enabled state

Add 'new_enabled' to intel_crtc and precompute it alongside new_encoder
and new_crtc. This will allow making decisions about shared resources
that are affected by the set of active pipes, before we've clobbered
anything for real.

BUG=chromium:344930
TEST=test modeset, external monitor, general operation on daisy and
panther

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 7668851fec5c207d1d62c4c9311e083edf940bcc)
Signed-off-by: David Sodman <dsodman@chromium.org>

Conflicts:
	drivers/gpu/drm/i915/intel_display.c

Change-Id: Ibca0413a0ebac50cad602ea2777598e17c65a261
(cherry picked from commit e371ca13e1237118d57932fe64f3032be27ffa8b)
Signed-off-by: David Sodman <dsodman@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/208507
BACKPORT: drm/i915: Prepare to track new pipe config per pipe

Add a new_config pointer to intel_crtc which will point to the new pipe
config for said crtc while intel_crtc.config will still contain the old
config during first parts of the modeset operation. This is a step
towards having the entire new state available during the compute phase,
so that we can make accurate decisions about global resource usage.

BUG=chromium:344930
TEST=test modeset, external monitor, general operation on daisy and
panther

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 50741abcd1b022c6555925837601624ca5a238cd)
Signed-off-by: David Sodman <dsodman@chromium.org>

Conflicts:
	drivers/gpu/drm/i915/intel_display.c

Change-Id: I6890ecdb0a1e8b5a4b7bc4ae0607297567256992
(cherry picked from commit e1620ea26276e1ee1b5bb0758f9db6396bf993b3)
Signed-off-by: David Sodman <dsodman@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/208508
BACKPORT: drm/i915: Fix new_config and new_enabled for load detect

I forgot to set new_config and new_enabled appropriately in the load
detect code. Fix it up.

v2: Handle the other error path in intel_get_load_detect_pipe() too (Imre)

BUG=chromium:344930
TEST=test modeset, external monitor, general operation on daisy and
panther

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 412b61d83a2d3e74527633097820db7510f97ce1)
Signed-off-by: David Sodman <dsodman@chromium.org>

Change-Id: I5608878b6a7589184869518658d43534a228f477
(cherry picked from commit 2b344d09c92f7b49c4220c84b6522af27316e8db)
Signed-off-by: David Sodman <dsodman@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/208509
BACKPORT: drm/i915: duct-tape locking when eDP init fails

Thanks to apple gpu mux fail we detect an eDP output, but can't read
anything over dp aux. In the resulting failure path we then hit a
paranoid WARN about potential locking.

Since the WARN is pretty useful for normal operation just paper over
it in the failure case by grabbing the demanded (but for init/teardown
not really required) lock.

I've checked our driver unload code and we already don't hold the kms
lock when calling drm_mode_config_cleanup. So this won't lead to a new
deadlock when reloading i915.ko.

v2: Make it compile.

BUG=chromium:344930
TEST=test modeset, external monitor, general operation on daisy and
panther

Reported-by: Dave Airlie <airlied@gmail.com>
Cc: Dave Airlie <airlied@gmail.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit bd17381372c0740c43a9addf0d80271f647f2b38)
Signed-off-by: David Sodman <dsodman@chromium.org>

Change-Id: I09b7f4e49295db93b209fc60f7b46f04777b7da1
(cherry picked from commit 50e49c835989631e8af8152b089dcb74b8c369c5)
Signed-off-by: David Sodman <dsodman@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/208510
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
BACKPORT: drm: helpers to find mode objects

Add a few more useful helpers to find mode objects.

BUG=chromium:344930
TEST=test modeset, external monitor, general operation on daisy and
panther

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit a2b34e226ac9fbd20179091fad0ee1a24ad48669)
Signed-off-by: David Sodman <dsodman@chromium.org>

Conflicts:
	drivers/gpu/drm/drm_crtc.c
	include/drm/drm_crtc.h

Change-Id: I64077b9535833ca29b94ece8d855b72d562b42f6
(cherry picked from commit 18beb1a2ae4a21aba01df02b7ac1c889e7b7c232)
Signed-off-by: David Sodman <dsodman@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/210132
Reviewed-by: Sean Paul <seanpaul@chromium.org>
BACKPORT: drm: add extended property types

If we continue to use bitmask for type, we will quickly run out of room
to add new types.  Split this up so existing part of bitmask range
continues to function as before, but reserve a chunk of the remaining
space for an integer type-id.  Wrap this all up in some type-check
helpers to keep the backwards-compat uglyness contained.

BUG=chromium:344930
TEST=test modeset, external monitor, general operation on daisy and
panther

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 5ea22f24d77b511d68c4ecaf4e6fd5d6ab462b8f)
Signed-off-by: David Sodman <dsodman@chromium.org>

Change-Id: I4411b36d92c3de5a28ad97ffb90a3e28ea677c8a
(cherry picked from commit 705c608c3a77a74e758b8ddfcc937c67e41af5f8)
Signed-off-by: David Sodman <dsodman@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/208512
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
BACKPORT: drm: add object property type

An object property is an id (idr) for a drm mode object.  This
will allow a property to be used set/get a framebuffer, CRTC, etc.

BUG=chromium:344930
TEST=test modeset, external monitor, general operation on daisy and
panther

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 98f75de40e9d83c3a90d294b8fd25fa2874212a9)
Signed-off-by: David Sodman <dsodman@chromium.org>

Conflicts:
	drivers/gpu/drm/drm_crtc.c

Change-Id: I77f48c9c9561eed24c80c788eae075b0fdfe06ed
(cherry picked from commit 480fca245c8af5a954f048cca9741edac4647a3a)
Signed-off-by: David Sodman <dsodman@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/208513
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
BACKPORT: drm: add signed-range property type

Like range, but values are signed.

BUG=chromium:344930
TEST=test modeset, external monitor, general operation on daisy and
panther

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
(cherry picked from commit ebc44cf386734374983922c6fc1ae8ac47f88bef)
Signed-off-by: David Sodman <dsodman@chromium.org>

Conflicts:
	drivers/gpu/drm/drm_crtc.c
	include/drm/drm_crtc.h

Change-Id: Ib4f3774e4b6a25b5d05ab3a0bb8e7f5209e8adbe
(cherry picked from commit efd8420a0ca05344a38b5b51776766420d3c4956)
Signed-off-by: David Sodman <dsodman@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/208514
BACKPORT: drm: spiff out FB refcnting traces

I find myself making this change locally whenever debugging FB reference
counting.  Which seems a bit silly.

BUG=chromium:344930
TEST=test modeset, external monitor, general operation on daisy and
panther

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
(cherry picked from commit 8291272ad234ff21628ce1af9043847f01f58734)
Signed-off-by: David Sodman <dsodman@chromium.org>

Change-Id: Iaca4f6b4043c44138efdc31f028f68b225a99847
(cherry picked from commit 609800f7864d69606104eaa52831ca73ccae516f)
Signed-off-by: David Sodman <dsodman@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/208515
BACKPORT: drm/i915: fixup per-crtc locking in intel_release_load_detect_pipe

One of the early return cases missed the mutex unlocking. Hilarity
ensued.

This regression has been introduced in

commit 7b24056be6db7ce907baffdd4cf142ab774ea60c
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Wed Dec 12 00:35:33 2012 +0100

    drm: don't hold crtc mutexes for connector ->detect callbacks

BUG=chromium:344930
TEST=test modeset, external monitor, general operation on daisy and
panther

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=59750
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Tested-by: Cancan Feng <cancan.feng@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 67c964000236497e00c646472cd6b70b5c5109c8)
Signed-off-by: David Sodman <dsodman@chromium.org>

Change-Id: I0c512fde847c707407d2a6e80051d57c1461999f
(cherry picked from commit d6621c9bdf10e635eeab6a384e87760879672355)
Signed-off-by: David Sodman <dsodman@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/210133
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
BACKPORT: drm: Split connection_mutex out of mode_config.mutex (v3)

After the split-out of crtc locks from the big mode_config.mutex
there's still two major areas it protects:
- Various connector probe states, like connector->status, EDID
  properties, probed mode lists and similar information.
- The links from connector->encoder and encoder->crtc and other
  modeset-relevant connector state (e.g. properties which control the
  panel fitter).

The later is used by modeset operations. But they don't really care
about the former since it's allowed to e.g. enable a disconnected VGA
output or with a mode not in the probed list.

Thus far this hasn't been a problem, but for the atomic modeset
conversion Rob Clark needs to convert all modeset relevant locks into
w/w locks. This is required because the order of acquisition is
determined by how userspace supplies the atomic modeset data. This has
run into troubles in the detect path since the i915 load detect code
needs _both_ protections offered by the mode_config.mutex: It updates
probe state and it needs to change the modeset configuration to enable
the temporary load detect pipe.

The big deal here is that for the probe/detect users of this lock a
plain mutex fits best, but for atomic modesets we really want a w/w
mutex. To fix this lets split out a new connection_mutex lock for the
modeset relevant parts.

For simplicity I've decided to only add one additional lock for all
connector/encoder links and modeset configuration states. We have
piles of different modeset objects in addition to those (like bridges
or panels), so adding per-object locks would be much more effort.

Also, we're guaranteed (at least for now) to do a full modeset if we
need to acquire this lock. Which means that fine-grained locking is
fairly irrelevant compared to the amount of time the full modeset will
take.

I've done a full audit, and there's just a few things that justify
special focus:
- Locking in drm_sysfs.c is almost completely absent. We should
  sprinkle mode_config.connection_mutex over this file a bit, but
  since it already lacks mode_config.mutex this patch wont make the
  situation any worse. This is material for a follow-up patch.

- omap has a omap_framebuffer_flush function which walks the
  connector->encoder->crtc links and is called from many contexts.
  Some look like they don't acquire mode_config.mutex, so this is
  already racy. Again fixing this is material for a separate patch.

- The radeon hot_plug function to retrain DP links looks at
  connector->dpms. Currently this happens without any locking, so is
  already racy. I think radeon_hotplug_work_func should gain
  mutex_lock/unlock calls for the mode_config.connection_mutex.

- Same applies to i915's intel_dp_hot_plug. But again, this is already
  racy.

- i915 load_detect code needs to acquire this lock. Which means the
  w/w dance due to Rob's work will be nicely contained to _just_ this
  function.

I've added fixme comments everywhere where it looks suspicious but in
the sysfs code. After a quick irc discussion with Dave Airlie it
sounds like the lack of locking in there is due to sysfs cleanup fun
at module unload.

v1: original (only compile tested)

v2: missing mutex_init(), etc (from Rob Clark)

v3: i915 needs more care in the conversion:
- Protect the edp pp logic with the connection_mutex.
- Use connection_mutex in the backlight code due to
  get_pipe_from_connector.
- Use drm_modeset_lock_all in suspend/resume paths.
- Update lock checks in the overlay code.

BUG=chromium:344930
TEST=test modeset, external monitor, general operation on daisy and
panther

Cc: Alex Deucher <alexdeucher@gmail.com>
Cc: Rob Clark <robdclark@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Rob Clark <robdclark@gmail.com>
(cherry picked from commit 6e9f798d91c526982cca0026cd451e8fdbf18aaf)
Signed-off-by: David Sodman <dsodman@chromium.org>

Conflicts:
	drivers/gpu/drm/drm_crtc_helper.c
	drivers/gpu/drm/i915/i915_debugfs.c
	drivers/gpu/drm/i915/i915_drv.c
	drivers/gpu/drm/i915/intel_display.c
	drivers/gpu/drm/i915/intel_dp.c
	drivers/gpu/drm/i915/intel_opregion.c
	drivers/gpu/drm/i915/intel_panel.c

(cherry picked from commit a249f6849dfdcb7fea6241c5b39e288d2b318acb)
Signed-off-by: David Sodman <dsodman@chromium.org>

Conflicts:
	drivers/gpu/drm/drm_crtc_helper.c

Change-Id: If620a254fbd36102e14405a058967f3c01f65031
Reviewed-on: https://chromium-review.googlesource.com/212740
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Tested-by: David Sodman <dsodman@chromium.org>
Commit-Queue: David Sodman <dsodman@chromium.org>
BACKPORT: drm: Check CRTC compatibility in setplane

The DRM core setplane code should check that the plane is usable on the
specified CRTC before calling into the driver.

Prior to this patch, a plane's possible_crtcs field was purely
informational for userspace and was never actually verified at the
kernel level (aside from the primary plane helper).

BUG=chromium:344930
TEST=test modeset, external monitor, general operation on daisy and
panther

Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Chon Ming Lee <chon.ming.lee@intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Acked-by: Dave Airlie <airlied@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 7f994f3fc4f44365a953dbcac55131b7160750ea)
Signed-off-by: David Sodman <dsodman@chromium.org>

Conflicts:
	drivers/gpu/drm/drm_crtc.c

Change-Id: I3db6045b5a3ac7aa638ad4d7208025ccc4355d6c
Reviewed-on: https://chromium-review.googlesource.com/212741
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Tested-by: David Sodman <dsodman@chromium.org>
Commit-Queue: David Sodman <dsodman@chromium.org>
BACKPORT: drm: Fix getconnector connection_mutex locking

I've fumbled my own idea and enthusiastically wrapped all the
getconnector code with the connection_mutex. But we only need it to
chase the connector->encoder link. Even there it's not really needed
since races with userspace won't matter, but better paranoid and
consistent about this stuff.

If we grap it everywhere connector probe callbacks can't grab it
themselves, which means they'll deadlock. i915 does that for the load
detect pipe. Furthermore i915 needs to do a ww dance since we also
need to grab the mutex of the load detect crtc.

This is a regression from

commit 6e9f798d91c526982cca0026cd451e8fdbf18aaf
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Thu May 29 23:54:47 2014 +0200

    drm: Split connection_mutex out of mode_config.mutex (v3)

Cc: Rob Clark <robdclark@gmail.com>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>

BUG=chromium:344930
TEST=test modeset, external monitor, general operation on daisy and
panther

Reported-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 832fd395ce61710c82d871196f7c7cd41fb076b6)
Signed-off-by: David Sodman <dsodman@chromium.org>

Conflicts:
	drivers/gpu/drm/drm_crtc.c

Change-Id: If0219c33a3a5c2e2da22e73711ae53eaeee889f9
(cherry picked from commit 4634d2ad6751facd3451381b1082f587f69928aa)
Signed-off-by: David Sodman <dsodman@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/210134
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
BACKPORT: drm: Refactor setplane to allow internal use (v3)

Refactor DRM setplane code into a new setplane_internal() function that
takes DRM objects directly as parameters rather than looking them up by
ID.  We'll use this in a future patch when we implement legacy cursor
ioctls on top of the universal plane interface.

v3:
 - Move integer overflow checking from setplane_internal to setplane
   ioctl.  The upcoming legacy cursor support via universal planes needs
   to maintain current cursor ioctl semantics and not return error for
   these extreme values (found via intel-gpu-tools kms_cursor_crc test).
v2:
 - Allow planes to be disabled without a valid crtc again (and add
   mention of this to setplane's kerneldoc, since it doesn't seem to be
   mentioned anywhere else).
 - Reformat some parameter line wrap

BUG=chromium:344930
TEST=test modeset, external monitor, general operation on daisy and
panther

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Pallavi G<pallavi.g@intel.com>
Acked-by: Dave Airlie <airlied@linux.ie>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit b36552b32aa9c69e83a3a20bda56379fb9e52435)
Signed-off-by: David Sodman <dsodman@chromium.org>

Conflicts:
	drivers/gpu/drm/drm_crtc.c

Change-Id: Iee2d8ee0efe9603e250dc6dcef166f26fe3ae43a
Reviewed-on: https://chromium-review.googlesource.com/212742
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Tested-by: David Sodman <dsodman@chromium.org>
Commit-Queue: David Sodman <dsodman@chromium.org>
BACKPORT: drm: Avoid NULL deference when disabling a plane from userspace

To disable a plane, userspace passes in an framebuffer id of 0. This
causes us to pass CRTC == NULL to setplane_internal, who promptly
deferences it to grab the struct drm_device. Oops.

[ 1296.467327] BUG: unable to handle kernel NULL pointer dereference at   (null)
[ 1296.467332] IP: [<c134dc51>] setplane_internal+0x11/0x280
[ 1296.467338] *pde = 00000000
[ 1296.467341] Oops: 0000 [#1] SMP
[ 1296.467344] Modules linked in: ccm bnep bluetooth snd_hda_codec_hdmi snd_hda_codec_idt snd_hda_codec_generic snd_hda_intel arc4 iwldvm snd_hda_controller snd_hda_codec mac80211 snd_hwdep snd_seq snd_seq_device snd_pcm snd_timer iwlwifi sdhci_pci snd cfg80211 x86_pkg_temp_thermal hp_wmi sdhci sparse_keymap mmc_core crc32c_intel rfkill microcode hp_accel lpc_ich lis3lv02d wmi mfd_core serio_raw input_polldev soundcore e1000e ptp pps_core
[ 1296.467367] CPU: 1 PID: 672 Comm: Xorg Tainted: G        W     3.15.0-rc8+ #351
[ 1296.467369] Hardware name: Hewlett-Packard HP ProBook 6360b/1620, BIOS 68SCF Ver. B.42 12/29/2010
[ 1296.467371] task: f423b5c0 ti: c2332000 task.ti: c2332000
[ 1296.467374] EIP: 0060:[<c134dc51>] EFLAGS: 00013286 CPU: 1
[ 1296.467376] EIP is at setplane_internal+0x11/0x280
[ 1296.467378] EAX: 00000000 EBX: c2333e90 ECX: 00000000 EDX: f3165600
[ 1296.467380] ESI: f430f400 EDI: 00000000 EBP: c2333e14 ESP: c2333dd4
[ 1296.467382]  DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
[ 1296.467384] CR0: 80050033 CR2: 00000000 CR3: 00159000 CR4: 000407d0
[ 1296.467385] Stack:
[ 1296.467387]  000200da 00000002 c2333de8 c15dc4a0 f430f400 c2333e00 c134c54f eeeeeeee
[ 1296.467391]  f430f400 00000007 f416b480 c2333e14 00000000 c2333e90 f430f400 00000000
[ 1296.467396]  c2333e4c c1350aed 00000000 00000000 00000000 00000000 00000000 00000000
[ 1296.467400] Call Trace:
[ 1296.467406]  [<c15dc4a0>] ? mutex_lock+0x10/0x28
[ 1296.467408]  [<c134c54f>] ? _object_find+0x5f/0x90
[ 1296.467413]  [<c1350aed>] drm_mode_setplane+0x10d/0x1f0
[ 1296.467416]  [<c13509e0>] ? drm_mode_getplane+0x100/0x100
[ 1296.467420]  [<c1342e4d>] drm_ioctl+0x1bd/0x4f0
[ 1296.467423]  [<c13509e0>] ? drm_mode_getplane+0x100/0x100
[ 1296.467427]  [<c111c023>] ? handle_mm_fault+0x5d3/0xb30
[ 1296.467431]  [<c1118f31>] ? tlb_finish_mmu+0x11/0x40
[ 1296.467435]  [<c1342c90>] ? drm_ioctl_flags+0x40/0x40
[ 1296.467438]  [<c11593d2>] do_vfs_ioctl+0x2f2/0x4d0
[ 1296.467443]  [<c1226512>] ? inode_has_perm.isra.32+0x32/0x40
[ 1296.467446]  [<c122662f>] ? file_has_perm+0x7f/0x90
[ 1296.467449]  [<c1226fec>] ? selinux_file_ioctl+0x4c/0xf0
[ 1296.467452]  [<c1159610>] SyS_ioctl+0x60/0x90
[ 1296.467456]  [<c15e578c>] sysenter_do_call+0x12/0x22
[ 1296.467457] Code: 3f cf ff eb dd ba 3f 00 00 00 b8 d9 c9 7f c1 e8 e6 3f cf ff eb d9 8d 74 26 00 55 89 e5 57 56 53 83 ec 34 66 66 66 66 90 89 45 f0 <8b> 00 85 c9 89 d6 89 cb 89 45 ec 0f 84 16 01 00 00 8b 45 f0 e8
[ 1296.467485] EIP: [<c134dc51>] setplane_internal+0x11/0x280 SS:ESP 0068:c2

Fixes regression from
commit b02fd7fd8a541c3d590bfdda23365a927b507ceb
Author: Matt Roper <matthew.d.roper@intel.com>
Date:   Tue Jun 10 08:28:10 2014 -0700

    drm: Support legacy cursor ioctls via universal planes when possible (v4)

While at it move the plane parameter to the first position in
setplane_internal since that's the main object we're manipulating.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Pallavi G<pallavi.g@intel.com>
Cc: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
[danvet: Add note about parameter reordering.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>

(cherry picked from commit 17cfd91f3985f23f92b8c7cba3307a2b630feb95)
Signed-off-by: David Sodman <dsodman@chromium.org>

Conflicts:
	drivers/gpu/drm/drm_crtc.c

Change-Id: Ie7eff0f00887c8bb008f8e5501ce725cf6f146ca
Reviewed-on: https://chromium-review.googlesource.com/214225
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Tested-by: David Sodman <dsodman@chromium.org>
Commit-Queue: David Sodman <dsodman@chromium.org>