ivpu_ipc.c (5d7422cfb498bf25c4a9ea6b9d82253cb5236364) | ivpu_ipc.c (852be13f3bd32c1eab808840cfac41b1fea25991) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Copyright (C) 2020-2023 Intel Corporation 4 */ 5 6#include <linux/genalloc.h> 7#include <linux/highmem.h> 8#include <linux/kthread.h> 9#include <linux/wait.h> 10 11#include "ivpu_drv.h" 12#include "ivpu_gem.h" 13#include "ivpu_hw.h" 14#include "ivpu_hw_reg_io.h" 15#include "ivpu_ipc.h" 16#include "ivpu_jsm_msg.h" | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Copyright (C) 2020-2023 Intel Corporation 4 */ 5 6#include <linux/genalloc.h> 7#include <linux/highmem.h> 8#include <linux/kthread.h> 9#include <linux/wait.h> 10 11#include "ivpu_drv.h" 12#include "ivpu_gem.h" 13#include "ivpu_hw.h" 14#include "ivpu_hw_reg_io.h" 15#include "ivpu_ipc.h" 16#include "ivpu_jsm_msg.h" |
17#include "ivpu_pm.h" |
|
17 18#define IPC_MAX_RX_MSG 128 19#define IS_KTHREAD() (get_current()->flags & PF_KTHREAD) 20 21struct ivpu_ipc_tx_buf { 22 struct ivpu_ipc_hdr ipc; 23 struct vpu_jsm_msg jsm; 24}; --- 264 unchanged lines hidden (view full) --- 289 290int ivpu_ipc_send_receive(struct ivpu_device *vdev, struct vpu_jsm_msg *req, 291 enum vpu_ipc_msg_type expected_resp_type, 292 struct vpu_jsm_msg *resp, u32 channel, 293 unsigned long timeout_ms) 294{ 295 struct vpu_jsm_msg hb_req = { .type = VPU_JSM_MSG_QUERY_ENGINE_HB }; 296 struct vpu_jsm_msg hb_resp; | 18 19#define IPC_MAX_RX_MSG 128 20#define IS_KTHREAD() (get_current()->flags & PF_KTHREAD) 21 22struct ivpu_ipc_tx_buf { 23 struct ivpu_ipc_hdr ipc; 24 struct vpu_jsm_msg jsm; 25}; --- 264 unchanged lines hidden (view full) --- 290 291int ivpu_ipc_send_receive(struct ivpu_device *vdev, struct vpu_jsm_msg *req, 292 enum vpu_ipc_msg_type expected_resp_type, 293 struct vpu_jsm_msg *resp, u32 channel, 294 unsigned long timeout_ms) 295{ 296 struct vpu_jsm_msg hb_req = { .type = VPU_JSM_MSG_QUERY_ENGINE_HB }; 297 struct vpu_jsm_msg hb_resp; |
297 int ret; | 298 int ret, hb_ret; |
298 | 299 |
300 ret = ivpu_rpm_get(vdev); 301 if (ret < 0) 302 return ret; 303 |
|
299 ret = ivpu_ipc_send_receive_internal(vdev, req, expected_resp_type, resp, 300 channel, timeout_ms); 301 if (ret != -ETIMEDOUT) | 304 ret = ivpu_ipc_send_receive_internal(vdev, req, expected_resp_type, resp, 305 channel, timeout_ms); 306 if (ret != -ETIMEDOUT) |
302 return ret; | 307 goto rpm_put; |
303 | 308 |
304 ret = ivpu_ipc_send_receive_internal(vdev, &hb_req, VPU_JSM_MSG_QUERY_ENGINE_HB_DONE, 305 &hb_resp, VPU_IPC_CHAN_ASYNC_CMD, vdev->timeout.jsm); 306 if (ret == -ETIMEDOUT) | 309 hb_ret = ivpu_ipc_send_receive_internal(vdev, &hb_req, VPU_JSM_MSG_QUERY_ENGINE_HB_DONE, 310 &hb_resp, VPU_IPC_CHAN_ASYNC_CMD, 311 vdev->timeout.jsm); 312 if (hb_ret == -ETIMEDOUT) { |
307 ivpu_hw_diagnose_failure(vdev); | 313 ivpu_hw_diagnose_failure(vdev); |
314 ivpu_pm_schedule_recovery(vdev); 315 } |
|
308 | 316 |
317rpm_put: 318 ivpu_rpm_put(vdev); |
|
309 return ret; 310} 311 312static bool 313ivpu_ipc_match_consumer(struct ivpu_device *vdev, struct ivpu_ipc_consumer *cons, 314 struct ivpu_ipc_hdr *ipc_hdr, struct vpu_jsm_msg *jsm_msg) 315{ 316 if (cons->channel != ipc_hdr->channel) --- 184 unchanged lines hidden --- | 319 return ret; 320} 321 322static bool 323ivpu_ipc_match_consumer(struct ivpu_device *vdev, struct ivpu_ipc_consumer *cons, 324 struct ivpu_ipc_hdr *ipc_hdr, struct vpu_jsm_msg *jsm_msg) 325{ 326 if (cons->channel != ipc_hdr->channel) --- 184 unchanged lines hidden --- |