From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v6 00/18] ARM: Add support for the Large Physical Address Extensions
Date: Sat, 2 Jul 2011 13:19:28 +0100 [thread overview]
Message-ID: <20110702121928.GG21898@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <20110701162419.GA3990@1n450.cable.virginmedia.net>
On Fri, Jul 01, 2011 at 05:24:19PM +0100, Catalin Marinas wrote:
> Hi Russell,
>
> On Tue, May 24, 2011 at 10:39:06PM +0100, Catalin Marinas wrote:
> > Catalin Marinas (14):
> > ARM: LPAE: Use long long printk format for displaying the pud
Ok.
> > ARM: LPAE: Use unsigned long for __phys_to_virt and __virt_to_phys
I don't like this; these macros are supposed to take unsigned long
arguments (the hint is in their non-__ versions and __[vp]a, which
contain the explicit casts.) I'd much rather have their callers
reduced in number, especially as this is a macro which platform classes
may (and do) define.
There are five places which use __phys_to_virt and one place which uses
__virt_to_phys.
Of the __virt_to_phys, this takes a u32 argument anyway, so that won't
cause any concerns.
Of the __phys_to_virt, the L2 cache handing files can use a void * for
vaddr and use the standard phys_to_virt(). That leaves three in the core
arch code, which can be dealt with by local casting.
> > ARM: LPAE: Use PMD_(SHIFT|SIZE|MASK) instead of PGDIR_*
This one I think is fine, except the dependency on what we do about the
dma coherent code... Also, see the patch below which is something I've
been thinking about to avoid the multiple-walking of the page table tree.
However, can we guarantee what the L1 page table in LPAE will contain?
> > ARM: LPAE: Factor out 2-level page table definitions into separate
> > files
> > ARM: LPAE: Add (pte|pmd|pgd|pgprot)val_t type definitions as u32
I'm unconvinced that this is the right solution to add all these val_t
types, especially as u32. It also creates some nonsense like assigning
pmdval_t values to pgprotval_t, and misses converting some other stuff
too.
> > ARM: LPAE: Use a mask for physical addresses in page table entries
> [...]
> > Will Deacon (4):
> > ARM: LPAE: add ISBs around MMU enabling code
I still don't like this one - and I do think there's a solution without
having to resort to isb there. This also affects the cpu resume code
too.
> > ARM: LPAE: Use generic dma_addr_t type definition
This is already the case since:
commit 8547727756a7322b99aa313ce50fe15d8f858872
Author: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Date: Wed Mar 23 16:43:28 2011 -0700
remove dma64_addr_t
> Since the core LPAE patches haven't got a proper review yet, would you
> please consider merging some of the LPAE preparation patches during the
> upcoming window? Above is a list that I think it's relatively trivial
> (or we can have an even smaller set of patches, any progress would be
> good).
>
> Thanks.
>
> --
> Catalin
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 6e7f67f..1892c3d 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -862,6 +862,29 @@ static void __init sanity_check_meminfo(void)
meminfo.nr_banks = j;
}
+static inline void pmd_clear_range(pgd_t *pgd, unsigned long addr, unsigned long end)
+{
+ pmd_t *pmd;
+
+ pmd = pmd_offset(pgd, addr);
+ do {
+ addr = pmd_addr_end(addr, end);
+ pmd_clear(pmd);
+ } while (pmd++, addr != end);
+}
+
+static void pgd_clear_range(unsigned long addr, unsigned long end)
+{
+ unsigned long next;
+ pgd_t *pgd;
+
+ pgd = pgd_offset_k(addr);
+ do {
+ next = pgd_addr_end(addr, end);
+ pmd_clear_range(pgd, addr, next);
+ } while (pgd++, addr = next, addr != end);
+}
+
static inline void prepare_page_table(void)
{
unsigned long addr;
@@ -870,15 +893,15 @@ static inline void prepare_page_table(void)
/*
* Clear out all the mappings below the kernel image.
*/
- for (addr = 0; addr < MODULES_VADDR; addr += PGDIR_SIZE)
- pmd_clear(pmd_off_k(addr));
+ pgd_clear_range(0, MODULES_VADDR);
#ifdef CONFIG_XIP_KERNEL
/* The XIP kernel is mapped in the module area -- skip over it */
addr = ((unsigned long)_etext + PGDIR_SIZE - 1) & PGDIR_MASK;
+#else
+ addr = MODULES_VADDR;
#endif
- for ( ; addr < PAGE_OFFSET; addr += PGDIR_SIZE)
- pmd_clear(pmd_off_k(addr));
+ pgd_clear_range(addr, PAGE_OFFSET);
/*
* Find the end of the first block of lowmem.
@@ -891,9 +914,7 @@ static inline void prepare_page_table(void)
* Clear out all the kernel space mappings, except for the first
* memory bank, up to the end of the vmalloc region.
*/
- for (addr = __phys_to_virt(end);
- addr < VMALLOC_END; addr += PGDIR_SIZE)
- pmd_clear(pmd_off_k(addr));
+ pgd_clear_range(__phys_to_virt(end), VMALLOC_END);
}
/*
WARNING: multiple messages have this Message-ID (diff)
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v6 00/18] ARM: Add support for the Large Physical Address Extensions
Date: Sat, 2 Jul 2011 13:19:28 +0100 [thread overview]
Message-ID: <20110702121928.GG21898@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <20110701162419.GA3990@1n450.cable.virginmedia.net>
On Fri, Jul 01, 2011 at 05:24:19PM +0100, Catalin Marinas wrote:
> Hi Russell,
>
> On Tue, May 24, 2011 at 10:39:06PM +0100, Catalin Marinas wrote:
> > Catalin Marinas (14):
> > ARM: LPAE: Use long long printk format for displaying the pud
Ok.
> > ARM: LPAE: Use unsigned long for __phys_to_virt and __virt_to_phys
I don't like this; these macros are supposed to take unsigned long
arguments (the hint is in their non-__ versions and __[vp]a, which
contain the explicit casts.) I'd much rather have their callers
reduced in number, especially as this is a macro which platform classes
may (and do) define.
There are five places which use __phys_to_virt and one place which uses
__virt_to_phys.
Of the __virt_to_phys, this takes a u32 argument anyway, so that won't
cause any concerns.
Of the __phys_to_virt, the L2 cache handing files can use a void * for
vaddr and use the standard phys_to_virt(). That leaves three in the core
arch code, which can be dealt with by local casting.
> > ARM: LPAE: Use PMD_(SHIFT|SIZE|MASK) instead of PGDIR_*
This one I think is fine, except the dependency on what we do about the
dma coherent code... Also, see the patch below which is something I've
been thinking about to avoid the multiple-walking of the page table tree.
However, can we guarantee what the L1 page table in LPAE will contain?
> > ARM: LPAE: Factor out 2-level page table definitions into separate
> > files
> > ARM: LPAE: Add (pte|pmd|pgd|pgprot)val_t type definitions as u32
I'm unconvinced that this is the right solution to add all these val_t
types, especially as u32. It also creates some nonsense like assigning
pmdval_t values to pgprotval_t, and misses converting some other stuff
too.
> > ARM: LPAE: Use a mask for physical addresses in page table entries
> [...]
> > Will Deacon (4):
> > ARM: LPAE: add ISBs around MMU enabling code
I still don't like this one - and I do think there's a solution without
having to resort to isb there. This also affects the cpu resume code
too.
> > ARM: LPAE: Use generic dma_addr_t type definition
This is already the case since:
commit 8547727756a7322b99aa313ce50fe15d8f858872
Author: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Date: Wed Mar 23 16:43:28 2011 -0700
remove dma64_addr_t
> Since the core LPAE patches haven't got a proper review yet, would you
> please consider merging some of the LPAE preparation patches during the
> upcoming window? Above is a list that I think it's relatively trivial
> (or we can have an even smaller set of patches, any progress would be
> good).
>
> Thanks.
>
> --
> Catalin
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 6e7f67f..1892c3d 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -862,6 +862,29 @@ static void __init sanity_check_meminfo(void)
meminfo.nr_banks = j;
}
+static inline void pmd_clear_range(pgd_t *pgd, unsigned long addr, unsigned long end)
+{
+ pmd_t *pmd;
+
+ pmd = pmd_offset(pgd, addr);
+ do {
+ addr = pmd_addr_end(addr, end);
+ pmd_clear(pmd);
+ } while (pmd++, addr != end);
+}
+
+static void pgd_clear_range(unsigned long addr, unsigned long end)
+{
+ unsigned long next;
+ pgd_t *pgd;
+
+ pgd = pgd_offset_k(addr);
+ do {
+ next = pgd_addr_end(addr, end);
+ pmd_clear_range(pgd, addr, next);
+ } while (pgd++, addr = next, addr != end);
+}
+
static inline void prepare_page_table(void)
{
unsigned long addr;
@@ -870,15 +893,15 @@ static inline void prepare_page_table(void)
/*
* Clear out all the mappings below the kernel image.
*/
- for (addr = 0; addr < MODULES_VADDR; addr += PGDIR_SIZE)
- pmd_clear(pmd_off_k(addr));
+ pgd_clear_range(0, MODULES_VADDR);
#ifdef CONFIG_XIP_KERNEL
/* The XIP kernel is mapped in the module area -- skip over it */
addr = ((unsigned long)_etext + PGDIR_SIZE - 1) & PGDIR_MASK;
+#else
+ addr = MODULES_VADDR;
#endif
- for ( ; addr < PAGE_OFFSET; addr += PGDIR_SIZE)
- pmd_clear(pmd_off_k(addr));
+ pgd_clear_range(addr, PAGE_OFFSET);
/*
* Find the end of the first block of lowmem.
@@ -891,9 +914,7 @@ static inline void prepare_page_table(void)
* Clear out all the kernel space mappings, except for the first
* memory bank, up to the end of the vmalloc region.
*/
- for (addr = __phys_to_virt(end);
- addr < VMALLOC_END; addr += PGDIR_SIZE)
- pmd_clear(pmd_off_k(addr));
+ pgd_clear_range(__phys_to_virt(end), VMALLOC_END);
}
/*
next prev parent reply other threads:[~2011-07-02 12:19 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-24 21:39 [PATCH v6 00/18] ARM: Add support for the Large Physical Address Extensions Catalin Marinas
2011-05-24 21:39 ` Catalin Marinas
2011-05-24 21:39 ` [PATCH v6 01/18] ARM: LPAE: Use long long printk format for displaying the pud Catalin Marinas
2011-05-24 21:39 ` Catalin Marinas
2011-05-24 21:39 ` [PATCH v6 02/18] ARM: LPAE: add ISBs around MMU enabling code Catalin Marinas
2011-05-24 21:39 ` Catalin Marinas
2011-05-24 21:39 ` [PATCH v6 03/18] ARM: LPAE: Use unsigned long for __phys_to_virt and __virt_to_phys Catalin Marinas
2011-05-24 21:39 ` Catalin Marinas
2011-05-24 21:39 ` [PATCH v6 04/18] ARM: LPAE: Use PMD_(SHIFT|SIZE|MASK) instead of PGDIR_* Catalin Marinas
2011-05-24 21:39 ` Catalin Marinas
2011-05-24 21:39 ` [PATCH v6 05/18] ARM: LPAE: Factor out 2-level page table definitions into separate files Catalin Marinas
2011-05-24 21:39 ` Catalin Marinas
2011-05-24 21:39 ` [PATCH v6 06/18] ARM: LPAE: Add (pte|pmd|pgd|pgprot)val_t type definitions as u32 Catalin Marinas
2011-05-24 21:39 ` Catalin Marinas
2011-05-24 21:39 ` [PATCH v6 07/18] ARM: LPAE: Use a mask for physical addresses in page table entries Catalin Marinas
2011-05-24 21:39 ` Catalin Marinas
2011-05-24 21:39 ` [PATCH v6 08/18] ARM: LPAE: Introduce the 3-level page table format definitions Catalin Marinas
2011-05-24 21:39 ` Catalin Marinas
2011-05-24 21:39 ` [PATCH v6 09/18] ARM: LPAE: Page table maintenance for the 3-level format Catalin Marinas
2011-05-24 21:39 ` Catalin Marinas
2011-05-24 21:39 ` [PATCH v6 10/18] ARM: LPAE: MMU setup for the 3-level page table format Catalin Marinas
2011-05-24 21:39 ` Catalin Marinas
2011-05-24 21:39 ` [PATCH v6 11/18] ARM: LPAE: Invalidate the TLB before freeing the PMD Catalin Marinas
2011-05-24 21:39 ` Catalin Marinas
2011-05-24 21:39 ` [PATCH v6 12/18] ARM: LPAE: Add fault handling support Catalin Marinas
2011-05-24 21:39 ` Catalin Marinas
2011-05-24 21:39 ` [PATCH v6 13/18] ARM: LPAE: Add context switching support Catalin Marinas
2011-05-24 21:39 ` Catalin Marinas
2011-05-24 21:39 ` [PATCH v6 14/18] ARM: LPAE: Add identity mapping support for the 3-level page table format Catalin Marinas
2011-05-24 21:39 ` Catalin Marinas
2011-05-24 21:39 ` [PATCH v6 15/18] ARM: LPAE: Use generic dma_addr_t type definition Catalin Marinas
2011-05-24 21:39 ` Catalin Marinas
2011-05-24 21:39 ` [PATCH v6 16/18] ARM: LPAE: mark memory banks with start > ULONG_MAX as highmem Catalin Marinas
2011-05-24 21:39 ` Catalin Marinas
2011-05-24 21:39 ` [PATCH v6 17/18] ARM: LPAE: add support for ATAG_MEM64 Catalin Marinas
2011-05-24 21:39 ` Catalin Marinas
2011-05-24 21:39 ` [PATCH v6 18/18] ARM: LPAE: Add the Kconfig entries Catalin Marinas
2011-05-24 21:39 ` Catalin Marinas
2011-05-24 23:56 ` [PATCH v6 00/18] ARM: Add support for the Large Physical Address Extensions David Brown
2011-05-24 23:56 ` David Brown
2011-05-25 0:44 ` Nicolas Pitre
2011-05-25 0:44 ` Nicolas Pitre
2011-05-25 11:10 ` Arnd Bergmann
2011-05-25 11:10 ` Arnd Bergmann
2011-05-25 11:22 ` Catalin Marinas
2011-05-25 11:22 ` Catalin Marinas
2011-05-25 12:43 ` Catalin Marinas
2011-05-25 12:43 ` Catalin Marinas
2011-05-25 8:33 ` Catalin Marinas
2011-05-25 8:33 ` Catalin Marinas
2011-07-01 16:24 ` Catalin Marinas
2011-07-01 16:24 ` Catalin Marinas
2011-07-02 12:19 ` Russell King - ARM Linux [this message]
2011-07-02 12:19 ` Russell King - ARM Linux
2011-07-04 17:23 ` Catalin Marinas
2011-07-04 17:23 ` Catalin Marinas
2011-07-08 19:21 ` Russell King - ARM Linux
2011-07-08 19:21 ` Russell King - ARM Linux
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=20110702121928.GG21898@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--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 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.