diff --git a/msm/eva/cvp_core_hfi.h b/msm/eva/cvp_core_hfi.h index e56e4a8eea..e4ca6b6549 100644 --- a/msm/eva/cvp_core_hfi.h +++ b/msm/eva/cvp_core_hfi.h @@ -232,6 +232,7 @@ struct iris_hfi_device { u32 device_id; u32 clk_freq; u32 last_packet_type; + u32 error; unsigned long clk_bitrate; unsigned long scaled_rate; struct msm_cvp_gov_data bus_vote; diff --git a/msm/eva/cvp_hfi.c b/msm/eva/cvp_hfi.c index 3ad885ad4e..54b20c883b 100644 --- a/msm/eva/cvp_hfi.c +++ b/msm/eva/cvp_hfi.c @@ -1802,7 +1802,9 @@ static int iris_pm_qos_update(void *device) dev = device; + mutex_lock(&dev->lock); cvp_pm_qos_update(dev, true); + mutex_unlock(&dev->lock); return 0; } @@ -3204,7 +3206,9 @@ static int reset_ahb2axi_bridge(struct iris_hfi_device *device) else s = CVP_POWER_OFF; +#ifdef CONFIG_EVA_WAIPIO s = CVP_POWER_IGNORED; +#endif for (i = 0; i < device->res->reset_set.count; i++) { rc = __handle_reset_clk(device->res, i, ASSERT, s); @@ -4077,6 +4081,13 @@ static int __power_off_controller(struct iris_hfi_device *device) "DBLP Release: lpi_status %x\n", lpi_status); } + /* PDXFIFO reset: addition for Kailua */ +#ifdef CONFIG_EVA_KALAMA + __write_register(device, CVP_WRAPPER_AXI_CLOCK_CONFIG, 0x3); + __write_register(device, CVP_WRAPPER_QNS4PDXFIFO_RESET, 0x1); + __write_register(device, CVP_WRAPPER_QNS4PDXFIFO_RESET, 0x0); + __write_register(device, CVP_WRAPPER_AXI_CLOCK_CONFIG, 0x0); +#endif /* HPG 6.2.2 Step 5 */ msm_cvp_disable_unprepare_clk(device, "cvp_clk"); @@ -4454,6 +4465,12 @@ static void __noc_error_info_iris2(struct iris_hfi_device *device) noc_log = &core->log.noc_log; + if (noc_log->used) { + dprintk(CVP_WARN, "Data already in NoC log, skip logging\n"); + return; + } + noc_log->used = 1; + val = __read_register(device, CVP_NOC_ERR_SWID_LOW_OFFS); __err_log(log_required, &noc_log->err_ctrl_swid_low, "CVP_NOC_ERL_MAIN_SWID_LOW", val); @@ -4550,7 +4567,6 @@ static void __noc_error_info_iris2(struct iris_hfi_device *device) __write_register(device, CVP_SS_ARP_TEST_BUS_CONTROL, regi); val = __read_register(device, CVP_SS_ARP_TEST_BUS_REGISTER); noc_log->arp_test_bus[i] = val; - dprintk(CVP_ERR, "ARP_CTL:%x - %x\n", regi, val); } for (i = 0; i < 512; i++) { @@ -4558,7 +4574,6 @@ static void __noc_error_info_iris2(struct iris_hfi_device *device) __write_register(device, CVP_DMA_TEST_BUS_CONTROL, regi); val = __read_register(device, CVP_DMA_TEST_BUS_REGISTER); noc_log->dma_test_bus[i] = val; - dprintk(CVP_ERR, "DMA_CTL:%x - %x\n", regi, val); } } diff --git a/msm/eva/cvp_hfi_io.h b/msm/eva/cvp_hfi_io.h index 2dc935278a..513e45dd07 100644 --- a/msm/eva/cvp_hfi_io.h +++ b/msm/eva/cvp_hfi_io.h @@ -105,12 +105,16 @@ #define CVP_WRAPPER_INTR_MASK_A2HCPU_SHFT 0x2 #define CVP_WRAPPER_INTR_CLEAR (CVP_WRAPPER_BASE_OFFS + 0x14) + #define CVP_WRAPPER_TZ_BASE_OFFS 0x000C0000 + #define CVP_WRAPPER_INTR_CLEAR_A2HWD_BMSK 0x10 #define CVP_WRAPPER_INTR_CLEAR_A2HWD_SHFT 0x4 #define CVP_WRAPPER_INTR_CLEAR_A2H_BMSK 0x4 #define CVP_WRAPPER_INTR_CLEAR_A2H_SHFT 0x2 #define CVP_WRAPPER_CPU_STATUS (CVP_WRAPPER_TZ_BASE_OFFS + 0x10) +#define CVP_WRAPPER_AXI_CLOCK_CONFIG (CVP_WRAPPER_TZ_BASE_OFFS + 0x14) +#define CVP_WRAPPER_QNS4PDXFIFO_RESET (CVP_WRAPPER_TZ_BASE_OFFS + 0x18) #define CVP_WRAPPER_CPU_CGC_DIS (CVP_WRAPPER_BASE_OFFS + 0x2010) #define CVP_WRAPPER_CPU_CLOCK_CONFIG (CVP_WRAPPER_BASE_OFFS + 0x50) diff --git a/msm/eva/hfi_response_handler.c b/msm/eva/hfi_response_handler.c index 9c093d4fab..1347d61be3 100644 --- a/msm/eva/hfi_response_handler.c +++ b/msm/eva/hfi_response_handler.c @@ -79,6 +79,7 @@ static int hfi_process_sys_error(u32 device_id, info->response_type = HAL_SYS_ERROR; info->response.cmd = cmd_done; + dprintk(CVP_ERR, "Received FW sys error %#x\n", pkt->event_data1); return 0; } diff --git a/msm/eva/msm_cvp_clocks.c b/msm/eva/msm_cvp_clocks.c index b03389df73..b61fd359a5 100644 --- a/msm/eva/msm_cvp_clocks.c +++ b/msm/eva/msm_cvp_clocks.c @@ -8,6 +8,18 @@ #include "msm_cvp_debug.h" #include "msm_cvp_clocks.h" +static bool __mmrm_client_check_scaling_supported( + struct mmrm_client_desc *client) +{ +#ifdef CVP_MMRM_ENABLED + return mmrm_client_check_scaling_supported( + client->client_type, + client->client_info.desc.client_domain); +#else + return false; +#endif +} + static struct mmrm_client *__mmrm_client_register( struct mmrm_client_desc *client) { @@ -87,6 +99,7 @@ int msm_cvp_mmrm_register(struct iris_hfi_device *device) int rc = 0; struct clock_info *cl = NULL; char *name; + bool isSupport; if (!device) { dprintk(CVP_ERR, "%s invalid device\n", __func__); @@ -110,6 +123,14 @@ int msm_cvp_mmrm_register(struct iris_hfi_device *device) } } + isSupport = __mmrm_client_check_scaling_supported(&(device->mmrm_desc)); + + if (!isSupport) { + dprintk(CVP_PWR, "%s: mmrm not supported, flag: %d\n", + __func__, isSupport); + return rc; + } + dprintk(CVP_PWR, "%s: Register for %s, clk_id %d\n", __func__, device->mmrm_desc.client_info.desc.name, @@ -137,13 +158,20 @@ int msm_cvp_mmrm_deregister(struct iris_hfi_device *device) int rc = 0; struct clock_info *cl = NULL; - if (!device || !device->mmrm_cvp) { + if (!device) { dprintk(CVP_ERR, - "%s invalid args: device %pK, or device->mmrm_cvp \n", + "%s invalid args: device %pK \n", __func__, device); return -EINVAL; } + if (!device->mmrm_cvp) { // when mmrm not supported + dprintk(CVP_ERR, + "%s device->mmrm_cvp not initialized \n", + __func__); + return rc; + } + /* set clk value to 0 before deregister */ iris_hfi_for_each_clock(device, cl) { if ((cl->has_scaling) && (__clk_is_enabled(cl->clk))){ diff --git a/msm/eva/msm_cvp_common.c b/msm/eva/msm_cvp_common.c index 19f2dddfdc..8160d9a442 100644 --- a/msm/eva/msm_cvp_common.c +++ b/msm/eva/msm_cvp_common.c @@ -582,6 +582,7 @@ static void handle_sys_error(enum hal_command_response cmd, void *data) struct msm_cvp_cb_cmd_done *response = data; struct msm_cvp_core *core = NULL; struct cvp_hfi_device *hdev = NULL; + struct iris_hfi_device *hfi_device; struct msm_cvp_inst *inst = NULL; int i, rc = 0; unsigned long flags = 0; @@ -612,11 +613,14 @@ static void handle_sys_error(enum hal_command_response cmd, void *data) cur_state = core->state; core->state = CVP_CORE_UNINIT; + dprintk(CVP_WARN, "SYS_ERROR received for core %pK cmd %x\n", + core, cmd); mutex_lock(&core->clk_lock); - dprintk(CVP_WARN, "SYS_ERROR received for core %pK\n", core); - if (response->status == CVP_ERR_NOC_ERROR) { + hfi_device = hdev->hfi_device_data; + if (hfi_device->error == CVP_ERR_NOC_ERROR) { dprintk(CVP_WARN, "Got NOC error"); msm_cvp_noc_error_info(core); + hfi_device->error = 0xdead; MSM_CVP_ERROR(true); } call_hfi_op(hdev, flush_debug_queue, hdev->hfi_device_data); diff --git a/msm/eva/msm_cvp_debug.c b/msm/eva/msm_cvp_debug.c index efeaebc312..3dd365adb9 100644 --- a/msm/eva/msm_cvp_debug.c +++ b/msm/eva/msm_cvp_debug.c @@ -28,7 +28,11 @@ bool msm_cvp_cacheop_disabled = !true; int msm_cvp_clock_voting = !1; bool msm_cvp_syscache_disable = !true; bool msm_cvp_dsp_disable = !true; +#ifdef CVP_MMRM_ENABLED bool msm_cvp_mmrm_enabled = true; +#else +bool msm_cvp_mmrm_enabled = !true; +#endif bool msm_cvp_dcvs_disable = !true; int msm_cvp_minidump_enable = !1; diff --git a/msm/eva/msm_cvp_dsp.c b/msm/eva/msm_cvp_dsp.c index 2308f2a9c1..ebb6941036 100644 --- a/msm/eva/msm_cvp_dsp.c +++ b/msm/eva/msm_cvp_dsp.c @@ -337,6 +337,7 @@ static void cvp_dsp_rpmsg_remove(struct rpmsg_device *rpdev) mutex_unlock(&me->tx_lock); ptr = &me->fastrpc_driver_list.list; + mutex_lock(&me->fastrpc_driver_list.lock); list_for_each_safe(ptr, next, &me->fastrpc_driver_list.list) { frpc_node = list_entry(ptr, struct cvp_dsp_fastrpc_driver_entry, list); @@ -368,7 +369,7 @@ static void cvp_dsp_rpmsg_remove(struct rpmsg_device *rpdev) frpc_node = NULL; } } - + mutex_unlock(&me->fastrpc_driver_list.lock); dprintk(CVP_WARN, "%s: CDSP SSR handled\n", __func__); } @@ -1023,6 +1024,7 @@ static int eva_fastrpc_driver_register(uint32_t handle) struct cvp_dsp_apps *me = &gfa_cv; int rc = 0; struct cvp_dsp_fastrpc_driver_entry *frpc_node = NULL; + bool skip_deregister = true; dprintk(CVP_DSP, "%s -> cvp_find_fastrpc_node_with_handle pid 0x%x\n", __func__, handle); @@ -1067,6 +1069,7 @@ static int eva_fastrpc_driver_register(uint32_t handle) if (rc) { dprintk(CVP_ERR, "%s fastrpc driver reg fail err %d\n", __func__, rc); + skip_deregister = true; goto fail_fastrpc_driver_register; } @@ -1076,7 +1079,8 @@ static int eva_fastrpc_driver_register(uint32_t handle) msecs_to_jiffies(CVP_DSP_RESPONSE_TIMEOUT))) { dprintk(CVP_ERR, "%s fastrpc driver_register timeout\n", __func__); - goto fail_fastrpc_driver_timeout; + skip_deregister = false; + goto fail_fastrpc_driver_register; } } else { dprintk(CVP_DSP, "%s fastrpc probe hndl %pK pid 0x%x\n", @@ -1085,14 +1089,15 @@ static int eva_fastrpc_driver_register(uint32_t handle) return rc; -fail_fastrpc_driver_timeout: - __fastrpc_driver_unregister(&frpc_node->cvp_fastrpc_driver); fail_fastrpc_driver_register: /* remove list if this is the last session */ mutex_lock(&me->fastrpc_driver_list.lock); list_del(&frpc_node->list); mutex_unlock(&me->fastrpc_driver_list.lock); + if (!skip_deregister) + __fastrpc_driver_unregister(&frpc_node->cvp_fastrpc_driver); + mutex_lock(&me->driver_name_lock); eva_fastrpc_driver_release_name(frpc_node); mutex_unlock(&me->driver_name_lock); diff --git a/msm/eva/msm_cvp_events.h b/msm/eva/msm_cvp_events.h index dbe3a2843a..aca1e87bfa 100644 --- a/msm/eva/msm_cvp_events.h +++ b/msm/eva/msm_cvp_events.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only * - * Copyright (c) 2020 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2020, The Linux Foundation. All rights reserved. */ #undef TRACE_SYSTEM diff --git a/msm/eva/msm_cvp_internal.h b/msm/eva/msm_cvp_internal.h index e4d3078cc5..05b1e47793 100644 --- a/msm/eva/msm_cvp_internal.h +++ b/msm/eva/msm_cvp_internal.h @@ -304,6 +304,7 @@ struct inst_snapshot { }; struct cvp_noc_log { + u32 used; u32 err_ctrl_swid_low; u32 err_ctrl_swid_high; u32 err_ctrl_mainctl_low; diff --git a/msm/eva/msm_cvp_platform.c b/msm/eva/msm_cvp_platform.c index 90c6520396..b7c106032e 100644 --- a/msm/eva/msm_cvp_platform.c +++ b/msm/eva/msm_cvp_platform.c @@ -58,7 +58,7 @@ static struct msm_cvp_common_data sm8450_common_data[] = { }, { .key = "qcom,domain-attr-non-fatal-faults", - .value = 0, + .value = 1, }, { .key = "qcom,max-secure-instances", diff --git a/msm/eva/msm_cvp_res_parse.c b/msm/eva/msm_cvp_res_parse.c index 3b3b7e9254..f3b797d6cb 100644 --- a/msm/eva/msm_cvp_res_parse.c +++ b/msm/eva/msm_cvp_res_parse.c @@ -11,6 +11,7 @@ #include "msm_cvp_debug.h" #include "msm_cvp_resources.h" #include "msm_cvp_res_parse.h" +#include "cvp_core_hfi.h" #include "soc/qcom/secure_buffer.h" enum clock_properties { @@ -954,6 +955,7 @@ int msm_cvp_smmu_fault_handler(struct iommu_domain *domain, struct device *dev, unsigned long iova, int flags, void *token) { struct msm_cvp_core *core = token; + struct iris_hfi_device *hdev; struct msm_cvp_inst *inst; bool log = false; @@ -974,6 +976,9 @@ int msm_cvp_smmu_fault_handler(struct iommu_domain *domain, list_for_each_entry(inst, &core->instances, list) { msm_cvp_print_inst_bufs(inst, log); } + hdev = core->device->hfi_device_data; + if (hdev) + hdev->error = CVP_ERR_NOC_ERROR; mutex_unlock(&core->lock); /* * Return -EINVAL to elicit the default behaviour of smmu driver.