Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp409324pxu; Thu, 3 Dec 2020 03:27:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJzGuYNM9d3paleR2VW//MMmiBU2YI2DWyW11lugnais/70Opohbw9Ti0kM8pMSJNQqwkQ/8 X-Received: by 2002:a17:906:71d3:: with SMTP id i19mr2046162ejk.187.1606994851957; Thu, 03 Dec 2020 03:27:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606994851; cv=none; d=google.com; s=arc-20160816; b=u0c0LCON8YZ2DNZMhjWfjFiQtdbBO/X4hEpaK63/BqgNxy537T60B816iANUCJS1RK WjLJbFKTizafKj9BJWjviMBTmlfEKe/jP1H7Bm1oapk+ompRsUROwyERMIElZYR/kavK 2acnU40UVhRAlIALZbsEfPgP6IH6w7Ovr5XajnIRx2J6jR30MILNwahE9/dQl9atYn4+ iRSZk+0Jc5eVJj2Y447fWQhqUH3X2f+bMbYCgE4J77LMg9Eqknq91d2NnLbvAuDZXhSd jmhRNT0oaDe8YUpDDHoXz71rCV6ED2pCxrqCUUfmw4MpBi6BpsDuoGkR4uI7XWZDiES8 fkoQ== 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=N1mHAJGMa+utqda+wDZrppx4vW0XFBnMfFuMCeP3iUk=; b=tt3uuPJ7zNgPfl2QtAlJlTxo8PohOeOZZYaLUbv7QCXFoZyQPB/9kr8ulMRf0Jb8f7 ViKNKhJWGpeJblNuu97C7tqIo8B8vdaX5Gu6sV1AVKguQlGkIyIJAJgjMjuljhMl83fh 1+g5+6cna7FEmaAmfw0N4ifnW+6OG7qRAmMcsv87BFvAoAGwp0hNfELz5wr56rT7D/Bh SKc5I8ZvEOcuC59Z491Q8kb2Kg2VQhv/MvBrPFU6n2dkqx8NIPktUM/pWBeKyP3MxNNc y9Zn6ENH/T07k4bd+TsvPOzLpCLy0VzJ0V1bXLkUKMkuLW8GdL0wvauce6q6bGv0ZbLL wGrA== 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 rn17si1024368ejb.292.2020.12.03.03.27.07; Thu, 03 Dec 2020 03:27:31 -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 S1729162AbgLCLYy (ORCPT + 99 others); Thu, 3 Dec 2020 06:24:54 -0500 Received: from alexa-out.qualcomm.com ([129.46.98.28]:52866 "EHLO alexa-out.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727757AbgLCLYx (ORCPT ); Thu, 3 Dec 2020 06:24:53 -0500 Received: from ironmsg-lv-alpha.qualcomm.com ([10.47.202.13]) by alexa-out.qualcomm.com with ESMTP; 03 Dec 2020 03:24:13 -0800 X-QCInternal: smtphost Received: from ironmsg02-blr.qualcomm.com ([10.86.208.131]) by ironmsg-lv-alpha.qualcomm.com with ESMTP/TLS/AES256-SHA; 03 Dec 2020 03:24:10 -0800 X-QCInternal: smtphost Received: from c-mansur-linux.qualcomm.com ([10.204.90.208]) by ironmsg02-blr.qualcomm.com with ESMTP; 03 Dec 2020 16:53:57 +0530 Received: by c-mansur-linux.qualcomm.com (Postfix, from userid 461723) id 044D81FE2C; Thu, 3 Dec 2020 16:53:55 +0530 (IST) From: dikshita@codeaurora.org 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 v2] venus: core: add support to dump FW region Date: Thu, 3 Dec 2020 16:53:36 +0530 Message-Id: <1606994616-3592-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 From: Dikshita Agarwal Add support to dump video FW region during FW crash using devcoredump helpers. Signed-off-by: Dikshita Agarwal Change-Id: Ic055579b99ffd10fe5c346f95c33aac6a97b21f2 --- drivers/media/platform/qcom/venus/core.c | 30 ++++++++++++++++++++++++++++ drivers/media/platform/qcom/venus/core.h | 2 ++ drivers/media/platform/qcom/venus/firmware.c | 3 +++ 3 files changed, 35 insertions(+) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index 5102403..dd8d35a 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,32 @@ #include "firmware.h" #include "pm_helpers.h" +static void subsystem_dump(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) + goto err_unmap; + + memcpy(data, mem_va, mem_size); + dev_coredumpv(dev, data, mem_size, GFP_KERNEL); +err_unmap: + memunmap(mem_va); +} + static void venus_event_notify(struct venus_core *core, u32 event) { struct venus_inst *inst; @@ -67,6 +95,8 @@ static void venus_sys_error_handler(struct work_struct *work) venus_shutdown(core); + subsystem_dump(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 842a294..8122f23 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -171,6 +171,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 9a9c097..f3d91d23 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 -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation