Re: [PATCH 00/17] PCI resource mmap cleanup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux