From patchwork Fri Jul 27 15:19:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sibi Sankar X-Patchwork-Id: 10547323 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 19A351822 for ; Fri, 27 Jul 2018 15:21:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 093372C071 for ; Fri, 27 Jul 2018 15:21:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 073622C04E; Fri, 27 Jul 2018 15:21:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8529D2C04E for ; Fri, 27 Jul 2018 15:21:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388708AbeG0Qnf (ORCPT ); Fri, 27 Jul 2018 12:43:35 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:53826 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732752AbeG0Qnf (ORCPT ); Fri, 27 Jul 2018 12:43:35 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 2CBE060481; Fri, 27 Jul 2018 15:21:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1532704872; bh=jUEUG1Zoe9hQ6lqR7Oo6DNpf4+svISBtdkV6AjUBcZw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EPVItMJW17kMoJmrEqJKtwE5Y5MUzCL4BySaWyIE6k6duZ8bhGQVvPJdh97CVnBeZ KYmwufgYQaFdDH1cr8PO8uZJ/KJXIDmG0mpXIOXjuVJrlfEOIK9dRRGxHRJRh//l/m yArW0HSZIcpGTOmcYI7Y4EufYA+7XmxtmANgp29I= Received: from blr-ubuntu-87.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.18.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: sibis@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 3A0FF60B15; Fri, 27 Jul 2018 15:21:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1532704871; bh=jUEUG1Zoe9hQ6lqR7Oo6DNpf4+svISBtdkV6AjUBcZw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xd6XU8J09MsWXsq/l0nc9aNrg6URyTek0f/FPpsBYEBJXRsifAW2uQ6aBvkAeTrXa h/zdXZqs+GiQ4GpCmf6NRmOFIvQEPbvekQd//h077/m0gjjT79mjg8mzAZ0i2Cp1tm uNPl2SP12Gf/TBeoIAd51oS7uimDKdvfFoR9SxPs= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 3A0FF60B15 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=sibis@codeaurora.org From: Sibi Sankar To: bjorn.andersson@linaro.org Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, ohad@wizery.com, kyan@codeaurora.org, sricharan@codeaurora.org, akdwived@codeaurora.org, linux-arm-msm@vger.kernel.org, tsoni@codeaurora.org, Sibi Sankar Subject: [PATCH v3 1/6] remoteproc: Introduce custom dump function for each remoteproc segment Date: Fri, 27 Jul 2018 20:49:58 +0530 Message-Id: <20180727152003.11663-2-sibis@codeaurora.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180727152003.11663-1-sibis@codeaurora.org> References: <20180727152003.11663-1-sibis@codeaurora.org> Sender: linux-remoteproc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Introduce custom dump function per remoteproc segment. It is responsible for filling the device memory segment associated with coredump Signed-off-by: Sibi Sankar --- drivers/remoteproc/remoteproc_core.c | 15 ++++++++++----- include/linux/remoteproc.h | 3 +++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 283b258f5e0f..ec56cd822b26 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -1183,13 +1183,18 @@ static void rproc_coredump(struct rproc *rproc) phdr->p_align = 0; ptr = rproc_da_to_va(rproc, segment->da, segment->size); - if (!ptr) { - dev_err(&rproc->dev, + + if (segment->dump) { + segment->dump(rproc, ptr, segment->size, data + offset); + } else { + if (!ptr) { + dev_err(&rproc->dev, "invalid coredump segment (%pad, %zu)\n", &segment->da, segment->size); - memset(data + offset, 0xff, segment->size); - } else { - memcpy(data + offset, ptr, segment->size); + memset(data + offset, 0xff, segment->size); + } else { + memcpy(data + offset, ptr, segment->size); + } } offset += phdr->p_filesz; diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h index e3c5d856b6da..0fbb01a9955c 100644 --- a/include/linux/remoteproc.h +++ b/include/linux/remoteproc.h @@ -399,6 +399,8 @@ enum rproc_crash_type { * @node: list node related to the rproc segment list * @da: device address of the segment * @size: size of the segment + * @dump: custom dump function to fill device memory segment associated + * with coredump */ struct rproc_dump_segment { struct list_head node; @@ -406,6 +408,7 @@ struct rproc_dump_segment { dma_addr_t da; size_t size; + void (*dump)(struct rproc *rproc, void *ptr, size_t len, void *priv); loff_t offset; };