Omgili, forum search, forums search, search forums, discussion search,discussions search, search discussions, board search, boards search, search boards
  Advanced Search

[PATCH 0/2] [P/omap4] Remove the CMA

On Tue, 24 Jan 2012 13:26:11 +0100, Paolo Pisati <...@canonical.com

The contiguos memory allocator (CMA) was part of latest TILT but it's not part
of mainline, nor it's a dependency for any of our drivers and it could be a
source of problems in case it's not properly initialized at boot time
(lp920511): remove it from our tree.

BugLink: http://bugs.launchpad.net/bugs/920511

Paolo Pisati (2):
Revert "workaround cma highmem broken"
Revert "cma17 10"

Documentation/kernel-parameters.txt | 4 -
arch/arm/Kconfig | 2 -
arch/arm/include/asm/dma-contiguous.h | 16 --
arch/arm/include/asm/mach/map.h | 1 -
arch/arm/kernel/setup.c | 2 -
arch/arm/mach-omap2/Kconfig | 1 -
arch/arm/mach-omap2/board-4430sdp.c | 3 -
arch/arm/mach-omap2/board-omap4panda.c | 3 -
arch/arm/mm/dma-mapping.c | 372 ++++++--------------------------
arch/arm/mm/init.c | 20 +--
arch/arm/mm/mm.h | 3 -
arch/arm/mm/mmu.c | 29 +--
12 files changed, 81 insertions(+), 375 deletions(-)
delete mode 100644 arch/arm/include/asm/dma-contiguous.h

--
1.7.5.4

--
kernel-team mailing list
kern...@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team



On Tue, 24 Jan 2012 13:26:12 +0100, Paolo Pisati <...@canonical.com

This reverts commit dce4ad0eabf45def016d0bf47c000320fa9de6a9.

Signed-off-by: Paolo Pisati <...@canonical.com---
arch/arm/mach-omap2/Kconfig | 1 -
arch/arm/mach-omap2/board-4430sdp.c | 3 ---
arch/arm/mach-omap2/board-omap4panda.c | 3 ---
arch/arm/mm/dma-mapping.c | 4 ----
4 files changed, 0 insertions(+), 11 deletions(-)

diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index fe013c5..7bac6ae 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -52,7 +52,6 @@ config ARCH_OMAP4
select USB_ARCH_HAS_EHCI
select ARM_CPU_SUSPEND if PM
select ARCH_HAS_BARRIERS
- select ZONE_DMA

comment "OMAP Core Type"
depends on ARCH_OMAP2
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index 2b06e6c..eed6d40 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -1210,7 +1210,4 @@ MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
.init_machine = omap_4430sdp_init,
.timer = &omap4_timer,
.restart = omap_prcm_restart,
-#ifdef CONFIG_ZONE_DMA
- .dma_zone_size = 500 * 1024 * 1024,
-#endif
MACHINE_END
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
index 8086266..035d56f 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -819,7 +819,4 @@ MACHINE_START(OMAP4_PANDA, "OMAP4 Panda board")
.timer = &omap4_timer,
.restart = omap_prcm_restart,
.dt_compat = omap4_panda_match,
-#ifdef CONFIG_ZONE_DMA
- .dma_zone_size = 500 * 1024 * 1024,
-#endif
MACHINE_END
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 9c05132..6f1fa3e 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -503,14 +503,10 @@ static void *__alloc_from_contiguous(struct device *dev, size_t size,
size_t count = size struct page *page;

- pr_err("__alloc_from_contiguous: count=%lu, order=%lu\n", (unsigned long)count, order);
-
page = dma_alloc_from_contiguous(dev, count, order);
if (!page)
return NULL;

- pr_err("__alloc_from_contiguous: page=%p, size=%lu\n", page, (unsigned long)size);
-
__dma_clear_buffer(page, size);
__dma_remap(page, size, prot);

--
1.7.5.4

--
kernel-team mailing list
kern...@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team

On Tue, 24 Jan 2012 13:26:13 +0100, Paolo Pisati <...@canonical.com

This reverts commit 886bb201ac2853b4cbf44926ab27cfc8cb67a0d0.

Signed-off-by: Paolo Pisati <...@canonical.com---
Documentation/kernel-parameters.txt | 4 -
arch/arm/Kconfig | 2 -
arch/arm/include/asm/dma-contiguous.h | 16 --
arch/arm/include/asm/mach/map.h | 1 -
arch/arm/kernel/setup.c | 2 -
arch/arm/mm/dma-mapping.c | 368 ++++++---------------------------
arch/arm/mm/init.c | 20 +--
arch/arm/mm/mm.h | 3 -
arch/arm/mm/mmu.c | 29 +--
9 files changed, 81 insertions(+), 364 deletions(-)
delete mode 100644 arch/arm/include/asm/dma-contiguous.h

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 6052ab2..1c0a769 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -518,10 +518,6 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
a hypervisor.
Default: yes

- coherent_pool=nn[KMG] [ARM,KNL]
- Sets the size of memory pool for coherent, atomic dma
- allocations if Contiguous Memory Allocator (CMA) is used.
-
code_bytes [X86] How many bytes of object code to print
in an oops report.
Range: 0 - 8192
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index b6d9c32..89ea346 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -4,8 +4,6 @@ config ARM
select HAVE_AOUT
select HAVE_DMA_API_DEBUG
select HAVE_IDE if PCI || ISA || PCMCIA
- select HAVE_DMA_CONTIGUOUS if (CPU_V6 || CPU_V6K || CPU_V7)
- select CMA if (CPU_V6 || CPU_V6K || CPU_V7)
select HAVE_MEMBLOCK
select RTC_LIB
select SYS_SUPPORTS_APM_EMULATION
diff --git a/arch/arm/include/asm/dma-contiguous.h b/arch/arm/include/asm/dma-contiguous.h
deleted file mode 100644
index c7ba05e..0000000
--- a/arch/arm/include/asm/dma-contiguous.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef ASMARM_DMA_CONTIGUOUS_H
-#define ASMARM_DMA_CONTIGUOUS_H
-
-#ifdef __KERNEL__
-
-#include <linux/device.h-#include <linux/dma-contiguous.h-#include <asm-generic/dma-contiguous.h-
-#ifdef CONFIG_CMA
-
-void dma_contiguous_early_fixup(phys_addr_t base, unsigned long size);
-
-#endif
-#endif
-#endif
diff --git a/arch/arm/include/asm/mach/map.h b/arch/arm/include/asm/mach/map.h
index a6efcdd..b36f365 100644
--- a/arch/arm/include/asm/mach/map.h
+++ b/arch/arm/include/asm/mach/map.h
@@ -30,7 +30,6 @@ struct map_desc {
#define MT_MEMORY_DTCM 12
#define MT_MEMORY_ITCM 13
#define MT_MEMORY_SO 14
-#define MT_MEMORY_DMA_READY 15

#ifdef CONFIG_MMU
extern void iotable_init(struct map_desc *, int);
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index ca66c99..8b13930 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -78,7 +78,6 @@ __setup("fpe=", fpe_setup);
extern void paging_init(struct machine_desc *desc);
extern void sanity_check_meminfo(void);
extern void reboot_setup(char *str);
-extern void setup_dma_zone(struct machine_desc *desc);

unsigned int processor_id;
EXPORT_SYMBOL(processor_id);
@@ -924,7 +923,6 @@ void __init setup_arch(char **cmdline_p)
parse_early_param();

sanity_check_meminfo();
- setup_dma_zone(mdesc);
arm_memblock_init(&meminfo, mdesc);

paging_init(mdesc);
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 6f1fa3e..1aa664a 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -17,9 +17,7 @@
#include <linux/init.h #include <linux/device.h #include <linux/dma-mapping.h-#include <linux/dma-contiguous.h #include <linux/highmem.h-#include <linux/memblock.h #include <linux/slab.h
#include <asm/memory.h@@ -28,8 +26,6 @@
#include <asm/tlbflush.h #include <asm/sizes.h #include <asm/mach/arch.h-#include <asm/mach/map.h-#include <asm/dma-contiguous.h
#include "mm.h"

@@ -60,19 +56,6 @@ static u64 get_coherent_dma_mask(struct device *dev)
return mask;
}

-static void __dma_clear_buffer(struct page *page, size_t size)
-{
- void *ptr;
- /*
- * Ensure that the allocated pages are zeroed, and that any data
- * lurking in the kernel direct-mapped region is invalidated.
- */
- ptr = page_address(page);
- memset(ptr, 0, size);
- dmac_flush_range(ptr, ptr + size);
- outer_flush_range(__pa(ptr), __pa(ptr) + size);
-}
-
/*
* Allocate a DMA buffer for 'dev' of size 'size' using the
* specified gfp mask. Note that 'size' must be page aligned.
@@ -81,6 +64,23 @@ static struct page *__dma_alloc_buffer(struct device *dev, size_t size, gfp_t gf
{
unsigned long order = get_order(size);
struct page *page, *p, *e;
+ void *ptr;
+ u64 mask = get_coherent_dma_mask(dev);
+
+#ifdef CONFIG_DMA_API_DEBUG
+ u64 limit = (mask + 1) & ~mask;
+ if (limit && size + dev_warn(dev, "coherent allocation too big (requested %#x mask %#llx)\n",
+ size, mask);
+ return NULL;
+ }
+#endif
+
+ if (!mask)
+ return NULL;
+
+ if (mask < 0xffffffffULL)
+ gfp |= GFP_DMA;

page = alloc_pages(gfp, order);
if (!page)
@@ -93,7 +93,14 @@ static struct page *__dma_alloc_buffer(struct device *dev, size_t size, gfp_t gf
for (p = page + (size __free_page(p);

- __dma_clear_buffer(page, size);
+ /*
+ * Ensure that the allocated pages are zeroed, and that any data
+ * lurking in the kernel direct-mapped region is invalidated.
+ */
+ ptr = page_address(page);
+ memset(ptr, 0, size);
+ dmac_flush_range(ptr, ptr + size);
+ outer_flush_range(__pa(ptr), __pa(ptr) + size);

return page;
}
@@ -163,9 +170,6 @@ static int __init consistent_init(void)
unsigned long base = consistent_base;
unsigned long num_ptes = (CONSISTENT_END - base)
- if (cpu_architecture() - return 0;
-
consistent_pte = kmalloc(num_ptes * sizeof(pte_t), GFP_KERNEL);
if (!consistent_pte) {
pr_err("%s: no memory\n", __func__);
@@ -206,100 +210,8 @@ static int __init consistent_init(void)

return ret;
}
-core_initcall(consistent_init);
-
-static void *__alloc_from_contiguous(struct device *dev, size_t size,
- pgprot_t prot, struct page **ret_page);
-
-static struct arm_vmregion_head coherent_head = {
- .vm_lock = __SPIN_LOCK_UNLOCKED(&coherent_head.vm_lock),
- .vm_list = LIST_HEAD_INIT(coherent_head.vm_list),
-};
-
-size_t coherent_pool_size = DEFAULT_CONSISTENT_DMA_SIZE / 8;
-
-static int __init early_coherent_pool(char *p)
-{
- coherent_pool_size = memparse(p, &p);
- return 0;
-}
-early_param("coherent_pool", early_coherent_pool);
-
-/*
- * Initialise the coherent pool for atomic allocations.
- */
-static int __init coherent_init(void)
-{
- pgprot_t prot = pgprot_dmacoherent(pgprot_kernel);
- size_t size = coherent_pool_size;
- struct page *page;
- void *ptr;
-
- if (cpu_architecture() < CPU_ARCH_ARMv6)
- return 0;
-
- ptr = __alloc_from_contiguous(NULL, size, prot, &page);
- if (ptr) {
- coherent_head.vm_start = (unsigned long) ptr;
- coherent_head.vm_end = (unsigned long) ptr + size;
- printk(KERN_INFO "DMA: preallocated %u KiB pool for atomic coherent allocations\n",
- (unsigned)size / 1024);
- return 0;
- }
- printk(KERN_ERR "DMA: failed to allocate %u KiB pool for atomic coherent allocation\n",
- (unsigned)size / 1024);
- return -ENOMEM;
-}
-/*
- * CMA is activated by core_initcall, so we must be called after it
- */
-postcore_initcall(coherent_init);

-struct dma_contig_early_reserve {
- phys_addr_t base;
- unsigned long size;
-};
-
-static struct dma_contig_early_reserve dma_mmu_remap[MAX_CMA_AREAS] __initdata;
-
-static int dma_mmu_remap_num __initdata;
-
-void __init dma_contiguous_early_fixup(phys_addr_t base, unsigned long size)
-{
- dma_mmu_remap[dma_mmu_remap_num].base = base;
- dma_mmu_remap[dma_mmu_remap_num].size = size;
- dma_mmu_remap_num++;
-}
-
-void __init dma_contiguous_remap(void)
-{
- int i;
- for (i = 0; i < dma_mmu_remap_num; i++) {
- phys_addr_t start = dma_mmu_remap[i].base;
- phys_addr_t end = start + dma_mmu_remap[i].size;
- struct map_desc map;
- unsigned long addr;
-
- if (end - end = arm_lowmem_limit;
- if (start - return;
-
- map.pfn = __phys_to_pfn(start);
- map.virtual = __phys_to_virt(start);
- map.length = end - start;
- map.type = MT_MEMORY_DMA_READY;
-
- /*
- * Clear previous low-memory mapping
- */
- for (addr = __phys_to_virt(start); addr < __phys_to_virt(end);
- addr += PGDIR_SIZE)
- pmd_clear(pmd_off_k(addr));
-
- iotable_init(&map, 1);
- }
-}
+core_initcall(consistent_init);

static void *
__dma_alloc_remap(struct page *page, size_t size, gfp_t gfp, pgprot_t prot)
@@ -406,154 +318,17 @@ static void __dma_free_remap(void *cpu_addr, size_t size)
arm_vmregion_free(&consistent_head, c);
}

-static int __dma_update_pte(pte_t *pte, pgtable_t token, unsigned long addr,
- void *data)
-{
- struct page *page = virt_to_page(addr);
- pgprot_t prot = *(pgprot_t *)data;
-
- set_pte_ext(pte, mk_pte(page, prot), 0);
- return 0;
-}
-
-static void __dma_remap(struct page *page, size_t size, pgprot_t prot)
-{
- unsigned long start = (unsigned long) page_address(page);
- unsigned end = start + size;
-
- apply_to_page_range(&init_mm, start, size, __dma_update_pte, &prot);
- dsb();
- flush_tlb_kernel_range(start, end);
-}
-
-static void *__alloc_remap_buffer(struct device *dev, size_t size, gfp_t gfp,
- pgprot_t prot, struct page **ret_page)
-{
- struct page *page;
- void *ptr;
- page = __dma_alloc_buffer(dev, size, gfp);
- if (!page)
- return NULL;
-
- ptr = __dma_alloc_remap(page, size, gfp, prot);
- if (!ptr) {
- __dma_free_buffer(page, size);
- return NULL;
- }
-
- *ret_page = page;
- return ptr;
-}
-
-static void *__alloc_from_pool(struct device *dev, size_t size,
- struct page **ret_page)
-{
- struct arm_vmregion *c;
- size_t align;
-
- if (!coherent_head.vm_start) {
- printk(KERN_ERR "%s: coherent pool not initialised!\n",
- __func__);
- dump_stack();
- return NULL;
- }
-
- /*
- * Align the region allocation - allocations from pool are rather
- * small, so align them to their order in pages, minimum is a page
- * size. This helps reduce fragmentation of the DMA space.
- */
- align = PAGE_SIZE << get_order(size);
- c = arm_vmregion_alloc(&coherent_head, align, size, 0);
- if (c) {
- void *ptr = (void *)c-- struct page *page = virt_to_page(ptr);
- *ret_page = page;
- return ptr;
- }
- return NULL;
-}
-
-static int __free_from_pool(void *cpu_addr, size_t size)
-{
- unsigned long start = (unsigned long)cpu_addr;
- unsigned long end = start + size;
- struct arm_vmregion *c;
-
- if (start < coherent_head.vm_start || end - return 0;
-
- c = arm_vmregion_find_remove(&coherent_head, (unsigned long)start);
-
- if ((c-- printk(KERN_ERR "%s: freeing wrong coherent size (%ld != %d)\n",
- __func__, c-- dump_stack();
- size = c-- }
-
- arm_vmregion_free(&coherent_head, c);
- return 1;
-}
-
-static void *__alloc_from_contiguous(struct device *dev, size_t size,
- pgprot_t prot, struct page **ret_page)
-{
- unsigned long order = get_order(size);
- size_t count = size - struct page *page;
-
- page = dma_alloc_from_contiguous(dev, count, order);
- if (!page)
- return NULL;
-
- __dma_clear_buffer(page, size);
- __dma_remap(page, size, prot);
-
- *ret_page = page;
- return page_address(page);
-}
-
-static void __free_from_contiguous(struct device *dev, struct page *page,
- size_t size)
-{
- __dma_remap(page, size, pgprot_kernel);
- dma_release_from_contiguous(dev, page, size -}
-
-#define nommu() 0
-
#else /* !CONFIG_MMU */

-#define nommu() 1
-
-#define __alloc_remap_buffer(dev, size, gfp, prot, ret) NULL
-#define __alloc_from_pool(dev, size, ret_page) NULL
-#define __alloc_from_contiguous(dev, size, prot, ret) NULL
-#define __free_from_pool(cpu_addr, size) 0
-#define __free_from_contiguous(dev, page, size) do { } while (0)
-#define __dma_free_remap(cpu_addr, size) do { } while (0)
+#define __dma_alloc_remap(page, size, gfp, prot) page_address(page)
+#define __dma_free_remap(addr, size) do { } while (0)

#endif /* CONFIG_MMU */

-static void *__alloc_simple_buffer(struct device *dev, size_t size, gfp_t gfp,
- struct page **ret_page)
-{
- struct page *page;
- page = __dma_alloc_buffer(dev, size, gfp);
- if (!page)
- return NULL;
-
- *ret_page = page;
- return page_address(page);
-}
-
-
-
-static void *__dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
- gfp_t gfp, pgprot_t prot)
+static void *
+__dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp,
+ pgprot_t prot)
{
- u64 mask = get_coherent_dma_mask(dev);
struct page *page;
void *addr;

@@ -566,35 +341,22 @@ static void *__dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
*/
gfp &= ~(__GFP_COMP);

-#ifdef CONFIG_DMA_API_DEBUG
- u64 limit = (mask + 1) & ~mask;
- if (limit && size - dev_warn(dev, "coherent allocation too big (requested %#x mask %#llx)\n",
- size, mask);
- return NULL;
- }
-#endif
-
- if (!mask)
- return NULL;
-
- if (mask < 0xffffffffULL)
- gfp |= GFP_DMA;
-
*handle = ~0;
size = PAGE_ALIGN(size);

- if (arch_is_coherent() || nommu())
- addr = __alloc_simple_buffer(dev, size, gfp, &page);
- else if (cpu_architecture() < CPU_ARCH_ARMv6)
- addr = __alloc_remap_buffer(dev, size, gfp, prot, &page);
- else if (gfp & GFP_ATOMIC)
- addr = __alloc_from_pool(dev, size, &page);
+ page = __dma_alloc_buffer(dev, size, gfp);
+ if (!page)
+ return NULL;
+
+ if (!arch_is_coherent())
+ addr = __dma_alloc_remap(page, size, gfp, prot);
else
- addr = __alloc_from_contiguous(dev, size, prot, &page);
+ addr = page_address(page);

if (addr)
*handle = pfn_to_dma(dev, page_to_pfn(page));
+ else
+ __dma_free_buffer(page, size);

return addr;
}
@@ -603,8 +365,8 @@ static void *__dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
* Allocate DMA-coherent memory space and return both the kernel remapped
* virtual and bus address for that space.
*/
-void *dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *handle,
- gfp_t gfp)
+void *
+dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp)
{
void *memory;

@@ -633,11 +395,25 @@ static int dma_mmap(struct device *dev, struct vm_area_struct *vma,
{
int ret = -ENXIO;
#ifdef CONFIG_MMU
- unsigned long pfn = dma_to_pfn(dev, dma_addr);
- ret = remap_pfn_range(vma, vma-- pfn + vma-- vma-- vma-+ unsigned long user_size, kern_size;
+ struct arm_vmregion *c;
+
+ user_size = (vma-+
+ c = arm_vmregion_find(&consistent_head, (unsigned long)cpu_addr);
+ if (c) {
+ unsigned long off = vma-+
+ kern_size = (c-+
+ if (off < kern_size &&
+ user_size <= (kern_size - off)) {
+ ret = remap_pfn_range(vma, vma-+ page_to_pfn(c-+ user_size << PAGE_SHIFT,
+ vma-+ }
+ }
#endif /* CONFIG_MMU */

return ret;
@@ -659,33 +435,23 @@ int dma_mmap_writecombine(struct device *dev, struct vm_area_struct *vma,
}
EXPORT_SYMBOL(dma_mmap_writecombine);

-
/*
- * Free a buffer as defined by the above mapping.
+ * free a page as defined by the above mapping.
+ * Must not be called with IRQs disabled.
*/
void dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, dma_addr_t handle)
{
- struct page *page = pfn_to_page(dma_to_pfn(dev, handle));
+ WARN_ON(irqs_disabled());

if (dma_release_from_coherent(dev, get_order(size), cpu_addr))
return;

size = PAGE_ALIGN(size);

- if (arch_is_coherent() || nommu()) {
- __dma_free_buffer(page, size);
- } else if (cpu_architecture() < CPU_ARCH_ARMv6) {
+ if (!arch_is_coherent())
__dma_free_remap(cpu_addr, size);
- __dma_free_buffer(page, size);
- } else {
- if (__free_from_pool(cpu_addr, size))
- return;
- /*
- * Non-atomic allocations cannot be freed with IRQs disabled
- */
- WARN_ON(irqs_disabled());
- __free_from_contiguous(dev, page, size);
- }
+
+ __dma_free_buffer(pfn_to_page(dma_to_pfn(dev, handle)), size);
}
EXPORT_SYMBOL(dma_free_coherent);

diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index adddcde..fbdd12e 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -21,7 +21,6 @@
#include <linux/gfp.h #include <linux/memblock.h #include <linux/sort.h-#include <linux/dma-contiguous.h
#include <asm/mach-types.h #include <asm/prom.h@@ -239,17 +238,6 @@ static void __init arm_adjust_dma_zone(unsigned long *size, unsigned long *hole,
}
#endif

-void __init setup_dma_zone(struct machine_desc *mdesc)
-{
-#ifdef CONFIG_ZONE_DMA
- if (mdesc-- arm_dma_zone_size = mdesc-- arm_dma_limit = PHYS_OFFSET + arm_dma_zone_size - 1;
- } else
- arm_dma_limit = 0xffffffff;
-#endif
-}
-
static void __init arm_bootmem_free(unsigned long min, unsigned long max_low,
unsigned long max_high)
{
@@ -297,9 +285,12 @@ static void __init arm_bootmem_free(unsigned long min, unsigned long max_low,
* Adjust the sizes according to any special requirements for
* this machine type.
*/
- if (arm_dma_zone_size)
+ if (arm_dma_zone_size) {
arm_adjust_dma_zone(zone_size, zhole_size,
arm_dma_zone_size + arm_dma_limit = PHYS_OFFSET + arm_dma_zone_size - 1;
+ } else
+ arm_dma_limit = 0xffffffff;
#endif

free_area_init_node(0, zone_size, min, zhole_size);
@@ -380,9 +371,6 @@ void __init arm_memblock_init(struct meminfo *mi, struct machine_desc *mdesc)
if (mdesc- mdesc-
- /* reserve memory for DMA contigouos allocations */
- dma_contiguous_reserve(arm_dma_limit);
-
memblock_analyze();
memblock_dump_all();
}
diff --git a/arch/arm/mm/mm.h b/arch/arm/mm/mm.h
index fa95d9b..ad7cce3 100644
--- a/arch/arm/mm/mm.h
+++ b/arch/arm/mm/mm.h
@@ -29,8 +29,5 @@ extern u32 arm_dma_limit;
#define arm_dma_limit ((u32)~0)
#endif

-extern phys_addr_t arm_lowmem_limit;
-
void __init bootmem_init(void);
void arm_mm_memblock_reserve(void);
-void dma_contiguous_remap(void);
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 9796cf1..dc8c550 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -281,11 +281,6 @@ static struct mem_type mem_types[] = {
PMD_SECT_UNCACHED | PMD_SECT_XN,
.domain = DOMAIN_KERNEL,
},
- [MT_MEMORY_DMA_READY] = {
- .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY,
- .prot_l1 = PMD_TYPE_TABLE,
- .domain = DOMAIN_KERNEL,
- },
};

const struct mem_type *get_mem_type(unsigned int type)
@@ -427,7 +422,6 @@ static void __init build_mem_type_table(void)
if (arch_is_coherent() && cpu_is_xsc3()) {
mem_types[MT_MEMORY].prot_sect |= PMD_SECT_S;
mem_types[MT_MEMORY].prot_pte |= L_PTE_SHARED;
- mem_types[MT_MEMORY_DMA_READY].prot_pte |= L_PTE_SHARED;
mem_types[MT_MEMORY_NONCACHED].prot_sect |= PMD_SECT_S;
mem_types[MT_MEMORY_NONCACHED].prot_pte |= L_PTE_SHARED;
}
@@ -457,7 +451,6 @@ static void __init build_mem_type_table(void)
mem_types[MT_DEVICE_CACHED].prot_pte |= L_PTE_SHARED;
mem_types[MT_MEMORY].prot_sect |= PMD_SECT_S;
mem_types[MT_MEMORY].prot_pte |= L_PTE_SHARED;
- mem_types[MT_MEMORY_DMA_READY].prot_pte |= L_PTE_SHARED;
mem_types[MT_MEMORY_NONCACHED].prot_sect |= PMD_SECT_S;
mem_types[MT_MEMORY_NONCACHED].prot_pte |= L_PTE_SHARED;
}
@@ -497,7 +490,6 @@ static void __init build_mem_type_table(void)
mem_types[MT_HIGH_VECTORS].prot_l1 |= ecc_mask;
mem_types[MT_MEMORY].prot_sect |= ecc_mask | cp- mem_types[MT_MEMORY].prot_pte |= kern_pgprot;
- mem_types[MT_MEMORY_DMA_READY].prot_pte |= kern_pgprot;
mem_types[MT_MEMORY_NONCACHED].prot_sect |= ecc_mask;
mem_types[MT_ROM].prot_sect |= cp-
@@ -577,7 +569,7 @@ static void __init alloc_init_section(pud_t *pud, unsigned long addr,
* L1 entries, whereas PGDs refer to a group of L1 entries making
* up one logical pointer to an L2 table.
*/
- if (type-+ if (((addr | end | phys) & ~SECTION_MASK) == 0) {
pmd_t *p = pmd;

if (addr & SECTION_SIZE)
@@ -773,7 +765,7 @@ static int __init early_vmalloc(char *arg)
}
early_param("vmalloc", early_vmalloc);

-phys_addr_t arm_lowmem_limit __initdata = 0;
+static phys_addr_t lowmem_limit __initdata = 0;

void __init sanity_check_meminfo(void)
{
@@ -842,8 +834,8 @@ void __init sanity_check_meminfo(void)
bank- }
#endif
- if (!bank-- arm_lowmem_limit = bank-+ if (!bank-+ lowmem_limit = bank-
j++;
}
@@ -868,7 +860,7 @@ void __init sanity_check_meminfo(void)
}
#endif
meminfo.nr_banks = j;
- memblock_set_current_limit(arm_lowmem_limit);
+ memblock_set_current_limit(lowmem_limit);
}

static inline void prepare_page_table(void)
@@ -893,8 +885,8 @@ static inline void prepare_page_table(void)
* Find the end of the first block of lowmem.
*/
end = memblock.memory.regions[0].base + memblock.memory.regions[0].size;
- if (end - end = arm_lowmem_limit;
+ if (end + end = lowmem_limit;

/*
* Clear out all the kernel space mappings, except for the first
@@ -1028,8 +1020,8 @@ static void __init map_lowmem(void)
phys_addr_t end = start + reg- struct map_desc map;

- if (end - end = arm_lowmem_limit;
+ if (end + end = lowmem_limit;
if (start break;

@@ -1050,12 +1042,11 @@ void __init paging_init(struct machine_desc *mdesc)
{
void *zero_page;

- memblock_set_current_limit(arm_lowmem_limit);
+ memblock_set_current_limit(lowmem_limit);

build_mem_type_table();
prepare_page_table();
map_lowmem();
- dma_contiguous_remap();
devicemaps_init(mdesc);
kmap_init();

--
1.7.5.4

--
kernel-team mailing list
kern...@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team

On Tue, 24 Jan 2012 21:38:36 +0800, Andy Green <...@linaro.org

On 01/24/2012 08:26 PM, Somebody in the thread at some point said:

Hum, well CMA is needed for Panda Camera driver which is also in our
trees, I don't see this bug here either.

But if it's making problems and you don't need Camera, I guess this is
reasonable solution.

-Andy

--
Andy Green | TI Landing Team Leader
Linaro.org │ Open source software for ARM SoCs | Follow Linaro
http://facebook.com/pages/Linaro/155974581091106 -
http://twitter.com/#!/linaroorg - http://linaro.org/linaro-blog

--
kernel-team mailing list
kern...@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team

On Tue, 24 Jan 2012 14:54:28 +0100, Paolo Pisati <...@canonical.com

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

do you specify where the memory banks are located at boot time? e.g.
mem=456M@0x80000000 mem=512M@0xA0000000

in case you don't, the usb driver should panic whenever it tries to a
__alloc_from_pool().
- --
bye,
p.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJPHrgPAAoJEJdscTmfuQbQZWcP/j0PGmYmGWZoywt0Tfs5FsBF
1EcbnE1bL3/jo2KedtT/5VOiTN9ptHw4SIb1PlvZPaFpO+TJrqQWBPwgVuJz5wk+
JvKmbiJ45UkrEB0izasWyQGnjV8UOEIiCb9QSxrd2XFBgOOknaxhF6QgO4y3osuJ
aLMgRleCgxz7x23v5U/pkC6gjMzdWli3nlq4n5Sd0Nw9LpYawNXfXaEWeH+gGHyJ
Xr3h7knLCwhXJ0H1FEaAQroynwwqJ7TX3zgHtqbAzFmwYrk4Y2oUdBYU/5lberrj
vQpHYKGts+0YLtH52daNkXj9ey3bk/IRe6jhO0XZFEo+VdykzaJX7z69ZmIecPYi
dfGDHu9u+Uyr1WwmOKf/WeITLvXQcNYXBoQdCL32zxHlrHjcLT8ffzSNkCsTyo/2
jYJULCR1hXh/TfI1jbTBvKbgSSRhGivuxWKSDtz/vpaka7YSeyLULROecNj6RPG9
+u3iGcYgZ6VFEMCp+UNXC3YJXOadbgz3Yf9otKM5QYW4F1xzXbnkEHxlj6IvovEP
DwXJCdJ8XrQEt4DuSzoYDe8jr44uxgQ0xHPCXQ47rTQtxB9yMJvhxDaebnAP4BkM
bZGwv5HhaeVAWfXawaf6MMz3YE+MfOHCpWc0u7X5wbh18yT10Wfpco/uHEm22DWj
3fr2LsIe7+4i30NAPWVG
=39j+
-----END PGP SIGNATURE-----

--
kernel-team mailing list
kern...@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team

On Tue, 24 Jan 2012 18:14:59 +0100, "Dechesne, Nicolas" <...@ti.com

Rob, Sergio,

please see below

On Tue, Jan 24, 2012 at 2:54 PM, Paolo Pisati <...@canonical.com
the CMA + v4l2 driver coming from Linaro 3.2 kernel is reaching Ubuntu
12.04, and CMA is causing issue that disappear when we add the memory hole
in the bootargs.

that doesn't make too much sense to me (the mem hole). it was needed for
Multimedia stuff with syslink2.0, but since we no longer support syslink2.0
moving forward we should not need that any more. so i guess something is
wrong with the CMA config, or the patches...

does it ring a bell?

<font
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"Hash: SHA1<br<div class="im"On 01/24/2012 02:38 PM, Andy Green wrote:<br><br> Hum, well CMA is needed for Panda Camera driver which is also in<br> our trees, I don't see this bug here either.<br><br> But if it's making problems and you don't need Camera, I guess this<br> is reasonable solution.<br<br</divmem=456M@0x80000000 mem=512M@0xA0000000<br<br
<brin case you don't, the usb driver should panic whenever it tries to a<br__alloc_from_pool().<br- --<brbye,<brp.<br-----BEGIN PGP SIGNATURE-----<brVersion: GnuPG v1.4.11 (GNU/Linux)<brComment: Using GnuPG with Mozilla - <a href="http://enigmail.mozdev.org/" target="_blank"<briQIcBAEBAgAGBQJPHrgPAAoJEJdscTmfuQbQZWcP/j0PGmYmGWZoywt0Tfs 5FsBF<br1EcbnE1bL3/jo2KedtT/5VOiTN9ptHw4SIb1PlvZPaFpO+TJrqQWBPwgVuJz5wk+<b rJvKmbiJ45UkrEB0izasWyQGnjV8UOEIiCb9QSxrd2XFBgOOknaxhF6QgO4y3osuJ<braLMgRleCg xz7x23v5U/pkC6gjMzdWli3nlq4n5Sd0Nw9LpYawNXfXaEWeH+gGHyJ<brXr3h7knLCwhXJ0H1FEa AQroynwwqJ7TX3zgHtqbAzFmwYrk4Y2oUdBYU/5lberrj<brvQpHYKGts+0YLtH52daNkXj9ey3bk /IRe6jhO0XZFEo+VdykzaJX7z69ZmIecPYi<brdfGDHu9u+Uyr1WwmOKf/WeITLvXQcNYXBoQdCL3 2zxHlrHjcLT8ffzSNkCsTyo/2<brjYJULCR1hXh/TfI1jbTBvKbgSSRhGivuxWKSDtz/vpaka7YSe yLULROecNj6RPG9<br+u3iGcYgZ6VFEMCp+UNXC3YJXOadbgz3Yf9otKM5QYW4F1xzXbnkEHxlj6I vovEP<brDwXJCdJ8XrQEt4DuSzoYDe8jr44uxgQ0xHPCXQ47rTQtxB9yMJvhxDaebnAP4BkM<b rbZGwv5HhaeVAWfXawaf6MMz3YE+MfOHCpWc0u7X5wbh18yT10Wfpco/uHEm22DWj<br3fr2LsIe7 +4i30NAPWVG<br=39j+<br-----END PGP SIGNATURE-----<br<div class="HOEnZb"--<brkernel-team mailing list<br<a href...@lists.ubuntu.com"<a href="https://lists.ubuntu.com/mailman/listinfo/kernel-team" target="_blank"</div

--
kernel-team mailing list
kern...@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team

On Tue, 24 Jan 2012 11:27:40 -0600, "Clark, Rob" <...@ti.com

Could someone be a bit more specific than "CMA is causing issue that
disappear when we add the memory hole in the bootargs"?

If you aren't using syslink2 then you don't need the whole in memory.
But there are some potential highmem issues w/ CMA. (Building kernel
w/ 2g/2g split is one possible workaround now)

BR,
-R

On Tue, Jan 24, 2012 at 11:14 AM, Dechesne, Nicolas <...@ti.com
--
kernel-team mailing list
kern...@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team

On Wed, 25 Jan 2012 12:40:53 +0100, Paolo Pisati <...@canonical.com

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On a 3.2.1 + agreen's kernel-tilt/tilt-tracking @ c39eb9613c [1],
during boot we got this:

http://paste.ubuntu.com/814182/

with these boot arguments:

http://paste.ubuntu.com/814183/

...
[ 2.593322] __alloc_from_pool: coherent pool not initialised!
...

comes from arch/arm/mm/dma-mapping.c::__alloc_from_pool():

...
if (!coherent_head.vm_start) {
printk(KERN_ERR "%s: coherent pool not initialised!\n",
__func__);
dump_stack();
return NULL;
}
...

and coherent_head.vm_start is initialized in coherent_init() (called
from postcore_initcall()):

...
ptr = __alloc_from_contiguous(NULL, size, prot, &page);
if (ptr) {
coherent_head.vm_start = (unsigned long) ptr;
coherent_head.vm_end = (unsigned long) ptr + size;
printk(KERN_INFO "DMA: preallocated %u KiB pool for atomic
coherent allocations\n",
(unsigned)size / 1024);
return 0;
}
printk(KERN_ERR "DMA: failed to allocate %u KiB pool for atomic
coherent allocation\n",
(unsigned)size / 1024);
return -ENOMEM;

...
[ 0.339477] DMA: failed to allocate 256 KiB pool for atomic
coherent allocation
...

__alloc_from_contiguous():

pr_err("__alloc_from_contiguous: count=%lu, order=%lu\n", (unsigned
long)count, order);

page = dma_alloc_from_contiguous(dev, count, order);
if (!page)
return NULL;

pr_err("__alloc_from_contiguous: page=%p, size=%lu\n", page,
(unsigned long)size);

...
[ 0.330535] __alloc_from_contiguous: count=64, order=6
[ 0.330810] Trying to unpack rootfs image as initramfs...
[ 0.339477] DMA: failed to allocate 256 KiB pool for atomic
coherent allocation
...

I didn't notice this panic when i did the first rebase because i had
these arguments in my bootargs:

mem=456M@0x80000000 mem=512M@0xA0000000

as these somehow workarounded the problem and made the kernel boot.

Now, since all of this came with CMA, and CMA is not in mainline and
we already need hacks to make it work (e.g. 4b345a6 and dce4ad0), i
thought the best solution (with alpha2 kernel freeze approaching) was
to revert CMA and so i did (and rbasak confirmed the revert fixed all
the issues he saw).

I hope this time it's a bit more clear for anyone.

1:
http://kernel.ubuntu.com/git?p=ubuntu/ubuntu-precise.git;a=shortlog;h=refs/head s/ti-omap4
- --
bye,
p.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJPH+pAAAoJEJdscTmfuQbQzhMP/274JECf053+KkvRe/qUuiAV
QVVruNnYWBzWYESV/xu6HoGhN/3ubP+A2e4nJ26GSsj/JfZ0MF8vwsLzbg66Ido3
Kxw1YI8OuSJw9cLxVhXWq9muvoPF65K7gjn3ggYqqEJmB+LT9FBt4UPnFPU+RaoA
j4/poJe7J2lKLcty8AwcxypERef6QPKFyX+OWsXumvfTVI9oD1mRVO07lpVhxKYR
Lim8Q50FSk30tBdBKOxhI6OztaW8x5lbJ4c6CsjyDfV9hhJiXin2ZbcH/QgADGMg
XiWu8cDnI+9BTtNgR3Z2zWX4dpyetXx2Mjqe67OECqFKE/LQ+pjEWgu3dTm3F6Mf
abpGuluzxMfYiDn6xY/T5N1oSSj7QiDmQc6QHyluzvKuDi/HFTxJUOTqQ0UjzrYE
8wbF60cScTITvb20JXvQshekaS8xSTP9QQ6i2+us82AiY2QNNQ+X3Ukxq415n4dm
iQ39FB/q9a0PoZ5eS0VO1iUP4mn7AnaXL/5w76kTq+0a7rDLpIlEf0UtNUpSuD8z
Pj0yCItMcf5sgp2rxshJoj0b8WUulnHqchlCCLxKgYKh5cVFEgPbZb0Su6pEMbrI
7zvph94LBzuW9Invvp60NNB/j+u52KQtubhGQ6T0cBxlHPjbzrBVDbyWXRCMsNvr
4X0n+BeoQ4rFHzzeRS9m
=yk30
-----END PGP SIGNATURE-----

--
kernel-team mailing list
kern...@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team

On Wed, 25 Jan 2012 07:58:27 -0600, "Clark, Rob" <...@ti.com

if we are going to anyways have a kernel which enables multimedia in
the TI PPA, I think it is safe to revert CMA.. I'm not entirely sure
why that carveout would help, unless it is avoiding that the CMA pool
is created in highmem somehow (which is a known issue w/ current CMA)

I'm using CMA without this issue on 3.3-rc1, and had previously used
it on various 3.2-rc's.. but with a 2g/2g memory split to avoid
highmem.

BR,
-R

On Wed, Jan 25, 2012 at 5:40 AM, Paolo Pisati
<...@canonical.com
--
kernel-team mailing list
kern...@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team

On Wed, 25 Jan 2012 18:10:45 +0100, Paolo Pisati <...@canonical.com

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

ok, i just sent a pull request to remove CMA, thanks for the support.
- --
bye,
p.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJPIDeVAAoJEJdscTmfuQbQBSoQAIRDwDAXIrMrlaUMCl0hGn+r
1czAh0g2CrMQ8a+QTX8xKPIemWeMP/+7L6hr/fm3bfgJUktbPZcxlA3HuHDDafLS
EDBcOiK1MjmnL27/gv6YeUCYBNESw6AQp+HRZ/Y6Ap3rkT9kSfZtoznIHjG0Zg2D
A+pBCjxn7FeG4gBCoEcKvtiPHa48EevtifGyoIoybuqq9ZmRnAqD73zKZvoxlt8S
JhU/sd+eZKNJMYG5Of6pkqOgRGkTvDz0lJns+Zj3dTCrKBt7SF7ChF15rg8M30mp
oCYAYAQZiC9RKBP1s2SYE+YARVfwgfCFLveJGsTag9beiT/4zaU3YVULjl1abCaT
oAhJA+lWYR+LESQA0ZeZHQjgQbsZAh3V5mudygGtF2qw52TUwPepabqFcLc4Dc1O
754qtnxhoa8dx+4Ivss5If9XbglnigE7LLZFs2DVLzZw1TXwNWpnKxatom+ys1tf
UZFkO0LOasacMpg0LJj/z+b8WGEva6Qv42SyARtFxezVAN6VZvOcC28Jydoyn8Z5
XGqPC8/qGZMUlFnzw4ka49tG/7ttxd9IKdtUpQuFSQ8pHV9qzSMboqX8kAO2R1Or
1r2uOrjV3+1K9UheRmzYQyE0emg4GRSYAYdU7RQKvR4mAUV9UdqkyogU69bxaTkU
40RnNhWOOp//yG+CfcLc
=fZhp
-----END PGP SIGNATURE-----

--
kernel-team mailing list
kern...@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team

Discussion Title: [PATCH 0/2] [P/omap4] Remove the CMA
Title Keywords: [PATCH  0/2]  [P/omap4]  Remove