linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: haojian.zhuang@marvell.com (Haojian Zhuang)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: mmp: map sram as MT_MEMORY rather than MT_DEVICE
Date: Tue, 23 Aug 2011 16:22:17 +0800	[thread overview]
Message-ID: <1314087737.4444.22.camel@Lily> (raw)
In-Reply-To: <4E535B66.8070301@marvell.com>

On Tue, 2011-08-23 at 00:48 -0700, Leo Yan wrote:
> 
> On 08/23/2011 10:08 AM, Andres Salomon wrote:
> > On Tue, 23 Aug 2011 08:07:41 +0800
> > Eric Miao<eric.y.miao@gmail.com>  wrote:
> >
> >> On Tue, Aug 23, 2011 at 7:47 AM, Andres Salomon<dilinger@queued.net>
> >> wrote:
> >>> The sram code allocates memory with ioremap, which assumes MT_DEVICE
> >>> for memory protections.  This explodes when we map sram for power
> >>> management purposes and then attempt to execute it (jump_to_lp_sram)
> >>> on the OLPC XO-1.75.  Instead, we want to specify MT_MEMORY, which
> >>> doesn't set the L_PTE_XN bit.
> >>>
> >>> Signed-off-by: Andres Salomon<dilinger@queued.net>
> >>> ---
> >>>   arch/arm/mach-mmp/sram.c |    4 +++-
> >>>   1 files changed, 3 insertions(+), 1 deletions(-)
> >>>
> >>> Eric, this patch is against the devel branch of your pxa tree.
> >>>
> >>> diff --git a/arch/arm/mach-mmp/sram.c b/arch/arm/mach-mmp/sram.c
> >>> index 4304f95..ca4d3c1 100644
> >>> --- a/arch/arm/mach-mmp/sram.c
> >>> +++ b/arch/arm/mach-mmp/sram.c
> >>> @@ -21,6 +21,7 @@
> >>>   #include<linux/err.h>
> >>>   #include<linux/slab.h>
> >>>   #include<linux/genalloc.h>
> >>> +#include<asm/mach/map.h>
> >>>
> >>>   #include<mach/sram.h>
> >>>
> >>> @@ -87,7 +88,8 @@ static int __devinit sram_probe(struct
> >>> platform_device *pdev)
> >>>
> >>>         info->sram_phys   = (phys_addr_t)res->start;
> >>>         info->sram_size   = resource_size(res);
> >>> -       info->sram_virt   = ioremap(info->sram_phys,
> >>> info->sram_size);
> >>> +       info->sram_virt   = __arm_ioremap(info->sram_phys,
> >>> info->sram_size,
> >>> +                                         MT_MEMORY);
> >>
> >> I doubt MT_MEMORY is intended for use with __arm_ioremap(). There
> >> could be other way around to the L_PTE_XN bit.
> >>
> >> One other way I'm actually thinking of is to add the SRAM mapping to
> >> mmp_map_io(). The difference of SRAM offset/size may result the
> >> separation of mmp_map_io() into {pxa168,pxa910,mmp2}_map_io()
> >> if necessary.
> >>
> >
> > I guess I don't follow.  I think you're talking about adding it to the
> > standard_io_desc array, but that would require having it pre-mapped and
> > knowing the virtual address.  Or were you planning to ioremap it?
> 
> I missed the L_PTE_XN bit.
> The patch is originally for audio sram, so use the ioremap is ok for 
> that. But for the internal sram we should need the different mapping 
> property.
> 
> so far, the standard_io_desc is shared by pxa168/pxa910/mmp2;
> we can not add the sram's entry into it for now sram is only dedicated
> to mmp2; just like Eric's suggestion, we need mmp2_map_io() only for
> mmp2, and add the sram's entries into the structure.
> if so, we need transfer the mapped info into the sram module,
> and sram module just keep the info and do not need remap it again.
> 
> so what's your opinion?

Could we use resource or platform data to specify sram is used for
device or memory? If so, it may be helpful to customize.

  reply	other threads:[~2011-08-23  8:22 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-15  3:09 [PATCH V4 0/3] ARM: mmp: add audio sram support Leo Yan
2011-08-15  3:09 ` [PATCH 1/3] ARM: mmp: add sram allocator Leo Yan
2011-08-15  8:59   ` Arnd Bergmann
2011-08-15  9:09     ` Jean-Christophe PLAGNIOL-VILLARD
2011-08-15  9:30       ` Haojian Zhuang
2011-10-07 19:06         ` Tony Lindgren
2011-08-15  9:26     ` Leo Yan
2011-08-15 13:23     ` Nicolas Pitre
2011-08-15 13:32       ` Russell King - ARM Linux
2011-08-15  9:11   ` Jean-Christophe PLAGNIOL-VILLARD
2011-08-22 23:47   ` [PATCH] ARM: mmp: map sram as MT_MEMORY rather than MT_DEVICE Andres Salomon
2011-08-23  0:07     ` Eric Miao
2011-08-23  2:08       ` Andres Salomon
2011-08-23  7:48         ` Leo Yan
2011-08-23  8:22           ` Haojian Zhuang [this message]
2011-08-23  0:07     ` Russell King - ARM Linux
2011-08-23  2:13       ` Andres Salomon
2011-10-07 19:05         ` Tony Lindgren
2011-08-15  3:09 ` [PATCH 2/3] ARM: mmp: register audio sram bank Leo Yan
2011-08-15  3:09 ` [PATCH 3/3] ARM: mmp: register internal " Leo Yan
2011-08-15  3:11 ` [PATCH V4 0/3] ARM: mmp: add audio sram support Haojian Zhuang
2011-08-15  8:43   ` Eric Miao
2011-08-15  9:12     ` Jean-Christophe PLAGNIOL-VILLARD
2011-08-15  9:35       ` Eric Miao
2011-08-15 10:25         ` Leo Yan
2011-08-17 12:32           ` Jean-Christophe PLAGNIOL-VILLARD
2011-08-19  8:25             ` Haojian Zhuang

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=1314087737.4444.22.camel@Lily \
    --to=haojian.zhuang@marvell.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).