aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-08-15 14:11:45 -0400
committerSage Weil <sage@inktank.com>2013-08-15 14:11:45 -0400
commitee3e542fec6e69bc9fb668698889a37d93950ddf (patch)
treee74ee766a4764769ef1d3d45d266b4dea64101d3 /arch/sparc
parentfe2a801b50c0bb8039d627e5ae1fec249d10ff39 (diff)
parentf1d6e17f540af37bb1891480143669ba7636c4cf (diff)
Merge remote-tracking branch 'linus/master' into testing
Diffstat (limited to 'arch/sparc')
-rw-r--r--arch/sparc/Kconfig1
-rw-r--r--arch/sparc/include/asm/leon.h2
-rw-r--r--arch/sparc/include/asm/pgtable_32.h1
-rw-r--r--arch/sparc/include/asm/pgtable_64.h6
-rw-r--r--arch/sparc/include/uapi/asm/fcntl.h1
-rw-r--r--arch/sparc/include/uapi/asm/socket.h2
-rw-r--r--arch/sparc/kernel/asm-offsets.c2
-rw-r--r--arch/sparc/kernel/ds.c21
-rw-r--r--arch/sparc/kernel/entry.h2
-rw-r--r--arch/sparc/kernel/hvtramp.S1
-rw-r--r--arch/sparc/kernel/irq_64.c5
-rw-r--r--arch/sparc/kernel/leon_smp.c13
-rw-r--r--arch/sparc/kernel/mdesc.c34
-rw-r--r--arch/sparc/kernel/pci.c15
-rw-r--r--arch/sparc/kernel/smp_32.c20
-rw-r--r--arch/sparc/kernel/smp_64.c9
-rw-r--r--arch/sparc/kernel/sun4d_smp.c6
-rw-r--r--arch/sparc/kernel/sun4m_smp.c6
-rw-r--r--arch/sparc/kernel/sys_sparc_64.c2
-rw-r--r--arch/sparc/kernel/sysfs.c4
-rw-r--r--arch/sparc/kernel/trampoline_32.S3
-rw-r--r--arch/sparc/kernel/trampoline_64.S2
-rw-r--r--arch/sparc/mm/hypersparc.S8
-rw-r--r--arch/sparc/mm/init_32.c37
-rw-r--r--arch/sparc/mm/init_64.c28
-rw-r--r--arch/sparc/mm/srmmu.c12
-rw-r--r--arch/sparc/mm/swift.S8
-rw-r--r--arch/sparc/mm/tlb.c5
-rw-r--r--arch/sparc/mm/tsunami.S6
-rw-r--r--arch/sparc/mm/viking.S10
-rw-r--r--arch/sparc/net/bpf_jit_comp.c20
31 files changed, 114 insertions, 178 deletions
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 9ac9f1666339..a00cbd356db5 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -243,7 +243,6 @@ config SECCOMP
243config HOTPLUG_CPU 243config HOTPLUG_CPU
244 bool "Support for hot-pluggable CPUs" 244 bool "Support for hot-pluggable CPUs"
245 depends on SPARC64 && SMP 245 depends on SPARC64 && SMP
246 select HOTPLUG
247 help 246 help
248 Say Y here to experiment with turning CPUs off and on. CPUs 247 Say Y here to experiment with turning CPUs off and on. CPUs
249 can be controlled through /sys/devices/system/cpu/cpu#. 248 can be controlled through /sys/devices/system/cpu/cpu#.
diff --git a/arch/sparc/include/asm/leon.h b/arch/sparc/include/asm/leon.h
index b836e9297f2a..c2f6ff6d7a35 100644
--- a/arch/sparc/include/asm/leon.h
+++ b/arch/sparc/include/asm/leon.h
@@ -108,7 +108,7 @@ static inline int sparc_leon3_snooping_enabled(void)
108{ 108{
109 u32 cctrl; 109 u32 cctrl;
110 __asm__ __volatile__("lda [%%g0] 2, %0\n\t" : "=r"(cctrl)); 110 __asm__ __volatile__("lda [%%g0] 2, %0\n\t" : "=r"(cctrl));
111 return (cctrl >> 23) & 1; 111 return ((cctrl >> 23) & 1) && ((cctrl >> 17) & 1);
112}; 112};
113 113
114static inline void sparc_leon3_disable_cache(void) 114static inline void sparc_leon3_disable_cache(void)
diff --git a/arch/sparc/include/asm/pgtable_32.h b/arch/sparc/include/asm/pgtable_32.h
index 6fc13483f702..502f632f6cc7 100644
--- a/arch/sparc/include/asm/pgtable_32.h
+++ b/arch/sparc/include/asm/pgtable_32.h
@@ -443,6 +443,7 @@ static inline int io_remap_pfn_range(struct vm_area_struct *vma,
443 443
444 return remap_pfn_range(vma, from, phys_base >> PAGE_SHIFT, size, prot); 444 return remap_pfn_range(vma, from, phys_base >> PAGE_SHIFT, size, prot);
445} 445}
446#define io_remap_pfn_range io_remap_pfn_range
446 447
447#define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS 448#define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
448#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \ 449#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h
index 7619f2f792af..36760317814f 100644
--- a/arch/sparc/include/asm/pgtable_64.h
+++ b/arch/sparc/include/asm/pgtable_64.h
@@ -853,10 +853,11 @@ extern void update_mmu_cache_pmd(struct vm_area_struct *vma, unsigned long addr,
853 pmd_t *pmd); 853 pmd_t *pmd);
854 854
855#define __HAVE_ARCH_PGTABLE_DEPOSIT 855#define __HAVE_ARCH_PGTABLE_DEPOSIT
856extern void pgtable_trans_huge_deposit(struct mm_struct *mm, pgtable_t pgtable); 856extern void pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp,
857 pgtable_t pgtable);
857 858
858#define __HAVE_ARCH_PGTABLE_WITHDRAW 859#define __HAVE_ARCH_PGTABLE_WITHDRAW
859extern pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm); 860extern pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp);
860#endif 861#endif
861 862
862/* Encode and de-code a swap entry */ 863/* Encode and de-code a swap entry */
@@ -914,6 +915,7 @@ static inline int io_remap_pfn_range(struct vm_area_struct *vma,
914 915
915 return remap_pfn_range(vma, from, phys_base >> PAGE_SHIFT, size, prot); 916 return remap_pfn_range(vma, from, phys_base >> PAGE_SHIFT, size, prot);
916} 917}
918#define io_remap_pfn_range io_remap_pfn_range
917 919
918#include <asm/tlbflush.h> 920#include <asm/tlbflush.h>
919#include <asm-generic/pgtable.h> 921#include <asm-generic/pgtable.h>
diff --git a/arch/sparc/include/uapi/asm/fcntl.h b/arch/sparc/include/uapi/asm/fcntl.h
index d0b83f66f356..7e8ace5bf760 100644
--- a/arch/sparc/include/uapi/asm/fcntl.h
+++ b/arch/sparc/include/uapi/asm/fcntl.h
@@ -35,6 +35,7 @@
35#define O_SYNC (__O_SYNC|O_DSYNC) 35#define O_SYNC (__O_SYNC|O_DSYNC)
36 36
37#define O_PATH 0x1000000 37#define O_PATH 0x1000000
38#define __O_TMPFILE 0x2000000
38 39
39#define F_GETOWN 5 /* for sockets. */ 40#define F_GETOWN 5 /* for sockets. */
40#define F_SETOWN 6 /* for sockets. */ 41#define F_SETOWN 6 /* for sockets. */
diff --git a/arch/sparc/include/uapi/asm/socket.h b/arch/sparc/include/uapi/asm/socket.h
index 89f49b68a21c..4e1d66c3ce71 100644
--- a/arch/sparc/include/uapi/asm/socket.h
+++ b/arch/sparc/include/uapi/asm/socket.h
@@ -70,6 +70,8 @@
70 70
71#define SO_SELECT_ERR_QUEUE 0x0029 71#define SO_SELECT_ERR_QUEUE 0x0029
72 72
73#define SO_BUSY_POLL 0x0030
74
73/* Security levels - as per NRL IPv6 - don't actually do anything */ 75/* Security levels - as per NRL IPv6 - don't actually do anything */
74#define SO_SECURITY_AUTHENTICATION 0x5001 76#define SO_SECURITY_AUTHENTICATION 0x5001
75#define SO_SECURITY_ENCRYPTION_TRANSPORT 0x5002 77#define SO_SECURITY_ENCRYPTION_TRANSPORT 0x5002
diff --git a/arch/sparc/kernel/asm-offsets.c b/arch/sparc/kernel/asm-offsets.c
index 961b87f99e69..f76389a32342 100644
--- a/arch/sparc/kernel/asm-offsets.c
+++ b/arch/sparc/kernel/asm-offsets.c
@@ -49,6 +49,8 @@ int foo(void)
49 DEFINE(AOFF_task_thread, offsetof(struct task_struct, thread)); 49 DEFINE(AOFF_task_thread, offsetof(struct task_struct, thread));
50 BLANK(); 50 BLANK();
51 DEFINE(AOFF_mm_context, offsetof(struct mm_struct, context)); 51 DEFINE(AOFF_mm_context, offsetof(struct mm_struct, context));
52 BLANK();
53 DEFINE(VMA_VM_MM, offsetof(struct vm_area_struct, vm_mm));
52 54
53 /* DEFINE(NUM_USER_SEGMENTS, TASK_SIZE>>28); */ 55 /* DEFINE(NUM_USER_SEGMENTS, TASK_SIZE>>28); */
54 return 0; 56 return 0;
diff --git a/arch/sparc/kernel/ds.c b/arch/sparc/kernel/ds.c
index 5ef48dab5636..62d6b153ffa2 100644
--- a/arch/sparc/kernel/ds.c
+++ b/arch/sparc/kernel/ds.c
@@ -528,10 +528,8 @@ static void dr_cpu_mark(struct ds_data *resp, int cpu, int ncpus,
528 } 528 }
529} 529}
530 530
531static int __cpuinit dr_cpu_configure(struct ds_info *dp, 531static int dr_cpu_configure(struct ds_info *dp, struct ds_cap_state *cp,
532 struct ds_cap_state *cp, 532 u64 req_num, cpumask_t *mask)
533 u64 req_num,
534 cpumask_t *mask)
535{ 533{
536 struct ds_data *resp; 534 struct ds_data *resp;
537 int resp_len, ncpus, cpu; 535 int resp_len, ncpus, cpu;
@@ -627,9 +625,8 @@ static int dr_cpu_unconfigure(struct ds_info *dp,
627 return 0; 625 return 0;
628} 626}
629 627
630static void __cpuinit dr_cpu_data(struct ds_info *dp, 628static void dr_cpu_data(struct ds_info *dp, struct ds_cap_state *cp, void *buf,
631 struct ds_cap_state *cp, 629 int len)
632 void *buf, int len)
633{ 630{
634 struct ds_data *data = buf; 631 struct ds_data *data = buf;
635 struct dr_cpu_tag *tag = (struct dr_cpu_tag *) (data + 1); 632 struct dr_cpu_tag *tag = (struct dr_cpu_tag *) (data + 1);
@@ -783,6 +780,16 @@ void ldom_set_var(const char *var, const char *value)
783 char *base, *p; 780 char *base, *p;
784 int msg_len, loops; 781 int msg_len, loops;
785 782
783 if (strlen(var) + strlen(value) + 2 >
784 sizeof(pkt) - sizeof(pkt.header)) {
785 printk(KERN_ERR PFX
786 "contents length: %zu, which more than max: %lu,"
787 "so could not set (%s) variable to (%s).\n",
788 strlen(var) + strlen(value) + 2,
789 sizeof(pkt) - sizeof(pkt.header), var, value);
790 return;
791 }
792
786 memset(&pkt, 0, sizeof(pkt)); 793 memset(&pkt, 0, sizeof(pkt));
787 pkt.header.data.tag.type = DS_DATA; 794 pkt.header.data.tag.type = DS_DATA;
788 pkt.header.data.handle = cp->handle; 795 pkt.header.data.handle = cp->handle;
diff --git a/arch/sparc/kernel/entry.h b/arch/sparc/kernel/entry.h
index cc3c5cb47cda..9c179fbfb219 100644
--- a/arch/sparc/kernel/entry.h
+++ b/arch/sparc/kernel/entry.h
@@ -250,7 +250,7 @@ extern struct ino_bucket *ivector_table;
250extern unsigned long ivector_table_pa; 250extern unsigned long ivector_table_pa;
251 251
252extern void init_irqwork_curcpu(void); 252extern void init_irqwork_curcpu(void);
253extern void __cpuinit sun4v_register_mondo_queues(int this_cpu); 253extern void sun4v_register_mondo_queues(int this_cpu);
254 254
255#endif /* CONFIG_SPARC32 */ 255#endif /* CONFIG_SPARC32 */
256#endif /* _ENTRY_H */ 256#endif /* _ENTRY_H */
diff --git a/arch/sparc/kernel/hvtramp.S b/arch/sparc/kernel/hvtramp.S
index 605c960b2fa6..4eb1a5a1d544 100644
--- a/arch/sparc/kernel/hvtramp.S
+++ b/arch/sparc/kernel/hvtramp.S
@@ -16,7 +16,6 @@
16#include <asm/asi.h> 16#include <asm/asi.h>
17#include <asm/pil.h> 17#include <asm/pil.h>
18 18
19 __CPUINIT
20 .align 8 19 .align 8
21 .globl hv_cpu_startup, hv_cpu_startup_end 20 .globl hv_cpu_startup, hv_cpu_startup_end
22 21
diff --git a/arch/sparc/kernel/irq_64.c b/arch/sparc/kernel/irq_64.c
index 9bcbbe2c4e7e..d4840cec2c55 100644
--- a/arch/sparc/kernel/irq_64.c
+++ b/arch/sparc/kernel/irq_64.c
@@ -835,7 +835,8 @@ void notrace init_irqwork_curcpu(void)
835 * Therefore you cannot make any OBP calls, not even prom_printf, 835 * Therefore you cannot make any OBP calls, not even prom_printf,
836 * from these two routines. 836 * from these two routines.
837 */ 837 */
838static void __cpuinit notrace register_one_mondo(unsigned long paddr, unsigned long type, unsigned long qmask) 838static void notrace register_one_mondo(unsigned long paddr, unsigned long type,
839 unsigned long qmask)
839{ 840{
840 unsigned long num_entries = (qmask + 1) / 64; 841 unsigned long num_entries = (qmask + 1) / 64;
841 unsigned long status; 842 unsigned long status;
@@ -848,7 +849,7 @@ static void __cpuinit notrace register_one_mondo(unsigned long paddr, unsigned l
848 } 849 }
849} 850}
850 851
851void __cpuinit notrace sun4v_register_mondo_queues(int this_cpu) 852void notrace sun4v_register_mondo_queues(int this_cpu)
852{ 853{
853 struct trap_per_cpu *tb = &trap_block[this_cpu]; 854 struct trap_per_cpu *tb = &trap_block[this_cpu];
854 855
diff --git a/arch/sparc/kernel/leon_smp.c b/arch/sparc/kernel/leon_smp.c
index 6cfc1b09ec25..6edf955f987c 100644
--- a/arch/sparc/kernel/leon_smp.c
+++ b/arch/sparc/kernel/leon_smp.c
@@ -54,7 +54,7 @@ extern ctxd_t *srmmu_ctx_table_phys;
54static int smp_processors_ready; 54static int smp_processors_ready;
55extern volatile unsigned long cpu_callin_map[NR_CPUS]; 55extern volatile unsigned long cpu_callin_map[NR_CPUS];
56extern cpumask_t smp_commenced_mask; 56extern cpumask_t smp_commenced_mask;
57void __cpuinit leon_configure_cache_smp(void); 57void leon_configure_cache_smp(void);
58static void leon_ipi_init(void); 58static void leon_ipi_init(void);
59 59
60/* IRQ number of LEON IPIs */ 60/* IRQ number of LEON IPIs */
@@ -69,12 +69,12 @@ static inline unsigned long do_swap(volatile unsigned long *ptr,
69 return val; 69 return val;
70} 70}
71 71
72void __cpuinit leon_cpu_pre_starting(void *arg) 72void leon_cpu_pre_starting(void *arg)
73{ 73{
74 leon_configure_cache_smp(); 74 leon_configure_cache_smp();
75} 75}
76 76
77void __cpuinit leon_cpu_pre_online(void *arg) 77void leon_cpu_pre_online(void *arg)
78{ 78{
79 int cpuid = hard_smp_processor_id(); 79 int cpuid = hard_smp_processor_id();
80 80
@@ -106,7 +106,7 @@ void __cpuinit leon_cpu_pre_online(void *arg)
106 106
107extern struct linux_prom_registers smp_penguin_ctable; 107extern struct linux_prom_registers smp_penguin_ctable;
108 108
109void __cpuinit leon_configure_cache_smp(void) 109void leon_configure_cache_smp(void)
110{ 110{
111 unsigned long cfg = sparc_leon3_get_dcachecfg(); 111 unsigned long cfg = sparc_leon3_get_dcachecfg();
112 int me = smp_processor_id(); 112 int me = smp_processor_id();
@@ -186,7 +186,7 @@ void __init leon_boot_cpus(void)
186 186
187} 187}
188 188
189int __cpuinit leon_boot_one_cpu(int i, struct task_struct *idle) 189int leon_boot_one_cpu(int i, struct task_struct *idle)
190{ 190{
191 int timeout; 191 int timeout;
192 192
@@ -254,15 +254,12 @@ void __init leon_smp_done(void)
254 /* Free unneeded trap tables */ 254 /* Free unneeded trap tables */
255 if (!cpu_present(1)) { 255 if (!cpu_present(1)) {
256 free_reserved_page(virt_to_page(&trapbase_cpu1)); 256 free_reserved_page(virt_to_page(&trapbase_cpu1));
257 num_physpages++;
258 } 257 }
259 if (!cpu_present(2)) { 258 if (!cpu_present(2)) {
260 free_reserved_page(virt_to_page(&trapbase_cpu2)); 259 free_reserved_page(virt_to_page(&trapbase_cpu2));
261 num_physpages++;
262 } 260 }
263 if (!cpu_present(3)) { 261 if (!cpu_present(3)) {
264 free_reserved_page(virt_to_page(&trapbase_cpu3)); 262 free_reserved_page(virt_to_page(&trapbase_cpu3));
265 num_physpages++;
266 } 263 }
267 /* Ok, they are spinning and ready to go. */ 264 /* Ok, they are spinning and ready to go. */
268 smp_processors_ready = 1; 265 smp_processors_ready = 1;
diff --git a/arch/sparc/kernel/mdesc.c b/arch/sparc/kernel/mdesc.c
index 831c001604e8..b90bf23e3aab 100644
--- a/arch/sparc/kernel/mdesc.c
+++ b/arch/sparc/kernel/mdesc.c
@@ -571,9 +571,7 @@ static void __init report_platform_properties(void)
571 mdesc_release(hp); 571 mdesc_release(hp);
572} 572}
573 573
574static void __cpuinit fill_in_one_cache(cpuinfo_sparc *c, 574static void fill_in_one_cache(cpuinfo_sparc *c, struct mdesc_handle *hp, u64 mp)
575 struct mdesc_handle *hp,
576 u64 mp)
577{ 575{
578 const u64 *level = mdesc_get_property(hp, mp, "level", NULL); 576 const u64 *level = mdesc_get_property(hp, mp, "level", NULL);
579 const u64 *size = mdesc_get_property(hp, mp, "size", NULL); 577 const u64 *size = mdesc_get_property(hp, mp, "size", NULL);
@@ -616,7 +614,7 @@ static void __cpuinit fill_in_one_cache(cpuinfo_sparc *c,
616 } 614 }
617} 615}
618 616
619static void __cpuinit mark_core_ids(struct mdesc_handle *hp, u64 mp, int core_id) 617static void mark_core_ids(struct mdesc_handle *hp, u64 mp, int core_id)
620{ 618{
621 u64 a; 619 u64 a;
622 620
@@ -649,7 +647,7 @@ static void __cpuinit mark_core_ids(struct mdesc_handle *hp, u64 mp, int core_id
649 } 647 }
650} 648}
651 649
652static void __cpuinit set_core_ids(struct mdesc_handle *hp) 650static void set_core_ids(struct mdesc_handle *hp)
653{ 651{
654 int idx; 652 int idx;
655 u64 mp; 653 u64 mp;
@@ -674,7 +672,7 @@ static void __cpuinit set_core_ids(struct mdesc_handle *hp)
674 } 672 }
675} 673}
676 674
677static void __cpuinit mark_proc_ids(struct mdesc_handle *hp, u64 mp, int proc_id) 675static void mark_proc_ids(struct mdesc_handle *hp, u64 mp, int proc_id)
678{ 676{
679 u64 a; 677 u64 a;
680 678
@@ -693,7 +691,7 @@ static void __cpuinit mark_proc_ids(struct mdesc_handle *hp, u64 mp, int proc_id
693 } 691 }
694} 692}
695 693
696static void __cpuinit __set_proc_ids(struct mdesc_handle *hp, const char *exec_unit_name) 694static void __set_proc_ids(struct mdesc_handle *hp, const char *exec_unit_name)
697{ 695{
698 int idx; 696 int idx;
699 u64 mp; 697 u64 mp;
@@ -714,14 +712,14 @@ static void __cpuinit __set_proc_ids(struct mdesc_handle *hp, const char *exec_u
714 } 712 }
715} 713}
716 714
717static void __cpuinit set_proc_ids(struct mdesc_handle *hp) 715static void set_proc_ids(struct mdesc_handle *hp)
718{ 716{
719 __set_proc_ids(hp, "exec_unit"); 717 __set_proc_ids(hp, "exec_unit");
720 __set_proc_ids(hp, "exec-unit"); 718 __set_proc_ids(hp, "exec-unit");
721} 719}
722 720
723static void __cpuinit get_one_mondo_bits(const u64 *p, unsigned int *mask, 721static void get_one_mondo_bits(const u64 *p, unsigned int *mask,
724 unsigned long def, unsigned long max) 722 unsigned long def, unsigned long max)
725{ 723{
726 u64 val; 724 u64 val;
727 725
@@ -742,8 +740,8 @@ use_default:
742 *mask = ((1U << def) * 64U) - 1U; 740 *mask = ((1U << def) * 64U) - 1U;
743} 741}
744 742
745static void __cpuinit get_mondo_data(struct mdesc_handle *hp, u64 mp, 743static void get_mondo_data(struct mdesc_handle *hp, u64 mp,
746 struct trap_per_cpu *tb) 744 struct trap_per_cpu *tb)
747{ 745{
748 static int printed; 746 static int printed;
749 const u64 *val; 747 const u64 *val;
@@ -769,7 +767,7 @@ static void __cpuinit get_mondo_data(struct mdesc_handle *hp, u64 mp,
769 } 767 }
770} 768}
771 769
772static void * __cpuinit mdesc_iterate_over_cpus(void *(*func)(struct mdesc_handle *, u64, int, void *), void *arg, cpumask_t *mask) 770static void *mdesc_iterate_over_cpus(void *(*func)(struct mdesc_handle *, u64, int, void *), void *arg, cpumask_t *mask)
773{ 771{
774 struct mdesc_handle *hp = mdesc_grab(); 772 struct mdesc_handle *hp = mdesc_grab();
775 void *ret = NULL; 773 void *ret = NULL;
@@ -799,7 +797,8 @@ out:
799 return ret; 797 return ret;
800} 798}
801 799
802static void * __cpuinit record_one_cpu(struct mdesc_handle *hp, u64 mp, int cpuid, void *arg) 800static void *record_one_cpu(struct mdesc_handle *hp, u64 mp, int cpuid,
801 void *arg)
803{ 802{
804 ncpus_probed++; 803 ncpus_probed++;
805#ifdef CONFIG_SMP 804#ifdef CONFIG_SMP
@@ -808,7 +807,7 @@ static void * __cpuinit record_one_cpu(struct mdesc_handle *hp, u64 mp, int cpui
808 return NULL; 807 return NULL;
809} 808}
810 809
811void __cpuinit mdesc_populate_present_mask(cpumask_t *mask) 810void mdesc_populate_present_mask(cpumask_t *mask)
812{ 811{
813 if (tlb_type != hypervisor) 812 if (tlb_type != hypervisor)
814 return; 813 return;
@@ -841,7 +840,8 @@ void __init mdesc_get_page_sizes(cpumask_t *mask, unsigned long *pgsz_mask)
841 mdesc_iterate_over_cpus(check_one_pgsz, pgsz_mask, mask); 840 mdesc_iterate_over_cpus(check_one_pgsz, pgsz_mask, mask);
842} 841}
843 842
844static void * __cpuinit fill_in_one_cpu(struct mdesc_handle *hp, u64 mp, int cpuid, void *arg) 843static void *fill_in_one_cpu(struct mdesc_handle *hp, u64 mp, int cpuid,
844 void *arg)
845{ 845{
846 const u64 *cfreq = mdesc_get_property(hp, mp, "clock-frequency", NULL); 846 const u64 *cfreq = mdesc_get_property(hp, mp, "clock-frequency", NULL);
847 struct trap_per_cpu *tb; 847 struct trap_per_cpu *tb;
@@ -890,7 +890,7 @@ static void * __cpuinit fill_in_one_cpu(struct mdesc_handle *hp, u64 mp, int cpu
890 return NULL; 890 return NULL;
891} 891}
892 892
893void __cpuinit mdesc_fill_in_cpu_data(cpumask_t *mask) 893void mdesc_fill_in_cpu_data(cpumask_t *mask)
894{ 894{
895 struct mdesc_handle *hp; 895 struct mdesc_handle *hp;
896 896
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index baf4366e2d6a..bc4d3f5d2e5d 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -254,7 +254,7 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
254 const char *type; 254 const char *type;
255 u32 class; 255 u32 class;
256 256
257 dev = alloc_pci_dev(); 257 dev = pci_alloc_dev(bus);
258 if (!dev) 258 if (!dev)
259 return NULL; 259 return NULL;
260 260
@@ -281,7 +281,6 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
281 printk(" create device, devfn: %x, type: %s\n", 281 printk(" create device, devfn: %x, type: %s\n",
282 devfn, type); 282 devfn, type);
283 283
284 dev->bus = bus;
285 dev->sysdata = node; 284 dev->sysdata = node;
286 dev->dev.parent = bus->bridge; 285 dev->dev.parent = bus->bridge;
287 dev->dev.bus = &pci_bus_type; 286 dev->dev.bus = &pci_bus_type;
@@ -327,7 +326,7 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
327 if ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE) 326 if ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE)
328 pci_set_master(dev); 327 pci_set_master(dev);
329 328
330 dev->current_state = 4; /* unknown power state */ 329 dev->current_state = PCI_UNKNOWN; /* unknown power state */
331 dev->error_state = pci_channel_io_normal; 330 dev->error_state = pci_channel_io_normal;
332 dev->dma_mask = 0xffffffff; 331 dev->dma_mask = 0xffffffff;
333 332
@@ -773,15 +772,6 @@ static int __pci_mmap_make_offset(struct pci_dev *pdev,
773 return 0; 772 return 0;
774} 773}
775 774
776/* Set vm_flags of VMA, as appropriate for this architecture, for a pci device
777 * mapping.
778 */
779static void __pci_mmap_set_flags(struct pci_dev *dev, struct vm_area_struct *vma,
780 enum pci_mmap_state mmap_state)
781{
782 vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP;
783}
784
785/* Set vm_page_prot of VMA, as appropriate for this architecture, for a pci 775/* Set vm_page_prot of VMA, as appropriate for this architecture, for a pci
786 * device mapping. 776 * device mapping.
787 */ 777 */
@@ -809,7 +799,6 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
809 if (ret < 0) 799 if (ret < 0)
810 return ret; 800 return ret;
811 801
812 __pci_mmap_set_flags(dev, vma, mmap_state);
813 __pci_mmap_set_pgprot(dev, vma, mmap_state); 802 __pci_mmap_set_pgprot(dev, vma, mmap_state);
814 803
815 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); 804 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
diff --git a/arch/sparc/kernel/smp_32.c b/arch/sparc/kernel/smp_32.c
index e3f2b81c23f1..a102bfba6ea8 100644
--- a/arch/sparc/kernel/smp_32.c
+++ b/arch/sparc/kernel/smp_32.c
@@ -39,7 +39,7 @@
39#include "kernel.h" 39#include "kernel.h"
40#include "irq.h" 40#include "irq.h"
41 41
42volatile unsigned long cpu_callin_map[NR_CPUS] __cpuinitdata = {0,}; 42volatile unsigned long cpu_callin_map[NR_CPUS] = {0,};
43 43
44cpumask_t smp_commenced_mask = CPU_MASK_NONE; 44cpumask_t smp_commenced_mask = CPU_MASK_NONE;
45 45
@@ -53,7 +53,7 @@ const struct sparc32_ipi_ops *sparc32_ipi_ops;
53 * instruction which is much better... 53 * instruction which is much better...
54 */ 54 */
55 55
56void __cpuinit smp_store_cpu_info(int id) 56void smp_store_cpu_info(int id)
57{ 57{
58 int cpu_node; 58 int cpu_node;
59 int mid; 59 int mid;
@@ -120,7 +120,7 @@ void cpu_panic(void)
120 panic("SMP bolixed\n"); 120 panic("SMP bolixed\n");
121} 121}
122 122
123struct linux_prom_registers smp_penguin_ctable __cpuinitdata = { 0 }; 123struct linux_prom_registers smp_penguin_ctable = { 0 };
124 124
125void smp_send_reschedule(int cpu) 125void smp_send_reschedule(int cpu)
126{ 126{
@@ -259,10 +259,10 @@ void __init smp_prepare_boot_cpu(void)
259 set_cpu_possible(cpuid, true); 259 set_cpu_possible(cpuid, true);
260} 260}
261 261
262int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle) 262int __cpu_up(unsigned int cpu, struct task_struct *tidle)
263{ 263{
264 extern int __cpuinit smp4m_boot_one_cpu(int, struct task_struct *); 264 extern int smp4m_boot_one_cpu(int, struct task_struct *);
265 extern int __cpuinit smp4d_boot_one_cpu(int, struct task_struct *); 265 extern int smp4d_boot_one_cpu(int, struct task_struct *);
266 int ret=0; 266 int ret=0;
267 267
268 switch(sparc_cpu_model) { 268 switch(sparc_cpu_model) {
@@ -297,7 +297,7 @@ int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle)
297 return ret; 297 return ret;
298} 298}
299 299
300void __cpuinit arch_cpu_pre_starting(void *arg) 300void arch_cpu_pre_starting(void *arg)
301{ 301{
302 local_ops->cache_all(); 302 local_ops->cache_all();
303 local_ops->tlb_all(); 303 local_ops->tlb_all();
@@ -317,7 +317,7 @@ void __cpuinit arch_cpu_pre_starting(void *arg)
317 } 317 }
318} 318}
319 319
320void __cpuinit arch_cpu_pre_online(void *arg) 320void arch_cpu_pre_online(void *arg)
321{ 321{
322 unsigned int cpuid = hard_smp_processor_id(); 322 unsigned int cpuid = hard_smp_processor_id();
323 323
@@ -344,7 +344,7 @@ void __cpuinit arch_cpu_pre_online(void *arg)
344 } 344 }
345} 345}
346 346
347void __cpuinit sparc_start_secondary(void *arg) 347void sparc_start_secondary(void *arg)
348{ 348{
349 unsigned int cpu; 349 unsigned int cpu;
350 350
@@ -375,7 +375,7 @@ void __cpuinit sparc_start_secondary(void *arg)
375 BUG(); 375 BUG();
376} 376}
377 377
378void __cpuinit smp_callin(void) 378void smp_callin(void)
379{ 379{
380 sparc_start_secondary(NULL); 380 sparc_start_secondary(NULL);
381} 381}
diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c
index 77539eda928c..e142545244f2 100644
--- a/arch/sparc/kernel/smp_64.c
+++ b/arch/sparc/kernel/smp_64.c
@@ -87,7 +87,7 @@ extern void setup_sparc64_timer(void);
87 87
88static volatile unsigned long callin_flag = 0; 88static volatile unsigned long callin_flag = 0;
89 89
90void __cpuinit smp_callin(void) 90void smp_callin(void)
91{ 91{
92 int cpuid = hard_smp_processor_id(); 92 int cpuid = hard_smp_processor_id();
93 93
@@ -281,7 +281,8 @@ static unsigned long kimage_addr_to_ra(void *p)
281 return kern_base + (val - KERNBASE); 281 return kern_base + (val - KERNBASE);
282} 282}
283 283
284static void __cpuinit ldom_startcpu_cpuid(unsigned int cpu, unsigned long thread_reg, void **descrp) 284static void ldom_startcpu_cpuid(unsigned int cpu, unsigned long thread_reg,
285 void **descrp)
285{ 286{
286 extern unsigned long sparc64_ttable_tl0; 287 extern unsigned long sparc64_ttable_tl0;
287 extern unsigned long kern_locked_tte_data; 288 extern unsigned long kern_locked_tte_data;
@@ -342,7 +343,7 @@ extern unsigned long sparc64_cpu_startup;
342 */ 343 */
343static struct thread_info *cpu_new_thread = NULL; 344static struct thread_info *cpu_new_thread = NULL;
344 345
345static int __cpuinit smp_boot_one_cpu(unsigned int cpu, struct task_struct *idle) 346static int smp_boot_one_cpu(unsigned int cpu, struct task_struct *idle)
346{ 347{
347 unsigned long entry = 348 unsigned long entry =
348 (unsigned long)(&sparc64_cpu_startup); 349 (unsigned long)(&sparc64_cpu_startup);
@@ -1266,7 +1267,7 @@ void smp_fill_in_sib_core_maps(void)
1266 } 1267 }
1267} 1268}
1268 1269
1269int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle) 1270int __cpu_up(unsigned int cpu, struct task_struct *tidle)
1270{ 1271{
1271 int ret = smp_boot_one_cpu(cpu, tidle); 1272 int ret = smp_boot_one_cpu(cpu, tidle);
1272 1273
diff --git a/arch/sparc/kernel/sun4d_smp.c b/arch/sparc/kernel/sun4d_smp.c
index c9eb82f23d92..d5c319553fd0 100644
--- a/arch/sparc/kernel/sun4d_smp.c
+++ b/arch/sparc/kernel/sun4d_smp.c
@@ -50,7 +50,7 @@ static inline void show_leds(int cpuid)
50 "i" (ASI_M_CTL)); 50 "i" (ASI_M_CTL));
51} 51}
52 52
53void __cpuinit sun4d_cpu_pre_starting(void *arg) 53void sun4d_cpu_pre_starting(void *arg)
54{ 54{
55 int cpuid = hard_smp_processor_id(); 55 int cpuid = hard_smp_processor_id();
56 56
@@ -62,7 +62,7 @@ void __cpuinit sun4d_cpu_pre_starting(void *arg)
62 cc_set_imsk((cc_get_imsk() & ~0x8000) | 0x4000); 62 cc_set_imsk((cc_get_imsk() & ~0x8000) | 0x4000);
63} 63}
64 64
65void __cpuinit sun4d_cpu_pre_online(void *arg) 65void sun4d_cpu_pre_online(void *arg)
66{ 66{
67 unsigned long flags; 67 unsigned long flags;
68 int cpuid; 68 int cpuid;
@@ -118,7 +118,7 @@ void __init smp4d_boot_cpus(void)
118 local_ops->cache_all(); 118 local_ops->cache_all();
119} 119}
120 120
121int __cpuinit smp4d_boot_one_cpu(int i, struct task_struct *idle) 121int smp4d_boot_one_cpu(int i, struct task_struct *idle)
122{ 122{
123 unsigned long *entry = &sun4d_cpu_startup; 123 unsigned long *entry = &sun4d_cpu_startup;
124 int timeout; 124 int timeout;
diff --git a/arch/sparc/kernel/sun4m_smp.c b/arch/sparc/kernel/sun4m_smp.c
index 8a65f158153d..d3408e72d20c 100644
--- a/arch/sparc/kernel/sun4m_smp.c
+++ b/arch/sparc/kernel/sun4m_smp.c
@@ -34,11 +34,11 @@ swap_ulong(volatile unsigned long *ptr, unsigned long val)
34 return val; 34 return val;
35} 35}
36 36
37void __cpuinit sun4m_cpu_pre_starting(void *arg) 37void sun4m_cpu_pre_starting(void *arg)
38{ 38{
39} 39}
40 40
41void __cpuinit sun4m_cpu_pre_online(void *arg) 41void sun4m_cpu_pre_online(void *arg)
42{ 42{
43 int cpuid = hard_smp_processor_id(); 43 int cpuid = hard_smp_processor_id();
44 44
@@ -75,7 +75,7 @@ void __init smp4m_boot_cpus(void)
75 local_ops->cache_all(); 75 local_ops->cache_all();
76} 76}
77 77
78int __cpuinit smp4m_boot_one_cpu(int i, struct task_struct *idle) 78int smp4m_boot_one_cpu(int i, struct task_struct *idle)
79{ 79{
80 unsigned long *entry = &sun4m_cpu_startup; 80 unsigned long *entry = &sun4m_cpu_startup;
81 int timeout; 81 int timeout;
diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c
index 2daaaa6eda23..51561b8b15ba 100644
--- a/arch/sparc/kernel/sys_sparc_64.c
+++ b/arch/sparc/kernel/sys_sparc_64.c
@@ -290,7 +290,6 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
290 sysctl_legacy_va_layout) { 290 sysctl_legacy_va_layout) {
291 mm->mmap_base = TASK_UNMAPPED_BASE + random_factor; 291 mm->mmap_base = TASK_UNMAPPED_BASE + random_factor;
292 mm->get_unmapped_area = arch_get_unmapped_area; 292 mm->get_unmapped_area = arch_get_unmapped_area;
293 mm->unmap_area = arch_unmap_area;
294 } else { 293 } else {
295 /* We know it's 32-bit */ 294 /* We know it's 32-bit */
296 unsigned long task_size = STACK_TOP32; 295 unsigned long task_size = STACK_TOP32;
@@ -302,7 +301,6 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
302 301
303 mm->mmap_base = PAGE_ALIGN(task_size - gap - random_factor); 302 mm->mmap_base = PAGE_ALIGN(task_size - gap - random_factor);
304 mm->get_unmapped_area = arch_get_unmapped_area_topdown; 303 mm->get_unmapped_area = arch_get_unmapped_area_topdown;
305 mm->unmap_area = arch_unmap_area_topdown;
306 } 304 }
307} 305}
308 306
diff --git a/arch/sparc/kernel/sysfs.c b/arch/sparc/kernel/sysfs.c
index 654e8aad3bbe..c21c673e5f7c 100644
--- a/arch/sparc/kernel/sysfs.c
+++ b/arch/sparc/kernel/sysfs.c
@@ -246,7 +246,7 @@ static void unregister_cpu_online(unsigned int cpu)
246} 246}
247#endif 247#endif
248 248
249static int __cpuinit sysfs_cpu_notify(struct notifier_block *self, 249static int sysfs_cpu_notify(struct notifier_block *self,
250 unsigned long action, void *hcpu) 250 unsigned long action, void *hcpu)
251{ 251{
252 unsigned int cpu = (unsigned int)(long)hcpu; 252 unsigned int cpu = (unsigned int)(long)hcpu;
@@ -266,7 +266,7 @@ static int __cpuinit sysfs_cpu_notify(struct notifier_block *self,
266 return NOTIFY_OK; 266 return NOTIFY_OK;
267} 267}
268 268
269static struct notifier_block __cpuinitdata sysfs_cpu_nb = { 269static struct notifier_block sysfs_cpu_nb = {
270 .notifier_call = sysfs_cpu_notify, 270 .notifier_call = sysfs_cpu_notify,
271}; 271};
272 272
diff --git a/arch/sparc/kernel/trampoline_32.S b/arch/sparc/kernel/trampoline_32.S
index 6cdb08cdabf0..76dcbd3c988a 100644
--- a/arch/sparc/kernel/trampoline_32.S
+++ b/arch/sparc/kernel/trampoline_32.S
@@ -18,7 +18,6 @@
18 .globl sun4m_cpu_startup 18 .globl sun4m_cpu_startup
19 .globl sun4d_cpu_startup 19 .globl sun4d_cpu_startup
20 20
21 __CPUINIT
22 .align 4 21 .align 4
23 22
24/* When we start up a cpu for the first time it enters this routine. 23/* When we start up a cpu for the first time it enters this routine.
@@ -94,7 +93,6 @@ smp_panic:
94/* CPUID in bootbus can be found at PA 0xff0140000 */ 93/* CPUID in bootbus can be found at PA 0xff0140000 */
95#define SUN4D_BOOTBUS_CPUID 0xf0140000 94#define SUN4D_BOOTBUS_CPUID 0xf0140000
96 95
97 __CPUINIT
98 .align 4 96 .align 4
99 97
100sun4d_cpu_startup: 98sun4d_cpu_startup:
@@ -146,7 +144,6 @@ sun4d_cpu_startup:
146 144
147 b,a smp_panic 145 b,a smp_panic
148 146
149 __CPUINIT
150 .align 4 147 .align 4
151 .global leon_smp_cpu_startup, smp_penguin_ctable 148 .global leon_smp_cpu_startup, smp_penguin_ctable
152 149
diff --git a/arch/sparc/kernel/trampoline_64.S b/arch/sparc/kernel/trampoline_64.S
index 2e973a26fbda..e0b1e13a0736 100644
--- a/arch/sparc/kernel/trampoline_64.S
+++ b/arch/sparc/kernel/trampoline_64.S
@@ -32,13 +32,11 @@ itlb_load:
32dtlb_load: 32dtlb_load:
33 .asciz "SUNW,dtlb-load" 33 .asciz "SUNW,dtlb-load"
34 34
35 /* XXX __cpuinit this thing XXX */
36#define TRAMP_STACK_SIZE 1024 35#define TRAMP_STACK_SIZE 1024
37 .align 16 36 .align 16
38tramp_stack: 37tramp_stack:
39 .skip TRAMP_STACK_SIZE 38 .skip TRAMP_STACK_SIZE
40 39
41 __CPUINIT
42 .align 8 40 .align 8
43 .globl sparc64_cpu_startup, sparc64_cpu_startup_end 41 .globl sparc64_cpu_startup, sparc64_cpu_startup_end
44sparc64_cpu_startup: 42sparc64_cpu_startup:
diff --git a/arch/sparc/mm/hypersparc.S b/arch/sparc/mm/hypersparc.S
index 44aad32eeb4e..969f96450f69 100644
--- a/arch/sparc/mm/hypersparc.S
+++ b/arch/sparc/mm/hypersparc.S
@@ -74,7 +74,7 @@ hypersparc_flush_cache_mm_out:
74 74
75 /* The things we do for performance... */ 75 /* The things we do for performance... */
76hypersparc_flush_cache_range: 76hypersparc_flush_cache_range:
77 ld [%o0 + 0x0], %o0 /* XXX vma->vm_mm, GROSS XXX */ 77 ld [%o0 + VMA_VM_MM], %o0
78#ifndef CONFIG_SMP 78#ifndef CONFIG_SMP
79 ld [%o0 + AOFF_mm_context], %g1 79 ld [%o0 + AOFF_mm_context], %g1
80 cmp %g1, -1 80 cmp %g1, -1
@@ -163,7 +163,7 @@ hypersparc_flush_cache_range_out:
163 */ 163 */
164 /* Verified, my ass... */ 164 /* Verified, my ass... */
165hypersparc_flush_cache_page: 165hypersparc_flush_cache_page:
166 ld [%o0 + 0x0], %o0 /* XXX vma->vm_mm, GROSS XXX */ 166 ld [%o0 + VMA_VM_MM], %o0
167 ld [%o0 + AOFF_mm_context], %g2 167 ld [%o0 + AOFF_mm_context], %g2
168#ifndef CONFIG_SMP 168#ifndef CONFIG_SMP
169 cmp %g2, -1 169 cmp %g2, -1
@@ -284,7 +284,7 @@ hypersparc_flush_tlb_mm_out:
284 sta %g5, [%g1] ASI_M_MMUREGS 284 sta %g5, [%g1] ASI_M_MMUREGS
285 285
286hypersparc_flush_tlb_range: 286hypersparc_flush_tlb_range:
287 ld [%o0 + 0x00], %o0 /* XXX vma->vm_mm GROSS XXX */ 287 ld [%o0 + VMA_VM_MM], %o0
288 mov SRMMU_CTX_REG, %g1 288 mov SRMMU_CTX_REG, %g1
289 ld [%o0 + AOFF_mm_context], %o3 289 ld [%o0 + AOFF_mm_context], %o3
290 lda [%g1] ASI_M_MMUREGS, %g5 290 lda [%g1] ASI_M_MMUREGS, %g5
@@ -307,7 +307,7 @@ hypersparc_flush_tlb_range_out:
307 sta %g5, [%g1] ASI_M_MMUREGS 307 sta %g5, [%g1] ASI_M_MMUREGS
308 308
309hypersparc_flush_tlb_page: 309hypersparc_flush_tlb_page:
310 ld [%o0 + 0x00], %o0 /* XXX vma->vm_mm GROSS XXX */ 310 ld [%o0 + VMA_VM_MM], %o0
311 mov SRMMU_CTX_REG, %g1 311 mov SRMMU_CTX_REG, %g1
312 ld [%o0 + AOFF_mm_context], %o3 312 ld [%o0 + AOFF_mm_context], %o3
313 andn %o1, (PAGE_SIZE - 1), %o1 313 andn %o1, (PAGE_SIZE - 1), %o1
diff --git a/arch/sparc/mm/init_32.c b/arch/sparc/mm/init_32.c
index af472cf7c69a..db6987082805 100644
--- a/arch/sparc/mm/init_32.c
+++ b/arch/sparc/mm/init_32.c
@@ -288,10 +288,6 @@ static void map_high_region(unsigned long start_pfn, unsigned long end_pfn)
288 288
289void __init mem_init(void) 289void __init mem_init(void)
290{ 290{
291 int codepages = 0;
292 int datapages = 0;
293 int initpages = 0;
294 int reservedpages = 0;
295 int i; 291 int i;
296 292
297 if (PKMAP_BASE+LAST_PKMAP*PAGE_SIZE >= FIXADDR_START) { 293 if (PKMAP_BASE+LAST_PKMAP*PAGE_SIZE >= FIXADDR_START) {
@@ -323,15 +319,12 @@ void __init mem_init(void)
323 319
324 max_mapnr = last_valid_pfn - pfn_base; 320 max_mapnr = last_valid_pfn - pfn_base;
325 high_memory = __va(max_low_pfn << PAGE_SHIFT); 321 high_memory = __va(max_low_pfn << PAGE_SHIFT);
326 322 free_all_bootmem();
327 totalram_pages = free_all_bootmem();
328 323
329 for (i = 0; sp_banks[i].num_bytes != 0; i++) { 324 for (i = 0; sp_banks[i].num_bytes != 0; i++) {
330 unsigned long start_pfn = sp_banks[i].base_addr >> PAGE_SHIFT; 325 unsigned long start_pfn = sp_banks[i].base_addr >> PAGE_SHIFT;
331 unsigned long end_pfn = (sp_banks[i].base_addr + sp_banks[i].num_bytes) >> PAGE_SHIFT; 326 unsigned long end_pfn = (sp_banks[i].base_addr + sp_banks[i].num_bytes) >> PAGE_SHIFT;
332 327
333 num_physpages += sp_banks[i].num_bytes >> PAGE_SHIFT;
334
335 if (end_pfn <= highstart_pfn) 328 if (end_pfn <= highstart_pfn)
336 continue; 329 continue;
337 330
@@ -341,39 +334,19 @@ void __init mem_init(void)
341 map_high_region(start_pfn, end_pfn); 334 map_high_region(start_pfn, end_pfn);
342 } 335 }
343 336
344 codepages = (((unsigned long) &_etext) - ((unsigned long)&_start)); 337 mem_init_print_info(NULL);
345 codepages = PAGE_ALIGN(codepages) >> PAGE_SHIFT;
346 datapages = (((unsigned long) &_edata) - ((unsigned long)&_etext));
347 datapages = PAGE_ALIGN(datapages) >> PAGE_SHIFT;
348 initpages = (((unsigned long) &__init_end) - ((unsigned long) &__init_begin));
349 initpages = PAGE_ALIGN(initpages) >> PAGE_SHIFT;
350
351 /* Ignore memory holes for the purpose of counting reserved pages */
352 for (i=0; i < max_low_pfn; i++)
353 if (test_bit(i >> (20 - PAGE_SHIFT), sparc_valid_addr_bitmap)
354 && PageReserved(pfn_to_page(i)))
355 reservedpages++;
356
357 printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, %dk init, %ldk highmem)\n",
358 nr_free_pages() << (PAGE_SHIFT-10),
359 num_physpages << (PAGE_SHIFT - 10),
360 codepages << (PAGE_SHIFT-10),
361 reservedpages << (PAGE_SHIFT - 10),
362 datapages << (PAGE_SHIFT-10),
363 initpages << (PAGE_SHIFT-10),
364 totalhigh_pages << (PAGE_SHIFT-10));
365} 338}
366 339
367void free_initmem (void) 340void free_initmem (void)
368{ 341{
369 num_physpages += free_initmem_default(POISON_FREE_INITMEM); 342 free_initmem_default(POISON_FREE_INITMEM);
370} 343}
371 344
372#ifdef CONFIG_BLK_DEV_INITRD 345#ifdef CONFIG_BLK_DEV_INITRD
373void free_initrd_mem(unsigned long start, unsigned long end) 346void free_initrd_mem(unsigned long start, unsigned long end)
374{ 347{
375 num_physpages += free_reserved_area(start, end, POISON_FREE_INITMEM, 348 free_reserved_area((void *)start, (void *)end, POISON_FREE_INITMEM,
376 "initrd"); 349 "initrd");
377} 350}
378#endif 351#endif
379 352
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
index 04fd55a6e461..ed82edad1a39 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -1694,7 +1694,7 @@ static void __init sun4v_ktsb_init(void)
1694#endif 1694#endif
1695} 1695}
1696 1696
1697void __cpuinit sun4v_ktsb_register(void) 1697void sun4v_ktsb_register(void)
1698{ 1698{
1699 unsigned long pa, ret; 1699 unsigned long pa, ret;
1700 1700
@@ -2045,7 +2045,6 @@ static void __init register_page_bootmem_info(void)
2045} 2045}
2046void __init mem_init(void) 2046void __init mem_init(void)
2047{ 2047{
2048 unsigned long codepages, datapages, initpages;
2049 unsigned long addr, last; 2048 unsigned long addr, last;
2050 2049
2051 addr = PAGE_OFFSET + kern_base; 2050 addr = PAGE_OFFSET + kern_base;
@@ -2061,12 +2060,7 @@ void __init mem_init(void)
2061 high_memory = __va(last_valid_pfn << PAGE_SHIFT); 2060 high_memory = __va(last_valid_pfn << PAGE_SHIFT);
2062 2061
2063 register_page_bootmem_info(); 2062 register_page_bootmem_info();
2064 totalram_pages = free_all_bootmem(); 2063 free_all_bootmem();
2065
2066 /* We subtract one to account for the mem_map_zero page
2067 * allocated below.
2068 */
2069 num_physpages = totalram_pages - 1;
2070 2064
2071 /* 2065 /*
2072 * Set up the zero page, mark it reserved, so that page count 2066 * Set up the zero page, mark it reserved, so that page count
@@ -2079,19 +2073,7 @@ void __init mem_init(void)
2079 } 2073 }
2080 mark_page_reserved(mem_map_zero); 2074 mark_page_reserved(mem_map_zero);
2081 2075
2082 codepages = (((unsigned long) _etext) - ((unsigned long) _start)); 2076 mem_init_print_info(NULL);
2083 codepages = PAGE_ALIGN(codepages) >> PAGE_SHIFT;
2084 datapages = (((unsigned long) _edata) - ((unsigned long) _etext));
2085 datapages = PAGE_ALIGN(datapages) >> PAGE_SHIFT;
2086 initpages = (((unsigned long) __init_end) - ((unsigned long) __init_begin));
2087 initpages = PAGE_ALIGN(initpages) >> PAGE_SHIFT;
2088
2089 printk("Memory: %luk available (%ldk kernel code, %ldk data, %ldk init) [%016lx,%016lx]\n",
2090 nr_free_pages() << (PAGE_SHIFT-10),
2091 codepages << (PAGE_SHIFT-10),
2092 datapages << (PAGE_SHIFT-10),
2093 initpages << (PAGE_SHIFT-10),
2094 PAGE_OFFSET, (last_valid_pfn << PAGE_SHIFT));
2095 2077
2096 if (tlb_type == cheetah || tlb_type == cheetah_plus) 2078 if (tlb_type == cheetah || tlb_type == cheetah_plus)
2097 cheetah_ecache_flush_init(); 2079 cheetah_ecache_flush_init();
@@ -2131,8 +2113,8 @@ void free_initmem(void)
2131#ifdef CONFIG_BLK_DEV_INITRD 2113#ifdef CONFIG_BLK_DEV_INITRD
2132void free_initrd_mem(unsigned long start, unsigned long end) 2114void free_initrd_mem(unsigned long start, unsigned long end)
2133{ 2115{
2134 num_physpages += free_reserved_area(start, end, POISON_FREE_INITMEM, 2116 free_reserved_area((void *)start, (void *)end, POISON_FREE_INITMEM,
2135 "initrd"); 2117 "initrd");
2136} 2118}
2137#endif 2119#endif
2138 2120
diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c
index 036c2797dece..5d721df48a72 100644
--- a/arch/sparc/mm/srmmu.c
+++ b/arch/sparc/mm/srmmu.c
@@ -858,7 +858,7 @@ static void __init map_kernel(void)
858 } 858 }
859} 859}
860 860
861void (*poke_srmmu)(void) __cpuinitdata = NULL; 861void (*poke_srmmu)(void) = NULL;
862 862
863extern unsigned long bootmem_init(unsigned long *pages_avail); 863extern unsigned long bootmem_init(unsigned long *pages_avail);
864 864
@@ -1055,7 +1055,7 @@ static void __init init_vac_layout(void)
1055 (int)vac_cache_size, (int)vac_line_size); 1055 (int)vac_cache_size, (int)vac_line_size);
1056} 1056}
1057 1057
1058static void __cpuinit poke_hypersparc(void) 1058static void poke_hypersparc(void)
1059{ 1059{
1060 volatile unsigned long clear; 1060 volatile unsigned long clear;
1061 unsigned long mreg = srmmu_get_mmureg(); 1061 unsigned long mreg = srmmu_get_mmureg();
@@ -1107,7 +1107,7 @@ static void __init init_hypersparc(void)
1107 hypersparc_setup_blockops(); 1107 hypersparc_setup_blockops();
1108} 1108}
1109 1109
1110static void __cpuinit poke_swift(void) 1110static void poke_swift(void)
1111{ 1111{
1112 unsigned long mreg; 1112 unsigned long mreg;
1113 1113
@@ -1287,7 +1287,7 @@ static void turbosparc_flush_tlb_page(struct vm_area_struct *vma, unsigned long
1287} 1287}
1288 1288
1289 1289
1290static void __cpuinit poke_turbosparc(void) 1290static void poke_turbosparc(void)
1291{ 1291{
1292 unsigned long mreg = srmmu_get_mmureg(); 1292 unsigned long mreg = srmmu_get_mmureg();
1293 unsigned long ccreg; 1293 unsigned long ccreg;
@@ -1350,7 +1350,7 @@ static void __init init_turbosparc(void)
1350 poke_srmmu = poke_turbosparc; 1350 poke_srmmu = poke_turbosparc;
1351} 1351}
1352 1352
1353static void __cpuinit poke_tsunami(void) 1353static void poke_tsunami(void)
1354{ 1354{
1355 unsigned long mreg = srmmu_get_mmureg(); 1355 unsigned long mreg = srmmu_get_mmureg();
1356 1356
@@ -1391,7 +1391,7 @@ static void __init init_tsunami(void)
1391 tsunami_setup_blockops(); 1391 tsunami_setup_blockops();
1392} 1392}
1393 1393
1394static void __cpuinit poke_viking(void) 1394static void poke_viking(void)
1395{ 1395{
1396 unsigned long mreg = srmmu_get_mmureg(); 1396 unsigned long mreg = srmmu_get_mmureg();
1397 static int smp_catch; 1397 static int smp_catch;
diff --git a/arch/sparc/mm/swift.S b/arch/sparc/mm/swift.S
index c801c3953a00..5d2b88d39424 100644
--- a/arch/sparc/mm/swift.S
+++ b/arch/sparc/mm/swift.S
@@ -105,7 +105,7 @@ swift_flush_cache_mm_out:
105 105
106 .globl swift_flush_cache_range 106 .globl swift_flush_cache_range
107swift_flush_cache_range: 107swift_flush_cache_range:
108 ld [%o0 + 0x0], %o0 /* XXX vma->vm_mm, GROSS XXX */ 108 ld [%o0 + VMA_VM_MM], %o0
109 sub %o2, %o1, %o2 109 sub %o2, %o1, %o2
110 sethi %hi(4096), %o3 110 sethi %hi(4096), %o3
111 cmp %o2, %o3 111 cmp %o2, %o3
@@ -116,7 +116,7 @@ swift_flush_cache_range:
116 116
117 .globl swift_flush_cache_page 117 .globl swift_flush_cache_page
118swift_flush_cache_page: 118swift_flush_cache_page:
119 ld [%o0 + 0x0], %o0 /* XXX vma->vm_mm, GROSS XXX */ 119 ld [%o0 + VMA_VM_MM], %o0
12070: 12070:
121 ld [%o0 + AOFF_mm_context], %g2 121 ld [%o0 + AOFF_mm_context], %g2
122 cmp %g2, -1 122 cmp %g2, -1
@@ -219,7 +219,7 @@ swift_flush_sig_insns:
219 .globl swift_flush_tlb_range 219 .globl swift_flush_tlb_range
220 .globl swift_flush_tlb_all 220 .globl swift_flush_tlb_all
221swift_flush_tlb_range: 221swift_flush_tlb_range:
222 ld [%o0 + 0x00], %o0 /* XXX vma->vm_mm GROSS XXX */ 222 ld [%o0 + VMA_VM_MM], %o0
223swift_flush_tlb_mm: 223swift_flush_tlb_mm:
224 ld [%o0 + AOFF_mm_context], %g2 224 ld [%o0 + AOFF_mm_context], %g2
225 cmp %g2, -1 225 cmp %g2, -1
@@ -233,7 +233,7 @@ swift_flush_tlb_all_out:
233 233
234 .globl swift_flush_tlb_page 234 .globl swift_flush_tlb_page
235swift_flush_tlb_page: 235swift_flush_tlb_page:
236 ld [%o0 + 0x00], %o0 /* XXX vma->vm_mm GROSS XXX */ 236 ld [%o0 + VMA_VM_MM], %o0
237 mov SRMMU_CTX_REG, %g1 237 mov SRMMU_CTX_REG, %g1
238 ld [%o0 + AOFF_mm_context], %o3 238 ld [%o0 + AOFF_mm_context], %o3
239 andn %o1, (PAGE_SIZE - 1), %o1 239 andn %o1, (PAGE_SIZE - 1), %o1
diff --git a/arch/sparc/mm/tlb.c b/arch/sparc/mm/tlb.c
index 37e7bc4c95b3..7a91f288c708 100644
--- a/arch/sparc/mm/tlb.c
+++ b/arch/sparc/mm/tlb.c
@@ -188,7 +188,8 @@ void set_pmd_at(struct mm_struct *mm, unsigned long addr,
188 } 188 }
189} 189}
190 190
191void pgtable_trans_huge_deposit(struct mm_struct *mm, pgtable_t pgtable) 191void pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp,
192 pgtable_t pgtable)
192{ 193{
193 struct list_head *lh = (struct list_head *) pgtable; 194 struct list_head *lh = (struct list_head *) pgtable;
194 195
@@ -202,7 +203,7 @@ void pgtable_trans_huge_deposit(struct mm_struct *mm, pgtable_t pgtable)
202 mm->pmd_huge_pte = pgtable; 203 mm->pmd_huge_pte = pgtable;
203} 204}
204 205
205pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm) 206pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp)
206{ 207{
207 struct list_head *lh; 208 struct list_head *lh;
208 pgtable_t pgtable; 209 pgtable_t pgtable;
diff --git a/arch/sparc/mm/tsunami.S b/arch/sparc/mm/tsunami.S
index 4e55e8f76648..bf10a345fa8b 100644
--- a/arch/sparc/mm/tsunami.S
+++ b/arch/sparc/mm/tsunami.S
@@ -24,7 +24,7 @@
24 /* Sliiick... */ 24 /* Sliiick... */
25tsunami_flush_cache_page: 25tsunami_flush_cache_page:
26tsunami_flush_cache_range: 26tsunami_flush_cache_range:
27 ld [%o0 + 0x0], %o0 /* XXX vma->vm_mm, GROSS XXX */ 27 ld [%o0 + VMA_VM_MM], %o0
28tsunami_flush_cache_mm: 28tsunami_flush_cache_mm:
29 ld [%o0 + AOFF_mm_context], %g2 29 ld [%o0 + AOFF_mm_context], %g2
30 cmp %g2, -1 30 cmp %g2, -1
@@ -46,7 +46,7 @@ tsunami_flush_sig_insns:
46 46
47 /* More slick stuff... */ 47 /* More slick stuff... */
48tsunami_flush_tlb_range: 48tsunami_flush_tlb_range:
49 ld [%o0 + 0x00], %o0 /* XXX vma->vm_mm GROSS XXX */ 49 ld [%o0 + VMA_VM_MM], %o0
50tsunami_flush_tlb_mm: 50tsunami_flush_tlb_mm:
51 ld [%o0 + AOFF_mm_context], %g2 51 ld [%o0 + AOFF_mm_context], %g2
52 cmp %g2, -1 52 cmp %g2, -1
@@ -65,7 +65,7 @@ tsunami_flush_tlb_out:
65 65
66 /* This one can be done in a fine grained manner... */ 66 /* This one can be done in a fine grained manner... */
67tsunami_flush_tlb_page: 67tsunami_flush_tlb_page:
68 ld [%o0 + 0x00], %o0 /* XXX vma->vm_mm GROSS XXX */ 68 ld [%o0 + VMA_VM_MM], %o0
69 mov SRMMU_CTX_REG, %g1 69 mov SRMMU_CTX_REG, %g1
70 ld [%o0 + AOFF_mm_context], %o3 70 ld [%o0 + AOFF_mm_context], %o3
71 andn %o1, (PAGE_SIZE - 1), %o1 71 andn %o1, (PAGE_SIZE - 1), %o1
diff --git a/arch/sparc/mm/viking.S b/arch/sparc/mm/viking.S
index bf8ee0613ae7..852257fcc82b 100644
--- a/arch/sparc/mm/viking.S
+++ b/arch/sparc/mm/viking.S
@@ -108,7 +108,7 @@ viking_mxcc_flush_page:
108viking_flush_cache_page: 108viking_flush_cache_page:
109viking_flush_cache_range: 109viking_flush_cache_range:
110#ifndef CONFIG_SMP 110#ifndef CONFIG_SMP
111 ld [%o0 + 0x0], %o0 /* XXX vma->vm_mm, GROSS XXX */ 111 ld [%o0 + VMA_VM_MM], %o0
112#endif 112#endif
113viking_flush_cache_mm: 113viking_flush_cache_mm:
114#ifndef CONFIG_SMP 114#ifndef CONFIG_SMP
@@ -148,7 +148,7 @@ viking_flush_tlb_mm:
148#endif 148#endif
149 149
150viking_flush_tlb_range: 150viking_flush_tlb_range:
151 ld [%o0 + 0x00], %o0 /* XXX vma->vm_mm GROSS XXX */ 151 ld [%o0 + VMA_VM_MM], %o0
152 mov SRMMU_CTX_REG, %g1 152 mov SRMMU_CTX_REG, %g1
153 ld [%o0 + AOFF_mm_context], %o3 153 ld [%o0 + AOFF_mm_context], %o3
154 lda [%g1] ASI_M_MMUREGS, %g5 154 lda [%g1] ASI_M_MMUREGS, %g5
@@ -173,7 +173,7 @@ viking_flush_tlb_range:
173#endif 173#endif
174 174
175viking_flush_tlb_page: 175viking_flush_tlb_page:
176 ld [%o0 + 0x00], %o0 /* XXX vma->vm_mm GROSS XXX */ 176 ld [%o0 + VMA_VM_MM], %o0
177 mov SRMMU_CTX_REG, %g1 177 mov SRMMU_CTX_REG, %g1
178 ld [%o0 + AOFF_mm_context], %o3 178 ld [%o0 + AOFF_mm_context], %o3
179 lda [%g1] ASI_M_MMUREGS, %g5 179 lda [%g1] ASI_M_MMUREGS, %g5
@@ -239,7 +239,7 @@ sun4dsmp_flush_tlb_range:
239 tst %g5 239 tst %g5
240 bne 3f 240 bne 3f
241 mov SRMMU_CTX_REG, %g1 241 mov SRMMU_CTX_REG, %g1
242 ld [%o0 + 0x00], %o0 /* XXX vma->vm_mm GROSS XXX */ 242 ld [%o0 + VMA_VM_MM], %o0
243 ld [%o0 + AOFF_mm_context], %o3 243 ld [%o0 + AOFF_mm_context], %o3
244 lda [%g1] ASI_M_MMUREGS, %g5 244 lda [%g1] ASI_M_MMUREGS, %g5
245 sethi %hi(~((1 << SRMMU_PGDIR_SHIFT) - 1)), %o4 245 sethi %hi(~((1 << SRMMU_PGDIR_SHIFT) - 1)), %o4
@@ -265,7 +265,7 @@ sun4dsmp_flush_tlb_page:
265 tst %g5 265 tst %g5
266 bne 2f 266 bne 2f
267 mov SRMMU_CTX_REG, %g1 267 mov SRMMU_CTX_REG, %g1
268 ld [%o0 + 0x00], %o0 /* XXX vma->vm_mm GROSS XXX */ 268 ld [%o0 + VMA_VM_MM], %o0
269 ld [%o0 + AOFF_mm_context], %o3 269 ld [%o0 + AOFF_mm_context], %o3
270 lda [%g1] ASI_M_MMUREGS, %g5 270 lda [%g1] ASI_M_MMUREGS, %g5
271 and %o1, PAGE_MASK, %o1 271 and %o1, PAGE_MASK, %o1
diff --git a/arch/sparc/net/bpf_jit_comp.c b/arch/sparc/net/bpf_jit_comp.c
index d36a85ebb5e0..9c7be59e6f5a 100644
--- a/arch/sparc/net/bpf_jit_comp.c
+++ b/arch/sparc/net/bpf_jit_comp.c
@@ -785,9 +785,7 @@ cond_branch: f_offset = addrs[i + filter[i].jf];
785 break; 785 break;
786 } 786 }
787 if (proglen == oldproglen) { 787 if (proglen == oldproglen) {
788 image = module_alloc(max_t(unsigned int, 788 image = module_alloc(proglen);
789 proglen,
790 sizeof(struct work_struct)));
791 if (!image) 789 if (!image)
792 goto out; 790 goto out;
793 } 791 }
@@ -806,20 +804,8 @@ out:
806 return; 804 return;
807} 805}
808 806
809static void jit_free_defer(struct work_struct *arg)
810{
811 module_free(NULL, arg);
812}
813
814/* run from softirq, we must use a work_struct to call
815 * module_free() from process context
816 */
817void bpf_jit_free(struct sk_filter *fp) 807void bpf_jit_free(struct sk_filter *fp)
818{ 808{
819 if (fp->bpf_func != sk_run_filter) { 809 if (fp->bpf_func != sk_run_filter)
820 struct work_struct *work = (struct work_struct *)fp->bpf_func; 810 module_free(NULL, fp->bpf_func);
821
822 INIT_WORK(work, jit_free_defer);
823 schedule_work(work);
824 }
825} 811}