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

Configure Feed

Select the types of activity you want to include in your feed.

drm/lima: add mask irq callback to gp and pp

This is needed because we want to reset those devices in device-agnostic
code such as lima_sched.
In particular, masking irqs will be useful before a hard reset to
prevent race conditions.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240405152951.1531555-2-nunes.erico@gmail.com

authored by

Erico Nunes and committed by
Qiang Yu
49c13b4d 42d34193

+42
+12
drivers/gpu/drm/lima/lima_bcast.c
··· 43 43 44 44 } 45 45 46 + int lima_bcast_mask_irq(struct lima_ip *ip) 47 + { 48 + bcast_write(LIMA_BCAST_BROADCAST_MASK, 0); 49 + bcast_write(LIMA_BCAST_INTERRUPT_MASK, 0); 50 + return 0; 51 + } 52 + 53 + int lima_bcast_reset(struct lima_ip *ip) 54 + { 55 + return lima_bcast_hw_init(ip); 56 + } 57 + 46 58 int lima_bcast_init(struct lima_ip *ip) 47 59 { 48 60 int i;
+3
drivers/gpu/drm/lima/lima_bcast.h
··· 13 13 14 14 void lima_bcast_enable(struct lima_device *dev, int num_pp); 15 15 16 + int lima_bcast_mask_irq(struct lima_ip *ip); 17 + int lima_bcast_reset(struct lima_ip *ip); 18 + 16 19 #endif
+8
drivers/gpu/drm/lima/lima_gp.c
··· 233 233 lima_sched_pipe_task_done(pipe); 234 234 } 235 235 236 + static void lima_gp_task_mask_irq(struct lima_sched_pipe *pipe) 237 + { 238 + struct lima_ip *ip = pipe->processor[0]; 239 + 240 + gp_write(LIMA_GP_INT_MASK, 0); 241 + } 242 + 236 243 static int lima_gp_task_recover(struct lima_sched_pipe *pipe) 237 244 { 238 245 struct lima_ip *ip = pipe->processor[0]; ··· 372 365 pipe->task_error = lima_gp_task_error; 373 366 pipe->task_mmu_error = lima_gp_task_mmu_error; 374 367 pipe->task_recover = lima_gp_task_recover; 368 + pipe->task_mask_irq = lima_gp_task_mask_irq; 375 369 376 370 return 0; 377 371 }
+18
drivers/gpu/drm/lima/lima_pp.c
··· 429 429 430 430 lima_pp_hard_reset(ip); 431 431 } 432 + 433 + if (pipe->bcast_processor) 434 + lima_bcast_reset(pipe->bcast_processor); 432 435 } 433 436 434 437 static void lima_pp_task_mmu_error(struct lima_sched_pipe *pipe) 435 438 { 436 439 if (atomic_dec_and_test(&pipe->task)) 437 440 lima_sched_pipe_task_done(pipe); 441 + } 442 + 443 + static void lima_pp_task_mask_irq(struct lima_sched_pipe *pipe) 444 + { 445 + int i; 446 + 447 + for (i = 0; i < pipe->num_processor; i++) { 448 + struct lima_ip *ip = pipe->processor[i]; 449 + 450 + pp_write(LIMA_PP_INT_MASK, 0); 451 + } 452 + 453 + if (pipe->bcast_processor) 454 + lima_bcast_mask_irq(pipe->bcast_processor); 438 455 } 439 456 440 457 static struct kmem_cache *lima_pp_task_slab; ··· 485 468 pipe->task_fini = lima_pp_task_fini; 486 469 pipe->task_error = lima_pp_task_error; 487 470 pipe->task_mmu_error = lima_pp_task_mmu_error; 471 + pipe->task_mask_irq = lima_pp_task_mask_irq; 488 472 489 473 return 0; 490 474 }
+1
drivers/gpu/drm/lima/lima_sched.h
··· 80 80 void (*task_error)(struct lima_sched_pipe *pipe); 81 81 void (*task_mmu_error)(struct lima_sched_pipe *pipe); 82 82 int (*task_recover)(struct lima_sched_pipe *pipe); 83 + void (*task_mask_irq)(struct lima_sched_pipe *pipe); 83 84 84 85 struct work_struct recover_work; 85 86 };