mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-23 05:56:14 -04:00
Use disable_work_sync() instead of cancel_work_sync() in ivpu_dev_fini()
to ensure that no new recovery work items can be queued after device
removal has started. Previously, recovery work could be scheduled even
after canceling existing work, potentially leading to use-after-free
bugs if recovery accessed freed resources.
Rename ivpu_pm_cancel_recovery() to ivpu_pm_disable_recovery() to better
reflect its new behavior.
Fixes: 58cde80f45 ("accel/ivpu: Use dedicated work for job timeout detection")
Cc: stable@vger.kernel.org # v6.8+
Signed-off-by: Karol Wachowski <karol.wachowski@intel.com>
Reviewed-by: Lizhi Hou <lizhi.hou@amd.com>
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Link: https://lore.kernel.org/r/20250808110939.328366-1-jacek.lawrynowicz@linux.intel.com
51 lines
1.5 KiB
C
51 lines
1.5 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* Copyright (C) 2020-2024 Intel Corporation
|
|
*/
|
|
|
|
#ifndef __IVPU_PM_H__
|
|
#define __IVPU_PM_H__
|
|
|
|
#include <linux/rwsem.h>
|
|
#include <linux/types.h>
|
|
|
|
struct ivpu_device;
|
|
|
|
struct ivpu_pm_info {
|
|
struct ivpu_device *vdev;
|
|
struct delayed_work job_timeout_work;
|
|
struct work_struct recovery_work;
|
|
struct rw_semaphore reset_lock;
|
|
atomic_t reset_counter;
|
|
atomic_t reset_pending;
|
|
bool is_warmboot;
|
|
u8 dct_active_percent;
|
|
};
|
|
|
|
void ivpu_pm_init(struct ivpu_device *vdev);
|
|
void ivpu_pm_enable(struct ivpu_device *vdev);
|
|
void ivpu_pm_disable(struct ivpu_device *vdev);
|
|
void ivpu_pm_disable_recovery(struct ivpu_device *vdev);
|
|
|
|
int ivpu_pm_suspend_cb(struct device *dev);
|
|
int ivpu_pm_resume_cb(struct device *dev);
|
|
int ivpu_pm_runtime_suspend_cb(struct device *dev);
|
|
int ivpu_pm_runtime_resume_cb(struct device *dev);
|
|
|
|
void ivpu_pm_reset_prepare_cb(struct pci_dev *pdev);
|
|
void ivpu_pm_reset_done_cb(struct pci_dev *pdev);
|
|
|
|
int __must_check ivpu_rpm_get(struct ivpu_device *vdev);
|
|
void ivpu_rpm_put(struct ivpu_device *vdev);
|
|
|
|
void ivpu_pm_trigger_recovery(struct ivpu_device *vdev, const char *reason);
|
|
void ivpu_start_job_timeout_detection(struct ivpu_device *vdev);
|
|
void ivpu_stop_job_timeout_detection(struct ivpu_device *vdev);
|
|
|
|
int ivpu_pm_dct_init(struct ivpu_device *vdev);
|
|
int ivpu_pm_dct_enable(struct ivpu_device *vdev, u8 active_percent);
|
|
int ivpu_pm_dct_disable(struct ivpu_device *vdev);
|
|
void ivpu_pm_irq_dct_work_fn(struct work_struct *work);
|
|
|
|
#endif /* __IVPU_PM_H__ */
|