From owner-freebsd-arch@freebsd.org Mon Feb 22 12:19:10 2016 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 339DDAB0992 for ; Mon, 22 Feb 2016 12:19:10 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AB6B81CB0 for ; Mon, 22 Feb 2016 12:19:09 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id u1MCIbMK097524 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Mon, 22 Feb 2016 14:18:37 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua u1MCIbMK097524 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id u1MCIalI097523; Mon, 22 Feb 2016 14:18:36 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 22 Feb 2016 14:18:36 +0200 From: Konstantin Belousov To: Justin Hibbits Cc: "freebsd-arch@freebsd.org" Subject: Re: RF_CACHEABLE flag Message-ID: <20160222121836.GH91220@kib.kiev.ua> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) 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.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Feb 2016 12:19:10 -0000 On Sun, Feb 21, 2016 at 07:42:49PM -0600, Justin Hibbits wrote: > The Freescale/NXP Datapath Acceleration Architecture uses both > cache-inhibited and cache-enabled memory regions for buffer portals. > This doesn't quite fit right into the existing framework, so I've > added to my personal repo (on github) a RF_CACHEABLE flag to be used > by this. Now that I'm ready to commit the driver to head, I want to > float this on -arch to get opinions. > > I did consider another route, using bus_space_map()/bus_space_unmap(), > and stashing sizes around, but adding a simple flag to rman would take > care of all the details, and rman already knows all the other details > for the region anyway. > > I put the diff on phabricator, at https://reviews.freebsd.org/D5384 . > > Thoughts on this? Not making any opinion about RF_CACHEABLE, only pointing out some facts that might be interesting to you. On x86, some BARs need specific memory access modes at least for performance. E.g., for Intel GPUs, there is a combined BAR where the first 512KB or 2M maps the registers and must be uncacheable, and the rest of the BAR maps GTT. To get a reasonable performance from the graphics hardware, GTT should be mapped as write-combining (i.e. not cacheable but writes may sit in the combining buffers and flushed on serialization points). Look at dev/agp/agp_i810.c:agp_gen4_install_gatt() to see direct pmap_change_attr(WC) call to set it up. No flag could accomodate this mode. OTOH, why couldn't you explicitely add pmap_change_attr() to the driver of your device ?