All of lore.kernel.org
 help / color / mirror / Atom feed
* Alignment Requirement for MT_MEMORY type
@ 2010-02-18  0:33 Henry Li
  2010-02-18  8:51 ` Russell King - ARM Linux
  0 siblings, 1 reply; 4+ messages in thread
From: Henry Li @ 2010-02-18  0:33 UTC (permalink / raw)
  To: linux-arm-kernel


Hi,

Can someone tell me why there is a requirement for the virtual and physical
addresses and size using MT_MEMORY memtype (where prot_l1=0) to be aligned
to section boundary (1MB) in linux-2.6.32/arch/arm/mm/mmu.c/create_mapping
during IO table init?


Following is the relevent code snippet:

addr = md->virtual & PAGE_MASK;
phys = (unsigned long)__pfn_to_phys(md->pfn);
length = PAGE_ALIGN(md->length + (md->virtual & ~PAGE_MASK));

if (type->prot_l1 == 0 && ((addr | phys | length) & ~SECTION_MASK)) {
	printk(KERN_WARNING "BUG: map for 0x%08lx at 0x%08lx can not "
	       "be mapped using pages, ignoring.\n",
	       __pfn_to_phys(md->pfn), addr);
	return;
}


Thanks,

- Henry

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Alignment Requirement for MT_MEMORY type
  2010-02-18  0:33 Alignment Requirement for MT_MEMORY type Henry Li
@ 2010-02-18  8:51 ` Russell King - ARM Linux
  2010-02-18 18:08   ` Henry Li
  0 siblings, 1 reply; 4+ messages in thread
From: Russell King - ARM Linux @ 2010-02-18  8:51 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Feb 17, 2010 at 04:33:00PM -0800, Henry Li wrote:
> Can someone tell me why there is a requirement for the virtual and physical
> addresses and size using MT_MEMORY memtype (where prot_l1=0) to be aligned
> to section boundary (1MB) in linux-2.6.32/arch/arm/mm/mmu.c/create_mapping
> during IO table init?

Because today SDRAM is always a whole number of MB, so its pointless
defining it in terms of 4K pages.  MT_MEMORY is not for general purpose
use, but only for setting up the initial kernel SDRAM mapping.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Alignment Requirement for MT_MEMORY type
  2010-02-18  8:51 ` Russell King - ARM Linux
@ 2010-02-18 18:08   ` Henry Li
  2010-02-19  8:44     ` Linus Walleij
  0 siblings, 1 reply; 4+ messages in thread
From: Henry Li @ 2010-02-18 18:08 UTC (permalink / raw)
  To: linux-arm-kernel


On Wed, Feb 17, 2010 at 04:33:00PM -0800, Henry Li wrote:
> Can someone tell me why there is a requirement for the virtual and 
> physical addresses and size using MT_MEMORY memtype (where prot_l1=0) 
> to be aligned to section boundary (1MB) in 
> linux-2.6.32/arch/arm/mm/mmu.c/create_mapping
> during IO table init?

Because today SDRAM is always a whole number of MB, so its pointless defining it in terms of 4K pages.  MT_MEMORY is not for general purpose use, but only for setting up the initial kernel SDRAM mapping.

>> I see. The platform I am working with has 160kB of SRAM that I need to map as cacheable and shareable but its physical address is not 1MB aligned.  Is there suitable memtype that I could use to map this?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Alignment Requirement for MT_MEMORY type
  2010-02-18 18:08   ` Henry Li
@ 2010-02-19  8:44     ` Linus Walleij
  0 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2010-02-19  8:44 UTC (permalink / raw)
  To: linux-arm-kernel

2010/2/18 Henry Li <hli@broadcom.com>:
> On Wed, Feb 17, 2010 at 04:33:00PM -0800, Henry Li wrote:
>>> Can someone tell me why there is a requirement for the virtual and
>>> physical addresses and size using MT_MEMORY memtype (where prot_l1=0)
>>> to be aligned to section boundary (1MB) in
>>> linux-2.6.32/arch/arm/mm/mmu.c/create_mapping
>>> during IO table init?

>> Because today SDRAM is always a whole number of MB, so its pointless
>> defining it in terms of 4K pages. ?MT_MEMORY is not for general purpose
>> use, but only for setting up the initial kernel SDRAM mapping.

> I see. The platform I am working with has 160kB of SRAM that I need
> to map as cacheable and shareable but its physical address is not 1MB
> aligned. ?Is there suitable memtype that I could use to map this?

I don't know just what you're trying to do, but is this some kind of
fast on-chip RAM, that's not in a separate capsule?

In that case you might want to examine the solution used for
the OMAP on-chip SRAM at:
arch/arm/plat-omap/sram.c
Or the solution we chose for the TCM memory close to the L1
caches in ARM systems:
arch/arm/kernel/tcm.c

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-02-19  8:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-18  0:33 Alignment Requirement for MT_MEMORY type Henry Li
2010-02-18  8:51 ` Russell King - ARM Linux
2010-02-18 18:08   ` Henry Li
2010-02-19  8:44     ` Linus Walleij

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.