Re: [PATCH] ARM: mmp: map sram as MT_MEMORY rather than MT_DEVICE

From: Eric Miao
Date: Mon Aug 22 2011 - 20:08:05 EST


On Tue, Aug 23, 2011 at 7:47 AM, Andres Salomon <dilinger@xxxxxxxxxx> 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@xxxxxxxxxx>
> ---
> Â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.

>    Âinfo->pool_name  = kstrdup(pdata->pool_name, GFP_KERNEL);
> Â Â Â Âinfo->granularity = pdata->granularity;
>
> --
> 1.7.2.5
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/