aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/cz_ih.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/cz_ih.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/cz_ih.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/cz_ih.c b/drivers/gpu/drm/amd/amdgpu/cz_ih.c
index 9d3ea298e116..c59eed041fb5 100644
--- a/drivers/gpu/drm/amd/amdgpu/cz_ih.c
+++ b/drivers/gpu/drm/amd/amdgpu/cz_ih.c
@@ -185,11 +185,12 @@ static void cz_ih_irq_disable(struct amdgpu_device *adev)
185 * Used by cz_irq_process(VI). 185 * Used by cz_irq_process(VI).
186 * Returns the value of the wptr. 186 * Returns the value of the wptr.
187 */ 187 */
188static u32 cz_ih_get_wptr(struct amdgpu_device *adev) 188static u32 cz_ih_get_wptr(struct amdgpu_device *adev,
189 struct amdgpu_ih_ring *ih)
189{ 190{
190 u32 wptr, tmp; 191 u32 wptr, tmp;
191 192
192 wptr = le32_to_cpu(adev->wb.wb[adev->irq.ih.wptr_offs]); 193 wptr = le32_to_cpu(adev->wb.wb[ih->wptr_offs]);
193 194
194 if (REG_GET_FIELD(wptr, IH_RB_WPTR, RB_OVERFLOW)) { 195 if (REG_GET_FIELD(wptr, IH_RB_WPTR, RB_OVERFLOW)) {
195 wptr = REG_SET_FIELD(wptr, IH_RB_WPTR, RB_OVERFLOW, 0); 196 wptr = REG_SET_FIELD(wptr, IH_RB_WPTR, RB_OVERFLOW, 0);
@@ -198,13 +199,13 @@ static u32 cz_ih_get_wptr(struct amdgpu_device *adev)
198 * this should allow us to catchup. 199 * this should allow us to catchup.
199 */ 200 */
200 dev_warn(adev->dev, "IH ring buffer overflow (0x%08X, 0x%08X, 0x%08X)\n", 201 dev_warn(adev->dev, "IH ring buffer overflow (0x%08X, 0x%08X, 0x%08X)\n",
201 wptr, adev->irq.ih.rptr, (wptr + 16) & adev->irq.ih.ptr_mask); 202 wptr, ih->rptr, (wptr + 16) & ih->ptr_mask);
202 adev->irq.ih.rptr = (wptr + 16) & adev->irq.ih.ptr_mask; 203 ih->rptr = (wptr + 16) & ih->ptr_mask;
203 tmp = RREG32(mmIH_RB_CNTL); 204 tmp = RREG32(mmIH_RB_CNTL);
204 tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, WPTR_OVERFLOW_CLEAR, 1); 205 tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, WPTR_OVERFLOW_CLEAR, 1);
205 WREG32(mmIH_RB_CNTL, tmp); 206 WREG32(mmIH_RB_CNTL, tmp);
206 } 207 }
207 return (wptr & adev->irq.ih.ptr_mask); 208 return (wptr & ih->ptr_mask);
208} 209}
209 210
210/** 211/**
@@ -216,16 +217,17 @@ static u32 cz_ih_get_wptr(struct amdgpu_device *adev)
216 * position and also advance the position. 217 * position and also advance the position.
217 */ 218 */
218static void cz_ih_decode_iv(struct amdgpu_device *adev, 219static void cz_ih_decode_iv(struct amdgpu_device *adev,
219 struct amdgpu_iv_entry *entry) 220 struct amdgpu_ih_ring *ih,
221 struct amdgpu_iv_entry *entry)
220{ 222{
221 /* wptr/rptr are in bytes! */ 223 /* wptr/rptr are in bytes! */
222 u32 ring_index = adev->irq.ih.rptr >> 2; 224 u32 ring_index = ih->rptr >> 2;
223 uint32_t dw[4]; 225 uint32_t dw[4];
224 226
225 dw[0] = le32_to_cpu(adev->irq.ih.ring[ring_index + 0]); 227 dw[0] = le32_to_cpu(ih->ring[ring_index + 0]);
226 dw[1] = le32_to_cpu(adev->irq.ih.ring[ring_index + 1]); 228 dw[1] = le32_to_cpu(ih->ring[ring_index + 1]);
227 dw[2] = le32_to_cpu(adev->irq.ih.ring[ring_index + 2]); 229 dw[2] = le32_to_cpu(ih->ring[ring_index + 2]);
228 dw[3] = le32_to_cpu(adev->irq.ih.ring[ring_index + 3]); 230 dw[3] = le32_to_cpu(ih->ring[ring_index + 3]);
229 231
230 entry->client_id = AMDGPU_IRQ_CLIENTID_LEGACY; 232 entry->client_id = AMDGPU_IRQ_CLIENTID_LEGACY;
231 entry->src_id = dw[0] & 0xff; 233 entry->src_id = dw[0] & 0xff;
@@ -235,7 +237,7 @@ static void cz_ih_decode_iv(struct amdgpu_device *adev,
235 entry->pasid = (dw[2] >> 16) & 0xffff; 237 entry->pasid = (dw[2] >> 16) & 0xffff;
236 238
237 /* wptr/rptr are in bytes! */ 239 /* wptr/rptr are in bytes! */
238 adev->irq.ih.rptr += 16; 240 ih->rptr += 16;
239} 241}
240 242
241/** 243/**
@@ -245,9 +247,10 @@ static void cz_ih_decode_iv(struct amdgpu_device *adev,
245 * 247 *
246 * Set the IH ring buffer rptr. 248 * Set the IH ring buffer rptr.
247 */ 249 */
248static void cz_ih_set_rptr(struct amdgpu_device *adev) 250static void cz_ih_set_rptr(struct amdgpu_device *adev,
251 struct amdgpu_ih_ring *ih)
249{ 252{
250 WREG32(mmIH_RB_RPTR, adev->irq.ih.rptr); 253 WREG32(mmIH_RB_RPTR, ih->rptr);
251} 254}
252 255
253static int cz_ih_early_init(void *handle) 256static int cz_ih_early_init(void *handle)