aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/include
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sparc/include')
-rw-r--r--arch/sparc/include/asm/Kbuild1
-rw-r--r--arch/sparc/include/asm/floppy_64.h2
-rw-r--r--arch/sparc/include/asm/jump_label.h2
-rw-r--r--arch/sparc/include/asm/mmu_64.h1
-rw-r--r--arch/sparc/include/asm/page_64.h49
-rw-r--r--arch/sparc/include/asm/pgtable_64.h209
-rw-r--r--arch/sparc/include/asm/prom.h12
-rw-r--r--arch/sparc/include/asm/sparsemem.h6
-rw-r--r--arch/sparc/include/asm/thread_info_64.h3
-rw-r--r--arch/sparc/include/asm/tsb.h105
-rw-r--r--arch/sparc/include/uapi/asm/errno.h2
-rw-r--r--arch/sparc/include/uapi/asm/socket.h2
12 files changed, 198 insertions, 196 deletions
diff --git a/arch/sparc/include/asm/Kbuild b/arch/sparc/include/asm/Kbuild
index 7e4a97fbded4..bf390667657a 100644
--- a/arch/sparc/include/asm/Kbuild
+++ b/arch/sparc/include/asm/Kbuild
@@ -16,3 +16,4 @@ generic-y += serial.h
16generic-y += trace_clock.h 16generic-y += trace_clock.h
17generic-y += types.h 17generic-y += types.h
18generic-y += word-at-a-time.h 18generic-y += word-at-a-time.h
19generic-y += preempt.h
diff --git a/arch/sparc/include/asm/floppy_64.h b/arch/sparc/include/asm/floppy_64.h
index e204f902e6c9..7c90c50c200d 100644
--- a/arch/sparc/include/asm/floppy_64.h
+++ b/arch/sparc/include/asm/floppy_64.h
@@ -254,7 +254,7 @@ static int sun_fd_request_irq(void)
254 once = 1; 254 once = 1;
255 255
256 error = request_irq(FLOPPY_IRQ, sparc_floppy_irq, 256 error = request_irq(FLOPPY_IRQ, sparc_floppy_irq,
257 IRQF_DISABLED, "floppy", NULL); 257 0, "floppy", NULL);
258 258
259 return ((error == 0) ? 0 : -1); 259 return ((error == 0) ? 0 : -1);
260 } 260 }
diff --git a/arch/sparc/include/asm/jump_label.h b/arch/sparc/include/asm/jump_label.h
index 5080d16a832f..ec2e2e2aba7d 100644
--- a/arch/sparc/include/asm/jump_label.h
+++ b/arch/sparc/include/asm/jump_label.h
@@ -9,7 +9,7 @@
9 9
10static __always_inline bool arch_static_branch(struct static_key *key) 10static __always_inline bool arch_static_branch(struct static_key *key)
11{ 11{
12 asm goto("1:\n\t" 12 asm_volatile_goto("1:\n\t"
13 "nop\n\t" 13 "nop\n\t"
14 "nop\n\t" 14 "nop\n\t"
15 ".pushsection __jump_table, \"aw\"\n\t" 15 ".pushsection __jump_table, \"aw\"\n\t"
diff --git a/arch/sparc/include/asm/mmu_64.h b/arch/sparc/include/asm/mmu_64.h
index 76092c4dd277..f668797ae234 100644
--- a/arch/sparc/include/asm/mmu_64.h
+++ b/arch/sparc/include/asm/mmu_64.h
@@ -93,7 +93,6 @@ typedef struct {
93 spinlock_t lock; 93 spinlock_t lock;
94 unsigned long sparc64_ctx_val; 94 unsigned long sparc64_ctx_val;
95 unsigned long huge_pte_count; 95 unsigned long huge_pte_count;
96 struct page *pgtable_page;
97 struct tsb_config tsb_block[MM_NUM_TSBS]; 96 struct tsb_config tsb_block[MM_NUM_TSBS];
98 struct hv_tsb_descr tsb_descr[MM_NUM_TSBS]; 97 struct hv_tsb_descr tsb_descr[MM_NUM_TSBS];
99} mm_context_t; 98} mm_context_t;
diff --git a/arch/sparc/include/asm/page_64.h b/arch/sparc/include/asm/page_64.h
index e15538899f3d..aac53fcea807 100644
--- a/arch/sparc/include/asm/page_64.h
+++ b/arch/sparc/include/asm/page_64.h
@@ -15,7 +15,10 @@
15#define DCACHE_ALIASING_POSSIBLE 15#define DCACHE_ALIASING_POSSIBLE
16#endif 16#endif
17 17
18#define HPAGE_SHIFT 22 18#define HPAGE_SHIFT 23
19#define REAL_HPAGE_SHIFT 22
20
21#define REAL_HPAGE_SIZE (_AC(1,UL) << REAL_HPAGE_SHIFT)
19 22
20#if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE) 23#if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE)
21#define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT) 24#define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT)
@@ -53,8 +56,8 @@ extern void copy_user_page(void *to, void *from, unsigned long vaddr, struct pag
53/* These are used to make use of C type-checking.. */ 56/* These are used to make use of C type-checking.. */
54typedef struct { unsigned long pte; } pte_t; 57typedef struct { unsigned long pte; } pte_t;
55typedef struct { unsigned long iopte; } iopte_t; 58typedef struct { unsigned long iopte; } iopte_t;
56typedef struct { unsigned int pmd; } pmd_t; 59typedef struct { unsigned long pmd; } pmd_t;
57typedef struct { unsigned int pgd; } pgd_t; 60typedef struct { unsigned long pgd; } pgd_t;
58typedef struct { unsigned long pgprot; } pgprot_t; 61typedef struct { unsigned long pgprot; } pgprot_t;
59 62
60#define pte_val(x) ((x).pte) 63#define pte_val(x) ((x).pte)
@@ -73,8 +76,8 @@ typedef struct { unsigned long pgprot; } pgprot_t;
73/* .. while these make it easier on the compiler */ 76/* .. while these make it easier on the compiler */
74typedef unsigned long pte_t; 77typedef unsigned long pte_t;
75typedef unsigned long iopte_t; 78typedef unsigned long iopte_t;
76typedef unsigned int pmd_t; 79typedef unsigned long pmd_t;
77typedef unsigned int pgd_t; 80typedef unsigned long pgd_t;
78typedef unsigned long pgprot_t; 81typedef unsigned long pgprot_t;
79 82
80#define pte_val(x) (x) 83#define pte_val(x) (x)
@@ -93,18 +96,44 @@ typedef unsigned long pgprot_t;
93 96
94typedef pte_t *pgtable_t; 97typedef pte_t *pgtable_t;
95 98
99/* These two values define the virtual address space range in which we
100 * must forbid 64-bit user processes from making mappings. It used to
101 * represent precisely the virtual address space hole present in most
102 * early sparc64 chips including UltraSPARC-I. But now it also is
103 * further constrained by the limits of our page tables, which is
104 * 43-bits of virtual address.
105 */
106#define SPARC64_VA_HOLE_TOP _AC(0xfffffc0000000000,UL)
107#define SPARC64_VA_HOLE_BOTTOM _AC(0x0000040000000000,UL)
108
109/* The next two defines specify the actual exclusion region we
110 * enforce, wherein we use a 4GB red zone on each side of the VA hole.
111 */
112#define VA_EXCLUDE_START (SPARC64_VA_HOLE_BOTTOM - (1UL << 32UL))
113#define VA_EXCLUDE_END (SPARC64_VA_HOLE_TOP + (1UL << 32UL))
114
96#define TASK_UNMAPPED_BASE (test_thread_flag(TIF_32BIT) ? \ 115#define TASK_UNMAPPED_BASE (test_thread_flag(TIF_32BIT) ? \
97 (_AC(0x0000000070000000,UL)) : \ 116 _AC(0x0000000070000000,UL) : \
98 (_AC(0xfffff80000000000,UL) + (1UL << 32UL))) 117 VA_EXCLUDE_END)
99 118
100#include <asm-generic/memory_model.h> 119#include <asm-generic/memory_model.h>
101 120
121#define PAGE_OFFSET_BY_BITS(X) (-(_AC(1,UL) << (X)))
122extern unsigned long PAGE_OFFSET;
123
102#endif /* !(__ASSEMBLY__) */ 124#endif /* !(__ASSEMBLY__) */
103 125
104/* We used to stick this into a hard-coded global register (%g4) 126/* The maximum number of physical memory address bits we support, this
105 * but that does not make sense anymore. 127 * is used to size various tables used to manage kernel TLB misses and
128 * also the sparsemem code.
129 */
130#define MAX_PHYS_ADDRESS_BITS 47
131
132/* These two shift counts are used when indexing sparc64_valid_addr_bitmap
133 * and kpte_linear_bitmap.
106 */ 134 */
107#define PAGE_OFFSET _AC(0xFFFFF80000000000,UL) 135#define ILOG2_4MB 22
136#define ILOG2_256MB 28
108 137
109#ifndef __ASSEMBLY__ 138#ifndef __ASSEMBLY__
110 139
diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h
index 36760317814f..8358dc144959 100644
--- a/arch/sparc/include/asm/pgtable_64.h
+++ b/arch/sparc/include/asm/pgtable_64.h
@@ -48,18 +48,18 @@
48/* PMD_SHIFT determines the size of the area a second-level page 48/* PMD_SHIFT determines the size of the area a second-level page
49 * table can map 49 * table can map
50 */ 50 */
51#define PMD_SHIFT (PAGE_SHIFT + (PAGE_SHIFT-4)) 51#define PMD_SHIFT (PAGE_SHIFT + (PAGE_SHIFT-3))
52#define PMD_SIZE (_AC(1,UL) << PMD_SHIFT) 52#define PMD_SIZE (_AC(1,UL) << PMD_SHIFT)
53#define PMD_MASK (~(PMD_SIZE-1)) 53#define PMD_MASK (~(PMD_SIZE-1))
54#define PMD_BITS (PAGE_SHIFT - 2) 54#define PMD_BITS (PAGE_SHIFT - 3)
55 55
56/* PGDIR_SHIFT determines what a third-level page table entry can map */ 56/* PGDIR_SHIFT determines what a third-level page table entry can map */
57#define PGDIR_SHIFT (PAGE_SHIFT + (PAGE_SHIFT-4) + PMD_BITS) 57#define PGDIR_SHIFT (PAGE_SHIFT + (PAGE_SHIFT-3) + PMD_BITS)
58#define PGDIR_SIZE (_AC(1,UL) << PGDIR_SHIFT) 58#define PGDIR_SIZE (_AC(1,UL) << PGDIR_SHIFT)
59#define PGDIR_MASK (~(PGDIR_SIZE-1)) 59#define PGDIR_MASK (~(PGDIR_SIZE-1))
60#define PGDIR_BITS (PAGE_SHIFT - 2) 60#define PGDIR_BITS (PAGE_SHIFT - 3)
61 61
62#if (PGDIR_SHIFT + PGDIR_BITS) != 44 62#if (PGDIR_SHIFT + PGDIR_BITS) != 43
63#error Page table parameters do not cover virtual address space properly. 63#error Page table parameters do not cover virtual address space properly.
64#endif 64#endif
65 65
@@ -67,35 +67,12 @@
67#error PMD_SHIFT must equal HPAGE_SHIFT for transparent huge pages. 67#error PMD_SHIFT must equal HPAGE_SHIFT for transparent huge pages.
68#endif 68#endif
69 69
70/* PMDs point to PTE tables which are 4K aligned. */
71#define PMD_PADDR _AC(0xfffffffe,UL)
72#define PMD_PADDR_SHIFT _AC(11,UL)
73
74#define PMD_ISHUGE _AC(0x00000001,UL)
75
76/* This is the PMD layout when PMD_ISHUGE is set. With 4MB huge
77 * pages, this frees up a bunch of bits in the layout that we can
78 * use for the protection settings and software metadata.
79 */
80#define PMD_HUGE_PADDR _AC(0xfffff800,UL)
81#define PMD_HUGE_PROTBITS _AC(0x000007ff,UL)
82#define PMD_HUGE_PRESENT _AC(0x00000400,UL)
83#define PMD_HUGE_WRITE _AC(0x00000200,UL)
84#define PMD_HUGE_DIRTY _AC(0x00000100,UL)
85#define PMD_HUGE_ACCESSED _AC(0x00000080,UL)
86#define PMD_HUGE_EXEC _AC(0x00000040,UL)
87#define PMD_HUGE_SPLITTING _AC(0x00000020,UL)
88
89/* PGDs point to PMD tables which are 8K aligned. */
90#define PGD_PADDR _AC(0xfffffffc,UL)
91#define PGD_PADDR_SHIFT _AC(11,UL)
92
93#ifndef __ASSEMBLY__ 70#ifndef __ASSEMBLY__
94 71
95#include <linux/sched.h> 72#include <linux/sched.h>
96 73
97/* Entries per page directory level. */ 74/* Entries per page directory level. */
98#define PTRS_PER_PTE (1UL << (PAGE_SHIFT-4)) 75#define PTRS_PER_PTE (1UL << (PAGE_SHIFT-3))
99#define PTRS_PER_PMD (1UL << PMD_BITS) 76#define PTRS_PER_PMD (1UL << PMD_BITS)
100#define PTRS_PER_PGD (1UL << PGDIR_BITS) 77#define PTRS_PER_PGD (1UL << PGDIR_BITS)
101 78
@@ -112,6 +89,7 @@
112#define _PAGE_VALID _AC(0x8000000000000000,UL) /* Valid TTE */ 89#define _PAGE_VALID _AC(0x8000000000000000,UL) /* Valid TTE */
113#define _PAGE_R _AC(0x8000000000000000,UL) /* Keep ref bit uptodate*/ 90#define _PAGE_R _AC(0x8000000000000000,UL) /* Keep ref bit uptodate*/
114#define _PAGE_SPECIAL _AC(0x0200000000000000,UL) /* Special page */ 91#define _PAGE_SPECIAL _AC(0x0200000000000000,UL) /* Special page */
92#define _PAGE_PMD_HUGE _AC(0x0100000000000000,UL) /* Huge page */
115 93
116/* Advertise support for _PAGE_SPECIAL */ 94/* Advertise support for _PAGE_SPECIAL */
117#define __HAVE_ARCH_PTE_SPECIAL 95#define __HAVE_ARCH_PTE_SPECIAL
@@ -125,6 +103,7 @@
125#define _PAGE_IE_4U _AC(0x0800000000000000,UL) /* Invert Endianness */ 103#define _PAGE_IE_4U _AC(0x0800000000000000,UL) /* Invert Endianness */
126#define _PAGE_SOFT2_4U _AC(0x07FC000000000000,UL) /* Software bits, set 2 */ 104#define _PAGE_SOFT2_4U _AC(0x07FC000000000000,UL) /* Software bits, set 2 */
127#define _PAGE_SPECIAL_4U _AC(0x0200000000000000,UL) /* Special page */ 105#define _PAGE_SPECIAL_4U _AC(0x0200000000000000,UL) /* Special page */
106#define _PAGE_PMD_HUGE_4U _AC(0x0100000000000000,UL) /* Huge page */
128#define _PAGE_RES1_4U _AC(0x0002000000000000,UL) /* Reserved */ 107#define _PAGE_RES1_4U _AC(0x0002000000000000,UL) /* Reserved */
129#define _PAGE_SZ32MB_4U _AC(0x0001000000000000,UL) /* (Panther) 32MB page */ 108#define _PAGE_SZ32MB_4U _AC(0x0001000000000000,UL) /* (Panther) 32MB page */
130#define _PAGE_SZ256MB_4U _AC(0x2001000000000000,UL) /* (Panther) 256MB page */ 109#define _PAGE_SZ256MB_4U _AC(0x2001000000000000,UL) /* (Panther) 256MB page */
@@ -155,6 +134,7 @@
155#define _PAGE_READ_4V _AC(0x0800000000000000,UL) /* Readable SW Bit */ 134#define _PAGE_READ_4V _AC(0x0800000000000000,UL) /* Readable SW Bit */
156#define _PAGE_WRITE_4V _AC(0x0400000000000000,UL) /* Writable SW Bit */ 135#define _PAGE_WRITE_4V _AC(0x0400000000000000,UL) /* Writable SW Bit */
157#define _PAGE_SPECIAL_4V _AC(0x0200000000000000,UL) /* Special page */ 136#define _PAGE_SPECIAL_4V _AC(0x0200000000000000,UL) /* Special page */
137#define _PAGE_PMD_HUGE_4V _AC(0x0100000000000000,UL) /* Huge page */
158#define _PAGE_PADDR_4V _AC(0x00FFFFFFFFFFE000,UL) /* paddr[55:13] */ 138#define _PAGE_PADDR_4V _AC(0x00FFFFFFFFFFE000,UL) /* paddr[55:13] */
159#define _PAGE_IE_4V _AC(0x0000000000001000,UL) /* Invert Endianness */ 139#define _PAGE_IE_4V _AC(0x0000000000001000,UL) /* Invert Endianness */
160#define _PAGE_E_4V _AC(0x0000000000000800,UL) /* side-Effect */ 140#define _PAGE_E_4V _AC(0x0000000000000800,UL) /* side-Effect */
@@ -180,6 +160,10 @@
180#define _PAGE_SZBITS_4U _PAGE_SZ8K_4U 160#define _PAGE_SZBITS_4U _PAGE_SZ8K_4U
181#define _PAGE_SZBITS_4V _PAGE_SZ8K_4V 161#define _PAGE_SZBITS_4V _PAGE_SZ8K_4V
182 162
163#if REAL_HPAGE_SHIFT != 22
164#error REAL_HPAGE_SHIFT and _PAGE_SZHUGE_foo must match up
165#endif
166
183#define _PAGE_SZHUGE_4U _PAGE_SZ4MB_4U 167#define _PAGE_SZHUGE_4U _PAGE_SZ4MB_4U
184#define _PAGE_SZHUGE_4V _PAGE_SZ4MB_4V 168#define _PAGE_SZHUGE_4V _PAGE_SZ4MB_4V
185 169
@@ -239,16 +223,13 @@ static inline pte_t pfn_pte(unsigned long pfn, pgprot_t prot)
239#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot)) 223#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot))
240 224
241#ifdef CONFIG_TRANSPARENT_HUGEPAGE 225#ifdef CONFIG_TRANSPARENT_HUGEPAGE
242extern pmd_t pfn_pmd(unsigned long page_nr, pgprot_t pgprot); 226static inline pmd_t pfn_pmd(unsigned long page_nr, pgprot_t pgprot)
243#define mk_pmd(page, pgprot) pfn_pmd(page_to_pfn(page), (pgprot))
244
245extern pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot);
246
247static inline pmd_t pmd_mkhuge(pmd_t pmd)
248{ 227{
249 /* Do nothing, mk_pmd() does this part. */ 228 pte_t pte = pfn_pte(page_nr, pgprot);
250 return pmd; 229
230 return __pmd(pte_val(pte));
251} 231}
232#define mk_pmd(page, pgprot) pfn_pmd(page_to_pfn(page), (pgprot))
252#endif 233#endif
253 234
254/* This one can be done with two shifts. */ 235/* This one can be done with two shifts. */
@@ -309,14 +290,25 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t prot)
309 : "=r" (mask), "=r" (tmp) 290 : "=r" (mask), "=r" (tmp)
310 : "i" (_PAGE_PADDR_4U | _PAGE_MODIFIED_4U | _PAGE_ACCESSED_4U | 291 : "i" (_PAGE_PADDR_4U | _PAGE_MODIFIED_4U | _PAGE_ACCESSED_4U |
311 _PAGE_CP_4U | _PAGE_CV_4U | _PAGE_E_4U | _PAGE_PRESENT_4U | 292 _PAGE_CP_4U | _PAGE_CV_4U | _PAGE_E_4U | _PAGE_PRESENT_4U |
312 _PAGE_SPECIAL), 293 _PAGE_SPECIAL | _PAGE_PMD_HUGE | _PAGE_SZALL_4U),
313 "i" (_PAGE_PADDR_4V | _PAGE_MODIFIED_4V | _PAGE_ACCESSED_4V | 294 "i" (_PAGE_PADDR_4V | _PAGE_MODIFIED_4V | _PAGE_ACCESSED_4V |
314 _PAGE_CP_4V | _PAGE_CV_4V | _PAGE_E_4V | _PAGE_PRESENT_4V | 295 _PAGE_CP_4V | _PAGE_CV_4V | _PAGE_E_4V | _PAGE_PRESENT_4V |
315 _PAGE_SPECIAL)); 296 _PAGE_SPECIAL | _PAGE_PMD_HUGE | _PAGE_SZALL_4V));
316 297
317 return __pte((pte_val(pte) & mask) | (pgprot_val(prot) & ~mask)); 298 return __pte((pte_val(pte) & mask) | (pgprot_val(prot) & ~mask));
318} 299}
319 300
301#ifdef CONFIG_TRANSPARENT_HUGEPAGE
302static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot)
303{
304 pte_t pte = __pte(pmd_val(pmd));
305
306 pte = pte_modify(pte, newprot);
307
308 return __pmd(pte_val(pte));
309}
310#endif
311
320static inline pte_t pgoff_to_pte(unsigned long off) 312static inline pte_t pgoff_to_pte(unsigned long off)
321{ 313{
322 off <<= PAGE_SHIFT; 314 off <<= PAGE_SHIFT;
@@ -357,7 +349,7 @@ static inline pgprot_t pgprot_noncached(pgprot_t prot)
357 */ 349 */
358#define pgprot_noncached pgprot_noncached 350#define pgprot_noncached pgprot_noncached
359 351
360#ifdef CONFIG_HUGETLB_PAGE 352#if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE)
361static inline pte_t pte_mkhuge(pte_t pte) 353static inline pte_t pte_mkhuge(pte_t pte)
362{ 354{
363 unsigned long mask; 355 unsigned long mask;
@@ -375,6 +367,17 @@ static inline pte_t pte_mkhuge(pte_t pte)
375 367
376 return __pte(pte_val(pte) | mask); 368 return __pte(pte_val(pte) | mask);
377} 369}
370#ifdef CONFIG_TRANSPARENT_HUGEPAGE
371static inline pmd_t pmd_mkhuge(pmd_t pmd)
372{
373 pte_t pte = __pte(pmd_val(pmd));
374
375 pte = pte_mkhuge(pte);
376 pte_val(pte) |= _PAGE_PMD_HUGE;
377
378 return __pmd(pte_val(pte));
379}
380#endif
378#endif 381#endif
379 382
380static inline pte_t pte_mkdirty(pte_t pte) 383static inline pte_t pte_mkdirty(pte_t pte)
@@ -626,91 +629,130 @@ static inline unsigned long pte_special(pte_t pte)
626 return pte_val(pte) & _PAGE_SPECIAL; 629 return pte_val(pte) & _PAGE_SPECIAL;
627} 630}
628 631
629static inline int pmd_large(pmd_t pmd) 632static inline unsigned long pmd_large(pmd_t pmd)
630{ 633{
631 return (pmd_val(pmd) & (PMD_ISHUGE | PMD_HUGE_PRESENT)) == 634 pte_t pte = __pte(pmd_val(pmd));
632 (PMD_ISHUGE | PMD_HUGE_PRESENT); 635
636 return (pte_val(pte) & _PAGE_PMD_HUGE) && pte_present(pte);
633} 637}
634 638
635#ifdef CONFIG_TRANSPARENT_HUGEPAGE 639#ifdef CONFIG_TRANSPARENT_HUGEPAGE
636static inline int pmd_young(pmd_t pmd) 640static inline unsigned long pmd_young(pmd_t pmd)
637{ 641{
638 return pmd_val(pmd) & PMD_HUGE_ACCESSED; 642 pte_t pte = __pte(pmd_val(pmd));
643
644 return pte_young(pte);
639} 645}
640 646
641static inline int pmd_write(pmd_t pmd) 647static inline unsigned long pmd_write(pmd_t pmd)
642{ 648{
643 return pmd_val(pmd) & PMD_HUGE_WRITE; 649 pte_t pte = __pte(pmd_val(pmd));
650
651 return pte_write(pte);
644} 652}
645 653
646static inline unsigned long pmd_pfn(pmd_t pmd) 654static inline unsigned long pmd_pfn(pmd_t pmd)
647{ 655{
648 unsigned long val = pmd_val(pmd) & PMD_HUGE_PADDR; 656 pte_t pte = __pte(pmd_val(pmd));
649 657
650 return val >> (PAGE_SHIFT - PMD_PADDR_SHIFT); 658 return pte_pfn(pte);
651} 659}
652 660
653static inline int pmd_trans_splitting(pmd_t pmd) 661static inline unsigned long pmd_trans_huge(pmd_t pmd)
654{ 662{
655 return (pmd_val(pmd) & (PMD_ISHUGE|PMD_HUGE_SPLITTING)) == 663 pte_t pte = __pte(pmd_val(pmd));
656 (PMD_ISHUGE|PMD_HUGE_SPLITTING); 664
665 return pte_val(pte) & _PAGE_PMD_HUGE;
657} 666}
658 667
659static inline int pmd_trans_huge(pmd_t pmd) 668static inline unsigned long pmd_trans_splitting(pmd_t pmd)
660{ 669{
661 return pmd_val(pmd) & PMD_ISHUGE; 670 pte_t pte = __pte(pmd_val(pmd));
671
672 return pmd_trans_huge(pmd) && pte_special(pte);
662} 673}
663 674
664#define has_transparent_hugepage() 1 675#define has_transparent_hugepage() 1
665 676
666static inline pmd_t pmd_mkold(pmd_t pmd) 677static inline pmd_t pmd_mkold(pmd_t pmd)
667{ 678{
668 pmd_val(pmd) &= ~PMD_HUGE_ACCESSED; 679 pte_t pte = __pte(pmd_val(pmd));
669 return pmd; 680
681 pte = pte_mkold(pte);
682
683 return __pmd(pte_val(pte));
670} 684}
671 685
672static inline pmd_t pmd_wrprotect(pmd_t pmd) 686static inline pmd_t pmd_wrprotect(pmd_t pmd)
673{ 687{
674 pmd_val(pmd) &= ~PMD_HUGE_WRITE; 688 pte_t pte = __pte(pmd_val(pmd));
675 return pmd; 689
690 pte = pte_wrprotect(pte);
691
692 return __pmd(pte_val(pte));
676} 693}
677 694
678static inline pmd_t pmd_mkdirty(pmd_t pmd) 695static inline pmd_t pmd_mkdirty(pmd_t pmd)
679{ 696{
680 pmd_val(pmd) |= PMD_HUGE_DIRTY; 697 pte_t pte = __pte(pmd_val(pmd));
681 return pmd; 698
699 pte = pte_mkdirty(pte);
700
701 return __pmd(pte_val(pte));
682} 702}
683 703
684static inline pmd_t pmd_mkyoung(pmd_t pmd) 704static inline pmd_t pmd_mkyoung(pmd_t pmd)
685{ 705{
686 pmd_val(pmd) |= PMD_HUGE_ACCESSED; 706 pte_t pte = __pte(pmd_val(pmd));
687 return pmd; 707
708 pte = pte_mkyoung(pte);
709
710 return __pmd(pte_val(pte));
688} 711}
689 712
690static inline pmd_t pmd_mkwrite(pmd_t pmd) 713static inline pmd_t pmd_mkwrite(pmd_t pmd)
691{ 714{
692 pmd_val(pmd) |= PMD_HUGE_WRITE; 715 pte_t pte = __pte(pmd_val(pmd));
693 return pmd; 716
717 pte = pte_mkwrite(pte);
718
719 return __pmd(pte_val(pte));
694} 720}
695 721
696static inline pmd_t pmd_mknotpresent(pmd_t pmd) 722static inline pmd_t pmd_mknotpresent(pmd_t pmd)
697{ 723{
698 pmd_val(pmd) &= ~PMD_HUGE_PRESENT; 724 unsigned long mask;
725
726 if (tlb_type == hypervisor)
727 mask = _PAGE_PRESENT_4V;
728 else
729 mask = _PAGE_PRESENT_4U;
730
731 pmd_val(pmd) &= ~mask;
732
699 return pmd; 733 return pmd;
700} 734}
701 735
702static inline pmd_t pmd_mksplitting(pmd_t pmd) 736static inline pmd_t pmd_mksplitting(pmd_t pmd)
703{ 737{
704 pmd_val(pmd) |= PMD_HUGE_SPLITTING; 738 pte_t pte = __pte(pmd_val(pmd));
705 return pmd; 739
740 pte = pte_mkspecial(pte);
741
742 return __pmd(pte_val(pte));
706} 743}
707 744
708extern pgprot_t pmd_pgprot(pmd_t entry); 745static inline pgprot_t pmd_pgprot(pmd_t entry)
746{
747 unsigned long val = pmd_val(entry);
748
749 return __pgprot(val);
750}
709#endif 751#endif
710 752
711static inline int pmd_present(pmd_t pmd) 753static inline int pmd_present(pmd_t pmd)
712{ 754{
713 return pmd_val(pmd) != 0U; 755 return pmd_val(pmd) != 0UL;
714} 756}
715 757
716#define pmd_none(pmd) (!pmd_val(pmd)) 758#define pmd_none(pmd) (!pmd_val(pmd))
@@ -728,33 +770,32 @@ static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr,
728 770
729static inline void pmd_set(struct mm_struct *mm, pmd_t *pmdp, pte_t *ptep) 771static inline void pmd_set(struct mm_struct *mm, pmd_t *pmdp, pte_t *ptep)
730{ 772{
731 unsigned long val = __pa((unsigned long) (ptep)) >> PMD_PADDR_SHIFT; 773 unsigned long val = __pa((unsigned long) (ptep));
732 774
733 pmd_val(*pmdp) = val; 775 pmd_val(*pmdp) = val;
734} 776}
735 777
736#define pud_set(pudp, pmdp) \ 778#define pud_set(pudp, pmdp) \
737 (pud_val(*(pudp)) = (__pa((unsigned long) (pmdp)) >> PGD_PADDR_SHIFT)) 779 (pud_val(*(pudp)) = (__pa((unsigned long) (pmdp))))
738static inline unsigned long __pmd_page(pmd_t pmd) 780static inline unsigned long __pmd_page(pmd_t pmd)
739{ 781{
740 unsigned long paddr = (unsigned long) pmd_val(pmd); 782 pte_t pte = __pte(pmd_val(pmd));
741#ifdef CONFIG_TRANSPARENT_HUGEPAGE 783 unsigned long pfn;
742 if (pmd_val(pmd) & PMD_ISHUGE) 784
743 paddr &= PMD_HUGE_PADDR; 785 pfn = pte_pfn(pte);
744#endif 786
745 paddr <<= PMD_PADDR_SHIFT; 787 return ((unsigned long) __va(pfn << PAGE_SHIFT));
746 return ((unsigned long) __va(paddr));
747} 788}
748#define pmd_page(pmd) virt_to_page((void *)__pmd_page(pmd)) 789#define pmd_page(pmd) virt_to_page((void *)__pmd_page(pmd))
749#define pud_page_vaddr(pud) \ 790#define pud_page_vaddr(pud) \
750 ((unsigned long) __va((((unsigned long)pud_val(pud))<<PGD_PADDR_SHIFT))) 791 ((unsigned long) __va(pud_val(pud)))
751#define pud_page(pud) virt_to_page((void *)pud_page_vaddr(pud)) 792#define pud_page(pud) virt_to_page((void *)pud_page_vaddr(pud))
752#define pmd_bad(pmd) (0) 793#define pmd_bad(pmd) (0)
753#define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0U) 794#define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0UL)
754#define pud_none(pud) (!pud_val(pud)) 795#define pud_none(pud) (!pud_val(pud))
755#define pud_bad(pud) (0) 796#define pud_bad(pud) (0)
756#define pud_present(pud) (pud_val(pud) != 0U) 797#define pud_present(pud) (pud_val(pud) != 0U)
757#define pud_clear(pudp) (pud_val(*(pudp)) = 0U) 798#define pud_clear(pudp) (pud_val(*(pudp)) = 0UL)
758 799
759/* Same in both SUN4V and SUN4U. */ 800/* Same in both SUN4V and SUN4U. */
760#define pte_none(pte) (!pte_val(pte)) 801#define pte_none(pte) (!pte_val(pte))
@@ -789,7 +830,7 @@ static inline pmd_t pmdp_get_and_clear(struct mm_struct *mm,
789 pmd_t *pmdp) 830 pmd_t *pmdp)
790{ 831{
791 pmd_t pmd = *pmdp; 832 pmd_t pmd = *pmdp;
792 set_pmd_at(mm, addr, pmdp, __pmd(0U)); 833 set_pmd_at(mm, addr, pmdp, __pmd(0UL));
793 return pmd; 834 return pmd;
794} 835}
795 836
@@ -837,8 +878,8 @@ static inline void __set_pte_at(struct mm_struct *mm, unsigned long addr,
837}) 878})
838#endif 879#endif
839 880
840extern pgd_t swapper_pg_dir[2048]; 881extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
841extern pmd_t swapper_low_pmd_dir[2048]; 882extern pmd_t swapper_low_pmd_dir[PTRS_PER_PMD];
842 883
843extern void paging_init(void); 884extern void paging_init(void);
844extern unsigned long find_ecache_flush_span(unsigned long size); 885extern unsigned long find_ecache_flush_span(unsigned long size);
diff --git a/arch/sparc/include/asm/prom.h b/arch/sparc/include/asm/prom.h
index 67c62578d170..11ebd659e7b6 100644
--- a/arch/sparc/include/asm/prom.h
+++ b/arch/sparc/include/asm/prom.h
@@ -43,10 +43,6 @@ extern int of_getintprop_default(struct device_node *np,
43 const char *name, 43 const char *name,
44 int def); 44 int def);
45extern int of_find_in_proplist(const char *list, const char *match, int len); 45extern int of_find_in_proplist(const char *list, const char *match, int len);
46#ifdef CONFIG_NUMA
47extern int of_node_to_nid(struct device_node *dp);
48#define of_node_to_nid of_node_to_nid
49#endif
50 46
51extern void prom_build_devicetree(void); 47extern void prom_build_devicetree(void);
52extern void of_populate_present_mask(void); 48extern void of_populate_present_mask(void);
@@ -63,13 +59,5 @@ extern char *of_console_options;
63extern void irq_trans_init(struct device_node *dp); 59extern void irq_trans_init(struct device_node *dp);
64extern char *build_path_component(struct device_node *dp); 60extern char *build_path_component(struct device_node *dp);
65 61
66/* SPARC has local implementations */
67extern int of_address_to_resource(struct device_node *dev, int index,
68 struct resource *r);
69#define of_address_to_resource of_address_to_resource
70
71void __iomem *of_iomap(struct device_node *node, int index);
72#define of_iomap of_iomap
73
74#endif /* __KERNEL__ */ 62#endif /* __KERNEL__ */
75#endif /* _SPARC_PROM_H */ 63#endif /* _SPARC_PROM_H */
diff --git a/arch/sparc/include/asm/sparsemem.h b/arch/sparc/include/asm/sparsemem.h
index b99d4e4b6d28..e5e1752d5d78 100644
--- a/arch/sparc/include/asm/sparsemem.h
+++ b/arch/sparc/include/asm/sparsemem.h
@@ -3,9 +3,11 @@
3 3
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5 5
6#include <asm/page.h>
7
6#define SECTION_SIZE_BITS 30 8#define SECTION_SIZE_BITS 30
7#define MAX_PHYSADDR_BITS 42 9#define MAX_PHYSADDR_BITS MAX_PHYS_ADDRESS_BITS
8#define MAX_PHYSMEM_BITS 42 10#define MAX_PHYSMEM_BITS MAX_PHYS_ADDRESS_BITS
9 11
10#endif /* !(__KERNEL__) */ 12#endif /* !(__KERNEL__) */
11 13
diff --git a/arch/sparc/include/asm/thread_info_64.h b/arch/sparc/include/asm/thread_info_64.h
index d5e504251079..5d9292ab1077 100644
--- a/arch/sparc/include/asm/thread_info_64.h
+++ b/arch/sparc/include/asm/thread_info_64.h
@@ -192,7 +192,7 @@ register struct thread_info *current_thread_info_reg asm("g6");
192#define TIF_UNALIGNED 5 /* allowed to do unaligned accesses */ 192#define TIF_UNALIGNED 5 /* allowed to do unaligned accesses */
193/* flag bit 6 is available */ 193/* flag bit 6 is available */
194#define TIF_32BIT 7 /* 32-bit binary */ 194#define TIF_32BIT 7 /* 32-bit binary */
195/* flag bit 8 is available */ 195#define TIF_NOHZ 8 /* in adaptive nohz mode */
196#define TIF_SECCOMP 9 /* secure computing */ 196#define TIF_SECCOMP 9 /* secure computing */
197#define TIF_SYSCALL_AUDIT 10 /* syscall auditing active */ 197#define TIF_SYSCALL_AUDIT 10 /* syscall auditing active */
198#define TIF_SYSCALL_TRACEPOINT 11 /* syscall tracepoint instrumentation */ 198#define TIF_SYSCALL_TRACEPOINT 11 /* syscall tracepoint instrumentation */
@@ -210,6 +210,7 @@ register struct thread_info *current_thread_info_reg asm("g6");
210#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) 210#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
211#define _TIF_UNALIGNED (1<<TIF_UNALIGNED) 211#define _TIF_UNALIGNED (1<<TIF_UNALIGNED)
212#define _TIF_32BIT (1<<TIF_32BIT) 212#define _TIF_32BIT (1<<TIF_32BIT)
213#define _TIF_NOHZ (1<<TIF_NOHZ)
213#define _TIF_SECCOMP (1<<TIF_SECCOMP) 214#define _TIF_SECCOMP (1<<TIF_SECCOMP)
214#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) 215#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
215#define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT) 216#define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT)
diff --git a/arch/sparc/include/asm/tsb.h b/arch/sparc/include/asm/tsb.h
index e696432b950d..2230f80d9fe3 100644
--- a/arch/sparc/include/asm/tsb.h
+++ b/arch/sparc/include/asm/tsb.h
@@ -142,98 +142,39 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
142 or REG1, %lo(swapper_pg_dir), REG1; \ 142 or REG1, %lo(swapper_pg_dir), REG1; \
143 sllx VADDR, 64 - (PGDIR_SHIFT + PGDIR_BITS), REG2; \ 143 sllx VADDR, 64 - (PGDIR_SHIFT + PGDIR_BITS), REG2; \
144 srlx REG2, 64 - PAGE_SHIFT, REG2; \ 144 srlx REG2, 64 - PAGE_SHIFT, REG2; \
145 andn REG2, 0x3, REG2; \ 145 andn REG2, 0x7, REG2; \
146 lduw [REG1 + REG2], REG1; \ 146 ldx [REG1 + REG2], REG1; \
147 brz,pn REG1, FAIL_LABEL; \ 147 brz,pn REG1, FAIL_LABEL; \
148 sllx VADDR, 64 - (PMD_SHIFT + PMD_BITS), REG2; \ 148 sllx VADDR, 64 - (PMD_SHIFT + PMD_BITS), REG2; \
149 srlx REG2, 64 - PAGE_SHIFT, REG2; \ 149 srlx REG2, 64 - PAGE_SHIFT, REG2; \
150 sllx REG1, PGD_PADDR_SHIFT, REG1; \ 150 andn REG2, 0x7, REG2; \
151 andn REG2, 0x3, REG2; \ 151 ldxa [REG1 + REG2] ASI_PHYS_USE_EC, REG1; \
152 lduwa [REG1 + REG2] ASI_PHYS_USE_EC, REG1; \
153 brz,pn REG1, FAIL_LABEL; \ 152 brz,pn REG1, FAIL_LABEL; \
154 sllx VADDR, 64 - PMD_SHIFT, REG2; \ 153 sllx VADDR, 64 - PMD_SHIFT, REG2; \
155 srlx REG2, 64 - (PAGE_SHIFT - 1), REG2; \ 154 srlx REG2, 64 - PAGE_SHIFT, REG2; \
156 sllx REG1, PMD_PADDR_SHIFT, REG1; \
157 andn REG2, 0x7, REG2; \ 155 andn REG2, 0x7, REG2; \
158 add REG1, REG2, REG1; 156 add REG1, REG2, REG1;
159 157
160 /* These macros exists only to make the PMD translator below
161 * easier to read. It hides the ELF section switch for the
162 * sun4v code patching.
163 */
164#define OR_PTE_BIT_1INSN(REG, NAME) \
165661: or REG, _PAGE_##NAME##_4U, REG; \
166 .section .sun4v_1insn_patch, "ax"; \
167 .word 661b; \
168 or REG, _PAGE_##NAME##_4V, REG; \
169 .previous;
170
171#define OR_PTE_BIT_2INSN(REG, TMP, NAME) \
172661: sethi %hi(_PAGE_##NAME##_4U), TMP; \
173 or REG, TMP, REG; \
174 .section .sun4v_2insn_patch, "ax"; \
175 .word 661b; \
176 mov -1, TMP; \
177 or REG, _PAGE_##NAME##_4V, REG; \
178 .previous;
179
180 /* Load into REG the PTE value for VALID, CACHE, and SZHUGE. */
181#define BUILD_PTE_VALID_SZHUGE_CACHE(REG) \
182661: sethi %uhi(_PAGE_VALID|_PAGE_SZHUGE_4U), REG; \
183 .section .sun4v_1insn_patch, "ax"; \
184 .word 661b; \
185 sethi %uhi(_PAGE_VALID), REG; \
186 .previous; \
187 sllx REG, 32, REG; \
188661: or REG, _PAGE_CP_4U|_PAGE_CV_4U, REG; \
189 .section .sun4v_1insn_patch, "ax"; \
190 .word 661b; \
191 or REG, _PAGE_CP_4V|_PAGE_CV_4V|_PAGE_SZHUGE_4V, REG; \
192 .previous;
193
194 /* PMD has been loaded into REG1, interpret the value, seeing 158 /* PMD has been loaded into REG1, interpret the value, seeing
195 * if it is a HUGE PMD or a normal one. If it is not valid 159 * if it is a HUGE PMD or a normal one. If it is not valid
196 * then jump to FAIL_LABEL. If it is a HUGE PMD, and it 160 * then jump to FAIL_LABEL. If it is a HUGE PMD, and it
197 * translates to a valid PTE, branch to PTE_LABEL. 161 * translates to a valid PTE, branch to PTE_LABEL.
198 * 162 *
199 * We translate the PMD by hand, one bit at a time, 163 * We have to propagate the 4MB bit of the virtual address
200 * constructing the huge PTE. 164 * because we are fabricating 8MB pages using 4MB hw pages.
201 *
202 * So we construct the PTE in REG2 as follows:
203 *
204 * 1) Extract the PMD PFN from REG1 and place it into REG2.
205 *
206 * 2) Translate PMD protection bits in REG1 into REG2, one bit
207 * at a time using andcc tests on REG1 and OR's into REG2.
208 *
209 * Only two bits to be concerned with here, EXEC and WRITE.
210 * Now REG1 is freed up and we can use it as a temporary.
211 *
212 * 3) Construct the VALID, CACHE, and page size PTE bits in
213 * REG1, OR with REG2 to form final PTE.
214 */ 165 */
215#ifdef CONFIG_TRANSPARENT_HUGEPAGE 166#ifdef CONFIG_TRANSPARENT_HUGEPAGE
216#define USER_PGTABLE_CHECK_PMD_HUGE(VADDR, REG1, REG2, FAIL_LABEL, PTE_LABEL) \ 167#define USER_PGTABLE_CHECK_PMD_HUGE(VADDR, REG1, REG2, FAIL_LABEL, PTE_LABEL) \
217 brz,pn REG1, FAIL_LABEL; \ 168 brz,pn REG1, FAIL_LABEL; \
218 andcc REG1, PMD_ISHUGE, %g0; \ 169 sethi %uhi(_PAGE_PMD_HUGE), REG2; \
219 be,pt %xcc, 700f; \ 170 sllx REG2, 32, REG2; \
220 and REG1, PMD_HUGE_PRESENT|PMD_HUGE_ACCESSED, REG2; \ 171 andcc REG1, REG2, %g0; \
221 cmp REG2, PMD_HUGE_PRESENT|PMD_HUGE_ACCESSED; \ 172 be,pt %xcc, 700f; \
222 bne,pn %xcc, FAIL_LABEL; \ 173 sethi %hi(4 * 1024 * 1024), REG2; \
223 andn REG1, PMD_HUGE_PROTBITS, REG2; \ 174 andn REG1, REG2, REG1; \
224 sllx REG2, PMD_PADDR_SHIFT, REG2; \ 175 and VADDR, REG2, REG2; \
225 /* REG2 now holds PFN << PAGE_SHIFT */ \ 176 brlz,pt REG1, PTE_LABEL; \
226 andcc REG1, PMD_HUGE_WRITE, %g0; \ 177 or REG1, REG2, REG1; \
227 bne,a,pt %xcc, 1f; \
228 OR_PTE_BIT_1INSN(REG2, W); \
2291: andcc REG1, PMD_HUGE_EXEC, %g0; \
230 be,pt %xcc, 1f; \
231 nop; \
232 OR_PTE_BIT_2INSN(REG2, REG1, EXEC); \
233 /* REG1 can now be clobbered, build final PTE */ \
2341: BUILD_PTE_VALID_SZHUGE_CACHE(REG1); \
235 ba,pt %xcc, PTE_LABEL; \
236 or REG1, REG2, REG1; \
237700: 178700:
238#else 179#else
239#define USER_PGTABLE_CHECK_PMD_HUGE(VADDR, REG1, REG2, FAIL_LABEL, PTE_LABEL) \ 180#define USER_PGTABLE_CHECK_PMD_HUGE(VADDR, REG1, REG2, FAIL_LABEL, PTE_LABEL) \
@@ -253,18 +194,16 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
253#define USER_PGTABLE_WALK_TL1(VADDR, PHYS_PGD, REG1, REG2, FAIL_LABEL) \ 194#define USER_PGTABLE_WALK_TL1(VADDR, PHYS_PGD, REG1, REG2, FAIL_LABEL) \
254 sllx VADDR, 64 - (PGDIR_SHIFT + PGDIR_BITS), REG2; \ 195 sllx VADDR, 64 - (PGDIR_SHIFT + PGDIR_BITS), REG2; \
255 srlx REG2, 64 - PAGE_SHIFT, REG2; \ 196 srlx REG2, 64 - PAGE_SHIFT, REG2; \
256 andn REG2, 0x3, REG2; \ 197 andn REG2, 0x7, REG2; \
257 lduwa [PHYS_PGD + REG2] ASI_PHYS_USE_EC, REG1; \ 198 ldxa [PHYS_PGD + REG2] ASI_PHYS_USE_EC, REG1; \
258 brz,pn REG1, FAIL_LABEL; \ 199 brz,pn REG1, FAIL_LABEL; \
259 sllx VADDR, 64 - (PMD_SHIFT + PMD_BITS), REG2; \ 200 sllx VADDR, 64 - (PMD_SHIFT + PMD_BITS), REG2; \
260 srlx REG2, 64 - PAGE_SHIFT, REG2; \ 201 srlx REG2, 64 - PAGE_SHIFT, REG2; \
261 sllx REG1, PGD_PADDR_SHIFT, REG1; \ 202 andn REG2, 0x7, REG2; \
262 andn REG2, 0x3, REG2; \ 203 ldxa [REG1 + REG2] ASI_PHYS_USE_EC, REG1; \
263 lduwa [REG1 + REG2] ASI_PHYS_USE_EC, REG1; \
264 USER_PGTABLE_CHECK_PMD_HUGE(VADDR, REG1, REG2, FAIL_LABEL, 800f) \ 204 USER_PGTABLE_CHECK_PMD_HUGE(VADDR, REG1, REG2, FAIL_LABEL, 800f) \
265 sllx VADDR, 64 - PMD_SHIFT, REG2; \ 205 sllx VADDR, 64 - PMD_SHIFT, REG2; \
266 srlx REG2, 64 - (PAGE_SHIFT - 1), REG2; \ 206 srlx REG2, 64 - PAGE_SHIFT, REG2; \
267 sllx REG1, PMD_PADDR_SHIFT, REG1; \
268 andn REG2, 0x7, REG2; \ 207 andn REG2, 0x7, REG2; \
269 add REG1, REG2, REG1; \ 208 add REG1, REG2, REG1; \
270 ldxa [REG1] ASI_PHYS_USE_EC, REG1; \ 209 ldxa [REG1] ASI_PHYS_USE_EC, REG1; \
diff --git a/arch/sparc/include/uapi/asm/errno.h b/arch/sparc/include/uapi/asm/errno.h
index c351aba997b7..20423e172853 100644
--- a/arch/sparc/include/uapi/asm/errno.h
+++ b/arch/sparc/include/uapi/asm/errno.h
@@ -40,7 +40,7 @@
40#define EPROCLIM 67 /* SUNOS: Too many processes */ 40#define EPROCLIM 67 /* SUNOS: Too many processes */
41#define EUSERS 68 /* Too many users */ 41#define EUSERS 68 /* Too many users */
42#define EDQUOT 69 /* Quota exceeded */ 42#define EDQUOT 69 /* Quota exceeded */
43#define ESTALE 70 /* Stale NFS file handle */ 43#define ESTALE 70 /* Stale file handle */
44#define EREMOTE 71 /* Object is remote */ 44#define EREMOTE 71 /* Object is remote */
45#define ENOSTR 72 /* Device not a stream */ 45#define ENOSTR 72 /* Device not a stream */
46#define ETIME 73 /* Timer expired */ 46#define ETIME 73 /* Timer expired */
diff --git a/arch/sparc/include/uapi/asm/socket.h b/arch/sparc/include/uapi/asm/socket.h
index 4e1d66c3ce71..0f21e9a5ca18 100644
--- a/arch/sparc/include/uapi/asm/socket.h
+++ b/arch/sparc/include/uapi/asm/socket.h
@@ -72,6 +72,8 @@
72 72
73#define SO_BUSY_POLL 0x0030 73#define SO_BUSY_POLL 0x0030
74 74
75#define SO_MAX_PACING_RATE 0x0031
76
75/* Security levels - as per NRL IPv6 - don't actually do anything */ 77/* Security levels - as per NRL IPv6 - don't actually do anything */
76#define SO_SECURITY_AUTHENTICATION 0x5001 78#define SO_SECURITY_AUTHENTICATION 0x5001
77#define SO_SECURITY_ENCRYPTION_TRANSPORT 0x5002 79#define SO_SECURITY_ENCRYPTION_TRANSPORT 0x5002