From patchwork Wed Oct 17 13:55:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sibi Sankar X-Patchwork-Id: 10645669 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 7703215E2 for ; Wed, 17 Oct 2018 13:56:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 64D3B2AE9A for ; Wed, 17 Oct 2018 13:56:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 58FB52AEAB; Wed, 17 Oct 2018 13:56:13 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 F29DB2AE9A for ; Wed, 17 Oct 2018 13:56:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727567AbeJQVv6 (ORCPT ); Wed, 17 Oct 2018 17:51:58 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:44438 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727013AbeJQVv5 (ORCPT ); Wed, 17 Oct 2018 17:51:57 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id AC7586132F; Wed, 17 Oct 2018 13:56:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1539784567; bh=04y2TahKeW7N1261nI48AyV+3lS5X15YaOUQyCHohC0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DlXaLHqh/k0zJxxdxayV07Yw47igGXfDSXRS5HzfVlgeTdlSp5icZHrJAJA3cfWGM DnvJujxBhOAypI92hiyurodS9yVOJJue6FNSUMK4iYAqhKRzFeSsvHVDqzgihH+sNC KHguRAtPdvKakyvQpto6Qws+k4vOAJTRJ6hWZ4uM= 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 634A26130F; Wed, 17 Oct 2018 13:56:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1539784566; bh=04y2TahKeW7N1261nI48AyV+3lS5X15YaOUQyCHohC0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MmP2j8pdS+k4/lXflBhq7260k1PvCPFvs4X9LFUveNQN1EMdKks7zdMpHHbg/rAjO Fmr+kyEWkLGJlOt14ThOnJcV2yYQZX4zESDgCDYxSByYYJk+9sDmg4+/jjjcifzkay 2yHMigCQMayEo73HXFtIuBVZWSYTFUjGuPKNv3No= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 634A26130F 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, ohad@wizery.com Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, tsoni@codeaurora.org, sricharan@codeaurora.org, akdwived@codeaurora.org, kyan@codeaurora.org, Sibi Sankar Subject: [PATCH v5 4/5] remoteproc: qcom: q6v5-mss: Add custom dump function for modem Date: Wed, 17 Oct 2018 19:25:26 +0530 Message-Id: <20181017135527.30592-5-sibis@codeaurora.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181017135527.30592-1-sibis@codeaurora.org> References: <20181017135527.30592-1-sibis@codeaurora.org> MIME-Version: 1.0 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 The per segment dump function is responsible for loading the mba before device memory segments associated with coredump can be populated and for cleaning up the resources post coredump. Signed-off-by: Sibi Sankar --- drivers/remoteproc/qcom_q6v5_mss.c | 33 ++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/drivers/remoteproc/qcom_q6v5_mss.c b/drivers/remoteproc/qcom_q6v5_mss.c index 87d7f4d0c176..0d3b9d70823e 100644 --- a/drivers/remoteproc/qcom_q6v5_mss.c +++ b/drivers/remoteproc/qcom_q6v5_mss.c @@ -168,6 +168,9 @@ struct q6v5 { bool running; bool dump_mba_loaded; + unsigned long dump_segment_mask; + unsigned long dump_complete_mask; + phys_addr_t mba_phys; void *mba_region; size_t mba_size; @@ -961,6 +964,33 @@ static int q6v5_mpss_load(struct q6v5 *qproc) return ret < 0 ? ret : 0; } +static void qcom_q6v5_dump_segment(struct rproc *rproc, + struct rproc_dump_segment *segment, + void *dest) +{ + int ret = 0; + struct q6v5 *qproc = rproc->priv; + unsigned long mask = BIT((unsigned long)segment->priv); + void *ptr = rproc_da_to_va(rproc, segment->da, segment->size); + + /* Unlock mba before copying segments */ + if (!qproc->dump_mba_loaded) + ret = q6v5_mba_load(qproc); + + if (!ptr || ret) + memset(dest, 0xff, segment->size); + else + memcpy(dest, ptr, segment->size); + + qproc->dump_segment_mask |= mask; + + /* Reclaim mba after copying segments */ + if (qproc->dump_segment_mask == qproc->dump_complete_mask) { + if (qproc->dump_mba_loaded) + q6v5_mba_reclaim(qproc); + } +} + static int q6v5_start(struct rproc *rproc) { struct q6v5 *qproc = (struct q6v5 *)rproc->priv; @@ -989,6 +1019,9 @@ static int q6v5_start(struct rproc *rproc) if (xfermemop_ret) dev_err(qproc->dev, "Failed to reclaim mba buffer system may become unstable\n"); + + /* Reset Dump Segment Mask */ + qproc->dump_segment_mask = 0; qproc->running = true; return 0;