aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/cik_ih.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/cik_ih.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/cik_ih.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/cik_ih.c b/drivers/gpu/drm/amd/amdgpu/cik_ih.c
index 8a8b4967a101..884aa9b81e86 100644
--- a/drivers/gpu/drm/amd/amdgpu/cik_ih.c
+++ b/drivers/gpu/drm/amd/amdgpu/cik_ih.c
@@ -183,11 +183,12 @@ static void cik_ih_irq_disable(struct amdgpu_device *adev)
183 * Used by cik_irq_process(). 183 * Used by cik_irq_process().
184 * Returns the value of the wptr. 184 * Returns the value of the wptr.
185 */ 185 */
186static u32 cik_ih_get_wptr(struct amdgpu_device *adev) 186static u32 cik_ih_get_wptr(struct amdgpu_device *adev,
187 struct amdgpu_ih_ring *ih)
187{ 188{
188 u32 wptr, tmp; 189 u32 wptr, tmp;
189 190
190 wptr = le32_to_cpu(adev->wb.wb[adev->irq.ih.wptr_offs]); 191 wptr = le32_to_cpu(adev->wb.wb[ih->wptr_offs]);
191 192
192 if (wptr & IH_RB_WPTR__RB_OVERFLOW_MASK) { 193 if (wptr & IH_RB_WPTR__RB_OVERFLOW_MASK) {
193 wptr &= ~IH_RB_WPTR__RB_OVERFLOW_MASK; 194 wptr &= ~IH_RB_WPTR__RB_OVERFLOW_MASK;
@@ -196,13 +197,13 @@ static u32 cik_ih_get_wptr(struct amdgpu_device *adev)
196 * this should allow us to catchup. 197 * this should allow us to catchup.
197 */ 198 */
198 dev_warn(adev->dev, "IH ring buffer overflow (0x%08X, 0x%08X, 0x%08X)\n", 199 dev_warn(adev->dev, "IH ring buffer overflow (0x%08X, 0x%08X, 0x%08X)\n",
199 wptr, adev->irq.ih.rptr, (wptr + 16) & adev->irq.ih.ptr_mask); 200 wptr, ih->rptr, (wptr + 16) & ih->ptr_mask);
200 adev->irq.ih.rptr = (wptr + 16) & adev->irq.ih.ptr_mask; 201 ih->rptr = (wptr + 16) & ih->ptr_mask;
201 tmp = RREG32(mmIH_RB_CNTL); 202 tmp = RREG32(mmIH_RB_CNTL);
202 tmp |= IH_RB_CNTL__WPTR_OVERFLOW_CLEAR_MASK; 203 tmp |= IH_RB_CNTL__WPTR_OVERFLOW_CLEAR_MASK;
203 WREG32(mmIH_RB_CNTL, tmp); 204 WREG32(mmIH_RB_CNTL, tmp);
204 } 205 }
205 return (wptr & adev->irq.ih.ptr_mask); 206 return (wptr & ih->ptr_mask);
206} 207}
207 208
208/* CIK IV Ring 209/* CIK IV Ring
@@ -237,16 +238,17 @@ static u32 cik_ih_get_wptr(struct amdgpu_device *adev)
237 * position and also advance the position. 238 * position and also advance the position.
238 */ 239 */
239static void cik_ih_decode_iv(struct amdgpu_device *adev, 240static void cik_ih_decode_iv(struct amdgpu_device *adev,
241 struct amdgpu_ih_ring *ih,
240 struct amdgpu_iv_entry *entry) 242 struct amdgpu_iv_entry *entry)
241{ 243{
242 /* wptr/rptr are in bytes! */ 244 /* wptr/rptr are in bytes! */
243 u32 ring_index = adev->irq.ih.rptr >> 2; 245 u32 ring_index = ih->rptr >> 2;
244 uint32_t dw[4]; 246 uint32_t dw[4];
245 247
246 dw[0] = le32_to_cpu(adev->irq.ih.ring[ring_index + 0]); 248 dw[0] = le32_to_cpu(ih->ring[ring_index + 0]);
247 dw[1] = le32_to_cpu(adev->irq.ih.ring[ring_index + 1]); 249 dw[1] = le32_to_cpu(ih->ring[ring_index + 1]);
248 dw[2] = le32_to_cpu(adev->irq.ih.ring[ring_index + 2]); 250 dw[2] = le32_to_cpu(ih->ring[ring_index + 2]);
249 dw[3] = le32_to_cpu(adev->irq.ih.ring[ring_index + 3]); 251 dw[3] = le32_to_cpu(ih->ring[ring_index + 3]);
250 252
251 entry->client_id = AMDGPU_IRQ_CLIENTID_LEGACY; 253 entry->client_id = AMDGPU_IRQ_CLIENTID_LEGACY;
252 entry->src_id = dw[0] & 0xff; 254 entry->src_id = dw[0] & 0xff;
@@ -256,7 +258,7 @@ static void cik_ih_decode_iv(struct amdgpu_device *adev,
256 entry->pasid = (dw[2] >> 16) & 0xffff; 258 entry->pasid = (dw[2] >> 16) & 0xffff;
257 259
258 /* wptr/rptr are in bytes! */ 260 /* wptr/rptr are in bytes! */
259 adev->irq.ih.rptr += 16; 261 ih->rptr += 16;
260} 262}
261 263
262/** 264/**
@@ -266,9 +268,10 @@ static void cik_ih_decode_iv(struct amdgpu_device *adev,
266 * 268 *
267 * Set the IH ring buffer rptr. 269 * Set the IH ring buffer rptr.
268 */ 270 */
269static void cik_ih_set_rptr(struct amdgpu_device *adev) 271static void cik_ih_set_rptr(struct amdgpu_device *adev,
272 struct amdgpu_ih_ring *ih)
270{ 273{
271 WREG32(mmIH_RB_RPTR, adev->irq.ih.rptr); 274 WREG32(mmIH_RB_RPTR, ih->rptr);
272} 275}
273 276
274static int cik_ih_early_init(void *handle) 277static int cik_ih_early_init(void *handle)