.. | .. |
---|
314 | 314 | |
---|
315 | 315 | static void *vepu_prepare(struct mpp_dev *mpp, struct mpp_task *mpp_task) |
---|
316 | 316 | { |
---|
317 | | - struct mpp_taskqueue *queue = mpp->queue; |
---|
318 | 317 | struct vepu_dev *enc = to_vepu_dev(mpp); |
---|
319 | 318 | struct vepu_ccu *ccu = enc->ccu; |
---|
320 | 319 | unsigned long core_idle; |
---|
321 | 320 | unsigned long flags; |
---|
322 | | - u32 core_id_max; |
---|
323 | 321 | s32 core_id; |
---|
324 | 322 | u32 i; |
---|
325 | 323 | |
---|
326 | 324 | spin_lock_irqsave(&ccu->lock, flags); |
---|
327 | 325 | |
---|
328 | | - core_idle = queue->core_idle; |
---|
329 | | - core_id_max = queue->core_id_max; |
---|
| 326 | + core_idle = ccu->core_idle; |
---|
330 | 327 | |
---|
331 | | - for (i = 0; i <= core_id_max; i++) { |
---|
332 | | - struct mpp_dev *mpp = queue->cores[i]; |
---|
| 328 | + for (i = 0; i < ccu->core_num; i++) { |
---|
| 329 | + struct mpp_dev *mpp = ccu->cores[i]; |
---|
333 | 330 | |
---|
334 | 331 | if (mpp && mpp->disable) |
---|
335 | | - clear_bit(i, &core_idle); |
---|
| 332 | + clear_bit(mpp->core_id, &core_idle); |
---|
336 | 333 | } |
---|
337 | 334 | |
---|
338 | | - core_id = find_first_bit(&ccu->core_idle, ccu->core_num); |
---|
339 | | - core_id = array_index_nospec(core_id, MPP_MAX_CORE_NUM); |
---|
340 | | - if (core_id >= core_id_max + 1 || !queue->cores[core_id]) { |
---|
| 335 | + core_id = find_first_bit(&core_idle, ccu->core_num); |
---|
| 336 | + if (core_id >= ARRAY_SIZE(ccu->cores)) { |
---|
341 | 337 | mpp_task = NULL; |
---|
342 | 338 | mpp_dbg_core("core %d all busy %lx\n", core_id, ccu->core_idle); |
---|
343 | | - } else { |
---|
344 | | - unsigned long core_idle = ccu->core_idle; |
---|
345 | | - |
---|
346 | | - clear_bit(core_id, &ccu->core_idle); |
---|
347 | | - mpp_task->mpp = ccu->cores[core_id]; |
---|
348 | | - mpp_task->core_id = core_id; |
---|
349 | | - |
---|
350 | | - mpp_dbg_core("core cnt %d core %d set idle %lx -> %lx\n", |
---|
351 | | - ccu->core_num, core_id, core_idle, ccu->core_idle); |
---|
| 339 | + goto done; |
---|
352 | 340 | } |
---|
353 | 341 | |
---|
| 342 | + core_id = array_index_nospec(core_id, MPP_MAX_CORE_NUM); |
---|
| 343 | + clear_bit(core_id, &ccu->core_idle); |
---|
| 344 | + mpp_task->mpp = ccu->cores[core_id]; |
---|
| 345 | + mpp_task->core_id = core_id; |
---|
| 346 | + |
---|
| 347 | + mpp_dbg_core("core cnt %d core %d set idle %lx -> %lx\n", |
---|
| 348 | + ccu->core_num, core_id, core_idle, ccu->core_idle); |
---|
| 349 | + |
---|
| 350 | +done: |
---|
354 | 351 | spin_unlock_irqrestore(&ccu->lock, flags); |
---|
355 | 352 | |
---|
356 | 353 | return mpp_task; |
---|
.. | .. |
---|
1050 | 1047 | ccu_info = ccu->main_core->iommu_info; |
---|
1051 | 1048 | cur_info = enc->mpp.iommu_info; |
---|
1052 | 1049 | |
---|
1053 | | - cur_info->domain = ccu_info->domain; |
---|
| 1050 | + if (cur_info) |
---|
| 1051 | + cur_info->domain = ccu_info->domain; |
---|
1054 | 1052 | mpp_iommu_attach(cur_info); |
---|
1055 | 1053 | } |
---|
1056 | 1054 | enc->ccu = ccu; |
---|