Rev 3838 | Rev 3857 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3838 | Rev 3839 | ||
---|---|---|---|
Line 154... | Line 154... | ||
154 | uint32_t hash = vsid ^ page; |
154 | uint32_t hash = vsid ^ page; |
155 | uint32_t base = (hash & 0x3ff) << 3; |
155 | uint32_t base = (hash & 0x3ff) << 3; |
156 | uint32_t i; |
156 | uint32_t i; |
157 | bool found = false; |
157 | bool found = false; |
158 | 158 | ||
159 | /* Find unused or colliding PTE in PTEG */ |
159 | /* Find colliding PTE in PTEG */ |
160 | for (i = 0; i < 8; i++) { |
160 | for (i = 0; i < 8; i++) { |
161 | if ((!phte[base + i].v) || |
161 | if ((phte[base + i].v) |
162 | ((phte[base + i].vsid == vsid) |
162 | && (phte[base + i].vsid == vsid) |
163 | && (phte[base + i].api == api) |
163 | && (phte[base + i].api == api) |
164 | && (phte[base + i].h == 0))) { |
164 | && (phte[base + i].h == 0)) { |
165 | found = true; |
165 | found = true; |
166 | break; |
166 | break; |
167 | } |
167 | } |
168 | } |
168 | } |
169 | 169 | ||
170 | if (!found) { |
170 | if (!found) { |
- | 171 | /* Find unused PTE in PTEG */ |
|
- | 172 | for (i = 0; i < 8; i++) { |
|
- | 173 | if (!phte[base + i].v) { |
|
- | 174 | found = true; |
|
- | 175 | break; |
|
- | 176 | } |
|
- | 177 | } |
|
- | 178 | } |
|
- | 179 | ||
- | 180 | if (!found) { |
|
171 | /* Secondary hash (not) */ |
181 | /* Secondary hash (not) */ |
172 | uint32_t base2 = (~hash & 0x3ff) << 3; |
182 | uint32_t base2 = (~hash & 0x3ff) << 3; |
173 | 183 | ||
174 | /* Find unused or colliding PTE in PTEG */ |
184 | /* Find colliding PTE in PTEG */ |
175 | for (i = 0; i < 8; i++) { |
185 | for (i = 0; i < 8; i++) { |
176 | if ((!phte[base2 + i].v) || |
186 | if ((phte[base2 + i].v) |
177 | ((phte[base2 + i].vsid == vsid) |
187 | && (phte[base2 + i].vsid == vsid) |
178 | && (phte[base2 + i].api == api) |
188 | && (phte[base2 + i].api == api) |
179 | && (phte[base2 + i].h == 1))) { |
189 | && (phte[base2 + i].h == 1)) { |
- | 190 | found = true; |
|
- | 191 | base = base2; |
|
- | 192 | h = 1; |
|
- | 193 | break; |
|
- | 194 | } |
|
- | 195 | } |
|
- | 196 | ||
- | 197 | if (!found) { |
|
- | 198 | /* Find unused PTE in PTEG */ |
|
- | 199 | for (i = 0; i < 8; i++) { |
|
- | 200 | if (!phte[base2 + i].v) { |
|
180 | found = true; |
201 | found = true; |
181 | base = base2; |
202 | base = base2; |
182 | h = 1; |
203 | h = 1; |
183 | break; |
204 | break; |
184 | } |
205 | } |
185 | } |
206 | } |
- | 207 | } |
|
186 | 208 | ||
187 | if (!found) |
209 | if (!found) |
188 | i = RANDI(seed) % 8; |
210 | i = RANDI(seed) % 8; |
189 | } |
211 | } |
190 | 212 | ||
Line 306... | Line 328... | ||
306 | uint32_t hash = vsid ^ page; |
328 | uint32_t hash = vsid ^ page; |
307 | uint32_t base = (hash & 0x3ff) << 3; |
329 | uint32_t base = (hash & 0x3ff) << 3; |
308 | uint32_t i; |
330 | uint32_t i; |
309 | bool found = false; |
331 | bool found = false; |
310 | 332 | ||
311 | /* Find unused or colliding PTE in PTEG */ |
333 | /* Find colliding PTE in PTEG */ |
312 | for (i = 0; i < 8; i++) { |
334 | for (i = 0; i < 8; i++) { |
313 | if ((!phte_real[base + i].v) || |
335 | if ((phte_real[base + i].v) |
314 | ((phte_real[base + i].vsid == vsid) |
336 | && (phte_real[base + i].vsid == vsid) |
315 | && (phte_real[base + i].api == api) |
337 | && (phte_real[base + i].api == api) |
316 | && (phte_real[base + i].h == 0))) { |
338 | && (phte_real[base + i].h == 0)) { |
317 | found = true; |
339 | found = true; |
318 | break; |
340 | break; |
319 | } |
341 | } |
320 | } |
342 | } |
321 | 343 | ||
322 | if (!found) { |
344 | if (!found) { |
- | 345 | /* Find unused PTE in PTEG */ |
|
- | 346 | for (i = 0; i < 8; i++) { |
|
- | 347 | if (!phte_real[base + i].v) { |
|
- | 348 | found = true; |
|
- | 349 | break; |
|
- | 350 | } |
|
- | 351 | } |
|
- | 352 | } |
|
- | 353 | ||
- | 354 | if (!found) { |
|
323 | /* Secondary hash (not) */ |
355 | /* Secondary hash (not) */ |
324 | uint32_t base2 = (~hash & 0x3ff) << 3; |
356 | uint32_t base2 = (~hash & 0x3ff) << 3; |
325 | 357 | ||
326 | /* Find unused or colliding PTE in PTEG */ |
358 | /* Find colliding PTE in PTEG */ |
327 | for (i = 0; i < 8; i++) { |
359 | for (i = 0; i < 8; i++) { |
328 | if ((!phte_real[base2 + i].v) || |
360 | if ((phte_real[base2 + i].v) |
329 | ((phte_real[base2 + i].vsid == vsid) |
361 | && (phte_real[base2 + i].vsid == vsid) |
330 | && (phte_real[base2 + i].api == api) |
362 | && (phte_real[base2 + i].api == api) |
331 | && (phte_real[base2 + i].h == 1))) { |
363 | && (phte_real[base2 + i].h == 1)) { |
- | 364 | found = true; |
|
- | 365 | base = base2; |
|
- | 366 | h = 1; |
|
- | 367 | break; |
|
- | 368 | } |
|
- | 369 | } |
|
- | 370 | ||
- | 371 | if (!found) { |
|
- | 372 | /* Find unused PTE in PTEG */ |
|
- | 373 | for (i = 0; i < 8; i++) { |
|
- | 374 | if (!phte_real[base2 + i].v) { |
|
332 | found = true; |
375 | found = true; |
333 | base = base2; |
376 | base = base2; |
334 | h = 1; |
377 | h = 1; |
335 | break; |
378 | break; |
336 | } |
379 | } |
337 | } |
380 | } |
- | 381 | } |
|
338 | 382 | ||
339 | if (!found) { |
383 | if (!found) { |
340 | /* Use secondary hash to avoid collisions |
384 | /* Use secondary hash to avoid collisions |
341 | with usual PHT refill handler. */ |
385 | with usual PHT refill handler. */ |
342 | i = RANDI(seed_real) % 8; |
386 | i = RANDI(seed_real) % 8; |