diff options
-rw-r--r-- | arch/ppc/Kconfig | 16 | ||||
-rw-r--r-- | arch/ppc/kernel/head_fsl_booke.S | 113 | ||||
-rw-r--r-- | arch/ppc/syslib/ppc85xx_common.c | 8 | ||||
-rw-r--r-- | include/asm-ppc/cputable.h | 3 | ||||
-rw-r--r-- | include/asm-ppc/pgtable.h | 45 | ||||
-rw-r--r-- | include/asm-ppc/reg_booke.h | 1 |
6 files changed, 123 insertions, 63 deletions
diff --git a/arch/ppc/Kconfig b/arch/ppc/Kconfig index 813c6c9a6d99..74aa1e92a395 100644 --- a/arch/ppc/Kconfig +++ b/arch/ppc/Kconfig | |||
@@ -98,13 +98,19 @@ config FSL_BOOKE | |||
98 | 98 | ||
99 | config PTE_64BIT | 99 | config PTE_64BIT |
100 | bool | 100 | bool |
101 | depends on 44x | 101 | depends on 44x || E500 |
102 | default y | 102 | default y if 44x |
103 | default y if E500 && PHYS_64BIT | ||
103 | 104 | ||
104 | config PHYS_64BIT | 105 | config PHYS_64BIT |
105 | bool | 106 | bool 'Large physical address support' if E500 |
106 | depends on 44x | 107 | depends on 44x || E500 |
107 | default y | 108 | default y if 44x |
109 | ---help--- | ||
110 | This option enables kernel support for larger than 32-bit physical | ||
111 | addresses. This features is not be available on all e500 cores. | ||
112 | |||
113 | If in doubt, say N here. | ||
108 | 114 | ||
109 | config ALTIVEC | 115 | config ALTIVEC |
110 | bool "AltiVec Support" | 116 | bool "AltiVec Support" |
diff --git a/arch/ppc/kernel/head_fsl_booke.S b/arch/ppc/kernel/head_fsl_booke.S index dea19c216fc3..d64bf61d2b1f 100644 --- a/arch/ppc/kernel/head_fsl_booke.S +++ b/arch/ppc/kernel/head_fsl_booke.S | |||
@@ -347,6 +347,38 @@ skpinv: addi r6,r6,1 /* Increment */ | |||
347 | mtspr SPRN_SRR1,r3 | 347 | mtspr SPRN_SRR1,r3 |
348 | rfi /* change context and jump to start_kernel */ | 348 | rfi /* change context and jump to start_kernel */ |
349 | 349 | ||
350 | /* Macros to hide the PTE size differences | ||
351 | * | ||
352 | * FIND_PTE -- walks the page tables given EA & pgdir pointer | ||
353 | * r10 -- EA of fault | ||
354 | * r11 -- PGDIR pointer | ||
355 | * r12 -- free | ||
356 | * label 2: is the bailout case | ||
357 | * | ||
358 | * if we find the pte (fall through): | ||
359 | * r11 is low pte word | ||
360 | * r12 is pointer to the pte | ||
361 | */ | ||
362 | #ifdef CONFIG_PTE_64BIT | ||
363 | #define PTE_FLAGS_OFFSET 4 | ||
364 | #define FIND_PTE \ | ||
365 | rlwinm r12, r10, 13, 19, 29; /* Compute pgdir/pmd offset */ \ | ||
366 | lwzx r11, r12, r11; /* Get pgd/pmd entry */ \ | ||
367 | rlwinm. r12, r11, 0, 0, 20; /* Extract pt base address */ \ | ||
368 | beq 2f; /* Bail if no table */ \ | ||
369 | rlwimi r12, r10, 23, 20, 28; /* Compute pte address */ \ | ||
370 | lwz r11, 4(r12); /* Get pte entry */ | ||
371 | #else | ||
372 | #define PTE_FLAGS_OFFSET 0 | ||
373 | #define FIND_PTE \ | ||
374 | rlwimi r11, r10, 12, 20, 29; /* Create L1 (pgdir/pmd) address */ \ | ||
375 | lwz r11, 0(r11); /* Get L1 entry */ \ | ||
376 | rlwinm. r12, r11, 0, 0, 19; /* Extract L2 (pte) base address */ \ | ||
377 | beq 2f; /* Bail if no table */ \ | ||
378 | rlwimi r12, r10, 22, 20, 29; /* Compute PTE address */ \ | ||
379 | lwz r11, 0(r12); /* Get Linux PTE */ | ||
380 | #endif | ||
381 | |||
350 | /* | 382 | /* |
351 | * Interrupt vector entry code | 383 | * Interrupt vector entry code |
352 | * | 384 | * |
@@ -405,13 +437,7 @@ interrupt_base: | |||
405 | mfspr r11,SPRN_SPRG3 | 437 | mfspr r11,SPRN_SPRG3 |
406 | lwz r11,PGDIR(r11) | 438 | lwz r11,PGDIR(r11) |
407 | 4: | 439 | 4: |
408 | rlwimi r11, r10, 12, 20, 29 /* Create L1 (pgdir/pmd) address */ | 440 | FIND_PTE |
409 | lwz r11, 0(r11) /* Get L1 entry */ | ||
410 | rlwinm. r12, r11, 0, 0, 19 /* Extract L2 (pte) base address */ | ||
411 | beq 2f /* Bail if no table */ | ||
412 | |||
413 | rlwimi r12, r10, 22, 20, 29 /* Compute PTE address */ | ||
414 | lwz r11, 0(r12) /* Get Linux PTE */ | ||
415 | 441 | ||
416 | /* Are _PAGE_USER & _PAGE_RW set & _PAGE_HWWRITE not? */ | 442 | /* Are _PAGE_USER & _PAGE_RW set & _PAGE_HWWRITE not? */ |
417 | andi. r13, r11, _PAGE_RW|_PAGE_USER|_PAGE_HWWRITE | 443 | andi. r13, r11, _PAGE_RW|_PAGE_USER|_PAGE_HWWRITE |
@@ -420,14 +446,12 @@ interrupt_base: | |||
420 | 446 | ||
421 | /* Update 'changed'. */ | 447 | /* Update 'changed'. */ |
422 | ori r11, r11, _PAGE_DIRTY|_PAGE_ACCESSED|_PAGE_HWWRITE | 448 | ori r11, r11, _PAGE_DIRTY|_PAGE_ACCESSED|_PAGE_HWWRITE |
423 | stw r11, 0(r12) /* Update Linux page table */ | 449 | stw r11, PTE_FLAGS_OFFSET(r12) /* Update Linux page table */ |
424 | 450 | ||
425 | /* MAS2 not updated as the entry does exist in the tlb, this | 451 | /* MAS2 not updated as the entry does exist in the tlb, this |
426 | fault taken to detect state transition (eg: COW -> DIRTY) | 452 | fault taken to detect state transition (eg: COW -> DIRTY) |
427 | */ | 453 | */ |
428 | lis r12, MAS3_RPN@h | 454 | andi. r11, r11, _PAGE_HWEXEC |
429 | ori r12, r12, _PAGE_HWEXEC | MAS3_RPN@l | ||
430 | and r11, r11, r12 | ||
431 | rlwimi r11, r11, 31, 27, 27 /* SX <- _PAGE_HWEXEC */ | 455 | rlwimi r11, r11, 31, 27, 27 /* SX <- _PAGE_HWEXEC */ |
432 | ori r11, r11, (MAS3_UW|MAS3_SW|MAS3_UR|MAS3_SR)@l /* set static perms */ | 456 | ori r11, r11, (MAS3_UW|MAS3_SW|MAS3_UR|MAS3_SR)@l /* set static perms */ |
433 | 457 | ||
@@ -439,7 +463,10 @@ interrupt_base: | |||
439 | /* find the TLB index that caused the fault. It has to be here. */ | 463 | /* find the TLB index that caused the fault. It has to be here. */ |
440 | tlbsx 0, r10 | 464 | tlbsx 0, r10 |
441 | 465 | ||
442 | mtspr SPRN_MAS3,r11 | 466 | /* only update the perm bits, assume the RPN is fine */ |
467 | mfspr r12, SPRN_MAS3 | ||
468 | rlwimi r12, r11, 0, 20, 31 | ||
469 | mtspr SPRN_MAS3,r12 | ||
443 | tlbwe | 470 | tlbwe |
444 | 471 | ||
445 | /* Done...restore registers and get out of here. */ | 472 | /* Done...restore registers and get out of here. */ |
@@ -530,18 +557,15 @@ interrupt_base: | |||
530 | lwz r11,PGDIR(r11) | 557 | lwz r11,PGDIR(r11) |
531 | 558 | ||
532 | 4: | 559 | 4: |
533 | rlwimi r11, r10, 12, 20, 29 /* Create L1 (pgdir/pmd) address */ | 560 | FIND_PTE |
534 | lwz r11, 0(r11) /* Get L1 entry */ | 561 | andi. r13, r11, _PAGE_PRESENT /* Is the page present? */ |
535 | rlwinm. r12, r11, 0, 0, 19 /* Extract L2 (pte) base address */ | 562 | beq 2f /* Bail if not present */ |
536 | beq 2f /* Bail if no table */ | ||
537 | |||
538 | rlwimi r12, r10, 22, 20, 29 /* Compute PTE address */ | ||
539 | lwz r11, 0(r12) /* Get Linux PTE */ | ||
540 | andi. r13, r11, _PAGE_PRESENT | ||
541 | beq 2f | ||
542 | 563 | ||
564 | #ifdef CONFIG_PTE_64BIT | ||
565 | lwz r13, 0(r12) | ||
566 | #endif | ||
543 | ori r11, r11, _PAGE_ACCESSED | 567 | ori r11, r11, _PAGE_ACCESSED |
544 | stw r11, 0(r12) | 568 | stw r11, PTE_FLAGS_OFFSET(r12) |
545 | 569 | ||
546 | /* Jump to common tlb load */ | 570 | /* Jump to common tlb load */ |
547 | b finish_tlb_load | 571 | b finish_tlb_load |
@@ -594,18 +618,15 @@ interrupt_base: | |||
594 | lwz r11,PGDIR(r11) | 618 | lwz r11,PGDIR(r11) |
595 | 619 | ||
596 | 4: | 620 | 4: |
597 | rlwimi r11, r10, 12, 20, 29 /* Create L1 (pgdir/pmd) address */ | 621 | FIND_PTE |
598 | lwz r11, 0(r11) /* Get L1 entry */ | 622 | andi. r13, r11, _PAGE_PRESENT /* Is the page present? */ |
599 | rlwinm. r12, r11, 0, 0, 19 /* Extract L2 (pte) base address */ | 623 | beq 2f /* Bail if not present */ |
600 | beq 2f /* Bail if no table */ | ||
601 | |||
602 | rlwimi r12, r10, 22, 20, 29 /* Compute PTE address */ | ||
603 | lwz r11, 0(r12) /* Get Linux PTE */ | ||
604 | andi. r13, r11, _PAGE_PRESENT | ||
605 | beq 2f | ||
606 | 624 | ||
625 | #ifdef CONFIG_PTE_64BIT | ||
626 | lwz r13, 0(r12) | ||
627 | #endif | ||
607 | ori r11, r11, _PAGE_ACCESSED | 628 | ori r11, r11, _PAGE_ACCESSED |
608 | stw r11, 0(r12) | 629 | stw r11, PTE_FLAGS_OFFSET(r12) |
609 | 630 | ||
610 | /* Jump to common TLB load point */ | 631 | /* Jump to common TLB load point */ |
611 | b finish_tlb_load | 632 | b finish_tlb_load |
@@ -690,27 +711,39 @@ finish_tlb_load: | |||
690 | */ | 711 | */ |
691 | 712 | ||
692 | mfspr r12, SPRN_MAS2 | 713 | mfspr r12, SPRN_MAS2 |
714 | #ifdef CONFIG_PTE_64BIT | ||
715 | rlwimi r12, r11, 26, 24, 31 /* extract ...WIMGE from pte */ | ||
716 | #else | ||
693 | rlwimi r12, r11, 26, 27, 31 /* extract WIMGE from pte */ | 717 | rlwimi r12, r11, 26, 27, 31 /* extract WIMGE from pte */ |
718 | #endif | ||
694 | mtspr SPRN_MAS2, r12 | 719 | mtspr SPRN_MAS2, r12 |
695 | 720 | ||
696 | bge 5, 1f | 721 | bge 5, 1f |
697 | 722 | ||
698 | /* addr > TASK_SIZE */ | 723 | /* is user addr */ |
699 | li r10, (MAS3_UX | MAS3_UW | MAS3_UR) | 724 | andi. r12, r11, (_PAGE_USER | _PAGE_HWWRITE | _PAGE_HWEXEC) |
700 | andi. r13, r11, (_PAGE_USER | _PAGE_HWWRITE | _PAGE_HWEXEC) | 725 | andi. r10, r11, _PAGE_USER /* Test for _PAGE_USER */ |
701 | andi. r12, r11, _PAGE_USER /* Test for _PAGE_USER */ | 726 | srwi r10, r12, 1 |
702 | iseleq r12, 0, r10 | ||
703 | and r10, r12, r13 | ||
704 | srwi r12, r10, 1 | ||
705 | or r12, r12, r10 /* Copy user perms into supervisor */ | 727 | or r12, r12, r10 /* Copy user perms into supervisor */ |
728 | iseleq r12, 0, r12 | ||
706 | b 2f | 729 | b 2f |
707 | 730 | ||
708 | /* addr <= TASK_SIZE */ | 731 | /* is kernel addr */ |
709 | 1: rlwinm r12, r11, 31, 29, 29 /* Extract _PAGE_HWWRITE into SW */ | 732 | 1: rlwinm r12, r11, 31, 29, 29 /* Extract _PAGE_HWWRITE into SW */ |
710 | ori r12, r12, (MAS3_SX | MAS3_SR) | 733 | ori r12, r12, (MAS3_SX | MAS3_SR) |
711 | 734 | ||
735 | #ifdef CONFIG_PTE_64BIT | ||
736 | 2: rlwimi r12, r13, 24, 0, 7 /* grab RPN[32:39] */ | ||
737 | rlwimi r12, r11, 24, 8, 19 /* grab RPN[40:51] */ | ||
738 | mtspr SPRN_MAS3, r12 | ||
739 | BEGIN_FTR_SECTION | ||
740 | srwi r10, r13, 8 /* grab RPN[8:31] */ | ||
741 | mtspr SPRN_MAS7, r10 | ||
742 | END_FTR_SECTION_IFSET(CPU_FTR_BIG_PHYS) | ||
743 | #else | ||
712 | 2: rlwimi r11, r12, 0, 20, 31 /* Extract RPN from PTE and merge with perms */ | 744 | 2: rlwimi r11, r12, 0, 20, 31 /* Extract RPN from PTE and merge with perms */ |
713 | mtspr SPRN_MAS3, r11 | 745 | mtspr SPRN_MAS3, r11 |
746 | #endif | ||
714 | tlbwe | 747 | tlbwe |
715 | 748 | ||
716 | /* Done...restore registers and get out of here. */ | 749 | /* Done...restore registers and get out of here. */ |
diff --git a/arch/ppc/syslib/ppc85xx_common.c b/arch/ppc/syslib/ppc85xx_common.c index e83f2f8686d3..da841dacdc13 100644 --- a/arch/ppc/syslib/ppc85xx_common.c +++ b/arch/ppc/syslib/ppc85xx_common.c | |||
@@ -31,3 +31,11 @@ get_ccsrbar(void) | |||
31 | } | 31 | } |
32 | 32 | ||
33 | EXPORT_SYMBOL(get_ccsrbar); | 33 | EXPORT_SYMBOL(get_ccsrbar); |
34 | |||
35 | /* For now this is a pass through */ | ||
36 | phys_addr_t fixup_bigphys_addr(phys_addr_t addr, phys_addr_t size) | ||
37 | { | ||
38 | return addr; | ||
39 | }; | ||
40 | EXPORT_SYMBOL(fixup_bigphys_addr); | ||
41 | |||
diff --git a/include/asm-ppc/cputable.h b/include/asm-ppc/cputable.h index 22de04fe1b4c..41d8f8425c04 100644 --- a/include/asm-ppc/cputable.h +++ b/include/asm-ppc/cputable.h | |||
@@ -86,8 +86,9 @@ static inline unsigned int cpu_has_feature(unsigned int feature) | |||
86 | #define CPU_FTR_DUAL_PLL_750FX 0x00004000 | 86 | #define CPU_FTR_DUAL_PLL_750FX 0x00004000 |
87 | #define CPU_FTR_NO_DPM 0x00008000 | 87 | #define CPU_FTR_NO_DPM 0x00008000 |
88 | #define CPU_FTR_HAS_HIGH_BATS 0x00010000 | 88 | #define CPU_FTR_HAS_HIGH_BATS 0x00010000 |
89 | #define CPU_FTR_NEED_COHERENT 0x00020000 | 89 | #define CPU_FTR_NEED_COHERENT 0x00020000 |
90 | #define CPU_FTR_NO_BTIC 0x00040000 | 90 | #define CPU_FTR_NO_BTIC 0x00040000 |
91 | #define CPU_FTR_BIG_PHYS 0x00080000 | ||
91 | 92 | ||
92 | #ifdef __ASSEMBLY__ | 93 | #ifdef __ASSEMBLY__ |
93 | 94 | ||
diff --git a/include/asm-ppc/pgtable.h b/include/asm-ppc/pgtable.h index e135b4aba9fc..a67bd512b2c8 100644 --- a/include/asm-ppc/pgtable.h +++ b/include/asm-ppc/pgtable.h | |||
@@ -225,8 +225,7 @@ extern unsigned long ioremap_bot, ioremap_base; | |||
225 | /* ERPN in a PTE never gets cleared, ignore it */ | 225 | /* ERPN in a PTE never gets cleared, ignore it */ |
226 | #define _PTE_NONE_MASK 0xffffffff00000000ULL | 226 | #define _PTE_NONE_MASK 0xffffffff00000000ULL |
227 | 227 | ||
228 | #elif defined(CONFIG_E500) | 228 | #elif defined(CONFIG_FSL_BOOKE) |
229 | |||
230 | /* | 229 | /* |
231 | MMU Assist Register 3: | 230 | MMU Assist Register 3: |
232 | 231 | ||
@@ -240,21 +239,29 @@ extern unsigned long ioremap_bot, ioremap_base; | |||
240 | entries use the top 29 bits. | 239 | entries use the top 29 bits. |
241 | */ | 240 | */ |
242 | 241 | ||
243 | /* Definitions for e500 core */ | 242 | /* Definitions for FSL Book-E Cores */ |
244 | #define _PAGE_PRESENT 0x001 /* S: PTE contains a translation */ | 243 | #define _PAGE_PRESENT 0x00001 /* S: PTE contains a translation */ |
245 | #define _PAGE_USER 0x002 /* S: User page (maps to UR) */ | 244 | #define _PAGE_USER 0x00002 /* S: User page (maps to UR) */ |
246 | #define _PAGE_FILE 0x002 /* S: when !present: nonlinear file mapping */ | 245 | #define _PAGE_FILE 0x00002 /* S: when !present: nonlinear file mapping */ |
247 | #define _PAGE_ACCESSED 0x004 /* S: Page referenced */ | 246 | #define _PAGE_ACCESSED 0x00004 /* S: Page referenced */ |
248 | #define _PAGE_HWWRITE 0x008 /* H: Dirty & RW, set in exception */ | 247 | #define _PAGE_HWWRITE 0x00008 /* H: Dirty & RW, set in exception */ |
249 | #define _PAGE_RW 0x010 /* S: Write permission */ | 248 | #define _PAGE_RW 0x00010 /* S: Write permission */ |
250 | #define _PAGE_HWEXEC 0x020 /* H: UX permission */ | 249 | #define _PAGE_HWEXEC 0x00020 /* H: UX permission */ |
251 | 250 | ||
252 | #define _PAGE_ENDIAN 0x040 /* H: E bit */ | 251 | #define _PAGE_ENDIAN 0x00040 /* H: E bit */ |
253 | #define _PAGE_GUARDED 0x080 /* H: G bit */ | 252 | #define _PAGE_GUARDED 0x00080 /* H: G bit */ |
254 | #define _PAGE_COHERENT 0x100 /* H: M bit */ | 253 | #define _PAGE_COHERENT 0x00100 /* H: M bit */ |
255 | #define _PAGE_NO_CACHE 0x200 /* H: I bit */ | 254 | #define _PAGE_NO_CACHE 0x00200 /* H: I bit */ |
256 | #define _PAGE_WRITETHRU 0x400 /* H: W bit */ | 255 | #define _PAGE_WRITETHRU 0x00400 /* H: W bit */ |
257 | #define _PAGE_DIRTY 0x800 /* S: Page dirty */ | 256 | |
257 | #ifdef CONFIG_PTE_64BIT | ||
258 | #define _PAGE_DIRTY 0x08000 /* S: Page dirty */ | ||
259 | |||
260 | /* ERPN in a PTE never gets cleared, ignore it */ | ||
261 | #define _PTE_NONE_MASK 0xffffffffffff0000ULL | ||
262 | #else | ||
263 | #define _PAGE_DIRTY 0x00800 /* S: Page dirty */ | ||
264 | #endif | ||
258 | 265 | ||
259 | #define _PMD_PRESENT 0 | 266 | #define _PMD_PRESENT 0 |
260 | #define _PMD_PRESENT_MASK (PAGE_MASK) | 267 | #define _PMD_PRESENT_MASK (PAGE_MASK) |
@@ -433,7 +440,11 @@ extern unsigned long bad_call_to_PMD_PAGE_SIZE(void); | |||
433 | 440 | ||
434 | /* in some case we want to additionaly adjust where the pfn is in the pte to | 441 | /* in some case we want to additionaly adjust where the pfn is in the pte to |
435 | * allow room for more flags */ | 442 | * allow room for more flags */ |
443 | #if defined(CONFIG_FSL_BOOKE) && defined(CONFIG_PTE_64BIT) | ||
444 | #define PFN_SHIFT_OFFSET (PAGE_SHIFT + 8) | ||
445 | #else | ||
436 | #define PFN_SHIFT_OFFSET (PAGE_SHIFT) | 446 | #define PFN_SHIFT_OFFSET (PAGE_SHIFT) |
447 | #endif | ||
437 | 448 | ||
438 | #define pte_pfn(x) (pte_val(x) >> PFN_SHIFT_OFFSET) | 449 | #define pte_pfn(x) (pte_val(x) >> PFN_SHIFT_OFFSET) |
439 | #define pte_page(x) pfn_to_page(pte_pfn(x)) | 450 | #define pte_page(x) pfn_to_page(pte_pfn(x)) |
diff --git a/include/asm-ppc/reg_booke.h b/include/asm-ppc/reg_booke.h index 4b03f8e26b72..e70c25f3c339 100644 --- a/include/asm-ppc/reg_booke.h +++ b/include/asm-ppc/reg_booke.h | |||
@@ -172,6 +172,7 @@ do { \ | |||
172 | #define SPRN_MAS4 0x274 /* MMU Assist Register 4 */ | 172 | #define SPRN_MAS4 0x274 /* MMU Assist Register 4 */ |
173 | #define SPRN_MAS5 0x275 /* MMU Assist Register 5 */ | 173 | #define SPRN_MAS5 0x275 /* MMU Assist Register 5 */ |
174 | #define SPRN_MAS6 0x276 /* MMU Assist Register 6 */ | 174 | #define SPRN_MAS6 0x276 /* MMU Assist Register 6 */ |
175 | #define SPRN_MAS7 0x3b0 /* MMU Assist Register 7 */ | ||
175 | #define SPRN_PID1 0x279 /* Process ID Register 1 */ | 176 | #define SPRN_PID1 0x279 /* Process ID Register 1 */ |
176 | #define SPRN_PID2 0x27A /* Process ID Register 2 */ | 177 | #define SPRN_PID2 0x27A /* Process ID Register 2 */ |
177 | #define SPRN_TLB0CFG 0x2B0 /* TLB 0 Config Register */ | 178 | #define SPRN_TLB0CFG 0x2B0 /* TLB 0 Config Register */ |