From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BE57B267386 for ; Mon, 2 Feb 2026 16:16:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770049007; cv=none; b=n9K2fuXnJ/4GkNKj9rwu+lDa08aYcXnotRiqAGRlCZ7zl7G6UuGdGVwM9p2x6XBI47jfNHQkAp0/RJsnqI8pbsEjXsRwP6MVGXLpN0nmWjipOUsUtYuryaL7f293SYZMKbR0lOfQP6jwIpvdA2n3sqVP/xL3sHtP21s5ec4sYcs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770049007; c=relaxed/simple; bh=PMp4djD8pRzTfzCwrEWdLRidXLy0AL6hraTfCK1hKTI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=gTI+o4jkcgOCKzU/aA0i7yqVvBFBZytdy6LiSZw9cv0GBqNtlxdt+seMXL4qgqSy6l4LcXClcWukNmo7ExgpFs5341w3GvKTFVAaxbxkStMmvV8Q/DglO2CmXcoX5SbyiD0EQx2ESS8Dbr+3+h4/afKKCeCn6oFn0F0YD5i0vPo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=CWbgTv5c; arc=none smtp.client-ip=209.85.214.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="CWbgTv5c" Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-2a102494058so25499045ad.0 for ; Mon, 02 Feb 2026 08:16:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1770049005; x=1770653805; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=yDIwIvjoA0KVZj8266aGVsS4EvreJW/WICQfNeIuAso=; b=CWbgTv5c8Io0cIiRd9rSz6q1Qpein0lLZLFY38XhSy0BEXwjecDMbfaUMO6Pp9bEd/ kQcffYvQix74IkzH3aD7iBFKe40cDACIfoHvWqTyGJOoIoFcRQs7/aaAuVHitHnBlFjx 66RE9zaeDoxCewjPK61LG3HgoWZSPKIpckz8lVMeVXWsHtc1j/snVLaHHU44KPAzYc/B LBZ5ha0uhDREkQ/opDd71zNtiXr0LrqjUX8Ns8iIzVXcCNEk1FdAb6c98GephXBkFtOF CQDY+dKR4eZRv3hsh/r1jAsLCslQUiWNizp4nUuizP8/LO9BdNGjF7bq51ciyecBkQQE 0wCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770049005; x=1770653805; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=yDIwIvjoA0KVZj8266aGVsS4EvreJW/WICQfNeIuAso=; b=EMSErLSr/ywX1fuNjUNFTozhO/MXzwcujXMDVU+Ib3GClueBtti5SrflbyAR9BAXQT f/XEJpS+XOn3bzFX9PWHpSlOhZRCt/lfnWPwkU3ymcPTqq3wgZUdhfpCAGtbUk9Lt0uJ oHaJsWt3Pck/wrHfS4gcWlD1lljhxcO8eThW6dLJmslBgjdgYCHK22l/aVrXjjcL4BUf SjoRSHIZqBk3SlDBA+5OSQ6+wJBUo4S5Fx7paeV70onXakr6nrmT8qbqU5ZFrK2pwskm H7tz6pKrj/8nby2m2+hu8vJKhlU1buHfYczkcyF7ZiRT3L6WB5zyJMkbLcvkZhNc5lzl 88HA== X-Forwarded-Encrypted: i=1; AJvYcCWdsPUfXYmp6sigbfq4ZNK0AUx+Epdx6G97rANrINqo8OyiaWrEiF3Iq/B8E6qL23QJLbR5fEDPClf8XNc=@vger.kernel.org X-Gm-Message-State: AOJu0YzqaFrTgpzPrubdrGwsZqsLiYp7oE96pnaXrW/8aSUFASct57qZ ZdaL9MbeFNZe9hg+iX7cRGSprZKkvMeuyV52goSnfaf59FqtReh59pyjpyz2FpdE9zw= X-Gm-Gg: AZuq6aI9ngnLZBahpSkL/ak73ZMHHDg5b5C8pHR92eaNZuo0UD8U08qtfxOC6OSRDjI 2dnWD/4xntWkE6ZYsR8tYOotlQ3KYI3VejSbzYgSp5F0kWwi9ck77tF2FBNFh2ELXABHYScbp+1 LLmgKyQpBnQPwBgdkAEvLdoi6Lq6mYfjbX9+qGBtdMk5BJbAZRr0T8IFOXRQZA+BM1Qy9yuCHLe JK6PbJiOqLLivmr7CZnhrqZLHhRKSuz82oNBCK5KQWxVxgx91VEFu9xK4R0H773Dbp1CKqjO8fI Fg8jS8KBE9w/LvruUckNWvPKRCJjfq7PYmbAujaFb4QOEWNqelIkHTcFFui2338cbvzKRqQY1OK /hQbGiLqdDxNHwx7r/ZHX6WTbsiWdhvmG3ugPQ8AWBbEbft1ZpJ8ym4P6TfjnDm0W4bkkXTj6fk ++3N7N1LQqlcR5f5560faRYoAR X-Received: by 2002:a17:902:e749:b0:2a7:5f26:aaf9 with SMTP id d9443c01a7336-2a8bd4c6f2cmr162675685ad.14.1770049004918; Mon, 02 Feb 2026 08:16:44 -0800 (PST) Received: from p14s ([2604:3d09:148c:c800:ef20:b488:c934:4d5f]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2a88b4154fcsm147962315ad.36.2026.02.02.08.16.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Feb 2026 08:16:44 -0800 (PST) Date: Mon, 2 Feb 2026 09:16:41 -0700 From: Mathieu Poirier To: Daniel Baluta Cc: "Peng Fan (OSS)" , Bjorn Andersson , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Iuliana Prodan , Daniel Baluta , Frank Li , linux-remoteproc@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Peng Fan , stable@vger.kernel.org Subject: Re: [PATCH v3] remoteproc: imx: Fix invalid loaded resource table detection Message-ID: References: <20260129-imx-rproc-fix-v3-1-fc4e41e6e750@nxp.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Thu, Jan 29, 2026 at 06:02:21PM +0200, Daniel Baluta wrote: > On Thu, Jan 29, 2026 at 3:45 AM Peng Fan (OSS) wrote: > > > > From: Peng Fan > > > > imx_rproc_elf_find_loaded_rsc_table() may incorrectly report a loaded > > resource table even when the current firmware does not provide one. > > > > When the device tree contains a "rsc-table" entry, priv->rsc_table is > > non-NULL and denotes where a resource table would be located if one is > > present in memory. However, when the current firmware has no resource > > table, rproc->table_ptr is NULL. The function still returns > > priv->rsc_table, and the remoteproc core interprets this as a valid loaded > > resource table. > > > > Fix this by returning NULL from imx_rproc_elf_find_loaded_rsc_table() when > > there is no resource table for the current firmware (i.e. when > > rproc->table_ptr is NULL). This aligns the function's semantics with the > > remoteproc core: a loaded resource table is only reported when a valid > > table_ptr exists. > > > > With this change, starting firmware without a resource table no longer > > triggers a crash. > > > > Fixes: e954a1bd1610 ("remoteproc: imx_rproc: Use imx specific hook for find_loaded_rsc_table") > > Cc: stable@vger.kernel.org > > Signed-off-by: Peng Fan > > Changes looks good to me > > > > --- a/drivers/remoteproc/imx_rproc.c > > +++ b/drivers/remoteproc/imx_rproc.c > > @@ -729,6 +729,10 @@ imx_rproc_elf_find_loaded_rsc_table(struct rproc *rproc, const struct firmware * > > { > > struct imx_rproc *priv = rproc->priv; > > > > + /* No resource table in the firmware */ > > + if (!rproc->table_ptr) > > + return NULL; > > I wonder if we can make this change generic because it should happen > on other platforms also. > > Maybe something like this: > > remoteproc: core: Only copy loaded table when valid > > Copy resource table in memory only when: > * the current loaded firmware provides one > AND > * there is an explicit request to have the rsc table copied in memory > via rsc-table > > --- a/drivers/remoteproc/remoteproc_core.c > +++ b/drivers/remoteproc/remoteproc_core.c > @@ -1281,7 +1281,7 @@ static int rproc_start(struct rproc *rproc, > const struct firmware *fw) > * that any subsequent changes will be applied to the loaded version. > */ > loaded_table = rproc_find_loaded_rsc_table(rproc, fw); > - if (loaded_table) { > + if (rproc->cached_table && loaded_table) { But we would be doing the check for rproc->table_ptr twice (->table_ptr and ->cached_table should be the same). The way it is currently writting forces vendor specific implementation of rproc_elf_find_loaded_rsc_table() to do the right thing. The merge window has been pushed by a week, giving me an opportunity to merge this patch. Should I do that or should we continue discussing the best approach? > memcpy(loaded_table, rproc->cached_table, rproc->table_sz); > rproc->table_ptr = loaded_table; > }