Revert "msm: kgsl: Prevent race conditions when freeing memory"

This reverts commit c36952ffb29e934692d5572ef29e09c74c97a6a9.
Revert "msm: kgsl: Add a missing mutex unlock"

This reverts commit 7fc986682e15685e10be6d0939996ceaea0ce517.
Revert "msm: kgsl: Only initialize process structure once"

This reverts commit f435f008ef6ed2a887473a8965ee2c8435adab11.
Revert "msm: kgsl: Only reference the rb_node after taking spinlock"

This reverts commit fd7948556445fa615b210d1bff92a1392d6a555a.
Revert "msm: kgsl: Prevent race conditions when freeing memory"

This reverts commit 3843455af1ec796fdb869dad5fe9056fa07f0e80.
Revert "msm: kgsl: Use the correct length when looking for address collision"

This reverts commit 2a24e9edfce8314a62f947cf07fef44ce84f065a.
Revert "kgsl: Add memory barrier to kgsl_iommu_lock_rb_in_tlb iommu operation"

This reverts commit 69760f7b37eaec53905ebea6be7261d649e90046.
Revert "msm: kgsl: Map sync lock variables to every pagetable"

This reverts commit d61ad6ba2919f961cb79ee02211053edb9ac4878.
Revert "adreno: increase cmdbatch timeout to 10 seconds"

This reverts commit f1e5204035d57da72d116e20889e43aa04ee4cca.
Revert "msm: kgsl: Add a check to free the kgsl_timeline object."

This reverts commit ce2dda9e141dac3f98a57bd940384c63f6cbaa79.
Revert "msm: kgsl: show timestamp in sync dump"

This reverts commit 8004937a581f6b04fc6679a38f9fd3542e7b71f9.
Revert "msm: kgsl: generate descriptive names for kgsl-timeline"

This reverts commit 22fb028d3361aa8adc9455dba9934776e0f20efd.
Revert "msm: kgsl: implement server-side waits"

This reverts commit 55bf2b11cd7ae4f8dc277c6564268f838e34fe7d.
Revert "msm: kgsl: use kgsl_mmu_device_setstate() if the GPU is already idle"

This reverts commit e271b1ae537a339ead13cf76682d9761fb570029.
Revert "Merge remote-tracking branch 'cm/cm-10.2' into jb4.3"

This reverts commit 3d2d28fd565719a816fa41e0f48eff3ba8a14dcf.
Revert "msm_fb: Set RR sched policy for Glupdator thread"

This reverts commit 850827ca164e970aa0bf0417fe868e5d7586d598.
Revert "msm: mdp: Update sync pt. behaviour"

This reverts commit 965593062c97917117c0142081cf9285ed35fa29.
Merge branch 'bcm-mako-W1-R2' into bcm-mako-W1-R2-JWR
ARM: sched_clock: Load cycle count after epoch stabilizes

There is a small race between when the cycle count is read from
the hardware and when the epoch stabilizes. Consider this
scenario:

 CPU0                           CPU1
 ----                           ----
 cyc = read_sched_clock()
 cyc_to_sched_clock()
                                 update_sched_clock()
                                  ...
                                  cd.epoch_cyc = cyc;
  epoch_cyc = cd.epoch_cyc;
  ...
  epoch_ns + cyc_to_ns((cyc - epoch_cyc)

The cyc on cpu0 was read before the epoch changed. But we
calculate the nanoseconds based on the new epoch by subtracting
the new epoch from the old cycle count. Since epoch is most likely
larger than the old cycle count we calculate a large number that
will be converted to nanoseconds and added to epoch_ns, causing
time to jump forward too much.

Fix this problem by reading the hardware after the epoch has
stabilized.

Change-Id: I995133b229b2c2fedd5091406d1dc366d8bfff7b
Cc: Russell King <linux@arm.linux.org.uk>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Git-commit: 336ae1180df5f69b9e0fb6561bec01c5f64361cf
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
[sboyd: reworked for file movement kernel/time -> arm/kernel]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
Merge branch 'bcm-mako-W1-R2' into bcm-mako-W1-R2-JWR