From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC767C11D00 for ; Thu, 20 Feb 2020 02:12:30 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A50DD24670 for ; Thu, 20 Feb 2020 02:12:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ismpZX5/"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.b="LECZGoy6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A50DD24670 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=D7iD57liagH8BB9TRE9BpGWCDYSI6k/+UCdA/s//w0k=; b=ismpZX5/Zw2gpBINNsyUy6ek43 oNtOCiLt11Hb2n/I97435rSYmigZq62lRSrNnb8V7Mtyu7++VVlLBkXqUm9eRL+lqgqYShCAbsn5b O1gI2kIdKwZckMIdxuWKKQG38hDSugpH4Q99vg2xFmFqIHWa1ELF9DYcuoq0V03dlcOkZ37kKvlBO E78ub1ug47JlkDyIXk4UCLj1FgmuIagH0lLwPrvvBIMEPjahnfts4QDrv5i57xYm5GhDuNKL5knoi VzZXKaJi+vyIl+HOWkD1iV0m9JuPMMD+9spuR76chE5g20/oCotdnV1P87HrXfQKgWV00tPtjobd3 0MM412+A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1j4bKA-0002SV-MR; Thu, 20 Feb 2020 02:12:22 +0000 Received: from mail27.static.mailgun.info ([104.130.122.27]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1j4bJw-0002JX-VV for linux-arm-kernel@lists.infradead.org; Thu, 20 Feb 2020 02:12:12 +0000 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1582164731; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=G0N2LK4yBTzqvnQc6T2DASLm9WXe508wiQLbyaNYBZI=; b=LECZGoy61vO4mUJfk8xh5CJ4Wi/HV1ayaFMzNYPQA7E2UW/7A+YzovV5G2/botyUehphp4uT BniTHWt0Fh7WS5Um5SU4jPZg6m6LeKPjz7BDTVBihcrCBfFW0cb07AEq0WOPRL46z7DmaqsB SEjF6rGVRVk/SdPjdd99g6wsTzY= X-Mailgun-Sending-Ip: 104.130.122.27 X-Mailgun-Sid: WyJiYzAxZiIsICJsaW51eC1hcm0ta2VybmVsQGxpc3RzLmluZnJhZGVhZC5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by mxa.mailgun.org with ESMTP id 5e4deaf3.7fc0441f0308-smtp-out-n01; Thu, 20 Feb 2020 02:12:03 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 5067EC4479D; Thu, 20 Feb 2020 02:12:02 +0000 (UTC) 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 56F5EC433A2; Thu, 20 Feb 2020 02:12:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 56F5EC433A2 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=none smtp.mailfrom=sidgup@codeaurora.org From: Siddharth Gupta To: ohad@wizery.com, bjorn.andersson@linaro.org Subject: [PATCH 1/2] remoteproc: core: Add an API for booting with firmware name Date: Wed, 19 Feb 2020 18:11:52 -0800 Message-Id: <1582164713-6413-2-git-send-email-sidgup@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1582164713-6413-1-git-send-email-sidgup@codeaurora.org> References: <1582164713-6413-1-git-send-email-sidgup@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200219_181211_180596_5DEBD8B3 X-CRM114-Status: GOOD ( 15.25 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: tsoni@codeaurora.org, linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, rishabhb@codeaurora.org, Siddharth Gupta , psodagud@codeaurora.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add an API which allows to change the name of the firmware to be booted on the specified rproc. This change gives us the flixibility to change the firmware at run-time depending on the usecase. Some remoteprocs might use a different firmware for testing, production and development purposes, which may be selected based on the fuse settings during bootup. Signed-off-by: Siddharth Gupta --- drivers/remoteproc/remoteproc_core.c | 34 ++++++++++++++++++++++++++++++++++ include/linux/remoteproc.h | 1 + 2 files changed, 35 insertions(+) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 097f33e..5ab65a4 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -1779,6 +1779,40 @@ int rproc_boot(struct rproc *rproc) EXPORT_SYMBOL(rproc_boot); /** + * rproc_boot_with_fw() - boot a remote processor with the specified firmware + * @rproc: handle of a remote processor + * @firmware: name of the firmware to boot with + * + * Change the name of the firmware to be loaded to @firmware in the rproc + * structure, and call rproc_boot(). + * + * Returns 0 on success, and an appropriate error value otherwise. + */ +int rproc_boot_with_fw(struct rproc *rproc, const char *firmware) +{ + char *p; + + if (!rproc) { + pr_err("invalid rproc handle\n"); + return -EINVAL; + } + + if (firmware) { + p = kstrdup(firmware, GFP_KERNEL); + if (!p) + return -ENOMEM; + + mutex_lock(&rproc->lock); + kfree(rproc->firmware); + rproc->firmware = p; + mutex_unlock(&rproc->lock); + } + + return rproc_boot(rproc); +} +EXPORT_SYMBOL(rproc_boot_with_fw); + +/** * rproc_shutdown() - power off the remote processor * @rproc: the remote processor * diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h index 16ad666..e2eaba9 100644 --- a/include/linux/remoteproc.h +++ b/include/linux/remoteproc.h @@ -609,6 +609,7 @@ rproc_of_resm_mem_entry_init(struct device *dev, u32 of_resm_idx, int len, u32 da, const char *name, ...); int rproc_boot(struct rproc *rproc); +int rproc_boot_with_fw(struct rproc *rproc, const char *firmware); void rproc_shutdown(struct rproc *rproc); void rproc_report_crash(struct rproc *rproc, enum rproc_crash_type type); int rproc_coredump_add_segment(struct rproc *rproc, dma_addr_t da, size_t size); -- Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel