Skip to content

Commit b563e47

Browse files
committed
accel/ivpu: Do not use mutex_lock_interruptible
If we get signal when waiting for the mmu->lock we do not invalidate current MMU configuration that might result in undefined behavior. Additionally there is little or no benefit on break waiting for ipc->lock. In current code base, we keep this lock for short periods. Fixes: 263b2ba ("accel/ivpu: Add Intel VPU MMU support") Reviewed-by: Krystian Pradzynski <[email protected]> Reviewed-by: Jeffrey Hugo <[email protected]> Signed-off-by: Stanislaw Gruszka <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 9f7e361 commit b563e47

File tree

2 files changed

+7
-19
lines changed

2 files changed

+7
-19
lines changed

drivers/accel/ivpu/ivpu_ipc.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,7 @@ ivpu_ipc_send(struct ivpu_device *vdev, struct ivpu_ipc_consumer *cons, struct v
183183
struct ivpu_ipc_info *ipc = vdev->ipc;
184184
int ret;
185185

186-
ret = mutex_lock_interruptible(&ipc->lock);
187-
if (ret)
188-
return ret;
186+
mutex_lock(&ipc->lock);
189187

190188
if (!ipc->on) {
191189
ret = -EAGAIN;

drivers/accel/ivpu/ivpu_mmu.c

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -587,16 +587,11 @@ static int ivpu_mmu_strtab_init(struct ivpu_device *vdev)
587587
int ivpu_mmu_invalidate_tlb(struct ivpu_device *vdev, u16 ssid)
588588
{
589589
struct ivpu_mmu_info *mmu = vdev->mmu;
590-
int ret;
591-
592-
ret = mutex_lock_interruptible(&mmu->lock);
593-
if (ret)
594-
return ret;
590+
int ret = 0;
595591

596-
if (!mmu->on) {
597-
ret = 0;
592+
mutex_lock(&mmu->lock);
593+
if (!mmu->on)
598594
goto unlock;
599-
}
600595

601596
ret = ivpu_mmu_cmdq_write_tlbi_nh_asid(vdev, ssid);
602597
if (ret)
@@ -614,7 +609,7 @@ static int ivpu_mmu_cd_add(struct ivpu_device *vdev, u32 ssid, u64 cd_dma)
614609
struct ivpu_mmu_cdtab *cdtab = &mmu->cdtab;
615610
u64 *entry;
616611
u64 cd[4];
617-
int ret;
612+
int ret = 0;
618613

619614
if (ssid > IVPU_MMU_CDTAB_ENT_COUNT)
620615
return -EINVAL;
@@ -655,14 +650,9 @@ static int ivpu_mmu_cd_add(struct ivpu_device *vdev, u32 ssid, u64 cd_dma)
655650
ivpu_dbg(vdev, MMU, "CDTAB %s entry (SSID=%u, dma=%pad): 0x%llx, 0x%llx, 0x%llx, 0x%llx\n",
656651
cd_dma ? "write" : "clear", ssid, &cd_dma, cd[0], cd[1], cd[2], cd[3]);
657652

658-
ret = mutex_lock_interruptible(&mmu->lock);
659-
if (ret)
660-
return ret;
661-
662-
if (!mmu->on) {
663-
ret = 0;
653+
mutex_lock(&mmu->lock);
654+
if (!mmu->on)
664655
goto unlock;
665-
}
666656

667657
ret = ivpu_mmu_cmdq_write_cfgi_all(vdev);
668658
if (ret)

0 commit comments

Comments
 (0)