Discussion:
[PATCH] arm: dma-mapping: fix compilation error when CONFIG_MMU is not present
Stefan Hengelein
2014-10-19 15:59:00 UTC
Permalink
When CONFIG_MMU is not present, the variable 'atomic_pool' and the
function '__in_atomic_pool' are undeclared but used in part of the
code. Therefore, the compilation breaks.
Now, they are defined to dummy values when CONFIG_MMU is undefined.

This error was found with vampyr.

Signed-off-by: Stefan Hengelein <***@fau.de>
---
arch/arm/mm/dma-mapping.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index c245d90..7d04cf7 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -573,12 +573,14 @@ static inline pgprot_t __get_dma_pgprot(struct dma_attrs *attrs, pgprot_t prot)
#else /* !CONFIG_MMU */

#define nommu() 1
+#define atomic_pool 0

#define __get_dma_pgprot(attrs, prot) __pgprot(0)
#define __alloc_remap_buffer(dev, size, gfp, prot, ret, c) NULL
#define __alloc_from_pool(size, ret_page) NULL
#define __alloc_from_contiguous(dev, size, prot, ret, c) NULL
#define __free_from_pool(cpu_addr, size) 0
+#define __in_atomic_pool(start, size) 0
#define __free_from_contiguous(dev, page, cpu_addr, size) do { } while (0)
#define __dma_free_remap(cpu_addr, size) do { } while (0)
--
1.9.1
Marek Szyprowski
2014-10-20 07:42:55 UTC
Permalink
Hello,
Post by Stefan Hengelein
When CONFIG_MMU is not present, the variable 'atomic_pool' and the
function '__in_atomic_pool' are undeclared but used in part of the
code. Therefore, the compilation breaks.
Now, they are defined to dummy values when CONFIG_MMU is undefined.
This error was found with vampyr.
Frankly, those variables are used only when CONFIG_MMU or
CONFIG_ARM_DMA_USE_IOMMU are set. The latter imho makes only sense
together with CONFIG_MMU, so the issue reported here doesn't really
happen in real world.
Post by Stefan Hengelein
---
arch/arm/mm/dma-mapping.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index c245d90..7d04cf7 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -573,12 +573,14 @@ static inline pgprot_t __get_dma_pgprot(struct dma_attrs *attrs, pgprot_t prot)
#else /* !CONFIG_MMU */
#define nommu() 1
+#define atomic_pool 0
#define __get_dma_pgprot(attrs, prot) __pgprot(0)
#define __alloc_remap_buffer(dev, size, gfp, prot, ret, c) NULL
#define __alloc_from_pool(size, ret_page) NULL
#define __alloc_from_contiguous(dev, size, prot, ret, c) NULL
#define __free_from_pool(cpu_addr, size) 0
+#define __in_atomic_pool(start, size) 0
#define __free_from_contiguous(dev, page, cpu_addr, size) do { } while (0)
#define __dma_free_remap(cpu_addr, size) do { } while (0)
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
Stefan Hengelein
2014-10-20 13:50:27 UTC
Permalink
Well,

arch/arm/mm/dma-mapping.c: In function ‘__atomic_get_pages’:
arch/arm/mm/dma-mapping.c:1265:31: error: ‘atomic_pool’ undeclared
(first use in this function)

arch/arm/mm/dma-mapping.c: In function ‘__iommu_get_pages’:
arch/arm/mm/dma-mapping.c:1275:2: error: implicit declaration of
function ‘__in_atomic_pool’ [-Werror=implicit-function-declaration]


others:
arch/arm/mm/dma-mapping.c: In function ‘__iommu_alloc_remap’:
arch/arm/mm/dma-mapping.c:1200:4: error: ‘VM_ARM_DMA_CONSISTENT’
undeclared (first use in this function)
arch/arm/mm/dma-mapping.c:1200:4: note: each undeclared identifier is
reported only once for each function it appears in

arch/arm/mm/dma-mapping.c: In function ‘__iommu_get_pages’:
arch/arm/mm/dma-mapping.c:1282:29: error: ‘VM_ARM_DMA_CONSISTENT’
undeclared (first use in this function)
arch/arm/mm/dma-mapping.c: In function ‘arm_iommu_free_attrs’:
arch/arm/mm/dma-mapping.c:1411:4: error: ‘VM_ARM_DMA_CONSISTENT’
undeclared (first use in this function)


i've attached a configuration where it happens.
when you place the configuration in your tree and compile the file,
the errors should show up.

However, within the configuration CONFIG_ARM_DMA_USE_IOMMU is defined
and CONFIG_MMU is not. AFAIUI, if both should be enabled together, it
should be mapped in Kconfig somewhere, right?

Best Regards,
Stefan
Post by Marek Szyprowski
Hello,
Post by Stefan Hengelein
When CONFIG_MMU is not present, the variable 'atomic_pool' and the
function '__in_atomic_pool' are undeclared but used in part of the
code. Therefore, the compilation breaks.
Now, they are defined to dummy values when CONFIG_MMU is undefined.
This error was found with vampyr.
Frankly, those variables are used only when CONFIG_MMU or
CONFIG_ARM_DMA_USE_IOMMU are set. The latter imho makes only sense
together with CONFIG_MMU, so the issue reported here doesn't really
happen in real world.
Post by Stefan Hengelein
---
arch/arm/mm/dma-mapping.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index c245d90..7d04cf7 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -573,12 +573,14 @@ static inline pgprot_t __get_dma_pgprot(struct
dma_attrs *attrs, pgprot_t prot)
#else /* !CONFIG_MMU */
#define nommu() 1
+#define atomic_pool 0
#define __get_dma_pgprot(attrs, prot) __pgprot(0)
#define __alloc_remap_buffer(dev, size, gfp, prot, ret, c) NULL
#define __alloc_from_pool(size, ret_page) NULL
#define __alloc_from_contiguous(dev, size, prot, ret, c) NULL
#define __free_from_pool(cpu_addr, size) 0
+#define __in_atomic_pool(start, size) 0
#define __free_from_contiguous(dev, page, cpu_addr, size) do { }
while (0)
#define __dma_free_remap(cpu_addr, size) do { }
while (0)
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
Loading...