Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp761538pxb; Thu, 19 Nov 2020 13:10:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJyHIZnKpcMt3tOGqU0r57sLlAouNHmXPQbJDudiiDYk8lQ/ERIFYNNhRUxQT6jxp/rIRvhL X-Received: by 2002:aa7:d717:: with SMTP id t23mr31850064edq.286.1605820229516; Thu, 19 Nov 2020 13:10:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605820229; cv=none; d=google.com; s=arc-20160816; b=vWNz1ca+9FWrlLngFDVdBrFaOh3W4HnTMbnARYhG0dl/j/07/MjldlXSD1cvDUOMQ9 cdDLUGg+wB/8J2sazIyh24G7TZHUOp6NM4K4xQaYOFUn/P6VCsbJtAq1yV0VZZcEJ7wn mqvCY2YW1yGPH5tqs1/OInFQUlKOEP8OCllMHhkUZlKu7NxG4q/w052FD0qZCgjnAKFs bKb1y44NnUMEXkawNanbGj8IOVo0JeNPjNksqUcwCW/Hbs4Yd3fzM6UMJgRtj3QBfZE1 CJcd/y+u+nT/qKJqhJO2+FypviAtfYEqiiIgt32OiaJnrRjOwewrAksaVUFnF1aEiXW4 KBjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dmarc-filter:sender:dkim-signature; bh=wip3SqxPDZ8IG7Sc4+GAbXTApb3DFMxp79tDHTBbQ88=; b=Hqai2Rbtp1BNe0bHlJFd57TXmNcdYd2sZsf/sVQjTk3XuicWTZnw6G8iS2517WdMFB xAD3yfsE5Pa7S+Docgq3uyxpUT7LD+b3qIN4akZ4VehCq+hHd5XxrPpNbuU+SPjZ2Y3s VtBAKMvkPGZIjUCdYI3nIN6PfCqfFcfG858Oe0ewDoc3vB+eeHJwYxXqN5KvF/0z+JKN C/N/9wlukn7z2zRPx0a8v6UoZJBf4YioLwhrd2I2zpUU23wLhVKtwqOKrfGNgKEPMCvi 0/XYFD+bmIQ7RVD6pOfSkAIFyrHLGiqtu3PptFgRy5WRFeSV9ijpBb9LQp4iNesb/7Qi /6mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b="N/N/9quX"; 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 hd41si512730ejc.168.2020.11.19.13.10.06; Thu, 19 Nov 2020 13:10:29 -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=@mg.codeaurora.org header.s=smtp header.b="N/N/9quX"; 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 S1726444AbgKSVF4 (ORCPT + 99 others); Thu, 19 Nov 2020 16:05:56 -0500 Received: from z5.mailgun.us ([104.130.96.5]:55362 "EHLO z5.mailgun.us" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726355AbgKSVFz (ORCPT ); Thu, 19 Nov 2020 16:05:55 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1605819955; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=wip3SqxPDZ8IG7Sc4+GAbXTApb3DFMxp79tDHTBbQ88=; b=N/N/9quXdPcbfHU5scRKp0BUDgihHy+MLgLhxcXvJSKE0AzGBEVOJjGQ1l1p3Li9r0XB/ejm UGuQtsOHCqiE3IYlSzP/6xNb8upgbPvlGtfG70P76/XjcJFdAgHjU3iMvE69aiR9q7UGoyEv BAtWygDw6hcwFPtiIVDa5MI6aR4= X-Mailgun-Sending-Ip: 104.130.96.5 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n06.prod.us-east-1.postgun.com with SMTP id 5fb6de32b9b39088ed0e5e5d (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Thu, 19 Nov 2020 21:05:54 GMT Sender: sidgup=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 47133C43467; Thu, 19 Nov 2020 21:05:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00,SPF_FAIL, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from sidgup-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: sidgup) by smtp.codeaurora.org (Postfix) with ESMTPSA id CA1DFC43460; Thu, 19 Nov 2020 21:05:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org CA1DFC43460 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=sidgup@codeaurora.org From: Siddharth Gupta To: agross@kernel.org, bjorn.andersson@linaro.org, ohad@wizery.com, linux-remoteproc@vger.kernel.org Cc: Siddharth Gupta , linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, tsoni@codeaurora.org, psodagud@codeaurora.org, rishabhb@codeaurora.org, linux-doc@vger.kernel.org Subject: [PATCH v8 1/4] remoteproc: core: Add ops to enable custom coredump functionality Date: Thu, 19 Nov 2020 13:05:32 -0800 Message-Id: <1605819935-10726-2-git-send-email-sidgup@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1605819935-10726-1-git-send-email-sidgup@codeaurora.org> References: <1605819935-10726-1-git-send-email-sidgup@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Each remoteproc might have different requirements for coredumps and might want to choose the type of dumps it wants to collect. This change allows remoteproc drivers to specify their own custom dump function to be executed in place of rproc_coredump. If the coredump op is not specified by the remoteproc driver it will be set to rproc_coredump by default. Signed-off-by: Siddharth Gupta --- drivers/remoteproc/remoteproc_core.c | 6 +++++- include/linux/remoteproc.h | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index dab2c0f..eba7543 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -1704,7 +1704,7 @@ int rproc_trigger_recovery(struct rproc *rproc) goto unlock_mutex; /* generate coredump */ - rproc_coredump(rproc); + rproc->ops->coredump(rproc); /* load firmware */ ret = request_firmware(&firmware_p, rproc->firmware, dev); @@ -2126,6 +2126,10 @@ static int rproc_alloc_ops(struct rproc *rproc, const struct rproc_ops *ops) if (!rproc->ops) return -ENOMEM; + /* Default to rproc_coredump if no coredump function is specified */ + if (!rproc->ops->coredump) + rproc->ops->coredump = rproc_coredump; + if (rproc->ops->load) return 0; diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h index 3fa3ba6..a419878 100644 --- a/include/linux/remoteproc.h +++ b/include/linux/remoteproc.h @@ -375,6 +375,7 @@ enum rsc_handling_status { * @get_boot_addr: get boot address to entry point specified in firmware * @panic: optional callback to react to system panic, core will delay * panic at least the returned number of milliseconds + * @coredump: collect firmware dump after the subsystem is shutdown */ struct rproc_ops { int (*prepare)(struct rproc *rproc); @@ -393,6 +394,7 @@ struct rproc_ops { int (*sanity_check)(struct rproc *rproc, const struct firmware *fw); u64 (*get_boot_addr)(struct rproc *rproc, const struct firmware *fw); unsigned long (*panic)(struct rproc *rproc); + void (*coredump)(struct rproc *rproc); }; /** -- Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project