Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 163349
b: refs/heads/master
c: 9cef749
h: refs/heads/master
i:
  163347: cbb0892
v: v3
  • Loading branch information
Paul Mundt committed Jul 28, 2009
1 parent bbc53c4 commit c740461
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 75 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0dfae7d5a21901b28ec0452d71be64adf5ea323e
refs/heads/master: 9cef7492696a416663b4edb953a4eade8517ebeb
15 changes: 13 additions & 2 deletions trunk/arch/sh/include/asm/pgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,19 @@ typedef pte_t *pte_addr_t;
#define pgtable_cache_init() do { } while (0)

struct vm_area_struct;
extern void update_mmu_cache(struct vm_area_struct * vma,
unsigned long address, pte_t pte);

extern void __update_cache(struct vm_area_struct *vma,
unsigned long address, pte_t pte);
extern void __update_tlb(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 pte)
{
__update_cache(vma, address, pte);
__update_tlb(vma, address, pte);
}

extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
extern void paging_init(void);
extern void page_table_range_init(unsigned long start, unsigned long end,
Expand Down
21 changes: 21 additions & 0 deletions trunk/arch/sh/mm/pg-mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,24 @@ void clear_user_highpage(struct page *page, unsigned long vaddr)
kunmap_atomic(kaddr, KM_USER0);
}
EXPORT_SYMBOL(clear_user_highpage);

void __update_cache(struct vm_area_struct *vma,
unsigned long address, pte_t pte)
{
struct page *page;
unsigned long pfn = pte_pfn(pte);

if (!boot_cpu_data.dcache.n_aliases)
return;

page = pfn_to_page(pfn);
if (pfn_valid(pfn) && page_mapping(page)) {
int dirty = test_and_clear_bit(PG_dcache_dirty, &page->flags);
if (dirty) {
unsigned long addr = (unsigned long)page_address(page);

if (pages_do_alias(addr, address & PAGE_MASK))
__flush_wback_region((void *)addr, PAGE_SIZE);
}
}
}
9 changes: 6 additions & 3 deletions trunk/arch/sh/mm/tlb-nommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,13 @@ void local_flush_tlb_kernel_range(unsigned long start, unsigned long end)
BUG();
}

void update_mmu_cache(struct vm_area_struct * vma,
unsigned long address, pte_t pte)
void __update_tlb(struct vm_area_struct *vma, unsigned long address, pte_t pte)
{
}

void __update_cache(struct vm_area_struct *vma,
unsigned long address, pte_t pte)
{
BUG();
}

void __init page_table_range_init(unsigned long start, unsigned long end,
Expand Down
13 changes: 6 additions & 7 deletions trunk/arch/sh/mm/tlb-pteaex.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@
#include <asm/mmu_context.h>
#include <asm/cacheflush.h>

void update_mmu_cache(struct vm_area_struct * vma,
unsigned long address, pte_t pte)
void __update_tlb(struct vm_area_struct *vma, unsigned long address, pte_t pte)
{
unsigned long flags;
unsigned long pteval;
unsigned long vpn;
unsigned long flags, pteval, vpn;

/* Ptrace may call this routine. */
if (vma && current->active_mm != vma->vm_mm)
/*
* Handle debugger faulting in for debugee.
*/
if (current->active_mm != vma->vm_mm)
return;

local_irq_save(flags);
Expand Down
29 changes: 6 additions & 23 deletions trunk/arch/sh/mm/tlb-sh3.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,32 +27,16 @@
#include <asm/mmu_context.h>
#include <asm/cacheflush.h>

void update_mmu_cache(struct vm_area_struct * vma,
unsigned long address, pte_t pte)
void __update_tlb(struct vm_area_struct *vma, unsigned long address, pte_t pte)
{
unsigned long flags;
unsigned long pteval;
unsigned long vpn;
unsigned long pfn = pte_pfn(pte);
struct page *page;
unsigned long flags, pteval, vpn;

/* Ptrace may call this routine. */
if (vma && current->active_mm != vma->vm_mm)
/*
* Handle debugger faulting in for debugee.
*/
if (current->active_mm != vma->vm_mm)
return;

page = pfn_to_page(pfn);
if (pfn_valid(pfn) && page_mapping(page)) {
#if defined(CONFIG_SH7705_CACHE_32KB)
int dirty = test_and_clear_bit(PG_dcache_dirty, &page->flags);
if (dirty) {
unsigned long addr = (unsigned long)page_address(page);

if (pages_do_alias(addr, address & PAGE_MASK))
__flush_wback_region((void *)addr, PAGE_SIZE);
}
#endif
}

local_irq_save(flags);

/* Set PTEH register */
Expand Down Expand Up @@ -93,4 +77,3 @@ void local_flush_tlb_one(unsigned long asid, unsigned long page)
for (i = 0; i < ways; i++)
ctrl_outl(data, addr + (i << 8));
}

29 changes: 6 additions & 23 deletions trunk/arch/sh/mm/tlb-sh4.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,16 @@
#include <asm/mmu_context.h>
#include <asm/cacheflush.h>

void update_mmu_cache(struct vm_area_struct * vma,
unsigned long address, pte_t pte)
void __update_tlb(struct vm_area_struct *vma, unsigned long address, pte_t pte)
{
unsigned long flags;
unsigned long pteval;
unsigned long vpn;
unsigned long pfn = pte_pfn(pte);
struct page *page;
unsigned long flags, pteval, vpn;

/* Ptrace may call this routine. */
if (vma && current->active_mm != vma->vm_mm)
/*
* Handle debugger faulting in for debugee.
*/
if (current->active_mm != vma->vm_mm)
return;

page = pfn_to_page(pfn);
if (pfn_valid(pfn) && page_mapping(page)) {
#ifndef CONFIG_SMP
int dirty = test_and_clear_bit(PG_dcache_dirty, &page->flags);
if (dirty) {

unsigned long addr = (unsigned long)page_address(page);

if (pages_do_alias(addr, address & PAGE_MASK))
__flush_wback_region((void *)addr, PAGE_SIZE);
}
#endif
}

local_irq_save(flags);

/* Set PTEH register */
Expand Down
25 changes: 9 additions & 16 deletions trunk/arch/sh/mm/tlbflush_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,22 +329,6 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long writeaccess,
goto no_context;
}

void update_mmu_cache(struct vm_area_struct * vma,
unsigned long address, pte_t pte)
{
/*
* This appears to get called once for every pte entry that gets
* established => I don't think it's efficient to try refilling the
* TLBs with the pages - some may not get accessed even. Also, for
* executable pages, it is impossible to determine reliably here which
* TLB they should be mapped into (or both even).
*
* So, just do nothing here and handle faults on demand. In the
* TLBMISS handling case, the refill is now done anyway after the pte
* has been fixed up, so that deals with most useful cases.
*/
}

void local_flush_tlb_one(unsigned long asid, unsigned long page)
{
unsigned long long match, pteh=0, lpage;
Expand Down Expand Up @@ -482,3 +466,12 @@ void local_flush_tlb_kernel_range(unsigned long start, unsigned long end)
/* FIXME: Optimize this later.. */
flush_tlb_all();
}

void __update_tlb(struct vm_area_struct *vma, unsigned long address, pte_t pte)
{
}

void __update_cache(struct vm_area_struct *vma,
unsigned long address, pte_t pte)
{
}

0 comments on commit c740461

Please sign in to comment.