linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: tony@atomide.com (Tony Lindgren)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC 3/4] Misc: SRAM: Hack for allowing executable code in SRAM.
Date: Wed, 4 Sep 2013 11:06:39 -0700	[thread overview]
Message-ID: <20130904180638.GC31541@atomide.com> (raw)
In-Reply-To: <1378226665-27090-4-git-send-email-Russ.Dill@ti.com>

* Russ Dill <Russ.Dill@ti.com> [130903 09:52]:
> The generic SRAM mechanism does not ioremap memory in a
> manner that allows code to be executed from SRAM. There is
> currently no generic way to request ioremap to return a
> memory area with execution allowed.
> 
> Insert a temporary hack for proof of concept on ARM.
> 
> Signed-off-by: Russ Dill <Russ.Dill@ti.com>
> ---
>  drivers/misc/sram.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/misc/sram.c b/drivers/misc/sram.c
> index 08baaab..e059a23 100644
> --- a/drivers/misc/sram.c
> +++ b/drivers/misc/sram.c
> @@ -31,6 +31,7 @@
>  #include <linux/genalloc.h>
>  #include <linux/sram.h>
>  #include <asm-generic/cacheflush.h>
> +#include <asm/io.h>
>  
>  #define SRAM_GRANULARITY	32
>  
> @@ -138,7 +139,7 @@ static int sram_probe(struct platform_device *pdev)
>  	int ret;
>  
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	virt_base = devm_ioremap_resource(&pdev->dev, res);
> +	virt_base = __arm_ioremap_exec(res->start, resource_size(res), false);
>  	if (IS_ERR(virt_base))
>  		return PTR_ERR(virt_base);

You can get rid of this hack by defining ioremap_exec in
include/asm-generic/io.h the same way as ioremap_nocache
is done:

#ifndef ioremap_exec
#define ioremap_exec ioremap
#endif

Then the arch that need ioremap_exec can define and
implement it. Needs to be reviewed on LKML naturally :)

Regards,

Tony

  parent reply	other threads:[~2013-09-04 18:06 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   ` Tony Lindgren [this message]
2013-09-06 20:50     ` [RFC 3/4] Misc: SRAM: Hack for allowing executable code in SRAM 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
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=20130904180638.GC31541@atomide.com \
    --to=tony@atomide.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).