Re: [BK PATCH] USB update for 2.6.3

From: Hollis Blanchard
Date: Fri Feb 20 2004 - 13:27:20 EST


On Feb 20, 2004, at 9:15 AM, Linus Torvalds wrote:

On Thu, 19 Feb 2004, David S. Miller wrote:
On Fri, 20 Feb 2004 18:10:41 +1100
Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx> wrote:

Hrm... so if the USB device drivers are actually doing the dma mapping
themselves, it make sense for them to pass their own struct device, no ?

That's right, at least that was the idea.

No. That would be _fundamentally_ wrong.

There's no way a USB device can do DMA in the first place. It has no DMA
controller, and no way to read/write memory except through the USB host.

So it is the host - and only the host - that matters. Anything else is a
bug.

Sure. So dma-mapping.h does this:
int dma_supported(struct device *dev, u64 mask) {
return device->bus->dma_supported(dev, u64 mask);
}

And USB, when it creates its bus_type, does this:
int usb_dma_supported(struct device *dev, u64 mask) {
usb_dev *usbdev = to_usb_device(dev);
return usbdev->root_hub->controller->bus->dma_supported(controller, u64 mask)
}
And of then PCI has:
int pci_dma_supported(struct device *dev, u64 mask) {
pci_dev *pcidev = to_pci_dev(dev, u64 mask);
...
}

Then a USB driver uses its own usb_device->dev and it all ends up back at the PCI bus.

For PCI devices of course, device->bus->dma_supported() *is* pci_dma_supported(), so there's no middleman (as USB is above).

--
Hollis Blanchard
IBM Linux Technology Center

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/