Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp1863014ybg; Thu, 30 Jul 2020 04:50:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwU68igOgmZ1+3ykhxUQx+14LHCHKim3XBNE0/6WuqeKrhpcCSLagfL8BQaexQDV9GgYkKQ X-Received: by 2002:a50:d1d8:: with SMTP id i24mr2318528edg.341.1596109802662; Thu, 30 Jul 2020 04:50:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596109802; cv=none; d=google.com; s=arc-20160816; b=tao2Gg0vUrPhRY+LFoBWExW+asDVl3/6CBFw4DhnASoH50T25/XAfAst397buph6vl eJGCBCXThQfsx2wdM4gCOYovT/j5L8ZdYXCtrMy1jfJw3588J86pYidHbBC7iPrpv7WW zXafHanHpKJlQSyTg5Mu2tTMsaGMnZpzmnsYWXkZHcbdBr4js4pIzU9HIuTC16uZdJge yfvV0YkVYuxLOGnc+oBysJBZVzGZJ3QfbohxpEGGPmMIzUUh6bnz2Qr+LP5XHiqQ0PTW /uQ8Y1qRgpMtWegs/E/xQWd49FT8Nfju79UgapAf43VksFtK1D0R98NQ6gH/Q4k6o4G8 txaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=LWt2SD9BmU5MUG0bfq/HT/GSXil7yqUtBapdyAmDpx0=; b=hLHsYQUzzIF2tKRzJNDfWDcVfcqVPXU5Wr8bXRwflI58DlrMLEm37S04f3vpIVA8Kw uVgyeWjDiC8yBuuyqqnLIeQNR/yHBdTtNNIFonRJ4rKM0a2QYdzOfvR5TnvOaOvYgLwB OO1CpYyrnt1o0cKEF9yAsU+A/zuVJPut3e/yIWzOLCl/znLmL+unfnQP+XwBHiBV2/hS 3xHqmMXgobt/Bf84KUdKOi4MNe2O7cCUBejJGt424wB/pfwm1PAX5/5OmCGDZhUpJHSq LCDt+7pIVL11HaQ335mM3SmB4E6GliCl97nvJmf6pRohbFpEzlhupdMeH1HvAjZyYoKc K8aQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jBo2saLD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l14si2846918ejz.730.2020.07.30.04.49.40; Thu, 30 Jul 2020 04:50:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jBo2saLD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727977AbgG3LrY (ORCPT + 99 others); Thu, 30 Jul 2020 07:47:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727942AbgG3LrX (ORCPT ); Thu, 30 Jul 2020 07:47:23 -0400 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0FD9C0619D2 for ; Thu, 30 Jul 2020 04:47:21 -0700 (PDT) Received: by mail-wm1-x341.google.com with SMTP id 3so5928629wmi.1 for ; Thu, 30 Jul 2020 04:47:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=LWt2SD9BmU5MUG0bfq/HT/GSXil7yqUtBapdyAmDpx0=; b=jBo2saLDBGJvI+FbAVmxTQ+JCljGmhEYfNgRnHKXdJBPSecTUcAuY9msJm2ywtehtb nkdQboZilXVJ4otJI5uKQa1pW7H5YHoaZOArobwcODMa5sSDKkugrbZLg6CmCdVROBgt UfjLzh46Ppkm/6BlneR7KNbDuvLPSQuPfGW67cBlz1/742k28f+0UO37SRyDIYDBEpfL NRukNVkrDj31x7ABt2WEBxz7tK06VBPmyazflTiiSPDV/r0E3x4gcwFj/4vbTSKG7OYS xhKaSQKfwKeqD1QOc8Rc1l3f+dvKwtnQ3orlYje6puTR1/FJmU0rbXEsvaGqwBG4HeeI 3yDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=LWt2SD9BmU5MUG0bfq/HT/GSXil7yqUtBapdyAmDpx0=; b=i15iyTwlkdfxWCIJ0P4G9gFL0tr4tk6OTZAk5obbRRsPxZmocK2Dq3bp598QZ6nrGI wpnlyO9zaxn2z5j28+6flL3x6UFi1gx1nuIimgYTveIT8MXCuYUskHFfLvVk/5Ir/VBt RhAFG2SNG+tAY/4jK6yhbGyIGwNE2hoM1YlFKb82LCDQBaD1l/m3y6sCVEnUlLfdju++ RZdYK2DFYS/M7LiWLy88jfUGKY0cp6zIsK/XWUoSzPnQ+QgDifkbf0u9/28tZYYEH5JN AHTlpyppNUACPzxkQwsUgNJYTOGwgw6tnZxGjobI/RfeIHlKgfUUnI2XHwqeUAn3gANQ 5Brg== X-Gm-Message-State: AOAM532JThN+Qh+C4axw4tIN57wVTyHIWZdvLvJbA3olvmapbc//YGgH ra6KpcEMVLxo50ZFPeZ5h3pUXg== X-Received: by 2002:a7b:c0c8:: with SMTP id s8mr13525676wmh.4.1596109640545; Thu, 30 Jul 2020 04:47:20 -0700 (PDT) Received: from localhost.localdomain ([195.24.90.54]) by smtp.gmail.com with ESMTPSA id 32sm9636691wrn.86.2020.07.30.04.47.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Jul 2020 04:47:20 -0700 (PDT) From: Stanimir Varbanov To: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Stanimir Varbanov Subject: [PATCH 2/3] venus: Rework recovery mechanism Date: Thu, 30 Jul 2020 14:46:31 +0300 Message-Id: <20200730114632.6717-3-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200730114632.6717-1-stanimir.varbanov@linaro.org> References: <20200730114632.6717-1-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org After power domains and clock restructuring the recovery for sdm845 and v4 did not work properly. Fix that by reworking the recovery function and the sequence. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/core.c | 24 ++++++++++--------- drivers/media/platform/qcom/venus/hfi_venus.c | 11 --------- 2 files changed, 13 insertions(+), 22 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index 203c6538044f..46f6e34d435a 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -40,13 +41,7 @@ static void venus_event_notify(struct venus_core *core, u32 event) mutex_unlock(&core->lock); disable_irq_nosync(core->irq); - - /* - * Delay recovery to ensure venus has completed any pending cache - * operations. Without this sleep, we see device reset when firmware is - * unloaded after a system error. - */ - schedule_delayed_work(&core->work, msecs_to_jiffies(100)); + schedule_delayed_work(&core->work, msecs_to_jiffies(10)); } static const struct hfi_core_ops venus_core_ops = { @@ -59,23 +54,30 @@ static void venus_sys_error_handler(struct work_struct *work) container_of(work, struct venus_core, work.work); int ret = 0; - dev_warn(core->dev, "system error has occurred, starting recovery!\n"); - pm_runtime_get_sync(core->dev); hfi_core_deinit(core, true); - hfi_destroy(core); + + dev_warn(core->dev, "system error has occurred, starting recovery!\n"); + mutex_lock(&core->lock); + + while (pm_runtime_active(core->dev_dec) || pm_runtime_active(core->dev_enc)) + msleep(10); + venus_shutdown(core); pm_runtime_put_sync(core->dev); + while (core->pmdomains[0] && pm_runtime_active(core->pmdomains[0])) + usleep_range(1000, 1500); + + hfi_destroy(core); ret |= hfi_create(core, &venus_core_ops); pm_runtime_get_sync(core->dev); ret |= venus_boot(core); - ret |= hfi_core_resume(core, true); enable_irq(core->irq); diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c index 0d8855014ab3..3392fd177d22 100644 --- a/drivers/media/platform/qcom/venus/hfi_venus.c +++ b/drivers/media/platform/qcom/venus/hfi_venus.c @@ -986,13 +986,6 @@ static void venus_process_msg_sys_error(struct venus_hfi_device *hdev, venus_set_state(hdev, VENUS_STATE_DEINIT); - /* - * Once SYS_ERROR received from HW, it is safe to halt the AXI. - * With SYS_ERROR, Venus FW may have crashed and HW might be - * active and causing unnecessary transactions. Hence it is - * safe to stop all AXI transactions from venus subsystem. - */ - venus_halt_axi(hdev); venus_sfr_print(hdev); } @@ -1009,10 +1002,6 @@ static irqreturn_t venus_isr_thread(struct venus_core *core) res = hdev->core->res; pkt = hdev->pkt_buf; - if (hdev->irq_status & WRAPPER_INTR_STATUS_A2HWD_MASK) { - venus_sfr_print(hdev); - hfi_process_watchdog_timeout(core); - } while (!venus_iface_msgq_read(hdev, pkt)) { msg_ret = hfi_process_msg_packet(core, pkt); -- 2.17.1