RE: [RFCv2 09/11] remoteproc: Add operation to find resource table in memory

Sjur BRENDELAND
2013-01-15T15:13:55Z

Hi Ido,

> From: Ido Yariv [mailto:ido@wizery.com]
> > +struct resource_table *rproc_elf_get_rsctab_addr(struct rproc *rproc,
> > + const struct firmware *fw)
> > +{
> > + struct elf32_shdr *shdr;
> > +
> > + shdr = find_rsc_shdr(&rproc->dev, (struct elf32_hdr *)fw->data);
> > + if (!shdr)
> > + return NULL;
>
> Instead of traversing the headers twice, perhaps we could save the
> address and size in advance and use it here?

To do that we would have to store the struct elf32_shdr in struct rproc.
So this is a trade-off between bloating rproc structure with shdr or
spending some more cpu-cycles to scan the elf sections.
It shouldn't be that many sections to scan, and as we've just parsed
this firmware sections earlier so it might be hot in cache.
This shouldn't be very expensive, so I'd prefer to keep this as is.

Are you OK with that?

Regards,
Sjur