From owner-svn-src-head@freebsd.org Tue May 10 17:06:57 2016 Return-Path: Delivered-To: svn-src-head@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 71A7CB3537E; Tue, 10 May 2016 17:06:57 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (heidi.turbocat.net [88.198.202.214]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3AC951D22; Tue, 10 May 2016 17:06:56 +0000 (UTC) (envelope-from hps@selasky.org) Received: from laptop015.home.selasky.org (unknown [62.141.129.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 97FD01FE022; Tue, 10 May 2016 19:06:54 +0200 (CEST) Subject: Re: svn commit: r299364 - head/sys/compat/linuxkpi/common/include/linux To: cem@FreeBSD.org, Matthew Macy References: <201605101204.u4AC4vhR007264@repo.freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Hans Petter Selasky Message-ID: <072816bb-716e-4164-0cde-2febf8bd1866@selasky.org> Date: Tue, 10 May 2016 19:10:12 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 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: Tue, 10 May 2016 17:06:57 -0000 On 05/10/16 16:49, Conrad Meyer wrote: > On Tue, May 10, 2016 at 5:04 AM, Hans Petter Selasky > wrote: >> Author: hselasky >> Date: Tue May 10 12:04:57 2016 >> New Revision: 299364 >> URL: https://svnweb.freebsd.org/changeset/base/299364 >> >> Log: >> Add more LinuxKPI I/O functions. >> >> Obtained from: kmacy @ >> ... >> @@ -166,5 +212,35 @@ __iowrite64_copy(void *to, void *from, s >> #endif >> } >> >> +enum { >> + MEMREMAP_WB = 1 << 0, >> + MEMREMAP_WT = 1 << 1, >> + MEMREMAP_WC = 1 << 2, >> +}; >> + >> +static inline void * >> +memremap(resource_size_t offset, size_t size, unsigned long flags) >> +{ >> + void *addr = NULL; >> + >> + if ((flags & MEMREMAP_WB) && >> + (addr = ioremap_wb(offset, size)) != NULL) >> + goto done; >> + if ((flags & MEMREMAP_WT) && >> + (addr = ioremap_nocache(offset, size)) != NULL) >> + goto done; > > x86 can actually map memory as WT rather than UC. Why throw that away? > >> + if ((flags & MEMREMAP_WC) && >> + (addr = ioremap_wc(offset, size)) != NULL) >> + goto done; >> +done: >> + return (addr); >> +} >> + >> ... Hi Conrad, I agree. I see no reason to not implement ioremap_wt() for x86 (32-bit and 64-bit) and use it for the WT case. --HPS