diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/sparc64/kernel/smp.c | 4 | ||||
-rw-r--r-- | arch/sparc64/mm/init.c | 70 |
2 files changed, 72 insertions, 2 deletions
diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c index f553264588d6..7d7e02ba297e 100644 --- a/arch/sparc64/kernel/smp.c +++ b/arch/sparc64/kernel/smp.c | |||
@@ -122,8 +122,10 @@ void __init smp_callin(void) | |||
122 | 122 | ||
123 | __local_per_cpu_offset = __per_cpu_offset(cpuid); | 123 | __local_per_cpu_offset = __per_cpu_offset(cpuid); |
124 | 124 | ||
125 | if (tlb_type == hypervisor) | 125 | if (tlb_type == hypervisor) { |
126 | sun4v_register_fault_status(); | 126 | sun4v_register_fault_status(); |
127 | sun4v_ktsb_register(); | ||
128 | } | ||
127 | 129 | ||
128 | __flush_tlb_all(); | 130 | __flush_tlb_all(); |
129 | 131 | ||
diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c index 88eb6f6be562..92756da273bd 100644 --- a/arch/sparc64/mm/init.c +++ b/arch/sparc64/mm/init.c | |||
@@ -1109,6 +1109,69 @@ static void __init tsb_phys_patch(void) | |||
1109 | } | 1109 | } |
1110 | } | 1110 | } |
1111 | 1111 | ||
1112 | /* Don't mark as init, we give this to the Hypervisor. */ | ||
1113 | static struct hv_tsb_descr ktsb_descr[2]; | ||
1114 | extern struct tsb swapper_tsb[KERNEL_TSB_NENTRIES]; | ||
1115 | |||
1116 | static void __init sun4v_ktsb_init(void) | ||
1117 | { | ||
1118 | unsigned long ktsb_pa; | ||
1119 | |||
1120 | ktsb_pa = kern_base + ((unsigned long)&swapper_tsb[0] - KERNBASE); | ||
1121 | |||
1122 | switch (PAGE_SIZE) { | ||
1123 | case 8 * 1024: | ||
1124 | default: | ||
1125 | ktsb_descr[0].pgsz_idx = HV_PGSZ_IDX_8K; | ||
1126 | ktsb_descr[0].pgsz_mask = HV_PGSZ_MASK_8K; | ||
1127 | break; | ||
1128 | |||
1129 | case 64 * 1024: | ||
1130 | ktsb_descr[0].pgsz_idx = HV_PGSZ_IDX_64K; | ||
1131 | ktsb_descr[0].pgsz_mask = HV_PGSZ_MASK_64K; | ||
1132 | break; | ||
1133 | |||
1134 | case 512 * 1024: | ||
1135 | ktsb_descr[0].pgsz_idx = HV_PGSZ_IDX_512K; | ||
1136 | ktsb_descr[0].pgsz_mask = HV_PGSZ_MASK_512K; | ||
1137 | break; | ||
1138 | |||
1139 | case 4 * 1024 * 1024: | ||
1140 | ktsb_descr[0].pgsz_idx = HV_PGSZ_IDX_4MB; | ||
1141 | ktsb_descr[0].pgsz_mask = HV_PGSZ_MASK_4MB; | ||
1142 | break; | ||
1143 | }; | ||
1144 | |||
1145 | ktsb_descr[0].assoc = 0; | ||
1146 | ktsb_descr[0].num_ttes = KERNEL_TSB_NENTRIES; | ||
1147 | ktsb_descr[0].ctx_idx = 0; | ||
1148 | ktsb_descr[0].tsb_base = ktsb_pa; | ||
1149 | ktsb_descr[0].resv = 0; | ||
1150 | |||
1151 | /* XXX When we have a kernel large page size TSB, describe | ||
1152 | * XXX it in ktsb_descr[1] here. | ||
1153 | */ | ||
1154 | } | ||
1155 | |||
1156 | void __cpuinit sun4v_ktsb_register(void) | ||
1157 | { | ||
1158 | register unsigned long func asm("%o5"); | ||
1159 | register unsigned long arg0 asm("%o0"); | ||
1160 | register unsigned long arg1 asm("%o1"); | ||
1161 | unsigned long pa; | ||
1162 | |||
1163 | pa = kern_base + ((unsigned long)&ktsb_descr[0] - KERNBASE); | ||
1164 | |||
1165 | func = HV_FAST_MMU_TSB_CTX0; | ||
1166 | /* XXX set arg0 to 2 when we use ktsb_descr[1], see above XXX */ | ||
1167 | arg0 = 1; | ||
1168 | arg1 = pa; | ||
1169 | __asm__ __volatile__("ta %6" | ||
1170 | : "=&r" (func), "=&r" (arg0), "=&r" (arg1) | ||
1171 | : "0" (func), "1" (arg0), "2" (arg1), | ||
1172 | "i" (HV_FAST_TRAP)); | ||
1173 | } | ||
1174 | |||
1112 | /* paging_init() sets up the page tables */ | 1175 | /* paging_init() sets up the page tables */ |
1113 | 1176 | ||
1114 | extern void cheetah_ecache_flush_init(void); | 1177 | extern void cheetah_ecache_flush_init(void); |
@@ -1129,8 +1192,10 @@ void __init paging_init(void) | |||
1129 | tlb_type == hypervisor) | 1192 | tlb_type == hypervisor) |
1130 | tsb_phys_patch(); | 1193 | tsb_phys_patch(); |
1131 | 1194 | ||
1132 | if (tlb_type == hypervisor) | 1195 | if (tlb_type == hypervisor) { |
1133 | sun4v_patch_tlb_handlers(); | 1196 | sun4v_patch_tlb_handlers(); |
1197 | sun4v_ktsb_init(); | ||
1198 | } | ||
1134 | 1199 | ||
1135 | /* Find available physical memory... */ | 1200 | /* Find available physical memory... */ |
1136 | read_obp_memory("available", &pavail[0], &pavail_ents); | 1201 | read_obp_memory("available", &pavail[0], &pavail_ents); |
@@ -1171,6 +1236,9 @@ void __init paging_init(void) | |||
1171 | 1236 | ||
1172 | __flush_tlb_all(); | 1237 | __flush_tlb_all(); |
1173 | 1238 | ||
1239 | if (tlb_type == hypervisor) | ||
1240 | sun4v_ktsb_register(); | ||
1241 | |||
1174 | /* Setup bootmem... */ | 1242 | /* Setup bootmem... */ |
1175 | pages_avail = 0; | 1243 | pages_avail = 0; |
1176 | last_valid_pfn = end_pfn = bootmem_init(&pages_avail); | 1244 | last_valid_pfn = end_pfn = bootmem_init(&pages_avail); |