92
92
typedef struct { unsigned long pgprot; } pgprot_t;
93
typedef struct { unsigned long pgste; } pgste_t;
93
94
typedef struct { unsigned long pte; } pte_t;
94
95
typedef struct { unsigned long pmd; } pmd_t;
95
96
typedef struct { unsigned long pud; } pud_t;
97
98
typedef pte_t *pgtable_t;
99
100
#define pgprot_val(x) ((x).pgprot)
101
#define pgste_val(x) ((x).pgste)
100
102
#define pte_val(x) ((x).pte)
101
103
#define pmd_val(x) ((x).pmd)
102
104
#define pud_val(x) ((x).pud)
103
105
#define pgd_val(x) ((x).pgd)
107
#define __pgste(x) ((pgste_t) { (x) } )
105
108
#define __pte(x) ((pte_t) { (x) } )
106
109
#define __pmd(x) ((pmd_t) { (x) } )
110
#define __pud(x) ((pud_t) { (x) } )
107
111
#define __pgd(x) ((pgd_t) { (x) } )
108
112
#define __pgprot(x) ((pgprot_t) { (x) } )
111
page_set_storage_key(unsigned long addr, unsigned int skey, int mapped)
114
static inline void page_set_storage_key(unsigned long addr,
115
unsigned char skey, int mapped)
114
118
asm volatile(".insn rrf,0xb22b0000,%0,%1,8,0"
117
121
asm volatile("sske %0,%1" : : "d" (skey), "a" (addr));
120
static inline unsigned int
121
page_get_storage_key(unsigned long addr)
124
static inline unsigned char page_get_storage_key(unsigned long addr)
125
asm volatile("iske %0,%1" : "=d" (skey) : "a" (addr), "0" (0));
128
asm volatile("iske %0,%1" : "=d" (skey) : "a" (addr));
132
static inline int page_reset_referenced(unsigned long addr)
139
: "=d" (ipm) : "a" (addr) : "cc");
140
return !!(ipm & 0x20000000);
143
/* Bits int the storage key */
144
#define _PAGE_CHANGED 0x02 /* HW changed bit */
145
#define _PAGE_REFERENCED 0x04 /* HW referenced bit */
146
#define _PAGE_FP_BIT 0x08 /* HW fetch protection bit */
147
#define _PAGE_ACC_BITS 0xf0 /* HW access control bits */
150
* Test and clear dirty bit in storage key.
151
* We can't clear the changed bit atomically. This is a potential
152
* race against modification of the referenced bit. This function
153
* should therefore only be called if it is not mapped in any
156
#define __HAVE_ARCH_PAGE_TEST_AND_CLEAR_DIRTY
157
static inline int page_test_and_clear_dirty(unsigned long pfn, int mapped)
161
skey = page_get_storage_key(pfn << PAGE_SHIFT);
162
if (!(skey & _PAGE_CHANGED))
164
page_set_storage_key(pfn << PAGE_SHIFT, skey & ~_PAGE_CHANGED, mapped);
169
* Test and clear referenced bit in storage key.
171
#define __HAVE_ARCH_PAGE_TEST_AND_CLEAR_YOUNG
172
static inline int page_test_and_clear_young(unsigned long pfn)
174
return page_reset_referenced(pfn << PAGE_SHIFT);
130
178
void arch_free_page(struct page *page, int order);
131
179
void arch_alloc_page(struct page *page, int order);