sh: Preliminary support for SH-X2 MMU.
This adds some preliminary support for the SH-X2 MMU, used by newer SH-4A parts (particularly SH7785). This MMU implements a 'compat' mode with SH-X MMUs and an 'extended' mode for SH-X2 extended features. Extended features include additional page sizes (8kB, 4MB, 64MB), as well as the addition of page execute permissions. The extended mode attributes are placed in a second data array, which requires us to switch to 64-bit PTEs when in X2 mode. With the addition of the exec perms, we also overhaul the mmap prots somewhat, now that it's possible to handle them more intelligently. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
This commit is contained in:
@@ -13,9 +13,16 @@
|
||||
[ P4 control ] 0xE0000000
|
||||
*/
|
||||
|
||||
|
||||
/* PAGE_SHIFT determines the page size */
|
||||
#define PAGE_SHIFT 12
|
||||
#if defined(CONFIG_PAGE_SIZE_4KB)
|
||||
# define PAGE_SHIFT 12
|
||||
#elif defined(CONFIG_PAGE_SIZE_8KB)
|
||||
# define PAGE_SHIFT 13
|
||||
#elif defined(CONFIG_PAGE_SIZE_64KB)
|
||||
# define PAGE_SHIFT 16
|
||||
#else
|
||||
# error "Bogus kernel page size?"
|
||||
#endif
|
||||
|
||||
#ifdef __ASSEMBLY__
|
||||
#define PAGE_SIZE (1 << PAGE_SHIFT)
|
||||
@@ -28,8 +35,14 @@
|
||||
|
||||
#if defined(CONFIG_HUGETLB_PAGE_SIZE_64K)
|
||||
#define HPAGE_SHIFT 16
|
||||
#elif defined(CONFIG_HUGETLB_PAGE_SIZE_256K)
|
||||
#define HPAGE_SHIFT 18
|
||||
#elif defined(CONFIG_HUGETLB_PAGE_SIZE_1MB)
|
||||
#define HPAGE_SHIFT 20
|
||||
#elif defined(CONFIG_HUGETLB_PAGE_SIZE_4MB)
|
||||
#define HPAGE_SHIFT 22
|
||||
#elif defined(CONFIG_HUGETLB_PAGE_SIZE_64MB)
|
||||
#define HPAGE_SHIFT 26
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_HUGETLB_PAGE
|
||||
@@ -69,15 +82,25 @@ extern void __copy_user_page(void *to, void *from, void *orig_to);
|
||||
/*
|
||||
* These are used to make use of C type-checking..
|
||||
*/
|
||||
typedef struct { unsigned long pte; } pte_t;
|
||||
typedef struct { unsigned long pgd; } pgd_t;
|
||||
#ifdef CONFIG_X2TLB
|
||||
typedef struct { unsigned long pte_low, pte_high; } pte_t;
|
||||
typedef struct { unsigned long long pgprot; } pgprot_t;
|
||||
#define pte_val(x) \
|
||||
((x).pte_low | ((unsigned long long)(x).pte_high << 32))
|
||||
#define __pte(x) \
|
||||
({ pte_t __pte = {(x), ((unsigned long long)(x)) >> 32}; __pte; })
|
||||
#else
|
||||
typedef struct { unsigned long pte_low; } pte_t;
|
||||
typedef struct { unsigned long pgprot; } pgprot_t;
|
||||
#define pte_val(x) ((x).pte_low)
|
||||
#define __pte(x) ((pte_t) { (x) } )
|
||||
#endif
|
||||
|
||||
typedef struct { unsigned long pgd; } pgd_t;
|
||||
|
||||
#define pte_val(x) ((x).pte)
|
||||
#define pgd_val(x) ((x).pgd)
|
||||
#define pgprot_val(x) ((x).pgprot)
|
||||
|
||||
#define __pte(x) ((pte_t) { (x) } )
|
||||
#define __pgd(x) ((pgd_t) { (x) } )
|
||||
#define __pgprot(x) ((pgprot_t) { (x) } )
|
||||
|
||||
|
Reference in New Issue
Block a user