From owner-freebsd-arch@freebsd.org Tue Feb 23 20:19:58 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 CE450AB134B for ; Tue, 23 Feb 2016 20:19:58 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-ob0-x232.google.com (mail-ob0-x232.google.com [IPv6:2607:f8b0:4003:c01::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8A62F1C2D for ; Tue, 23 Feb 2016 20:19:58 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-ob0-x232.google.com with SMTP id jq7so206922044obb.0 for ; Tue, 23 Feb 2016 12:19:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=G5BGM+wvYPQ/UDLb7klTf+sFO6sZuQpQN64iAUwo93Q=; b=o9w/u+gk51oHOYd1K+68++lyFWWgLayevwKs4Ssho8WcK4n4LgJtoHAtN45x3lKBMb ggDuIXvo21/bnDR9JvX9mMUKWEWun2Fh5FIZEh5jFoSXrNi94NaymyoxI17ZRu6joJBp pZDGCPSxbK4hWqK9Uc4WFTnJJPT0VEE3X+PS6FZtmeYY3kAdxkz9Z0Lrpn6DBWKubNlk Li8JVEs9udV7bQWssVH3PetajIB7LGhVNIy4q0xSizyyw1Gvjpsc/9QZfas3LDn4PaHA GDhZEnELoypnbMIRgi70xDufnBPvdUKazFQcIrmVgsjSXVllhPHNjhfx700yOl2CiJgh M7IA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alumni-cwru-edu.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=G5BGM+wvYPQ/UDLb7klTf+sFO6sZuQpQN64iAUwo93Q=; b=s668z0hgMv+vKbJHQ8aoX209Fnhm2I/TNKhVgwwZBjFjf0fU4k2beJGred5YTrNpxM Lv42br3V7dPzc6z3MzuYDqgyCyvqgTkZi1NeKhEwA7VUVOP3PnV6A57AenyeUXGJz/3K 9mjjFmNb4LmDWGGESsEMkLEkTfZ5ZmZa4omDQsecnYO1JpS+Rj3zoABbPsH9sbkWjTqi 1gP0jb4iDtvRIQa1zsZiLnZrZwWgv32REoJ8hdpKbcTq3aYFUZkb8AO1casoqiM+0QJx b7+uKUBqZpDn1mLBbS6wS01gDiCrcOyTk/W4vsEX6fWwFbktSWUZOC12e2EvhCzq7QbZ f7jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=G5BGM+wvYPQ/UDLb7klTf+sFO6sZuQpQN64iAUwo93Q=; b=YfeFKnc9HZBudtVWUxPpQsLP11aZKxMyBvKHvXYG1HMkKOjhaa4WpIfKRzPjEhD/ZH 7Hj2eIq9U7C0CpZeegXfCIi/gNm8pm3Qn+8Z9N+DEdQo0KNvweHHL7TcbUQ1nEMkoCtj S0GhDzJcCy65S5inxV4yjnGyqiaSn1wTmByZ60B752rqUaMvltQUkk1bmep0BLphBF5g NMKLSy44m/eHKyXzcJZG0evLWThlVUBRi2yD9DD//0/B4HN1n7dtdoEfYH6d9/+H6nMu yyNRN2Fw5vi4IJQlbb2dMFghP0Gdwm6a5yJr5c5CRZAzIsmA3UxUZRVBwbb8/nJBMDU8 yepg== X-Gm-Message-State: AG10YOTO2aKaKxVQ/RGRrzbIgRYkrAKGE9XCFBuWuG+HOkLHDeb475Rye75TWbYONIToi1RK0NgCM/ndT7Hkgw== MIME-Version: 1.0 X-Received: by 10.60.128.163 with SMTP id np3mr3305408oeb.16.1456258797714; Tue, 23 Feb 2016 12:19:57 -0800 (PST) Sender: chmeeedalf@gmail.com Received: by 10.182.33.8 with HTTP; Tue, 23 Feb 2016 12:19:57 -0800 (PST) In-Reply-To: <20160222121836.GH91220@kib.kiev.ua> References: <20160222121836.GH91220@kib.kiev.ua> Date: Tue, 23 Feb 2016 14:19:57 -0600 X-Google-Sender-Auth: JECrNBcx1fAx1i32W-QCfH9M26U Message-ID: Subject: Re: RF_CACHEABLE flag From: Justin Hibbits To: Konstantin Belousov Cc: "freebsd-arch@freebsd.org" Content-Type: text/plain; charset=UTF-8 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: Tue, 23 Feb 2016 20:19:58 -0000 On Mon, Feb 22, 2016 at 6:18 AM, Konstantin Belousov wrote: > 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 ? Already mentioned this on IRC yesterday, but best for me to follow up here. This really isn't much different from bus_space_map() conceptually. The work involved is pretty much the same, and if this route is deemed the Wrong Way(TM), I'll go that route. Grepping through sys/, only x86 currently implements pmap_change_attr(), and arm has the declaration but no definition that I could see. Writing it wouldn't be difficult of course, there's just not much compelling case for it right now. But, yes, either of these alternatives are acceptable, and I had explored it. Seeing John Baldwin's comment on the phab review, it looks like he wants to go a different (parallel) direction. - Justin