aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2006-03-21 05:29:39 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-03-22 04:15:13 -0500
commit14778d9072e53d2171f66ffd9657daff41acfaed (patch)
tree3b60565ec1e957800fc3bf4743497202a24f8279 /arch
parente952f31bce6e9f64db01f607abc46529ba57ac9e (diff)
[SPARC]: Respect vm_page_prot in io_remap_page_range().
Make sure the callers do a pgprot_noncached() on vma->vm_page_prot. Pointed out by Hugh Dickens. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch')
-rw-r--r--arch/sparc/mm/generic.c1
-rw-r--r--arch/sparc/mm/loadmmu.c2
-rw-r--r--arch/sparc/mm/srmmu.c9
-rw-r--r--arch/sparc/mm/sun4c.c15
-rw-r--r--arch/sparc64/kernel/pci.c2
-rw-r--r--arch/sparc64/mm/generic.c1
6 files changed, 21 insertions, 9 deletions
diff --git a/arch/sparc/mm/generic.c b/arch/sparc/mm/generic.c
index 2cb0728cee05..1ef7fa03fefe 100644
--- a/arch/sparc/mm/generic.c
+++ b/arch/sparc/mm/generic.c
@@ -76,7 +76,6 @@ int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from,
76 vma->vm_pgoff = (offset >> PAGE_SHIFT) | 76 vma->vm_pgoff = (offset >> PAGE_SHIFT) |
77 ((unsigned long)space << 28UL); 77 ((unsigned long)space << 28UL);
78 78
79 prot = __pgprot(pg_iobits);
80 offset -= from; 79 offset -= from;
81 dir = pgd_offset(mm, from); 80 dir = pgd_offset(mm, from);
82 flush_cache_range(vma, beg, end); 81 flush_cache_range(vma, beg, end);
diff --git a/arch/sparc/mm/loadmmu.c b/arch/sparc/mm/loadmmu.c
index e9f9571601ba..36b4d24988f8 100644
--- a/arch/sparc/mm/loadmmu.c
+++ b/arch/sparc/mm/loadmmu.c
@@ -22,8 +22,6 @@ struct ctx_list *ctx_list_pool;
22struct ctx_list ctx_free; 22struct ctx_list ctx_free;
23struct ctx_list ctx_used; 23struct ctx_list ctx_used;
24 24
25unsigned int pg_iobits;
26
27extern void ld_mmu_sun4c(void); 25extern void ld_mmu_sun4c(void);
28extern void ld_mmu_srmmu(void); 26extern void ld_mmu_srmmu(void);
29 27
diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c
index c664b962987c..27b0e0ba8581 100644
--- a/arch/sparc/mm/srmmu.c
+++ b/arch/sparc/mm/srmmu.c
@@ -2130,6 +2130,13 @@ static unsigned long srmmu_pte_to_pgoff(pte_t pte)
2130 return pte_val(pte) >> SRMMU_PTE_FILE_SHIFT; 2130 return pte_val(pte) >> SRMMU_PTE_FILE_SHIFT;
2131} 2131}
2132 2132
2133static pgprot_t srmmu_pgprot_noncached(pgprot_t prot)
2134{
2135 prot &= ~__pgprot(SRMMU_CACHE);
2136
2137 return prot;
2138}
2139
2133/* Load up routines and constants for sun4m and sun4d mmu */ 2140/* Load up routines and constants for sun4m and sun4d mmu */
2134void __init ld_mmu_srmmu(void) 2141void __init ld_mmu_srmmu(void)
2135{ 2142{
@@ -2150,9 +2157,9 @@ void __init ld_mmu_srmmu(void)
2150 BTFIXUPSET_INT(page_readonly, pgprot_val(SRMMU_PAGE_RDONLY)); 2157 BTFIXUPSET_INT(page_readonly, pgprot_val(SRMMU_PAGE_RDONLY));
2151 BTFIXUPSET_INT(page_kernel, pgprot_val(SRMMU_PAGE_KERNEL)); 2158 BTFIXUPSET_INT(page_kernel, pgprot_val(SRMMU_PAGE_KERNEL));
2152 page_kernel = pgprot_val(SRMMU_PAGE_KERNEL); 2159 page_kernel = pgprot_val(SRMMU_PAGE_KERNEL);
2153 pg_iobits = SRMMU_VALID | SRMMU_WRITE | SRMMU_REF;
2154 2160
2155 /* Functions */ 2161 /* Functions */
2162 BTFIXUPSET_CALL(pgprot_noncached, srmmu_pgprot_noncached, BTFIXUPCALL_NORM);
2156#ifndef CONFIG_SMP 2163#ifndef CONFIG_SMP
2157 BTFIXUPSET_CALL(___xchg32, ___xchg32_sun4md, BTFIXUPCALL_SWAPG1G2); 2164 BTFIXUPSET_CALL(___xchg32, ___xchg32_sun4md, BTFIXUPCALL_SWAPG1G2);
2158#endif 2165#endif
diff --git a/arch/sparc/mm/sun4c.c b/arch/sparc/mm/sun4c.c
index 731f19603cad..49f28c1bdc6d 100644
--- a/arch/sparc/mm/sun4c.c
+++ b/arch/sparc/mm/sun4c.c
@@ -1589,7 +1589,10 @@ static void sun4c_flush_tlb_page(struct vm_area_struct *vma, unsigned long page)
1589 1589
1590static inline void sun4c_mapioaddr(unsigned long physaddr, unsigned long virt_addr) 1590static inline void sun4c_mapioaddr(unsigned long physaddr, unsigned long virt_addr)
1591{ 1591{
1592 unsigned long page_entry; 1592 unsigned long page_entry, pg_iobits;
1593
1594 pg_iobits = _SUN4C_PAGE_PRESENT | _SUN4C_READABLE | _SUN4C_WRITEABLE |
1595 _SUN4C_PAGE_IO | _SUN4C_PAGE_NOCACHE;
1593 1596
1594 page_entry = ((physaddr >> PAGE_SHIFT) & SUN4C_PFN_MASK); 1597 page_entry = ((physaddr >> PAGE_SHIFT) & SUN4C_PFN_MASK);
1595 page_entry |= ((pg_iobits | _SUN4C_PAGE_PRIV) & ~(_SUN4C_PAGE_PRESENT)); 1598 page_entry |= ((pg_iobits | _SUN4C_PAGE_PRIV) & ~(_SUN4C_PAGE_PRESENT));
@@ -2134,6 +2137,13 @@ void __init sun4c_paging_init(void)
2134 printk("SUN4C: %d mmu entries for the kernel\n", cnt); 2137 printk("SUN4C: %d mmu entries for the kernel\n", cnt);
2135} 2138}
2136 2139
2140static pgprot_t sun4c_pgprot_noncached(pgprot_t prot)
2141{
2142 prot |= __pgprot(_SUN4C_PAGE_IO | _SUN4C_PAGE_NOCACHE);
2143
2144 return prot;
2145}
2146
2137/* Load up routines and constants for sun4c mmu */ 2147/* Load up routines and constants for sun4c mmu */
2138void __init ld_mmu_sun4c(void) 2148void __init ld_mmu_sun4c(void)
2139{ 2149{
@@ -2156,10 +2166,9 @@ void __init ld_mmu_sun4c(void)
2156 BTFIXUPSET_INT(page_readonly, pgprot_val(SUN4C_PAGE_READONLY)); 2166 BTFIXUPSET_INT(page_readonly, pgprot_val(SUN4C_PAGE_READONLY));
2157 BTFIXUPSET_INT(page_kernel, pgprot_val(SUN4C_PAGE_KERNEL)); 2167 BTFIXUPSET_INT(page_kernel, pgprot_val(SUN4C_PAGE_KERNEL));
2158 page_kernel = pgprot_val(SUN4C_PAGE_KERNEL); 2168 page_kernel = pgprot_val(SUN4C_PAGE_KERNEL);
2159 pg_iobits = _SUN4C_PAGE_PRESENT | _SUN4C_READABLE | _SUN4C_WRITEABLE |
2160 _SUN4C_PAGE_IO | _SUN4C_PAGE_NOCACHE;
2161 2169
2162 /* Functions */ 2170 /* Functions */
2171 BTFIXUPSET_CALL(pgprot_noncached, sun4c_pgprot_noncached, BTFIXUPCALL_NORM);
2163 BTFIXUPSET_CALL(___xchg32, ___xchg32_sun4c, BTFIXUPCALL_NORM); 2172 BTFIXUPSET_CALL(___xchg32, ___xchg32_sun4c, BTFIXUPCALL_NORM);
2164 BTFIXUPSET_CALL(do_check_pgt_cache, sun4c_check_pgt_cache, BTFIXUPCALL_NORM); 2173 BTFIXUPSET_CALL(do_check_pgt_cache, sun4c_check_pgt_cache, BTFIXUPCALL_NORM);
2165 2174
diff --git a/arch/sparc64/kernel/pci.c b/arch/sparc64/kernel/pci.c
index 95ffa9418620..dfccff29e182 100644
--- a/arch/sparc64/kernel/pci.c
+++ b/arch/sparc64/kernel/pci.c
@@ -656,6 +656,7 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
656 __pci_mmap_set_flags(dev, vma, mmap_state); 656 __pci_mmap_set_flags(dev, vma, mmap_state);
657 __pci_mmap_set_pgprot(dev, vma, mmap_state); 657 __pci_mmap_set_pgprot(dev, vma, mmap_state);
658 658
659 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
659 ret = io_remap_pfn_range(vma, vma->vm_start, 660 ret = io_remap_pfn_range(vma, vma->vm_start,
660 vma->vm_pgoff, 661 vma->vm_pgoff,
661 vma->vm_end - vma->vm_start, 662 vma->vm_end - vma->vm_start,
@@ -663,7 +664,6 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
663 if (ret) 664 if (ret)
664 return ret; 665 return ret;
665 666
666 vma->vm_flags |= VM_IO;
667 return 0; 667 return 0;
668} 668}
669 669
diff --git a/arch/sparc64/mm/generic.c b/arch/sparc64/mm/generic.c
index 5fc5c579e35e..8cb06205d265 100644
--- a/arch/sparc64/mm/generic.c
+++ b/arch/sparc64/mm/generic.c
@@ -140,7 +140,6 @@ int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from,
140 vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP; 140 vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP;
141 vma->vm_pgoff = phys_base >> PAGE_SHIFT; 141 vma->vm_pgoff = phys_base >> PAGE_SHIFT;
142 142
143 prot = __pgprot(pg_iobits);
144 offset -= from; 143 offset -= from;
145 dir = pgd_offset(mm, from); 144 dir = pgd_offset(mm, from);
146 flush_cache_range(vma, beg, end); 145 flush_cache_range(vma, beg, end);