svn commit: r299364 - head/sys/compat/linuxkpi/common/include/linux

Hans Petter Selasky hps at selasky.org
Tue May 10 17:06:57 UTC 2016


On 05/10/16 16:49, Conrad Meyer wrote:
> On Tue, May 10, 2016 at 5:04 AM, Hans Petter Selasky
> <hselasky at 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



More information about the svn-src-all mailing list