[PATCH v3 1/2] remoteproc: elf_loader: Create new callback for copying segments to remote cpu
Uwe Kleine-König
u.kleine-koenig at baylibre.com
Thu Nov 5 05:41:37 PST 2026
Hello,
On Thu, Nov 05, 2026 at 12:10:05PM +0000, sashiko-bot at kernel.org wrote:
> > diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h
> > index 00019b1895e6e..e750a127cbc4a 100644
> > --- a/include/linux/remoteproc.h
> > +++ b/include/linux/remoteproc.h
> > @@ -75,6 +75,7 @@ enum rsc_handling_status {
> > * @detach: detach from a device, leaving it powered up
> > * @kick: kick a virtqueue (virtqueue id given as a parameter)
> > * @da_to_va: optional platform hook to perform address translations
> > + * @memcpy_tova:optional platform hook to copy data into remote memory range
> > * @parse_fw: parse firmware to extract information (e.g. resource table)
> > * @handle_rsc: optional platform hook to handle vendor resources. Should return
> > * RSC_HANDLED if resource was handled, RSC_IGNORED if not handled
> > @@ -99,6 +100,9 @@ struct rproc_ops {
> > int (*detach)(struct rproc *rproc);
> > void (*kick)(struct rproc *rproc, int vqid);
> > void * (*da_to_va)(struct rproc *rproc, u64 da, size_t len, bool *is_iomem);
> > + int (*memcpy_tova)(struct rproc *rproc, u64 da, const void *src,
> > + size_t filesz, size_t memsz);
>
> [Severity: Low]
> This isn't a bug, but is memcpy_tova the best name for this callback in
> struct rproc_ops?
>
> Across the remoteproc subsystem (such as in struct rproc_mem_entry and
> ops->da_to_va), da denotes a remote processor device address while va denotes
> a kernel virtual address. Since rproc_elf_load_segments() passes the
> untranslated device address da directly to this callback (including for
> devices where remote memory is not mapped into CPU virtual address space at
> all), calling it memcpy_tova seems somewhat misleading.
>
> In addition, when rproc->ops->memcpy_tova is provided,
> rproc_elf_load_segments() skips both the filesz copy and the trailing
> memsz - filesz zeroing step. Should the kernel-doc comment for @memcpy_tova in
> include/linux/remoteproc.h document that implementations must copy filesz
> bytes to da and zero-fill the remaining memsz - filesz bytes when
> memsz > filesz?
That's a valid concern. Maybe `populate_segment` would be a better name?
I considered being more verbose in the kdoc entry, but all the other
entries are very sparse, too, so didn't want to add a 5 line comment for
the new callback among all the one-liners. But I can if you tell me your
preferences.
Best regards
Uwe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20261105/323d9e38/attachment.sig>
More information about the linux-arm-kernel
mailing list