Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2288407pxu; Fri, 18 Dec 2020 09:35:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJxEFzNCWupen8KF7FN/zYAxzt+u7TWd+UYRy/V8bl9f+LQUFGV6vkBFrCwOwgaWbRGm1O/r X-Received: by 2002:a05:6402:845:: with SMTP id b5mr5573437edz.38.1608312936697; Fri, 18 Dec 2020 09:35:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608312936; cv=none; d=google.com; s=arc-20160816; b=CoyAXANtffMr71WXfvIp2XZQX46clZatZb/LJMUE6NtFAE+IZXRkpNSql6B8QW5mpx ZcJb5/Xr3UeQUUQIL9wQKsi7S82lcbIllGUkIJ8aUiOumcTNUIUjntlGBPdSK0XmBfOr aUKAk5X9xQANa+qybeOwlUCbGZKNUs44zARiL4RSq7uBgcyV88fgPHea3vrDnGoAwXBC BoS/HFFsYXPDi8a7jdv1QFJmFXxRNWyJYd1VhHH7J6xkuvl2xYYCXVc3CfQEViz48t2J velzNjK010NWz9DTSJsJHa6td3BpGsqIfQXeWZHkGp+/1sSzg+Tp4U+kuKlibLhf0x6W 59Ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=veV/gWfMA9I6EK7puOMUDziv6Q4utmhzFu5s8pwfL6Y=; b=d4atiTdwCAUyFSCjFxsQTez1hTmb98KaFL23pJ2I+hBX0u1yfmTafR5cRy0211ZDnO 4x9FOEaCPmVmCLFVTHeDxmioaO43XANEIhq+FUcTG2Jb7m5Mj1U5qY+8+V7eHoKR2xwQ ihaR85vbe/5b3UUoLtBW73VXf4xPN5dktRiiyIpYvCZP0ri7jbwoDqWKXmR3W1SX3FWi x6Elo/MY9urv9/YYwiaALkKpZahjW4Fw3CEDIbXHwbslegqnt3eaGYqk+YuhgQbGZXi7 ERxbPtz5WabSpRz8T6O57kKClae4we2iK0rvWRTAy6SSIcbjVVPDeBXRXlYsLmMNJWWc Fkjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IsLC2tdb; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id me7si5175202ejb.11.2020.12.18.09.35.14; Fri, 18 Dec 2020 09:35:36 -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=@linaro.org header.s=google header.b=IsLC2tdb; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732775AbgLRReP (ORCPT + 99 others); Fri, 18 Dec 2020 12:34:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732751AbgLRReM (ORCPT ); Fri, 18 Dec 2020 12:34:12 -0500 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DF34C0619D2 for ; Fri, 18 Dec 2020 09:32:36 -0800 (PST) Received: by mail-pj1-x102f.google.com with SMTP id lb18so1660905pjb.5 for ; Fri, 18 Dec 2020 09:32:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=veV/gWfMA9I6EK7puOMUDziv6Q4utmhzFu5s8pwfL6Y=; b=IsLC2tdb+Pf1zJzmBqdfU+7Lt9+J5U7obCdktnUBK+t6z1PscQocz5RbK7ptqQeZjh 69aoGazTQg7QNqyHvMLxy/ABKuxk9AgbBGPQNYMDymkMmlRzPg86LNJ1joQmNVaCdlgP g3w1obCYUxvM5RqGHIxQQMzCWI9CVpB4UvfmRhn1kpc+pRnEsU7xDo7EdhO4SPqhHle4 0hC5qeLZLQmoHqsR62Tjt1n6rFzv+0jyB/+ktGqldWh9wVVroMVkhLW6czNqzNSHOLXe W/4g2TJNzrN1P3SHIqN2FpEvfDWRqDJPIgIdT/bmTzzAeFqeuwhhze8+kFm6yPTSCDDR a8xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=veV/gWfMA9I6EK7puOMUDziv6Q4utmhzFu5s8pwfL6Y=; b=ViNMJSbIPci0bJjtoh2gl4fp0DB/SVsz4TJazMvUKi1vZ73IJXY2HsZaAyWdn5Vxf/ THLQoIwkq+HiUtzVxmbp7knR8HD81Z3aR/UVUOkTgukhe1TFyH0+6kTsR+FBTmLbilWq jS3vMxcPx7Q0hgcHf98IJrlA2TlNa+3fr3P8I6JGeO8iUo1/jaQzbovwd/PntbIJqccd 9Q9qu51ODUm+0i1z0XeXmN9WnWnqKGoTIWNSDoHkWhKDTSI9QpsvHzbUz6YpST779D3s B1N9nf3mjRbhPtDmU28VmtyYQp5DcYlF+HeDLG/dln7i3AbEn8fv21hbzki6xYM/I7ku qB7g== X-Gm-Message-State: AOAM5339Mb7ce8LtOkRFRElQzvkeIlvU/rybGJFKC1csBdkaUfdJ6Aca iCM4AqkfCRkmCsVNMb2IplQi4A== X-Received: by 2002:a17:90b:1249:: with SMTP id gx9mr5207245pjb.169.1608312755974; Fri, 18 Dec 2020 09:32:35 -0800 (PST) Received: from xps15.cg.shawcable.net (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id l11sm9892957pgt.79.2020.12.18.09.32.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Dec 2020 09:32:35 -0800 (PST) From: Mathieu Poirier To: ohad@wizery.com, bjorn.andersson@linaro.org, robh+dt@kernel.org Cc: arnaud.pouliquen@st.com, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 05/17] remoteproc: Add new get_loaded_rsc_table() remoteproc operation Date: Fri, 18 Dec 2020 10:32:16 -0700 Message-Id: <20201218173228.2277032-6-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201218173228.2277032-1-mathieu.poirier@linaro.org> References: <20201218173228.2277032-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add an new get_loaded_rsc_table() operation in order to support scenarios where the remoteproc core has booted a remote processor and detaches from it. When re-attaching to the remote processor, the core needs to know where the resource table has been placed in memory. Signed-off-by: Mathieu Poirier --- drivers/remoteproc/remoteproc_core.c | 6 ++++++ drivers/remoteproc/remoteproc_internal.h | 8 ++++++++ include/linux/remoteproc.h | 5 ++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index d0f6b39b56f9..3d87c910aca7 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -1556,6 +1556,12 @@ static int rproc_attach(struct rproc *rproc) return ret; } + ret = rproc_get_loaded_rsc_table(rproc); + if (ret) { + dev_err(dev, "can't load resource table: %d\n", ret); + goto disable_iommu; + } + /* reset max_notifyid */ rproc->max_notifyid = -1; diff --git a/drivers/remoteproc/remoteproc_internal.h b/drivers/remoteproc/remoteproc_internal.h index c34002888d2c..c48b301d6ad1 100644 --- a/drivers/remoteproc/remoteproc_internal.h +++ b/drivers/remoteproc/remoteproc_internal.h @@ -177,6 +177,14 @@ struct resource_table *rproc_find_loaded_rsc_table(struct rproc *rproc, return NULL; } +static inline int rproc_get_loaded_rsc_table(struct rproc *rproc) +{ + if (rproc->ops->get_loaded_rsc_table) + return rproc->ops->get_loaded_rsc_table(rproc); + + return 0; +} + static inline bool rproc_u64_fit_in_size_t(u64 val) { diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h index 3fa3ba6498e8..571615e77e6f 100644 --- a/include/linux/remoteproc.h +++ b/include/linux/remoteproc.h @@ -368,7 +368,9 @@ enum rsc_handling_status { * RSC_HANDLED if resource was handled, RSC_IGNORED if not handled and a * negative value on error * @load_rsc_table: load resource table from firmware image - * @find_loaded_rsc_table: find the loaded resouce table + * @find_loaded_rsc_table: find the loaded resource table from firmware image + * @get_loaded_rsc_table: get resource table installed in memory + * by external entity * @load: load firmware to memory, where the remote processor * expects to find it * @sanity_check: sanity check the fw image @@ -389,6 +391,7 @@ struct rproc_ops { int offset, int avail); struct resource_table *(*find_loaded_rsc_table)( struct rproc *rproc, const struct firmware *fw); + int (*get_loaded_rsc_table)(struct rproc *rproc); int (*load)(struct rproc *rproc, const struct firmware *fw); int (*sanity_check)(struct rproc *rproc, const struct firmware *fw); u64 (*get_boot_addr)(struct rproc *rproc, const struct firmware *fw); -- 2.25.1