diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2001-01-10 05:27:25 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2001-01-10 05:27:25 +0000 |
commit | c9c06167e7933d93a6e396174c68abf242294abb (patch) | |
tree | d9a8bb30663e9a3405a1ef37ffb62bc14b9f019f /arch/sparc/mm | |
parent | f79e8cc3c34e4192a3e5ef4cc9c6542fdef703c0 (diff) |
Merge with Linux 2.4.0-test12.
Diffstat (limited to 'arch/sparc/mm')
-rw-r--r-- | arch/sparc/mm/init.c | 9 | ||||
-rw-r--r-- | arch/sparc/mm/srmmu.c | 76 | ||||
-rw-r--r-- | arch/sparc/mm/sun4c.c | 79 |
3 files changed, 7 insertions, 157 deletions
diff --git a/arch/sparc/mm/init.c b/arch/sparc/mm/init.c index 85161a3a6..d27495bd6 100644 --- a/arch/sparc/mm/init.c +++ b/arch/sparc/mm/init.c @@ -1,4 +1,4 @@ -/* $Id: init.c,v 1.95 2000/11/10 04:49:56 davem Exp $ +/* $Id: init.c,v 1.96 2000/11/30 08:51:50 anton Exp $ * linux/arch/sparc/mm/init.c * * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) @@ -579,7 +579,8 @@ void si_meminfo(struct sysinfo *val) void flush_page_to_ram(struct page *page) { - unsigned long vaddr = (unsigned long) kmap(page); - __flush_page_to_ram(vaddr); - kunmap(page); + unsigned long vaddr = (unsigned long)page_address(page); + + if (vaddr) + __flush_page_to_ram(vaddr); } diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c index b32199c13..0dba7d0a3 100644 --- a/arch/sparc/mm/srmmu.c +++ b/arch/sparc/mm/srmmu.c @@ -1,4 +1,4 @@ -/* $Id: srmmu.c,v 1.224 2000/11/09 22:40:05 davem Exp $ +/* $Id: srmmu.c,v 1.225 2000/11/30 08:37:31 anton Exp $ * srmmu.c: SRMMU specific routines for memory management. * * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) @@ -51,7 +51,6 @@ enum mbus_module srmmu_modtype; unsigned int hwbug_bitmask; int vac_cache_size; int vac_line_size; -int vac_badbits; extern struct resource sparc_iomap; @@ -1286,75 +1285,6 @@ static void srmmu_destroy_context(struct mm_struct *mm) } } -static void srmmu_vac_update_mmu_cache(struct vm_area_struct * vma, - unsigned long address, pte_t pte) -{ - if((vma->vm_flags & (VM_WRITE|VM_SHARED)) == (VM_WRITE|VM_SHARED)) { - struct vm_area_struct *vmaring; - struct file *file; - struct address_space *mapping; - unsigned long flags, offset, vaddr, start; - int alias_found = 0; - pgd_t *pgdp; - pmd_t *pmdp; - pte_t *ptep; - - __save_and_cli(flags); - - file = vma->vm_file; - if (!file) - goto done; - mapping = file->f_dentry->d_inode->i_mapping; - offset = (address & PAGE_MASK) - vma->vm_start; - spin_lock(&mapping->i_shared_lock); - vmaring = mapping->i_mmap_shared; - if (vmaring != NULL) do { - /* Do not mistake ourselves as another mapping. */ - if(vmaring == vma) - continue; - - vaddr = vmaring->vm_start + offset; - if ((vaddr ^ address) & vac_badbits) { - alias_found++; - start = vmaring->vm_start; - while (start < vmaring->vm_end) { - pgdp = srmmu_pgd_offset(vmaring->vm_mm, start); - if(!pgdp) goto next; - pmdp = srmmu_pmd_offset(pgdp, start); - if(!pmdp) goto next; - ptep = srmmu_pte_offset(pmdp, start); - if(!ptep) goto next; - - if((pte_val(*ptep) & SRMMU_ET_MASK) == SRMMU_VALID) { -#if 0 - printk("Fixing USER/USER alias [%ld:%08lx]\n", - vmaring->vm_mm->context, start); -#endif - flush_cache_page(vmaring, start); - srmmu_set_pte(ptep, __pte((pte_val(*ptep) & - ~SRMMU_CACHE))); - flush_tlb_page(vmaring, start); - } - next: - start += PAGE_SIZE; - } - } - } while ((vmaring = vmaring->vm_next_share) != NULL); - spin_unlock(&mapping->i_shared_lock); - - if(alias_found && ((pte_val(pte) & SRMMU_CACHE) != 0)) { - pgdp = srmmu_pgd_offset(vma->vm_mm, address); - pmdp = srmmu_pmd_offset(pgdp, address); - ptep = srmmu_pte_offset(pmdp, address); - flush_cache_page(vma, address); - srmmu_set_pte(ptep, __pte((pte_val(*ptep) & ~SRMMU_CACHE))); - flush_tlb_page(vma, address); - } - done: - __restore_flags(flags); - } -} - /* Init various srmmu chip types. */ static void __init srmmu_is_bad(void) { @@ -1389,7 +1319,6 @@ static void __init init_vac_layout(void) } vac_cache_size = cache_lines * vac_line_size; - vac_badbits = (vac_cache_size - 1) & PAGE_MASK; #ifdef CONFIG_SMP if(vac_cache_size > max_size) max_size = vac_cache_size; @@ -1410,7 +1339,6 @@ static void __init init_vac_layout(void) #ifdef CONFIG_SMP vac_cache_size = max_size; vac_line_size = min_line_size; - vac_badbits = (vac_cache_size - 1) & PAGE_MASK; #endif printk("SRMMU: Using VAC size of %d bytes, line size %d bytes.\n", (int)vac_cache_size, (int)vac_line_size); @@ -1465,7 +1393,6 @@ static void __init init_hypersparc(void) BTFIXUPSET_CALL(flush_page_for_dma, hypersparc_flush_page_for_dma, BTFIXUPCALL_NOP); - BTFIXUPSET_CALL(update_mmu_cache, srmmu_vac_update_mmu_cache, BTFIXUPCALL_NORM); poke_srmmu = poke_hypersparc; hypersparc_setup_blockops(); @@ -1532,7 +1459,6 @@ static void __init init_cypress_common(void) BTFIXUPSET_CALL(flush_sig_insns, cypress_flush_sig_insns, BTFIXUPCALL_NOP); BTFIXUPSET_CALL(flush_page_for_dma, cypress_flush_page_for_dma, BTFIXUPCALL_NOP); - BTFIXUPSET_CALL(update_mmu_cache, srmmu_vac_update_mmu_cache, BTFIXUPCALL_NORM); poke_srmmu = poke_cypress; } diff --git a/arch/sparc/mm/sun4c.c b/arch/sparc/mm/sun4c.c index edba89672..1b32dd8ef 100644 --- a/arch/sparc/mm/sun4c.c +++ b/arch/sparc/mm/sun4c.c @@ -1,4 +1,4 @@ -/* $Id: sun4c.c,v 1.201 2000/11/09 22:39:36 davem Exp $ +/* $Id: sun4c.c,v 1.202 2000/12/01 03:17:31 anton Exp $ * sun4c.c: Doing in software what should be done in hardware. * * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) @@ -2373,78 +2373,6 @@ static int sun4c_check_pgt_cache(int low, int high) return freed; } -/* There are really two cases of aliases to watch out for, and these - * are: - * - * 1) A user's page which can be aliased with the kernels virtual - * mapping of the physical page. - * - * 2) Multiple user mappings of the same inode/anonymous object - * such that two copies of the same data for the same phys page - * can live (writable) in the cache at the same time. - * - * We handle number 1 by flushing the kernel copy of the page always - * after COW page operations. - * - * NOTE: We are a bit slowed down now because the VMA arg is indeed used - * now, so our ref/mod bit tracking quick userfaults eat a few more - * cycles than they used to. - */ -static void sun4c_vac_alias_fixup(struct vm_area_struct *vma, unsigned long address, pte_t pte) -{ - pgd_t *pgdp; - pte_t *ptep; - - if (vma->vm_file) { - struct address_space *mapping; - unsigned long offset = (address & PAGE_MASK) - vma->vm_start; - struct vm_area_struct *vmaring; - int alias_found = 0; - - mapping = vma->vm_file->f_dentry->d_inode->i_mapping; - spin_lock(&mapping->i_shared_lock); - vmaring = mapping->i_mmap_shared; - if (vmaring != NULL) do { - unsigned long vaddr = vmaring->vm_start + offset; - unsigned long start; - - /* Do not mistake ourselves as another mapping. */ - if (vmaring == vma) - continue; - - if (S4CVAC_BADALIAS(vaddr, address)) { - alias_found++; - start = vmaring->vm_start; - while (start < vmaring->vm_end) { - pgdp = sun4c_pgd_offset(vmaring->vm_mm, start); - if (!pgdp) - goto next; - ptep = sun4c_pte_offset((pmd_t *) pgdp, start); - if (!ptep) - goto next; - - if (pte_val(*ptep) & _SUN4C_PAGE_PRESENT) { - flush_cache_page(vmaring, start); - *ptep = __pte(pte_val(*ptep) | - _SUN4C_PAGE_NOCACHE); - flush_tlb_page(vmaring, start); - } - next: - start += PAGE_SIZE; - } - } - } while ((vmaring = vmaring->vm_next_share) != NULL); - spin_unlock(&mapping->i_shared_lock); - - if (alias_found && !(pte_val(pte) & _SUN4C_PAGE_NOCACHE)) { - pgdp = sun4c_pgd_offset(vma->vm_mm, address); - ptep = sun4c_pte_offset((pmd_t *) pgdp, address); - *ptep = __pte(pte_val(*ptep) | _SUN4C_PAGE_NOCACHE); - pte = *ptep; - } - } -} - /* An experiment, turn off by default for now... -DaveM */ #define SUN4C_PRELOAD_PSEG @@ -2486,8 +2414,6 @@ void sun4c_update_mmu_cache(struct vm_area_struct *vma, unsigned long address, p #endif start += PAGE_SIZE; } - if ((vma->vm_flags & (VM_WRITE|VM_SHARED)) == (VM_WRITE|VM_SHARED)) - sun4c_vac_alias_fixup(vma, address, pte); #ifndef SUN4C_PRELOAD_PSEG sun4c_put_pte(address, pte_val(pte)); #endif @@ -2500,9 +2426,6 @@ void sun4c_update_mmu_cache(struct vm_area_struct *vma, unsigned long address, p add_lru(entry); } - if ((vma->vm_flags & (VM_WRITE|VM_SHARED)) == (VM_WRITE|VM_SHARED)) - sun4c_vac_alias_fixup(vma, address, pte); - sun4c_put_pte(address, pte_val(pte)); restore_flags(flags); } |