From: Dave.Martin@arm.com (Dave Martin)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC 0/4] Create infrastructure for running C code from SRAM.
Date: Fri, 6 Sep 2013 17:40:59 +0100 [thread overview]
Message-ID: <20130906164059.GC3558@localhost.localdomain> (raw)
In-Reply-To: <20130906111408.GI25647@n2100.arm.linux.org.uk>
On Fri, Sep 06, 2013 at 12:14:08PM +0100, Russell King - ARM Linux wrote:
> On Wed, Sep 04, 2013 at 02:47:51PM -0700, Russ Dill wrote:
> > I think this is already taken care of by the way sram.c is using
> > genalloc. The allocation returned should be aligned to 32 bytes. The
> > thumb bit shouldn't be an issue as code is copied based on the start
> > and end makers made by the linker. I may need to add .align statements
> > in the linker so that the start and end markers for the copied code
> > are aligned to at least 8 bytes.
>
> I think you need to read up on what fncpy does... there's more to it
> than just merely copying code at an appropriate alignment.
The technique of putting each loadable blob in a specific vmlinux
section, and then adjusting entry-point symbols by adding/subtracting
the appropriate offset, probably does work.
This relies on the functions' code alignment requirement being
honoured by both the vmlinux link map, and the allocator used to find
SRAM space to copy the functions to.
Searching the entire list of known blobs every time we want to convert
a symbol seems unnecessary though. Surely the caller could know the
blob<->symbol mapping anyway?
One thing fncpy() doesn't provide is a way to copy groups of functions
that call each other, if vmlinux needs to know about any symbol other
than the one at the start. We might need a better mechanism if that is
needed.
I actually wonder whether fncpy() contains a buglet, whereby
flush_icache_range() is used instead of coherent_kern_range().
The SRAM is probably not mapped cached, but at least a DSB would be
needed before flushing the relevant lines from the I-cache.
However, flush_icache_range() seems to be implemented by a call to
coherent_kern_range() anyway, so perhaps that's not a problem.
Cheers
---Dave
next prev parent reply other threads:[~2013-09-06 16:40 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-03 16:44 [RFC 0/4] Create infrastructure for running C code from SRAM Russ Dill
[not found] ` <1378226665-27090-4-git-send-email-Russ.Dill@ti.com>
2013-09-04 18:06 ` [RFC 3/4] Misc: SRAM: Hack for allowing executable code in SRAM Tony Lindgren
2013-09-06 20:50 ` Russ Dill
2013-09-04 19:52 ` [RFC 0/4] Create infrastructure for running C code from SRAM Emilio López
2013-09-04 21:47 ` Russ Dill
2013-09-06 11:02 ` Sekhar Nori
2013-09-06 11:14 ` Russell King - ARM Linux
2013-09-06 16:40 ` Dave Martin [this message]
2013-09-06 18:50 ` Russ Dill
2013-09-07 8:57 ` Russell King - ARM Linux
2013-09-06 18:40 ` Russ Dill
2013-09-06 11:12 ` Russell King - ARM Linux
2013-09-06 16:19 ` Dave Martin
2013-09-06 19:42 ` Russ Dill
2013-09-06 19:32 ` Russ Dill
2013-09-07 16:21 ` Ard Biesheuvel
2013-09-09 23:10 ` Russ Dill
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=20130906164059.GC3558@localhost.localdomain \
--to=dave.martin@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).