Date: Tue, 10 May 2016 19:10:12 +0200 From: Hans Petter Selasky <hps@selasky.org> To: cem@FreeBSD.org, Matthew Macy <mmacy@nextbsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r299364 - head/sys/compat/linuxkpi/common/include/linux Message-ID: <072816bb-716e-4164-0cde-2febf8bd1866@selasky.org> In-Reply-To: <CAG6CVpUX399fRcLod5UVgrds_xCYdD5KwDzw5WhWKtzGcQTwkw@mail.gmail.com> References: <201605101204.u4AC4vhR007264@repo.freebsd.org> <CAG6CVpUX399fRcLod5UVgrds_xCYdD5KwDzw5WhWKtzGcQTwkw@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 05/10/16 16:49, Conrad Meyer wrote: > On Tue, May 10, 2016 at 5:04 AM, Hans Petter Selasky > <hselasky@freebsd.org> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?072816bb-716e-4164-0cde-2febf8bd1866>