Commit graph

23865 commits

Author SHA1 Message Date
Jordan Crouse
d4a7e95db8 msm: kgsl: Refactor MMU/IOMMU support
The current MMU code assumes a binary state - either there is a
IOMMU or there isn't. This precludes other memory models and
makes for a lot of inherent IOMMU knowledge in the generic MMU
code and the rest of the driver.  Reorganize and cleanup the
MMU and IOMMU code:

 * Add a Kconfig boolean dependent on  ARM and/or MSM SMMU support.
 * Make "nommu" mode an actual MMU subtype and figure out available
   MMU subtypes at probe time.
 * Move IOMMU device tree parsing to the IOMMU code.
 * Move the MMU subtype private structures into struct kgsl_mmu.
 * Move adreno_iommu specific functions out of other generic
   adreno code.
 * Move A4XX specific preemption code out of the ringbuffer code.

CRs-Fixed: 970264
Change-Id: Ic0dedbad1293a1d129b7c4ed1105d684ca84d97f
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
2016-03-23 21:19:19 -07:00
Rajesh Kemisetti
721a66e665 msm: kgsl: Declare platform_bus_type as secure for ARM driver
ARM driver supports only one bus for all context banks.

In some cases, hypervisor may not be available and GPU SMMU
uses ARM driver. This will make all context banks are on
non secure bus and kgsl_mmu_bus_secured() returns -EPERM.

Make platform_bus_type as secure for ARM driver.

Change-Id: I11a637ca2b1ef29cc42c9811cad009312a2879cd
Signed-off-by: Rajesh Kemisetti <rajeshk@codeaurora.org>
2016-03-23 21:19:05 -07:00
Jordan Crouse
bc3e27ab70 msm: kgsl: Move all platform drivers to the same module init function
There can only be one module_init() function per module.  Move all
three driver register calls into the same initialization function. The
ordering should still work correctly.

Change-Id: Ic0dedbadf7c69221a836ba3bbba362d0660f1f0f
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
2016-03-23 21:18:42 -07:00
Jordan Crouse
da324cf8f6 msm: kgsl: Add and use KGSL_DEVICE macro
Add a helper macro to convert an adreno_device pointer to a
struct kgsl_device pointer.  This is mostly syntatic sugar
but it makes the code a bit cleaner and it abstracts a bit of
the ugliness away.

Change-Id: Ic0dedbadd97bda3316a58514a5a64757bd4154c7
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
2016-03-23 21:18:41 -07:00
Jordan Crouse
11d4029da9 msm: kgsl: Add KGSL_RB_DEVICE macro
The ringbuffer structures are static members of struct adreno_device
which means that they are permanently associated with a specific
adreno device and by extension a struct kgsl_device too. The upshot
is that we can use macro math to derive the adreno device from
a ringbuffer pointer and get rid of the device shortcut in the
ringbuffer struct.  This also gives us a chance to clean up
how functions use the ringbuffer and adreno_device structs
to limit unnessesary dereferencing.

Change-Id: Ic0dedbad909ef71e99cd3319713cee38fb1700f0
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
2016-03-23 21:18:40 -07:00
Hareesh Gundu
3662821930 msm: kgsl: Don't overwrite the VBIF XIN offset for A3xx
Currently VBIF XIN register offset is been overwritten by
the AXI offset. This will cause VBIF XIN halt time out in
VBIF clear transaction path. Fix this by using the proper
VBIF XIN offset for A3xx targets.

Change-Id: Iac20528cb105904e46e012d67287dd736fa11f70
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
2016-03-23 21:18:36 -07:00
Shrenuj Bansal
b6200b61fb msm: kgsl: Properly enable bit 5 in CP_INIT mask
Use bit 5 in the CP_INIT_MASK to properly enable/disable
microcode workarounds.

Change-Id: I9f43c8c988c3179b3de2cce071339bc565b4a00d
Signed-off-by: Carter Cooper <ccooper@codeaurora.org>
2016-03-23 21:18:29 -07:00
Harshdeep Dhatt
e34ca145b3 msm: kgsl: Fix the snapshot mempool size calculation
The snapshot mempool size takes into account the memory
required for section headers. It was being calculated based
on old header structure. Update that to avoid corruption/
buffer overflow of the mempool memory.

Change-Id: I07274934e4c0dced707e03be3e31b2459e00d706
Signed-off-by: Harshdeep Dhatt <hdhatt@codeaurora.org>
2016-03-23 21:18:28 -07:00
Jonathan Wicks
b290459823 msm: kgsl: Add A5x support for CONTEXT_SWITCH_YIELD preemption
Enable CP to process yield packets placed in the IB2s.

Change-Id: I2fadfb108a2dc42f574b3f6ed2e667baddb7889c
Signed-off-by: Jonathan Wicks <jwicks@codeaurora.org>
2016-03-23 21:18:15 -07:00
Carter Cooper
30e849fa8b msm: kgsl: Avoid an interrupt storm from the GPU
CP_CACHE_FLUSH interrupts can storm on very rare occasions.
Check for this interrupt storm and do nothing when it occurs
rather than thrashing the CPU which can occasionally bring the
system down.

Change-Id: I0528ad4fec43abfaeeba1499d0b0e51e14b09f0d
Signed-off-by: Carter Cooper <ccooper@codeaurora.org>
2016-03-23 21:17:19 -07:00
Harshdeep Dhatt
b0d56ee1cb msm: kgsl: Make snapshot resilient to a non-existent ib1base
During snapshot, we may encounter an invalid IB1 base which
is not found in the current rb. In that case, dump the entire
ringbuffer from start to end and all the IBs in it to get a
more complete picture of the failure.

Change-Id: I4393c7de6f8f4890870fa6e2b5e69073dce922b7
Signed-off-by: Harshdeep Dhatt <hdhatt@codeaurora.org>
2016-03-23 21:16:59 -07:00
Harshdeep Dhatt
55946b6985 msm: kgsl: Add accounting for memory mapped in userspace
For proper memory accounting, a key metric is to know how much
memory kgsl allocated for a process and how much of it the process
is actually using. This is done by keeping track of memory in our
vmfault routines. This information is provided via the process
mem file.

Change-Id: I7e3371a708ea5fdade3840b2384b3bc4012ad004
Signed-off-by: Harshdeep Dhatt <hdhatt@codeaurora.org>
2016-03-23 21:16:58 -07:00
Jordan Crouse
531fca9ffc msm: kgsl: Move global pagetable entries to the IOMMU driver
Global pagetable entries are exclusively for IOMMU and per-process
pagetables.  Move all the code out of the generic driver and into
the IOMMU driver and clean up a bunch of stuff along the way.

Change-Id: Ic0dedbadbb368bb2a289ba4393f729d7e6066a17
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
2016-03-23 21:16:32 -07:00
Jordan Crouse
7359adc0bf msm: kgsl: Move setstate to the IOMMU initialization
The setstate memory is a IOMMU specific construct.  Move it to the
IOMMU code where it belongs.

Change-Id: Ic0dedbada977f2861f7c1300a5365da5b09d70a9
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
2016-03-23 21:16:31 -07:00
Harshdeep Dhatt
8e26a3a840 msm: kgsl: Do not purge non-overlapping freemem list entries
A freemem list entry maybe truncated/deleted even if it doesn't
overlap with a new buffer, for example, if the new buffer is entirely
to the left or right of the entry. Fix the conditional logic so
that an entry may be truncated/deleted only if it overlaps with
the new buffer.

Change-Id: Ib1519f20d3b56c1e0ed36e9e0afb33c1b31d6166
Signed-off-by: Harshdeep Dhatt <hdhatt@codeaurora.org>
2016-03-23 21:16:23 -07:00
Harshdeep Dhatt
1380e19dc8 msm: kgsl: Purge a memfree entry correctly
For the case when newly allocated gpuaddr falls between
a memfree entry's gpuaddr and size, the size of the mem
entry was being truncated to a negative value. Fix
the math to reflect the truncated size correctly.

Change-Id: Id39519acc2af106240db8f41539b9fd1dc0cb0eb
Signed-off-by: Harshdeep Dhatt <hdhatt@codeaurora.org>
2016-03-23 21:16:22 -07:00
Harshdeep Dhatt
68d94e70f6 msm: kgsl: Correctly save the process mem entries in snapshot
All the mem entries were being written to a single location hence
the snapshot consisted of only the last mem entry of the process.
Fix this by writing each mem entry to consecutive location in the
snapshot.

Change-Id: I1971fc4b3adce3146768862a56db2b11c6ac44c4
Signed-off-by: Harshdeep Dhatt <hdhatt@codeaurora.org>
2016-03-23 21:16:21 -07:00
Rajesh Kemisetti
52939ea591 msm: kgsl: BUG_ON only if address is not an error
_gpu_find_svm() makes a BUG_ON if the returned address is
greater than ULONG_MAX.

But in 32bit kernel, Error conditions would also make the
comparison to be true. Because it compares address or
error in unit64_t with ULONG_MAX which is in 32bit.

Check whether returned address is an error before making the BUG_ON.

Change-Id: I482b330db3e06a1bee31dd6931faf239a61f9ab8
Signed-off-by: Rajesh Kemisetti <rajeshk@codeaurora.org>
2016-03-23 21:16:16 -07:00
Carter Cooper
4318bd3cd6 msm: kgsl: Free allocated memory on early return
Make sure the allocated memory is freed before returning.

Change-Id: I6da7d1ffbd83ad206970e38ac99f9da211ffe86c
Signed-off-by: Carter Cooper <ccooper@codeaurora.org>
2016-03-23 21:16:04 -07:00
Oleg Perelet
24dc1862e7 msm: kgsl: Account for throttled clock cycles in DCVS
Limits management can force clock throttling which results in incorrect
busy percentage calculation. We need to account for that in DCVS.

Change-Id: Iaa17a7f7d661ab9966597f7710374d5b2e00d514
Signed-off-by: Oleg Perelet <operelet@codeaurora.org>
2016-03-23 21:15:42 -07:00
Suman Tatiraju
6a1704d165 msm: kgsl: Fix direct references to HZ
Make the various timeout values HZ agnostic by using the proper
macros and values instead.

Change-Id: I708cd491f593782f0172cd7d2cca058cd41044a5
Signed-off-by: Suman Tatiraju <sumant@codeaurora.org>
2016-03-23 21:15:24 -07:00
Rajesh Kemisetti
b9ad61fb8e msm: kgsl: Add missing check for size against lower VA
_get_unmapped_area_topdown() subtracts the requested size
from lower entry base without really checking its value.

This leads to overflow while working at boundary conditions.

Add a condition to check entry base with the size and proceed.

Change-Id: Ic695da683b11de35c7c4b8936a35d693dc8fa452
Signed-off-by: Rajesh Kemisetti <rajeshk@codeaurora.org>
2016-03-23 21:14:53 -07:00
Tarun Karra
1757ab898b msm: kgsl: Prevent deadlock in cmdbatch timer
Dispatcher can acquire drawctxt->lock if context is pending
and the fence it is waiting on just got signalled.
Dispatcher acquires drawctxt->lock and tries to delete the
cmdbatch timer using delete_timer_sync(). Delete_timer_sync()
waits till timer and its pending handlers are deleted.
But if the timer expires at the same time, timer handler
could be waiting on drawctxt->lock leading to a
deadlock. To prevent this use spin_trylock_bh() instead of
spin_lock_bh(). spin_trylock_bh() does not wait for the lock
if it does not get it and allows the timer handler to finish.
This prevents the deadlock.

Change-Id: Ic2344fed5fccb581b58ec0b66b45ba68af9f1459
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
2016-03-23 21:14:52 -07:00
Oleg Perelet
d1fcd1dbe8 msm: kgsl: Add A540 limits management
Add ISENSE based limit management, provide interfaces to GPMU
and hardware LLM and BCL subsystems.

Change-Id: Ic0419509bdc6d4d9d478277cc90ae75dc527ca66
Signed-off-by: Oleg Perelet <operelet@codeaurora.org>
2016-03-23 21:13:43 -07:00
Tarun Karra
6dc0e71825 msm: kgsl: Add support for the A540 GPU
Add support for the A540 GPU device:
   * Add entry to the GPU list and add adreno_is_a540() functions
   * Add VBIF settings
   * Add hardware clock gating values

Change-Id: Ibd653597400ded01ca05607fbbdafea3e86e177f
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
Signed-off-by: Oleg Perelet <operelet@codeaurora.org>
2016-03-23 21:13:42 -07:00
Carter Cooper
53dbbb3ed6 msm: kgsl: Remove tracking virtual map sizes
mmapsize is no longer important to the memory descriptor
and the APIs that would use it never materialized. It currently
just tracks the size of the memdesc and is no longer needed.

Change-Id: I8fa1001c2f89f23034029de7de6ab77532bf45fa
Signed-off-by: Carter Cooper <ccooper@codeaurora.org>
2016-03-23 21:13:41 -07:00
Carter Cooper
6eb6712708 msm: kgsl: Verify the pointer isn't NULL before using it for kref
Probably overkill, but ensure that the struct pointer we are going
to dereference to send into kref calls is valid before we dereference.

Change-Id: I308176df9f7476a2a9f1357612381a93160ad698
Signed-off-by: Carter Cooper <ccooper@codeaurora.org>
2016-03-23 21:13:40 -07:00
Carter Cooper
048fc95836 msm: kgsl: Rework page allocation sizes
Alignment checks only need to be done once and can be moved down to
the lower layers.

Change-Id: Ia4683cf9db08506db810e80854c006d94dc80310
Signed-off-by: Carter Cooper <ccooper@codeaurora.org>
2016-03-23 21:13:39 -07:00
Carter Cooper
eaa62a6847 msm: kgsl: Cleanup iommu interactions for secured MMU cases
The code has gotten bloated and repeats the same logic in several
places leading to very stringy code. Consolidate this code to
enable easier readability as well as prep the code for future
changes to this area.

Change-Id: Ibb70cbae3a8a5157e589020ccebefff11b6ffaf1
Signed-off-by: Carter Cooper <ccooper@codeaurora.org>
2016-03-23 21:13:38 -07:00
Rajesh Kemisetti
dd68fb8d5b msm: kgsl: Don't enable GPU 64bit when kernel is in 32bit configuration
Setting the GPU to 64bit when rest of world is in 32bit can
make the GPU misbehave. Hence, check the kernel configuration
before actually moving the GPU to 64bit mode.

Change-Id: Ie4cf6c2d4fdfa978287c86812bdce4bf8c56ef5f
Signed-off-by: Rajesh Kemisetti <rajeshk@codeaurora.org>
2016-03-23 21:12:33 -07:00
Prakash Kamliya
f5d225e2ff msm: kgsl: Fix state transition action from deep_nap state
Deep nap removes the quality of service latency vote. Restore device
before powering back the GPU while coming out of deep nap.

Change-Id: I9366ffa6f5f2768cb3ea10f9117678ba8cf8d190
Signed-off-by: Prakash Kamliya <pkamliya@codeaurora.org>
Signed-off-by: Divya Ponnusamy <pdivya@codeaurora.org>
2016-03-23 21:12:29 -07:00
Jordan Crouse
10ad380dc4 msm: kgsl: Add a macro to derive the device from the mmu structure
struct kgsl_mmu is a static member of struct kgsl_device so we can
use the usual container_of trick to get the device from a mmu
pointer rather than carry around an unneeded back reference.

Change-Id: Ic0dedbad7ff22e598b03d980dfbb738374ed5a7a
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
2016-03-23 21:11:49 -07:00
Jordan Crouse
bdd0368ce0 msm: kgsl: Add macros to facilitate checking MMU and pagetable ops
The MMU code does most of its magic by way of device specific MMU
and pagetable functions.  Add macros to make it easier for developers
to verify that hooks exist before calling them.

Change-Id: Ic0dedbadf74682adebec1a973384e1d3bbf4f79e
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
2016-03-23 21:11:48 -07:00
Jordan Crouse
6fce6a4e6f msm: kgsl: Skip a5xx_post_start if it isn't needed
a5xx_post_start() is currently only used for either an A530 workaround
OR preemption.  If neither are allocated then memory is allocated in
the ringbuffer for no reason and it confuses everybody.

Change-Id: Ic0dedbad7615ba0593da5eb701cc5943877883f4
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
2016-03-23 21:11:47 -07:00
Harshdeep Dhatt
4aef0900ff msm: kgsl: Fix race condition in snapshot sysfs read
If there are concurrent sysfs reads of snapshot binary
there can be a race condition where the snapshot data
is prematurely free'd by one reader while the other reader
is still reading it. Fix this by proper refcounting using
an atomic.

CRs-Fixed: 902816
Change-Id: I7a156c3a22f5475df0394ae30328d0fd6140f3da
Signed-off-by: Harshdeep Dhatt <hdhatt@codeaurora.org>
2016-03-23 21:11:40 -07:00
Chintan Pandya
93a0f575cb iommu: Use proper bus for domain allocation in client drivers
When there are multiple IOMMU drivers in the system,
each one will be sitting on different busses. This
way, clients should be choosing the right bus to
declare their domain on. Once and for all, update
all the clients code to use proper bus abstraction
API msm_iommu_get_bus() to get right bus.

Change-Id: I5edf7037e7b1e4af6a559b6aeaa0b6de0976bf35
Signed-off-by: Chintan Pandya <cpandya@codeaurora.org>
[cip@codeaurora.org: Removed changes to
drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c,
drivers/media/platform/msm/camera_v2/common/cam_smmu_api.c,
drivers/media/platform/msm/vidc/venus_boot.c,
drivers/platform/msm/ipa/ipa_v2/ipa.c,
drivers/platform/msm/ipa/ipa_v3/ipa.c,
drivers/platform/msm/msm_11ad/msm_11ad.c]
Signed-off-by: Clarence Ip <cip@codeaurora.org>
2016-03-23 20:45:54 -07:00
Jordan Crouse
a43bd89897 msm: kgsl: Increase GPMU timeouts
The existing timeout values for the various GPMU interactions seems
to have been a tad optimistic for all conditions. Increase them to
cover measured worse case scenarios.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
2016-03-22 11:15:54 -07:00
Jordan Crouse
d31b0d97e6 msm: kgsl: Conditionally use bwmon governor if it exists
Wrap the code to use the bwmon governor or not depending if it
exists.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
2016-03-22 11:15:53 -07:00
Jordan Crouse
56930b9f17 msm: kgsl: Update various exernal APIs for the 4.4 kernel
Make several changes to build the GPU driver for 4.4:

 - Rename CONFIG_MSM to CONFIG_QCOM where applicable
 - Add msm_kgsl.h to the Kbuild exports
 - Remove linux/coresight_of.h (as it has been merged into
   coresight.h) and remove the .owner member of the
   coresight_desc struct.
 - Use the new location for the sync.h file (in staging)
 - Remove an unused sync function
 - Move oneshot_sync.h inside of #ifdef wrappers

Signed-off-by: Jordan Crouse <jcrouse@codeauorora.org>
2016-03-22 11:15:52 -07:00
Jordan Crouse
318be96313 devfreq: Add Qualcomm GPU devfreq governors
Snapshot of the Qualcomm GPU devfreq governors and support
as of msm-3.18 commit e70ad0cd5efd
("Promotion of kernel.lnx.3.18-151201.").

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
2016-03-22 11:15:51 -07:00
Jordan Crouse
5103db813f msm: kgsl: Add Qualcomm GPU driver
Snapshot of the Qualcom Adreno GPU driver (KGSL) as of msm-3.18 commit
commit e70ad0cd5efd ("Promotion of kernel.lnx.3.18-151201.").

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
2016-03-22 11:15:49 -07:00
Dave Airlie
3bea6a4c78 Merge branch 'linux-4.4' of git://github.com/skeggsb/linux into drm-fixes
single nv40 oops fix.

* 'linux-4.4' of git://github.com/skeggsb/linux:
  drm/nouveau/gr/nv40: fix oops in interrupt handler
2016-01-07 17:18:45 +10:00
Ben Skeggs
9daf38f4fc drm/nouveau/gr/nv40: fix oops in interrupt handler
fdo#93557

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Cc: stable@vger.kernel.org
2016-01-05 07:51:18 +10:00
Linus Torvalds
4e5e384c46 Merge tag 'drm-intel-fixes-2016-01-02' of git://anongit.freedesktop.org/drm-intel
Pull i915 drm fixes from Jani Nikula:
 "Two display fixes still for v4.4.

  The new year's resolution is to start using signed tags per Linus'
  request.  This one is still unsigned; I want to fix this up in our
  maintainer scripts instead of doing it one-off"

* tag 'drm-intel-fixes-2016-01-02' of git://anongit.freedesktop.org/drm-intel:
  drm/i915: increase the tries for HDMI hotplug live status checking
  drm/i915: Unbreak check_digital_port_conflicts()
2016-01-03 11:36:26 -08:00
Gary Wang
3d8acd1f66 drm/i915: increase the tries for HDMI hotplug live status checking
The total delay of HDMI hotplug detecting with 30ms is sometimes not
enoughtfor HDMI live status up with specific HDMI monitors in BSW platform.

After doing experiments for following monitors, it needs 80ms at least
for those worst cases.

Lenovo L246 1xwA (4 failed, necessary hot-plug delay: 58/40/60/40ms)
Philips HH2AP (9 failed, necessary hot-plug delay: 80/50/50/60/46/40/58/58/39ms)
BENQ ET-0035-N (6 failed, necessary hot-plug delay: 60/50/50/80/80/40ms)
DELL U2713HM (2 failed, necessary hot-plug delay: 58/59ms)
HP HP-LP2475w (5 failed, necessary hot-plug delay: 70/50/40/60/40ms)

It looks like 70-80 ms is BSW platform needs in some bad cases of the
monitors at this end (8 times delay at most). Keep less than 100ms for
HDCP pulse HPD low (with at least 100ms) to respond a plug out.

Reviewed-by: Cooper Chiou <cooper.chiou@intel.com>
Tested-by: Gary Wang <gary.c.wang@intel.com>
Cc: Gavin Hindman <gavin.hindman@intel.com>
Cc: Sonika Jindal <sonika.jindal@intel.com>
Cc: Shashank Sharma <shashank.sharma@intel.com>
Cc: Shobhit Kumar <shobhit.kumar@intel.com>
Signed-off-by: Gary Wang <gary.c.wang@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1450858295-12804-1-git-send-email-gary.c.wang@intel.com
Tested-by: Shobhit Kumar <shobhit.kumar@intel.com>
Cc: drm-intel-fixes@lists.freedesktop.org
Fixes: 237ed86c69 ("drm/i915: Check live status before reading edid")
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit f8d03ea0053b23de42c828d559016eabe0b91523)
[Jani: undo the file mode change of the original commit]
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2015-12-30 13:58:37 +02:00
Linus Torvalds
5b726e06d6 Merge tag 'drm-intel-fixes-2015-12-23' of git://anongit.freedesktop.org/drm-intel
Pull i915 drm fixes from Jani Nikula:
 "Here's a batch of i915 fixes all around.  It may be slightly bigger
  than one would hope for at this stage, but they've all been through
  testing in our -next before being picked up for v4.4.  Also, I missed
  Dave's fixes pull earlier today just because I wanted an extra testing
  round on this.  So I'm fairly confident.

  Wishing you all the things it is customary to wish this time of the
  year"

* tag 'drm-intel-fixes-2015-12-23' of git://anongit.freedesktop.org/drm-intel:
  drm/i915: Correct max delay for HDMI hotplug live status checking
  drm/i915: mdelay(10) considered harmful
  drm/i915: Kill intel_crtc->cursor_bo
  drm/i915: Workaround CHV pipe C cursor fail
  drm/i915: Only spin whilst waiting on the current request
  drm/i915: Limit the busy wait on requests to 5us not 10ms!
  drm/i915: Break busywaiting for requests on pending signals
  drm/i915: Disable primary plane if we fail to reconstruct BIOS fb (v2)
  drm/i915: Set the map-and-fenceable flag for preallocated objects
  drm/i915: Drop the broken cursor base==0 special casing
2015-12-23 10:22:16 -08:00
Ville Syrjälä
ae35b56e36 drm/i915: Unbreak check_digital_port_conflicts()
Atomic changes broke check_digital_port_conflicts(). It needs to look
at the global situation instead of just trying to find a conflict
within the current atomic state.

This bug made my HSW explode spectacularly after I had split the DDI
encoders into separate DP and HDMI encoders. With the fix, things
seem much more solid.

I hope holding the connection_mutex is enough protection that we can
actually walk the connectors even if they're not part of the current
atomic state...

v2: Regenerate the patch so that it actually applies (Jani)

Cc: stable@vger.kernel.org
Cc: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Fixes: 5448a00d3f ("drm/i915: Don't use staged config in check_digital_port_conflicts()")
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1449764551-12466-1-git-send-email-ville.syrjala@linux.intel.com
(cherry picked from commit 0bff4858653312a10c83709e0009c3adb87e6f1e)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2015-12-23 12:52:37 +02:00
Gary Wang
a98728e0bb drm/i915: Correct max delay for HDMI hotplug live status checking
The total delay of HDMI hotplug detecting with 30ms have already
been split into a resolution of 3 retries of 10ms each, for the worst
cases. But it still suffered from only waiting 10ms at most in
intel_hdmi_detect(). This patch corrects it by reading hotplug status
with 4 times at most for 30ms delay.

v2:
- straight up to loop execution for more clear in code readability
- mdelay will replace with msleep by Daniel's new patch

	drm/i915: mdelay(10) considered harmful

- suggest to re-evaluate try times for being compatible to old HDMI monitor

Reviewed-by: Cooper Chiou <cooper.chiou@intel.com>
Tested-by: Gary Wang <gary.c.wang@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Gavin Hindman <gavin.hindman@intel.com>
Cc: Sonika Jindal <sonika.jindal@intel.com>
Cc: Shashank Sharma <shashank.sharma@intel.com>
Signed-off-by: Gary Wang <gary.c.wang@intel.com>
[danvet: fixup conflict with s/mdelay/msleep/ patch.]
Cc: drm-intel-fixes@lists.freedesktop.org
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 61fb3980dd396880ffba48523b1e27579868b82b)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2015-12-22 13:01:24 +02:00
Daniel Vetter
97f9010af0 drm/i915: mdelay(10) considered harmful
I missed this myself when reviewing

commit 237ed86c69
Author: Sonika Jindal <sonika.jindal@intel.com>
Date:   Tue Sep 15 09:44:20 2015 +0530

    drm/i915: Check live status before reading edid

Long sleeps like this really shouldn't waste cpu cycles spinning.

Cc: Sonika Jindal <sonika.jindal@intel.com>
Cc: "Wang, Gary C" <gary.c.wang@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1449859455-32609-1-git-send-email-daniel.vetter@ffwll.ch
Reviewed-by: Sonika Jindal <sonika.jindal@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 71a199bacb398ee54eeac001699257dda083a455)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2015-12-22 13:00:45 +02:00
Ville Syrjälä
57a2af6bbc drm/i915: Kill intel_crtc->cursor_bo
The vma may have been rebound between the last time the cursor was
enabled and now, so skipping the cursor gtt offset deduction is not
safe unless we would also reset cursor_bo to NULL when disabling the
cursor. Just thow cursor_bo to the bin instead since it's lost all
other uses thanks to universal plane support.

Chris pointed out that cursor updates are currently too slow
via universal planes that micro optimizations like these wouldn't
even help.

v2: Add a note about futility of micro optimizations (Chris)

Cc: drm-intel-fixes@lists.freedesktop.org
References: http://lists.freedesktop.org/archives/intel-gfx/2015-December/082976.html
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Takashi Iwai <tiwai@suse.de>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1450107302-17171-1-git-send-email-ville.syrjala@linux.intel.com
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
(cherry picked from commit 1264859d648c4bdc9f0a098efbff90cbf462a075)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2015-12-22 12:59:06 +02:00