Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2613651pxu; Mon, 14 Dec 2020 06:54:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJx1+SpyXR7WqZD+yPoV9nd6TYjGgtCpLpGYAQX74UA2AHIrxNpPcEJ5y+4YVUwqeCUmlDaV X-Received: by 2002:a17:906:d9c7:: with SMTP id qk7mr3898609ejb.384.1607957693868; Mon, 14 Dec 2020 06:54:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607957693; cv=none; d=google.com; s=arc-20160816; b=p8PyQOfe3l8yTbvB1Z3PKvDO7s1PQdJ2JaZENPPiNpH+f+Xx8jSRHdl8oVheSI9eZf wf2TTwV590wuXfPbyAdO6DIO/QKjJ5Q4PSLwYeZ0mBwVoKOGFUZZQeOe8+swzDXtSYfJ c9l9L5ETcKwcUNL/GLLfFQEj5aqLUTUAv1b06rYeQXbE36gz/GR2j71TzrwWWbkvq8Yh fnZAJu+adXoxShi2WvTkaZdG1/3V5V7uymKLAUaCVQy+TaF4UTM0UIVsJ6qBSowIKeKX cXjT8IE0EtXKsA+3225e2JzJX3UiR6IEtq+VK73WgWR0/xdJuZo5Q9IZRVTIl0x9KQ25 eKqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=3ex2j8h07Mx1VgryjNPuPg9BdQLuc2MLXkicfYRyKh0=; b=khikS/5bY+A2q4HaISzPQM0fKwg7KPQngnKNuqlMiluFHcZVJUn4sPym2NcURX3GWm ZatND5TuwpsdojejLDRAN+uwUp0ZSkhK4MdC7zSWawvvdQlqOXIsOslEypR67Jk/cFps XDnptSoY8ZV6bKL0Hl3RqIZut+vKqXQEi72vU+A89IbzArS4aQ6tpJ9mr7iN0qhhyC0u +a1EHL5pIOLuZlZEZZKvdZFOznVXmMabd1UfMUuWAWFAHqodSxQ6D+ivtzwCbPBrP7Aa +Gy1TM822snqkaAVIxTUOzk1/7Urg2wrguixnlq8LAk54y6gJTED4JkWn+22J0jqZ0M4 g+Lw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f20si11541955edy.12.2020.12.14.06.54.30; Mon, 14 Dec 2020 06:54:53 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407578AbgLNNFE (ORCPT + 99 others); Mon, 14 Dec 2020 08:05:04 -0500 Received: from alexa-out.qualcomm.com ([129.46.98.28]:53731 "EHLO alexa-out.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404621AbgLNNFE (ORCPT ); Mon, 14 Dec 2020 08:05:04 -0500 Received: from ironmsg07-lv.qualcomm.com (HELO ironmsg07-lv.qulacomm.com) ([10.47.202.151]) by alexa-out.qualcomm.com with ESMTP; 14 Dec 2020 05:04:23 -0800 X-QCInternal: smtphost Received: from ironmsg01-blr.qualcomm.com ([10.86.208.130]) by ironmsg07-lv.qulacomm.com with ESMTP/TLS/AES256-SHA; 14 Dec 2020 05:04:21 -0800 X-QCInternal: smtphost Received: from dikshita-linux.qualcomm.com ([10.204.65.237]) by ironmsg01-blr.qualcomm.com with ESMTP; 14 Dec 2020 18:34:07 +0530 Received: by dikshita-linux.qualcomm.com (Postfix, from userid 347544) id 99FA4212FF; Mon, 14 Dec 2020 18:34:06 +0530 (IST) From: Dikshita Agarwal To: linux-media@vger.kernel.org, stanimir.varbanov@linaro.org Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, vgarodia@codeaurora.org, Dikshita Agarwal Subject: [PATCH v4] venus: core: add support to dump FW region Date: Mon, 14 Dec 2020 18:33:51 +0530 Message-Id: <1607951031-12980-1-git-send-email-dikshita@codeaurora.org> X-Mailer: git-send-email 2.7.4 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add support to dump video FW region during FW crash using devcoredump helpers. Major changes since v1: - update the name of function (Stephen) - store start address and size in resource structure during probe and reuse while dumping (Stephen, Stanimir) Signed-off-by: Dikshita Agarwal Reviewed-by: Stephen Boyd --- drivers/media/platform/qcom/venus/core.c | 31 ++++++++++++++++++++++++++++ drivers/media/platform/qcom/venus/core.h | 2 ++ drivers/media/platform/qcom/venus/firmware.c | 3 +++ 3 files changed, 36 insertions(+) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index bdd293f..2ddbd36 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,33 @@ #include "firmware.h" #include "pm_helpers.h" +static void venus_coredump(struct venus_core *core) +{ + struct device *dev; + phys_addr_t mem_phys; + size_t mem_size; + void *mem_va; + void *data; + + dev = core->dev; + mem_phys = core->fw.mem_phys; + mem_size = core->fw.mem_size; + + mem_va = memremap(mem_phys, mem_size, MEMREMAP_WC); + if (!mem_va) + return; + + data = vmalloc(mem_size); + if (!data) { + memunmap(mem_va); + return; + } + + memcpy(data, mem_va, mem_size); + memunmap(mem_va); + dev_coredumpv(dev, data, mem_size, GFP_KERNEL); +} + static void venus_event_notify(struct venus_core *core, u32 event) { struct venus_inst *inst; @@ -67,6 +96,8 @@ static void venus_sys_error_handler(struct work_struct *work) venus_shutdown(core); + venus_coredump(core); + pm_runtime_put_sync(core->dev); while (core->pmdomains[0] && pm_runtime_active(core->pmdomains[0])) diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index 3a477fc..b37de95 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -178,6 +178,8 @@ struct venus_core { struct device *dev; struct iommu_domain *iommu_domain; size_t mapped_mem_size; + phys_addr_t mem_phys; + size_t mem_size; } fw; struct mutex lock; struct list_head instances; diff --git a/drivers/media/platform/qcom/venus/firmware.c b/drivers/media/platform/qcom/venus/firmware.c index d03e2dd..89defc2 100644 --- a/drivers/media/platform/qcom/venus/firmware.c +++ b/drivers/media/platform/qcom/venus/firmware.c @@ -201,6 +201,9 @@ int venus_boot(struct venus_core *core) return -EINVAL; } + core->fw.mem_size = mem_size; + core->fw.mem_phys = mem_phys; + if (core->use_tz) ret = qcom_scm_pas_auth_and_reset(VENUS_PAS_ID); else -- 2.7.4