| .. | .. |
|---|
| 59 | 59 | { |
|---|
| 60 | 60 | struct vc4_dev *vc4 = |
|---|
| 61 | 61 | container_of(work, struct vc4_dev, overflow_mem_work); |
|---|
| 62 | | - struct vc4_bo *bo = vc4->bin_bo; |
|---|
| 62 | + struct vc4_bo *bo; |
|---|
| 63 | 63 | int bin_bo_slot; |
|---|
| 64 | 64 | struct vc4_exec_info *exec; |
|---|
| 65 | 65 | unsigned long irqflags; |
|---|
| 66 | 66 | |
|---|
| 67 | + mutex_lock(&vc4->bin_bo_lock); |
|---|
| 68 | + |
|---|
| 69 | + if (!vc4->bin_bo) |
|---|
| 70 | + goto complete; |
|---|
| 71 | + |
|---|
| 72 | + bo = vc4->bin_bo; |
|---|
| 73 | + |
|---|
| 67 | 74 | bin_bo_slot = vc4_v3d_get_bin_slot(vc4); |
|---|
| 68 | 75 | if (bin_bo_slot < 0) { |
|---|
| 69 | 76 | DRM_ERROR("Couldn't allocate binner overflow mem\n"); |
|---|
| 70 | | - return; |
|---|
| 77 | + goto complete; |
|---|
| 71 | 78 | } |
|---|
| 72 | 79 | |
|---|
| 73 | 80 | spin_lock_irqsave(&vc4->job_lock, irqflags); |
|---|
| .. | .. |
|---|
| 98 | 105 | V3D_WRITE(V3D_INTCTL, V3D_INT_OUTOMEM); |
|---|
| 99 | 106 | V3D_WRITE(V3D_INTENA, V3D_INT_OUTOMEM); |
|---|
| 100 | 107 | spin_unlock_irqrestore(&vc4->job_lock, irqflags); |
|---|
| 108 | + |
|---|
| 109 | +complete: |
|---|
| 110 | + mutex_unlock(&vc4->bin_bo_lock); |
|---|
| 101 | 111 | } |
|---|
| 102 | 112 | |
|---|
| 103 | 113 | static void |
|---|
| .. | .. |
|---|
| 229 | 239 | { |
|---|
| 230 | 240 | struct vc4_dev *vc4 = to_vc4_dev(dev); |
|---|
| 231 | 241 | |
|---|
| 242 | + if (!vc4->v3d) |
|---|
| 243 | + return; |
|---|
| 244 | + |
|---|
| 232 | 245 | init_waitqueue_head(&vc4->job_wait_queue); |
|---|
| 233 | 246 | INIT_WORK(&vc4->overflow_mem_work, vc4_overflow_mem_work); |
|---|
| 234 | 247 | |
|---|
| .. | .. |
|---|
| 243 | 256 | { |
|---|
| 244 | 257 | struct vc4_dev *vc4 = to_vc4_dev(dev); |
|---|
| 245 | 258 | |
|---|
| 246 | | - /* Enable both the render done and out of memory interrupts. */ |
|---|
| 247 | | - V3D_WRITE(V3D_INTENA, V3D_DRIVER_IRQS); |
|---|
| 259 | + if (!vc4->v3d) |
|---|
| 260 | + return 0; |
|---|
| 261 | + |
|---|
| 262 | + /* Enable the render done interrupts. The out-of-memory interrupt is |
|---|
| 263 | + * enabled as soon as we have a binner BO allocated. |
|---|
| 264 | + */ |
|---|
| 265 | + V3D_WRITE(V3D_INTENA, V3D_INT_FLDONE | V3D_INT_FRDONE); |
|---|
| 248 | 266 | |
|---|
| 249 | 267 | return 0; |
|---|
| 250 | 268 | } |
|---|
| .. | .. |
|---|
| 254 | 272 | { |
|---|
| 255 | 273 | struct vc4_dev *vc4 = to_vc4_dev(dev); |
|---|
| 256 | 274 | |
|---|
| 275 | + if (!vc4->v3d) |
|---|
| 276 | + return; |
|---|
| 277 | + |
|---|
| 257 | 278 | /* Disable sending interrupts for our driver's IRQs. */ |
|---|
| 258 | 279 | V3D_WRITE(V3D_INTDIS, V3D_DRIVER_IRQS); |
|---|
| 259 | 280 | |
|---|