From owner-freebsd-arch@FreeBSD.ORG Fri Jan 30 15:21:57 2015 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 06DC164F; Fri, 30 Jan 2015 15:21:57 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 693DEA52; Fri, 30 Jan 2015 15:21:56 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.9/8.14.9) with ESMTP id t0UFLoVq000588 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 30 Jan 2015 17:21:50 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.9.2 kib.kiev.ua t0UFLoVq000588 Received: (from kostik@localhost) by tom.home (8.14.9/8.14.9/Submit) id t0UFLodb000587; Fri, 30 Jan 2015 17:21:50 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 30 Jan 2015 17:21:50 +0200 From: Konstantin Belousov To: John Baldwin Subject: Re: Wrapper API for static bus_dma allocations Message-ID: <20150130152150.GX42409@kib.kiev.ua> References: <2800970.jY4xzTy9Hz@ralph.baldwin.cx> <67604.1422568494@critter.freebsd.dk> <54CB9B9F.50905@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <54CB9B9F.50905@FreeBSD.org> User-Agent: Mutt/1.5.23 (2014-03-12) 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 autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home Cc: Poul-Henning Kamp , 'freebsd-arch' X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2015 15:21:57 -0000 On Fri, Jan 30, 2015 at 09:56:31AM -0500, John Baldwin wrote: > On 1/29/15 4:54 PM, Poul-Henning Kamp wrote: > > -------- > > In message <2800970.jY4xzTy9Hz@ralph.baldwin.cx>, John Baldwin writes: > > > >> The bus_dma API to allocate a chunk of static DMA'able memory (e.g. for > >> descriptor rings) can be a bit obtuse [...] > > > > Isn't it time we take a good hard stare at all of the bus_dma API, > > and refactor it into something a lot more compact ? > > Given the amount of oddball hardware out there I don't think there is a > lot you can cut out. The filter function might be something we can lose > (and losing it would simplify the implementation), but all the other > weird constraints are actually used by something AFAIK. I do think we > can provide some simpler wrappers for some of the more common cases, but > there will be some hardware for which those wrappers do not work. > > One suggestion Scott has had is to at least make it easier to extend the > API by using getter/setter routines on the tag to work with tag > attributes instead of passing them all in bus_dma_tag_create(). BTW, filter function is useless. It can deny specific bus address from being used, but it does not provide the busdma implementation even a hint what other address should be (tried to) used. In dmar busdma, I simply ignored it. And there is no real users of filter in the tree.