From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) (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 5838E2F8BEE for ; Fri, 10 Apr 2026 15:52:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775836352; cv=none; b=nazAu8BTbTDxW6YEBdtN5uTwy58X1/rFWe9zKx5V3uVROXd2OeLJHvc6/lHxS1qbbd8VRa1qSrZH3/pR3wVIuAracLa1fxJ3Vr6JfKExsJycErz/seImMhUAMC8Ola3VKac9f5JlIUSl9JU/+/hpjrzqhmeHxuWmrXsgrB4IZSQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775836352; c=relaxed/simple; bh=IVX1psQg7ZO53TJ7iWhI8o/DZnKxxZyF+3P5lFmYSOw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=VIUhyarb34NdLvXKwZP667sqMuUq1O0mlbfWHKK/Bl6+Pg6//MmNt4pWQwgH+8aAfti9MlHSVDre3yZi0HjYf4h/AYn7LJVwSy7f8vSP2tGVuiSwn0hvfQhwDS9AH4CzI3Ohw595iKRLsEo/9hMuKdid8LFgwSBjwj1mnR+GDNg= 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=xnNRcWIq; arc=none smtp.client-ip=209.85.216.41 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="xnNRcWIq" Received: by mail-pj1-f41.google.com with SMTP id 98e67ed59e1d1-35c124d2613so1440349a91.2 for ; Fri, 10 Apr 2026 08:52:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1775836350; x=1776441150; 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=BpSOIXXZ3ZNpAOx8++v8mFOwpFQb2y00e+UwJxOC5kE=; b=xnNRcWIqhFyaFCf1g2ZTN5ZjYduVXneBC0H+7vKNZ2Ncsct/IXOCdrH5SZ2lG5BAFO 7PZyXnsaFeYQO6rY389t2AENCdhw0OQfoDh0WcausOcoZm8PoojratwfPilkOF0/iIvL //ntdraWTjKkcmc/uuFrrBZtr9P59PSbDVO4doW6fzHzIILbOUGAxUf8XlL7vHlbtEGw u+hfKQ1cfq2wREIZSIaQ10R3+6URxMlwQDvfznXSMCmmRaroIE+jrKEDlpdA9GXGSDok n0+Q2t0djzBR3kuCs+ad7uyU3vThzN1hmECY3jF2+hRejkgbuUQGIHYujBiNeStfjL6g m52Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775836350; x=1776441150; 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=BpSOIXXZ3ZNpAOx8++v8mFOwpFQb2y00e+UwJxOC5kE=; b=qzoFx1jb/Owmw2hSbbI0YyJmzIR/IrnzSF2ZZ2+AHF9Zy+d0yTXrntpoWUSKwAZAgK ZMQeJ/qGWiuZ2/S/ayMjmBD3rnYuxu/JqIp0B5Ly4aAb+y+sjK/Z0sgQqCt2oCMj0AuJ oE533vPTd1U5Xqw/xAIhwNVg1c+UmBkPvOP2X8sgP7onZKM/yw6GA6VBIgY9t5fDMNmb ytM0eCMYHwY5cmWpFxseVEFykPU0Dn/xaE1Q7RSsNkZh/7vka6Sg8+YXouiEZqn/F0ie scR7aj42KuedHPSD9sANQP2tU6Q/8VUq3jFtt+hdhbgJ7M0Ec8o4NebovNlKHkI+n0IT wiLg== X-Forwarded-Encrypted: i=1; AJvYcCXNNq6rGbbNMH+AZwn4bYC4URo6ur/XK5nkCLBrsG4n5Jft/5LQ5el4ZybXW0UzxgBGZ2BPfECc03pWifc=@vger.kernel.org X-Gm-Message-State: AOJu0YxF8mHua1sR8OcdpozOCY89bYcGdKDCtHG1AXeXn+ssIVpbyemv XrWHxJ8A305bedE3ZEifYBnqryVgF7xs9iBXRDcqihULjHyK8/5IAy7r9R+Dj7tlvkA= X-Gm-Gg: AeBDiesS/EBx9dPR+s4Lzl6kIeoI3cDF4pAllsl9pEPkpZvi2BdqpXYC9j97D4/lEhI fVYJWgHgtBBzKlA2bCFM1St8KIltLdZ3mc03JO/YZYr9oVzxDTHhhtay2EbG+q+6k/Fc0Gx5k5t koEYsdj9gbI3wJRmS2yEI9OReSgjUGT/hrXV1vmkLRLMuYQZkDbc2Bs6ahnHiJl5IJYab0kkZow YkRXAJlZnxpVH+p/ndB3Ro5tgmFgjRUjnusEfZO/V9Tt6fZPcxm+6giOVFCOvg1mj+fPMk3MfLH nGiR3839zi1I5kAvIeGIxyLjvS8feYabLQf2bXG6s5ETeuSia0MEr0PASvkbd5Rz6QtfRsen2xM abPoGDWlMI8/hO8aP0iHqf9zf3n5apB5h5Q03ENwUDz24OZ5DvdPLQoFXjMo9iihaeu0QgjuaL7 uvsQBKabSKUdfp7df2+nDR+PVybro= X-Received: by 2002:a17:90b:2fd0:b0:359:d54:846f with SMTP id 98e67ed59e1d1-35e4275f708mr4213158a91.7.1775836349298; Fri, 10 Apr 2026 08:52:29 -0700 (PDT) Received: from p14s ([2604:3d09:148c:c800:372f:d8dc:5d88:3c78]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b2d4f25aa2sm33630105ad.55.2026.04.10.08.52.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2026 08:52:28 -0700 (PDT) Date: Fri, 10 Apr 2026 09:52:26 -0600 From: Mathieu Poirier To: Peng Fan Cc: Peng Fan , Bjorn Andersson , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Frank Li , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Daniel Baluta , "linux-remoteproc@vger.kernel.org" , "devicetree@vger.kernel.org" , "imx@lists.linux.dev" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v2 2/3] remoteproc: imx_rproc: Pass bootaddr to SM CPU/LMM reset vector Message-ID: References: <20260327-imx943-rproc-v2-0-a547a3588730@nxp.com> <20260327-imx943-rproc-v2-2-a547a3588730@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, Apr 09, 2026 at 08:30:54AM +0800, Peng Fan wrote: > On Wed, Apr 08, 2026 at 09:46:32AM -0600, Mathieu Poirier wrote: > >On Wed, Apr 08, 2026 at 01:30:16AM +0000, Peng Fan wrote: > >> > Subject: Re: [PATCH v2 2/3] remoteproc: imx_rproc: Pass bootaddr to > >> > SM CPU/LMM reset vector > >> > > >> [...] > >> > > >> > > > >> > > Aligning the ELF entry point with the hardware reset base on > >> > Cortex‑M > >> > > systems is possible, but it comes with several risks. > >> > > >> > I'm not asking to align the ELF entry point with the hardware reset base. > >> > All I want is to have the correct start address embedded in the ELF file > >> > to avoid having to use a mask. > >> > >> I see, per my understanding: > >> FreeRTOS typically exposes __isr_vector, which corresponds to the hardware > >> reset / vector table base. > >> Zephyr (Cortex‑M) exposes _vector_table, which serves the same purpose. > >> I am not certain about other RTOSes, but the pattern seems consistent: > >> the vector table base is already available as a named ELF symbol. > >> > >> Given that, if the preferred approach is to parse the ELF and explicitly > >> retrieve the hardware reset base, I can update the implementation accordingly. > >> If you prefer to parse the elf file to get the hardware reset base, > >> I could update to use them. > >> > >> Options1: Something as below: > >> 1. Include rproc_elf_find_symbol in remoteproc_elf_loader.c > >> 2. Use below in imx_rproc.c > >> ret = rproc_elf_find_symbol(rproc, fw, "__isr_vector", &vector_base); > >> if (ret) > >> ret = rproc_elf_find_symbol(rproc, fw, "__vector_table", &vector_base); > >> > >> if (!ret) > >> rproc->bootaddr = vector_base > >> else > >> dev_info(dev, "no __isr_vector or __vector_table\n") > > > >No > > If your concern is about rproc->bootaddr, I could introduce > imx_rproc->vector_base for i.MX. Please help detail a bit. > > > > >> > >> This makes the hardware reset base explicit, avoids masking e_entry. > >> > >> Option 2: User‑provided reset symbol via sysfs > >> As an alternative, we could expose a sysfs attribute, > >> e.g. reset_symbol, allowing users to specify the symbol name > >> to be used as the reset base: > >> > >> echo __isr_vector > /sys/class/remoteproc/remoteprocX/reset_symbol > >> > > > >Definitely not. > > > >The definition of e_entry in the specification is clear, i.e "the address of the > >entry point from where the process starts executing". If masking is required > >because the tool that puts the image together gets the wrong address, then it > >should be fixed. > > The hardware reset base is the address from which the hardware fetches the > initial stack pointer and program counter values and loads them into the SP > and PC registers. In contrast, bootaddr (i.e. e_entry) represents the address > at which the CPU starts executing code (the PC value after reset). As you > pointed out earlier, this distinction is clear. > > In our case, we need to obtain the hardware reset base and pass that value to > the system firmware. However, e_entry should not be set to the hardware reset > base. Doing so would introduce the issues I described in [1]. This means we > should not modify the Zephyr or FreeRTOS build outputs to make e_entry equal > to the hardware reset base. As I said earlier, I am _not_ suggesting to make e_entry equal to the hardware reset base. We are going in circles here. > > Given these constraints, the feasible solutions I can see are either: > - option 1 (explicitly retrieving the hardware reset base), or > - continuing to use masking. > > Please suggest. > > [1] https://lore.kernel.org/all/acs2PAZq2k3zjmDW@shlinux89/ > > Thanks, > Peng > > > > >> The remoteproc core would then resolve that symbol from > >> the ELF and set rproc->bootaddr accordingly. > >> This provides maximum flexibility but does introduce a new user‑visible ABI, > >> so I see it more as an opt‑in or fallback mechanism. > >> > >> Please let me know which approach you prefer, and I will update > >> this series accordingly in v3.. > >> > >> Thanks, > >> Peng. > >> > >> > >> > > >> > > 1, Semantic mismatch (ELF vs. hardware behavior) 2, Debuggers may > >> > > attempt to set breakpoints or start execution at the entry symbol > >> > >