Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu: Add prescreening stage in IH processing (v2)

To filter out high-frequency interrupts that can be safely ignored.

v2: squash in trivial typo fix for si (Alex)

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Felix Kuehling and committed by
Alex Deucher
00ecd8a2 d2791c45

+92
+2
drivers/gpu/drm/amd/amdgpu/amdgpu.h
··· 334 334 struct amdgpu_ih_funcs { 335 335 /* ring read/write ptr handling, called from interrupt context */ 336 336 u32 (*get_wptr)(struct amdgpu_device *adev); 337 + bool (*prescreen_iv)(struct amdgpu_device *adev); 337 338 void (*decode_iv)(struct amdgpu_device *adev, 338 339 struct amdgpu_iv_entry *entry); 339 340 void (*set_rptr)(struct amdgpu_device *adev); ··· 1750 1749 #define amdgpu_ring_init_cond_exec(r) (r)->funcs->init_cond_exec((r)) 1751 1750 #define amdgpu_ring_patch_cond_exec(r,o) (r)->funcs->patch_cond_exec((r),(o)) 1752 1751 #define amdgpu_ih_get_wptr(adev) (adev)->irq.ih_funcs->get_wptr((adev)) 1752 + #define amdgpu_ih_prescreen_iv(adev) (adev)->irq.ih_funcs->prescreen_iv((adev)) 1753 1753 #define amdgpu_ih_decode_iv(adev, iv) (adev)->irq.ih_funcs->decode_iv((adev), (iv)) 1754 1754 #define amdgpu_ih_set_rptr(adev) (adev)->irq.ih_funcs->set_rptr((adev)) 1755 1755 #define amdgpu_display_vblank_get_counter(adev, crtc) (adev)->mode_info.funcs->vblank_get_counter((adev), (crtc))
+6
drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c
··· 169 169 while (adev->irq.ih.rptr != wptr) { 170 170 u32 ring_index = adev->irq.ih.rptr >> 2; 171 171 172 + /* Prescreening of high-frequency interrupts */ 173 + if (!amdgpu_ih_prescreen_iv(adev)) { 174 + adev->irq.ih.rptr &= adev->irq.ih.ptr_mask; 175 + continue; 176 + } 177 + 172 178 /* Before dispatching irq to IP blocks, send it to amdkfd */ 173 179 amdgpu_amdkfd_interrupt(adev, 174 180 (const void *) &adev->irq.ih.ring[ring_index]);
+14
drivers/gpu/drm/amd/amdgpu/cik_ih.c
··· 228 228 * [127:96] - reserved 229 229 */ 230 230 231 + /** 232 + * cik_ih_prescreen_iv - prescreen an interrupt vector 233 + * 234 + * @adev: amdgpu_device pointer 235 + * 236 + * Returns true if the interrupt vector should be further processed. 237 + */ 238 + static bool cik_ih_prescreen_iv(struct amdgpu_device *adev) 239 + { 240 + /* Process all interrupts */ 241 + return true; 242 + } 243 + 231 244 /** 232 245 * cik_ih_decode_iv - decode an interrupt vector 233 246 * ··· 446 433 447 434 static const struct amdgpu_ih_funcs cik_ih_funcs = { 448 435 .get_wptr = cik_ih_get_wptr, 436 + .prescreen_iv = cik_ih_prescreen_iv, 449 437 .decode_iv = cik_ih_decode_iv, 450 438 .set_rptr = cik_ih_set_rptr 451 439 };
+14
drivers/gpu/drm/amd/amdgpu/cz_ih.c
··· 208 208 } 209 209 210 210 /** 211 + * cz_ih_prescreen_iv - prescreen an interrupt vector 212 + * 213 + * @adev: amdgpu_device pointer 214 + * 215 + * Returns true if the interrupt vector should be further processed. 216 + */ 217 + static bool cz_ih_prescreen_iv(struct amdgpu_device *adev) 218 + { 219 + /* Process all interrupts */ 220 + return true; 221 + } 222 + 223 + /** 211 224 * cz_ih_decode_iv - decode an interrupt vector 212 225 * 213 226 * @adev: amdgpu_device pointer ··· 427 414 428 415 static const struct amdgpu_ih_funcs cz_ih_funcs = { 429 416 .get_wptr = cz_ih_get_wptr, 417 + .prescreen_iv = cz_ih_prescreen_iv, 430 418 .decode_iv = cz_ih_decode_iv, 431 419 .set_rptr = cz_ih_set_rptr 432 420 };
+14
drivers/gpu/drm/amd/amdgpu/iceland_ih.c
··· 208 208 } 209 209 210 210 /** 211 + * iceland_ih_prescreen_iv - prescreen an interrupt vector 212 + * 213 + * @adev: amdgpu_device pointer 214 + * 215 + * Returns true if the interrupt vector should be further processed. 216 + */ 217 + static bool iceland_ih_prescreen_iv(struct amdgpu_device *adev) 218 + { 219 + /* Process all interrupts */ 220 + return true; 221 + } 222 + 223 + /** 211 224 * iceland_ih_decode_iv - decode an interrupt vector 212 225 * 213 226 * @adev: amdgpu_device pointer ··· 425 412 426 413 static const struct amdgpu_ih_funcs iceland_ih_funcs = { 427 414 .get_wptr = iceland_ih_get_wptr, 415 + .prescreen_iv = iceland_ih_prescreen_iv, 428 416 .decode_iv = iceland_ih_decode_iv, 429 417 .set_rptr = iceland_ih_set_rptr 430 418 };
+14
drivers/gpu/drm/amd/amdgpu/si_ih.c
··· 118 118 return (wptr & adev->irq.ih.ptr_mask); 119 119 } 120 120 121 + /** 122 + * si_ih_prescreen_iv - prescreen an interrupt vector 123 + * 124 + * @adev: amdgpu_device pointer 125 + * 126 + * Returns true if the interrupt vector should be further processed. 127 + */ 128 + static bool si_ih_prescreen_iv(struct amdgpu_device *adev) 129 + { 130 + /* Process all interrupts */ 131 + return true; 132 + } 133 + 121 134 static void si_ih_decode_iv(struct amdgpu_device *adev, 122 135 struct amdgpu_iv_entry *entry) 123 136 { ··· 301 288 302 289 static const struct amdgpu_ih_funcs si_ih_funcs = { 303 290 .get_wptr = si_ih_get_wptr, 291 + .prescreen_iv = si_ih_prescreen_iv, 304 292 .decode_iv = si_ih_decode_iv, 305 293 .set_rptr = si_ih_set_rptr 306 294 };
+14
drivers/gpu/drm/amd/amdgpu/tonga_ih.c
··· 219 219 } 220 220 221 221 /** 222 + * tonga_ih_prescreen_iv - prescreen an interrupt vector 223 + * 224 + * @adev: amdgpu_device pointer 225 + * 226 + * Returns true if the interrupt vector should be further processed. 227 + */ 228 + static bool tonga_ih_prescreen_iv(struct amdgpu_device *adev) 229 + { 230 + /* Process all interrupts */ 231 + return true; 232 + } 233 + 234 + /** 222 235 * tonga_ih_decode_iv - decode an interrupt vector 223 236 * 224 237 * @adev: amdgpu_device pointer ··· 491 478 492 479 static const struct amdgpu_ih_funcs tonga_ih_funcs = { 493 480 .get_wptr = tonga_ih_get_wptr, 481 + .prescreen_iv = tonga_ih_prescreen_iv, 494 482 .decode_iv = tonga_ih_decode_iv, 495 483 .set_rptr = tonga_ih_set_rptr 496 484 };
+14
drivers/gpu/drm/amd/amdgpu/vega10_ih.c
··· 227 227 } 228 228 229 229 /** 230 + * vega10_ih_prescreen_iv - prescreen an interrupt vector 231 + * 232 + * @adev: amdgpu_device pointer 233 + * 234 + * Returns true if the interrupt vector should be further processed. 235 + */ 236 + static bool vega10_ih_prescreen_iv(struct amdgpu_device *adev) 237 + { 238 + /* TODO: Filter known pending page faults */ 239 + return true; 240 + } 241 + 242 + /** 230 243 * vega10_ih_decode_iv - decode an interrupt vector 231 244 * 232 245 * @adev: amdgpu_device pointer ··· 423 410 424 411 static const struct amdgpu_ih_funcs vega10_ih_funcs = { 425 412 .get_wptr = vega10_ih_get_wptr, 413 + .prescreen_iv = vega10_ih_prescreen_iv, 426 414 .decode_iv = vega10_ih_decode_iv, 427 415 .set_rptr = vega10_ih_set_rptr 428 416 };