]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
gpu: nvgpu: flush write before unlocking
authorSang-Hun Lee <sanlee@nvidia.com>
Tue, 3 Jun 2014 20:28:45 +0000 (13:28 -0700)
committerSimone Willett <swillett@nvidia.com>
Tue, 10 Jun 2014 02:09:49 +0000 (19:09 -0700)
 - gk20a_enable is reading the clock after unlocking the spinlock
   to flush any previous write
 - This could lead to a race if any write afterwards assume
   the write has been completed already
 - Read the clock before unlocking to ensure all previous writes
   have been completed before letting any other thread use gk20a

Bug 200007520

Change-Id: I737fbbe825c68b25ca256c4a8ee2b99aa8baf0f5
Signed-off-by: Sang-Hun Lee <sanlee@nvidia.com>
Reviewed-on: http://git-master/r/418485
(cherry picked from commit 2aed542a719caa69620766bf2dceefe50626c189)
Reviewed-on: http://git-master/r/420329
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>
drivers/gpu/nvgpu/gk20a/gk20a.c

index 2f4485d5b570096093b7bc45b79c6c70c6cf60f5..2acad45f1a30d0c988855a2335443f21057058a8 100644 (file)
@@ -1569,8 +1569,8 @@ void gk20a_enable(struct gk20a *g, u32 units)
        pmc = gk20a_readl(g, mc_enable_r());
        pmc |= units;
        gk20a_writel(g, mc_enable_r(), pmc);
-       spin_unlock(&g->mc_enable_lock);
        gk20a_readl(g, mc_enable_r());
+       spin_unlock(&g->mc_enable_lock);
 
        udelay(20);
 }