Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3412385pxu; Mon, 30 Nov 2020 02:32:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJyZlBXRNK6GWDs9Isgawp3Kk/YeoyZ4vAG40LuRrS1CCcujUZBHeO4kejnfo6SIArX/+uC/ X-Received: by 2002:a17:906:4bc6:: with SMTP id x6mr20609328ejv.4.1606732340632; Mon, 30 Nov 2020 02:32:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606732340; cv=none; d=google.com; s=arc-20160816; b=jDZzBKbrKRYvyA6vXnIw5YX+LaNLYFXdRQ6CSBa7Y2lDmovNHkWy041HBLtli+ZkWN rUkPuA18RtY9XIRsJIxOqDdAiwn1UhUhrgyufmeq05R2ZOsPIhU9ZAHZ3RIk8RMOecwq eYZbB2kiBsnZXXt1b4qj8sAvZ/9TbZcGAcrraXjDyfFLeLtaMzawgT0/obemgNbBfXlT 4f1HY4BS3TInxpkPI2HW2pM1qjkqqqmPmSpXRd8rkrK8DWFBw5PTnCjfHyRppyFG0mIX ESIBOVEHhbR2GV4WTjf//adWKekTk1Leq/qnBF+t1qZDnlTsqxZdeDNtQkTqBFuk8lR7 Um9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=mojUcFaFWrmPvm6PQa/ffpB+mQE3ctox4g4XwFjgJQU=; b=DGOQpF2K2FAb+cZVy0pm/eI8qT5rbH+khQS8Z0FEtavS5+BMENFhsslC7c2miz/RiA J6I0JovYyEkBeBFbNfTGpwnXuTI7bXhO38wTEdbtVI95oY7EoStJNNx16AIYRTpMGvQE xsZZMVaeka/WEp3QU7+P7bIf/FdPg4hND8B2ftt0k7IXxuhtvV6HUrq8ZzxN5vNDCOcg /H1uUzSiTKaFLEh2tDZsgc8HydETRxs5kKswhKALPKSUmfnaXDJ6SrqEPZQPIYt4gf+T +E4HW4KCwtw4ILhOkJdAZ+liWKegQVrHox5F9ExurSJzlEfpIydd9ElIVrw9dmzUaoz3 SzzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Vi5Gi2uW; 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 q4si12428161eji.62.2020.11.30.02.31.58; Mon, 30 Nov 2020 02:32:20 -0800 (PST) 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=Vi5Gi2uW; 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 S1728527AbgK3K2L (ORCPT + 99 others); Mon, 30 Nov 2020 05:28:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728528AbgK3K2K (ORCPT ); Mon, 30 Nov 2020 05:28:10 -0500 Received: from mail-ej1-x644.google.com (mail-ej1-x644.google.com [IPv6:2a00:1450:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22032C0613D3 for ; Mon, 30 Nov 2020 02:27:30 -0800 (PST) Received: by mail-ej1-x644.google.com with SMTP id s13so5378947ejr.1 for ; Mon, 30 Nov 2020 02:27:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=mojUcFaFWrmPvm6PQa/ffpB+mQE3ctox4g4XwFjgJQU=; b=Vi5Gi2uW0ePyQwuhHVG6mPQ9oE3+Ttcbi2FUtWJjB9M4bdg9zYGKEMsGe+CbOplB3p 579/JECS5wOn/2XBn3w0JEw44fhdy7mAO+LHDTfyiycQ2M/nu1j1ux7vE7XwYY5fPu9L XwC3UF17fL0W0riQ8V5PBff4aW/rtjKgixQmCtQDwbuFk6+0tdiAh3z1ucLFsw++QTOn ZSkkZfhTYsHBt3a6QdRzEgBmOhHDZfSnrvUgu+tLGd4DP+Z5pQq2RYg9manUDscxNgrt BMUn/a9UEB62o4gr+qdZzuTV5WVtbyYmD+Kh1vYtTuytVH60WM3GsxpsGilzEV3kr/D3 gNtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=mojUcFaFWrmPvm6PQa/ffpB+mQE3ctox4g4XwFjgJQU=; b=tdslxDezPlDtfPX22MDAf0B3soOqCd3+kjVaDE6HkQqu3Crazj2CzwlApdnJ33bYCR pwk+6WjQOqx0KG0LXAnmoJoLzqL50fylFmShznt/dig1fbSx7gnOBiYURbzwTP2v99WC P1RF3TnAZUSbTYtAd/8SkYx6klpIsyx2+gWMN9sZsx/0ufqXvAr+WUYAe0yXvGZMoIUj yC2NqblPcx4VW85sGpRL2oRx8s9IftUFsJKf+rDPu8HXUa+9hSGEb0hRAus7a2aae92S 8cVFb6/7iwtzyE6Ti+kiD/FMP8tInraq2zmV+n41d6SxrPQFpmLBEJAECBkQJW4gdGYv BsDA== X-Gm-Message-State: AOAM53050Qvt/aQkGiGyzjJdXUTxLM08hggALKIuQ9/z3ldYpu/cUeQE rCVp2PLDwENE6f/j51aNXOHCSg== X-Received: by 2002:a17:906:6d52:: with SMTP id a18mr20155432ejt.224.1606732048726; Mon, 30 Nov 2020 02:27:28 -0800 (PST) Received: from [192.168.0.3] (hst-221-94.medicom.bg. [84.238.221.94]) by smtp.googlemail.com with ESMTPSA id v16sm2476312eds.64.2020.11.30.02.27.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 30 Nov 2020 02:27:28 -0800 (PST) Subject: Re: [PATCH] venus: core: add support to dump FW region To: Dikshita Agarwal , linux-media@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, vgarodia@codeaurora.org References: <1606714572-1113-1-git-send-email-dikshita@codeaurora.org> From: Stanimir Varbanov Message-ID: Date: Mon, 30 Nov 2020 12:27:27 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <1606714572-1113-1-git-send-email-dikshita@codeaurora.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/30/20 7:36 AM, Dikshita Agarwal wrote: > Add support to dump video FW region during FW crash > using devcoredump helpers. > > Signed-off-by: Dikshita Agarwal > --- > drivers/media/platform/qcom/venus/core.c | 47 ++++++++++++++++++++++++++++++++ > 1 file changed, 47 insertions(+) > > diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c > index 6103aaf..01a0cfe 100644 > --- a/drivers/media/platform/qcom/venus/core.c > +++ b/drivers/media/platform/qcom/venus/core.c > @@ -7,8 +7,10 @@ > #include > #include > #include > +#include > #include > #include > +#include > #include > #include > #include > @@ -22,6 +24,48 @@ > #include "firmware.h" > #include "pm_helpers.h" > > +static int subsystem_dump(struct venus_core *core) this function could return void because we don't handle the error in venus_sys_error_handler(). > +{ > + struct device_node *node; > + struct device *dev; > + struct resource r; > + void *mem_va; > + size_t mem_size; > + void *data; > + int ret; > + > + dev = core->dev; > + node = of_parse_phandle(dev->of_node, "memory-region", 0); > + if (!node) > + return -EINVAL; > + > + ret = of_address_to_resource(node, 0, &r); > + if (ret) > + goto err_put_node; > + > + mem_size = resource_size(&r); could you reuse the resource from venus_load_fw by adding r.sart and resource size in venus_core->fw{} structure. > + > + mem_va = memremap(r.start, mem_size, MEMREMAP_WC); > + if (!mem_va) { > + ret = -ENOMEM; > + goto err_put_node; > + } > + > + data = vmalloc(mem_size); > + if (!data) { > + ret = -EINVAL; > + goto err_unmap; > + } > + > + memcpy(data, mem_va, mem_size); > + > + dev_coredumpv(dev, data, mem_size, GFP_KERNEL); > +err_unmap: > + memunmap(mem_va); > +err_put_node: > + of_node_put(node); > + return ret; > +} > static void venus_event_notify(struct venus_core *core, u32 event) > { > struct venus_inst *inst; > @@ -67,6 +111,9 @@ static void venus_sys_error_handler(struct work_struct *work) > > venus_shutdown(core); > > + dev_warn(core->dev, "dumping FW region!\n"); this warn is not needed, please drop it. > + subsystem_dump(core); Are we sure that the dump is always required? > + > pm_runtime_put_sync(core->dev); > > while (core->pmdomains[0] && pm_runtime_active(core->pmdomains[0])) > -- regards, Stan