aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2017-08-10 15:09:13 -0400
committerDavid S. Miller <davem@davemloft.net>2017-08-10 15:09:13 -0400
commit2f7043a37708110aa98262b91702da6bc32e17b6 (patch)
treede0525dae8420a56f9a00def631ccc0108d9d091 /arch/sparc
parent4d9fbf539b52810cd2903719b181ed3d3ccd861f (diff)
parent26273939ace935dd7553b31d279eab30b40f7b9a (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc
Diffstat (limited to 'arch/sparc')
-rw-r--r--arch/sparc/configs/sparc32_defconfig4
-rw-r--r--arch/sparc/configs/sparc64_defconfig4
-rw-r--r--arch/sparc/include/asm/mmu_context_64.h14
-rw-r--r--arch/sparc/include/asm/spitfire.h16
-rw-r--r--arch/sparc/include/uapi/asm/ioctls.h2
-rw-r--r--arch/sparc/kernel/cpu.c6
-rw-r--r--arch/sparc/kernel/cpumap.c1
-rw-r--r--arch/sparc/kernel/head_64.S22
-rw-r--r--arch/sparc/kernel/setup_64.c15
-rw-r--r--arch/sparc/kernel/tsb.S12
-rw-r--r--arch/sparc/lib/U3memcpy.S4
-rw-r--r--arch/sparc/mm/init_64.c39
-rw-r--r--arch/sparc/power/hibernate.c3
13 files changed, 112 insertions, 30 deletions
diff --git a/arch/sparc/configs/sparc32_defconfig b/arch/sparc/configs/sparc32_defconfig
index c74d3701ad68..207a43a2d8b3 100644
--- a/arch/sparc/configs/sparc32_defconfig
+++ b/arch/sparc/configs/sparc32_defconfig
@@ -1,4 +1,3 @@
1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 1CONFIG_SYSVIPC=y
3CONFIG_POSIX_MQUEUE=y 2CONFIG_POSIX_MQUEUE=y
4CONFIG_LOG_BUF_SHIFT=14 3CONFIG_LOG_BUF_SHIFT=14
@@ -23,7 +22,6 @@ CONFIG_IP_PNP_DHCP=y
23CONFIG_INET_AH=y 22CONFIG_INET_AH=y
24CONFIG_INET_ESP=y 23CONFIG_INET_ESP=y
25CONFIG_INET_IPCOMP=y 24CONFIG_INET_IPCOMP=y
26# CONFIG_INET_LRO is not set
27CONFIG_INET6_AH=m 25CONFIG_INET6_AH=m
28CONFIG_INET6_ESP=m 26CONFIG_INET6_ESP=m
29CONFIG_INET6_IPCOMP=m 27CONFIG_INET6_IPCOMP=m
@@ -69,7 +67,6 @@ CONFIG_EXT2_FS=y
69CONFIG_EXT2_FS_XATTR=y 67CONFIG_EXT2_FS_XATTR=y
70CONFIG_EXT2_FS_POSIX_ACL=y 68CONFIG_EXT2_FS_POSIX_ACL=y
71CONFIG_EXT2_FS_SECURITY=y 69CONFIG_EXT2_FS_SECURITY=y
72CONFIG_AUTOFS_FS=m
73CONFIG_AUTOFS4_FS=m 70CONFIG_AUTOFS4_FS=m
74CONFIG_ISO9660_FS=m 71CONFIG_ISO9660_FS=m
75CONFIG_PROC_KCORE=y 72CONFIG_PROC_KCORE=y
@@ -82,7 +79,6 @@ CONFIG_NLS=y
82CONFIG_DEBUG_KERNEL=y 79CONFIG_DEBUG_KERNEL=y
83CONFIG_DETECT_HUNG_TASK=y 80CONFIG_DETECT_HUNG_TASK=y
84# CONFIG_SCHED_DEBUG is not set 81# CONFIG_SCHED_DEBUG is not set
85# CONFIG_RCU_CPU_STALL_DETECTOR is not set
86CONFIG_KGDB=y 82CONFIG_KGDB=y
87CONFIG_KGDB_TESTS=y 83CONFIG_KGDB_TESTS=y
88CONFIG_CRYPTO_NULL=m 84CONFIG_CRYPTO_NULL=m
diff --git a/arch/sparc/configs/sparc64_defconfig b/arch/sparc/configs/sparc64_defconfig
index b2e650d1764f..ca8609d7292f 100644
--- a/arch/sparc/configs/sparc64_defconfig
+++ b/arch/sparc/configs/sparc64_defconfig
@@ -1,5 +1,4 @@
1CONFIG_64BIT=y 1CONFIG_64BIT=y
2CONFIG_EXPERIMENTAL=y
3# CONFIG_LOCALVERSION_AUTO is not set 2# CONFIG_LOCALVERSION_AUTO is not set
4CONFIG_SYSVIPC=y 3CONFIG_SYSVIPC=y
5CONFIG_POSIX_MQUEUE=y 4CONFIG_POSIX_MQUEUE=y
@@ -184,7 +183,6 @@ CONFIG_HID_TOPSEED=y
184CONFIG_HID_THRUSTMASTER=y 183CONFIG_HID_THRUSTMASTER=y
185CONFIG_HID_ZEROPLUS=y 184CONFIG_HID_ZEROPLUS=y
186CONFIG_USB=y 185CONFIG_USB=y
187# CONFIG_USB_DEVICE_CLASS is not set
188CONFIG_USB_EHCI_HCD=m 186CONFIG_USB_EHCI_HCD=m
189# CONFIG_USB_EHCI_TT_NEWSCHED is not set 187# CONFIG_USB_EHCI_TT_NEWSCHED is not set
190CONFIG_USB_OHCI_HCD=y 188CONFIG_USB_OHCI_HCD=y
@@ -210,8 +208,6 @@ CONFIG_LOCKUP_DETECTOR=y
210CONFIG_DETECT_HUNG_TASK=y 208CONFIG_DETECT_HUNG_TASK=y
211# CONFIG_SCHED_DEBUG is not set 209# CONFIG_SCHED_DEBUG is not set
212CONFIG_SCHEDSTATS=y 210CONFIG_SCHEDSTATS=y
213# CONFIG_RCU_CPU_STALL_DETECTOR is not set
214CONFIG_SYSCTL_SYSCALL_CHECK=y
215CONFIG_BLK_DEV_IO_TRACE=y 211CONFIG_BLK_DEV_IO_TRACE=y
216CONFIG_UPROBE_EVENTS=y 212CONFIG_UPROBE_EVENTS=y
217CONFIG_KEYS=y 213CONFIG_KEYS=y
diff --git a/arch/sparc/include/asm/mmu_context_64.h b/arch/sparc/include/asm/mmu_context_64.h
index 2cddcda4f85f..87841d687f8d 100644
--- a/arch/sparc/include/asm/mmu_context_64.h
+++ b/arch/sparc/include/asm/mmu_context_64.h
@@ -27,9 +27,11 @@ void destroy_context(struct mm_struct *mm);
27void __tsb_context_switch(unsigned long pgd_pa, 27void __tsb_context_switch(unsigned long pgd_pa,
28 struct tsb_config *tsb_base, 28 struct tsb_config *tsb_base,
29 struct tsb_config *tsb_huge, 29 struct tsb_config *tsb_huge,
30 unsigned long tsb_descr_pa); 30 unsigned long tsb_descr_pa,
31 unsigned long secondary_ctx);
31 32
32static inline void tsb_context_switch(struct mm_struct *mm) 33static inline void tsb_context_switch_ctx(struct mm_struct *mm,
34 unsigned long ctx)
33{ 35{
34 __tsb_context_switch(__pa(mm->pgd), 36 __tsb_context_switch(__pa(mm->pgd),
35 &mm->context.tsb_block[MM_TSB_BASE], 37 &mm->context.tsb_block[MM_TSB_BASE],
@@ -40,9 +42,12 @@ static inline void tsb_context_switch(struct mm_struct *mm)
40#else 42#else
41 NULL 43 NULL
42#endif 44#endif
43 , __pa(&mm->context.tsb_descr[MM_TSB_BASE])); 45 , __pa(&mm->context.tsb_descr[MM_TSB_BASE]),
46 ctx);
44} 47}
45 48
49#define tsb_context_switch(X) tsb_context_switch_ctx(X, 0)
50
46void tsb_grow(struct mm_struct *mm, 51void tsb_grow(struct mm_struct *mm,
47 unsigned long tsb_index, 52 unsigned long tsb_index,
48 unsigned long mm_rss); 53 unsigned long mm_rss);
@@ -112,8 +117,7 @@ static inline void switch_mm(struct mm_struct *old_mm, struct mm_struct *mm, str
112 * cpu0 to update it's TSB because at that point the cpu_vm_mask 117 * cpu0 to update it's TSB because at that point the cpu_vm_mask
113 * only had cpu1 set in it. 118 * only had cpu1 set in it.
114 */ 119 */
115 load_secondary_context(mm); 120 tsb_context_switch_ctx(mm, CTX_HWBITS(mm->context));
116 tsb_context_switch(mm);
117 121
118 /* Any time a processor runs a context on an address space 122 /* Any time a processor runs a context on an address space
119 * for the first time, we must flush that context out of the 123 * for the first time, we must flush that context out of the
diff --git a/arch/sparc/include/asm/spitfire.h b/arch/sparc/include/asm/spitfire.h
index 1d8321c827a8..1b1286d05069 100644
--- a/arch/sparc/include/asm/spitfire.h
+++ b/arch/sparc/include/asm/spitfire.h
@@ -47,10 +47,26 @@
47#define SUN4V_CHIP_NIAGARA5 0x05 47#define SUN4V_CHIP_NIAGARA5 0x05
48#define SUN4V_CHIP_SPARC_M6 0x06 48#define SUN4V_CHIP_SPARC_M6 0x06
49#define SUN4V_CHIP_SPARC_M7 0x07 49#define SUN4V_CHIP_SPARC_M7 0x07
50#define SUN4V_CHIP_SPARC_M8 0x08
50#define SUN4V_CHIP_SPARC64X 0x8a 51#define SUN4V_CHIP_SPARC64X 0x8a
51#define SUN4V_CHIP_SPARC_SN 0x8b 52#define SUN4V_CHIP_SPARC_SN 0x8b
52#define SUN4V_CHIP_UNKNOWN 0xff 53#define SUN4V_CHIP_UNKNOWN 0xff
53 54
55/*
56 * The following CPU_ID_xxx constants are used
57 * to identify the CPU type in the setup phase
58 * (see head_64.S)
59 */
60#define CPU_ID_NIAGARA1 ('1')
61#define CPU_ID_NIAGARA2 ('2')
62#define CPU_ID_NIAGARA3 ('3')
63#define CPU_ID_NIAGARA4 ('4')
64#define CPU_ID_NIAGARA5 ('5')
65#define CPU_ID_M6 ('6')
66#define CPU_ID_M7 ('7')
67#define CPU_ID_M8 ('8')
68#define CPU_ID_SONOMA1 ('N')
69
54#ifndef __ASSEMBLY__ 70#ifndef __ASSEMBLY__
55 71
56enum ultra_tlb_layout { 72enum ultra_tlb_layout {
diff --git a/arch/sparc/include/uapi/asm/ioctls.h b/arch/sparc/include/uapi/asm/ioctls.h
index 6d27398632ea..f5df72b93bb2 100644
--- a/arch/sparc/include/uapi/asm/ioctls.h
+++ b/arch/sparc/include/uapi/asm/ioctls.h
@@ -88,7 +88,7 @@
88#define TIOCGPTN _IOR('t', 134, unsigned int) /* Get Pty Number */ 88#define TIOCGPTN _IOR('t', 134, unsigned int) /* Get Pty Number */
89#define TIOCSPTLCK _IOW('t', 135, int) /* Lock/unlock PTY */ 89#define TIOCSPTLCK _IOW('t', 135, int) /* Lock/unlock PTY */
90#define TIOCSIG _IOW('t', 136, int) /* Generate signal on Pty slave */ 90#define TIOCSIG _IOW('t', 136, int) /* Generate signal on Pty slave */
91#define TIOCGPTPEER _IOR('t', 137, int) /* Safely open the slave */ 91#define TIOCGPTPEER _IO('t', 137) /* Safely open the slave */
92 92
93/* Little f */ 93/* Little f */
94#define FIOCLEX _IO('f', 1) 94#define FIOCLEX _IO('f', 1)
diff --git a/arch/sparc/kernel/cpu.c b/arch/sparc/kernel/cpu.c
index 493e023a468a..ef4f18f7a674 100644
--- a/arch/sparc/kernel/cpu.c
+++ b/arch/sparc/kernel/cpu.c
@@ -506,6 +506,12 @@ static void __init sun4v_cpu_probe(void)
506 sparc_pmu_type = "sparc-m7"; 506 sparc_pmu_type = "sparc-m7";
507 break; 507 break;
508 508
509 case SUN4V_CHIP_SPARC_M8:
510 sparc_cpu_type = "SPARC-M8";
511 sparc_fpu_type = "SPARC-M8 integrated FPU";
512 sparc_pmu_type = "sparc-m8";
513 break;
514
509 case SUN4V_CHIP_SPARC_SN: 515 case SUN4V_CHIP_SPARC_SN:
510 sparc_cpu_type = "SPARC-SN"; 516 sparc_cpu_type = "SPARC-SN";
511 sparc_fpu_type = "SPARC-SN integrated FPU"; 517 sparc_fpu_type = "SPARC-SN integrated FPU";
diff --git a/arch/sparc/kernel/cpumap.c b/arch/sparc/kernel/cpumap.c
index 45c820e1cba5..90d550bbfeef 100644
--- a/arch/sparc/kernel/cpumap.c
+++ b/arch/sparc/kernel/cpumap.c
@@ -328,6 +328,7 @@ static int iterate_cpu(struct cpuinfo_tree *t, unsigned int root_index)
328 case SUN4V_CHIP_NIAGARA5: 328 case SUN4V_CHIP_NIAGARA5:
329 case SUN4V_CHIP_SPARC_M6: 329 case SUN4V_CHIP_SPARC_M6:
330 case SUN4V_CHIP_SPARC_M7: 330 case SUN4V_CHIP_SPARC_M7:
331 case SUN4V_CHIP_SPARC_M8:
331 case SUN4V_CHIP_SPARC_SN: 332 case SUN4V_CHIP_SPARC_SN:
332 case SUN4V_CHIP_SPARC64X: 333 case SUN4V_CHIP_SPARC64X:
333 rover_inc_table = niagara_iterate_method; 334 rover_inc_table = niagara_iterate_method;
diff --git a/arch/sparc/kernel/head_64.S b/arch/sparc/kernel/head_64.S
index 41a407328667..78e0211753d2 100644
--- a/arch/sparc/kernel/head_64.S
+++ b/arch/sparc/kernel/head_64.S
@@ -424,22 +424,25 @@ EXPORT_SYMBOL(sun4v_chip_type)
424 nop 424 nop
425 425
42670: ldub [%g1 + 7], %g2 42670: ldub [%g1 + 7], %g2
427 cmp %g2, '3' 427 cmp %g2, CPU_ID_NIAGARA3
428 be,pt %xcc, 5f 428 be,pt %xcc, 5f
429 mov SUN4V_CHIP_NIAGARA3, %g4 429 mov SUN4V_CHIP_NIAGARA3, %g4
430 cmp %g2, '4' 430 cmp %g2, CPU_ID_NIAGARA4
431 be,pt %xcc, 5f 431 be,pt %xcc, 5f
432 mov SUN4V_CHIP_NIAGARA4, %g4 432 mov SUN4V_CHIP_NIAGARA4, %g4
433 cmp %g2, '5' 433 cmp %g2, CPU_ID_NIAGARA5
434 be,pt %xcc, 5f 434 be,pt %xcc, 5f
435 mov SUN4V_CHIP_NIAGARA5, %g4 435 mov SUN4V_CHIP_NIAGARA5, %g4
436 cmp %g2, '6' 436 cmp %g2, CPU_ID_M6
437 be,pt %xcc, 5f 437 be,pt %xcc, 5f
438 mov SUN4V_CHIP_SPARC_M6, %g4 438 mov SUN4V_CHIP_SPARC_M6, %g4
439 cmp %g2, '7' 439 cmp %g2, CPU_ID_M7
440 be,pt %xcc, 5f 440 be,pt %xcc, 5f
441 mov SUN4V_CHIP_SPARC_M7, %g4 441 mov SUN4V_CHIP_SPARC_M7, %g4
442 cmp %g2, 'N' 442 cmp %g2, CPU_ID_M8
443 be,pt %xcc, 5f
444 mov SUN4V_CHIP_SPARC_M8, %g4
445 cmp %g2, CPU_ID_SONOMA1
443 be,pt %xcc, 5f 446 be,pt %xcc, 5f
444 mov SUN4V_CHIP_SPARC_SN, %g4 447 mov SUN4V_CHIP_SPARC_SN, %g4
445 ba,pt %xcc, 49f 448 ba,pt %xcc, 49f
@@ -448,10 +451,10 @@ EXPORT_SYMBOL(sun4v_chip_type)
44891: sethi %hi(prom_cpu_compatible), %g1 45191: sethi %hi(prom_cpu_compatible), %g1
449 or %g1, %lo(prom_cpu_compatible), %g1 452 or %g1, %lo(prom_cpu_compatible), %g1
450 ldub [%g1 + 17], %g2 453 ldub [%g1 + 17], %g2
451 cmp %g2, '1' 454 cmp %g2, CPU_ID_NIAGARA1
452 be,pt %xcc, 5f 455 be,pt %xcc, 5f
453 mov SUN4V_CHIP_NIAGARA1, %g4 456 mov SUN4V_CHIP_NIAGARA1, %g4
454 cmp %g2, '2' 457 cmp %g2, CPU_ID_NIAGARA2
455 be,pt %xcc, 5f 458 be,pt %xcc, 5f
456 mov SUN4V_CHIP_NIAGARA2, %g4 459 mov SUN4V_CHIP_NIAGARA2, %g4
457 460
@@ -602,6 +605,9 @@ niagara_tlb_fixup:
602 cmp %g1, SUN4V_CHIP_SPARC_M7 605 cmp %g1, SUN4V_CHIP_SPARC_M7
603 be,pt %xcc, niagara4_patch 606 be,pt %xcc, niagara4_patch
604 nop 607 nop
608 cmp %g1, SUN4V_CHIP_SPARC_M8
609 be,pt %xcc, niagara4_patch
610 nop
605 cmp %g1, SUN4V_CHIP_SPARC_SN 611 cmp %g1, SUN4V_CHIP_SPARC_SN
606 be,pt %xcc, niagara4_patch 612 be,pt %xcc, niagara4_patch
607 nop 613 nop
diff --git a/arch/sparc/kernel/setup_64.c b/arch/sparc/kernel/setup_64.c
index f92d5c67938b..c4088a3b1051 100644
--- a/arch/sparc/kernel/setup_64.c
+++ b/arch/sparc/kernel/setup_64.c
@@ -288,10 +288,17 @@ static void __init sun4v_patch(void)
288 288
289 sun4v_patch_2insn_range(&__sun4v_2insn_patch, 289 sun4v_patch_2insn_range(&__sun4v_2insn_patch,
290 &__sun4v_2insn_patch_end); 290 &__sun4v_2insn_patch_end);
291 if (sun4v_chip_type == SUN4V_CHIP_SPARC_M7 || 291
292 sun4v_chip_type == SUN4V_CHIP_SPARC_SN) 292 switch (sun4v_chip_type) {
293 case SUN4V_CHIP_SPARC_M7:
294 case SUN4V_CHIP_SPARC_M8:
295 case SUN4V_CHIP_SPARC_SN:
293 sun_m7_patch_2insn_range(&__sun_m7_2insn_patch, 296 sun_m7_patch_2insn_range(&__sun_m7_2insn_patch,
294 &__sun_m7_2insn_patch_end); 297 &__sun_m7_2insn_patch_end);
298 break;
299 default:
300 break;
301 }
295 302
296 sun4v_hvapi_init(); 303 sun4v_hvapi_init();
297} 304}
@@ -530,6 +537,7 @@ static void __init init_sparc64_elf_hwcap(void)
530 sun4v_chip_type == SUN4V_CHIP_NIAGARA5 || 537 sun4v_chip_type == SUN4V_CHIP_NIAGARA5 ||
531 sun4v_chip_type == SUN4V_CHIP_SPARC_M6 || 538 sun4v_chip_type == SUN4V_CHIP_SPARC_M6 ||
532 sun4v_chip_type == SUN4V_CHIP_SPARC_M7 || 539 sun4v_chip_type == SUN4V_CHIP_SPARC_M7 ||
540 sun4v_chip_type == SUN4V_CHIP_SPARC_M8 ||
533 sun4v_chip_type == SUN4V_CHIP_SPARC_SN || 541 sun4v_chip_type == SUN4V_CHIP_SPARC_SN ||
534 sun4v_chip_type == SUN4V_CHIP_SPARC64X) 542 sun4v_chip_type == SUN4V_CHIP_SPARC64X)
535 cap |= HWCAP_SPARC_BLKINIT; 543 cap |= HWCAP_SPARC_BLKINIT;
@@ -539,6 +547,7 @@ static void __init init_sparc64_elf_hwcap(void)
539 sun4v_chip_type == SUN4V_CHIP_NIAGARA5 || 547 sun4v_chip_type == SUN4V_CHIP_NIAGARA5 ||
540 sun4v_chip_type == SUN4V_CHIP_SPARC_M6 || 548 sun4v_chip_type == SUN4V_CHIP_SPARC_M6 ||
541 sun4v_chip_type == SUN4V_CHIP_SPARC_M7 || 549 sun4v_chip_type == SUN4V_CHIP_SPARC_M7 ||
550 sun4v_chip_type == SUN4V_CHIP_SPARC_M8 ||
542 sun4v_chip_type == SUN4V_CHIP_SPARC_SN || 551 sun4v_chip_type == SUN4V_CHIP_SPARC_SN ||
543 sun4v_chip_type == SUN4V_CHIP_SPARC64X) 552 sun4v_chip_type == SUN4V_CHIP_SPARC64X)
544 cap |= HWCAP_SPARC_N2; 553 cap |= HWCAP_SPARC_N2;
@@ -569,6 +578,7 @@ static void __init init_sparc64_elf_hwcap(void)
569 sun4v_chip_type == SUN4V_CHIP_NIAGARA5 || 578 sun4v_chip_type == SUN4V_CHIP_NIAGARA5 ||
570 sun4v_chip_type == SUN4V_CHIP_SPARC_M6 || 579 sun4v_chip_type == SUN4V_CHIP_SPARC_M6 ||
571 sun4v_chip_type == SUN4V_CHIP_SPARC_M7 || 580 sun4v_chip_type == SUN4V_CHIP_SPARC_M7 ||
581 sun4v_chip_type == SUN4V_CHIP_SPARC_M8 ||
572 sun4v_chip_type == SUN4V_CHIP_SPARC_SN || 582 sun4v_chip_type == SUN4V_CHIP_SPARC_SN ||
573 sun4v_chip_type == SUN4V_CHIP_SPARC64X) 583 sun4v_chip_type == SUN4V_CHIP_SPARC64X)
574 cap |= (AV_SPARC_VIS | AV_SPARC_VIS2 | 584 cap |= (AV_SPARC_VIS | AV_SPARC_VIS2 |
@@ -579,6 +589,7 @@ static void __init init_sparc64_elf_hwcap(void)
579 sun4v_chip_type == SUN4V_CHIP_NIAGARA5 || 589 sun4v_chip_type == SUN4V_CHIP_NIAGARA5 ||
580 sun4v_chip_type == SUN4V_CHIP_SPARC_M6 || 590 sun4v_chip_type == SUN4V_CHIP_SPARC_M6 ||
581 sun4v_chip_type == SUN4V_CHIP_SPARC_M7 || 591 sun4v_chip_type == SUN4V_CHIP_SPARC_M7 ||
592 sun4v_chip_type == SUN4V_CHIP_SPARC_M8 ||
582 sun4v_chip_type == SUN4V_CHIP_SPARC_SN || 593 sun4v_chip_type == SUN4V_CHIP_SPARC_SN ||
583 sun4v_chip_type == SUN4V_CHIP_SPARC64X) 594 sun4v_chip_type == SUN4V_CHIP_SPARC64X)
584 cap |= (AV_SPARC_VIS3 | AV_SPARC_HPC | 595 cap |= (AV_SPARC_VIS3 | AV_SPARC_HPC |
diff --git a/arch/sparc/kernel/tsb.S b/arch/sparc/kernel/tsb.S
index 07c0df924960..db872dbfafe9 100644
--- a/arch/sparc/kernel/tsb.S
+++ b/arch/sparc/kernel/tsb.S
@@ -360,6 +360,7 @@ tsb_flush:
360 * %o1: TSB base config pointer 360 * %o1: TSB base config pointer
361 * %o2: TSB huge config pointer, or NULL if none 361 * %o2: TSB huge config pointer, or NULL if none
362 * %o3: Hypervisor TSB descriptor physical address 362 * %o3: Hypervisor TSB descriptor physical address
363 * %o4: Secondary context to load, if non-zero
363 * 364 *
364 * We have to run this whole thing with interrupts 365 * We have to run this whole thing with interrupts
365 * disabled so that the current cpu doesn't change 366 * disabled so that the current cpu doesn't change
@@ -372,6 +373,17 @@ __tsb_context_switch:
372 rdpr %pstate, %g1 373 rdpr %pstate, %g1
373 wrpr %g1, PSTATE_IE, %pstate 374 wrpr %g1, PSTATE_IE, %pstate
374 375
376 brz,pn %o4, 1f
377 mov SECONDARY_CONTEXT, %o5
378
379661: stxa %o4, [%o5] ASI_DMMU
380 .section .sun4v_1insn_patch, "ax"
381 .word 661b
382 stxa %o4, [%o5] ASI_MMU
383 .previous
384 flush %g6
385
3861:
375 TRAP_LOAD_TRAP_BLOCK(%g2, %g3) 387 TRAP_LOAD_TRAP_BLOCK(%g2, %g3)
376 388
377 stx %o0, [%g2 + TRAP_PER_CPU_PGD_PADDR] 389 stx %o0, [%g2 + TRAP_PER_CPU_PGD_PADDR]
diff --git a/arch/sparc/lib/U3memcpy.S b/arch/sparc/lib/U3memcpy.S
index 54f98706b03b..5a8cb37f0a3b 100644
--- a/arch/sparc/lib/U3memcpy.S
+++ b/arch/sparc/lib/U3memcpy.S
@@ -145,13 +145,13 @@ ENDPROC(U3_retl_o2_plus_GS_plus_0x08)
145ENTRY(U3_retl_o2_and_7_plus_GS) 145ENTRY(U3_retl_o2_and_7_plus_GS)
146 and %o2, 7, %o2 146 and %o2, 7, %o2
147 retl 147 retl
148 add %o2, GLOBAL_SPARE, %o2 148 add %o2, GLOBAL_SPARE, %o0
149ENDPROC(U3_retl_o2_and_7_plus_GS) 149ENDPROC(U3_retl_o2_and_7_plus_GS)
150ENTRY(U3_retl_o2_and_7_plus_GS_plus_8) 150ENTRY(U3_retl_o2_and_7_plus_GS_plus_8)
151 add GLOBAL_SPARE, 8, GLOBAL_SPARE 151 add GLOBAL_SPARE, 8, GLOBAL_SPARE
152 and %o2, 7, %o2 152 and %o2, 7, %o2
153 retl 153 retl
154 add %o2, GLOBAL_SPARE, %o2 154 add %o2, GLOBAL_SPARE, %o0
155ENDPROC(U3_retl_o2_and_7_plus_GS_plus_8) 155ENDPROC(U3_retl_o2_and_7_plus_GS_plus_8)
156#endif 156#endif
157 157
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
index 3c40ebd50f92..afa0099f3748 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -325,6 +325,29 @@ static void __update_mmu_tsb_insert(struct mm_struct *mm, unsigned long tsb_inde
325} 325}
326 326
327#ifdef CONFIG_HUGETLB_PAGE 327#ifdef CONFIG_HUGETLB_PAGE
328static void __init add_huge_page_size(unsigned long size)
329{
330 unsigned int order;
331
332 if (size_to_hstate(size))
333 return;
334
335 order = ilog2(size) - PAGE_SHIFT;
336 hugetlb_add_hstate(order);
337}
338
339static int __init hugetlbpage_init(void)
340{
341 add_huge_page_size(1UL << HPAGE_64K_SHIFT);
342 add_huge_page_size(1UL << HPAGE_SHIFT);
343 add_huge_page_size(1UL << HPAGE_256MB_SHIFT);
344 add_huge_page_size(1UL << HPAGE_2GB_SHIFT);
345
346 return 0;
347}
348
349arch_initcall(hugetlbpage_init);
350
328static int __init setup_hugepagesz(char *string) 351static int __init setup_hugepagesz(char *string)
329{ 352{
330 unsigned long long hugepage_size; 353 unsigned long long hugepage_size;
@@ -364,7 +387,7 @@ static int __init setup_hugepagesz(char *string)
364 goto out; 387 goto out;
365 } 388 }
366 389
367 hugetlb_add_hstate(hugepage_shift - PAGE_SHIFT); 390 add_huge_page_size(hugepage_size);
368 rc = 1; 391 rc = 1;
369 392
370out: 393out:
@@ -1921,12 +1944,22 @@ static void __init setup_page_offset(void)
1921 break; 1944 break;
1922 case SUN4V_CHIP_SPARC_M7: 1945 case SUN4V_CHIP_SPARC_M7:
1923 case SUN4V_CHIP_SPARC_SN: 1946 case SUN4V_CHIP_SPARC_SN:
1924 default:
1925 /* M7 and later support 52-bit virtual addresses. */ 1947 /* M7 and later support 52-bit virtual addresses. */
1926 sparc64_va_hole_top = 0xfff8000000000000UL; 1948 sparc64_va_hole_top = 0xfff8000000000000UL;
1927 sparc64_va_hole_bottom = 0x0008000000000000UL; 1949 sparc64_va_hole_bottom = 0x0008000000000000UL;
1928 max_phys_bits = 49; 1950 max_phys_bits = 49;
1929 break; 1951 break;
1952 case SUN4V_CHIP_SPARC_M8:
1953 default:
1954 /* M8 and later support 54-bit virtual addresses.
1955 * However, restricting M8 and above VA bits to 53
1956 * as 4-level page table cannot support more than
1957 * 53 VA bits.
1958 */
1959 sparc64_va_hole_top = 0xfff0000000000000UL;
1960 sparc64_va_hole_bottom = 0x0010000000000000UL;
1961 max_phys_bits = 51;
1962 break;
1930 } 1963 }
1931 } 1964 }
1932 1965
@@ -2138,6 +2171,7 @@ static void __init sun4v_linear_pte_xor_finalize(void)
2138 */ 2171 */
2139 switch (sun4v_chip_type) { 2172 switch (sun4v_chip_type) {
2140 case SUN4V_CHIP_SPARC_M7: 2173 case SUN4V_CHIP_SPARC_M7:
2174 case SUN4V_CHIP_SPARC_M8:
2141 case SUN4V_CHIP_SPARC_SN: 2175 case SUN4V_CHIP_SPARC_SN:
2142 pagecv_flag = 0x00; 2176 pagecv_flag = 0x00;
2143 break; 2177 break;
@@ -2290,6 +2324,7 @@ void __init paging_init(void)
2290 */ 2324 */
2291 switch (sun4v_chip_type) { 2325 switch (sun4v_chip_type) {
2292 case SUN4V_CHIP_SPARC_M7: 2326 case SUN4V_CHIP_SPARC_M7:
2327 case SUN4V_CHIP_SPARC_M8:
2293 case SUN4V_CHIP_SPARC_SN: 2328 case SUN4V_CHIP_SPARC_SN:
2294 page_cache4v_flag = _PAGE_CP_4V; 2329 page_cache4v_flag = _PAGE_CP_4V;
2295 break; 2330 break;
diff --git a/arch/sparc/power/hibernate.c b/arch/sparc/power/hibernate.c
index 17bd2e167e07..df707a8ad311 100644
--- a/arch/sparc/power/hibernate.c
+++ b/arch/sparc/power/hibernate.c
@@ -35,6 +35,5 @@ void restore_processor_state(void)
35{ 35{
36 struct mm_struct *mm = current->active_mm; 36 struct mm_struct *mm = current->active_mm;
37 37
38 load_secondary_context(mm); 38 tsb_context_switch_ctx(mm, CTX_HWBITS(mm->context));
39 tsb_context_switch(mm);
40} 39}