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: fix shared irq handling on driver remove

lima uses a shared interrupt, so the interrupt handlers must be prepared
to be called at any time. At driver removal time, the clocks are
disabled early and the interrupts stay registered until the very end of
the remove process due to the devm usage.
This is potentially a bug as the interrupts access device registers
which assumes clocks are enabled. A crash can be triggered by removing
the driver in a kernel with CONFIG_DEBUG_SHIRQ enabled.
This patch frees the interrupts at each lima device finishing callback
so that the handlers are already unregistered by the time we fully
disable clocks.

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

authored by

Erico Nunes and committed by
Qiang Yu
a6683c69 a421cc7a

+11
+2
drivers/gpu/drm/lima/lima_gp.c
··· 345 345 346 346 void lima_gp_fini(struct lima_ip *ip) 347 347 { 348 + struct lima_device *dev = ip->dev; 348 349 350 + devm_free_irq(dev->dev, ip->irq, ip); 349 351 } 350 352 351 353 int lima_gp_pipe_init(struct lima_device *dev)
+5
drivers/gpu/drm/lima/lima_mmu.c
··· 118 118 119 119 void lima_mmu_fini(struct lima_ip *ip) 120 120 { 121 + struct lima_device *dev = ip->dev; 121 122 123 + if (ip->id == lima_ip_ppmmu_bcast) 124 + return; 125 + 126 + devm_free_irq(dev->dev, ip->irq, ip); 122 127 } 123 128 124 129 void lima_mmu_flush_tlb(struct lima_ip *ip)
+4
drivers/gpu/drm/lima/lima_pp.c
··· 286 286 287 287 void lima_pp_fini(struct lima_ip *ip) 288 288 { 289 + struct lima_device *dev = ip->dev; 289 290 291 + devm_free_irq(dev->dev, ip->irq, ip); 290 292 } 291 293 292 294 int lima_pp_bcast_resume(struct lima_ip *ip) ··· 321 319 322 320 void lima_pp_bcast_fini(struct lima_ip *ip) 323 321 { 322 + struct lima_device *dev = ip->dev; 324 323 324 + devm_free_irq(dev->dev, ip->irq, ip); 325 325 } 326 326 327 327 static int lima_pp_task_validate(struct lima_sched_pipe *pipe,