gpu: nvgpu: flush write before unlocking

- 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/437842
Reviewed-by: Mitch Luban <mluban@nvidia.com>
Tested-by: Mitch Luban <mluban@nvidia.com>
This commit is contained in:
Sang-Hun Lee
2014-06-03 13:28:45 -07:00
committed by Dan Willemsen
parent 5312fd2a18
commit ebf991e990

View File

@@ -1656,8 +1656,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);
}