MM: Pass a PTE pointer to update_mmu_cache() rather than the PTE itself
On VIVT ARM, when we have multiple shared mappings of the same file in the same MM, we need to ensure that we have coherency across all copies. We do this via make_coherent() by making the pages uncacheable. This used to work fine, until we allowed highmem with highpte - we now have a page table which is mapped as required, and is not available for modification via update_mmu_cache(). Ralf Beache suggested getting rid of the PTE value passed to update_mmu_cache(): On MIPS update_mmu_cache() calls __update_tlb() which walks pagetables to construct a pointer to the pte again. Passing a pte_t * is much more elegant. Maybe we might even replace the pte argument with the pte_t? Ben Herrenschmidt would also like the pte pointer for PowerPC: Passing the ptep in there is exactly what I want. I want that -instead- of the PTE value, because I have issue on some ppc cases, for I$/D$ coherency, where set_pte_at() may decide to mask out the _PAGE_EXEC. So, pass in the mapped page table pointer into update_mmu_cache(), and remove the PTE value, updating all implementations and call sites to suit. Includes a fix from Stephen Rothwell: sparc: fix fallout from update_mmu_cache API change Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
This commit is contained in:
parent
ed42acaef1
commit
4b3073e1c5
|
@ -88,12 +88,12 @@ changes occur:
|
||||||
This is used primarily during fault processing.
|
This is used primarily during fault processing.
|
||||||
|
|
||||||
5) void update_mmu_cache(struct vm_area_struct *vma,
|
5) void update_mmu_cache(struct vm_area_struct *vma,
|
||||||
unsigned long address, pte_t pte)
|
unsigned long address, pte_t *ptep)
|
||||||
|
|
||||||
At the end of every page fault, this routine is invoked to
|
At the end of every page fault, this routine is invoked to
|
||||||
tell the architecture specific code that a translation
|
tell the architecture specific code that a translation
|
||||||
described by "pte" now exists at virtual address "address"
|
now exists at virtual address "address" for address space
|
||||||
for address space "vma->vm_mm", in the software page tables.
|
"vma->vm_mm", in the software page tables.
|
||||||
|
|
||||||
A port may use this information in any way it so chooses.
|
A port may use this information in any way it so chooses.
|
||||||
For example, it could use this event to pre-load TLB
|
For example, it could use this event to pre-load TLB
|
||||||
|
|
|
@ -329,7 +329,7 @@ extern pgd_t swapper_pg_dir[1024];
|
||||||
* tables contain all the necessary information.
|
* tables contain all the necessary information.
|
||||||
*/
|
*/
|
||||||
extern inline void update_mmu_cache(struct vm_area_struct * vma,
|
extern inline void update_mmu_cache(struct vm_area_struct * vma,
|
||||||
unsigned long address, pte_t pte)
|
unsigned long address, pte_t *ptep)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -529,7 +529,8 @@ extern void flush_tlb_kernel_range(unsigned long start, unsigned long end);
|
||||||
* cache entries for the kernels virtual memory range are written
|
* cache entries for the kernels virtual memory range are written
|
||||||
* back to the page.
|
* back to the page.
|
||||||
*/
|
*/
|
||||||
extern void update_mmu_cache(struct vm_area_struct *vma, unsigned long addr, pte_t pte);
|
extern void update_mmu_cache(struct vm_area_struct *vma, unsigned long addr,
|
||||||
|
pte_t *ptep);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -149,9 +149,10 @@ make_coherent(struct address_space *mapping, struct vm_area_struct *vma, unsigne
|
||||||
*
|
*
|
||||||
* Note that the pte lock will be held.
|
* Note that the pte lock will be held.
|
||||||
*/
|
*/
|
||||||
void update_mmu_cache(struct vm_area_struct *vma, unsigned long addr, pte_t pte)
|
void update_mmu_cache(struct vm_area_struct *vma, unsigned long addr,
|
||||||
|
pte_t *ptep)
|
||||||
{
|
{
|
||||||
unsigned long pfn = pte_pfn(pte);
|
unsigned long pfn = pte_pfn(*ptep);
|
||||||
struct address_space *mapping;
|
struct address_space *mapping;
|
||||||
struct page *page;
|
struct page *page;
|
||||||
|
|
||||||
|
|
|
@ -325,7 +325,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
|
||||||
|
|
||||||
struct vm_area_struct;
|
struct vm_area_struct;
|
||||||
extern void update_mmu_cache(struct vm_area_struct * vma,
|
extern void update_mmu_cache(struct vm_area_struct * vma,
|
||||||
unsigned long address, pte_t pte);
|
unsigned long address, pte_t *ptep);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Encode and decode a swap entry
|
* Encode and decode a swap entry
|
||||||
|
|
|
@ -101,7 +101,7 @@ static void update_dtlb(unsigned long address, pte_t pte)
|
||||||
}
|
}
|
||||||
|
|
||||||
void update_mmu_cache(struct vm_area_struct *vma,
|
void update_mmu_cache(struct vm_area_struct *vma,
|
||||||
unsigned long address, pte_t pte)
|
unsigned long address, pte_t *ptep)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ void update_mmu_cache(struct vm_area_struct *vma,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
local_irq_save(flags);
|
local_irq_save(flags);
|
||||||
update_dtlb(address, pte);
|
update_dtlb(address, *ptep);
|
||||||
local_irq_restore(flags);
|
local_irq_restore(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -270,7 +270,7 @@ extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; /* defined in head.S */
|
||||||
* Actually I am not sure on what this could be used for.
|
* Actually I am not sure on what this could be used for.
|
||||||
*/
|
*/
|
||||||
static inline void update_mmu_cache(struct vm_area_struct * vma,
|
static inline void update_mmu_cache(struct vm_area_struct * vma,
|
||||||
unsigned long address, pte_t pte)
|
unsigned long address, pte_t *ptep)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -505,7 +505,7 @@ static inline int pte_file(pte_t pte)
|
||||||
/*
|
/*
|
||||||
* preload information about a newly instantiated PTE into the SCR0/SCR1 PGE cache
|
* preload information about a newly instantiated PTE into the SCR0/SCR1 PGE cache
|
||||||
*/
|
*/
|
||||||
static inline void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t pte)
|
static inline void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t *ptep)
|
||||||
{
|
{
|
||||||
struct mm_struct *mm;
|
struct mm_struct *mm;
|
||||||
unsigned long ampr;
|
unsigned long ampr;
|
||||||
|
|
|
@ -462,7 +462,7 @@ pte_same (pte_t a, pte_t b)
|
||||||
return pte_val(a) == pte_val(b);
|
return pte_val(a) == pte_val(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define update_mmu_cache(vma, address, pte) do { } while (0)
|
#define update_mmu_cache(vma, address, ptep) do { } while (0)
|
||||||
|
|
||||||
extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
|
extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
|
||||||
extern void paging_init (void);
|
extern void paging_init (void);
|
||||||
|
|
|
@ -92,6 +92,6 @@ static __inline__ void __flush_tlb_all(void)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t);
|
extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t *);
|
||||||
|
|
||||||
#endif /* _ASM_M32R_TLBFLUSH_H */
|
#endif /* _ASM_M32R_TLBFLUSH_H */
|
||||||
|
|
|
@ -95,7 +95,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code,
|
||||||
* update_mmu_cache()
|
* update_mmu_cache()
|
||||||
*======================================================================*/
|
*======================================================================*/
|
||||||
void update_mmu_cache(struct vm_area_struct *vma, unsigned long addr,
|
void update_mmu_cache(struct vm_area_struct *vma, unsigned long addr,
|
||||||
pte_t pte)
|
pte_t *ptep)
|
||||||
{
|
{
|
||||||
BUG();
|
BUG();
|
||||||
}
|
}
|
||||||
|
|
|
@ -336,7 +336,7 @@ vmalloc_fault:
|
||||||
|
|
||||||
addr = (address & PAGE_MASK);
|
addr = (address & PAGE_MASK);
|
||||||
set_thread_fault_code(error_code);
|
set_thread_fault_code(error_code);
|
||||||
update_mmu_cache(NULL, addr, *pte_k);
|
update_mmu_cache(NULL, addr, pte_k);
|
||||||
set_thread_fault_code(0);
|
set_thread_fault_code(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -349,7 +349,7 @@ vmalloc_fault:
|
||||||
#define ITLB_END (unsigned long *)(ITLB_BASE + (NR_TLB_ENTRIES * 8))
|
#define ITLB_END (unsigned long *)(ITLB_BASE + (NR_TLB_ENTRIES * 8))
|
||||||
#define DTLB_END (unsigned long *)(DTLB_BASE + (NR_TLB_ENTRIES * 8))
|
#define DTLB_END (unsigned long *)(DTLB_BASE + (NR_TLB_ENTRIES * 8))
|
||||||
void update_mmu_cache(struct vm_area_struct *vma, unsigned long vaddr,
|
void update_mmu_cache(struct vm_area_struct *vma, unsigned long vaddr,
|
||||||
pte_t pte)
|
pte_t *ptep)
|
||||||
{
|
{
|
||||||
volatile unsigned long *entry1, *entry2;
|
volatile unsigned long *entry1, *entry2;
|
||||||
unsigned long pte_data, flags;
|
unsigned long pte_data, flags;
|
||||||
|
@ -365,7 +365,7 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long vaddr,
|
||||||
|
|
||||||
vaddr = (vaddr & PAGE_MASK) | get_asid();
|
vaddr = (vaddr & PAGE_MASK) | get_asid();
|
||||||
|
|
||||||
pte_data = pte_val(pte);
|
pte_data = pte_val(*ptep);
|
||||||
|
|
||||||
#ifdef CONFIG_CHIP_OPSP
|
#ifdef CONFIG_CHIP_OPSP
|
||||||
entry1 = (unsigned long *)ITLB_BASE;
|
entry1 = (unsigned long *)ITLB_BASE;
|
||||||
|
|
|
@ -115,7 +115,7 @@ extern void kernel_set_cachemode(void *addr, unsigned long size, int cmode);
|
||||||
* they are updated on demand.
|
* they are updated on demand.
|
||||||
*/
|
*/
|
||||||
static inline void update_mmu_cache(struct vm_area_struct *vma,
|
static inline void update_mmu_cache(struct vm_area_struct *vma,
|
||||||
unsigned long address, pte_t pte)
|
unsigned long address, pte_t *ptep)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ static inline void local_flush_tlb_range(struct vm_area_struct *vma,
|
||||||
|
|
||||||
#define flush_tlb_kernel_range(start, end) do { } while (0)
|
#define flush_tlb_kernel_range(start, end) do { } while (0)
|
||||||
|
|
||||||
#define update_mmu_cache(vma, addr, pte) do { } while (0)
|
#define update_mmu_cache(vma, addr, ptep) do { } while (0)
|
||||||
|
|
||||||
#define flush_tlb_all local_flush_tlb_all
|
#define flush_tlb_all local_flush_tlb_all
|
||||||
#define flush_tlb_mm local_flush_tlb_mm
|
#define flush_tlb_mm local_flush_tlb_mm
|
||||||
|
|
|
@ -362,8 +362,9 @@ extern void __update_cache(struct vm_area_struct *vma, unsigned long address,
|
||||||
pte_t pte);
|
pte_t pte);
|
||||||
|
|
||||||
static inline void update_mmu_cache(struct vm_area_struct *vma,
|
static inline void update_mmu_cache(struct vm_area_struct *vma,
|
||||||
unsigned long address, pte_t pte)
|
unsigned long address, pte_t *ptep)
|
||||||
{
|
{
|
||||||
|
pte_t pte = *ptep;
|
||||||
__update_tlb(vma, address, pte);
|
__update_tlb(vma, address, pte);
|
||||||
__update_cache(vma, address, pte);
|
__update_cache(vma, address, pte);
|
||||||
}
|
}
|
||||||
|
|
|
@ -466,7 +466,7 @@ static inline int set_kernel_exec(unsigned long vaddr, int enable)
|
||||||
* the kernel page tables containing the necessary information by tlb-mn10300.S
|
* the kernel page tables containing the necessary information by tlb-mn10300.S
|
||||||
*/
|
*/
|
||||||
extern void update_mmu_cache(struct vm_area_struct *vma,
|
extern void update_mmu_cache(struct vm_area_struct *vma,
|
||||||
unsigned long address, pte_t pte);
|
unsigned long address, pte_t *ptep);
|
||||||
|
|
||||||
#endif /* !__ASSEMBLY__ */
|
#endif /* !__ASSEMBLY__ */
|
||||||
|
|
||||||
|
|
|
@ -51,9 +51,10 @@ void flush_tlb_page(struct vm_area_struct *vma, unsigned long addr)
|
||||||
/*
|
/*
|
||||||
* preemptively set a TLB entry
|
* preemptively set a TLB entry
|
||||||
*/
|
*/
|
||||||
void update_mmu_cache(struct vm_area_struct *vma, unsigned long addr, pte_t pte)
|
void update_mmu_cache(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
|
||||||
{
|
{
|
||||||
unsigned long pteu, ptel, cnx, flags;
|
unsigned long pteu, ptel, cnx, flags;
|
||||||
|
pte_t pte = *ptep;
|
||||||
|
|
||||||
addr &= PAGE_MASK;
|
addr &= PAGE_MASK;
|
||||||
ptel = pte_val(pte) & ~(xPTEL_UNUSED1 | xPTEL_UNUSED2);
|
ptel = pte_val(pte) & ~(xPTEL_UNUSED1 | xPTEL_UNUSED2);
|
||||||
|
|
|
@ -410,7 +410,7 @@ extern void paging_init (void);
|
||||||
|
|
||||||
#define PG_dcache_dirty PG_arch_1
|
#define PG_dcache_dirty PG_arch_1
|
||||||
|
|
||||||
extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t);
|
extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t *);
|
||||||
|
|
||||||
/* Encode and de-code a swap entry */
|
/* Encode and de-code a swap entry */
|
||||||
|
|
||||||
|
|
|
@ -68,9 +68,9 @@ flush_cache_all_local(void)
|
||||||
EXPORT_SYMBOL(flush_cache_all_local);
|
EXPORT_SYMBOL(flush_cache_all_local);
|
||||||
|
|
||||||
void
|
void
|
||||||
update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t pte)
|
update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t *ptep)
|
||||||
{
|
{
|
||||||
struct page *page = pte_page(pte);
|
struct page *page = pte_page(*ptep);
|
||||||
|
|
||||||
if (pfn_valid(page_to_pfn(page)) && page_mapping(page) &&
|
if (pfn_valid(page_to_pfn(page)) && page_mapping(page) &&
|
||||||
test_bit(PG_dcache_dirty, &page->flags)) {
|
test_bit(PG_dcache_dirty, &page->flags)) {
|
||||||
|
|
|
@ -209,7 +209,7 @@ extern void paging_init(void);
|
||||||
* corresponding HPTE into the hash table ahead of time, instead of
|
* corresponding HPTE into the hash table ahead of time, instead of
|
||||||
* waiting for the inevitable extra hash-table miss exception.
|
* waiting for the inevitable extra hash-table miss exception.
|
||||||
*/
|
*/
|
||||||
extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t);
|
extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t *);
|
||||||
|
|
||||||
extern int gup_hugepd(hugepd_t *hugepd, unsigned pdshift, unsigned long addr,
|
extern int gup_hugepd(hugepd_t *hugepd, unsigned pdshift, unsigned long addr,
|
||||||
unsigned long end, int write, struct page **pages, int *nr);
|
unsigned long end, int write, struct page **pages, int *nr);
|
||||||
|
|
|
@ -494,13 +494,13 @@ EXPORT_SYMBOL(flush_icache_user_range);
|
||||||
* This must always be called with the pte lock held.
|
* This must always be called with the pte lock held.
|
||||||
*/
|
*/
|
||||||
void update_mmu_cache(struct vm_area_struct *vma, unsigned long address,
|
void update_mmu_cache(struct vm_area_struct *vma, unsigned long address,
|
||||||
pte_t pte)
|
pte_t *ptep)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_PPC_STD_MMU
|
#ifdef CONFIG_PPC_STD_MMU
|
||||||
unsigned long access = 0, trap;
|
unsigned long access = 0, trap;
|
||||||
|
|
||||||
/* We only want HPTEs for linux PTEs that have _PAGE_ACCESSED set */
|
/* We only want HPTEs for linux PTEs that have _PAGE_ACCESSED set */
|
||||||
if (!pte_young(pte) || address >= TASK_SIZE)
|
if (!pte_young(*ptep) || address >= TASK_SIZE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* We try to figure out if we are coming from an instruction
|
/* We try to figure out if we are coming from an instruction
|
||||||
|
|
|
@ -43,7 +43,7 @@ extern void vmem_map_init(void);
|
||||||
* The S390 doesn't have any external MMU info: the kernel page
|
* The S390 doesn't have any external MMU info: the kernel page
|
||||||
* tables contain all the necessary information.
|
* tables contain all the necessary information.
|
||||||
*/
|
*/
|
||||||
#define update_mmu_cache(vma, address, pte) do { } while (0)
|
#define update_mmu_cache(vma, address, ptep) do { } while (0)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ZERO_PAGE is a global shared page that is always zero: used
|
* ZERO_PAGE is a global shared page that is always zero: used
|
||||||
|
|
|
@ -272,8 +272,9 @@ extern void __update_cache(struct vm_area_struct *vma,
|
||||||
unsigned long address, pte_t pte);
|
unsigned long address, pte_t pte);
|
||||||
|
|
||||||
static inline void update_mmu_cache(struct vm_area_struct *vma,
|
static inline void update_mmu_cache(struct vm_area_struct *vma,
|
||||||
unsigned long address, pte_t pte)
|
unsigned long address, pte_t *ptep)
|
||||||
{
|
{
|
||||||
|
pte_t pte = *ptep;
|
||||||
__update_tlb(vma, address, pte);
|
__update_tlb(vma, address, pte);
|
||||||
__update_cache(vma, address, pte);
|
__update_cache(vma, address, pte);
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,8 +165,9 @@ extern void __update_tlb(struct vm_area_struct *vma,
|
||||||
unsigned long address, pte_t pte);
|
unsigned long address, pte_t pte);
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t pte)
|
update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t *ptep)
|
||||||
{
|
{
|
||||||
|
pte_t pte = *ptep;
|
||||||
__update_cache(vma, address, pte);
|
__update_cache(vma, address, pte);
|
||||||
__update_tlb(vma, address, pte);
|
__update_tlb(vma, address, pte);
|
||||||
}
|
}
|
||||||
|
|
|
@ -371,7 +371,7 @@ handle_tlbmiss(struct pt_regs *regs, unsigned long writeaccess,
|
||||||
local_flush_tlb_one(get_asid(), address & PAGE_MASK);
|
local_flush_tlb_one(get_asid(), address & PAGE_MASK);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
update_mmu_cache(NULL, address, entry);
|
update_mmu_cache(NULL, address, pte);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -330,9 +330,9 @@ BTFIXUPDEF_CALL(void, mmu_info, struct seq_file *)
|
||||||
#define FAULT_CODE_WRITE 0x2
|
#define FAULT_CODE_WRITE 0x2
|
||||||
#define FAULT_CODE_USER 0x4
|
#define FAULT_CODE_USER 0x4
|
||||||
|
|
||||||
BTFIXUPDEF_CALL(void, update_mmu_cache, struct vm_area_struct *, unsigned long, pte_t)
|
BTFIXUPDEF_CALL(void, update_mmu_cache, struct vm_area_struct *, unsigned long, pte_t *)
|
||||||
|
|
||||||
#define update_mmu_cache(vma,addr,pte) BTFIXUP_CALL(update_mmu_cache)(vma,addr,pte)
|
#define update_mmu_cache(vma,addr,ptep) BTFIXUP_CALL(update_mmu_cache)(vma,addr,ptep)
|
||||||
|
|
||||||
BTFIXUPDEF_CALL(void, sparc_mapiorange, unsigned int, unsigned long,
|
BTFIXUPDEF_CALL(void, sparc_mapiorange, unsigned int, unsigned long,
|
||||||
unsigned long, unsigned int)
|
unsigned long, unsigned int)
|
||||||
|
|
|
@ -706,7 +706,7 @@ extern unsigned long find_ecache_flush_span(unsigned long size);
|
||||||
#define mmu_unlockarea(vaddr, len) do { } while(0)
|
#define mmu_unlockarea(vaddr, len) do { } while(0)
|
||||||
|
|
||||||
struct vm_area_struct;
|
struct vm_area_struct;
|
||||||
extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t);
|
extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t *);
|
||||||
|
|
||||||
/* Encode and de-code a swap entry */
|
/* Encode and de-code a swap entry */
|
||||||
#define __swp_type(entry) (((entry).val >> PAGE_SHIFT) & 0xffUL)
|
#define __swp_type(entry) (((entry).val >> PAGE_SHIFT) & 0xffUL)
|
||||||
|
|
|
@ -370,7 +370,7 @@ asmlinkage void do_sun4c_fault(struct pt_regs *regs, int text_fault, int write,
|
||||||
unsigned long address)
|
unsigned long address)
|
||||||
{
|
{
|
||||||
extern void sun4c_update_mmu_cache(struct vm_area_struct *,
|
extern void sun4c_update_mmu_cache(struct vm_area_struct *,
|
||||||
unsigned long,pte_t);
|
unsigned long,pte_t *);
|
||||||
extern pte_t *sun4c_pte_offset_kernel(pmd_t *,unsigned long);
|
extern pte_t *sun4c_pte_offset_kernel(pmd_t *,unsigned long);
|
||||||
struct task_struct *tsk = current;
|
struct task_struct *tsk = current;
|
||||||
struct mm_struct *mm = tsk->mm;
|
struct mm_struct *mm = tsk->mm;
|
||||||
|
@ -447,7 +447,7 @@ asmlinkage void do_sun4c_fault(struct pt_regs *regs, int text_fault, int write,
|
||||||
* on the CPU and doing a shrink_mmap() on this vma.
|
* on the CPU and doing a shrink_mmap() on this vma.
|
||||||
*/
|
*/
|
||||||
sun4c_update_mmu_cache (find_vma(current->mm, address), address,
|
sun4c_update_mmu_cache (find_vma(current->mm, address), address,
|
||||||
*ptep);
|
ptep);
|
||||||
else
|
else
|
||||||
do_sparc_fault(regs, text_fault, write, address);
|
do_sparc_fault(regs, text_fault, write, address);
|
||||||
}
|
}
|
||||||
|
|
|
@ -289,12 +289,13 @@ static void flush_dcache(unsigned long pfn)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t pte)
|
void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t *ptep)
|
||||||
{
|
{
|
||||||
struct mm_struct *mm;
|
struct mm_struct *mm;
|
||||||
struct tsb *tsb;
|
struct tsb *tsb;
|
||||||
unsigned long tag, flags;
|
unsigned long tag, flags;
|
||||||
unsigned long tsb_index, tsb_hash_shift;
|
unsigned long tsb_index, tsb_hash_shift;
|
||||||
|
pte_t pte = *ptep;
|
||||||
|
|
||||||
if (tlb_type != hypervisor) {
|
if (tlb_type != hypervisor) {
|
||||||
unsigned long pfn = pte_pfn(pte);
|
unsigned long pfn = pte_pfn(pte);
|
||||||
|
|
|
@ -62,7 +62,7 @@ pte_t *sun4c_pte_offset_kernel(pmd_t *dir, unsigned long address)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sun4c_update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t pte)
|
void sun4c_update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t *ptep)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -694,7 +694,7 @@ extern void tsunami_setup_blockops(void);
|
||||||
* The following code is a deadwood that may be necessary when
|
* The following code is a deadwood that may be necessary when
|
||||||
* we start to make precise page flushes again. --zaitcev
|
* we start to make precise page flushes again. --zaitcev
|
||||||
*/
|
*/
|
||||||
static void swift_update_mmu_cache(struct vm_area_struct * vma, unsigned long address, pte_t pte)
|
static void swift_update_mmu_cache(struct vm_area_struct * vma, unsigned long address, pte_t *ptep)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
static unsigned long last;
|
static unsigned long last;
|
||||||
|
@ -703,10 +703,10 @@ static void swift_update_mmu_cache(struct vm_area_struct * vma, unsigned long ad
|
||||||
|
|
||||||
if (address == last) {
|
if (address == last) {
|
||||||
val = srmmu_hwprobe(address);
|
val = srmmu_hwprobe(address);
|
||||||
if (val != 0 && pte_val(pte) != val) {
|
if (val != 0 && pte_val(*ptep) != val) {
|
||||||
printk("swift_update_mmu_cache: "
|
printk("swift_update_mmu_cache: "
|
||||||
"addr %lx put %08x probed %08x from %p\n",
|
"addr %lx put %08x probed %08x from %p\n",
|
||||||
address, pte_val(pte), val,
|
address, pte_val(*ptep), val,
|
||||||
__builtin_return_address(0));
|
__builtin_return_address(0));
|
||||||
srmmu_flush_whole_tlb();
|
srmmu_flush_whole_tlb();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1887,7 +1887,7 @@ static void sun4c_check_pgt_cache(int low, int high)
|
||||||
/* An experiment, turn off by default for now... -DaveM */
|
/* An experiment, turn off by default for now... -DaveM */
|
||||||
#define SUN4C_PRELOAD_PSEG
|
#define SUN4C_PRELOAD_PSEG
|
||||||
|
|
||||||
void sun4c_update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t pte)
|
void sun4c_update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t *ptep)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
int pseg;
|
int pseg;
|
||||||
|
@ -1929,7 +1929,7 @@ void sun4c_update_mmu_cache(struct vm_area_struct *vma, unsigned long address, p
|
||||||
start += PAGE_SIZE;
|
start += PAGE_SIZE;
|
||||||
}
|
}
|
||||||
#ifndef SUN4C_PRELOAD_PSEG
|
#ifndef SUN4C_PRELOAD_PSEG
|
||||||
sun4c_put_pte(address, pte_val(pte));
|
sun4c_put_pte(address, pte_val(*ptep));
|
||||||
#endif
|
#endif
|
||||||
local_irq_restore(flags);
|
local_irq_restore(flags);
|
||||||
return;
|
return;
|
||||||
|
@ -1940,7 +1940,7 @@ void sun4c_update_mmu_cache(struct vm_area_struct *vma, unsigned long address, p
|
||||||
add_lru(entry);
|
add_lru(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
sun4c_put_pte(address, pte_val(pte));
|
sun4c_put_pte(address, pte_val(*ptep));
|
||||||
local_irq_restore(flags);
|
local_irq_restore(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -345,7 +345,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
|
||||||
struct mm_struct;
|
struct mm_struct;
|
||||||
extern pte_t *virt_to_pte(struct mm_struct *mm, unsigned long addr);
|
extern pte_t *virt_to_pte(struct mm_struct *mm, unsigned long addr);
|
||||||
|
|
||||||
#define update_mmu_cache(vma,address,pte) do ; while (0)
|
#define update_mmu_cache(vma,address,ptep) do ; while (0)
|
||||||
|
|
||||||
/* Encode and de-code a swap entry */
|
/* Encode and de-code a swap entry */
|
||||||
#define __swp_type(x) (((x).val >> 4) & 0x3f)
|
#define __swp_type(x) (((x).val >> 4) & 0x3f)
|
||||||
|
|
|
@ -80,7 +80,7 @@ do { \
|
||||||
* The i386 doesn't have any external MMU info: the kernel page
|
* The i386 doesn't have any external MMU info: the kernel page
|
||||||
* tables contain all the necessary information.
|
* tables contain all the necessary information.
|
||||||
*/
|
*/
|
||||||
#define update_mmu_cache(vma, address, pte) do { } while (0)
|
#define update_mmu_cache(vma, address, ptep) do { } while (0)
|
||||||
|
|
||||||
#endif /* !__ASSEMBLY__ */
|
#endif /* !__ASSEMBLY__ */
|
||||||
|
|
||||||
|
|
|
@ -129,7 +129,7 @@ static inline int pgd_large(pgd_t pgd) { return 0; }
|
||||||
#define pte_unmap(pte) /* NOP */
|
#define pte_unmap(pte) /* NOP */
|
||||||
#define pte_unmap_nested(pte) /* NOP */
|
#define pte_unmap_nested(pte) /* NOP */
|
||||||
|
|
||||||
#define update_mmu_cache(vma, address, pte) do { } while (0)
|
#define update_mmu_cache(vma, address, ptep) do { } while (0)
|
||||||
|
|
||||||
/* Encode and de-code a swap entry */
|
/* Encode and de-code a swap entry */
|
||||||
#if _PAGE_BIT_FILE < _PAGE_BIT_PROTNONE
|
#if _PAGE_BIT_FILE < _PAGE_BIT_PROTNONE
|
||||||
|
|
|
@ -394,7 +394,7 @@ ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
|
||||||
#define kern_addr_valid(addr) (1)
|
#define kern_addr_valid(addr) (1)
|
||||||
|
|
||||||
extern void update_mmu_cache(struct vm_area_struct * vma,
|
extern void update_mmu_cache(struct vm_area_struct * vma,
|
||||||
unsigned long address, pte_t pte);
|
unsigned long address, pte_t *ptep);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* remap a physical page `pfn' of size `size' with page protection `prot'
|
* remap a physical page `pfn' of size `size' with page protection `prot'
|
||||||
|
|
|
@ -147,9 +147,9 @@ void flush_cache_page(struct vm_area_struct* vma, unsigned long address,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
update_mmu_cache(struct vm_area_struct * vma, unsigned long addr, pte_t pte)
|
update_mmu_cache(struct vm_area_struct * vma, unsigned long addr, pte_t *ptep)
|
||||||
{
|
{
|
||||||
unsigned long pfn = pte_pfn(pte);
|
unsigned long pfn = pte_pfn(*ptep);
|
||||||
struct page *page;
|
struct page *page;
|
||||||
|
|
||||||
if (!pfn_valid(pfn))
|
if (!pfn_valid(pfn))
|
||||||
|
|
|
@ -2088,7 +2088,7 @@ static void set_huge_ptep_writable(struct vm_area_struct *vma,
|
||||||
|
|
||||||
entry = pte_mkwrite(pte_mkdirty(huge_ptep_get(ptep)));
|
entry = pte_mkwrite(pte_mkdirty(huge_ptep_get(ptep)));
|
||||||
if (huge_ptep_set_access_flags(vma, address, ptep, entry, 1)) {
|
if (huge_ptep_set_access_flags(vma, address, ptep, entry, 1)) {
|
||||||
update_mmu_cache(vma, address, entry);
|
update_mmu_cache(vma, address, ptep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2559,7 +2559,7 @@ int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
|
||||||
entry = pte_mkyoung(entry);
|
entry = pte_mkyoung(entry);
|
||||||
if (huge_ptep_set_access_flags(vma, address, ptep, entry,
|
if (huge_ptep_set_access_flags(vma, address, ptep, entry,
|
||||||
flags & FAULT_FLAG_WRITE))
|
flags & FAULT_FLAG_WRITE))
|
||||||
update_mmu_cache(vma, address, entry);
|
update_mmu_cache(vma, address, ptep);
|
||||||
|
|
||||||
out_page_table_lock:
|
out_page_table_lock:
|
||||||
spin_unlock(&mm->page_table_lock);
|
spin_unlock(&mm->page_table_lock);
|
||||||
|
|
14
mm/memory.c
14
mm/memory.c
|
@ -1593,7 +1593,7 @@ static int insert_pfn(struct vm_area_struct *vma, unsigned long addr,
|
||||||
/* Ok, finally just insert the thing.. */
|
/* Ok, finally just insert the thing.. */
|
||||||
entry = pte_mkspecial(pfn_pte(pfn, prot));
|
entry = pte_mkspecial(pfn_pte(pfn, prot));
|
||||||
set_pte_at(mm, addr, pte, entry);
|
set_pte_at(mm, addr, pte, entry);
|
||||||
update_mmu_cache(vma, addr, entry); /* XXX: why not for insert_page? */
|
update_mmu_cache(vma, addr, pte); /* XXX: why not for insert_page? */
|
||||||
|
|
||||||
retval = 0;
|
retval = 0;
|
||||||
out_unlock:
|
out_unlock:
|
||||||
|
@ -2116,7 +2116,7 @@ reuse:
|
||||||
entry = pte_mkyoung(orig_pte);
|
entry = pte_mkyoung(orig_pte);
|
||||||
entry = maybe_mkwrite(pte_mkdirty(entry), vma);
|
entry = maybe_mkwrite(pte_mkdirty(entry), vma);
|
||||||
if (ptep_set_access_flags(vma, address, page_table, entry,1))
|
if (ptep_set_access_flags(vma, address, page_table, entry,1))
|
||||||
update_mmu_cache(vma, address, entry);
|
update_mmu_cache(vma, address, page_table);
|
||||||
ret |= VM_FAULT_WRITE;
|
ret |= VM_FAULT_WRITE;
|
||||||
goto unlock;
|
goto unlock;
|
||||||
}
|
}
|
||||||
|
@ -2185,7 +2185,7 @@ gotten:
|
||||||
* new page to be mapped directly into the secondary page table.
|
* new page to be mapped directly into the secondary page table.
|
||||||
*/
|
*/
|
||||||
set_pte_at_notify(mm, address, page_table, entry);
|
set_pte_at_notify(mm, address, page_table, entry);
|
||||||
update_mmu_cache(vma, address, entry);
|
update_mmu_cache(vma, address, page_table);
|
||||||
if (old_page) {
|
if (old_page) {
|
||||||
/*
|
/*
|
||||||
* Only after switching the pte to the new page may
|
* Only after switching the pte to the new page may
|
||||||
|
@ -2629,7 +2629,7 @@ static int do_swap_page(struct mm_struct *mm, struct vm_area_struct *vma,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No need to invalidate - it was non-present before */
|
/* No need to invalidate - it was non-present before */
|
||||||
update_mmu_cache(vma, address, pte);
|
update_mmu_cache(vma, address, page_table);
|
||||||
unlock:
|
unlock:
|
||||||
pte_unmap_unlock(page_table, ptl);
|
pte_unmap_unlock(page_table, ptl);
|
||||||
out:
|
out:
|
||||||
|
@ -2694,7 +2694,7 @@ setpte:
|
||||||
set_pte_at(mm, address, page_table, entry);
|
set_pte_at(mm, address, page_table, entry);
|
||||||
|
|
||||||
/* No need to invalidate - it was non-present before */
|
/* No need to invalidate - it was non-present before */
|
||||||
update_mmu_cache(vma, address, entry);
|
update_mmu_cache(vma, address, page_table);
|
||||||
unlock:
|
unlock:
|
||||||
pte_unmap_unlock(page_table, ptl);
|
pte_unmap_unlock(page_table, ptl);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2855,7 +2855,7 @@ static int __do_fault(struct mm_struct *mm, struct vm_area_struct *vma,
|
||||||
set_pte_at(mm, address, page_table, entry);
|
set_pte_at(mm, address, page_table, entry);
|
||||||
|
|
||||||
/* no need to invalidate: a not-present page won't be cached */
|
/* no need to invalidate: a not-present page won't be cached */
|
||||||
update_mmu_cache(vma, address, entry);
|
update_mmu_cache(vma, address, page_table);
|
||||||
} else {
|
} else {
|
||||||
if (charged)
|
if (charged)
|
||||||
mem_cgroup_uncharge_page(page);
|
mem_cgroup_uncharge_page(page);
|
||||||
|
@ -2992,7 +2992,7 @@ static inline int handle_pte_fault(struct mm_struct *mm,
|
||||||
}
|
}
|
||||||
entry = pte_mkyoung(entry);
|
entry = pte_mkyoung(entry);
|
||||||
if (ptep_set_access_flags(vma, address, pte, entry, flags & FAULT_FLAG_WRITE)) {
|
if (ptep_set_access_flags(vma, address, pte, entry, flags & FAULT_FLAG_WRITE)) {
|
||||||
update_mmu_cache(vma, address, entry);
|
update_mmu_cache(vma, address, pte);
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* This is needed only for protection faults but the arch code
|
* This is needed only for protection faults but the arch code
|
||||||
|
|
|
@ -134,7 +134,7 @@ static int remove_migration_pte(struct page *new, struct vm_area_struct *vma,
|
||||||
page_add_file_rmap(new);
|
page_add_file_rmap(new);
|
||||||
|
|
||||||
/* No need to invalidate - it was non-present before */
|
/* No need to invalidate - it was non-present before */
|
||||||
update_mmu_cache(vma, addr, pte);
|
update_mmu_cache(vma, addr, ptep);
|
||||||
unlock:
|
unlock:
|
||||||
pte_unmap_unlock(ptep, ptl);
|
pte_unmap_unlock(ptep, ptl);
|
||||||
out:
|
out:
|
||||||
|
|
Loading…
Reference in New Issue