aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/head_8xx.S
diff options
context:
space:
mode:
authorLEROY Christophe <christophe.leroy@c-s.fr>2015-04-22 06:06:43 -0400
committerScott Wood <scottwood@freescale.com>2015-06-02 22:37:27 -0400
commite0a8e0d90a9f0be66ba49f4f2380a63c22d4aaae (patch)
tree37325c92ff16f33b2d38792cb03d4f106a0a2e0c /arch/powerpc/kernel/head_8xx.S
parent83b086c5697169f1e34d2430dad062cc714c5c57 (diff)
powerpc/8xx: Handle PAGE_USER via APG bits
Use of APG for handling PAGE_USER. All pages PP exec bits are set to either 000 or 011, which means respectively RW for Supervisor and no access for User, or RO for Supervisor and no access for user. Then we use the APG to say whether accesses are according to Page rules or "all Supervisor" rules (Access to all) Therefore, we define 2 APG groups corresponding to _PAGE_USER. Mx_AP are initialised as follows: GP0 => No user => 01 (all accesses performed according to page definition) GP1 => User => 00 (all accesses performed as supervisor according to page definition) This removes the special 8xx handling in pte_update() Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> Signed-off-by: Scott Wood <scottwood@freescale.com>
Diffstat (limited to 'arch/powerpc/kernel/head_8xx.S')
-rw-r--r--arch/powerpc/kernel/head_8xx.S21
1 files changed, 12 insertions, 9 deletions
diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S
index c640bbb042b5..c79184d86f58 100644
--- a/arch/powerpc/kernel/head_8xx.S
+++ b/arch/powerpc/kernel/head_8xx.S
@@ -351,12 +351,15 @@ InstructionTLBMiss:
351 rlwimi r11, r10, 32 - ((PAGE_SHIFT - 2) << 1), (PAGE_SHIFT - 2) << 1, 29 351 rlwimi r11, r10, 32 - ((PAGE_SHIFT - 2) << 1), (PAGE_SHIFT - 2) << 1, 29
352 lwz r11, (swapper_pg_dir-PAGE_OFFSET)@l(r11) /* Get the level 1 entry */ 352 lwz r11, (swapper_pg_dir-PAGE_OFFSET)@l(r11) /* Get the level 1 entry */
353 353
354 /* Load the MI_TWC with the attributes for this "segment." */
355 MTSPR_CPU6(SPRN_MI_TWC, r11, r3) /* Set segment attributes */
356 rlwinm r11, r11,0,0,19 /* Extract page descriptor page address */
357 /* Extract level 2 index */ 354 /* Extract level 2 index */
358 rlwinm r10, r10, 32 - (PAGE_SHIFT - 2), 32 - PAGE_SHIFT, 29 355 rlwinm r10, r10, 32 - (PAGE_SHIFT - 2), 32 - PAGE_SHIFT, 29
359 lwzx r10, r10, r11 /* Get the pte */ 356 rlwimi r10, r11, 0, 0, 32 - PAGE_SHIFT - 1 /* Add level 2 base */
357 lwz r10, 0(r10) /* Get the pte */
358
359 /* Insert the APG into the TWC from the Linux PTE. */
360 rlwimi r11, r10, 0, 26, 26
361 /* Load the MI_TWC with the attributes for this "segment." */
362 MTSPR_CPU6(SPRN_MI_TWC, r11, r3) /* Set segment attributes */
360 363
361#ifdef CONFIG_SWAP 364#ifdef CONFIG_SWAP
362 rlwinm r11, r10, 32-5, _PAGE_PRESENT 365 rlwinm r11, r10, 32-5, _PAGE_PRESENT
@@ -365,12 +368,12 @@ InstructionTLBMiss:
365#endif 368#endif
366 li r11, RPN_PATTERN 369 li r11, RPN_PATTERN
367 /* The Linux PTE won't go exactly into the MMU TLB. 370 /* The Linux PTE won't go exactly into the MMU TLB.
368 * Software indicator bits 21 and 28 must be clear. 371 * Software indicator bits 20-23 and 28 must be clear.
369 * Software indicator bits 24, 25, 26, and 27 must be 372 * Software indicator bits 24, 25, 26, and 27 must be
370 * set. All other Linux PTE bits control the behavior 373 * set. All other Linux PTE bits control the behavior
371 * of the MMU. 374 * of the MMU.
372 */ 375 */
373 rlwimi r10, r11, 0, 0x07f8 /* Set 24-27, clear 21-23,28 */ 376 rlwimi r10, r11, 0, 0x0ff8 /* Set 24-27, clear 20-23,28 */
374 MTSPR_CPU6(SPRN_MI_RPN, r10, r3) /* Update TLB entry */ 377 MTSPR_CPU6(SPRN_MI_RPN, r10, r3) /* Update TLB entry */
375 378
376 /* Restore registers */ 379 /* Restore registers */
@@ -411,13 +414,13 @@ DataStoreTLBMiss:
411 rlwimi r10, r11, 0, 0, 32 - PAGE_SHIFT - 1 /* Add level 2 base */ 414 rlwimi r10, r11, 0, 0, 32 - PAGE_SHIFT - 1 /* Add level 2 base */
412 lwz r10, 0(r10) /* Get the pte */ 415 lwz r10, 0(r10) /* Get the pte */
413 416
414 /* Insert the Guarded flag into the TWC from the Linux PTE. 417 /* Insert the Guarded flag and APG into the TWC from the Linux PTE.
415 * It is bit 27 of both the Linux PTE and the TWC (at least 418 * It is bit 26-27 of both the Linux PTE and the TWC (at least
416 * I got that right :-). It will be better when we can put 419 * I got that right :-). It will be better when we can put
417 * this into the Linux pgd/pmd and load it in the operation 420 * this into the Linux pgd/pmd and load it in the operation
418 * above. 421 * above.
419 */ 422 */
420 rlwimi r11, r10, 0, 27, 27 423 rlwimi r11, r10, 0, 26, 27
421 /* Insert the WriteThru flag into the TWC from the Linux PTE. 424 /* Insert the WriteThru flag into the TWC from the Linux PTE.
422 * It is bit 25 in the Linux PTE and bit 30 in the TWC 425 * It is bit 25 in the Linux PTE and bit 30 in the TWC
423 */ 426 */