On 18.12.2023 12:32, Dikshita Agarwal wrote: > Allocate interrupt resources, enable the interrupt line and IRQ handling. > Register the IRQ handler to be called when interrupt occurs and > the function to be called from IRQ handler thread. > The threads invoke the driver's response handler which handles > all different responses from firmware. > > Signed-off-by: Dikshita Agarwal <quic_dikshita@xxxxxxxxxxx> > --- [...] > + > +irqreturn_t iris_hfi_isr_handler(int irq, void *data) > +{ > + struct iris_core *core = data; > + > + if (!core) > + return IRQ_NONE; Should this even be possible? > + > + mutex_lock(&core->lock); > + call_vpu_op(core, clear_interrupt, core); > + mutex_unlock(&core->lock); > + > + __response_handler(core); > + > + if (!call_vpu_op(core, watchdog, core, core->intr_status)) > + enable_irq(irq); > + > + return IRQ_HANDLED; > +} > diff --git a/drivers/media/platform/qcom/vcodec/iris/iris_hfi.h b/drivers/media/platform/qcom/vcodec/iris/iris_hfi.h > index 8a057cc..8a62986 100644 > --- a/drivers/media/platform/qcom/vcodec/iris/iris_hfi.h > +++ b/drivers/media/platform/qcom/vcodec/iris/iris_hfi.h > @@ -14,4 +14,7 @@ int iris_hfi_core_deinit(struct iris_core *core); > int iris_hfi_session_open(struct iris_inst *inst); > int iris_hfi_session_close(struct iris_inst *inst); > > +irqreturn_t iris_hfi_isr(int irq, void *data); > +irqreturn_t iris_hfi_isr_handler(int irq, void *data); > + > #endif > diff --git a/drivers/media/platform/qcom/vcodec/iris/iris_hfi_response.c b/drivers/media/platform/qcom/vcodec/iris/iris_hfi_response.c > new file mode 100644 > index 0000000..829f3f6 > --- /dev/null > +++ b/drivers/media/platform/qcom/vcodec/iris/iris_hfi_response.c > @@ -0,0 +1,184 @@ > +// SPDX-License-Identifier: GPL-2.0-only > +/* > + * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. > + */ > + > +#include "hfi_defines.h" > +#include "iris_hfi_packet.h" > +#include "iris_hfi_response.h" > + > +static void print_sfr_message(struct iris_core *core) I'm not sure how 'print' relates to what this function does [...] > +static int handle_system_error(struct iris_core *core, > + struct hfi_packet *pkt) > +{ > + print_sfr_message(core); > + > + iris_core_deinit(core); Either take the return value of /\ into account, or make this function void. > + > + return 0; > +} [...] > + > +struct sfr_buffer { > + u32 bufsize; > + u8 rg_data[]; Looks like you skipped static code checks.. Use __counted_by [...] > @@ -17,6 +17,8 @@ > #define CPU_CS_VCICMDARG0_IRIS3 (CPU_CS_BASE_OFFS_IRIS3 + 0x24) > #define CPU_CS_VCICMDARG1_IRIS3 (CPU_CS_BASE_OFFS_IRIS3 + 0x28) > > +#define CPU_CS_A2HSOFTINTCLR_IRIS3 (CPU_CS_BASE_OFFS_IRIS3 + 0x1C) You're mixing upper and lowercase hex throughout your defines. [...] > +static int clear_interrupt_iris3(struct iris_core *core) > +{ > + u32 intr_status = 0, mask = 0; > + int ret; > + > + ret = read_register(core, WRAPPER_INTR_STATUS_IRIS3, &intr_status); > + if (ret) > + return ret; > + > + mask = (WRAPPER_INTR_STATUS_A2H_BMSK_IRIS3 | > + WRAPPER_INTR_STATUS_A2HWD_BMSK_IRIS3 | > + CTRL_INIT_IDLE_MSG_BMSK_IRIS3); unnecesary parentheses > + > + if (intr_status & mask) > + core->intr_status |= intr_status; > + > + ret = write_register(core, CPU_CS_A2HSOFTINTCLR_IRIS3, 1); > + > + return ret; why not return write_register directly? Konrad