Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 17/19] ARM: simplify __iounmap() when dealing with section based mapping
From: Nicolas Pitre @ 2011-09-16  7:07 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1316156850-31013-1-git-send-email-nico@fluxnic.net>

From: Nicolas Pitre <nicolas.pitre@linaro.org>

Firstly, there is no need to have a double pointer here as we're only
walking the vmlist and not modifying it.

Secondly, for the same reason, we don't need a write lock but only a
read lock here, since the lock only protects the coherency of the list
nothing else.

Lastly, the reason for holding a lock is not what the comment says, so
let's remove that misleading piece of information.

Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
---
 arch/arm/mm/ioremap.c |   20 +++++++++-----------
 1 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
index ab506272b2..1ddcd8aa34 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -293,26 +293,24 @@ void __iounmap(volatile void __iomem *io_addr)
 {
 	void *addr = (void *)(PAGE_MASK & (unsigned long)io_addr);
 #ifndef CONFIG_SMP
-	struct vm_struct **p, *tmp;
+	struct vm_struct *vm;
 
 	/*
 	 * If this is a section based mapping we need to handle it
 	 * specially as the VM subsystem does not know how to handle
-	 * such a beast. We need the lock here b/c we need to clear
-	 * all the mappings before the area can be reclaimed
-	 * by someone else.
+	 * such a beast.
 	 */
-	write_lock(&vmlist_lock);
-	for (p = &vmlist ; (tmp = *p) ; p = &tmp->next) {
-		if ((tmp->flags & VM_IOREMAP) && (tmp->addr == addr)) {
-			if (tmp->flags & VM_ARM_SECTION_MAPPING) {
-				unmap_area_sections((unsigned long)tmp->addr,
-						    tmp->size);
+	read_lock(&vmlist_lock);
+	for (vm = vmlist; vm; vm = vm->next) {
+		if ((vm->flags & VM_IOREMAP) && (vm->addr == addr)) {
+			if (vm->flags & VM_ARM_SECTION_MAPPING) {
+				unmap_area_sections((unsigned long)vm->addr,
+						    vm->size);
 			}
 			break;
 		}
 	}
-	write_unlock(&vmlist_lock);
+	read_unlock(&vmlist_lock);
 #endif
 
 	vunmap(addr);
-- 
1.7.7-rc0

^ permalink raw reply related

* [PATCH 16/19] ARM: move iotable mappings within the vmalloc region
From: Nicolas Pitre @ 2011-09-16  7:07 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1316156850-31013-1-git-send-email-nico@fluxnic.net>

From: Nicolas Pitre <nicolas.pitre@linaro.org>

In order to remove the build time variation between different SOCs with
regards to VMALLOC_END, the iotable mappings are now allocated inside
the vmalloc region.  This allows for VMALLOC_END to be identical across
all machines.

Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
---
 arch/arm/include/asm/pgtable.h |    8 +------
 arch/arm/mm/mmu.c              |   42 +++++++++++++++++++++++++++++----------
 2 files changed, 32 insertions(+), 18 deletions(-)

diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h
index 5750704e02..950dee3ce2 100644
--- a/arch/arm/include/asm/pgtable.h
+++ b/arch/arm/include/asm/pgtable.h
@@ -21,7 +21,6 @@
 #else
 
 #include <asm/memory.h>
-#include <mach/vmalloc.h>
 #include <asm/pgtable-hwdef.h>
 
 /*
@@ -31,15 +30,10 @@
  * any out-of-bounds memory accesses will hopefully be caught.
  * The vmalloc() routines leaves a hole of 4kB between each vmalloced
  * area for the same reason. ;)
- *
- * Note that platforms may override VMALLOC_START, but they must provide
- * VMALLOC_END.  VMALLOC_END defines the (exclusive) limit of this space,
- * which may not overlap IO space.
  */
-#ifndef VMALLOC_START
 #define VMALLOC_OFFSET		(8*1024*1024)
 #define VMALLOC_START		(((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1))
-#endif
+#define VMALLOC_END		0xff000000UL
 
 /*
  * Hardware-wise, we have a two level page table structure, where the first
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 594d677b92..6996576488 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -15,6 +15,7 @@
 #include <linux/nodemask.h>
 #include <linux/memblock.h>
 #include <linux/fs.h>
+#include <linux/vmalloc.h>
 
 #include <asm/cputype.h>
 #include <asm/sections.h>
@@ -677,9 +678,10 @@ static void __init create_mapping(struct map_desc *md)
 	}
 
 	if ((md->type == MT_DEVICE || md->type == MT_ROM) &&
-	    md->virtual >= PAGE_OFFSET && md->virtual < VMALLOC_END) {
+	    md->virtual >= PAGE_OFFSET &&
+	    (md->virtual < VMALLOC_START || md->virtual >= VMALLOC_END)) {
 		printk(KERN_WARNING "BUG: mapping for 0x%08llx"
-		       " at 0x%08lx overlaps vmalloc space\n",
+		       " at 0x%08lx out of vmalloc space\n",
 		       (long long)__pfn_to_phys((u64)md->pfn), md->virtual);
 	}
 
@@ -721,18 +723,29 @@ static void __init create_mapping(struct map_desc *md)
  */
 void __init iotable_init(struct map_desc *io_desc, int nr)
 {
-	int i;
+	struct map_desc *md;
+	struct vm_struct *vm;
+
+	vm = __va(memblock_alloc(sizeof(*vm) * nr, __alignof__(*vm)));
+	memset(vm, 0, sizeof(*vm) * nr);
 
-	for (i = 0; i < nr; i++)
-		create_mapping(io_desc + i);
+	for (md = io_desc; nr; md++, nr--) {
+		create_mapping(md);
+		vm->addr = (void *)(md->virtual & PAGE_MASK);
+		vm->size = PAGE_ALIGN(md->length + (md->virtual & ~PAGE_MASK));
+		vm->phys_addr = __pfn_to_phys(md->pfn); 
+		vm->flags = VM_IOREMAP;
+		vm->caller = iotable_init;
+		vm_area_add_early(vm++);
+	}
 }
 
-static void * __initdata vmalloc_min = (void *)(VMALLOC_END - SZ_128M);
+static void * __initdata vmalloc_min = (void *)(0xf0000000UL - VMALLOC_OFFSET);
 
 /*
  * vmalloc=size forces the vmalloc area to be exactly 'size'
  * bytes. This can be used to increase (or decrease) the vmalloc
- * area - the default is 128m.
+ * area - the default is 240m.
  */
 static int __init early_vmalloc(char *arg)
 {
@@ -853,6 +866,7 @@ void __init sanity_check_meminfo(void)
 #endif
 	meminfo.nr_banks = j;
 	memblock_set_current_limit(lowmem_limit);
+	high_memory = __va(lowmem_limit - 1) + 1;
 }
 
 static inline void prepare_page_table(void)
@@ -882,10 +896,10 @@ 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.
+	 * memory bank, up to the vmalloc region.
 	 */
 	for (addr = __phys_to_virt(end);
-	     addr < VMALLOC_END; addr += PGDIR_SIZE)
+	     addr < VMALLOC_START; addr += PGDIR_SIZE)
 		pmd_clear(pmd_off_k(addr));
 }
 
@@ -910,8 +924,8 @@ void __init arm_mm_memblock_reserve(void)
 }
 
 /*
- * Set up device the mappings.  Since we clear out the page tables for all
- * mappings above VMALLOC_END, we will remove any debug device mappings.
+ * Set up the device mappings.  Since we clear out the page tables for all
+ * mappings below VMALLOC_END, we will remove any debug device mappings.
  * This means you have to be careful how you debug this function, or any
  * called function.  This means you can't use any function or debugging
  * method which may touch any device, otherwise the kernel _will_ crash.
@@ -977,6 +991,12 @@ static void __init devicemaps_init(struct machine_desc *mdesc)
 	}
 
 	/*
+	 * Clear the vmalloc area.
+	 */
+	for (addr = VMALLOC_START; addr < VMALLOC_END; addr += PGDIR_SIZE)
+		pmd_clear(pmd_off_k(addr));
+
+	/*
 	 * Ask the machine support to map in the statically mapped devices.
 	 */
 	if (mdesc->map_io)
-- 
1.7.7-rc0

^ permalink raw reply related

* [PATCH 15/19] mm: add vm_area_add_early()
From: Nicolas Pitre @ 2011-09-16  7:07 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1316156850-31013-1-git-send-email-nico@fluxnic.net>

From: Nicolas Pitre <nicolas.pitre@linaro.org>

The existing vm_area_register_early() allows for early vmalloc space
allocation.  However upcoming cleanups in the ARM architecture require
that some fixed locations in the vmalloc area be reserved also very early.

The name "vm_area_register_early" would have been a good name for the
reservation part without the allocation.  Since it is already in use with
different semantics, let's create vm_area_add_early() instead.

Both vm_area_register_early() and vm_area_add_early() can be used together
meaning that the former is now implemented using the later where it is
ensured that no conflicting areas are added, but no attempt is made to
make the allocation scheme in vm_area_register_early() more sophisticated.
After all, you must know what you're doing when using those functions.

Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Cc: linux-mm at kvack.org
---
 include/linux/vmalloc.h |    1 +
 mm/vmalloc.c            |   28 ++++++++++++++++++++++++++--
 2 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index 9332e52ea8..e7d2cba995 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -130,6 +130,7 @@ extern long vwrite(char *buf, char *addr, unsigned long count);
  */
 extern rwlock_t vmlist_lock;
 extern struct vm_struct *vmlist;
+extern __init void vm_area_add_early(struct vm_struct *vm);
 extern __init void vm_area_register_early(struct vm_struct *vm, size_t align);
 
 #ifdef CONFIG_SMP
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 7ef0903058..bf20a0ff95 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -1118,6 +1118,31 @@ void *vm_map_ram(struct page **pages, unsigned int count, int node, pgprot_t pro
 EXPORT_SYMBOL(vm_map_ram);
 
 /**
+ * vm_area_add_early - add vmap area early during boot
+ * @vm: vm_struct to add
+ *
+ * This function is used to add fixed kernel vm area to vmlist before
+ * vmalloc_init() is called.  @vm->addr, @vm->size, and @vm->flags
+ * should contain proper values and the other fields should be zero.
+ *
+ * DO NOT USE THIS FUNCTION UNLESS YOU KNOW WHAT YOU'RE DOING.
+ */
+void __init vm_area_add_early(struct vm_struct *vm)
+{
+	struct vm_struct *tmp, **p;
+
+	for (p = &vmlist; (tmp = *p) != NULL; p = &tmp->next) {
+		if (tmp->addr >= vm->addr) {
+			BUG_ON(tmp->addr < vm->addr + vm->size);
+			break;
+		} else
+			BUG_ON(tmp->addr + tmp->size > vm->addr);
+	}
+	vm->next = *p;
+	*p = vm;
+}
+
+/**
  * vm_area_register_early - register vmap area early during boot
  * @vm: vm_struct to register
  * @align: requested alignment
@@ -1139,8 +1164,7 @@ void __init vm_area_register_early(struct vm_struct *vm, size_t align)
 
 	vm->addr = (void *)addr;
 
-	vm->next = vmlist;
-	vmlist = vm;
+	vm_area_add_early(vm);
 }
 
 void __init vmalloc_init(void)
-- 
1.7.7-rc0

^ permalink raw reply related

* [PATCH 14/19] ARM: plat-iop: remove arch specific special handling for ioremap
From: Nicolas Pitre @ 2011-09-16  7:07 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1316156850-31013-1-git-send-email-nico@fluxnic.net>

From: Nicolas Pitre <nicolas.pitre@linaro.org>

A generic version should replace this later.

Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
---
 arch/arm/mach-iop32x/include/mach/io.h |    7 ----
 arch/arm/mach-iop33x/include/mach/io.h |    7 ----
 arch/arm/plat-iop/Makefile             |    2 -
 arch/arm/plat-iop/io.c                 |   59 --------------------------------
 4 files changed, 0 insertions(+), 75 deletions(-)
 delete mode 100644 arch/arm/plat-iop/io.c

diff --git a/arch/arm/mach-iop32x/include/mach/io.h b/arch/arm/mach-iop32x/include/mach/io.h
index 059c783ce0..2d88264b98 100644
--- a/arch/arm/mach-iop32x/include/mach/io.h
+++ b/arch/arm/mach-iop32x/include/mach/io.h
@@ -13,15 +13,8 @@
 
 #include <asm/hardware/iop3xx.h>
 
-extern void __iomem *__iop3xx_ioremap(unsigned long cookie, size_t size,
-	unsigned int mtype);
-extern void __iop3xx_iounmap(void __iomem *addr);
-
 #define IO_SPACE_LIMIT		0xffffffff
 #define __io(p)		((void __iomem *)IOP3XX_PCI_IO_PHYS_TO_VIRT(p))
 #define __mem_pci(a)		(a)
 
-#define __arch_ioremap	__iop3xx_ioremap
-#define __arch_iounmap	__iop3xx_iounmap
-
 #endif
diff --git a/arch/arm/mach-iop33x/include/mach/io.h b/arch/arm/mach-iop33x/include/mach/io.h
index 39e893e97c..a8a66fc8fb 100644
--- a/arch/arm/mach-iop33x/include/mach/io.h
+++ b/arch/arm/mach-iop33x/include/mach/io.h
@@ -13,15 +13,8 @@
 
 #include <asm/hardware/iop3xx.h>
 
-extern void __iomem *__iop3xx_ioremap(unsigned long cookie, size_t size,
-	unsigned int mtype);
-extern void __iop3xx_iounmap(void __iomem *addr);
-
 #define IO_SPACE_LIMIT		0xffffffff
 #define __io(p)		((void __iomem *)IOP3XX_PCI_IO_PHYS_TO_VIRT(p))
 #define __mem_pci(a)		(a)
 
-#define __arch_ioremap	__iop3xx_ioremap
-#define __arch_iounmap	__iop3xx_iounmap
-
 #endif
diff --git a/arch/arm/plat-iop/Makefile b/arch/arm/plat-iop/Makefile
index 69b09c1cec..90f7153a8d 100644
--- a/arch/arm/plat-iop/Makefile
+++ b/arch/arm/plat-iop/Makefile
@@ -10,7 +10,6 @@ obj-$(CONFIG_ARCH_IOP32X) += i2c.o
 obj-$(CONFIG_ARCH_IOP32X) += pci.o
 obj-$(CONFIG_ARCH_IOP32X) += setup.o
 obj-$(CONFIG_ARCH_IOP32X) += time.o
-obj-$(CONFIG_ARCH_IOP32X) += io.o
 obj-$(CONFIG_ARCH_IOP32X) += cp6.o
 obj-$(CONFIG_ARCH_IOP32X) += adma.o
 obj-$(CONFIG_ARCH_IOP32X) += pmu.o
@@ -21,7 +20,6 @@ obj-$(CONFIG_ARCH_IOP33X) += i2c.o
 obj-$(CONFIG_ARCH_IOP33X) += pci.o
 obj-$(CONFIG_ARCH_IOP33X) += setup.o
 obj-$(CONFIG_ARCH_IOP33X) += time.o
-obj-$(CONFIG_ARCH_IOP33X) += io.o
 obj-$(CONFIG_ARCH_IOP33X) += cp6.o
 obj-$(CONFIG_ARCH_IOP33X) += adma.o
 obj-$(CONFIG_ARCH_IOP33X) += pmu.o
diff --git a/arch/arm/plat-iop/io.c b/arch/arm/plat-iop/io.c
deleted file mode 100644
index e15bc17db9..0000000000
--- a/arch/arm/plat-iop/io.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * iop3xx custom ioremap implementation
- * Copyright (c) 2006, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place - Suite 330, Boston, MA 02111-1307 USA.
- *
- */
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/io.h>
-#include <mach/hardware.h>
-
-void * __iomem __iop3xx_ioremap(unsigned long cookie, size_t size,
-	unsigned int mtype)
-{
-	void __iomem * retval;
-
-	switch (cookie) {
-	case IOP3XX_PCI_LOWER_IO_PA ... IOP3XX_PCI_UPPER_IO_PA:
-		retval = (void *) IOP3XX_PCI_IO_PHYS_TO_VIRT(cookie);
-		break;
-	case IOP3XX_PERIPHERAL_PHYS_BASE ... IOP3XX_PERIPHERAL_UPPER_PA:
-		retval = (void *) IOP3XX_PMMR_PHYS_TO_VIRT(cookie);
-		break;
-	default:
-		retval = __arm_ioremap_caller(cookie, size, mtype,
-				__builtin_return_address(0));
-	}
-
-	return retval;
-}
-EXPORT_SYMBOL(__iop3xx_ioremap);
-
-void __iop3xx_iounmap(void __iomem *addr)
-{
-	extern void __iounmap(volatile void __iomem *addr);
-
-	switch ((u32) addr) {
-	case IOP3XX_PCI_LOWER_IO_VA ... IOP3XX_PCI_UPPER_IO_VA:
-	case IOP3XX_PERIPHERAL_VIRT_BASE ... IOP3XX_PERIPHERAL_UPPER_VA:
-		goto skip;
-	}
-	__iounmap(addr);
-
-skip:
-	return;
-}
-EXPORT_SYMBOL(__iop3xx_iounmap);
-- 
1.7.7-rc0

^ permalink raw reply related

* [PATCH 13/19] ARM: mach-ixp23xx: remove arch specific special handling for ioremap
From: Nicolas Pitre @ 2011-09-16  7:07 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1316156850-31013-1-git-send-email-nico@fluxnic.net>

From: Nicolas Pitre <nicolas.pitre@linaro.org>

A generic version should replace this later.

Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
---
 arch/arm/mach-ixp23xx/include/mach/io.h |   29 -----------------------------
 1 files changed, 0 insertions(+), 29 deletions(-)

diff --git a/arch/arm/mach-ixp23xx/include/mach/io.h b/arch/arm/mach-ixp23xx/include/mach/io.h
index a1749d0fd8..4ce4353b9f 100644
--- a/arch/arm/mach-ixp23xx/include/mach/io.h
+++ b/arch/arm/mach-ixp23xx/include/mach/io.h
@@ -20,33 +20,4 @@
 #define __io(p)		((void __iomem*)((p) + IXP23XX_PCI_IO_VIRT))
 #define __mem_pci(a)	(a)
 
-static inline void __iomem *
-ixp23xx_ioremap(unsigned long addr, unsigned long size, unsigned int mtype)
-{
-	if (addr >= IXP23XX_PCI_MEM_START &&
-		addr <= IXP23XX_PCI_MEM_START + IXP23XX_PCI_MEM_SIZE) {
-		if (addr + size > IXP23XX_PCI_MEM_START + IXP23XX_PCI_MEM_SIZE)
-			return NULL;
-
-		return (void __iomem *)
- 			((addr - IXP23XX_PCI_MEM_START) + IXP23XX_PCI_MEM_VIRT);
-	}
-
-	return __arm_ioremap(addr, size, mtype);
-}
-
-static inline void
-ixp23xx_iounmap(void __iomem *addr)
-{
-	if ((((u32)addr) >= IXP23XX_PCI_MEM_VIRT) &&
-	    (((u32)addr) < IXP23XX_PCI_MEM_VIRT + IXP23XX_PCI_MEM_SIZE))
-		return;
-
-	__iounmap(addr);
-}
-
-#define __arch_ioremap	ixp23xx_ioremap
-#define __arch_iounmap	ixp23xx_iounmap
-
-
 #endif
-- 
1.7.7-rc0

^ permalink raw reply related

* [PATCH 12/19] ARM: mach-kirkwood: remove arch specific special handling for ioremap
From: Nicolas Pitre @ 2011-09-16  7:07 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1316156850-31013-1-git-send-email-nico@fluxnic.net>

From: Nicolas Pitre <nicolas.pitre@linaro.org>

A generic version should replace this later.

Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
---
 arch/arm/mach-kirkwood/include/mach/io.h |   25 -------------------------
 1 files changed, 0 insertions(+), 25 deletions(-)

diff --git a/arch/arm/mach-kirkwood/include/mach/io.h b/arch/arm/mach-kirkwood/include/mach/io.h
index 1aaddc364f..49dd0cb5e1 100644
--- a/arch/arm/mach-kirkwood/include/mach/io.h
+++ b/arch/arm/mach-kirkwood/include/mach/io.h
@@ -19,31 +19,6 @@ static inline void __iomem *__io(unsigned long addr)
 					+ KIRKWOOD_PCIE_IO_VIRT_BASE);
 }
 
-static inline void __iomem *
-__arch_ioremap(unsigned long paddr, size_t size, unsigned int mtype)
-{
-	void __iomem *retval;
-	unsigned long offs = paddr - KIRKWOOD_REGS_PHYS_BASE;
-	if (mtype == MT_DEVICE && size && offs < KIRKWOOD_REGS_SIZE &&
-	    size <= KIRKWOOD_REGS_SIZE && offs + size <= KIRKWOOD_REGS_SIZE) {
-		retval = (void __iomem *)KIRKWOOD_REGS_VIRT_BASE + offs;
-	} else {
-		retval = __arm_ioremap(paddr, size, mtype);
-	}
-
-	return retval;
-}
-
-static inline void
-__arch_iounmap(void __iomem *addr)
-{
-	if (addr < (void __iomem *)KIRKWOOD_REGS_VIRT_BASE ||
-	    addr >= (void __iomem *)(KIRKWOOD_REGS_VIRT_BASE + KIRKWOOD_REGS_SIZE))
-		__iounmap(addr);
-}
-
-#define __arch_ioremap		__arch_ioremap
-#define __arch_iounmap		__arch_iounmap
 #define __io(a)			__io(a)
 #define __mem_pci(a)		(a)
 
-- 
1.7.7-rc0

^ permalink raw reply related

* [PATCH 11/19] ARM: mach-orion5x: remove arch specific special handling for ioremap
From: Nicolas Pitre @ 2011-09-16  7:07 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1316156850-31013-1-git-send-email-nico@fluxnic.net>

From: Nicolas Pitre <nicolas.pitre@linaro.org>

A generic version should replace this later.

Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
---
 arch/arm/mach-orion5x/include/mach/io.h |   25 -------------------------
 1 files changed, 0 insertions(+), 25 deletions(-)

diff --git a/arch/arm/mach-orion5x/include/mach/io.h b/arch/arm/mach-orion5x/include/mach/io.h
index c5196101a2..e9d9afdc26 100644
--- a/arch/arm/mach-orion5x/include/mach/io.h
+++ b/arch/arm/mach-orion5x/include/mach/io.h
@@ -15,31 +15,6 @@
 
 #define IO_SPACE_LIMIT		0xffffffff
 
-static inline void __iomem *
-__arch_ioremap(unsigned long paddr, size_t size, unsigned int mtype)
-{
-	void __iomem *retval;
-	unsigned long offs = paddr - ORION5X_REGS_PHYS_BASE;
-	if (mtype == MT_DEVICE && size && offs < ORION5X_REGS_SIZE &&
-	    size <= ORION5X_REGS_SIZE && offs + size <= ORION5X_REGS_SIZE) {
-		retval = (void __iomem *)ORION5X_REGS_VIRT_BASE + offs;
-	} else {
-		retval = __arm_ioremap(paddr, size, mtype);
-	}
-
-	return retval;
-}
-
-static inline void
-__arch_iounmap(void __iomem *addr)
-{
-	if (addr < (void __iomem *)ORION5X_REGS_VIRT_BASE ||
-	    addr >= (void __iomem *)(ORION5X_REGS_VIRT_BASE + ORION5X_REGS_SIZE))
-		__iounmap(addr);
-}
-
-#define __arch_ioremap		__arch_ioremap
-#define __arch_iounmap		__arch_iounmap
 #define __io(a)			__typesafe_io(a)
 #define __mem_pci(a)		(a)
 
-- 
1.7.7-rc0

^ permalink raw reply related

* [PATCH 10/19] ARM: mach-bcmring: use proper constant to identify DMA memory area
From: Nicolas Pitre @ 2011-09-16  7:07 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1316156850-31013-1-git-send-email-nico@fluxnic.net>

From: Nicolas Pitre <nicolas.pitre@linaro.org>

Using VMALLOC_END implies a presumption about the layout which is best
avoided, even if in practice this would not change much.

Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
---
 arch/arm/mach-bcmring/dma.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-bcmring/dma.c b/arch/arm/mach-bcmring/dma.c
index 0ca0005066..42021804b9 100644
--- a/arch/arm/mach-bcmring/dma.c
+++ b/arch/arm/mach-bcmring/dma.c
@@ -1613,7 +1613,7 @@ DMA_MemType_t dma_mem_type(void *addr)
 {
 	unsigned long addrVal = (unsigned long)addr;
 
-	if (addrVal >= VMALLOC_END) {
+	if (addrVal >= CONSISTENT_BASE) {
 		/* NOTE: DMA virtual memory space starts at 0xFFxxxxxx */
 
 		/* dma_alloc_xxx pages are physically and virtually contiguous */
-- 
1.7.7-rc0

^ permalink raw reply related

* [PATCH 09/19] ARM: plat-omap: remove arch specific special handling for ioremap
From: Nicolas Pitre @ 2011-09-16  7:07 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1316156850-31013-1-git-send-email-nico@fluxnic.net>

From: Nicolas Pitre <nicolas.pitre@linaro.org>

A generic version should replace this later.

Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
---
 arch/arm/plat-omap/Makefile          |    2 +-
 arch/arm/plat-omap/include/plat/io.h |    6 --
 arch/arm/plat-omap/io.c              |  141 ----------------------------------
 3 files changed, 1 insertions(+), 148 deletions(-)
 delete mode 100644 arch/arm/plat-omap/io.c

diff --git a/arch/arm/plat-omap/Makefile b/arch/arm/plat-omap/Makefile
index f0233e6abc..1db3f2f88c 100644
--- a/arch/arm/plat-omap/Makefile
+++ b/arch/arm/plat-omap/Makefile
@@ -4,7 +4,7 @@
 
 # Common support
 obj-y := common.o sram.o clock.o devices.o dma.o mux.o \
-	 usb.o fb.o io.o counter_32k.o
+	 usb.o fb.o counter_32k.o
 obj-m :=
 obj-n :=
 obj-  :=
diff --git a/arch/arm/plat-omap/include/plat/io.h b/arch/arm/plat-omap/include/plat/io.h
index d72ec85c97..92e6d53ed5 100644
--- a/arch/arm/plat-omap/include/plat/io.h
+++ b/arch/arm/plat-omap/include/plat/io.h
@@ -303,12 +303,6 @@ extern void omap2_init_common_infrastructure(void);
 extern void omap2_init_common_devices(struct omap_sdrc_params *sdrc_cs0,
 				      struct omap_sdrc_params *sdrc_cs1);
 
-#define __arch_ioremap	omap_ioremap
-#define __arch_iounmap	omap_iounmap
-
-void __iomem *omap_ioremap(unsigned long phys, size_t size, unsigned int type);
-void omap_iounmap(volatile void __iomem *addr);
-
 #endif
 
 #endif
diff --git a/arch/arm/plat-omap/io.c b/arch/arm/plat-omap/io.c
deleted file mode 100644
index f1ecfa9fc6..0000000000
--- a/arch/arm/plat-omap/io.c
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Common io.c file
- * This file is created by Russell King <rmk+kernel@arm.linux.org.uk>
- *
- * Copyright (C) 2009 Texas Instruments
- * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/module.h>
-#include <linux/io.h>
-#include <linux/mm.h>
-
-#include <plat/omap7xx.h>
-#include <plat/omap1510.h>
-#include <plat/omap16xx.h>
-#include <plat/omap24xx.h>
-#include <plat/omap34xx.h>
-#include <plat/omap44xx.h>
-
-#define BETWEEN(p,st,sz)	((p) >= (st) && (p) < ((st) + (sz)))
-#define XLATE(p,pst,vst)	((void __iomem *)((p) - (pst) + (vst)))
-
-/*
- * Intercept ioremap() requests for addresses in our fixed mapping regions.
- */
-void __iomem *omap_ioremap(unsigned long p, size_t size, unsigned int type)
-{
-#ifdef CONFIG_ARCH_OMAP1
-	if (cpu_class_is_omap1()) {
-		if (BETWEEN(p, OMAP1_IO_PHYS, OMAP1_IO_SIZE))
-			return XLATE(p, OMAP1_IO_PHYS, OMAP1_IO_VIRT);
-	}
-	if (cpu_is_omap7xx()) {
-		if (BETWEEN(p, OMAP7XX_DSP_BASE, OMAP7XX_DSP_SIZE))
-			return XLATE(p, OMAP7XX_DSP_BASE, OMAP7XX_DSP_START);
-
-		if (BETWEEN(p, OMAP7XX_DSPREG_BASE, OMAP7XX_DSPREG_SIZE))
-			return XLATE(p, OMAP7XX_DSPREG_BASE,
-					OMAP7XX_DSPREG_START);
-	}
-	if (cpu_is_omap15xx()) {
-		if (BETWEEN(p, OMAP1510_DSP_BASE, OMAP1510_DSP_SIZE))
-			return XLATE(p, OMAP1510_DSP_BASE, OMAP1510_DSP_START);
-
-		if (BETWEEN(p, OMAP1510_DSPREG_BASE, OMAP1510_DSPREG_SIZE))
-			return XLATE(p, OMAP1510_DSPREG_BASE,
-					OMAP1510_DSPREG_START);
-	}
-	if (cpu_is_omap16xx()) {
-		if (BETWEEN(p, OMAP16XX_DSP_BASE, OMAP16XX_DSP_SIZE))
-			return XLATE(p, OMAP16XX_DSP_BASE, OMAP16XX_DSP_START);
-
-		if (BETWEEN(p, OMAP16XX_DSPREG_BASE, OMAP16XX_DSPREG_SIZE))
-			return XLATE(p, OMAP16XX_DSPREG_BASE,
-					OMAP16XX_DSPREG_START);
-	}
-#endif
-#ifdef CONFIG_ARCH_OMAP2
-	if (cpu_is_omap24xx()) {
-		if (BETWEEN(p, L3_24XX_PHYS, L3_24XX_SIZE))
-			return XLATE(p, L3_24XX_PHYS, L3_24XX_VIRT);
-		if (BETWEEN(p, L4_24XX_PHYS, L4_24XX_SIZE))
-			return XLATE(p, L4_24XX_PHYS, L4_24XX_VIRT);
-	}
-	if (cpu_is_omap2420()) {
-		if (BETWEEN(p, DSP_MEM_2420_PHYS, DSP_MEM_2420_SIZE))
-			return XLATE(p, DSP_MEM_2420_PHYS, DSP_MEM_2420_VIRT);
-		if (BETWEEN(p, DSP_IPI_2420_PHYS, DSP_IPI_2420_SIZE))
-			return XLATE(p, DSP_IPI_2420_PHYS, DSP_IPI_2420_SIZE);
-		if (BETWEEN(p, DSP_MMU_2420_PHYS, DSP_MMU_2420_SIZE))
-			return XLATE(p, DSP_MMU_2420_PHYS, DSP_MMU_2420_VIRT);
-	}
-	if (cpu_is_omap2430()) {
-		if (BETWEEN(p, L4_WK_243X_PHYS, L4_WK_243X_SIZE))
-			return XLATE(p, L4_WK_243X_PHYS, L4_WK_243X_VIRT);
-		if (BETWEEN(p, OMAP243X_GPMC_PHYS, OMAP243X_GPMC_SIZE))
-			return XLATE(p, OMAP243X_GPMC_PHYS, OMAP243X_GPMC_VIRT);
-		if (BETWEEN(p, OMAP243X_SDRC_PHYS, OMAP243X_SDRC_SIZE))
-			return XLATE(p, OMAP243X_SDRC_PHYS, OMAP243X_SDRC_VIRT);
-		if (BETWEEN(p, OMAP243X_SMS_PHYS, OMAP243X_SMS_SIZE))
-			return XLATE(p, OMAP243X_SMS_PHYS, OMAP243X_SMS_VIRT);
-	}
-#endif
-#ifdef CONFIG_ARCH_OMAP3
-	if (cpu_is_ti816x()) {
-		if (BETWEEN(p, L4_34XX_PHYS, L4_34XX_SIZE))
-			return XLATE(p, L4_34XX_PHYS, L4_34XX_VIRT);
-	} else if (cpu_is_omap34xx()) {
-		if (BETWEEN(p, L3_34XX_PHYS, L3_34XX_SIZE))
-			return XLATE(p, L3_34XX_PHYS, L3_34XX_VIRT);
-		if (BETWEEN(p, L4_34XX_PHYS, L4_34XX_SIZE))
-			return XLATE(p, L4_34XX_PHYS, L4_34XX_VIRT);
-		if (BETWEEN(p, OMAP34XX_GPMC_PHYS, OMAP34XX_GPMC_SIZE))
-			return XLATE(p, OMAP34XX_GPMC_PHYS, OMAP34XX_GPMC_VIRT);
-		if (BETWEEN(p, OMAP343X_SMS_PHYS, OMAP343X_SMS_SIZE))
-			return XLATE(p, OMAP343X_SMS_PHYS, OMAP343X_SMS_VIRT);
-		if (BETWEEN(p, OMAP343X_SDRC_PHYS, OMAP343X_SDRC_SIZE))
-			return XLATE(p, OMAP343X_SDRC_PHYS, OMAP343X_SDRC_VIRT);
-		if (BETWEEN(p, L4_PER_34XX_PHYS, L4_PER_34XX_SIZE))
-			return XLATE(p, L4_PER_34XX_PHYS, L4_PER_34XX_VIRT);
-		if (BETWEEN(p, L4_EMU_34XX_PHYS, L4_EMU_34XX_SIZE))
-			return XLATE(p, L4_EMU_34XX_PHYS, L4_EMU_34XX_VIRT);
-	}
-#endif
-#ifdef CONFIG_ARCH_OMAP4
-	if (cpu_is_omap44xx()) {
-		if (BETWEEN(p, L3_44XX_PHYS, L3_44XX_SIZE))
-			return XLATE(p, L3_44XX_PHYS, L3_44XX_VIRT);
-		if (BETWEEN(p, L4_44XX_PHYS, L4_44XX_SIZE))
-			return XLATE(p, L4_44XX_PHYS, L4_44XX_VIRT);
-		if (BETWEEN(p, OMAP44XX_GPMC_PHYS, OMAP44XX_GPMC_SIZE))
-			return XLATE(p, OMAP44XX_GPMC_PHYS, OMAP44XX_GPMC_VIRT);
-		if (BETWEEN(p, OMAP44XX_EMIF1_PHYS, OMAP44XX_EMIF1_SIZE))
-			return XLATE(p, OMAP44XX_EMIF1_PHYS,		\
-							OMAP44XX_EMIF1_VIRT);
-		if (BETWEEN(p, OMAP44XX_EMIF2_PHYS, OMAP44XX_EMIF2_SIZE))
-			return XLATE(p, OMAP44XX_EMIF2_PHYS,		\
-							OMAP44XX_EMIF2_VIRT);
-		if (BETWEEN(p, OMAP44XX_DMM_PHYS, OMAP44XX_DMM_SIZE))
-			return XLATE(p, OMAP44XX_DMM_PHYS, OMAP44XX_DMM_VIRT);
-		if (BETWEEN(p, L4_PER_44XX_PHYS, L4_PER_44XX_SIZE))
-			return XLATE(p, L4_PER_44XX_PHYS, L4_PER_44XX_VIRT);
-		if (BETWEEN(p, L4_EMU_44XX_PHYS, L4_EMU_44XX_SIZE))
-			return XLATE(p, L4_EMU_44XX_PHYS, L4_EMU_44XX_VIRT);
-	}
-#endif
-	return __arm_ioremap_caller(p, size, type, __builtin_return_address(0));
-}
-EXPORT_SYMBOL(omap_ioremap);
-
-void omap_iounmap(volatile void __iomem *addr)
-{
-	unsigned long virt = (unsigned long)addr;
-
-	if (virt >= VMALLOC_START && virt < VMALLOC_END)
-		__iounmap(addr);
-}
-EXPORT_SYMBOL(omap_iounmap);
-- 
1.7.7-rc0

^ permalink raw reply related

* [PATCH 08/19] ARM: mach-tegra: remove arch specific special handling for ioremap
From: Nicolas Pitre @ 2011-09-16  7:07 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1316156850-31013-1-git-send-email-nico@fluxnic.net>

From: Nicolas Pitre <nicolas.pitre@linaro.org>

A generic version should replace this later.

Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
---
 arch/arm/mach-tegra/include/mach/io.h |    6 ------
 arch/arm/mach-tegra/io.c              |   21 ---------------------
 2 files changed, 0 insertions(+), 27 deletions(-)

diff --git a/arch/arm/mach-tegra/include/mach/io.h b/arch/arm/mach-tegra/include/mach/io.h
index 4cea2230c8..67fcb38c09 100644
--- a/arch/arm/mach-tegra/include/mach/io.h
+++ b/arch/arm/mach-tegra/include/mach/io.h
@@ -65,12 +65,6 @@
 
 #ifndef __ASSEMBLER__
 
-#define __arch_ioremap		tegra_ioremap
-#define __arch_iounmap		tegra_iounmap
-
-void __iomem *tegra_ioremap(unsigned long phys, size_t size, unsigned int type);
-void tegra_iounmap(volatile void __iomem *addr);
-
 #define IO_ADDRESS(n) ((void __iomem *) IO_TO_VIRT(n))
 
 #ifdef CONFIG_TEGRA_PCI
diff --git a/arch/arm/mach-tegra/io.c b/arch/arm/mach-tegra/io.c
index ea50fe28cf..d9d517dc4c 100644
--- a/arch/arm/mach-tegra/io.c
+++ b/arch/arm/mach-tegra/io.c
@@ -60,24 +60,3 @@ void __init tegra_map_common_io(void)
 {
 	iotable_init(tegra_io_desc, ARRAY_SIZE(tegra_io_desc));
 }
-
-/*
- * Intercept ioremap() requests for addresses in our fixed mapping regions.
- */
-void __iomem *tegra_ioremap(unsigned long p, size_t size, unsigned int type)
-{
-	void __iomem *v = IO_ADDRESS(p);
-	if (v == NULL)
-		v = __arm_ioremap(p, size, type);
-	return v;
-}
-EXPORT_SYMBOL(tegra_ioremap);
-
-void tegra_iounmap(volatile void __iomem *addr)
-{
-	unsigned long virt = (unsigned long)addr;
-
-	if (virt >= VMALLOC_START && virt < VMALLOC_END)
-		__iounmap(addr);
-}
-EXPORT_SYMBOL(tegra_iounmap);
-- 
1.7.7-rc0

^ permalink raw reply related

* [PATCH 07/19] ARM: mach-davinci: remove arch specific special handling for ioremap
From: Nicolas Pitre @ 2011-09-16  7:07 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1316156850-31013-1-git-send-email-nico@fluxnic.net>

From: Nicolas Pitre <nicolas.pitre@linaro.org>

A generic version should replace this later.

Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
---
 arch/arm/mach-davinci/Makefile          |    2 +-
 arch/arm/mach-davinci/include/mach/io.h |    8 -----
 arch/arm/mach-davinci/io.c              |   48 -------------------------------
 3 files changed, 1 insertions(+), 57 deletions(-)
 delete mode 100644 arch/arm/mach-davinci/io.c

diff --git a/arch/arm/mach-davinci/Makefile b/arch/arm/mach-davinci/Makefile
index 0b87a1ca2b..d6a8879aa6 100644
--- a/arch/arm/mach-davinci/Makefile
+++ b/arch/arm/mach-davinci/Makefile
@@ -4,7 +4,7 @@
 #
 
 # Common objects
-obj-y 			:= time.o clock.o serial.o io.o psc.o \
+obj-y 			:= time.o clock.o serial.o psc.o \
 			   gpio.o dma.o usb.o common.o sram.o aemif.o
 
 obj-$(CONFIG_DAVINCI_MUX)		+= mux.o
diff --git a/arch/arm/mach-davinci/include/mach/io.h b/arch/arm/mach-davinci/include/mach/io.h
index d1b954955c..b2267d1e1a 100644
--- a/arch/arm/mach-davinci/include/mach/io.h
+++ b/arch/arm/mach-davinci/include/mach/io.h
@@ -21,12 +21,4 @@
 #define __mem_pci(a)		(a)
 #define __mem_isa(a)		(a)
 
-#ifndef __ASSEMBLER__
-#define __arch_ioremap		davinci_ioremap
-#define __arch_iounmap		davinci_iounmap
-
-void __iomem *davinci_ioremap(unsigned long phys, size_t size,
-			      unsigned int type);
-void davinci_iounmap(volatile void __iomem *addr);
-#endif
 #endif /* __ASM_ARCH_IO_H */
diff --git a/arch/arm/mach-davinci/io.c b/arch/arm/mach-davinci/io.c
deleted file mode 100644
index 8ea60a8b24..0000000000
--- a/arch/arm/mach-davinci/io.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * DaVinci I/O mapping code
- *
- * Copyright (C) 2005-2006 Texas Instruments
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/module.h>
-#include <linux/io.h>
-
-#include <asm/tlb.h>
-#include <asm/mach/map.h>
-
-#include <mach/common.h>
-
-/*
- * Intercept ioremap() requests for addresses in our fixed mapping regions.
- */
-void __iomem *davinci_ioremap(unsigned long p, size_t size, unsigned int type)
-{
-	struct map_desc *desc = davinci_soc_info.io_desc;
-	int desc_num = davinci_soc_info.io_desc_num;
-	int i;
-
-	for (i = 0; i < desc_num; i++, desc++) {
-		unsigned long iophys = __pfn_to_phys(desc->pfn);
-		unsigned long iosize = desc->length;
-
-		if (p >= iophys && (p + size) <= (iophys + iosize))
-			return __io(desc->virtual + p - iophys);
-	}
-
-	return __arm_ioremap_caller(p, size, type,
-					__builtin_return_address(0));
-}
-EXPORT_SYMBOL(davinci_ioremap);
-
-void davinci_iounmap(volatile void __iomem *addr)
-{
-	unsigned long virt = (unsigned long)addr;
-
-	if (virt >= VMALLOC_START && virt < VMALLOC_END)
-		__iounmap(addr);
-}
-EXPORT_SYMBOL(davinci_iounmap);
-- 
1.7.7-rc0

^ permalink raw reply related

* [PATCH 06/19] ARM: mach-at91: remove arch specific special handling for ioremap
From: Nicolas Pitre @ 2011-09-16  7:07 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1316156850-31013-1-git-send-email-nico@fluxnic.net>

From: Nicolas Pitre <nicolas.pitre@linaro.org>

A generic version should replace this later.

Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
---
 arch/arm/mach-at91/include/mach/io.h |    8 --------
 arch/arm/mach-at91/setup.c           |   18 ------------------
 2 files changed, 0 insertions(+), 26 deletions(-)

diff --git a/arch/arm/mach-at91/include/mach/io.h b/arch/arm/mach-at91/include/mach/io.h
index 4298e7806c..4ca09ef7ca 100644
--- a/arch/arm/mach-at91/include/mach/io.h
+++ b/arch/arm/mach-at91/include/mach/io.h
@@ -30,14 +30,6 @@
 
 #ifndef __ASSEMBLY__
 
-#ifndef CONFIG_ARCH_AT91X40
-#define __arch_ioremap	at91_ioremap
-#define __arch_iounmap	at91_iounmap
-#endif
-
-void __iomem *at91_ioremap(unsigned long phys, size_t size, unsigned int type);
-void at91_iounmap(volatile void __iomem *addr);
-
 static inline unsigned int at91_sys_read(unsigned int reg_offset)
 {
 	void __iomem *addr = (void __iomem *)AT91_VA_BASE_SYS;
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
index aa64294c7d..cf98a8f94d 100644
--- a/arch/arm/mach-at91/setup.c
+++ b/arch/arm/mach-at91/setup.c
@@ -73,24 +73,6 @@ static struct map_desc at91_io_desc __initdata = {
 	.type		= MT_DEVICE,
 };
 
-void __iomem *at91_ioremap(unsigned long p, size_t size, unsigned int type)
-{
-	if (p >= AT91_BASE_SYS && p <= (AT91_BASE_SYS + SZ_16K - 1))
-		return (void __iomem *)AT91_IO_P2V(p);
-
-	return __arm_ioremap_caller(p, size, type, __builtin_return_address(0));
-}
-EXPORT_SYMBOL(at91_ioremap);
-
-void at91_iounmap(volatile void __iomem *addr)
-{
-	unsigned long virt = (unsigned long)addr;
-
-	if (virt >= VMALLOC_START && virt < VMALLOC_END)
-		__iounmap(addr);
-}
-EXPORT_SYMBOL(at91_iounmap);
-
 #define AT91_DBGU0	0xfffff200
 #define AT91_DBGU1	0xffffee00
 
-- 
1.7.7-rc0

^ permalink raw reply related

* [PATCH 05/19] ARM: plat-omap: don't define OMAP1_SRAM_VA in terms of VMALLOC_END
From: Nicolas Pitre @ 2011-09-16  7:07 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1316156850-31013-1-git-send-email-nico@fluxnic.net>

From: Nicolas Pitre <nicolas.pitre@linaro.org>

... as it is going to move away.

Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
---
 arch/arm/plat-omap/sram.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
index 363c91e44e..6835b89097 100644
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -41,7 +41,7 @@
 #endif
 
 #define OMAP1_SRAM_PA		0x20000000
-#define OMAP1_SRAM_VA		VMALLOC_END
+#define OMAP1_SRAM_VA		0xd8000000
 #define OMAP2_SRAM_PUB_PA	(OMAP2_SRAM_PA + 0xf800)
 #define OMAP2_SRAM_VA		0xfe400000
 #define OMAP2_SRAM_PUB_VA	(OMAP2_SRAM_VA + 0x800)
-- 
1.7.7-rc0

^ permalink raw reply related

* [PATCH 04/19] ARM: plat-mxc: remove inclusion of <mach/vmalloc.h>
From: Nicolas Pitre @ 2011-09-16  7:07 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1316156850-31013-1-git-send-email-nico@fluxnic.net>

From: Nicolas Pitre <nicolas.pitre@linaro.org>

Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
---
 arch/arm/plat-mxc/include/mach/mx1.h |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/arch/arm/plat-mxc/include/mach/mx1.h b/arch/arm/plat-mxc/include/mach/mx1.h
index 97b19e7800..2b7c08d13e 100644
--- a/arch/arm/plat-mxc/include/mach/mx1.h
+++ b/arch/arm/plat-mxc/include/mach/mx1.h
@@ -12,8 +12,6 @@
 #ifndef __MACH_MX1_H__
 #define __MACH_MX1_H__
 
-#include <mach/vmalloc.h>
-
 /*
  * Memory map
  */
-- 
1.7.7-rc0

^ permalink raw reply related

* [PATCH 03/19] ARM: mach-prima2: don't define SIRFSOC_VA in terms of VMALLOC_END
From: Nicolas Pitre @ 2011-09-16  7:07 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1316156850-31013-1-git-send-email-nico@fluxnic.net>

From: Nicolas Pitre <nicolas.pitre@linaro.org>

... since it is going to change.

Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
---
 arch/arm/mach-prima2/include/mach/map.h |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-prima2/include/mach/map.h b/arch/arm/mach-prima2/include/mach/map.h
index 66b1ae2e55..6f24353257 100644
--- a/arch/arm/mach-prima2/include/mach/map.h
+++ b/arch/arm/mach-prima2/include/mach/map.h
@@ -9,8 +9,10 @@
 #ifndef __MACH_PRIMA2_MAP_H__
 #define __MACH_PRIMA2_MAP_H__
 
-#include <mach/vmalloc.h>
+#include <linux/const.h>
 
-#define SIRFSOC_VA(x)			(VMALLOC_END + ((x) & 0x00FFF000))
+#define SIRFSOC_VA_BASE		_AC(0xFEC00000, UL)
+
+#define SIRFSOC_VA(x)		(SIRFSOC_VA_BASE + ((x) & 0x00FFF000))
 
 #endif
-- 
1.7.7-rc0

^ permalink raw reply related

* [PATCH 02/19] ARM: mach-dove: remove inclusion of <mach/vmalloc.h>
From: Nicolas Pitre @ 2011-09-16  7:07 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1316156850-31013-1-git-send-email-nico@fluxnic.net>

From: Nicolas Pitre <nicolas.pitre@linaro.org>

Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
---
 arch/arm/mach-dove/include/mach/dove.h |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-dove/include/mach/dove.h b/arch/arm/mach-dove/include/mach/dove.h
index b20ec9af78..ad1165d488 100644
--- a/arch/arm/mach-dove/include/mach/dove.h
+++ b/arch/arm/mach-dove/include/mach/dove.h
@@ -11,8 +11,6 @@
 #ifndef __ASM_ARCH_DOVE_H
 #define __ASM_ARCH_DOVE_H
 
-#include <mach/vmalloc.h>
-
 /*
  * Marvell Dove address maps.
  *
-- 
1.7.7-rc0

^ permalink raw reply related

* [PATCH 01/19] ARM: sort the meminfo array earlier
From: Nicolas Pitre @ 2011-09-16  7:07 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1316156850-31013-1-git-send-email-nico@fluxnic.net>

From: Nicolas Pitre <nicolas.pitre@linaro.org>

The meminfo array has to be sorted before sanity_check_meminfo() can work
properly.

Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
---
 arch/arm/kernel/setup.c |    8 ++++++++
 arch/arm/mm/init.c      |   10 ----------
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 70bca649e9..56cd8c351c 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -29,6 +29,7 @@
 #include <linux/fs.h>
 #include <linux/proc_fs.h>
 #include <linux/memblock.h>
+#include <linux/sort.h>
 
 #include <asm/unified.h>
 #include <asm/cpu.h>
@@ -875,6 +876,12 @@ static struct machine_desc * __init setup_machine_tags(unsigned int nr)
 	return mdesc;
 }
 
+static int __init meminfo_cmp(const void *_a, const void *_b)
+{
+	const struct membank *a = _a, *b = _b;
+	long cmp = bank_pfn_start(a) - bank_pfn_start(b);
+	return cmp < 0 ? -1 : cmp > 0 ? 1 : 0;
+}
 
 void __init setup_arch(char **cmdline_p)
 {
@@ -903,6 +910,7 @@ void __init setup_arch(char **cmdline_p)
 
 	parse_early_param();
 
+	sort(&meminfo.bank, meminfo.nr_banks, sizeof(meminfo.bank[0]), meminfo_cmp, NULL);
 	sanity_check_meminfo();
 	arm_memblock_init(&meminfo, mdesc);
 
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 91bca355cd..7080f10cc2 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -19,7 +19,6 @@
 #include <linux/highmem.h>
 #include <linux/gfp.h>
 #include <linux/memblock.h>
-#include <linux/sort.h>
 
 #include <asm/mach-types.h>
 #include <asm/prom.h>
@@ -318,19 +317,10 @@ static void arm_memory_present(void)
 }
 #endif
 
-static int __init meminfo_cmp(const void *_a, const void *_b)
-{
-	const struct membank *a = _a, *b = _b;
-	long cmp = bank_pfn_start(a) - bank_pfn_start(b);
-	return cmp < 0 ? -1 : cmp > 0 ? 1 : 0;
-}
-
 void __init arm_memblock_init(struct meminfo *mi, struct machine_desc *mdesc)
 {
 	int i;
 
-	sort(&meminfo.bank, meminfo.nr_banks, sizeof(meminfo.bank[0]), meminfo_cmp, NULL);
-
 	memblock_init();
 	for (i = 0; i < mi->nr_banks; i++)
 		memblock_add(mi->bank[i].start, mi->bank[i].size);
-- 
1.7.7-rc0

^ permalink raw reply related

* [PATCH 0/19] removal of mach/vmalloc.h and generic optimizations
From: Nicolas Pitre @ 2011-09-16  7:07 UTC (permalink / raw)
  To: linux-arm-kernel

This patch series removes all instances of mach/vmalloc.h in order to
have a more unified memory map across all ARM architectures.  To do so,
the static mappings are moved inside the vmalloc area.  And finally this
allows for a generic optimization to ioremap where static mappings are
reused whenever possible, using common code instead of having this
duplicated in a couple places.

This also provides a net reduction of more than 1200 lines of code.

Those patches are also available in the following repository:

	git://git.linaro.org/people/nico/linux vmalloc


Nicolas Pitre (19):
      ARM: sort the meminfo array earlier
      ARM: mach-dove: remove inclusion of <mach/vmalloc.h>
      ARM: mach-prima2: don't define SIRFSOC_VA in terms of VMALLOC_END
      ARM: plat-mxc: remove inclusion of <mach/vmalloc.h>
      ARM: plat-omap: don't define OMAP1_SRAM_VA in terms of VMALLOC_END
      ARM: mach-at91: remove arch specific special handling for ioremap
      ARM: mach-davinci: remove arch specific special handling for ioremap
      ARM: mach-tegra: remove arch specific special handling for ioremap
      ARM: plat-omap: remove arch specific special handling for ioremap
      ARM: mach-bcmring: use proper constant to identify DMA memory area
      ARM: mach-orion5x: remove arch specific special handling for ioremap
      ARM: mach-kirkwood: remove arch specific special handling for ioremap
      ARM: mach-ixp23xx: remove arch specific special handling for ioremap
      ARM: plat-iop: remove arch specific special handling for ioremap
      mm: add vm_area_add_early()
      ARM: move iotable mappings within the vmalloc region
      ARM: simplify __iounmap() when dealing with section based mapping
      ARM: add generic ioremap optimization by reusing static mappings
      ARM: big removal of now unused vmalloc.h files

 arch/arm/include/asm/pgtable.h                  |    8 +-
 arch/arm/kernel/setup.c                         |    8 +
 arch/arm/mach-at91/include/mach/io.h            |    8 -
 arch/arm/mach-at91/include/mach/vmalloc.h       |   26 ---
 arch/arm/mach-at91/setup.c                      |   18 --
 arch/arm/mach-bcmring/dma.c                     |    2 +-
 arch/arm/mach-bcmring/include/mach/vmalloc.h    |   25 ---
 arch/arm/mach-clps711x/include/mach/vmalloc.h   |   20 ---
 arch/arm/mach-cns3xxx/include/mach/vmalloc.h    |   11 --
 arch/arm/mach-davinci/Makefile                  |    2 +-
 arch/arm/mach-davinci/include/mach/io.h         |    8 -
 arch/arm/mach-davinci/include/mach/vmalloc.h    |   14 --
 arch/arm/mach-davinci/io.c                      |   48 ------
 arch/arm/mach-dove/include/mach/dove.h          |    2 -
 arch/arm/mach-dove/include/mach/vmalloc.h       |    5 -
 arch/arm/mach-ebsa110/include/mach/vmalloc.h    |   10 --
 arch/arm/mach-ep93xx/include/mach/vmalloc.h     |    5 -
 arch/arm/mach-exynos4/include/mach/vmalloc.h    |   22 ---
 arch/arm/mach-footbridge/include/mach/vmalloc.h |   10 --
 arch/arm/mach-gemini/include/mach/vmalloc.h     |   10 --
 arch/arm/mach-h720x/include/mach/vmalloc.h      |   10 --
 arch/arm/mach-integrator/include/mach/vmalloc.h |   20 ---
 arch/arm/mach-iop13xx/include/mach/vmalloc.h    |    4 -
 arch/arm/mach-iop32x/include/mach/io.h          |    7 -
 arch/arm/mach-iop32x/include/mach/vmalloc.h     |    5 -
 arch/arm/mach-iop33x/include/mach/io.h          |    7 -
 arch/arm/mach-iop33x/include/mach/vmalloc.h     |    5 -
 arch/arm/mach-ixp2000/include/mach/vmalloc.h    |   20 ---
 arch/arm/mach-ixp23xx/include/mach/io.h         |   29 ----
 arch/arm/mach-ixp23xx/include/mach/vmalloc.h    |   10 --
 arch/arm/mach-ixp4xx/include/mach/vmalloc.h     |    5 -
 arch/arm/mach-kirkwood/include/mach/io.h        |   25 ---
 arch/arm/mach-kirkwood/include/mach/vmalloc.h   |    5 -
 arch/arm/mach-ks8695/include/mach/vmalloc.h     |   19 ---
 arch/arm/mach-lpc32xx/include/mach/vmalloc.h    |   24 ---
 arch/arm/mach-mmp/include/mach/vmalloc.h        |    5 -
 arch/arm/mach-msm/include/mach/vmalloc.h        |   22 ---
 arch/arm/mach-mv78xx0/include/mach/vmalloc.h    |    5 -
 arch/arm/mach-mxs/include/mach/vmalloc.h        |   22 ---
 arch/arm/mach-netx/include/mach/vmalloc.h       |   19 ---
 arch/arm/mach-nomadik/include/mach/vmalloc.h    |    2 -
 arch/arm/mach-nuc93x/include/mach/vmalloc.h     |   23 ---
 arch/arm/mach-omap1/include/mach/vmalloc.h      |   20 ---
 arch/arm/mach-omap2/include/mach/vmalloc.h      |   20 ---
 arch/arm/mach-orion5x/include/mach/io.h         |   25 ---
 arch/arm/mach-orion5x/include/mach/vmalloc.h    |    5 -
 arch/arm/mach-pnx4008/include/mach/vmalloc.h    |   20 ---
 arch/arm/mach-prima2/include/mach/map.h         |    6 +-
 arch/arm/mach-prima2/include/mach/vmalloc.h     |   16 --
 arch/arm/mach-pxa/include/mach/vmalloc.h        |   11 --
 arch/arm/mach-realview/include/mach/vmalloc.h   |   21 ---
 arch/arm/mach-rpc/include/mach/vmalloc.h        |   10 --
 arch/arm/mach-s3c2410/include/mach/vmalloc.h    |   20 ---
 arch/arm/mach-s3c64xx/include/mach/vmalloc.h    |   20 ---
 arch/arm/mach-s5p64x0/include/mach/vmalloc.h    |   20 ---
 arch/arm/mach-s5pc100/include/mach/vmalloc.h    |   17 --
 arch/arm/mach-s5pv210/include/mach/vmalloc.h    |   22 ---
 arch/arm/mach-sa1100/include/mach/vmalloc.h     |    4 -
 arch/arm/mach-shark/include/mach/vmalloc.h      |    4 -
 arch/arm/mach-shmobile/include/mach/vmalloc.h   |    7 -
 arch/arm/mach-spear3xx/include/mach/vmalloc.h   |   19 ---
 arch/arm/mach-spear6xx/include/mach/vmalloc.h   |   19 ---
 arch/arm/mach-tegra/include/mach/io.h           |    6 -
 arch/arm/mach-tegra/include/mach/vmalloc.h      |   28 ----
 arch/arm/mach-tegra/io.c                        |   21 ---
 arch/arm/mach-u300/include/mach/vmalloc.h       |   12 --
 arch/arm/mach-ux500/include/mach/vmalloc.h      |   18 --
 arch/arm/mach-versatile/include/mach/vmalloc.h  |   21 ---
 arch/arm/mach-vexpress/include/mach/vmalloc.h   |   21 ---
 arch/arm/mach-vt8500/include/mach/vmalloc.h     |   20 ---
 arch/arm/mach-w90x900/include/mach/vmalloc.h    |   23 ---
 arch/arm/mach-zynq/include/mach/vmalloc.h       |   20 ---
 arch/arm/mm/init.c                              |   10 --
 arch/arm/mm/ioremap.c                           |   70 ++++++---
 arch/arm/mm/mm.h                                |   14 ++
 arch/arm/mm/mmu.c                               |   43 ++++--
 arch/arm/plat-iop/Makefile                      |    2 -
 arch/arm/plat-iop/io.c                          |   59 -------
 arch/arm/plat-mxc/include/mach/mx1.h            |    2 -
 arch/arm/plat-mxc/include/mach/vmalloc.h        |   22 ---
 arch/arm/plat-omap/Makefile                     |    2 +-
 arch/arm/plat-omap/include/plat/io.h            |    6 -
 arch/arm/plat-omap/io.c                         |  141 -----------------
 arch/arm/plat-omap/sram.c                       |    2 +-
 arch/arm/plat-spear/include/plat/vmalloc.h      |   19 ---
 arch/arm/plat-tcc/include/mach/vmalloc.h        |   10 --
 include/linux/vmalloc.h                         |    1 +
 mm/vmalloc.c                                    |   28 +++-
 88 files changed, 136 insertions(+), 1346 deletions(-)

^ permalink raw reply

* confusion regarding the CMD19 and CMD21 in eMMC/SD card spec
From: Girish K S @ 2011-09-16  6:14 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20110916055735.GA3938@lovegaga>

our host controller supports both
SD/MMC. single controller to read both cards.

On 16 September 2011 11:27, Aaron Lu <aaron.lu@amd.com> wrote:
> On Fri, Sep 16, 2011 at 11:00:12AM +0530, Girish K S wrote:
>> Hello Aaron Lu,
> Hi,
>
>> ? ? ? ? ? ? ? ? ? ? please check the mmc 4.5 specification CMD21 is
>> tuning command.
>
> So you are using a mmc card with a sd host?
>
> -Aaron
>
>

^ permalink raw reply

* Query about ARM interrupt virtualization
From: bill4carson @ 2011-09-16  6:13 UTC (permalink / raw)
  To: linux-arm-kernel

Hi, all

I have been doing ARM interrupt virtualization based on Christoffer KVM 
work.
Current status is an A15 guest os could boot successfully based on ARM KVM
without interrupt virtualization.


Interrupt injection is taken care of by Qemu, if interrupt 
virtualization need to be
supported, then all the gic cpu interface code in Qemu must be removed.
The distributor in Qemu figure out the best irq, then ship this best_irq 
into virtual
cpu interface through list register.

The problem is Distributor state must be synchronized with two cpu 
interface
actions: ACK(interrupt acknowledge) and EOI (end Of Interrupt).
EOI could be trapped by hypervisor, this will enable us to call 
gic_complete_irq
in Qemu to update Distributor state.
However for now I cannot find a way for ACK to be catch,
or am I missing something important here?

Any tips/suggestions would be appreciated!


bill

^ permalink raw reply

* [PATCH v2 6/6] arm/imx6q: add suspend/resume support
From: Shawn Guo @ 2011-09-16  6:09 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20110915162829.GA4797@e102568-lin.cambridge.arm.com>

Hi Lorenzo,

On Thu, Sep 15, 2011 at 05:28:29PM +0100, Lorenzo Pieralisi wrote:
> On Thu, Sep 15, 2011 at 03:45:26PM +0100, Shawn Guo wrote:
> > It adds suspend/resume support for imx6q.
> > 
> > Signed-off-by: Anson Huang <b20788@freescale.com>
> > Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> > ---
> >  arch/arm/mach-imx/Makefile              |    2 +-
> >  arch/arm/mach-imx/head-v7.S             |   27 +++++++++
> >  arch/arm/mach-imx/pm-imx6q.c            |   88 +++++++++++++++++++++++++++++++
> >  arch/arm/plat-mxc/include/mach/common.h |    8 +++
> >  4 files changed, 124 insertions(+), 1 deletions(-)
> >  create mode 100644 arch/arm/mach-imx/pm-imx6q.c
> > 
> > diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
> > index 16737ba..c787151 100644
> > --- a/arch/arm/mach-imx/Makefile
> > +++ b/arch/arm/mach-imx/Makefile
> > @@ -70,4 +70,4 @@ obj-$(CONFIG_CPU_V7) += head-v7.o
> >  obj-$(CONFIG_SMP) += platsmp.o
> >  obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
> >  obj-$(CONFIG_LOCAL_TIMERS) += localtimer.o
> > -obj-$(CONFIG_SOC_IMX6Q) += clock-imx6q.o mach-imx6q.o
> > +obj-$(CONFIG_SOC_IMX6Q) += clock-imx6q.o mach-imx6q.o pm-imx6q.o
> > diff --git a/arch/arm/mach-imx/head-v7.S b/arch/arm/mach-imx/head-v7.S
> > index ede908b..0a86685 100644
> > --- a/arch/arm/mach-imx/head-v7.S
> > +++ b/arch/arm/mach-imx/head-v7.S
> > @@ -69,3 +69,30 @@ ENTRY(v7_secondary_startup)
> >  	b	secondary_startup
> >  ENDPROC(v7_secondary_startup)
> >  #endif
> > +
> > +ENTRY(v7_cpu_resume)
> > +	bl	v7_invalidate_l1
> > +
> > +	/*
> > +	 * Restore L2 AUX_CTRL register saved by suspend procedure
> > +	 * and enable L2
> > +	 */
> > +	adr	r4, 1f
> > +	ldmia	r4, {r5, r6, r7}
> > +	sub	r4, r4, r5
> > +	add	r6, r6, r4
> > +	add	r7, r7, r4
> > +	ldr	r0, [r6]
> > +	ldr	r7, [r7]
> > +	ldr	r1, [r7]
> > +	str	r1, [r0, #L2X0_AUX_CTRL]
> > +	ldr	r1, =0x1
> > +	str	r1, [r0, #L2X0_CTRL]
> > +
> > +	b	cpu_resume
> > +
> > +	.align
> > +1:	.long	.
> > +	.long	pl310_pbase
> > +	.long	pl310_aux_ctrl_paddr
> 
> Would not something like:
> 
> 	adr	r4, pl310_pbase
> 	ldmia	r4, {r6, r7}
> 	[...]
> 
> pl310_pbase:
> 	.long 0
> pl310_aux_ctrl:
> 	.long 0
> 
> be better and faster ? Why play with virtual addresses ?
> Of course you should initialize the values, but then you can access them
> through a PC relative load when running physical.

Thanks for the comment.  I agree with you that it's better, though my
first thought on the existing approach is I can access the global
variables defined in C file directly from assembly code.

> Your code should be in the .data section for it to be writable (adr does not
> work across sections), have a look at Russell's code in sleep.S it is
> very well commented and similar to what you need.

Thanks for pointing me the example.

> 
> > +ENDPROC(v7_cpu_resume)
> > diff --git a/arch/arm/mach-imx/pm-imx6q.c b/arch/arm/mach-imx/pm-imx6q.c
> > new file mode 100644
> > index 0000000..124bcd5
> > --- /dev/null
> > +++ b/arch/arm/mach-imx/pm-imx6q.c
> > @@ -0,0 +1,88 @@
> > +/*
> > + * Copyright 2011 Freescale Semiconductor, Inc.
> > + * Copyright 2011 Linaro Ltd.
> > + *
> > + * The code contained herein is licensed under the GNU General Public
> > + * License. You may obtain a copy of the GNU General Public License
> > + * Version 2 or later at the following locations:
> > + *
> > + * http://www.opensource.org/licenses/gpl-license.html
> > + * http://www.gnu.org/copyleft/gpl.html
> > + */
> > +
> > +#include <linux/init.h>
> > +#include <linux/io.h>
> > +#include <linux/of.h>
> > +#include <linux/suspend.h>
> > +#include <asm/proc-fns.h>
> > +#include <asm/suspend.h>
> > +#include <asm/hardware/cache-l2x0.h>
> > +#include <mach/common.h>
> > +#include <mach/hardware.h>
> > +
> > +static void __iomem *pl310_vbase;
> > +void __iomem *pl310_pbase;
> > +
> > +static volatile unsigned long pl310_aux_ctrl;
> > +volatile unsigned long pl310_aux_ctrl_paddr;
> 
> I think that by defining those variables in assembly you would make
> your life much simpler.

Yes.  But I need a function call to learn the address of those variables
from assembly now.

> I think you know your L2 is already initialized here to make sure you
> save the right aux value. Hence you should clean the variables above from
> L2 to make sure they are available at reset from DRAM (L2 is retained
> and you do not clean it on suspend, correct ?)

Yes, agreed.  It's right thing to do for being safe.  Actually, I did it
when I saved the variables during suspend.  If I do not do, it simply
does not work.  But later, when I moved the saving to init function
since it needs to be done for only once, I found it works even without
the cache clean.  Then I dropped it.  To be safe, now I'm adding it
back with following your comment.

> 
> I do not think that code to save/restore L2 config belongs here though.
> More below.
> 
> > +
> > +static int imx6q_suspend_finish(unsigned long val)
> > +{
> > +	cpu_do_idle();
> > +	return 0;
> > +}
> > +
> > +static int imx6q_pm_enter(suspend_state_t state)
> > +{
> > +	switch (state) {
> > +	case PM_SUSPEND_MEM:
> > +		imx6q_set_lpm(STOP_POWER_OFF);
> > +		imx_gpc_pre_suspend();
> > +		imx_set_cpu_jump(0, v7_cpu_resume);
> > +		/* Zzz ... */
> > +		cpu_suspend(0, imx6q_suspend_finish);
> > +		imx_smp_prepare();
> > +		imx_gpc_post_resume();
> > +		break;
> > +	default:
> > +		return -EINVAL;
> > +	}
> > +
> > +	return 0;
> > +}
> > +
> > +static const struct platform_suspend_ops imx6q_pm_ops = {
> > +	.enter = imx6q_pm_enter,
> > +	.valid = suspend_valid_only_mem,
> > +};
> > +
> > +void __init imx6q_pm_init(void)
> > +{
> > +	struct device_node *np;
> > +	u32 reg[2];
> > +
> > +	np = of_find_compatible_node(NULL, NULL, "arm,pl310-cache");
> > +	of_property_read_u32_array(np, "reg", reg, ARRAY_SIZE(reg));
> > +	pl310_vbase = ioremap(reg[0], reg[1]);
> 
> Mmmm...is this vma ever released ? L2 is already mapped in the L2
> driver from DT or through static mappings. 

I think we can do another mapping even it's been done in the L2 driver,
no?

> Overall, I think that code to restore PL310 belongs in cache-l2x0.c, not here.
> We can easily write an assembly stub that reinitialize L2 before
> resume if that's something we should and can do (security ?).
> 
I would be definitely happy to see that, but before rmk agrees on that,
I have to find a way around in the platform code.

Here is the updated patch.  If it looks better to you, I will
incorporate it in the v3 of the series.

8<---
diff --git a/arch/arm/mach-imx/head-v7.S b/arch/arm/mach-imx/head-v7.S
index ede908b..5a486a9 100644
--- a/arch/arm/mach-imx/head-v7.S
+++ b/arch/arm/mach-imx/head-v7.S
@@ -69,3 +69,35 @@ ENTRY(v7_secondary_startup)
 	b	secondary_startup
 ENDPROC(v7_secondary_startup)
 #endif
+
+ENTRY(pl310_get_save_ptr)
+	ldr	r0, =pl310_pbase
+	mov	pc, lr
+ENDPROC(pl310_get_save_ptr)
+
+ENTRY(v7_cpu_resume)
+	bl	v7_invalidate_l1
+	bl	pl310_resume
+	b	cpu_resume
+ENDPROC(v7_cpu_resume)
+
+/*
+ * The following code is located into the .data section.  This is to
+ * allow pl310_pbase and pl310_aux_ctrl to be accessed with a relative
+ * load as we are running on physical address here.
+ */
+	.data
+	.align
+ENTRY(pl310_resume)
+	adr	r2, pl310_pbase
+	ldmia	r2, {r0, r1}
+	str	r1, [r0, #L2X0_AUX_CTRL]	@ restore aux_ctrl
+	mov	r1, #0x1
+	str	r1, [r0, #L2X0_CTRL]		@ re-enable L2
+	mov	pc, lr
+ENDPROC(pl310_resume)
+
+pl310_pbase:
+	.long	0
+pl310_aux_ctrl:
+	.long	0
diff --git a/arch/arm/mach-imx/pm-imx6q.c b/arch/arm/mach-imx/pm-imx6q.c
new file mode 100644
index 0000000..59cb8d2
--- /dev/null
+++ b/arch/arm/mach-imx/pm-imx6q.c
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2011 Freescale Semiconductor, Inc.
+ * Copyright 2011 Linaro Ltd.
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later@the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+#include <linux/init.h>
+#include <linux/io.h>
+#include <linux/of.h>
+#include <linux/suspend.h>
+#include <asm/cacheflush.h>
+#include <asm/proc-fns.h>
+#include <asm/suspend.h>
+#include <asm/hardware/cache-l2x0.h>
+#include <mach/common.h>
+#include <mach/hardware.h>
+
+static int imx6q_suspend_finish(unsigned long val)
+{
+	cpu_do_idle();
+	return 0;
+}
+
+static int imx6q_pm_enter(suspend_state_t state)
+{
+	switch (state) {
+	case PM_SUSPEND_MEM:
+		imx6q_set_lpm(STOP_POWER_OFF);
+		imx_gpc_pre_suspend();
+		imx_set_cpu_jump(0, v7_cpu_resume);
+		/* Zzz ... */
+		cpu_suspend(0, imx6q_suspend_finish);
+		imx_smp_prepare();
+		imx_gpc_post_resume();
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+static const struct platform_suspend_ops imx6q_pm_ops = {
+	.enter = imx6q_pm_enter,
+	.valid = suspend_valid_only_mem,
+};
+
+void __init imx6q_pm_init(void)
+{
+	struct device_node *np;
+	u32 reg[2], *ptr;
+	void __iomem *base;
+
+	np = of_find_compatible_node(NULL, NULL, "arm,pl310-cache");
+	of_property_read_u32_array(np, "reg", reg, ARRAY_SIZE(reg));
+	base = ioremap(reg[0], reg[1]);
+	WARN_ON(!base);
+
+	/*
+	 * On imx6q, during system suspend, ARM core gets powered off,
+	 * but L2 cache is retained.  To avoid cleaning the entire L2,
+	 * we need to save L2 controller registers, and when system gets
+	 * woke up, restore the registers and re-enable L2 before
+	 * calling into cpu_resume().
+	 *
+	 * Most of pl310 configuration upon reset work just fine for
+	 * imx6q, and the only one register we actually need to save is
+	 * AUX_CTRL.  Also since pl310 configuration won't change in a
+	 * live system, we can save it here only once, and restore it
+	 * every time system resumes back from v7_cpu_resume().
+	 */
+	ptr = pl310_get_save_ptr();
+	/* save pl310 physical base address */
+	*ptr = reg[0];
+	/* save pl310 aux_ctrl register */
+	*(ptr + 1) = readl_relaxed(base + L2X0_AUX_CTRL);
+	/* ensure they are written into external memory */
+	__cpuc_flush_dcache_area((void *) ptr, sizeof(*ptr) * 2);
+	outer_clean_range(__pa(ptr), __pa(ptr + 2));
+
+	suspend_set_ops(&imx6q_pm_ops);
+}

-- 
Regards,
Shawn

^ permalink raw reply related

* confusion regarding the CMD19 and CMD21 in eMMC/SD card spec
From: Aaron Lu @ 2011-09-16  5:57 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <CAGxe1ZGNBPcCMZQDdxCbO_CBBAm5FcF8R7FV0_P8MLEOcXqwYg@mail.gmail.com>

On Fri, Sep 16, 2011 at 11:00:12AM +0530, Girish K S wrote:
> Hello Aaron Lu,
Hi,

>                     please check the mmc 4.5 specification CMD21 is
> tuning command.

So you are using a mmc card with a sd host?

-Aaron

^ permalink raw reply

* [PATCH] ARM: kdump: copy kernel relocation code at the kexec prepare stage
From: Simon Horman @ 2011-09-16  5:45 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1316151129-30491-1-git-send-email-leiwen@marvell.com>

On Thu, Sep 15, 2011 at 10:32:09PM -0700, Lei Wen wrote:
> This copy really don't need to do at the very second before the kernel
> would crash.
> 
> Signed-off-by: Lei Wen <leiwen@marvell.com>

This seems reasonable to me.

Acked-by: Simon Horman <horms@verge.net.au>

^ permalink raw reply

* [PATCH] ARM: kdump: copy kernel relocation code at the kexec prepare stage
From: Lei Wen @ 2011-09-16  5:32 UTC (permalink / raw)
  To: linux-arm-kernel

This copy really don't need to do at the very second before the kernel
would crash.

Signed-off-by: Lei Wen <leiwen@marvell.com>
---
 arch/arm/kernel/machine_kexec.c |   30 +++++++++++++++---------------
 1 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/arch/arm/kernel/machine_kexec.c b/arch/arm/kernel/machine_kexec.c
index e59bbd4..f60fc90 100644
--- a/arch/arm/kernel/machine_kexec.c
+++ b/arch/arm/kernel/machine_kexec.c
@@ -32,6 +32,21 @@ static atomic_t waiting_for_crash_ipi;
 
 int machine_kexec_prepare(struct kimage *image)
 {
+	unsigned long page_list;
+	void *reboot_code_buffer;
+	page_list = image->head & PAGE_MASK;
+
+	reboot_code_buffer = page_address(image->control_code_page);
+
+	/* Prepare parameters for reboot_code_buffer*/
+	kexec_start_address = image->start;
+	kexec_indirection_page = page_list;
+	kexec_mach_type = machine_arch_type;
+	kexec_boot_atags = image->start - KEXEC_ARM_ZIMAGE_OFFSET + KEXEC_ARM_ATAGS_OFFSET;
+
+	/* copy our kernel relocation code to the control code page */
+	memcpy(reboot_code_buffer,
+	       relocate_new_kernel, relocate_new_kernel_size);
 	return 0;
 }
 
@@ -82,29 +97,14 @@ void (*kexec_reinit)(void);
 
 void machine_kexec(struct kimage *image)
 {
-	unsigned long page_list;
 	unsigned long reboot_code_buffer_phys;
 	void *reboot_code_buffer;
 
-
-	page_list = image->head & PAGE_MASK;
-
 	/* we need both effective and real address here */
 	reboot_code_buffer_phys =
 	    page_to_pfn(image->control_code_page) << PAGE_SHIFT;
 	reboot_code_buffer = page_address(image->control_code_page);
 
-	/* Prepare parameters for reboot_code_buffer*/
-	kexec_start_address = image->start;
-	kexec_indirection_page = page_list;
-	kexec_mach_type = machine_arch_type;
-	kexec_boot_atags = image->start - KEXEC_ARM_ZIMAGE_OFFSET + KEXEC_ARM_ATAGS_OFFSET;
-
-	/* copy our kernel relocation code to the control code page */
-	memcpy(reboot_code_buffer,
-	       relocate_new_kernel, relocate_new_kernel_size);
-
-
 	flush_icache_range((unsigned long) reboot_code_buffer,
 			   (unsigned long) reboot_code_buffer + KEXEC_CONTROL_PAGE_SIZE);
 	printk(KERN_INFO "Bye!\n");
-- 
1.7.0.4

^ permalink raw reply related

* confusion regarding the CMD19 and CMD21 in eMMC/SD card spec
From: Girish K S @ 2011-09-16  5:30 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20110916044706.GA4030@lovegaga>

Hello Aaron Lu,
                    please check the mmc 4.5 specification CMD21 is
tuning command.

regards
Girish K S

On 16 September 2011 10:17, Aaron Lu <aaron.lu@amd.com> wrote:
> On Fri, Sep 16, 2011 at 09:41:04AM +0530, Girish K S wrote:
>> but there is only one host controller to handle these commands.
>> the generic sdhci driver has cmd19 hard coded, thats the reason I
>> asked the question.
>> you can also check it in the function sdhci_execute_tuning it is hard coded as
>> cmd.opcode = MMC_SEND_TUNING_BLOCK; where the macro value is 19.
>> So in case of SD card insertion it will send a SEND_TUNING_BLOCK
>> command to the device. but if
>> MMC card is inserted then it will send a BUS_TEST_W command to the device.
>
> sdhci_execute_tuning will only be called if the inserted card is a sd card
> and it is operating at SDR104 or SDR50 mode(UHS-I).
>
> The host's tuning function is called from the mmc_sd_init_uhs_card,
> and for a mmc card, there is no chance of that function being called.
>
> -Aaron
>
>

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox