Skip to content

Commit

Permalink
FRV: Handle update_mmu_cache() being called when current->mm is NULL …
Browse files Browse the repository at this point in the history
…[try #2]

Handle update_mmu_cache() being called when current->mm is NULL.

We cache static TLB mappings for the current page table in DAMPR4 and DAMPR5
on the theory that the next data lookup is likely to be in the same general
region, and thus is likely to be mapped by the same page table.  However, we
can't get this information if we can't access the appropriate mm_struct.

If current->mm is NULL, we just clear the cache in the knowledge that the TLB
miss handlers will load it.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
David Howells authored and Linus Torvalds committed Apr 10, 2008
1 parent 5d69a02 commit a31b9dd
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions include/asm-frv/pgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -507,13 +507,22 @@ static inline int pte_file(pte_t pte)
*/
static inline void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t pte)
{
struct mm_struct *mm;
unsigned long ampr;
pgd_t *pge = pgd_offset(current->mm, address);
pud_t *pue = pud_offset(pge, address);
pmd_t *pme = pmd_offset(pue, address);

ampr = pme->ste[0] & 0xffffff00;
ampr |= xAMPRx_L | xAMPRx_SS_16Kb | xAMPRx_S | xAMPRx_C | xAMPRx_V;
mm = current->mm;
if (mm) {
pgd_t *pge = pgd_offset(mm, address);
pud_t *pue = pud_offset(pge, address);
pmd_t *pme = pmd_offset(pue, address);

ampr = pme->ste[0] & 0xffffff00;
ampr |= xAMPRx_L | xAMPRx_SS_16Kb | xAMPRx_S | xAMPRx_C |
xAMPRx_V;
} else {
address = ULONG_MAX;
ampr = 0;
}

asm volatile("movgs %0,scr0\n"
"movgs %0,scr1\n"
Expand Down

0 comments on commit a31b9dd

Please sign in to comment.