2013-01-18 02:42:19 -07:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _ASM_ARC_MMU_H
|
|
|
|
#define _ASM_ARC_MMU_H
|
|
|
|
|
2013-06-01 01:25:42 -06:00
|
|
|
#if defined(CONFIG_ARC_MMU_V1)
|
|
|
|
#define CONFIG_ARC_MMU_VER 1
|
|
|
|
#elif defined(CONFIG_ARC_MMU_V2)
|
|
|
|
#define CONFIG_ARC_MMU_VER 2
|
|
|
|
#elif defined(CONFIG_ARC_MMU_V3)
|
|
|
|
#define CONFIG_ARC_MMU_VER 3
|
|
|
|
#endif
|
|
|
|
|
2013-05-14 01:58:17 -06:00
|
|
|
/* MMU Management regs */
|
|
|
|
#define ARC_REG_MMU_BCR 0x06f
|
|
|
|
#define ARC_REG_TLBPD0 0x405
|
|
|
|
#define ARC_REG_TLBPD1 0x406
|
|
|
|
#define ARC_REG_TLBINDEX 0x407
|
|
|
|
#define ARC_REG_TLBCOMMAND 0x408
|
|
|
|
#define ARC_REG_PID 0x409
|
|
|
|
#define ARC_REG_SCRATCH_DATA0 0x418
|
|
|
|
|
|
|
|
/* Bits in MMU PID register */
|
|
|
|
#define MMU_ENABLE (1 << 31) /* Enable MMU for process */
|
|
|
|
|
|
|
|
/* Error code if probe fails */
|
|
|
|
#define TLB_LKUP_ERR 0x80000000
|
|
|
|
|
2013-07-01 06:42:28 -06:00
|
|
|
#define TLB_DUP_ERR (TLB_LKUP_ERR | 0x00000001)
|
|
|
|
|
2013-05-14 01:58:17 -06:00
|
|
|
/* TLB Commands */
|
|
|
|
#define TLBWrite 0x1
|
|
|
|
#define TLBRead 0x2
|
|
|
|
#define TLBGetIndex 0x3
|
|
|
|
#define TLBProbe 0x4
|
|
|
|
|
|
|
|
#if (CONFIG_ARC_MMU_VER >= 2)
|
|
|
|
#define TLBWriteNI 0x5 /* write JTLB without inv uTLBs */
|
|
|
|
#define TLBIVUTLB 0x6 /* explicitly inv uTLBs */
|
|
|
|
#endif
|
|
|
|
|
2013-01-18 02:42:19 -07:00
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
|
|
|
|
typedef struct {
|
ARC: [ASID] Track ASID allocation cycles/generations
This helps remove asid-to-mm reverse map
While mm->context.id contains the ASID assigned to a process, our ASID
allocator also used asid_mm_map[] reverse map. In a new allocation
cycle (mm->ASID >= @asid_cache), the Round Robin ASID allocator used this
to check if new @asid_cache belonged to some mm2 (from prev cycle).
If so, it could locate that mm using the ASID reverse map, and mark that
mm as unallocated ASID, to force it to refresh at the time of switch_mm()
However, for SMP, the reverse map has to be maintained per CPU, so
becomes 2 dimensional, hence got rid of it.
With reverse map gone, it is NOT possible to reach out to current
assignee. So we track the ASID allocation generation/cycle and
on every switch_mm(), check if the current generation of CPU ASID is
same as mm's ASID; If not it is refreshed.
(Based loosely on arch/sh implementation)
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
2013-07-25 16:45:50 -06:00
|
|
|
unsigned long asid; /* 8 bit MMU PID + Generation cycle */
|
2013-01-18 02:42:19 -07:00
|
|
|
} mm_context_t;
|
|
|
|
|
2013-05-14 01:58:17 -06:00
|
|
|
#ifdef CONFIG_ARC_DBG_TLB_PARANOIA
|
2013-08-23 06:07:18 -06:00
|
|
|
void tlb_paranoid_check(unsigned int mm_asid, unsigned long address);
|
2013-05-14 01:58:17 -06:00
|
|
|
#else
|
|
|
|
#define tlb_paranoid_check(a, b)
|
2013-01-18 02:42:19 -07:00
|
|
|
#endif
|
|
|
|
|
2013-05-14 01:58:17 -06:00
|
|
|
void arc_mmu_init(void);
|
|
|
|
extern char *arc_mmu_mumbojumbo(int cpu_id, char *buf, int len);
|
2013-09-05 07:49:06 -06:00
|
|
|
void read_decode_mmu_bcr(void);
|
2013-05-14 01:58:17 -06:00
|
|
|
|
|
|
|
#endif /* !__ASSEMBLY__ */
|
|
|
|
|
2013-01-18 02:42:19 -07:00
|
|
|
#endif
|