Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 42585
b: refs/heads/master
c: 52e2778
h: refs/heads/master
i:
  42583: adb0c8c
v: v3
  • Loading branch information
Paul Mundt committed Dec 6, 2006
1 parent 747b1b6 commit b6bf188
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 27 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: 21440cf04a64cd1b1209c12a6e1a3afba2a28709
refs/heads/master: 52e27782e1c4afa1feca0fdf194d279595e0431c
14 changes: 5 additions & 9 deletions trunk/arch/sh/mm/cache-sh4.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,8 @@
*/
#include <linux/init.h>
#include <linux/mm.h>
#include <asm/addrspace.h>
#include <asm/pgtable.h>
#include <asm/processor.h>
#include <asm/cache.h>
#include <asm/io.h>
#include <asm/pgalloc.h>
#include <linux/io.h>
#include <linux/mutex.h>
#include <asm/mmu_context.h>
#include <asm/cacheflush.h>

Expand Down Expand Up @@ -83,9 +79,9 @@ static void __init emit_cache_params(void)
*/

/* Worst case assumed to be 64k cache, direct-mapped i.e. 4 synonym bits. */
#define MAX_P3_SEMAPHORES 16
#define MAX_P3_MUTEXES 16

struct semaphore p3map_sem[MAX_P3_SEMAPHORES];
struct mutex p3map_mutex[MAX_P3_MUTEXES];

void __init p3_cache_init(void)
{
Expand Down Expand Up @@ -115,7 +111,7 @@ void __init p3_cache_init(void)
panic("%s failed.", __FUNCTION__);

for (i = 0; i < cpu_data->dcache.n_aliases; i++)
sema_init(&p3map_sem[i], 1);
mutex_init(&p3map_mutex[i]);
}

/*
Expand Down
23 changes: 6 additions & 17 deletions trunk/arch/sh/mm/pg-sh4.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,12 @@
*
* Released under the terms of the GNU GPL v2.0.
*/
#include <linux/init.h>
#include <linux/mman.h>
#include <linux/mm.h>
#include <linux/threads.h>
#include <asm/addrspace.h>
#include <asm/page.h>
#include <asm/pgtable.h>
#include <asm/processor.h>
#include <asm/cache.h>
#include <asm/io.h>
#include <asm/uaccess.h>
#include <asm/pgalloc.h>
#include <linux/mutex.h>
#include <asm/mmu_context.h>
#include <asm/cacheflush.h>

extern struct semaphore p3map_sem[];
extern struct mutex p3map_mutex[];

#define CACHE_ALIAS (cpu_data->dcache.alias_mask)

Expand All @@ -47,15 +37,15 @@ void clear_user_page(void *to, unsigned long address, struct page *page)
unsigned long flags;

entry = pfn_pte(phys_addr >> PAGE_SHIFT, PAGE_KERNEL);
down(&p3map_sem[(address & CACHE_ALIAS)>>12]);
mutex_lock(&p3map_mutex[(address & CACHE_ALIAS)>>12]);
set_pte(pte, entry);
local_irq_save(flags);
__flush_tlb_page(get_asid(), p3_addr);
local_irq_restore(flags);
update_mmu_cache(NULL, p3_addr, entry);
__clear_user_page((void *)p3_addr, to);
pte_clear(&init_mm, p3_addr, pte);
up(&p3map_sem[(address & CACHE_ALIAS)>>12]);
mutex_unlock(&p3map_mutex[(address & CACHE_ALIAS)>>12]);
}
}

Expand Down Expand Up @@ -83,15 +73,15 @@ void copy_user_page(void *to, void *from, unsigned long address,
unsigned long flags;

entry = pfn_pte(phys_addr >> PAGE_SHIFT, PAGE_KERNEL);
down(&p3map_sem[(address & CACHE_ALIAS)>>12]);
mutex_lock(&p3map_mutex[(address & CACHE_ALIAS)>>12]);
set_pte(pte, entry);
local_irq_save(flags);
__flush_tlb_page(get_asid(), p3_addr);
local_irq_restore(flags);
update_mmu_cache(NULL, p3_addr, entry);
__copy_user_page((void *)p3_addr, from, to);
pte_clear(&init_mm, p3_addr, pte);
up(&p3map_sem[(address & CACHE_ALIAS)>>12]);
mutex_unlock(&p3map_mutex[(address & CACHE_ALIAS)>>12]);
}
}

Expand All @@ -114,4 +104,3 @@ inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t
}
return pte;
}

0 comments on commit b6bf188

Please sign in to comment.