svn commit: r249476 - in head/sys/dev: ata pci

Konstantin Belousov kostikbel at gmail.com
Sun Apr 14 20:52:33 UTC 2013


On Sun, Apr 14, 2013 at 05:05:07PM +0200, Marius Strobl wrote:
> On Sun, Apr 14, 2013 at 02:02:34PM +0000, Konstantin Belousov wrote:
> > Author: kib
> > Date: Sun Apr 14 14:02:34 2013
> > New Revision: 249476
> > URL: http://svnweb.freebsd.org/changeset/base/249476
> > 
> > Log:
> >   Usnure that PCI bus BIS_GET_DMA_TAG() method sees the actual PCI
> >   device which makes the request for dma tag, instead of some descendant
> >   of the PCI device, by creating a pass-through trampoline for vga_pci
> >   and ata_pci buses.
> 
> If you need to know the last PCI device requesting the DMA tag,
> wouldn't it make more sense to let the consumer of this walk up the
> tree as necessary instead of hacking N drivers? I.e.:
> foo_get_dma_tag(device_t bus, device_t child)
> {
> 	device_t device, parent;
> 	devclass_t pci_devclass;
> 
> 	pci_devclass = devclass_find("pci");
> 	for (device = child; child != bus; device = parent) {
> 		parent = device_get_parent(device);
> 		if (device_get_devclass(parent) != pci_devclass)
> 			continue;
> 		break;
> 	}
> 	/* use device */
> }
The similar approach was my first thought, and I discussed it with John.
After the discussion, I agreed that this is a hack.

My understanding is that this default behaviour is only correct for
the simple cases like the one fixed in the commit. Forcing this on
other buses would only make the bugs hidden and cause more efforts
in trying to identify it.

> 
> I suspect the problem you are hitting is also true for ISA devices
> behind a PCI-ISA-bridge, PCI device drivers attaching non-PCI sub-
> devices requesting DMA tags like sk(4) etc.

And ISA DMA is probably good example why bus by default should not do
the walking up. ISA bridge would need to allocate its own root tag
for the ISA, while ISA bus needs to provide the specific tags and,
most likely, specific busdma functions implementation for the ISA DMA
channels. Of course, this talk assumes that ISA DMA is going to be
converted to busdma.

Unfortunately for me, the conversion looks inevitable.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/svn-src-all/attachments/20130414/b6c1963c/attachment.sig>


More information about the svn-src-all mailing list