From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Loic PALLARDY <loic.pallardy@st.com>
Cc: Ohad Ben-Cohen <ohad@wizery.com>,
"linux-remoteproc@vger.kernel.org"
<linux-remoteproc@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 6/8] remoteproc: Move resource table load logic to find
Date: Thu, 14 Dec 2017 11:25:29 -0800 [thread overview]
Message-ID: <20171214192529.GU17344@builder> (raw)
In-Reply-To: <63583c92f9e14fd881d53db2706ca689@SFHDAG7NODE2.st.com>
On Thu 14 Dec 03:25 PST 2017, Loic PALLARDY wrote:
> > -----Original Message-----
> > From: linux-remoteproc-owner@vger.kernel.org [mailto:linux-remoteproc-
> > owner@vger.kernel.org] On Behalf Of Bjorn Andersson
> > Sent: Wednesday, December 13, 2017 11:41 PM
[..]
> > -struct resource_table *rproc_elf_find_rsc_table(struct rproc *rproc,
> > - const struct firmware *fw,
> > - int *tablesz)
> > +int rproc_elf_load_rsc_table(struct rproc *rproc, const struct firmware *fw)
> > {
> > struct elf32_hdr *ehdr;
> > struct elf32_shdr *shdr;
> > struct device *dev = &rproc->dev;
> > struct resource_table *table = NULL;
> > const u8 *elf_data = fw->data;
> > + size_t tablesz;
> >
> > ehdr = (struct elf32_hdr *)elf_data;
> >
> > shdr = find_table(dev, ehdr, fw->size);
> > if (!shdr)
> > - return NULL;
> > + return -EINVAL;
> >
> > table = (struct resource_table *)(elf_data + shdr->sh_offset);
> > - *tablesz = shdr->sh_size;
> > + tablesz = shdr->sh_size;
> > +
> > + /*
> > + * Create a copy of the resource table. When a virtio device starts
> > + * and calls vring_new_virtqueue() the address of the allocated vring
> > + * will be stored in the cached_table. Before the device is started,
> > + * cached_table will be copied into device memory.
> > + */
> > + rproc->cached_table = kmemdup(table, tablesz, GFP_KERNEL);
> > + if (!rproc->cached_table)
> > + return -ENOMEM;
> >
> > - return table;
> > + rproc->table_ptr = rproc->cached_table;
> > + rproc->table_sz = tablesz;
> > +
> > + return 0;
> > }
> > -EXPORT_SYMBOL(rproc_elf_find_rsc_table);
> > +EXPORT_SYMBOL(rproc_elf_load_rsc_table);
> [LPA] Hi Bjorn,
>
> I understand the simplification of the code, but I would like to keep
> rproc_elf_find_rsc_table function as helper one. Indeed if a driver
> wants to override the default rproc_elf_load_rsc_table, it may have to
> parse first the elf file to look up for resource table using
> rproc_elf_find_rsc_table as helper.
find_table() finds the .resource_table segment and verifies that this
contains a valid, version 1, resource table.
So AFAICT there are two scenarios here:
1) A driver wants to support custom entries in the resource table, for
which Suman's proposal of adding a way for drivers to implement custom
properties seems like a good solution.
2) A driver wants to support something other than a v1 resource table,
in which case they would need to reimplement find_table() anyways.
It's possible that the part of find_table() that looks up the segment by
name could be exposed for drivers to use this, but half of find_table()
deals with verifying that the content is a proper resource table.
Please let me know if you have a use case beyond these.
Regards,
Bjorn
next prev parent reply other threads:[~2017-12-14 19:25 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-13 22:41 [PATCH 0/8] Remoteproc cleanups Bjorn Andersson
2017-12-13 22:41 ` [PATCH 1/8] remoteproc: Remove depricated crash completion Bjorn Andersson
2017-12-13 22:41 ` [PATCH 2/8] remoteproc: Cache resource table size Bjorn Andersson
2017-12-13 22:41 ` [PATCH 3/8] remoteproc: Clone rproc_ops in rproc_alloc() Bjorn Andersson
2017-12-13 22:41 ` [PATCH 4/8] remoteproc: Merge rproc_ops and rproc_fw_ops Bjorn Andersson
2017-12-13 22:41 ` [PATCH 5/8] remoteproc: Don't handle empty resource table Bjorn Andersson
2017-12-13 22:41 ` [PATCH 6/8] remoteproc: Move resource table load logic to find Bjorn Andersson
2017-12-14 11:25 ` Loic PALLARDY
2017-12-14 19:25 ` Bjorn Andersson [this message]
2017-12-14 12:00 ` Loic PALLARDY
2017-12-14 19:47 ` Bjorn Andersson
2017-12-14 20:12 ` Loic PALLARDY
2017-12-13 22:41 ` [PATCH 7/8] remoteproc: Drop dangling find_rsc_table dummies Bjorn Andersson
2018-01-05 16:53 ` Loic PALLARDY
2018-01-05 18:50 ` Bjorn Andersson
2018-01-08 8:14 ` Loic PALLARDY
2017-12-13 22:41 ` [PATCH 8/8] remoteproc: Reset table_ptr on stop Bjorn Andersson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171214192529.GU17344@builder \
--to=bjorn.andersson@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=loic.pallardy@st.com \
--cc=ohad@wizery.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.