* [PATCH 1/3] accel/ivpu: Fix general protection fault in ivpu_bo_list()
2024-12-10 13:09 [PATCH 0/3] accel/ivpu: Fixes for 6.13 Jacek Lawrynowicz
@ 2024-12-10 13:09 ` Jacek Lawrynowicz
2024-12-13 15:52 ` Jeffrey Hugo
2024-12-10 13:09 ` [PATCH 2/3] accel/ivpu: Fix memory leak in ivpu_mmu_reserved_context_init() Jacek Lawrynowicz
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Jacek Lawrynowicz @ 2024-12-10 13:09 UTC (permalink / raw)
To: dri-devel
Cc: oded.gabbay, quic_jhugo, Jacek Lawrynowicz, stable,
Karol Wachowski
Check if ctx is not NULL before accessing its fields.
Fixes: 37dee2a2f433 ("accel/ivpu: Improve buffer object debug logs")
Cc: <stable@vger.kernel.org> # v6.8
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Reviewed-by: Karol Wachowski <karol.wachowski@intel.com>
---
drivers/accel/ivpu/ivpu_gem.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/accel/ivpu/ivpu_gem.c b/drivers/accel/ivpu/ivpu_gem.c
index d8e97a760fbc0..16178054e6296 100644
--- a/drivers/accel/ivpu/ivpu_gem.c
+++ b/drivers/accel/ivpu/ivpu_gem.c
@@ -409,7 +409,7 @@ static void ivpu_bo_print_info(struct ivpu_bo *bo, struct drm_printer *p)
mutex_lock(&bo->lock);
drm_printf(p, "%-9p %-3u 0x%-12llx %-10lu 0x%-8x %-4u",
- bo, bo->ctx->id, bo->vpu_addr, bo->base.base.size,
+ bo, bo->ctx ? bo->ctx->id : 0, bo->vpu_addr, bo->base.base.size,
bo->flags, kref_read(&bo->base.base.refcount));
if (bo->base.pages)
--
2.45.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH 1/3] accel/ivpu: Fix general protection fault in ivpu_bo_list()
2024-12-10 13:09 ` [PATCH 1/3] accel/ivpu: Fix general protection fault in ivpu_bo_list() Jacek Lawrynowicz
@ 2024-12-13 15:52 ` Jeffrey Hugo
0 siblings, 0 replies; 8+ messages in thread
From: Jeffrey Hugo @ 2024-12-13 15:52 UTC (permalink / raw)
To: Jacek Lawrynowicz, dri-devel; +Cc: oded.gabbay, stable, Karol Wachowski
On 12/10/2024 6:09 AM, Jacek Lawrynowicz wrote:
> Check if ctx is not NULL before accessing its fields.
>
> Fixes: 37dee2a2f433 ("accel/ivpu: Improve buffer object debug logs")
> Cc: <stable@vger.kernel.org> # v6.8
> Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
> Reviewed-by: Karol Wachowski <karol.wachowski@intel.com>
> ---
> drivers/accel/ivpu/ivpu_gem.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/accel/ivpu/ivpu_gem.c b/drivers/accel/ivpu/ivpu_gem.c
> index d8e97a760fbc0..16178054e6296 100644
> --- a/drivers/accel/ivpu/ivpu_gem.c
> +++ b/drivers/accel/ivpu/ivpu_gem.c
> @@ -409,7 +409,7 @@ static void ivpu_bo_print_info(struct ivpu_bo *bo, struct drm_printer *p)
> mutex_lock(&bo->lock);
>
> drm_printf(p, "%-9p %-3u 0x%-12llx %-10lu 0x%-8x %-4u",
> - bo, bo->ctx->id, bo->vpu_addr, bo->base.base.size,
> + bo, bo->ctx ? bo->ctx->id : 0, bo->vpu_addr, bo->base.base.size,
> bo->flags, kref_read(&bo->base.base.refcount));
>
> if (bo->base.pages)
Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/3] accel/ivpu: Fix memory leak in ivpu_mmu_reserved_context_init()
2024-12-10 13:09 [PATCH 0/3] accel/ivpu: Fixes for 6.13 Jacek Lawrynowicz
2024-12-10 13:09 ` [PATCH 1/3] accel/ivpu: Fix general protection fault in ivpu_bo_list() Jacek Lawrynowicz
@ 2024-12-10 13:09 ` Jacek Lawrynowicz
2024-12-13 15:53 ` Jeffrey Hugo
2024-12-10 13:09 ` [PATCH 3/3] accel/ivpu: Fix WARN in ivpu_ipc_send_receive_internal() Jacek Lawrynowicz
2024-12-19 12:20 ` [PATCH 0/3] accel/ivpu: Fixes for 6.13 Jacek Lawrynowicz
3 siblings, 1 reply; 8+ messages in thread
From: Jacek Lawrynowicz @ 2024-12-10 13:09 UTC (permalink / raw)
To: dri-devel; +Cc: oded.gabbay, quic_jhugo, Jacek Lawrynowicz, Karol Wachowski
Add appropriate error handling to ensure all allocated resources are
released upon encountering an error.
Fixes: a74f4d991352 ("accel/ivpu: Defer MMU root page table allocation")
Cc: Karol Wachowski <karol.wachowski@intel.com>
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Reviewed-by: Karol Wachowski <karol.wachowski@intel.com>
---
drivers/accel/ivpu/ivpu_mmu_context.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/accel/ivpu/ivpu_mmu_context.c b/drivers/accel/ivpu/ivpu_mmu_context.c
index 891967a95bc3c..0af614dfb6f92 100644
--- a/drivers/accel/ivpu/ivpu_mmu_context.c
+++ b/drivers/accel/ivpu/ivpu_mmu_context.c
@@ -612,18 +612,22 @@ int ivpu_mmu_reserved_context_init(struct ivpu_device *vdev)
if (!ivpu_mmu_ensure_pgd(vdev, &vdev->rctx.pgtable)) {
ivpu_err(vdev, "Failed to allocate root page table for reserved context\n");
ret = -ENOMEM;
- goto unlock;
+ goto err_ctx_fini;
}
ret = ivpu_mmu_cd_set(vdev, vdev->rctx.id, &vdev->rctx.pgtable);
if (ret) {
ivpu_err(vdev, "Failed to set context descriptor for reserved context\n");
- goto unlock;
+ goto err_ctx_fini;
}
-unlock:
mutex_unlock(&vdev->rctx.lock);
return ret;
+
+err_ctx_fini:
+ mutex_unlock(&vdev->rctx.lock);
+ ivpu_mmu_context_fini(vdev, &vdev->rctx);
+ return ret;
}
void ivpu_mmu_reserved_context_fini(struct ivpu_device *vdev)
--
2.45.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 3/3] accel/ivpu: Fix WARN in ivpu_ipc_send_receive_internal()
2024-12-10 13:09 [PATCH 0/3] accel/ivpu: Fixes for 6.13 Jacek Lawrynowicz
2024-12-10 13:09 ` [PATCH 1/3] accel/ivpu: Fix general protection fault in ivpu_bo_list() Jacek Lawrynowicz
2024-12-10 13:09 ` [PATCH 2/3] accel/ivpu: Fix memory leak in ivpu_mmu_reserved_context_init() Jacek Lawrynowicz
@ 2024-12-10 13:09 ` Jacek Lawrynowicz
2024-12-13 15:54 ` Jeffrey Hugo
2024-12-19 12:20 ` [PATCH 0/3] accel/ivpu: Fixes for 6.13 Jacek Lawrynowicz
3 siblings, 1 reply; 8+ messages in thread
From: Jacek Lawrynowicz @ 2024-12-10 13:09 UTC (permalink / raw)
To: dri-devel
Cc: oded.gabbay, quic_jhugo, Jacek Lawrynowicz, stable,
Karol Wachowski
Move pm_runtime_set_active() to ivpu_pm_inti() so when
ivpu_ipc_send_receive_internal() is executed before ivpu_pm_enable()
it already has correct runtime state, even if last resume was
not successful.
Fixes: 8ed520ff4682 ("accel/ivpu: Move set autosuspend delay to HW specific code")
Cc: <stable@vger.kernel.org> # v6.7+
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Reviewed-by: Karol Wachowski <karol.wachowski@intel.com>
---
drivers/accel/ivpu/ivpu_pm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/accel/ivpu/ivpu_pm.c b/drivers/accel/ivpu/ivpu_pm.c
index dbc0711e28d13..949f4233946c6 100644
--- a/drivers/accel/ivpu/ivpu_pm.c
+++ b/drivers/accel/ivpu/ivpu_pm.c
@@ -378,6 +378,7 @@ void ivpu_pm_init(struct ivpu_device *vdev)
pm_runtime_use_autosuspend(dev);
pm_runtime_set_autosuspend_delay(dev, delay);
+ pm_runtime_set_active(dev);
ivpu_dbg(vdev, PM, "Autosuspend delay = %d\n", delay);
}
@@ -392,7 +393,6 @@ void ivpu_pm_enable(struct ivpu_device *vdev)
{
struct device *dev = vdev->drm.dev;
- pm_runtime_set_active(dev);
pm_runtime_allow(dev);
pm_runtime_mark_last_busy(dev);
pm_runtime_put_autosuspend(dev);
--
2.45.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH 0/3] accel/ivpu: Fixes for 6.13
2024-12-10 13:09 [PATCH 0/3] accel/ivpu: Fixes for 6.13 Jacek Lawrynowicz
` (2 preceding siblings ...)
2024-12-10 13:09 ` [PATCH 3/3] accel/ivpu: Fix WARN in ivpu_ipc_send_receive_internal() Jacek Lawrynowicz
@ 2024-12-19 12:20 ` Jacek Lawrynowicz
3 siblings, 0 replies; 8+ messages in thread
From: Jacek Lawrynowicz @ 2024-12-19 12:20 UTC (permalink / raw)
To: dri-devel; +Cc: oded.gabbay, quic_jhugo
Applied to drm-misc-fixes
On 12/10/2024 2:09 PM, Jacek Lawrynowicz wrote:
> This patchset addresses several issues in the accel/ivpu module,
> including fixing a general protection fault in ivpu_bo_list().
>
> Jacek Lawrynowicz (3):
> accel/ivpu: Fix general protection fault in ivpu_bo_list()
> accel/ivpu: Fix memory leak in ivpu_mmu_reserved_context_init()
> accel/ivpu: Fix WARN in ivpu_ipc_send_receive_internal()
>
> drivers/accel/ivpu/ivpu_gem.c | 2 +-
> drivers/accel/ivpu/ivpu_mmu_context.c | 10 +++++++---
> drivers/accel/ivpu/ivpu_pm.c | 2 +-
> 3 files changed, 9 insertions(+), 5 deletions(-)
>
> --
> 2.45.1
^ permalink raw reply [flat|nested] 8+ messages in thread