diff options
author | Tony Luck <tony.luck@intel.com> | 2006-06-21 17:50:10 -0400 |
---|---|---|
committer | Tony Luck <tony.luck@intel.com> | 2006-06-21 17:50:10 -0400 |
commit | 1323523f505606cfd24af6122369afddefc3b09d (patch) | |
tree | a3238a27220dd91ec0918478683e59e48605865f /arch/ia64/pci | |
parent | 9ba89334552b96e2127dcafb1c46ce255ecf2667 (diff) | |
parent | 32e62c636a728cb39c0b3bd191286f2ca65d4028 (diff) |
Pull rework-memory-attribute-aliasing into release branch
Diffstat (limited to 'arch/ia64/pci')
-rw-r--r-- | arch/ia64/pci/pci.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c index ab829a22f8a4..30d148f34042 100644 --- a/arch/ia64/pci/pci.c +++ b/arch/ia64/pci/pci.c | |||
@@ -645,18 +645,31 @@ char *ia64_pci_get_legacy_mem(struct pci_bus *bus) | |||
645 | int | 645 | int |
646 | pci_mmap_legacy_page_range(struct pci_bus *bus, struct vm_area_struct *vma) | 646 | pci_mmap_legacy_page_range(struct pci_bus *bus, struct vm_area_struct *vma) |
647 | { | 647 | { |
648 | unsigned long size = vma->vm_end - vma->vm_start; | ||
649 | pgprot_t prot; | ||
648 | char *addr; | 650 | char *addr; |
649 | 651 | ||
652 | /* | ||
653 | * Avoid attribute aliasing. See Documentation/ia64/aliasing.txt | ||
654 | * for more details. | ||
655 | */ | ||
656 | if (!valid_mmap_phys_addr_range(vma->vm_pgoff << PAGE_SHIFT, size)) | ||
657 | return -EINVAL; | ||
658 | prot = phys_mem_access_prot(NULL, vma->vm_pgoff, size, | ||
659 | vma->vm_page_prot); | ||
660 | if (pgprot_val(prot) != pgprot_val(pgprot_noncached(vma->vm_page_prot))) | ||
661 | return -EINVAL; | ||
662 | |||
650 | addr = pci_get_legacy_mem(bus); | 663 | addr = pci_get_legacy_mem(bus); |
651 | if (IS_ERR(addr)) | 664 | if (IS_ERR(addr)) |
652 | return PTR_ERR(addr); | 665 | return PTR_ERR(addr); |
653 | 666 | ||
654 | vma->vm_pgoff += (unsigned long)addr >> PAGE_SHIFT; | 667 | vma->vm_pgoff += (unsigned long)addr >> PAGE_SHIFT; |
655 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); | 668 | vma->vm_page_prot = prot; |
656 | vma->vm_flags |= (VM_SHM | VM_RESERVED | VM_IO); | 669 | vma->vm_flags |= (VM_SHM | VM_RESERVED | VM_IO); |
657 | 670 | ||
658 | if (remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff, | 671 | if (remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff, |
659 | vma->vm_end - vma->vm_start, vma->vm_page_prot)) | 672 | size, vma->vm_page_prot)) |
660 | return -EAGAIN; | 673 | return -EAGAIN; |
661 | 674 | ||
662 | return 0; | 675 | return 0; |