lkml.org 
[lkml]   [2017]   [Mar]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 00/17] PCI resource mmap cleanup
On Fri, Mar 24, 2017 at 11:40:33AM +0000, David Woodhouse wrote:
> That leaves IA64 as the last holdout, as the selection of vm_page_prot
> there is rather complicated:
>
> prot = phys_mem_access_prot(NULL, vma->vm_pgoff, size,
>     vma->vm_page_prot);
>
> /*
> * If the user requested WC, the kernel uses UC or WC for this region,
> * and the chipset supports WC, we can use WC. Otherwise, we have to
> * use the same attribute the kernel uses.
> */
> if (write_combine &&
>     ((pgprot_val(prot) & _PAGE_MA_MASK) == _PAGE_MA_UC ||
>      (pgprot_val(prot) & _PAGE_MA_MASK) == _PAGE_MA_WC) &&
>     efi_range_is_wc(vma->vm_start, vma->vm_end - vma->vm_start))
> vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
> else
> vma->vm_page_prot = prot;
>
>
> But I suspect it's *overcomplicated*, as the kernel should only ever be
> mapping PCI memory BARs as UC or WC in the first place, so the middle
> two checks in the if (write_combine…) condition are redundant.

Agreed.

> And if the efi_range_is_wc() check isn't gratuitous, perhaps that
> should be in the generic code whenever CONFIG_EFI is set?

Sounds dubious whether EFI could even get this right. The efi
memory map table is static, but we could remap a BAR to a different
spot. Does the efi map have entries for all the places that you
could remap a BAR? Isn't it more likely a property of the device
whether it supports WC?

-Tony

\
 
 \ /
  Last update: 2017-03-24 17:57    [W:0.671 / U:0.336 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site