Skip to contentSkip to conversation

ssb: Fix DMA-API compilation for non-PCI systems

DISCUSSION David Miller 3 participants 5 messages Nov 10, 2008 – Nov 11, 2008

Subsystems (2)
lore
Share & tools
lore

David Miller

author maintainer
#0 lore raw

I applied this since it's a build buster and we should get it fixed quickly.

But as I look at this, the thing to really do here is get rid of these stupid switch statements. None of it is needed.

The layer that sets up the SSB devices should simply save the generic device pointer for the DMA entity into some new ->dma_dev struct member.

Then you just use generic dma_*() interfaces unilaterally. For PCI devices it will "just work".

#1 lore raw
Quoted 7 lines · On Monday 10 November 2008 22:52:31 David Miller wrote:

I applied this since it's a build buster and we should get it fixed quickly.

But as I look at this, the thing to really do here is get rid of these stupid switch statements. None of it is needed.

Quoted 6 lines

The layer that sets up the SSB devices should simply save the generic device pointer for the DMA entity into some new ->dma_dev struct member.

Then you just use generic dma_*() interfaces unilaterally. For PCI devices it will "just work".

We tried that. It doesn't work. It breaks on several architectures that do special things in the pci_dma... functions.
See the git history and mailinglists, please.

Signature · 1 line
Greetings Michael.
author maintainer
#2 lore raw

From: Michael Buesch <[email protected]>
Date: Mon, 10 Nov 2008 23:07:37 +0100

Quoted 12 lines · On Monday 10 November 2008 22:52:31 David Miller wrote:
Quoted 11 lines

I applied this since it's a build buster and we should get it fixed quickly.

But as I look at this, the thing to really do here is get rid of these stupid switch statements. None of it is needed.

The layer that sets up the SSB devices should simply save the generic device pointer for the DMA entity into some new ->dma_dev struct member.

Quoted 6 lines
Quoted 2 lines

Then you just use generic dma_*() interfaces unilaterally. For PCI devices it will "just work".

We tried that. It doesn't work. It breaks on several architectures that do special things in the pci_dma... functions.
See the git history and mailinglists, please.

Then those architectures need to fix their implementations, simply. They aren't implementing the generic DMA interfaces properly. Other subsystems do make use of the generic DMA interfaces in this way.

Even something as simple as checking for &pci_bus_type in the dma_*() routines (like powerpc did for quite some time) is enough to fix the problem.

#3 lore raw
Quoted 8 lines · On Monday 10 November 2008 23:53:43 David Miller wrote:

Then those architectures need to fix their implementations, simply. They aren't implementing the generic DMA interfaces properly. Other subsystems do make use of the generic DMA interfaces in this way.

Even something as simple as checking for &pci_bus_type in the dma_*() routines (like powerpc did for quite some time) is enough to fix the problem.

Yeah, sure. The architectures are broken.
But the bugreports hit _my_ code. I got pretty tired of forwarding stuff to the arch maintainers, so I implemented something that does work in every situation. The bugreports stopped immediately (Except this tiny build failure that does only hit under rare circumstances).

DMA is pretty much a mess, if you look at how ever arch does implement the API in a slightly different way.
If somebody wants to fix this, I'm certainly OK with it. But for now we will have to live with SSB implementing a wrapper around the ssb-host-device DMA APIs.

Signature · 1 line
Greetings Michael.
#4 lore raw
Quoted 10 lines · Michael Buesch
Quoted 8 lines · On Monday 10 November 2008 23:53:43 David Miller wrote:

Then those architectures need to fix their implementations, simply. They aren't implementing the generic DMA interfaces properly. Other subsystems do make use of the generic DMA interfaces in this way.

Even something as simple as checking for &pci_bus_type in the dma_*() routines (like powerpc did for quite some time) is enough to fix the problem.

Quoted 8 lines

Yeah, sure. The architectures are broken.
But the bugreports hit _my_ code. I got pretty tired of forwarding stuff to the arch maintainers, so I implemented something that does work in every situation. The bugreports stopped immediately (Except this tiny build failure that does only hit under rare circumstances).

DMA is pretty much a mess, if you look at how ever arch does implement the API in a slightly different way.

We have tons of PCI drivers using the dma_ routines. So please report the broken architecture to get it fixes instead of whining.