Skip to content

Commit 9ca4c64

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc
Pull sparc updates from David Miller: 1) Add a proper .exit.data section. 2) Fix ipc64_perm type definition, from Arnd Bergmann. 3) Support folded p4d page tables on sparc64, from Mike Rapport. 4) Remove uses of struct timex, also from Arnd Bergmann. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc: y2038: sparc: remove use of struct timex sparc64: add support for folded p4d page tables sparc/console: kill off obsolete declarations sparc32: fix struct ipc64_perm type definition sparc32, leon: Stop adding vendor and device id to prom ambapp path components sparc: Add .exit.data section. sparc: remove unneeded uapi/asm/statfs.h
2 parents 11f2534 + d68712e commit 9ca4c64

File tree

12 files changed

+103
-68
lines changed

12 files changed

+103
-68
lines changed

arch/sparc/include/asm/pgalloc_64.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616

1717
extern struct kmem_cache *pgtable_cache;
1818

19-
static inline void __pgd_populate(pgd_t *pgd, pud_t *pud)
19+
static inline void __p4d_populate(p4d_t *p4d, pud_t *pud)
2020
{
21-
pgd_set(pgd, pud);
21+
p4d_set(p4d, pud);
2222
}
2323

24-
#define pgd_populate(MM, PGD, PUD) __pgd_populate(PGD, PUD)
24+
#define p4d_populate(MM, P4D, PUD) __p4d_populate(P4D, PUD)
2525

2626
static inline pgd_t *pgd_alloc(struct mm_struct *mm)
2727
{

arch/sparc/include/asm/pgtable_64.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* the SpitFire page tables.
1414
*/
1515

16-
#include <asm-generic/5level-fixup.h>
16+
#include <asm-generic/pgtable-nop4d.h>
1717
#include <linux/compiler.h>
1818
#include <linux/const.h>
1919
#include <asm/types.h>
@@ -810,9 +810,9 @@ static inline int pmd_present(pmd_t pmd)
810810

811811
#define pud_bad(pud) (pud_val(pud) & ~PAGE_MASK)
812812

813-
#define pgd_none(pgd) (!pgd_val(pgd))
813+
#define p4d_none(p4d) (!p4d_val(p4d))
814814

815-
#define pgd_bad(pgd) (pgd_val(pgd) & ~PAGE_MASK)
815+
#define p4d_bad(p4d) (p4d_val(p4d) & ~PAGE_MASK)
816816

817817
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
818818
void set_pmd_at(struct mm_struct *mm, unsigned long addr,
@@ -859,13 +859,13 @@ static inline unsigned long pud_page_vaddr(pud_t pud)
859859
#define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0UL)
860860
#define pud_present(pud) (pud_val(pud) != 0U)
861861
#define pud_clear(pudp) (pud_val(*(pudp)) = 0UL)
862-
#define pgd_page_vaddr(pgd) \
863-
((unsigned long) __va(pgd_val(pgd)))
864-
#define pgd_present(pgd) (pgd_val(pgd) != 0U)
865-
#define pgd_clear(pgdp) (pgd_val(*(pgdp)) = 0UL)
862+
#define p4d_page_vaddr(p4d) \
863+
((unsigned long) __va(p4d_val(p4d)))
864+
#define p4d_present(p4d) (p4d_val(p4d) != 0U)
865+
#define p4d_clear(p4dp) (p4d_val(*(p4dp)) = 0UL)
866866

867867
/* only used by the stubbed out hugetlb gup code, should never be called */
868-
#define pgd_page(pgd) NULL
868+
#define p4d_page(p4d) NULL
869869

870870
static inline unsigned long pud_large(pud_t pud)
871871
{
@@ -884,8 +884,8 @@ static inline unsigned long pud_pfn(pud_t pud)
884884
/* Same in both SUN4V and SUN4U. */
885885
#define pte_none(pte) (!pte_val(pte))
886886

887-
#define pgd_set(pgdp, pudp) \
888-
(pgd_val(*(pgdp)) = (__pa((unsigned long) (pudp))))
887+
#define p4d_set(p4dp, pudp) \
888+
(p4d_val(*(p4dp)) = (__pa((unsigned long) (pudp))))
889889

890890
/* to find an entry in a page-table-directory. */
891891
#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1))
@@ -896,8 +896,8 @@ static inline unsigned long pud_pfn(pud_t pud)
896896

897897
/* Find an entry in the third-level page table.. */
898898
#define pud_index(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD - 1))
899-
#define pud_offset(pgdp, address) \
900-
((pud_t *) pgd_page_vaddr(*(pgdp)) + pud_index(address))
899+
#define pud_offset(p4dp, address) \
900+
((pud_t *) p4d_page_vaddr(*(p4dp)) + pud_index(address))
901901

902902
/* Find an entry in the second-level page table.. */
903903
#define pmd_offset(pudp, address) \

arch/sparc/include/uapi/asm/ipcbuf.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@
1717

1818
struct ipc64_perm
1919
{
20-
__kernel_key_t key;
21-
__kernel_uid_t uid;
22-
__kernel_gid_t gid;
23-
__kernel_uid_t cuid;
24-
__kernel_gid_t cgid;
20+
__kernel_key_t key;
21+
__kernel_uid32_t uid;
22+
__kernel_gid32_t gid;
23+
__kernel_uid32_t cuid;
24+
__kernel_gid32_t cgid;
2525
#ifndef __arch64__
26-
unsigned short __pad0;
26+
unsigned short __pad0;
2727
#endif
28-
__kernel_mode_t mode;
29-
unsigned short __pad1;
30-
unsigned short seq;
31-
unsigned long long __unused1;
32-
unsigned long long __unused2;
28+
__kernel_mode_t mode;
29+
unsigned short __pad1;
30+
unsigned short seq;
31+
unsigned long long __unused1;
32+
unsigned long long __unused2;
3333
};
3434

3535
#endif /* __SPARC_IPCBUF_H */

arch/sparc/include/uapi/asm/statfs.h

Lines changed: 0 additions & 7 deletions
This file was deleted.

arch/sparc/kernel/prom_32.c

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,13 @@ static void __init ebus_path_component(struct device_node *dp, char *tmp_buf)
132132
regs->which_io, regs->phys_addr);
133133
}
134134

135-
/* "name:vendor:device@irq,addrlo" */
135+
/* "name@irq,addrlo" */
136136
static void __init ambapp_path_component(struct device_node *dp, char *tmp_buf)
137137
{
138138
const char *name = of_get_property(dp, "name", NULL);
139139
struct amba_prom_registers *regs;
140-
unsigned int *intr, *device, *vendor, reg0;
140+
unsigned int *intr;
141+
unsigned int reg0;
141142
struct property *prop;
142143
int interrupt = 0;
143144

@@ -159,18 +160,7 @@ static void __init ambapp_path_component(struct device_node *dp, char *tmp_buf)
159160
else
160161
intr = prop->value;
161162

162-
prop = of_find_property(dp, "vendor", NULL);
163-
if (!prop)
164-
return;
165-
vendor = prop->value;
166-
prop = of_find_property(dp, "device", NULL);
167-
if (!prop)
168-
return;
169-
device = prop->value;
170-
171-
sprintf(tmp_buf, "%s:%d:%d@%x,%x",
172-
name, *vendor, *device,
173-
*intr, reg0);
163+
sprintf(tmp_buf, "%s@%x,%x", name, *intr, reg0);
174164
}
175165

176166
static void __init __build_path_component(struct device_node *dp, char *tmp_buf)

arch/sparc/kernel/signal32.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ static void flush_signal_insns(unsigned long address)
299299
unsigned long pstate, paddr;
300300
pte_t *ptep, pte;
301301
pgd_t *pgdp;
302+
p4d_t *p4dp;
302303
pud_t *pudp;
303304
pmd_t *pmdp;
304305

@@ -318,7 +319,10 @@ static void flush_signal_insns(unsigned long address)
318319
pgdp = pgd_offset(current->mm, address);
319320
if (pgd_none(*pgdp))
320321
goto out_irqs_on;
321-
pudp = pud_offset(pgdp, address);
322+
p4dp = p4d_offset(pgdp, address);
323+
if (p4d_none(*p4dp))
324+
goto out_irqs_on;
325+
pudp = pud_offset(p4dp, address);
322326
if (pud_none(*pudp))
323327
goto out_irqs_on;
324328
pmdp = pmd_offset(pudp, address);

arch/sparc/kernel/smp_64.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1621,6 +1621,7 @@ static int __init pcpu_cpu_distance(unsigned int from, unsigned int to)
16211621
static void __init pcpu_populate_pte(unsigned long addr)
16221622
{
16231623
pgd_t *pgd = pgd_offset_k(addr);
1624+
p4d_t *p4d;
16241625
pud_t *pud;
16251626
pmd_t *pmd;
16261627

@@ -1633,7 +1634,17 @@ static void __init pcpu_populate_pte(unsigned long addr)
16331634
pgd_populate(&init_mm, pgd, new);
16341635
}
16351636

1636-
pud = pud_offset(pgd, addr);
1637+
p4d = p4d_offset(pgd, addr);
1638+
if (p4d_none(*p4d)) {
1639+
pud_t *new;
1640+
1641+
new = memblock_alloc_from(PAGE_SIZE, PAGE_SIZE, PAGE_SIZE);
1642+
if (!new)
1643+
goto err_alloc;
1644+
p4d_populate(&init_mm, p4d, new);
1645+
}
1646+
1647+
pud = pud_offset(p4d, addr);
16371648
if (pud_none(*pud)) {
16381649
pmd_t *new;
16391650

arch/sparc/kernel/vmlinux.lds.S

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,14 @@ SECTIONS
171171
}
172172
PERCPU_SECTION(SMP_CACHE_BYTES)
173173

174-
#ifdef CONFIG_JUMP_LABEL
175174
. = ALIGN(PAGE_SIZE);
176175
.exit.text : {
177176
EXIT_TEXT
178177
}
179-
#endif
178+
179+
.exit.data : {
180+
EXIT_DATA
181+
}
180182

181183
. = ALIGN(PAGE_SIZE);
182184
__init_end = .;

arch/sparc/mm/fault_64.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ static void __kprobes bad_kernel_pc(struct pt_regs *regs, unsigned long vaddr)
8080
static unsigned int get_user_insn(unsigned long tpc)
8181
{
8282
pgd_t *pgdp = pgd_offset(current->mm, tpc);
83+
p4d_t *p4dp;
8384
pud_t *pudp;
8485
pmd_t *pmdp;
8586
pte_t *ptep, pte;
@@ -88,7 +89,10 @@ static unsigned int get_user_insn(unsigned long tpc)
8889

8990
if (pgd_none(*pgdp) || unlikely(pgd_bad(*pgdp)))
9091
goto out;
91-
pudp = pud_offset(pgdp, tpc);
92+
p4dp = p4d_offset(pgdp, tpc);
93+
if (p4d_none(*p4dp) || unlikely(p4d_bad(*p4dp)))
94+
goto out;
95+
pudp = pud_offset(p4dp, tpc);
9296
if (pud_none(*pudp) || unlikely(pud_bad(*pudp)))
9397
goto out;
9498

arch/sparc/mm/hugetlbpage.c

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,13 @@ pte_t *huge_pte_alloc(struct mm_struct *mm,
277277
unsigned long addr, unsigned long sz)
278278
{
279279
pgd_t *pgd;
280+
p4d_t *p4d;
280281
pud_t *pud;
281282
pmd_t *pmd;
282283

283284
pgd = pgd_offset(mm, addr);
284-
pud = pud_alloc(mm, pgd, addr);
285+
p4d = p4d_offset(pgd, addr);
286+
pud = pud_alloc(mm, p4d, addr);
285287
if (!pud)
286288
return NULL;
287289
if (sz >= PUD_SIZE)
@@ -298,13 +300,17 @@ pte_t *huge_pte_offset(struct mm_struct *mm,
298300
unsigned long addr, unsigned long sz)
299301
{
300302
pgd_t *pgd;
303+
p4d_t *p4d;
301304
pud_t *pud;
302305
pmd_t *pmd;
303306

304307
pgd = pgd_offset(mm, addr);
305308
if (pgd_none(*pgd))
306309
return NULL;
307-
pud = pud_offset(pgd, addr);
310+
p4d = p4d_offset(pgd, addr);
311+
if (p4d_none(*p4d))
312+
return NULL;
313+
pud = pud_offset(p4d, addr);
308314
if (pud_none(*pud))
309315
return NULL;
310316
if (is_hugetlb_pud(*pud))
@@ -449,7 +455,7 @@ static void hugetlb_free_pmd_range(struct mmu_gather *tlb, pud_t *pud,
449455
mm_dec_nr_pmds(tlb->mm);
450456
}
451457

452-
static void hugetlb_free_pud_range(struct mmu_gather *tlb, pgd_t *pgd,
458+
static void hugetlb_free_pud_range(struct mmu_gather *tlb, p4d_t *p4d,
453459
unsigned long addr, unsigned long end,
454460
unsigned long floor, unsigned long ceiling)
455461
{
@@ -458,7 +464,7 @@ static void hugetlb_free_pud_range(struct mmu_gather *tlb, pgd_t *pgd,
458464
unsigned long start;
459465

460466
start = addr;
461-
pud = pud_offset(pgd, addr);
467+
pud = pud_offset(p4d, addr);
462468
do {
463469
next = pud_addr_end(addr, end);
464470
if (pud_none_or_clear_bad(pud))
@@ -481,8 +487,8 @@ static void hugetlb_free_pud_range(struct mmu_gather *tlb, pgd_t *pgd,
481487
if (end - 1 > ceiling - 1)
482488
return;
483489

484-
pud = pud_offset(pgd, start);
485-
pgd_clear(pgd);
490+
pud = pud_offset(p4d, start);
491+
p4d_clear(p4d);
486492
pud_free_tlb(tlb, pud, start);
487493
mm_dec_nr_puds(tlb->mm);
488494
}
@@ -492,6 +498,7 @@ void hugetlb_free_pgd_range(struct mmu_gather *tlb,
492498
unsigned long floor, unsigned long ceiling)
493499
{
494500
pgd_t *pgd;
501+
p4d_t *p4d;
495502
unsigned long next;
496503

497504
addr &= PMD_MASK;
@@ -511,10 +518,11 @@ void hugetlb_free_pgd_range(struct mmu_gather *tlb,
511518
return;
512519

513520
pgd = pgd_offset(tlb->mm, addr);
521+
p4d = p4d_offset(pgd, addr);
514522
do {
515-
next = pgd_addr_end(addr, end);
516-
if (pgd_none_or_clear_bad(pgd))
523+
next = p4d_addr_end(addr, end);
524+
if (p4d_none_or_clear_bad(p4d))
517525
continue;
518-
hugetlb_free_pud_range(tlb, pgd, addr, next, floor, ceiling);
519-
} while (pgd++, addr = next, addr != end);
526+
hugetlb_free_pud_range(tlb, p4d, addr, next, floor, ceiling);
527+
} while (p4d++, addr = next, addr != end);
520528
}

0 commit comments

Comments
 (0)