From df291cad8316c98d186a2cacaacf65fc68902410 Mon Sep 17 00:00:00 2001 From: George Shen Date: Fri, 26 May 2023 10:04:30 -0700 Subject: [PATCH] msm: eva: Give EVA IRQ thread realtime priority To ensure consistent EVA feature performance. Change-Id: I8068984bb677b7eef388b114efc36520be9f8d76 Signed-off-by: George Shen --- msm/eva/cvp_core_hfi.h | 2 ++ msm/eva/cvp_hfi.c | 18 ++++-------------- msm/eva/vm/cvp_vm_main.c | 6 +++--- 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/msm/eva/cvp_core_hfi.h b/msm/eva/cvp_core_hfi.h index f93b0db0bc..9f41bb2632 100644 --- a/msm/eva/cvp_core_hfi.h +++ b/msm/eva/cvp_core_hfi.h @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* * Copyright (c) 2018-2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. */ #ifndef __H_CVP_CORE_HFI_H__ @@ -280,6 +281,7 @@ struct iris_hfi_device { }; irqreturn_t cvp_hfi_isr(int irq, void *dev); +irqreturn_t iris_hfi_core_work_handler(int irq, void *data); irqreturn_t iris_hfi_isr_wd(int irq, void *dev); void cvp_iris_hfi_delete_device(void *device); diff --git a/msm/eva/cvp_hfi.c b/msm/eva/cvp_hfi.c index 859ee78604..a15f799a99 100644 --- a/msm/eva/cvp_hfi.c +++ b/msm/eva/cvp_hfi.c @@ -3456,7 +3456,7 @@ exit: return packet_count; } -static void iris_hfi_core_work_handler(struct work_struct *work) +irqreturn_t iris_hfi_core_work_handler(int irq, void *data) { struct msm_cvp_core *core; struct iris_hfi_device *device; @@ -3468,11 +3468,9 @@ static void iris_hfi_core_work_handler(struct work_struct *work) if (core) device = core->device->hfi_device_data; else - return; + return IRQ_HANDLED; mutex_lock(&device->lock); - - if (!__core_in_valid_state(device)) { if (warning_on) { dprintk(CVP_WARN, "%s Core not in init state\n", @@ -3531,21 +3529,13 @@ err_no_work: if (!(intr_status & CVP_WRAPPER_INTR_STATUS_A2HWD_BMSK)) enable_irq(device->cvp_hal_data->irq); - /* - * XXX: Don't add any code beyond here. Reacquiring locks after release - * it above doesn't guarantee the atomicity that we're aiming for. - */ + return IRQ_HANDLED; } -static DECLARE_WORK(iris_hfi_work, iris_hfi_core_work_handler); - irqreturn_t cvp_hfi_isr(int irq, void *dev) { - struct iris_hfi_device *device = dev; - disable_irq_nosync(irq); - queue_work(device->cvp_workq, &iris_hfi_work); - return IRQ_HANDLED; + return IRQ_WAKE_THREAD; } static void iris_hfi_wd_work_handler(struct work_struct *work) diff --git a/msm/eva/vm/cvp_vm_main.c b/msm/eva/vm/cvp_vm_main.c index b84f21cb6b..e53eb138bb 100644 --- a/msm/eva/vm/cvp_vm_main.c +++ b/msm/eva/vm/cvp_vm_main.c @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only * - * Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2022-2023, Qualcomm Innovation Center, Inc. All rights reserved. */ #include #include @@ -153,8 +153,8 @@ static int msm_cvp_vm_init_reg_and_irq(struct iris_hfi_device *device, } device->cvp_hal_data = hal; - rc = request_irq(res->irq, cvp_hfi_isr, IRQF_TRIGGER_HIGH, - "msm_cvp", device); + rc = request_threaded_irq(res->irq, cvp_hfi_isr, iris_hfi_core_work_handler, + IRQF_TRIGGER_HIGH, "msm_cvp", device); if (unlikely(rc)) { dprintk(CVP_ERR, "%s: request_irq failed rc: %d\n", __func__, rc); goto error_irq_fail;