19
19
pr_err("%s:%d: bad pgd %p(%016Lx)\n", \
20
20
__FILE__, __LINE__, &(e), pgd_val(e))
21
21
22
- /* Rules for using set_pte: the pte being assigned *must* be
22
+ #define pxx_xchg64 (_pxx , _ptr , _val ) ({ \
23
+ _pxx##val_t *_p = (_pxx##val_t *)_ptr; \
24
+ _pxx##val_t _o = *_p; \
25
+ do { } while (!try_cmpxchg64(_p, &_o, (_val))); \
26
+ native_make_##_pxx(_o); \
27
+ })
28
+
29
+ /*
30
+ * Rules for using set_pte: the pte being assigned *must* be
23
31
* either not present or in a state where the hardware will
24
32
* not attempt to update the pte. In places where this is
25
33
* not possible, use pte_get_and_clear to obtain the old pte
@@ -34,20 +42,20 @@ static inline void native_set_pte(pte_t *ptep, pte_t pte)
34
42
35
43
static inline void native_set_pte_atomic (pte_t * ptep , pte_t pte )
36
44
{
37
- set_64bit (( unsigned long long * )( ptep ) , native_pte_val (pte ));
45
+ pxx_xchg64 ( pte , ptep , native_pte_val (pte ));
38
46
}
39
47
40
48
static inline void native_set_pmd (pmd_t * pmdp , pmd_t pmd )
41
49
{
42
- set_64bit (( unsigned long long * )( pmdp ) , native_pmd_val (pmd ));
50
+ pxx_xchg64 ( pmd , pmdp , native_pmd_val (pmd ));
43
51
}
44
52
45
53
static inline void native_set_pud (pud_t * pudp , pud_t pud )
46
54
{
47
55
#ifdef CONFIG_PAGE_TABLE_ISOLATION
48
56
pud .p4d .pgd = pti_set_user_pgtbl (& pudp -> p4d .pgd , pud .p4d .pgd );
49
57
#endif
50
- set_64bit (( unsigned long long * )( pudp ) , native_pud_val (pud ));
58
+ pxx_xchg64 ( pud , pudp , native_pud_val (pud ));
51
59
}
52
60
53
61
/*
@@ -91,13 +99,6 @@ static inline void pud_clear(pud_t *pudp)
91
99
}
92
100
93
101
94
- #define pxx_xchg64 (_pxx , _ptr , _val ) ({ \
95
- _pxx##val_t *_p = (_pxx##val_t *)_ptr; \
96
- _pxx##val_t _o = *_p; \
97
- do { } while (!try_cmpxchg64(_p, &_o, (_val))); \
98
- native_make_##_pxx(_o); \
99
- })
100
-
101
102
#ifdef CONFIG_SMP
102
103
static inline pte_t native_ptep_get_and_clear (pte_t * ptep )
103
104
{
0 commit comments