aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc64/kernel/iSeries_htab.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2005-07-13 04:11:42 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-07-13 14:25:25 -0400
commit96e2844999f99878fc5b03b81ccaa60580005b81 (patch)
tree353c1bc9a5602d556e6741f4a261010cde45e93b /arch/ppc64/kernel/iSeries_htab.c
parentf13487c66c75f5db004a0631047309d9e7c5aab7 (diff)
[PATCH] ppc64: kill bitfields in ppc64 hash code
This patch removes the use of bitfield types from the ppc64 hash table manipulation code. Signed-off-by: David Gibson <dwg@au1.ibm.com> Acked-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/ppc64/kernel/iSeries_htab.c')
-rw-r--r--arch/ppc64/kernel/iSeries_htab.c51
1 files changed, 21 insertions, 30 deletions
diff --git a/arch/ppc64/kernel/iSeries_htab.c b/arch/ppc64/kernel/iSeries_htab.c
index aa9e8fdd1a4..b0250ae4a72 100644
--- a/arch/ppc64/kernel/iSeries_htab.c
+++ b/arch/ppc64/kernel/iSeries_htab.c
@@ -38,11 +38,12 @@ static inline void iSeries_hunlock(unsigned long slot)
38} 38}
39 39
40static long iSeries_hpte_insert(unsigned long hpte_group, unsigned long va, 40static long iSeries_hpte_insert(unsigned long hpte_group, unsigned long va,
41 unsigned long prpn, int secondary, 41 unsigned long prpn, unsigned long vflags,
42 unsigned long hpteflags, int bolted, int large) 42 unsigned long rflags)
43{ 43{
44 long slot; 44 long slot;
45 HPTE lhpte; 45 hpte_t lhpte;
46 int secondary = 0;
46 47
47 /* 48 /*
48 * The hypervisor tries both primary and secondary. 49 * The hypervisor tries both primary and secondary.
@@ -50,13 +51,13 @@ static long iSeries_hpte_insert(unsigned long hpte_group, unsigned long va,
50 * it means we have already tried both primary and secondary, 51 * it means we have already tried both primary and secondary,
51 * so we return failure immediately. 52 * so we return failure immediately.
52 */ 53 */
53 if (secondary) 54 if (vflags & HPTE_V_SECONDARY)
54 return -1; 55 return -1;
55 56
56 iSeries_hlock(hpte_group); 57 iSeries_hlock(hpte_group);
57 58
58 slot = HvCallHpt_findValid(&lhpte, va >> PAGE_SHIFT); 59 slot = HvCallHpt_findValid(&lhpte, va >> PAGE_SHIFT);
59 BUG_ON(lhpte.dw0.dw0.v); 60 BUG_ON(lhpte.v & HPTE_V_VALID);
60 61
61 if (slot == -1) { /* No available entry found in either group */ 62 if (slot == -1) { /* No available entry found in either group */
62 iSeries_hunlock(hpte_group); 63 iSeries_hunlock(hpte_group);
@@ -64,19 +65,13 @@ static long iSeries_hpte_insert(unsigned long hpte_group, unsigned long va,
64 } 65 }
65 66
66 if (slot < 0) { /* MSB set means secondary group */ 67 if (slot < 0) { /* MSB set means secondary group */
68 vflags |= HPTE_V_VALID;
67 secondary = 1; 69 secondary = 1;
68 slot &= 0x7fffffffffffffff; 70 slot &= 0x7fffffffffffffff;
69 } 71 }
70 72
71 lhpte.dw1.dword1 = 0; 73 lhpte.v = (va >> 23) << HPTE_V_AVPN_SHIFT | vflags | HPTE_V_VALID;
72 lhpte.dw1.dw1.rpn = physRpn_to_absRpn(prpn); 74 lhpte.r = (physRpn_to_absRpn(prpn) << HPTE_R_RPN_SHIFT) | rflags;
73 lhpte.dw1.flags.flags = hpteflags;
74
75 lhpte.dw0.dword0 = 0;
76 lhpte.dw0.dw0.avpn = va >> 23;
77 lhpte.dw0.dw0.h = secondary;
78 lhpte.dw0.dw0.bolted = bolted;
79 lhpte.dw0.dw0.v = 1;
80 75
81 /* Now fill in the actual HPTE */ 76 /* Now fill in the actual HPTE */
82 HvCallHpt_addValidate(slot, secondary, &lhpte); 77 HvCallHpt_addValidate(slot, secondary, &lhpte);
@@ -88,20 +83,17 @@ static long iSeries_hpte_insert(unsigned long hpte_group, unsigned long va,
88 83
89static unsigned long iSeries_hpte_getword0(unsigned long slot) 84static unsigned long iSeries_hpte_getword0(unsigned long slot)
90{ 85{
91 unsigned long dword0; 86 hpte_t hpte;
92 HPTE hpte;
93 87
94 HvCallHpt_get(&hpte, slot); 88 HvCallHpt_get(&hpte, slot);
95 dword0 = hpte.dw0.dword0; 89 return hpte.v;
96
97 return dword0;
98} 90}
99 91
100static long iSeries_hpte_remove(unsigned long hpte_group) 92static long iSeries_hpte_remove(unsigned long hpte_group)
101{ 93{
102 unsigned long slot_offset; 94 unsigned long slot_offset;
103 int i; 95 int i;
104 HPTE lhpte; 96 unsigned long hpte_v;
105 97
106 /* Pick a random slot to start at */ 98 /* Pick a random slot to start at */
107 slot_offset = mftb() & 0x7; 99 slot_offset = mftb() & 0x7;
@@ -109,10 +101,9 @@ static long iSeries_hpte_remove(unsigned long hpte_group)
109 iSeries_hlock(hpte_group); 101 iSeries_hlock(hpte_group);
110 102
111 for (i = 0; i < HPTES_PER_GROUP; i++) { 103 for (i = 0; i < HPTES_PER_GROUP; i++) {
112 lhpte.dw0.dword0 = 104 hpte_v = iSeries_hpte_getword0(hpte_group + slot_offset);
113 iSeries_hpte_getword0(hpte_group + slot_offset);
114 105
115 if (!lhpte.dw0.dw0.bolted) { 106 if (! (hpte_v & HPTE_V_BOLTED)) {
116 HvCallHpt_invalidateSetSwBitsGet(hpte_group + 107 HvCallHpt_invalidateSetSwBitsGet(hpte_group +
117 slot_offset, 0, 0); 108 slot_offset, 0, 0);
118 iSeries_hunlock(hpte_group); 109 iSeries_hunlock(hpte_group);
@@ -137,13 +128,13 @@ static long iSeries_hpte_remove(unsigned long hpte_group)
137static long iSeries_hpte_updatepp(unsigned long slot, unsigned long newpp, 128static long iSeries_hpte_updatepp(unsigned long slot, unsigned long newpp,
138 unsigned long va, int large, int local) 129 unsigned long va, int large, int local)
139{ 130{
140 HPTE hpte; 131 hpte_t hpte;
141 unsigned long avpn = va >> 23; 132 unsigned long avpn = va >> 23;
142 133
143 iSeries_hlock(slot); 134 iSeries_hlock(slot);
144 135
145 HvCallHpt_get(&hpte, slot); 136 HvCallHpt_get(&hpte, slot);
146 if ((hpte.dw0.dw0.avpn == avpn) && (hpte.dw0.dw0.v)) { 137 if ((HPTE_V_AVPN_VAL(hpte.v) == avpn) && (hpte.v & HPTE_V_VALID)) {
147 /* 138 /*
148 * Hypervisor expects bits as NPPP, which is 139 * Hypervisor expects bits as NPPP, which is
149 * different from how they are mapped in our PP. 140 * different from how they are mapped in our PP.
@@ -167,7 +158,7 @@ static long iSeries_hpte_updatepp(unsigned long slot, unsigned long newpp,
167 */ 158 */
168static long iSeries_hpte_find(unsigned long vpn) 159static long iSeries_hpte_find(unsigned long vpn)
169{ 160{
170 HPTE hpte; 161 hpte_t hpte;
171 long slot; 162 long slot;
172 163
173 /* 164 /*
@@ -177,7 +168,7 @@ static long iSeries_hpte_find(unsigned long vpn)
177 * 0x80000000xxxxxxxx : Entry found in secondary group, slot x 168 * 0x80000000xxxxxxxx : Entry found in secondary group, slot x
178 */ 169 */
179 slot = HvCallHpt_findValid(&hpte, vpn); 170 slot = HvCallHpt_findValid(&hpte, vpn);
180 if (hpte.dw0.dw0.v) { 171 if (hpte.v & HPTE_V_VALID) {
181 if (slot < 0) { 172 if (slot < 0) {
182 slot &= 0x7fffffffffffffff; 173 slot &= 0x7fffffffffffffff;
183 slot = -slot; 174 slot = -slot;
@@ -212,7 +203,7 @@ static void iSeries_hpte_updateboltedpp(unsigned long newpp, unsigned long ea)
212static void iSeries_hpte_invalidate(unsigned long slot, unsigned long va, 203static void iSeries_hpte_invalidate(unsigned long slot, unsigned long va,
213 int large, int local) 204 int large, int local)
214{ 205{
215 HPTE lhpte; 206 unsigned long hpte_v;
216 unsigned long avpn = va >> 23; 207 unsigned long avpn = va >> 23;
217 unsigned long flags; 208 unsigned long flags;
218 209
@@ -220,9 +211,9 @@ static void iSeries_hpte_invalidate(unsigned long slot, unsigned long va,
220 211
221 iSeries_hlock(slot); 212 iSeries_hlock(slot);
222 213
223 lhpte.dw0.dword0 = iSeries_hpte_getword0(slot); 214 hpte_v = iSeries_hpte_getword0(slot);
224 215
225 if ((lhpte.dw0.dw0.avpn == avpn) && lhpte.dw0.dw0.v) 216 if ((HPTE_V_AVPN_VAL(hpte_v) == avpn) && (hpte_v & HPTE_V_VALID))
226 HvCallHpt_invalidateSetSwBitsGet(slot, 0, 0); 217 HvCallHpt_invalidateSetSwBitsGet(slot, 0, 0);
227 218
228 iSeries_hunlock(slot); 219 iSeries_hunlock(slot);