aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2012-09-18 02:04:33 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2012-09-18 02:04:33 -0400
commitcaa1d631fc99940f866480c2bb88a6f5a235e7a2 (patch)
treed09d648dbccaa7bf23deb336e8cf52acbc360b8d /arch/powerpc/kernel
parent1e38b7140185e384da216aff66a711df09b5afc9 (diff)
parent905e75c46dba5f3061049277e4eb7110beedba43 (diff)
Merge remote-tracking branch 'kumar/next' into next
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r--arch/powerpc/kernel/cpu_setup_fsl_booke.S74
-rw-r--r--arch/powerpc/kernel/cputable.c4
-rw-r--r--arch/powerpc/kernel/dma-swiotlb.c20
-rw-r--r--arch/powerpc/kernel/exceptions-64e.S18
-rw-r--r--arch/powerpc/kernel/head_fsl_booke.S46
-rw-r--r--arch/powerpc/kernel/smp.c12
6 files changed, 134 insertions, 40 deletions
diff --git a/arch/powerpc/kernel/cpu_setup_fsl_booke.S b/arch/powerpc/kernel/cpu_setup_fsl_booke.S
index 69fdd2322a66..dcd881937f7a 100644
--- a/arch/powerpc/kernel/cpu_setup_fsl_booke.S
+++ b/arch/powerpc/kernel/cpu_setup_fsl_booke.S
@@ -16,6 +16,8 @@
16#include <asm/processor.h> 16#include <asm/processor.h>
17#include <asm/cputable.h> 17#include <asm/cputable.h>
18#include <asm/ppc_asm.h> 18#include <asm/ppc_asm.h>
19#include <asm/mmu-book3e.h>
20#include <asm/asm-offsets.h>
19 21
20_GLOBAL(__e500_icache_setup) 22_GLOBAL(__e500_icache_setup)
21 mfspr r0, SPRN_L1CSR1 23 mfspr r0, SPRN_L1CSR1
@@ -73,27 +75,81 @@ _GLOBAL(__setup_cpu_e500v2)
73 mtlr r4 75 mtlr r4
74 blr 76 blr
75_GLOBAL(__setup_cpu_e500mc) 77_GLOBAL(__setup_cpu_e500mc)
76 mr r5, r4 78_GLOBAL(__setup_cpu_e5500)
77 mflr r4 79 mflr r5
78 bl __e500_icache_setup 80 bl __e500_icache_setup
79 bl __e500_dcache_setup 81 bl __e500_dcache_setup
80 bl __setup_e500mc_ivors 82 bl __setup_e500mc_ivors
81 mtlr r4 83 /*
84 * We only want to touch IVOR38-41 if we're running on hardware
85 * that supports category E.HV. The architectural way to determine
86 * this is MMUCFG[LPIDSIZE].
87 */
88 mfspr r3, SPRN_MMUCFG
89 rlwinm. r3, r3, 0, MMUCFG_LPIDSIZE
90 beq 1f
91 bl __setup_ehv_ivors
92 b 2f
931:
94 lwz r3, CPU_SPEC_FEATURES(r4)
95 /* We need this check as cpu_setup is also called for
96 * the secondary cores. So, if we have already cleared
97 * the feature on the primary core, avoid doing it on the
98 * secondary core.
99 */
100 andis. r6, r3, CPU_FTR_EMB_HV@h
101 beq 2f
102 rlwinm r3, r3, 0, ~CPU_FTR_EMB_HV
103 stw r3, CPU_SPEC_FEATURES(r4)
1042:
105 mtlr r5
82 blr 106 blr
83#endif 107#endif
84/* Right now, restore and setup are the same thing */ 108
109#ifdef CONFIG_PPC_BOOK3E_64
85_GLOBAL(__restore_cpu_e5500) 110_GLOBAL(__restore_cpu_e5500)
86_GLOBAL(__setup_cpu_e5500)
87 mflr r4 111 mflr r4
88 bl __e500_icache_setup 112 bl __e500_icache_setup
89 bl __e500_dcache_setup 113 bl __e500_dcache_setup
90#ifdef CONFIG_PPC_BOOK3E_64
91 bl .__setup_base_ivors 114 bl .__setup_base_ivors
92 bl .setup_perfmon_ivor 115 bl .setup_perfmon_ivor
93 bl .setup_doorbell_ivors 116 bl .setup_doorbell_ivors
117 /*
118 * We only want to touch IVOR38-41 if we're running on hardware
119 * that supports category E.HV. The architectural way to determine
120 * this is MMUCFG[LPIDSIZE].
121 */
122 mfspr r10,SPRN_MMUCFG
123 rlwinm. r10,r10,0,MMUCFG_LPIDSIZE
124 beq 1f
94 bl .setup_ehv_ivors 125 bl .setup_ehv_ivors
95#else 1261:
96 bl __setup_e500mc_ivors
97#endif
98 mtlr r4 127 mtlr r4
99 blr 128 blr
129
130_GLOBAL(__setup_cpu_e5500)
131 mflr r5
132 bl __e500_icache_setup
133 bl __e500_dcache_setup
134 bl .__setup_base_ivors
135 bl .setup_perfmon_ivor
136 bl .setup_doorbell_ivors
137 /*
138 * We only want to touch IVOR38-41 if we're running on hardware
139 * that supports category E.HV. The architectural way to determine
140 * this is MMUCFG[LPIDSIZE].
141 */
142 mfspr r10,SPRN_MMUCFG
143 rlwinm. r10,r10,0,MMUCFG_LPIDSIZE
144 beq 1f
145 bl .setup_ehv_ivors
146 b 2f
1471:
148 ld r10,CPU_SPEC_FEATURES(r4)
149 LOAD_REG_IMMEDIATE(r9,CPU_FTR_EMB_HV)
150 andc r10,r10,r9
151 std r10,CPU_SPEC_FEATURES(r4)
1522:
153 mtlr r5
154 blr
155#endif
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 455faa389876..0514c21f138b 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -2016,7 +2016,9 @@ static struct cpu_spec __initdata cpu_specs[] = {
2016 .oprofile_cpu_type = "ppc/e500mc", 2016 .oprofile_cpu_type = "ppc/e500mc",
2017 .oprofile_type = PPC_OPROFILE_FSL_EMB, 2017 .oprofile_type = PPC_OPROFILE_FSL_EMB,
2018 .cpu_setup = __setup_cpu_e5500, 2018 .cpu_setup = __setup_cpu_e5500,
2019#ifndef CONFIG_PPC32
2019 .cpu_restore = __restore_cpu_e5500, 2020 .cpu_restore = __restore_cpu_e5500,
2021#endif
2020 .machine_check = machine_check_e500mc, 2022 .machine_check = machine_check_e500mc,
2021 .platform = "ppce5500", 2023 .platform = "ppce5500",
2022 }, 2024 },
@@ -2034,7 +2036,9 @@ static struct cpu_spec __initdata cpu_specs[] = {
2034 .oprofile_cpu_type = "ppc/e6500", 2036 .oprofile_cpu_type = "ppc/e6500",
2035 .oprofile_type = PPC_OPROFILE_FSL_EMB, 2037 .oprofile_type = PPC_OPROFILE_FSL_EMB,
2036 .cpu_setup = __setup_cpu_e5500, 2038 .cpu_setup = __setup_cpu_e5500,
2039#ifndef CONFIG_PPC32
2037 .cpu_restore = __restore_cpu_e5500, 2040 .cpu_restore = __restore_cpu_e5500,
2041#endif
2038 .machine_check = machine_check_e500mc, 2042 .machine_check = machine_check_e500mc,
2039 .platform = "ppce6500", 2043 .platform = "ppce6500",
2040 }, 2044 },
diff --git a/arch/powerpc/kernel/dma-swiotlb.c b/arch/powerpc/kernel/dma-swiotlb.c
index a720b54b971c..bd1a2aba599f 100644
--- a/arch/powerpc/kernel/dma-swiotlb.c
+++ b/arch/powerpc/kernel/dma-swiotlb.c
@@ -105,3 +105,23 @@ int __init swiotlb_setup_bus_notifier(void)
105 &ppc_swiotlb_plat_bus_notifier); 105 &ppc_swiotlb_plat_bus_notifier);
106 return 0; 106 return 0;
107} 107}
108
109void swiotlb_detect_4g(void)
110{
111 if ((memblock_end_of_DRAM() - 1) > 0xffffffff)
112 ppc_swiotlb_enable = 1;
113}
114
115static int __init swiotlb_late_init(void)
116{
117 if (ppc_swiotlb_enable) {
118 swiotlb_print_info();
119 set_pci_dma_ops(&swiotlb_dma_ops);
120 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
121 } else {
122 swiotlb_free();
123 }
124
125 return 0;
126}
127subsys_initcall(swiotlb_late_init);
diff --git a/arch/powerpc/kernel/exceptions-64e.S b/arch/powerpc/kernel/exceptions-64e.S
index 87a82fbdf05a..4684e33a26c3 100644
--- a/arch/powerpc/kernel/exceptions-64e.S
+++ b/arch/powerpc/kernel/exceptions-64e.S
@@ -1356,25 +1356,11 @@ _GLOBAL(setup_perfmon_ivor)
1356_GLOBAL(setup_doorbell_ivors) 1356_GLOBAL(setup_doorbell_ivors)
1357 SET_IVOR(36, 0x280) /* Processor Doorbell */ 1357 SET_IVOR(36, 0x280) /* Processor Doorbell */
1358 SET_IVOR(37, 0x2a0) /* Processor Doorbell Crit */ 1358 SET_IVOR(37, 0x2a0) /* Processor Doorbell Crit */
1359
1360 /* Check MMUCFG[LPIDSIZE] to determine if we have category E.HV */
1361 mfspr r10,SPRN_MMUCFG
1362 rlwinm. r10,r10,0,MMUCFG_LPIDSIZE
1363 beqlr
1364
1365 SET_IVOR(38, 0x2c0) /* Guest Processor Doorbell */
1366 SET_IVOR(39, 0x2e0) /* Guest Processor Doorbell Crit/MC */
1367 blr 1359 blr
1368 1360
1369_GLOBAL(setup_ehv_ivors) 1361_GLOBAL(setup_ehv_ivors)
1370 /*
1371 * We may be running as a guest and lack E.HV even on a chip
1372 * that normally has it.
1373 */
1374 mfspr r10,SPRN_MMUCFG
1375 rlwinm. r10,r10,0,MMUCFG_LPIDSIZE
1376 beqlr
1377
1378 SET_IVOR(40, 0x300) /* Embedded Hypervisor System Call */ 1362 SET_IVOR(40, 0x300) /* Embedded Hypervisor System Call */
1379 SET_IVOR(41, 0x320) /* Embedded Hypervisor Privilege */ 1363 SET_IVOR(41, 0x320) /* Embedded Hypervisor Privilege */
1364 SET_IVOR(38, 0x2c0) /* Guest Processor Doorbell */
1365 SET_IVOR(39, 0x2e0) /* Guest Processor Doorbell Crit/MC */
1380 blr 1366 blr
diff --git a/arch/powerpc/kernel/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S
index 0f59863c3ade..6f62a737f607 100644
--- a/arch/powerpc/kernel/head_fsl_booke.S
+++ b/arch/powerpc/kernel/head_fsl_booke.S
@@ -895,15 +895,11 @@ _GLOBAL(__setup_e500mc_ivors)
895 mtspr SPRN_IVOR36,r3 895 mtspr SPRN_IVOR36,r3
896 li r3,CriticalDoorbell@l 896 li r3,CriticalDoorbell@l
897 mtspr SPRN_IVOR37,r3 897 mtspr SPRN_IVOR37,r3
898 sync
899 blr
898 900
899 /* 901/* setup ehv ivors for */
900 * We only want to touch IVOR38-41 if we're running on hardware 902_GLOBAL(__setup_ehv_ivors)
901 * that supports category E.HV. The architectural way to determine
902 * this is MMUCFG[LPIDSIZE].
903 */
904 mfspr r3, SPRN_MMUCFG
905 andis. r3, r3, MMUCFG_LPIDSIZE@h
906 beq no_hv
907 li r3,GuestDoorbell@l 903 li r3,GuestDoorbell@l
908 mtspr SPRN_IVOR38,r3 904 mtspr SPRN_IVOR38,r3
909 li r3,CriticalGuestDoorbell@l 905 li r3,CriticalGuestDoorbell@l
@@ -912,14 +908,8 @@ _GLOBAL(__setup_e500mc_ivors)
912 mtspr SPRN_IVOR40,r3 908 mtspr SPRN_IVOR40,r3
913 li r3,Ehvpriv@l 909 li r3,Ehvpriv@l
914 mtspr SPRN_IVOR41,r3 910 mtspr SPRN_IVOR41,r3
915skip_hv_ivors:
916 sync 911 sync
917 blr 912 blr
918no_hv:
919 lwz r3, CPU_SPEC_FEATURES(r5)
920 rlwinm r3, r3, 0, ~CPU_FTR_EMB_HV
921 stw r3, CPU_SPEC_FEATURES(r5)
922 b skip_hv_ivors
923 913
924#ifdef CONFIG_SPE 914#ifdef CONFIG_SPE
925/* 915/*
@@ -1043,6 +1033,34 @@ _GLOBAL(flush_dcache_L1)
1043 1033
1044 blr 1034 blr
1045 1035
1036/* Flush L1 d-cache, invalidate and disable d-cache and i-cache */
1037_GLOBAL(__flush_disable_L1)
1038 mflr r10
1039 bl flush_dcache_L1 /* Flush L1 d-cache */
1040 mtlr r10
1041
1042 mfspr r4, SPRN_L1CSR0 /* Invalidate and disable d-cache */
1043 li r5, 2
1044 rlwimi r4, r5, 0, 3
1045
1046 msync
1047 isync
1048 mtspr SPRN_L1CSR0, r4
1049 isync
1050
10511: mfspr r4, SPRN_L1CSR0 /* Wait for the invalidate to finish */
1052 andi. r4, r4, 2
1053 bne 1b
1054
1055 mfspr r4, SPRN_L1CSR1 /* Invalidate and disable i-cache */
1056 li r5, 2
1057 rlwimi r4, r5, 0, 3
1058
1059 mtspr SPRN_L1CSR1, r4
1060 isync
1061
1062 blr
1063
1046#ifdef CONFIG_SMP 1064#ifdef CONFIG_SMP
1047/* When we get here, r24 needs to hold the CPU # */ 1065/* When we get here, r24 needs to hold the CPU # */
1048 .globl __secondary_start 1066 .globl __secondary_start
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 8d4214afc21d..a51ed205016e 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -102,7 +102,7 @@ int __devinit smp_generic_kick_cpu(int nr)
102 * Ok it's not there, so it might be soft-unplugged, let's 102 * Ok it's not there, so it might be soft-unplugged, let's
103 * try to bring it back 103 * try to bring it back
104 */ 104 */
105 per_cpu(cpu_state, nr) = CPU_UP_PREPARE; 105 generic_set_cpu_up(nr);
106 smp_wmb(); 106 smp_wmb();
107 smp_send_reschedule(nr); 107 smp_send_reschedule(nr);
108#endif /* CONFIG_HOTPLUG_CPU */ 108#endif /* CONFIG_HOTPLUG_CPU */
@@ -413,6 +413,16 @@ void generic_set_cpu_dead(unsigned int cpu)
413 per_cpu(cpu_state, cpu) = CPU_DEAD; 413 per_cpu(cpu_state, cpu) = CPU_DEAD;
414} 414}
415 415
416/*
417 * The cpu_state should be set to CPU_UP_PREPARE in kick_cpu(), otherwise
418 * the cpu_state is always CPU_DEAD after calling generic_set_cpu_dead(),
419 * which makes the delay in generic_cpu_die() not happen.
420 */
421void generic_set_cpu_up(unsigned int cpu)
422{
423 per_cpu(cpu_state, cpu) = CPU_UP_PREPARE;
424}
425
416int generic_check_cpu_restart(unsigned int cpu) 426int generic_check_cpu_restart(unsigned int cpu)
417{ 427{
418 return per_cpu(cpu_state, cpu) == CPU_UP_PREPARE; 428 return per_cpu(cpu_state, cpu) == CPU_UP_PREPARE;