Skip to content

Commit b0873ee

Browse files
committed
accel/ivpu: Do not use wait event interruptible
If we receive signal when waiting for IPC message response in ivpu_ipc_receive() we return error and continue to operate. Then the driver can send another IPC messages and re-use occupied slot of the message still processed by the firmware. This can result in corrupting firmware memory and following FW crash with messages: [ 3698.569719] intel_vpu 0000:00:0b.0: [drm] ivpu_ipc_send_receive_internal(): IPC receive failed: type 0x1103, ret -512 [ 3698.569747] intel_vpu 0000:00:0b.0: [drm] ivpu_jsm_unregister_db(): Failed to unregister doorbell 3: -512 [ 3698.569756] intel_vpu 0000:00:0b.0: [drm] ivpu_ipc_tx_prepare(): IPC message vpu:0x88980000 not released by firmware [ 3698.569763] intel_vpu 0000:00:0b.0: [drm] ivpu_ipc_tx_prepare(): JSM message vpu:0x88980040 not released by firmware [ 3698.570234] intel_vpu 0000:00:0b.0: [drm] ivpu_ipc_send_receive_internal(): IPC receive failed: type 0x110e, ret -512 [ 3698.570318] intel_vpu 0000:00:0b.0: [drm] *ERROR* ivpu_mmu_dump_event(): MMU EVTQ: 0x10 (Translation fault) SSID: 0 SID: 3, e[2] 00000000, e[3] 00000208, in addr: 0x88988000, fetch addr: 0x0 To fix the issue don't use interruptible variant of wait event to allow firmware to finish IPC processing. Fixes: 5d7422c ("accel/ivpu: Add IPC driver and JSM messages") Reviewed-by: Karol Wachowski <[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 9c1b242 commit b0873ee

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

drivers/accel/ivpu/ivpu_ipc.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -209,20 +209,17 @@ int ivpu_ipc_receive(struct ivpu_device *vdev, struct ivpu_ipc_consumer *cons,
209209
struct ivpu_ipc_rx_msg *rx_msg;
210210
int wait_ret, ret = 0;
211211

212-
wait_ret = wait_event_interruptible_timeout(cons->rx_msg_wq,
213-
(IS_KTHREAD() && kthread_should_stop()) ||
214-
!list_empty(&cons->rx_msg_list),
215-
msecs_to_jiffies(timeout_ms));
212+
wait_ret = wait_event_timeout(cons->rx_msg_wq,
213+
(IS_KTHREAD() && kthread_should_stop()) ||
214+
!list_empty(&cons->rx_msg_list),
215+
msecs_to_jiffies(timeout_ms));
216216

217217
if (IS_KTHREAD() && kthread_should_stop())
218218
return -EINTR;
219219

220220
if (wait_ret == 0)
221221
return -ETIMEDOUT;
222222

223-
if (wait_ret < 0)
224-
return -ERESTARTSYS;
225-
226223
spin_lock_irq(&cons->rx_msg_lock);
227224
rx_msg = list_first_entry_or_null(&cons->rx_msg_list, struct ivpu_ipc_rx_msg, link);
228225
if (!rx_msg) {

0 commit comments

Comments
 (0)