Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1304780pxk; Thu, 10 Sep 2020 12:01:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCFTOeUCD0KB3bvgWvRLYrRCXhODvDkDahSTzoWVS6sQRRHdxzI/Max4EMReIfJ0qu+/Sw X-Received: by 2002:a17:906:fcc8:: with SMTP id qx8mr10093265ejb.13.1599764493698; Thu, 10 Sep 2020 12:01:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599764493; cv=none; d=google.com; s=arc-20160816; b=W0PdExShXQ6mvSCp0VRqspYD7Nz/iAysVmEKW8GR0qEUvTjAHIcAb7mK4BF7KKouSR leKagvciP8JPKdw7XmKAmPRMoj5ZGu3pCrU/QJ1ywgUgST41eukpFy9iVbOmO/RIMjJZ 8VMs+Es7yjUMm7rBuDA1E1TwPhMIoEukdfsl7Y3EaGAUtpHF27zP6gKzp6uVlawZmyi0 O0hU+wWDeDZuV4N/Tscse1Z+oveluNH2ljlHpRGRlYHUv+jR6K7XaQBQuKo0k86p4VL4 o165IubQc4z51khkXq2eFRLSyaA6hhzSttKjDHW4trU2p4s9VXCR5S+al5W8bQqJWpzD KQRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:feedback-id:references:in-reply-to :message-id:date:subject:cc:to:from:dmarc-filter:dkim-signature :dkim-signature; bh=CvVilst/SHz/SqYvLZdpkVT2xevwnnPP44GBufwfxYg=; b=rviJi4aXFSaldDRYS7rGT9h0S1Xx3MLPNdwZpIGM/Zq0TOhyOvAChmI+l+xaFThInA anKDxfsepmDaSqx9F65R5zOlGWbHbh4cc5ElPjGM/mOjloLD7SmC6iVyCdynenXqn/Cw ywJb9oTckxCZlfcsTK2VtCJwH3aPl0FERSblc6TixKh7banddiNXJfkJmQ+HdgPcEnhe d+IwMhF5MSX+0ZH1pKbVdR+XcCIMhy0XYbNHTQJsHJ6vknXtIhuO4g9/edcIO2jlc8sn xy+QfnuweM0TczwPAtQqzN6D0K+HUi1CEH590aAJdU+MGF8JleozXsyBHthpE6Ig/F5D fu2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=zsmsymrwgfyinv5wlfyidntwsjeeldzt header.b=LfyyfQnu; dkim=pass header.i=@amazonses.com header.s=hsbnp7p3ensaochzwyq5wwmceodymuwv header.b=bXymSkGI; 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 ay19si4200074ejb.626.2020.09.10.12.01.09; Thu, 10 Sep 2020 12:01:33 -0700 (PDT) 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=@codeaurora.org header.s=zsmsymrwgfyinv5wlfyidntwsjeeldzt header.b=LfyyfQnu; dkim=pass header.i=@amazonses.com header.s=hsbnp7p3ensaochzwyq5wwmceodymuwv header.b=bXymSkGI; 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 S1727902AbgIJS7k (ORCPT + 99 others); Thu, 10 Sep 2020 14:59:40 -0400 Received: from a27-56.smtp-out.us-west-2.amazonses.com ([54.240.27.56]:41770 "EHLO a27-56.smtp-out.us-west-2.amazonses.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727001AbgIJS5d (ORCPT ); Thu, 10 Sep 2020 14:57:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=zsmsymrwgfyinv5wlfyidntwsjeeldzt; d=codeaurora.org; t=1599764252; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; bh=k0CVrHNZHjKDxCYHpx5Zfcww4H7NJod+HjFj1v8y6r8=; b=LfyyfQnuFIAyxP7gHXj0OXuqKKVSnNDvMqrUZZcUu4ElfToyjRz0Nz4yw5tIs+M6 LUQlQbvzlKrnKpodLJ62qgvwS2aNiHYPUV17MWLNS6lW8GC7n6ZIO/ycCobv8Q9a+uw GPTlQVXGCkiEiRAi11VRzEHeWrMGQ0F5LVzY968A= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=hsbnp7p3ensaochzwyq5wwmceodymuwv; d=amazonses.com; t=1599764252; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:Feedback-ID; bh=k0CVrHNZHjKDxCYHpx5Zfcww4H7NJod+HjFj1v8y6r8=; b=bXymSkGIF+wm4rAj3Se6iSDc/hMAW2q60bWHbIKVjLrPYPVQMgESQAPDmYlDjCqr /+0zAhhG5li1sirjbPFmXXi/ulwKMVDmTnVNh9HF9ztln7B5P0iNftFkA7Z4fdAizDZ ldQN0/8eqh7sqZe5Fl0sfqHKMZmkCyKwL1xuMusA= 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 DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org AF9B2C433F0 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 Cc: Siddharth Gupta , linux-remoteproc@vger.kernel.org, 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, Gurbir Arora Subject: [PATCH v4 1/3] remoteproc: core: Add ops to enable custom coredump functionality Date: Thu, 10 Sep 2020 18:57:32 +0000 Message-ID: <01010174796146c8-35d082e7-e9ee-460f-af9e-4e8016b15f6c-000000@us-west-2.amazonses.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1599764242-690-1-git-send-email-sidgup@codeaurora.org> References: <1599764242-690-1-git-send-email-sidgup@codeaurora.org> X-SES-Outgoing: 2020.09.10-54.240.27.56 Feedback-ID: 1.us-west-2.CZuq2qbDmUIuT3qdvXlRHZZCpfZqZ4GtG9v3VKgRyF0=:AmazonSES Sender: linux-kernel-owner@vger.kernel.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.The priv_cleanup op cleans up the private resources used by the remoteproc. Signed-off-by: Rishabh Bhatnagar Signed-off-by: Gurbir Arora Signed-off-by: Siddharth Gupta --- drivers/remoteproc/remoteproc_core.c | 6 +++++- include/linux/remoteproc.h | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 7f90eee..dcc1341 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -1681,7 +1681,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); @@ -2103,6 +2103,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 2fa68bf..a489aec 100644 --- a/include/linux/remoteproc.h +++ b/include/linux/remoteproc.h @@ -375,6 +375,8 @@ 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 + * @priv_cleanup: cleans up the private resources used by the rproc */ struct rproc_ops { int (*prepare)(struct rproc *rproc); @@ -393,6 +395,8 @@ 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); + void (*priv_cleanup)(struct rproc *rproc); }; /** -- Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project