From owner-svn-src-head@FreeBSD.ORG Sun Apr 14 20:52:33 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 4F22A9B1; Sun, 14 Apr 2013 20:52:33 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id BA4521BC; Sun, 14 Apr 2013 20:52:32 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.6/8.14.6) with ESMTP id r3EKqM6o060194; Sun, 14 Apr 2013 23:52:22 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.2 kib.kiev.ua r3EKqM6o060194 Received: (from kostik@localhost) by tom.home (8.14.6/8.14.6/Submit) id r3EKqMmW060193; Sun, 14 Apr 2013 23:52:22 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 14 Apr 2013 23:52:22 +0300 From: Konstantin Belousov To: Marius Strobl Subject: Re: svn commit: r249476 - in head/sys/dev: ata pci Message-ID: <20130414205222.GG2930@kib.kiev.ua> References: <201304141402.r3EE2YIi001357@svn.freebsd.org> <20130414150507.GA62578@alchemy.franken.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Kra4tWuoVJHqwr45" Content-Disposition: inline In-Reply-To: <20130414150507.GA62578@alchemy.franken.de> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Apr 2013 20:52:33 -0000 --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--