mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
ia64: Remove redundant checks for WC in pci_mmap_page_range()
For a PCI MMIO BAR, phys_mem_access_prot() should always return UC or WC. And while a mixture of cached and uncached mappings is forbidden, we were already mixing WC and UC, which is OK. Just do as we're asked. Signed-off-by: David Woodhouse <dwmw@amazon.co.uk> Tested-by: Tony Luck <tony.luck@intel.com>
This commit is contained in:
parent
61eee41ae1
commit
fcdb10d6b1
1 changed files with 2 additions and 16 deletions
|
@ -423,9 +423,6 @@ pci_mmap_page_range (struct pci_dev *dev, int bar,
|
||||||
struct vm_area_struct *vma,
|
struct vm_area_struct *vma,
|
||||||
enum pci_mmap_state mmap_state, int write_combine)
|
enum pci_mmap_state mmap_state, int write_combine)
|
||||||
{
|
{
|
||||||
unsigned long size = vma->vm_end - vma->vm_start;
|
|
||||||
pgprot_t prot;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* I/O space cannot be accessed via normal processor loads and
|
* I/O space cannot be accessed via normal processor loads and
|
||||||
* stores on this platform.
|
* stores on this platform.
|
||||||
|
@ -439,21 +436,10 @@ pci_mmap_page_range (struct pci_dev *dev, int bar,
|
||||||
*/
|
*/
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
prot = phys_mem_access_prot(NULL, vma->vm_pgoff, size,
|
if (write_combine)
|
||||||
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);
|
vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
|
||||||
else
|
else
|
||||||
vma->vm_page_prot = prot;
|
vma->vm_page_prot = pgprot_device(vma->vm_page_prot);
|
||||||
|
|
||||||
if (remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
|
if (remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
|
||||||
vma->vm_end - vma->vm_start, vma->vm_page_prot))
|
vma->vm_end - vma->vm_start, vma->vm_page_prot))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue