Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp287080pxu; Wed, 2 Dec 2020 23:22:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJyg05Muno/76MEG31l48AORV40GbL7DcA8MK7nN9zrsw4DN+/Be2gdopRROx6Q0tFbM7KN9 X-Received: by 2002:a50:e786:: with SMTP id b6mr1573652edn.242.1606980145170; Wed, 02 Dec 2020 23:22:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606980145; cv=none; d=google.com; s=arc-20160816; b=oZmpKlobKsrSzNbd14qC58juy7d9b7yxSGw+S/NL0kgAmb7WBS3erqfJgiRJYmvuiw EIKA22bPmSMcyaIntQJIaLGiZrR2dByHmglmf9PYKwZfOvfgXfGSG8Txm9yaLWAU/GtV y4CSJT4NTGvD7AS7Lz7p49UuuR4toHhUNqLOGO/WM3kYGDqsm4H2m8PQ06FDNqfrlLvF iA3cya18va4E9qpA+jNuWBVl891IM8v+LmYN1dvfcRx+k0zGZA99g0j7Dg9c4XTTCv95 CFP/NDUe86uVgVD2Z+Nx5i80lf50QVV2ebXer2y+JE09sFjnrKJlowgpmmBSmAh6mDDG NxBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:message-id:date:to:cc:from:subject :references:in-reply-to:content-transfer-encoding:mime-version :dkim-signature; bh=XboQBpa5SksH1iZ7g9IuRzqF6Oz1AM+DEQhjumRKkpU=; b=x+ADXDwUR7C2Rmio5bF42YoVxXBbUSsYhFlPux8bjq/G31U0q4EevxK/wkO2ayDDps ClCaSQ/fbl1pMaLxkEyHIz3MSWb6fbJdhSC2WXVFR6HHFpGs8qya/ptSTdaRKyf9G3Ds KF3PDpHHeNuOGF62t1aWBwuYodPF6FM8WBFT3V3tUeowmxsWA7YlgcNulEyPH9eIv1En GJeVAw4pTJqaCZVA9QtYAtv9QgHwKHKcc1aCbaDWut1zJFLq1DmpaJzdt936gmrEExMc 8aI03w+RANV0+WOsc7wtRY9dAKb8CzaVFPGI/ujEFC1PVwUEq5kNS8TwieaneQmJZe7g qV8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=gJeZZTf1; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bf26si432524edb.120.2020.12.02.23.22.01; Wed, 02 Dec 2020 23:22:25 -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=@chromium.org header.s=google header.b=gJeZZTf1; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387551AbgLCHTU (ORCPT + 99 others); Thu, 3 Dec 2020 02:19:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388002AbgLCHTT (ORCPT ); Thu, 3 Dec 2020 02:19:19 -0500 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84A9DC061A54 for ; Wed, 2 Dec 2020 23:18:28 -0800 (PST) Received: by mail-pl1-x643.google.com with SMTP id s2so634100plr.9 for ; Wed, 02 Dec 2020 23:18:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:content-transfer-encoding:in-reply-to:references :subject:from:cc:to:date:message-id:user-agent; bh=XboQBpa5SksH1iZ7g9IuRzqF6Oz1AM+DEQhjumRKkpU=; b=gJeZZTf1TU9E/PphFzlCR3PhtxCTKrw85fe2boTXN2UfZUD5faSjo2MsqUodQrLjH5 zauS9CHw8F/p/nJKZEvy0o1GIbK1HBYkurUupjJCdn9Cdpw+zahjLVz7bvpPpXQVGqCq +2KSkItg1JS0p2JCKMMdOrtIGd689aHsdj0H4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:content-transfer-encoding :in-reply-to:references:subject:from:cc:to:date:message-id :user-agent; bh=XboQBpa5SksH1iZ7g9IuRzqF6Oz1AM+DEQhjumRKkpU=; b=gUXIJvKcd/iC/Tgklxhd+lIKco8i9pMLbMLR1bRBTryf9Ul7+mpFM72K4Dk3nw6DcI p0S5RuhGJxavr3hDTIw/xHeGOPovH/M4ergusT7MvbYugjbJNEZt4YPwcP8Ng5H/mDii iLVXalYi8xKjhuN5xXzlaeKtMZ+fH0hLVHDTcxFDXAf2LXr3TO7Pi6XneRSSMiETAezq l8Y0wn5YLruEcxiT52wcJYyqFNQXFA5sgdLgOsA2mWFinJNesJvnNZT7f5ROfjhMfjBZ BYJXq9cvKoQ+W0tW+DkefxwSbFO6ZGZEeQAZVpEvMw4IXteLIju9TnJYedqTnei8poIl exsA== X-Gm-Message-State: AOAM5312grl31EoBJsu5st3pSF6qmswyJQPQBLR7LiWoJzmE8UQly6TL skFmLG9/eDfNPl8Yy6R/T2eO/lf7Mn79Cw== X-Received: by 2002:a17:90b:204d:: with SMTP id ji13mr1917017pjb.20.1606979907857; Wed, 02 Dec 2020 23:18:27 -0800 (PST) Received: from chromium.org ([2620:15c:202:201:3e52:82ff:fe6c:83ab]) by smtp.gmail.com with ESMTPSA id y21sm745604pfr.90.2020.12.02.23.18.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2020 23:18:27 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <1606714572-1113-1-git-send-email-dikshita@codeaurora.org> References: <1606714572-1113-1-git-send-email-dikshita@codeaurora.org> Subject: Re: [PATCH] venus: core: add support to dump FW region From: Stephen Boyd Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, vgarodia@codeaurora.org, Dikshita Agarwal To: Dikshita Agarwal , linux-media@vger.kernel.org, stanimir.varbanov@linaro.org Date: Wed, 02 Dec 2020 23:18:25 -0800 Message-ID: <160697990547.2717324.13284456705336253152@swboyd.mtv.corp.google.com> User-Agent: alot/0.9.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Dikshita Agarwal (2020-11-29 21:36:12) > diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/pla= tform/qcom/venus/core.c > index 6103aaf..01a0cfe 100644 > --- a/drivers/media/platform/qcom/venus/core.c > +++ b/drivers/media/platform/qcom/venus/core.c > @@ -22,6 +24,48 @@ > #include "firmware.h" > #include "pm_helpers.h" > =20 > +static int subsystem_dump(struct venus_core *core) > +{ > + struct device_node *node; > + struct device *dev; > + struct resource r; > + void *mem_va; > + size_t mem_size; > + void *data; > + int ret; > + > + dev =3D core->dev; > + node =3D of_parse_phandle(dev->of_node, "memory-region", 0); Any chance this could be done at probe time and saved away as some sort of pointer? > + if (!node) > + return -EINVAL; > + > + ret =3D of_address_to_resource(node, 0, &r); of_node_put(node); > + if (ret) > + goto err_put_node; And then just return ret; > + > + mem_size =3D resource_size(&r); > + > + mem_va =3D memremap(r.start, mem_size, MEMREMAP_WC); > + if (!mem_va) { > + ret =3D -ENOMEM; > + goto err_put_node; And return -ENOMEM; > + } > + > + data =3D vmalloc(mem_size); > + if (!data) { > + ret =3D -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) > =20 > venus_shutdown(core); > =20 > + dev_warn(core->dev, "dumping FW region!\n"); Do we need this warning? > + subsystem_dump(core); Maybe call it venus_do_coredump() so it isn't so generic. > + > pm_runtime_put_sync(core->dev); > =20 > while (core->pmdomains[0] && pm_runtime_active(core->pmdomains[0]= ))