Skip to contentSkip to conversation

microblaze: use generic dma-mapping-broken.h

PATCH Stephen Neuendorffer 3 participants 8 messages May 12, 2009 3 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Gah... considering the ll_temac needs this, it should get implemented ASAP...
(Yeah, I know... just not enough hours in the day.)

Steve

Quoted 2 lines

-----Original Message-----
From: [email protected]

[mailto:owner-microblaze-

Quoted 5 lines

[email protected]] On Behalf Of Arnd Bergmann
Sent: Monday, May 11, 2009 4:21 PM
To: Michal Simek
Cc: [email protected]; [email protected]
Subject: [microblaze-uclinux] [PATCH 12/12] microblaze: use generic

dma-mapping-broken.h

Quoted 6 lines

Microblaze does not support the Linux DMA mapping API at this point, so disable CONFIG_NO_DMA. This lets us use the generic dma-mapping-broken.h implementation instead of providing a different copy.

Quoted 8 lines

Any drivers that try to use DMA mapping now get omitted from Kconfig or produce a link error, rather than failing silently at run time.

---
 arch/microblaze/Kconfig                   |    2 +-
 arch/microblaze/include/asm/dma-mapping.h |  130
+----------------------------
>  2 files changed, 2 insertions(+), 130 deletions(-)
>  rewrite arch/microblaze/include/asm/dma-mapping.h (100%)

Review

Quoted 15 lines
arch/microblaze/Kconfig +1 -1
index 8cc312b..0d837ee 100644
@@ -55,7 +55,7 @@ config PCI
 
 config NO_DMA
 	depends on !MMU
-	def_bool n
+	def_bool y
 
 source "init/Kconfig"
 
(quoted diff) +0 -0

b/arch/microblaze/include/asm/dma-mapping.h

arch/microblaze/include/asm/dma-mapping.h line 4

Quoted 9 lines

dissimilarity index 100%
index 1733625..d00e400 100644

arch/microblaze/include/asm/dma-mapping.h +0 -4
@@ -1,129 +1 @@
-/*
- * Copyright (C) 2006 Atmark Techno, Inc.
- *
- * This file is subject to the terms and conditions of the GNU

General Public

arch/microblaze/include/asm/dma-mapping.h line 5

Quoted 1 line
arch/microblaze/include/asm/dma-mapping.h +0 -1
- * License. See the file "COPYING" in the main directory of this

archive

arch/microblaze/include/asm/dma-mapping.h line 18

Quoted 13 lines
arch/microblaze/include/asm/dma-mapping.h +0 -13
- * for more details.
- */
-
-#ifndef _ASM_MICROBLAZE_DMA_MAPPING_H
-#define _ASM_MICROBLAZE_DMA_MAPPING_H
-
-#include <asm/cacheflush.h>
-#include <linux/io.h>
-#include <linux/bug.h>
-
-struct scatterlist;
-
-#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h,

f)

arch/microblaze/include/asm/dma-mapping.h line 19

Quoted 1 line
arch/microblaze/include/asm/dma-mapping.h +0 -1
-#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v,

h)

Quoted 9 lines
arch/microblaze/include/asm/dma-mapping.h +0 -9
-
-/* FIXME */
-static inline int
-dma_supported(struct device *dev, u64 mask)
-{
-	return 1;
-}
-
-static inline dma_addr_t

arch/microblaze/include/asm/dma-mapping.h line 38

Quoted 10 lines
arch/microblaze/include/asm/dma-mapping.h +0 -10
-dma_map_page(struct device *dev, struct page *page,
-	unsigned long offset, size_t size,
-	enum dma_data_direction direction)
-{
-	BUG();
-	return 0;
-}
-
-static inline void
-dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t

size,

Quoted 5 lines
arch/microblaze/include/asm/dma-mapping.h +0 -5
-	enum dma_data_direction direction)
-{
-	BUG();
-}
-

arch/microblaze/include/asm/dma-mapping.h line 53

Quoted 10 lines
arch/microblaze/include/asm/dma-mapping.h +0 -10
-static inline int
-dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
-	enum dma_data_direction direction)
-{
-	BUG();
-	return 0;
-}
-
-static inline void
-dma_unmap_sg(struct device *dev, struct scatterlist *sg, int

nhwentries,

arch/microblaze/include/asm/dma-mapping.h line 60

Quoted 7 lines
arch/microblaze/include/asm/dma-mapping.h +0 -7
-	enum dma_data_direction direction)
-{
-	BUG();
-}
-
-static inline void
-dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle,

size_t size,

Quoted 4 lines
arch/microblaze/include/asm/dma-mapping.h +0 -4
-			enum dma_data_direction direction)
-{
-	BUG();
-}

arch/microblaze/include/asm/dma-mapping.h line 74

Quoted 10 lines
arch/microblaze/include/asm/dma-mapping.h +0 -10
-
-static inline void
-dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle,
-		size_t size, enum dma_data_direction direction)
-{
-	BUG();
-}
-
-static inline void
-dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int

nelems,

arch/microblaze/include/asm/dma-mapping.h line 81

Quoted 7 lines
arch/microblaze/include/asm/dma-mapping.h +0 -7
-		enum dma_data_direction direction)
-{
-	BUG();
-}
-
-static inline void
-dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,

int nelems,

arch/microblaze/include/asm/dma-mapping.h line 87

Quoted 6 lines
arch/microblaze/include/asm/dma-mapping.h +0 -6
-		enum dma_data_direction direction)
-{
-	BUG();
-}
-
-static inline int dma_mapping_error(struct device *dev, dma_addr_t

dma_addr)

arch/microblaze/include/asm/dma-mapping.h line 92

Quoted 5 lines
arch/microblaze/include/asm/dma-mapping.h +0 -5
-{
-	return 0;
-}
-
-static inline void *dma_alloc_coherent(struct device *dev, size_t

size,

Quoted 11 lines
arch/microblaze/include/asm/dma-mapping.h +0 -11
-				dma_addr_t *dma_handle, int flag)
-{
-	return NULL; /* consistent_alloc(flag, size, dma_handle); */
-}
-
-static inline void dma_free_coherent(struct device *dev, size_t size,
-			void *vaddr, dma_addr_t dma_handle)
-{
-	BUG();
-}
-

arch/microblaze/include/asm/dma-mapping.h line 113

Quoted 10 lines
arch/microblaze/include/asm/dma-mapping.h +0 -10
-static inline dma_addr_t
-dma_map_single(struct device *dev, void *ptr, size_t size,
-	enum dma_data_direction direction)
-{
-	BUG_ON(direction == DMA_NONE);
-
-	return virt_to_bus(ptr);
-}
-
-static inline void dma_unmap_single(struct device *dev, dma_addr_t

dma_addr,

Quoted 20 lines
arch/microblaze/include/asm/dma-mapping.h +1 -17
-				    size_t size,
-				    enum dma_data_direction direction)
-{
-	switch (direction) {
-	case DMA_FROM_DEVICE:
-		flush_dcache_range((unsigned)dma_addr,
-			(unsigned)dma_addr + size);
-			/* Fall through */
-	case DMA_TO_DEVICE:
-		break;
-	default:
-		BUG();
-	}
-}
-
-#endif /* _ASM_MICROBLAZE_DMA_MAPPING_H */
+#include <asm-generic/dma-mapping-broken.h>
--

1.6.0.4

Quoted 6 lines

--

___________________________
microblaze-uclinux mailing list
[email protected]
Project Home Page :

http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux

Quoted 1 line

Mailing List Archive :

http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/

Quoted 1 line

This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

#3 lore raw
Quoted 5 lines · Stephen Neuendorffer

Gah... considering the ll_temac needs this, it should get implemented ASAP...
(Yeah, I know... just not enough hours in the day.)

FUJITA Tomonori has just posted an asm-generic version of dma-mapping.h, which is half complete. For microblaze, it should be easy to add the missing functions, basically falling back on get_free_pages for all allocations and on page_to_phys for the actual mapping, as in arch/powerpc/kernel/dma.c.

	Arnd <><
#4 lore raw

Sounds like a great idea... That's really all that's necessary for microblazes with write-through cache anyway.

Steve

Quoted 5 lines

-----Original Message-----
From: Arnd Bergmann [mailto:[email protected]]
Sent: Monday, May 11, 2009 5:30 PM
To: Stephen Neuendorffer
Cc: [email protected]; Michal Simek;

[email protected]; FUJITA Tomonori

Quoted 1 line

Subject: Re: [microblaze-uclinux] [PATCH 12/12] microblaze: use

generic dma-mapping-broken.h

Quoted 4 lines · Stephen Neuendorffer
Quoted 2 lines

Gah... considering the ll_temac needs this, it should get

implemented

Quoted 5 lines
Quoted 3 lines

ASAP...
(Yeah, I know... just not enough hours in the day.)

FUJITA Tomonori has just posted an asm-generic version of

dma-mapping.h,

Quoted 6 lines

which is half complete. For microblaze, it should be easy to add the missing functions, basically falling back on get_free_pages for all allocations and on page_to_phys for the actual mapping, as in arch/powerpc/kernel/dma.c.

	Arnd <><

This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw

Re: [PATCH 11/12] microblaze: dont include asm/mmu.h in hw_exception_handler

Arnd Bergmann wrote:

1. Please do not attach your patches - use in-line patches - it is easier for me and for others to review it.

2. I have to reject this patch.
- currently you are right that I should remove mmu.h from hw_exception...S for noMMU kernel
- but on the other hand I need mmu.h for mmu patches - because of MICROBLAZE_TLB_SIZE
- if you think that mmu.h shouldn't be included we have to move this definition to another file
- you can look at my next branch to see mmu context

Thanks,
Michal

Signature · 2 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
#7 lore raw

Re: [PATCH 11/12] microblaze: dont include asm/mmu.h in hw_exception_handler

Quoted 2 lines · Michal Simek

1. Please do not attach your patches - use in-line patches - it is easier for me and for others to review it.

Something went wrong (again...) with my patches this time, so they got rejected by vger. They are not attached however AFAICT, but are inline with the "Content-Disposition: inline;" header, which is generated by "quilt mail". Which tool do you use that does not work with this correctly?

Quoted 4 lines

- but on the other hand I need mmu.h for mmu patches - because of MICROBLAZE_TLB_SIZE
  - if you think that mmu.h shouldn't be included we have to
  move this definition to another file
  - you can look at my next branch to see mmu context

Almost all architectures disallow using mmu.h in assembly, only powerpc and sh have an '#ifndef __ASSEMBLY__' in there. I did the change to allow using my asm-generic/mmu.h for microblaze-nommu.

When your MMU code gets merged, this is no longer required though, because you cannot simply fall back on the asm-generic version anyway.

	Arnd <><
#8 lore raw

Re: [PATCH 11/12] microblaze: dont include asm/mmu.h in hw_exception_handler

Quoted 9 lines · Arnd Bergmann
Quoted 2 lines · Michal Simek

1. Please do not attach your patches - use in-line patches - it is easier for me and for others to review it.

Something went wrong (again...) with my patches this time, so they got rejected by vger. They are not attached however AFAICT, but are inline with the "Content-Disposition: inline;" header, which is generated by "quilt mail". Which tool do you use that does not work with this correctly?

I use sendmail and git-send-email and I use Thunderbird for reviewing.

Quoted 6 lines
Quoted 5 lines

- but on the other hand I need mmu.h for mmu patches - because of MICROBLAZE_TLB_SIZE
- if you think that mmu.h shouldn't be included we have to
move this definition to another file
- you can look at my next branch to see mmu context

Quoted 6 lines

Almost all architectures disallow using mmu.h in assembly, only powerpc and sh have an '#ifndef __ASSEMBLY__' in there. I did the change to allow using my asm-generic/mmu.h for microblaze-nommu.

When your MMU code gets merged, this is no longer required though, because you cannot simply fall back on the asm-generic version anyway.

I have no problem to remove mmu.h from it but I have to move that one TLB macro to different sensible include file. It is related with mmu that's why I think someone in past add it to this file. The main point is which file. Any tip?
Or the second solution is to move directly to .S file but any different include file will be better.

Michal

Quoted 2 lines
	Arnd <><
Signature · 2 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
#9 lore raw

Re: [PATCH 11/12] microblaze: dont include asm/mmu.h in hw_exception_handler

Quoted 3 lines · Michal Simek

I have no problem to remove mmu.h from it but I have to move that one TLB macro to different sensible include file. It is related with mmu that's why I think someone in past add it to this file. The main point is which file. Any tip?

Since the hardware shares a number of properties with ppc440, I guess you are right that it makes sense to keep the kernel implementation similar to arch/powerpc/include/asm/mmu-44x.h. Please keep it the way you have it now, I'll just add #ifndef __ASSEMBLY__ to the asm-generic file.

	Arnd <><
#10 lore raw

Re: [PATCH 00/12] Microblaze fixes for 2.6.31

In reply to a message not in the archive
Quoted 11 lines · Arnd Bergmann

Hi Michal,

These are some cleanups and bug fixes that I came
across while working on my asm-generic headers.

Since I don't have actual hardware, they are
compile tested only. Please test and queue up
for 2.6.31.

Feel free to pull the whole series from git.kernel.org:/pub/scm/linux/kernel/git/arnd/playground.git microblaze-cleanups

All changes except this one ([PATCH 11/12] microblaze: dont include asm/mmu.h in hw_exception_handler) were added to for-linus branch

Thanks,
Michal

Quoted 3 lines
	Arnd <><
Signature · 2 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854