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: 263b2ba5fc
("accel/ivpu: Add Intel VPU MMU support")
Reviewed-by: Krystian Pradzynski <krystian.pradzynski@linux.intel.com>
Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230525103818.877590-2-stanislaw.gruszka@linux.intel.com
This commit is contained in:
parent
9f7e3611f6
commit
b563e47957
@ -183,9 +183,7 @@ ivpu_ipc_send(struct ivpu_device *vdev, struct ivpu_ipc_consumer *cons, struct v
|
|||||||
struct ivpu_ipc_info *ipc = vdev->ipc;
|
struct ivpu_ipc_info *ipc = vdev->ipc;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = mutex_lock_interruptible(&ipc->lock);
|
mutex_lock(&ipc->lock);
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
if (!ipc->on) {
|
if (!ipc->on) {
|
||||||
ret = -EAGAIN;
|
ret = -EAGAIN;
|
||||||
|
@ -587,16 +587,11 @@ static int ivpu_mmu_strtab_init(struct ivpu_device *vdev)
|
|||||||
int ivpu_mmu_invalidate_tlb(struct ivpu_device *vdev, u16 ssid)
|
int ivpu_mmu_invalidate_tlb(struct ivpu_device *vdev, u16 ssid)
|
||||||
{
|
{
|
||||||
struct ivpu_mmu_info *mmu = vdev->mmu;
|
struct ivpu_mmu_info *mmu = vdev->mmu;
|
||||||
int ret;
|
int ret = 0;
|
||||||
|
|
||||||
ret = mutex_lock_interruptible(&mmu->lock);
|
mutex_lock(&mmu->lock);
|
||||||
if (ret)
|
if (!mmu->on)
|
||||||
return ret;
|
|
||||||
|
|
||||||
if (!mmu->on) {
|
|
||||||
ret = 0;
|
|
||||||
goto unlock;
|
goto unlock;
|
||||||
}
|
|
||||||
|
|
||||||
ret = ivpu_mmu_cmdq_write_tlbi_nh_asid(vdev, ssid);
|
ret = ivpu_mmu_cmdq_write_tlbi_nh_asid(vdev, ssid);
|
||||||
if (ret)
|
if (ret)
|
||||||
@ -614,7 +609,7 @@ static int ivpu_mmu_cd_add(struct ivpu_device *vdev, u32 ssid, u64 cd_dma)
|
|||||||
struct ivpu_mmu_cdtab *cdtab = &mmu->cdtab;
|
struct ivpu_mmu_cdtab *cdtab = &mmu->cdtab;
|
||||||
u64 *entry;
|
u64 *entry;
|
||||||
u64 cd[4];
|
u64 cd[4];
|
||||||
int ret;
|
int ret = 0;
|
||||||
|
|
||||||
if (ssid > IVPU_MMU_CDTAB_ENT_COUNT)
|
if (ssid > IVPU_MMU_CDTAB_ENT_COUNT)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -655,14 +650,9 @@ static int ivpu_mmu_cd_add(struct ivpu_device *vdev, u32 ssid, u64 cd_dma)
|
|||||||
ivpu_dbg(vdev, MMU, "CDTAB %s entry (SSID=%u, dma=%pad): 0x%llx, 0x%llx, 0x%llx, 0x%llx\n",
|
ivpu_dbg(vdev, MMU, "CDTAB %s entry (SSID=%u, dma=%pad): 0x%llx, 0x%llx, 0x%llx, 0x%llx\n",
|
||||||
cd_dma ? "write" : "clear", ssid, &cd_dma, cd[0], cd[1], cd[2], cd[3]);
|
cd_dma ? "write" : "clear", ssid, &cd_dma, cd[0], cd[1], cd[2], cd[3]);
|
||||||
|
|
||||||
ret = mutex_lock_interruptible(&mmu->lock);
|
mutex_lock(&mmu->lock);
|
||||||
if (ret)
|
if (!mmu->on)
|
||||||
return ret;
|
|
||||||
|
|
||||||
if (!mmu->on) {
|
|
||||||
ret = 0;
|
|
||||||
goto unlock;
|
goto unlock;
|
||||||
}
|
|
||||||
|
|
||||||
ret = ivpu_mmu_cmdq_write_cfgi_all(vdev);
|
ret = ivpu_mmu_cmdq_write_cfgi_all(vdev);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
Loading…
Reference in New Issue
Block a user