From 11fa89d6188cec8a27df591975b66cf48e9ef2cb Mon Sep 17 00:00:00 2001 From: Sagar Kamble Date: Wed, 6 Feb 2019 15:10:14 +0530 Subject: [PATCH] gpu: nvgpu: isolate common & hal falcon_set_irq functions nvgpu_falcon_set_irq should handle interrupts state. gk20a_falcon_set_irq is supposed to be hal API that will enable/disable the falcon interrupts. JIRA NVGPU-1459 Change-Id: I2c97a7c1fd5cc0a5d11d80f62bca5aaa66f3b3c9 Signed-off-by: Sagar Kamble Reviewed-on: https://git-master.nvidia.com/r/2015591 Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-misra GVS: Gerrit_Virtual_Submit Reviewed-by: Mahantesh Kumbar Reviewed-by: Vijayakumar Subbu Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/falcon/falcon.c | 19 ++++++++++++++----- .../gpu/nvgpu/common/falcon/falcon_gk20a.c | 7 ------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/nvgpu/common/falcon/falcon.c b/drivers/gpu/nvgpu/common/falcon/falcon.c index 4d91f8f01..ef4e7b067 100644 --- a/drivers/gpu/nvgpu/common/falcon/falcon.c +++ b/drivers/gpu/nvgpu/common/falcon/falcon.c @@ -140,19 +140,28 @@ void nvgpu_falcon_set_irq(struct nvgpu_falcon *flcn, bool enable, u32 intr_mask, u32 intr_dest) { struct nvgpu_falcon_ops *flcn_ops; + struct gk20a *g; if (flcn == NULL) { return; } + g = flcn->g; flcn_ops = &flcn->flcn_ops; - if (flcn_ops->set_irq != NULL) { - flcn_ops->set_irq(flcn, enable, intr_mask, intr_dest); - } else { - nvgpu_warn(flcn->g, "Invalid op on falcon 0x%x ", - flcn->flcn_id); + if (flcn_ops->set_irq == NULL) { + nvgpu_warn(g, "Invalid op on falcon 0x%x ", flcn->flcn_id); + return; } + + if (!flcn->is_interrupt_enabled) { + nvgpu_warn(g, "Interrupt not supported on flcn 0x%x ", + flcn->flcn_id); + /* Keep interrupt disabled */ + enable = false; + } + + flcn_ops->set_irq(flcn, enable, intr_mask, intr_dest); } int nvgpu_falcon_wait_for_halt(struct nvgpu_falcon *flcn, unsigned int timeout) diff --git a/drivers/gpu/nvgpu/common/falcon/falcon_gk20a.c b/drivers/gpu/nvgpu/common/falcon/falcon_gk20a.c index 0657fd896..4ff706823 100644 --- a/drivers/gpu/nvgpu/common/falcon/falcon_gk20a.c +++ b/drivers/gpu/nvgpu/common/falcon/falcon_gk20a.c @@ -68,13 +68,6 @@ static void gk20a_falcon_set_irq(struct nvgpu_falcon *flcn, bool enable, struct gk20a *g = flcn->g; u32 base_addr = flcn->flcn_base; - if (!flcn->is_interrupt_enabled) { - nvgpu_warn(g, "Interrupt not supported on flcn 0x%x ", - flcn->flcn_id); - /* Keep interrupt disabled */ - enable = false; - } - if (enable) { gk20a_writel(g, base_addr + falcon_falcon_irqmset_r(), intr_mask);