Date: Sun, 14 Apr 2013 23:52:22 +0300 From: Konstantin Belousov <kostikbel@gmail.com> To: Marius Strobl <marius@alchemy.franken.de> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r249476 - in head/sys/dev: ata pci Message-ID: <20130414205222.GG2930@kib.kiev.ua> In-Reply-To: <20130414150507.GA62578@alchemy.franken.de> References: <201304141402.r3EE2YIi001357@svn.freebsd.org> <20130414150507.GA62578@alchemy.franken.de>
next in thread | previous in thread | raw e-mail | index | archive | help
--Kra4tWuoVJHqwr45 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 > >=20 > > 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. >=20 > 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; >=20 > pci_devclass =3D devclass_find("pci"); > for (device =3D child; child !=3D bus; device =3D parent) { > parent =3D device_get_parent(device); > if (device_get_devclass(parent) !=3D 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. >=20 > 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. --Kra4tWuoVJHqwr45 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQIcBAEBAgAGBQJRaxcGAAoJEJDCuSvBvK1B1ccP/2j6mIBYsX7We7930/45fS6Y USydw8SQWN4N9Oaq/SOqWukF3wMRz/7arX62wrl+JMVicMp+twf6rC2j0A5ax30B tlMdkw5qmC8yZy8WJNNa0Vn6G5uF9+X7WO0BmXymXJhg2/Kf1xYDkcN+cFKHPzAN oPb78obSSxDYq1qemexgQBcC9deOJBd9xsWM3fv8VMa8IExRhaANEUOoQ8hN3/M5 EoAe6kBYB+0XNrUOu9vBeW3qi1m24OradrfmM72tHKzQWdORekr803s5XcDVUZiw 4/bmuF1pk3HZPPi0s4w0Kshg5MzOJn6Gm5keyoQ5T0FQlLFLEJTaP0/tYfgeelcQ RePeWLTuY5kYoEKJkq7fONBWBwOcjrWEf3dyKYqEn+mcrdX/U029WnryqUZgyuX7 THGwt41vRVNwlejqVnxtDL/LoaPW46/HCb2wiS4Z0/0y9E/G/CvwZ98dcRutU6LA 9joWoNqRr3ZLedVvAT0g92KXG4SLoKEWUoEst7dckjgsUvRekd5azHZF6ELtKs56 Tke6HDPy7sX9urj6+AC/R/GFLCgee7YGVEnaDWmqMYosO063MB+zVa3zzAnUWv0r Gsy4s7v0ctul82TmrJL7CbKidv3wg1wdiWhzxotxi+2Vjzr5bZu2CU46z5MVGV+g Cz184944vair0Hth9lRS =E2IE -----END PGP SIGNATURE----- --Kra4tWuoVJHqwr45--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130414205222.GG2930>