diff options
author | Christian König <deathsimple@vodafone.de> | 2012-05-02 09:11:20 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2012-05-03 04:16:33 -0400 |
commit | 069211e55561fdaf86d66eedacca57eaad910757 (patch) | |
tree | 07a646396317bef842e32097542c8930a6e2bd85 /drivers/gpu/drm/radeon/r100.c | |
parent | 6c6f478370eccfbfafbdc6fc55c0def03e58f124 (diff) |
drm/radeon: move lockup detection code into radeon_ring.c
It isn't chipset specific, so it makes no sense
to have that inside r100.c.
Signed-off-by: Christian König <deathsimple@vodafone.de>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/r100.c')
-rw-r--r-- | drivers/gpu/drm/radeon/r100.c | 57 |
1 files changed, 2 insertions, 55 deletions
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c index 825f11774491..ccf5e3b844d3 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c | |||
@@ -2159,59 +2159,6 @@ int r100_mc_wait_for_idle(struct radeon_device *rdev) | |||
2159 | return -1; | 2159 | return -1; |
2160 | } | 2160 | } |
2161 | 2161 | ||
2162 | void r100_gpu_lockup_update(struct r100_gpu_lockup *lockup, struct radeon_ring *ring) | ||
2163 | { | ||
2164 | lockup->last_cp_rptr = ring->rptr; | ||
2165 | lockup->last_jiffies = jiffies; | ||
2166 | } | ||
2167 | |||
2168 | /** | ||
2169 | * r100_gpu_cp_is_lockup() - check if CP is lockup by recording information | ||
2170 | * @rdev: radeon device structure | ||
2171 | * @lockup: r100_gpu_lockup structure holding CP lockup tracking informations | ||
2172 | * @cp: radeon_cp structure holding CP information | ||
2173 | * | ||
2174 | * We don't need to initialize the lockup tracking information as we will either | ||
2175 | * have CP rptr to a different value of jiffies wrap around which will force | ||
2176 | * initialization of the lockup tracking informations. | ||
2177 | * | ||
2178 | * A possible false positivie is if we get call after while and last_cp_rptr == | ||
2179 | * the current CP rptr, even if it's unlikely it might happen. To avoid this | ||
2180 | * if the elapsed time since last call is bigger than 2 second than we return | ||
2181 | * false and update the tracking information. Due to this the caller must call | ||
2182 | * r100_gpu_cp_is_lockup several time in less than 2sec for lockup to be reported | ||
2183 | * the fencing code should be cautious about that. | ||
2184 | * | ||
2185 | * Caller should write to the ring to force CP to do something so we don't get | ||
2186 | * false positive when CP is just gived nothing to do. | ||
2187 | * | ||
2188 | **/ | ||
2189 | bool r100_gpu_cp_is_lockup(struct radeon_device *rdev, struct r100_gpu_lockup *lockup, struct radeon_ring *ring) | ||
2190 | { | ||
2191 | unsigned long cjiffies, elapsed; | ||
2192 | |||
2193 | cjiffies = jiffies; | ||
2194 | if (!time_after(cjiffies, lockup->last_jiffies)) { | ||
2195 | /* likely a wrap around */ | ||
2196 | lockup->last_cp_rptr = ring->rptr; | ||
2197 | lockup->last_jiffies = jiffies; | ||
2198 | return false; | ||
2199 | } | ||
2200 | if (ring->rptr != lockup->last_cp_rptr) { | ||
2201 | /* CP is still working no lockup */ | ||
2202 | lockup->last_cp_rptr = ring->rptr; | ||
2203 | lockup->last_jiffies = jiffies; | ||
2204 | return false; | ||
2205 | } | ||
2206 | elapsed = jiffies_to_msecs(cjiffies - lockup->last_jiffies); | ||
2207 | if (elapsed >= 10000) { | ||
2208 | dev_err(rdev->dev, "GPU lockup CP stall for more than %lumsec\n", elapsed); | ||
2209 | return true; | ||
2210 | } | ||
2211 | /* give a chance to the GPU ... */ | ||
2212 | return false; | ||
2213 | } | ||
2214 | |||
2215 | bool r100_gpu_is_lockup(struct radeon_device *rdev, struct radeon_ring *ring) | 2162 | bool r100_gpu_is_lockup(struct radeon_device *rdev, struct radeon_ring *ring) |
2216 | { | 2163 | { |
2217 | u32 rbbm_status; | 2164 | u32 rbbm_status; |
@@ -2219,7 +2166,7 @@ bool r100_gpu_is_lockup(struct radeon_device *rdev, struct radeon_ring *ring) | |||
2219 | 2166 | ||
2220 | rbbm_status = RREG32(R_000E40_RBBM_STATUS); | 2167 | rbbm_status = RREG32(R_000E40_RBBM_STATUS); |
2221 | if (!G_000E40_GUI_ACTIVE(rbbm_status)) { | 2168 | if (!G_000E40_GUI_ACTIVE(rbbm_status)) { |
2222 | r100_gpu_lockup_update(&rdev->config.r100.lockup, ring); | 2169 | radeon_ring_lockup_update(ring); |
2223 | return false; | 2170 | return false; |
2224 | } | 2171 | } |
2225 | /* force CP activities */ | 2172 | /* force CP activities */ |
@@ -2231,7 +2178,7 @@ bool r100_gpu_is_lockup(struct radeon_device *rdev, struct radeon_ring *ring) | |||
2231 | radeon_ring_unlock_commit(rdev, ring); | 2178 | radeon_ring_unlock_commit(rdev, ring); |
2232 | } | 2179 | } |
2233 | ring->rptr = RREG32(ring->rptr_reg); | 2180 | ring->rptr = RREG32(ring->rptr_reg); |
2234 | return r100_gpu_cp_is_lockup(rdev, &rdev->config.r100.lockup, ring); | 2181 | return radeon_ring_test_lockup(rdev, ring); |
2235 | } | 2182 | } |
2236 | 2183 | ||
2237 | void r100_bm_disable(struct radeon_device *rdev) | 2184 | void r100_bm_disable(struct radeon_device *rdev) |