diff options
Diffstat (limited to 'arch/sparc')
41 files changed, 263 insertions, 821 deletions
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index f92602e86607..96657992a72e 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -28,9 +28,11 @@ config SPARC  	select HAVE_GENERIC_HARDIRQS  	select GENERIC_IRQ_SHOW  	select USE_GENERIC_SMP_HELPERS if SMP +	select GENERIC_PCI_IOMAP  config SPARC32  	def_bool !64BIT +	select GENERIC_ATOMIC64  config SPARC64  	def_bool 64BIT @@ -43,6 +45,7 @@ config SPARC64  	select HAVE_KPROBES  	select HAVE_RCU_TABLE_FREE if SMP  	select HAVE_MEMBLOCK +	select HAVE_MEMBLOCK_NODE_MAP  	select HAVE_SYSCALL_WRAPPERS  	select HAVE_DYNAMIC_FTRACE  	select HAVE_FTRACE_MCOUNT_RECORD @@ -352,9 +355,6 @@ config NODES_SPAN_OTHER_NODES  	def_bool y  	depends on NEED_MULTIPLE_NODES -config ARCH_POPULATES_NODE_MAP -	def_bool y if SPARC64 -  config ARCH_SELECT_MEMORY_MODEL  	def_bool y if SPARC64 @@ -385,9 +385,7 @@ config SCHED_MC  	  making when dealing with multi-core CPU chips at a cost of slightly  	  increased overhead in some places. If unsure say N here. -if SPARC64  source "kernel/Kconfig.preempt" -endif  config CMDLINE_BOOL  	bool "Default bootloader kernel arguments" diff --git a/arch/sparc/include/asm/atomic_32.h b/arch/sparc/include/asm/atomic_32.h index 5c3c8b69884d..9dd0a769fa18 100644 --- a/arch/sparc/include/asm/atomic_32.h +++ b/arch/sparc/include/asm/atomic_32.h @@ -13,7 +13,7 @@  #include <linux/types.h> -#ifdef __KERNEL__ +#include <asm-generic/atomic64.h>  #include <asm/system.h> @@ -52,112 +52,10 @@ extern void atomic_set(atomic_t *, int);  #define atomic_dec_and_test(v) (atomic_dec_return(v) == 0)  #define atomic_sub_and_test(i, v) (atomic_sub_return(i, v) == 0) - -/* This is the old 24-bit implementation.  It's still used internally - * by some sparc-specific code, notably the semaphore implementation. - */ -typedef struct { volatile int counter; } atomic24_t; - -#ifndef CONFIG_SMP - -#define ATOMIC24_INIT(i)  { (i) } -#define atomic24_read(v)          ((v)->counter) -#define atomic24_set(v, i)        (((v)->counter) = i) - -#else -/* We do the bulk of the actual work out of line in two common - * routines in assembler, see arch/sparc/lib/atomic.S for the - * "fun" details. - * - * For SMP the trick is you embed the spin lock byte within - * the word, use the low byte so signedness is easily retained - * via a quick arithmetic shift.  It looks like this: - * - *	---------------------------------------- - *	| signed 24-bit counter value |  lock  |  atomic_t - *	---------------------------------------- - *	 31                          8 7      0 - */ - -#define ATOMIC24_INIT(i)	{ ((i) << 8) } - -static inline int atomic24_read(const atomic24_t *v) -{ -	int ret = v->counter; - -	while(ret & 0xff) -		ret = v->counter; - -	return ret >> 8; -} - -#define atomic24_set(v, i)	(((v)->counter) = ((i) << 8)) -#endif - -static inline int __atomic24_add(int i, atomic24_t *v) -{ -	register volatile int *ptr asm("g1"); -	register int increment asm("g2"); -	register int tmp1 asm("g3"); -	register int tmp2 asm("g4"); -	register int tmp3 asm("g7"); - -	ptr = &v->counter; -	increment = i; - -	__asm__ __volatile__( -	"mov	%%o7, %%g4\n\t" -	"call	___atomic24_add\n\t" -	" add	%%o7, 8, %%o7\n" -	: "=&r" (increment), "=r" (tmp1), "=r" (tmp2), "=r" (tmp3) -	: "0" (increment), "r" (ptr) -	: "memory", "cc"); - -	return increment; -} - -static inline int __atomic24_sub(int i, atomic24_t *v) -{ -	register volatile int *ptr asm("g1"); -	register int increment asm("g2"); -	register int tmp1 asm("g3"); -	register int tmp2 asm("g4"); -	register int tmp3 asm("g7"); - -	ptr = &v->counter; -	increment = i; - -	__asm__ __volatile__( -	"mov	%%o7, %%g4\n\t" -	"call	___atomic24_sub\n\t" -	" add	%%o7, 8, %%o7\n" -	: "=&r" (increment), "=r" (tmp1), "=r" (tmp2), "=r" (tmp3) -	: "0" (increment), "r" (ptr) -	: "memory", "cc"); - -	return increment; -} - -#define atomic24_add(i, v) ((void)__atomic24_add((i), (v))) -#define atomic24_sub(i, v) ((void)__atomic24_sub((i), (v))) - -#define atomic24_dec_return(v) __atomic24_sub(1, (v)) -#define atomic24_inc_return(v) __atomic24_add(1, (v)) - -#define atomic24_sub_and_test(i, v) (__atomic24_sub((i), (v)) == 0) -#define atomic24_dec_and_test(v) (__atomic24_sub(1, (v)) == 0) - -#define atomic24_inc(v) ((void)__atomic24_add(1, (v))) -#define atomic24_dec(v) ((void)__atomic24_sub(1, (v))) - -#define atomic24_add_negative(i, v) (__atomic24_add((i), (v)) < 0) -  /* Atomic operations are already serializing */  #define smp_mb__before_atomic_dec()	barrier()  #define smp_mb__after_atomic_dec()	barrier()  #define smp_mb__before_atomic_inc()	barrier()  #define smp_mb__after_atomic_inc()	barrier() -#endif /* !(__KERNEL__) */ -  #endif /* !(__ARCH_SPARC_ATOMIC__) */ diff --git a/arch/sparc/include/asm/io_32.h b/arch/sparc/include/asm/io_32.h index c2ced21c9dc1..2006e5d359df 100644 --- a/arch/sparc/include/asm/io_32.h +++ b/arch/sparc/include/asm/io_32.h @@ -7,6 +7,7 @@  #include <asm/page.h>      /* IO address mapping routines need this */  #include <asm/system.h> +#include <asm-generic/pci_iomap.h>  #define page_to_phys(page)	(page_to_pfn(page) << PAGE_SHIFT) @@ -324,7 +325,6 @@ extern void ioport_unmap(void __iomem *);  /* Create a virtual mapping cookie for a PCI BAR (memory or IO) */  struct pci_dev; -extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);  extern void pci_iounmap(struct pci_dev *dev, void __iomem *);  /* diff --git a/arch/sparc/include/asm/io_64.h b/arch/sparc/include/asm/io_64.h index 9c8965415f0a..9481e5a6fa90 100644 --- a/arch/sparc/include/asm/io_64.h +++ b/arch/sparc/include/asm/io_64.h @@ -8,6 +8,7 @@  #include <asm/page.h>      /* IO address mapping routines need this */  #include <asm/system.h>  #include <asm/asi.h> +#include <asm-generic/pci_iomap.h>  /* PC crapola... */  #define __SLOW_DOWN_IO	do { } while (0) @@ -514,7 +515,6 @@ extern void ioport_unmap(void __iomem *);  /* Create a virtual mapping cookie for a PCI BAR (memory or IO) */  struct pci_dev; -extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);  extern void pci_iounmap(struct pci_dev *dev, void __iomem *);  static inline int sbus_can_dma_64bit(void) diff --git a/arch/sparc/include/asm/memblock.h b/arch/sparc/include/asm/memblock.h deleted file mode 100644 index c67b047ef85e..000000000000 --- a/arch/sparc/include/asm/memblock.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef _SPARC64_MEMBLOCK_H -#define _SPARC64_MEMBLOCK_H - -#include <asm/oplib.h> - -#define MEMBLOCK_DBG(fmt...) prom_printf(fmt) - -#endif /* !(_SPARC64_MEMBLOCK_H) */ diff --git a/arch/sparc/include/asm/page_32.h b/arch/sparc/include/asm/page_32.h index 156707b0f18d..bb5c2ac4055d 100644 --- a/arch/sparc/include/asm/page_32.h +++ b/arch/sparc/include/asm/page_32.h @@ -8,14 +8,10 @@  #ifndef _SPARC_PAGE_H  #define _SPARC_PAGE_H -#define PAGE_SHIFT   12 +#include <linux/const.h> -#ifndef __ASSEMBLY__ -/* I have my suspicions... -DaveM */ -#define PAGE_SIZE    (1UL << PAGE_SHIFT) -#else -#define PAGE_SIZE    (1 << PAGE_SHIFT) -#endif +#define PAGE_SHIFT   12 +#define PAGE_SIZE    (_AC(1, UL) << PAGE_SHIFT)  #define PAGE_MASK    (~(PAGE_SIZE-1))  #include <asm/btfixup.h> diff --git a/arch/sparc/include/asm/pgtable_32.h b/arch/sparc/include/asm/pgtable_32.h index 5b31a8e89823..a790cc657476 100644 --- a/arch/sparc/include/asm/pgtable_32.h +++ b/arch/sparc/include/asm/pgtable_32.h @@ -431,10 +431,6 @@ extern unsigned long *sparc_valid_addr_bitmap;  #define kern_addr_valid(addr) \  	(test_bit(__pa((unsigned long)(addr))>>20, sparc_valid_addr_bitmap)) -extern int io_remap_pfn_range(struct vm_area_struct *vma, -			      unsigned long from, unsigned long pfn, -			      unsigned long size, pgprot_t prot); -  /*   * For sparc32&64, the pfn in io_remap_pfn_range() carries <iospace> in   * its high 4 bits.  These macros/functions put it there or get it from there. @@ -443,6 +439,22 @@ extern int io_remap_pfn_range(struct vm_area_struct *vma,  #define GET_IOSPACE(pfn)		(pfn >> (BITS_PER_LONG - 4))  #define GET_PFN(pfn)			(pfn & 0x0fffffffUL) +extern int remap_pfn_range(struct vm_area_struct *, unsigned long, unsigned long, +			   unsigned long, pgprot_t); + +static inline int io_remap_pfn_range(struct vm_area_struct *vma, +				     unsigned long from, unsigned long pfn, +				     unsigned long size, pgprot_t prot) +{ +	unsigned long long offset, space, phys_base; + +	offset = ((unsigned long long) GET_PFN(pfn)) << PAGE_SHIFT; +	space = GET_IOSPACE(pfn); +	phys_base = offset | (space << 32ULL); + +	return remap_pfn_range(vma, from, phys_base >> PAGE_SHIFT, size, prot); +} +  #define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS  #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 adf89329af59..38ebb2c60137 100644 --- a/arch/sparc/include/asm/pgtable_64.h +++ b/arch/sparc/include/asm/pgtable_64.h @@ -757,10 +757,6 @@ static inline bool kern_addr_valid(unsigned long addr)  extern int page_in_phys_avail(unsigned long paddr); -extern int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from, -			       unsigned long pfn, -			       unsigned long size, pgprot_t prot); -  /*   * For sparc32&64, the pfn in io_remap_pfn_range() carries <iospace> in   * its high 4 bits.  These macros/functions put it there or get it from there. @@ -769,6 +765,22 @@ extern int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from,  #define GET_IOSPACE(pfn)		(pfn >> (BITS_PER_LONG - 4))  #define GET_PFN(pfn)			(pfn & 0x0fffffffffffffffUL) +extern int remap_pfn_range(struct vm_area_struct *, unsigned long, unsigned long, +			   unsigned long, pgprot_t); + +static inline int io_remap_pfn_range(struct vm_area_struct *vma, +				     unsigned long from, unsigned long pfn, +				     unsigned long size, pgprot_t prot) +{ +	unsigned long offset = GET_PFN(pfn) << PAGE_SHIFT; +	int space = GET_IOSPACE(pfn); +	unsigned long phys_base; + +	phys_base = offset | (((unsigned long) space) << 32UL); + +	return remap_pfn_range(vma, from, phys_base >> PAGE_SHIFT, size, prot); +} +  #include <asm-generic/pgtable.h>  /* We provide our own get_unmapped_area to cope with VA holes and diff --git a/arch/sparc/include/asm/pgtsun4.h b/arch/sparc/include/asm/pgtsun4.h deleted file mode 100644 index 5a0d661fb82e..000000000000 --- a/arch/sparc/include/asm/pgtsun4.h +++ /dev/null @@ -1,171 +0,0 @@ -/* - * pgtsun4.h:  Sun4 specific pgtable.h defines and code. - * - * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) - * Copyright (C) 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz) - */ -#ifndef _SPARC_PGTSUN4C_H -#define _SPARC_PGTSUN4C_H - -#include <asm/contregs.h> - -/* PMD_SHIFT determines the size of the area a second-level page table can map */ -#define SUN4C_PMD_SHIFT       23 - -/* PGDIR_SHIFT determines what a third-level page table entry can map */ -#define SUN4C_PGDIR_SHIFT       23 -#define SUN4C_PGDIR_SIZE        (1UL << SUN4C_PGDIR_SHIFT) -#define SUN4C_PGDIR_MASK        (~(SUN4C_PGDIR_SIZE-1)) -#define SUN4C_PGDIR_ALIGN(addr) (((addr)+SUN4C_PGDIR_SIZE-1)&SUN4C_PGDIR_MASK) - -/* To represent how the sun4c mmu really lays things out. */ -#define SUN4C_REAL_PGDIR_SHIFT       18 -#define SUN4C_REAL_PGDIR_SIZE        (1UL << SUN4C_REAL_PGDIR_SHIFT) -#define SUN4C_REAL_PGDIR_MASK        (~(SUN4C_REAL_PGDIR_SIZE-1)) -#define SUN4C_REAL_PGDIR_ALIGN(addr) (((addr)+SUN4C_REAL_PGDIR_SIZE-1)&SUN4C_REAL_PGDIR_MASK) - -/* 19 bit PFN on sun4 */ -#define SUN4C_PFN_MASK 0x7ffff -  -/* Don't increase these unless the structures in sun4c.c are fixed */ -#define SUN4C_MAX_SEGMAPS 256 -#define SUN4C_MAX_CONTEXTS 16 - -/* - * To be efficient, and not have to worry about allocating such - * a huge pgd, we make the kernel sun4c tables each hold 1024 - * entries and the pgd similarly just like the i386 tables. - */ -#define SUN4C_PTRS_PER_PTE    1024 -#define SUN4C_PTRS_PER_PMD    1 -#define SUN4C_PTRS_PER_PGD    1024 - -/* - * Sparc SUN4C pte fields. - */ -#define _SUN4C_PAGE_VALID        0x80000000 -#define _SUN4C_PAGE_SILENT_READ  0x80000000   /* synonym */ -#define _SUN4C_PAGE_DIRTY        0x40000000 -#define _SUN4C_PAGE_SILENT_WRITE 0x40000000   /* synonym */ -#define _SUN4C_PAGE_PRIV         0x20000000   /* privileged page */ -#define _SUN4C_PAGE_NOCACHE      0x10000000   /* non-cacheable page */ -#define _SUN4C_PAGE_PRESENT      0x08000000   /* implemented in software */ -#define _SUN4C_PAGE_IO           0x04000000   /* I/O page */ -#define _SUN4C_PAGE_FILE         0x02000000   /* implemented in software */ -#define _SUN4C_PAGE_READ         0x00800000   /* implemented in software */ -#define _SUN4C_PAGE_WRITE        0x00400000   /* implemented in software */ -#define _SUN4C_PAGE_ACCESSED     0x00200000   /* implemented in software */ -#define _SUN4C_PAGE_MODIFIED     0x00100000   /* implemented in software */ - -#define _SUN4C_READABLE		(_SUN4C_PAGE_READ|_SUN4C_PAGE_SILENT_READ|\ -				 _SUN4C_PAGE_ACCESSED) -#define _SUN4C_WRITEABLE	(_SUN4C_PAGE_WRITE|_SUN4C_PAGE_SILENT_WRITE|\ -				 _SUN4C_PAGE_MODIFIED) - -#define _SUN4C_PAGE_CHG_MASK	(0xffff|_SUN4C_PAGE_ACCESSED|_SUN4C_PAGE_MODIFIED) - -#define SUN4C_PAGE_NONE		__pgprot(_SUN4C_PAGE_PRESENT) -#define SUN4C_PAGE_SHARED	__pgprot(_SUN4C_PAGE_PRESENT|_SUN4C_READABLE|\ -					 _SUN4C_PAGE_WRITE) -#define SUN4C_PAGE_COPY		__pgprot(_SUN4C_PAGE_PRESENT|_SUN4C_READABLE) -#define SUN4C_PAGE_READONLY	__pgprot(_SUN4C_PAGE_PRESENT|_SUN4C_READABLE) -#define SUN4C_PAGE_KERNEL	__pgprot(_SUN4C_READABLE|_SUN4C_WRITEABLE|\ -					 _SUN4C_PAGE_DIRTY|_SUN4C_PAGE_PRIV) - -/* SUN4C swap entry encoding - * - * We use 5 bits for the type and 19 for the offset.  This gives us - * 32 swapfiles of 4GB each.  Encoding looks like: - * - * RRRRRRRRooooooooooooooooooottttt - * fedcba9876543210fedcba9876543210 - * - * The top 8 bits are reserved for protection and status bits, especially - * FILE and PRESENT. - */ -#define SUN4C_SWP_TYPE_MASK	0x1f -#define SUN4C_SWP_OFF_MASK	0x7ffff -#define SUN4C_SWP_OFF_SHIFT	5 - -#ifndef __ASSEMBLY__ - -static inline unsigned long sun4c_get_synchronous_error(void) -{ -	unsigned long sync_err; - -	__asm__ __volatile__("lda [%1] %2, %0\n\t" : -			     "=r" (sync_err) : -			     "r" (AC_SYNC_ERR), "i" (ASI_CONTROL)); -	return sync_err; -} - -static inline unsigned long sun4c_get_synchronous_address(void) -{ -	unsigned long sync_addr; - -	__asm__ __volatile__("lda [%1] %2, %0\n\t" : -			     "=r" (sync_addr) : -			     "r" (AC_SYNC_VA), "i" (ASI_CONTROL)); -	return sync_addr; -} - -/* SUN4 pte, segmap, and context manipulation */ -static inline unsigned long sun4c_get_segmap(unsigned long addr) -{ -  register unsigned long entry; - -  __asm__ __volatile__("\n\tlduha [%1] %2, %0\n\t" :  -		       "=r" (entry) : -		       "r" (addr), "i" (ASI_SEGMAP)); -  return entry; -} - -static inline void sun4c_put_segmap(unsigned long addr, unsigned long entry) -{ -  __asm__ __volatile__("\n\tstha %1, [%0] %2; nop; nop; nop;\n\t" : : -		       "r" (addr), "r" (entry), -		       "i" (ASI_SEGMAP) -		       : "memory"); -} - -static inline unsigned long sun4c_get_pte(unsigned long addr) -{ -  register unsigned long entry; - -  __asm__ __volatile__("\n\tlda [%1] %2, %0\n\t" :  -		       "=r" (entry) : -		       "r" (addr), "i" (ASI_PTE)); -  return entry; -} - -static inline void sun4c_put_pte(unsigned long addr, unsigned long entry) -{ -  __asm__ __volatile__("\n\tsta %1, [%0] %2; nop; nop; nop;\n\t" : : -		       "r" (addr),  -		       "r" ((entry & ~(_SUN4C_PAGE_PRESENT))), "i" (ASI_PTE) -		       : "memory"); -} - -static inline int sun4c_get_context(void) -{ -  register int ctx; - -  __asm__ __volatile__("\n\tlduba [%1] %2, %0\n\t" : -		       "=r" (ctx) : -		       "r" (AC_CONTEXT), "i" (ASI_CONTROL)); - -  return ctx; -} - -static inline int sun4c_set_context(int ctx) -{ -  __asm__ __volatile__("\n\tstba %0, [%1] %2; nop; nop; nop;\n\t" : : -		       "r" (ctx), "r" (AC_CONTEXT), "i" (ASI_CONTROL) -		       : "memory"); - -  return ctx; -} - -#endif /* !(__ASSEMBLY__) */ - -#endif /* !(_SPARC_PGTSUN4_H) */ diff --git a/arch/sparc/include/asm/posix_types.h b/arch/sparc/include/asm/posix_types.h index 98d6ebb922fb..dbfc1a34b3a2 100644 --- a/arch/sparc/include/asm/posix_types.h +++ b/arch/sparc/include/asm/posix_types.h @@ -20,7 +20,6 @@ typedef unsigned int           __kernel_uid_t;  typedef unsigned int           __kernel_gid_t;  typedef unsigned long          __kernel_ino_t;  typedef unsigned int           __kernel_mode_t; -typedef unsigned short         __kernel_umode_t;  typedef unsigned int           __kernel_nlink_t;  typedef int                    __kernel_daddr_t;  typedef long                   __kernel_off_t; @@ -55,7 +54,6 @@ typedef unsigned short         __kernel_uid_t;  typedef unsigned short         __kernel_gid_t;  typedef unsigned long          __kernel_ino_t;  typedef unsigned short         __kernel_mode_t; -typedef unsigned short         __kernel_umode_t;  typedef short                  __kernel_nlink_t;  typedef long                   __kernel_daddr_t;  typedef long                   __kernel_off_t; diff --git a/arch/sparc/include/asm/signal.h b/arch/sparc/include/asm/signal.h index e49b828a2471..aa42fe30d5b9 100644 --- a/arch/sparc/include/asm/signal.h +++ b/arch/sparc/include/asm/signal.h @@ -143,10 +143,11 @@ struct sigstack {  #define SA_ONSTACK	_SV_SSTACK  #define SA_RESTART	_SV_INTR  #define SA_ONESHOT	_SV_RESET -#define SA_NOMASK	0x20u +#define SA_NODEFER	0x20u  #define SA_NOCLDWAIT    0x100u  #define SA_SIGINFO      0x200u +#define SA_NOMASK	SA_NODEFER  #define SIG_BLOCK          0x01	/* for blocking signals */  #define SIG_UNBLOCK        0x02	/* for unblocking signals */ diff --git a/arch/sparc/include/asm/socket.h b/arch/sparc/include/asm/socket.h index 9d3fefcff2f5..8af1b64168b3 100644 --- a/arch/sparc/include/asm/socket.h +++ b/arch/sparc/include/asm/socket.h @@ -58,6 +58,9 @@  #define SO_RXQ_OVFL             0x0024 +#define SO_WIFI_STATUS		0x0025 +#define SCM_WIFI_STATUS		SO_WIFI_STATUS +  /* Security levels - as per NRL IPv6 - don't actually do anything */  #define SO_SECURITY_AUTHENTICATION		0x5001  #define SO_SECURITY_ENCRYPTION_TRANSPORT	0x5002 diff --git a/arch/sparc/include/asm/thread_info_32.h b/arch/sparc/include/asm/thread_info_32.h index fa5753233410..c2a1080cdd3b 100644 --- a/arch/sparc/include/asm/thread_info_32.h +++ b/arch/sparc/include/asm/thread_info_32.h @@ -95,7 +95,7 @@ BTFIXUPDEF_CALL(void, free_thread_info, struct thread_info *)   * Observe the order of get_free_pages() in alloc_thread_info_node().   * The sun4 has 8K stack too, because it's short on memory, and 16K is a waste.   */ -#define THREAD_SIZE		8192 +#define THREAD_SIZE		(2 * PAGE_SIZE)  /*   * Offsets in thread_info structure, used in assembly code @@ -133,7 +133,6 @@ BTFIXUPDEF_CALL(void, free_thread_info, struct thread_info *)  #define TIF_POLLING_NRFLAG	9	/* true if poll_idle() is polling  					 * TIF_NEED_RESCHED */  #define TIF_MEMDIE		10	/* is terminating due to OOM killer */ -#define TIF_FREEZE		11	/* is freezing for suspend */  /* as above, but as bit values */  #define _TIF_SYSCALL_TRACE	(1<<TIF_SYSCALL_TRACE) @@ -147,7 +146,6 @@ BTFIXUPDEF_CALL(void, free_thread_info, struct thread_info *)  #define _TIF_DO_NOTIFY_RESUME_MASK	(_TIF_NOTIFY_RESUME | \  					 _TIF_SIGPENDING | \  					 _TIF_RESTORE_SIGMASK) -#define _TIF_FREEZE		(1<<TIF_FREEZE)  #endif /* __KERNEL__ */ diff --git a/arch/sparc/include/asm/thread_info_64.h b/arch/sparc/include/asm/thread_info_64.h index 60d86be1a533..01d057fe6a3f 100644 --- a/arch/sparc/include/asm/thread_info_64.h +++ b/arch/sparc/include/asm/thread_info_64.h @@ -225,7 +225,6 @@ register struct thread_info *current_thread_info_reg asm("g6");  /* flag bit 12 is available */  #define TIF_MEMDIE		13	/* is terminating due to OOM killer */  #define TIF_POLLING_NRFLAG	14 -#define TIF_FREEZE		15	/* is freezing for suspend */  #define _TIF_SYSCALL_TRACE	(1<<TIF_SYSCALL_TRACE)  #define _TIF_NOTIFY_RESUME	(1<<TIF_NOTIFY_RESUME) @@ -237,7 +236,6 @@ register struct thread_info *current_thread_info_reg asm("g6");  #define _TIF_SYSCALL_AUDIT	(1<<TIF_SYSCALL_AUDIT)  #define _TIF_SYSCALL_TRACEPOINT	(1<<TIF_SYSCALL_TRACEPOINT)  #define _TIF_POLLING_NRFLAG	(1<<TIF_POLLING_NRFLAG) -#define _TIF_FREEZE		(1<<TIF_FREEZE)  #define _TIF_USER_WORK_MASK	((0xff << TI_FLAG_WSAVED_SHIFT) | \  				 _TIF_DO_NOTIFY_RESUME_MASK | \ diff --git a/arch/sparc/include/asm/types.h b/arch/sparc/include/asm/types.h index 91e5a034f987..383d156cde9c 100644 --- a/arch/sparc/include/asm/types.h +++ b/arch/sparc/include/asm/types.h @@ -12,12 +12,6 @@  #include <asm-generic/int-ll64.h> -#ifndef __ASSEMBLY__ - -typedef unsigned short umode_t; - -#endif /* __ASSEMBLY__ */ -  #endif /* defined(__sparc__) */  #endif /* defined(_SPARC_TYPES_H) */ diff --git a/arch/sparc/include/asm/unistd.h b/arch/sparc/include/asm/unistd.h index 6260d5deeabc..c7cb0af0eb59 100644 --- a/arch/sparc/include/asm/unistd.h +++ b/arch/sparc/include/asm/unistd.h @@ -406,8 +406,10 @@  #define __NR_syncfs		335  #define __NR_sendmmsg		336  #define __NR_setns		337 +#define __NR_process_vm_readv	338 +#define __NR_process_vm_writev	339 -#define NR_syscalls		338 +#define NR_syscalls		340  #ifdef __32bit_syscall_numbers__  /* Sparc 32-bit only has the "setresuid32", "getresuid32" variants, diff --git a/arch/sparc/kernel/ds.c b/arch/sparc/kernel/ds.c index 7429b47c3aca..381edcd5bc29 100644 --- a/arch/sparc/kernel/ds.c +++ b/arch/sparc/kernel/ds.c @@ -1181,13 +1181,11 @@ static int __devinit ds_probe(struct vio_dev *vdev,  	dp->rcv_buf_len = 4096; -	dp->ds_states = kzalloc(sizeof(ds_states_template), -				GFP_KERNEL); +	dp->ds_states = kmemdup(ds_states_template, +				sizeof(ds_states_template), GFP_KERNEL);  	if (!dp->ds_states)  		goto out_free_rcv_buf; -	memcpy(dp->ds_states, ds_states_template, -	       sizeof(ds_states_template));  	dp->num_ds_states = ARRAY_SIZE(ds_states_template);  	for (i = 0; i < dp->num_ds_states; i++) diff --git a/arch/sparc/kernel/entry.h b/arch/sparc/kernel/entry.h index e27f8ea8656e..0c218e4c0881 100644 --- a/arch/sparc/kernel/entry.h +++ b/arch/sparc/kernel/entry.h @@ -42,6 +42,9 @@ extern void fpsave(unsigned long *fpregs, unsigned long *fsr,  extern void fpload(unsigned long *fpregs, unsigned long *fsr);  #else /* CONFIG_SPARC32 */ + +#include <asm/trap_block.h> +  struct popc_3insn_patch_entry {  	unsigned int	addr;  	unsigned int	insns[3]; @@ -57,6 +60,10 @@ extern struct popc_6insn_patch_entry __popc_6insn_patch,  	__popc_6insn_patch_end;  extern void __init per_cpu_patch(void); +extern void sun4v_patch_1insn_range(struct sun4v_1insn_patch_entry *, +				    struct sun4v_1insn_patch_entry *); +extern void sun4v_patch_2insn_range(struct sun4v_2insn_patch_entry *, +				    struct sun4v_2insn_patch_entry *);  extern void __init sun4v_patch(void);  extern void __init boot_cpu_id_too_large(int cpu);  extern unsigned int dcache_parity_tl1_occurred; diff --git a/arch/sparc/kernel/module.c b/arch/sparc/kernel/module.c index da0c6c70ccb2..e5519870c3d9 100644 --- a/arch/sparc/kernel/module.c +++ b/arch/sparc/kernel/module.c @@ -17,6 +17,8 @@  #include <asm/processor.h>  #include <asm/spitfire.h> +#include "entry.h" +  #ifdef CONFIG_SPARC64  #include <linux/jump_label.h> @@ -203,6 +205,29 @@ int apply_relocate_add(Elf_Shdr *sechdrs,  }  #ifdef CONFIG_SPARC64 +static void do_patch_sections(const Elf_Ehdr *hdr, +			      const Elf_Shdr *sechdrs) +{ +	const Elf_Shdr *s, *sun4v_1insn = NULL, *sun4v_2insn = NULL; +	char *secstrings = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset; + +	for (s = sechdrs; s < sechdrs + hdr->e_shnum; s++) { +		if (!strcmp(".sun4v_1insn_patch", secstrings + s->sh_name)) +			sun4v_1insn = s; +		if (!strcmp(".sun4v_2insn_patch", secstrings + s->sh_name)) +			sun4v_2insn = s; +	} + +	if (sun4v_1insn && tlb_type == hypervisor) { +		void *p = (void *) sun4v_1insn->sh_addr; +		sun4v_patch_1insn_range(p, p + sun4v_1insn->sh_size); +	} +	if (sun4v_2insn && tlb_type == hypervisor) { +		void *p = (void *) sun4v_2insn->sh_addr; +		sun4v_patch_2insn_range(p, p + sun4v_2insn->sh_size); +	} +} +  int module_finalize(const Elf_Ehdr *hdr,  		    const Elf_Shdr *sechdrs,  		    struct module *me) @@ -210,6 +235,8 @@ int module_finalize(const Elf_Ehdr *hdr,  	/* make jump label nops */  	jump_label_apply_nops(me); +	do_patch_sections(hdr, sechdrs); +  	/* Cheetah's I-cache is fully coherent.  */  	if (tlb_type == spitfire) {  		unsigned long va; diff --git a/arch/sparc/kernel/pci_sun4v.c b/arch/sparc/kernel/pci_sun4v.c index b272cda35a01..af5755d20fbe 100644 --- a/arch/sparc/kernel/pci_sun4v.c +++ b/arch/sparc/kernel/pci_sun4v.c @@ -849,10 +849,10 @@ static int pci_sun4v_msiq_build_irq(struct pci_pbm_info *pbm,  	if (!irq)  		return -ENOMEM; -	if (pci_sun4v_msiq_setstate(pbm->devhandle, msiqid, HV_MSIQSTATE_IDLE)) -		return -EINVAL;  	if (pci_sun4v_msiq_setvalid(pbm->devhandle, msiqid, HV_MSIQ_VALID))  		return -EINVAL; +	if (pci_sun4v_msiq_setstate(pbm->devhandle, msiqid, HV_MSIQSTATE_IDLE)) +		return -EINVAL;  	return irq;  } diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c index 3739a06a76cb..39d8b05201a2 100644 --- a/arch/sparc/kernel/process_64.c +++ b/arch/sparc/kernel/process_64.c @@ -95,12 +95,14 @@ void cpu_idle(void)  	set_thread_flag(TIF_POLLING_NRFLAG);  	while(1) { -		tick_nohz_stop_sched_tick(1); +		tick_nohz_idle_enter(); +		rcu_idle_enter();  		while (!need_resched() && !cpu_is_offline(cpu))  			sparc64_yield(cpu); -		tick_nohz_restart_sched_tick(); +		rcu_idle_exit(); +		tick_nohz_idle_exit();  		preempt_enable_no_resched(); diff --git a/arch/sparc/kernel/prom_common.c b/arch/sparc/kernel/prom_common.c index 46614807a57f..741df916c124 100644 --- a/arch/sparc/kernel/prom_common.c +++ b/arch/sparc/kernel/prom_common.c @@ -58,12 +58,10 @@ int of_set_property(struct device_node *dp, const char *name, void *val, int len  	void *new_val;  	int err; -	new_val = kmalloc(len, GFP_KERNEL); +	new_val = kmemdup(val, len, GFP_KERNEL);  	if (!new_val)  		return -ENOMEM; -	memcpy(new_val, val, len); -  	err = -ENODEV;  	mutex_lock(&of_set_property_mutex); diff --git a/arch/sparc/kernel/setup_32.c b/arch/sparc/kernel/setup_32.c index fe1e3fc31bc5..ffb883ddd0f0 100644 --- a/arch/sparc/kernel/setup_32.c +++ b/arch/sparc/kernel/setup_32.c @@ -84,7 +84,7 @@ static void prom_sync_me(void)  	prom_printf("PROM SYNC COMMAND...\n");  	show_free_areas(0); -	if(current->pid != 0) { +	if (!is_idle_task(current)) {  		local_irq_enable();  		sys_sync();  		local_irq_disable(); diff --git a/arch/sparc/kernel/setup_64.c b/arch/sparc/kernel/setup_64.c index c965595aa7e9..a854a1c240ff 100644 --- a/arch/sparc/kernel/setup_64.c +++ b/arch/sparc/kernel/setup_64.c @@ -234,40 +234,50 @@ void __init per_cpu_patch(void)  	}  } -void __init sun4v_patch(void) +void sun4v_patch_1insn_range(struct sun4v_1insn_patch_entry *start, +			     struct sun4v_1insn_patch_entry *end)  { -	extern void sun4v_hvapi_init(void); -	struct sun4v_1insn_patch_entry *p1; -	struct sun4v_2insn_patch_entry *p2; - -	if (tlb_type != hypervisor) -		return; +	while (start < end) { +		unsigned long addr = start->addr; -	p1 = &__sun4v_1insn_patch; -	while (p1 < &__sun4v_1insn_patch_end) { -		unsigned long addr = p1->addr; - -		*(unsigned int *) (addr +  0) = p1->insn; +		*(unsigned int *) (addr +  0) = start->insn;  		wmb();  		__asm__ __volatile__("flush	%0" : : "r" (addr +  0)); -		p1++; +		start++;  	} +} -	p2 = &__sun4v_2insn_patch; -	while (p2 < &__sun4v_2insn_patch_end) { -		unsigned long addr = p2->addr; +void sun4v_patch_2insn_range(struct sun4v_2insn_patch_entry *start, +			     struct sun4v_2insn_patch_entry *end) +{ +	while (start < end) { +		unsigned long addr = start->addr; -		*(unsigned int *) (addr +  0) = p2->insns[0]; +		*(unsigned int *) (addr +  0) = start->insns[0];  		wmb();  		__asm__ __volatile__("flush	%0" : : "r" (addr +  0)); -		*(unsigned int *) (addr +  4) = p2->insns[1]; +		*(unsigned int *) (addr +  4) = start->insns[1];  		wmb();  		__asm__ __volatile__("flush	%0" : : "r" (addr +  4)); -		p2++; +		start++;  	} +} + +void __init sun4v_patch(void) +{ +	extern void sun4v_hvapi_init(void); + +	if (tlb_type != hypervisor) +		return; + +	sun4v_patch_1insn_range(&__sun4v_1insn_patch, +				&__sun4v_1insn_patch_end); + +	sun4v_patch_2insn_range(&__sun4v_2insn_patch, +				&__sun4v_2insn_patch_end);  	sun4v_hvapi_init();  } diff --git a/arch/sparc/kernel/signal32.c b/arch/sparc/kernel/signal32.c index 2caa556db86d..023b8860dc97 100644 --- a/arch/sparc/kernel/signal32.c +++ b/arch/sparc/kernel/signal32.c @@ -822,21 +822,23 @@ static inline void syscall_restart32(unsigned long orig_i0, struct pt_regs *regs   * want to handle. Thus you cannot kill init even with a SIGKILL even by   * mistake.   */ -void do_signal32(sigset_t *oldset, struct pt_regs * regs, -		 int restart_syscall, unsigned long orig_i0) +void do_signal32(sigset_t *oldset, struct pt_regs * regs)  {  	struct k_sigaction ka; +	unsigned long orig_i0; +	int restart_syscall;  	siginfo_t info;  	int signr;  	signr = get_signal_to_deliver(&info, &ka, regs, NULL); -	/* If the debugger messes with the program counter, it clears -	 * the "in syscall" bit, directing us to not perform a syscall -	 * restart. -	 */ -	if (restart_syscall && !pt_regs_is_syscall(regs)) -		restart_syscall = 0; +	restart_syscall = 0; +	orig_i0 = 0; +	if (pt_regs_is_syscall(regs) && +	    (regs->tstate & (TSTATE_XCARRY | TSTATE_ICARRY))) { +		restart_syscall = 1; +		orig_i0 = regs->u_regs[UREG_G6]; +	}  	if (signr > 0) {  		if (restart_syscall) diff --git a/arch/sparc/kernel/signal_32.c b/arch/sparc/kernel/signal_32.c index 8ce247ac04cc..d54c6e53aba0 100644 --- a/arch/sparc/kernel/signal_32.c +++ b/arch/sparc/kernel/signal_32.c @@ -519,10 +519,26 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0)  	siginfo_t info;  	int signr; +	/* It's a lot of work and synchronization to add a new ptrace +	 * register for GDB to save and restore in order to get +	 * orig_i0 correct for syscall restarts when debugging. +	 * +	 * Although it should be the case that most of the global +	 * registers are volatile across a system call, glibc already +	 * depends upon that fact that we preserve them.  So we can't +	 * just use any global register to save away the orig_i0 value. +	 * +	 * In particular %g2, %g3, %g4, and %g5 are all assumed to be +	 * preserved across a system call trap by various pieces of +	 * code in glibc. +	 * +	 * %g7 is used as the "thread register".   %g6 is not used in +	 * any fixed manner.  %g6 is used as a scratch register and +	 * a compiler temporary, but it's value is never used across +	 * a system call.  Therefore %g6 is usable for orig_i0 storage. +	 */  	if (pt_regs_is_syscall(regs) && (regs->psr & PSR_C)) -		restart_syscall = 1; -	else -		restart_syscall = 0; +		regs->u_regs[UREG_G6] = orig_i0;  	if (test_thread_flag(TIF_RESTORE_SIGMASK))  		oldset = ¤t->saved_sigmask; @@ -535,8 +551,12 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0)  	 * the software "in syscall" bit, directing us to not perform  	 * a syscall restart.  	 */ -	if (restart_syscall && !pt_regs_is_syscall(regs)) -		restart_syscall = 0; +	restart_syscall = 0; +	if (pt_regs_is_syscall(regs) && (regs->psr & PSR_C)) { +		restart_syscall = 1; +		orig_i0 = regs->u_regs[UREG_G6]; +	} +  	if (signr > 0) {  		if (restart_syscall) diff --git a/arch/sparc/kernel/signal_64.c b/arch/sparc/kernel/signal_64.c index a2b81598d905..f0836cd0e2f2 100644 --- a/arch/sparc/kernel/signal_64.c +++ b/arch/sparc/kernel/signal_64.c @@ -529,11 +529,27 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0)  	siginfo_t info;  	int signr; +	/* It's a lot of work and synchronization to add a new ptrace +	 * register for GDB to save and restore in order to get +	 * orig_i0 correct for syscall restarts when debugging. +	 * +	 * Although it should be the case that most of the global +	 * registers are volatile across a system call, glibc already +	 * depends upon that fact that we preserve them.  So we can't +	 * just use any global register to save away the orig_i0 value. +	 * +	 * In particular %g2, %g3, %g4, and %g5 are all assumed to be +	 * preserved across a system call trap by various pieces of +	 * code in glibc. +	 * +	 * %g7 is used as the "thread register".   %g6 is not used in +	 * any fixed manner.  %g6 is used as a scratch register and +	 * a compiler temporary, but it's value is never used across +	 * a system call.  Therefore %g6 is usable for orig_i0 storage. +	 */  	if (pt_regs_is_syscall(regs) && -	    (regs->tstate & (TSTATE_XCARRY | TSTATE_ICARRY))) { -		restart_syscall = 1; -	} else -		restart_syscall = 0; +	    (regs->tstate & (TSTATE_XCARRY | TSTATE_ICARRY))) +		regs->u_regs[UREG_G6] = orig_i0;  	if (current_thread_info()->status & TS_RESTORE_SIGMASK)  		oldset = ¤t->saved_sigmask; @@ -542,22 +558,20 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0)  #ifdef CONFIG_COMPAT  	if (test_thread_flag(TIF_32BIT)) { -		extern void do_signal32(sigset_t *, struct pt_regs *, -					int restart_syscall, -					unsigned long orig_i0); -		do_signal32(oldset, regs, restart_syscall, orig_i0); +		extern void do_signal32(sigset_t *, struct pt_regs *); +		do_signal32(oldset, regs);  		return;  	}  #endif	  	signr = get_signal_to_deliver(&info, &ka, regs, NULL); -	/* If the debugger messes with the program counter, it clears -	 * the software "in syscall" bit, directing us to not perform -	 * a syscall restart. -	 */ -	if (restart_syscall && !pt_regs_is_syscall(regs)) -		restart_syscall = 0; +	restart_syscall = 0; +	if (pt_regs_is_syscall(regs) && +	    (regs->tstate & (TSTATE_XCARRY | TSTATE_ICARRY))) { +		restart_syscall = 1; +		orig_i0 = regs->u_regs[UREG_G6]; +	}  	if (signr > 0) {  		if (restart_syscall) diff --git a/arch/sparc/kernel/sigutil_64.c b/arch/sparc/kernel/sigutil_64.c index e7dc508c38eb..b19570d41a39 100644 --- a/arch/sparc/kernel/sigutil_64.c +++ b/arch/sparc/kernel/sigutil_64.c @@ -2,6 +2,7 @@  #include <linux/types.h>  #include <linux/thread_info.h>  #include <linux/uaccess.h> +#include <linux/errno.h>  #include <asm/sigcontext.h>  #include <asm/fpumacro.h> diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c index 75607724d290..3b1bd7c50164 100644 --- a/arch/sparc/kernel/smp_64.c +++ b/arch/sparc/kernel/smp_64.c @@ -840,7 +840,7 @@ static void tsb_sync(void *info)  	struct trap_per_cpu *tp = &trap_block[raw_smp_processor_id()];  	struct mm_struct *mm = info; -	/* It is not valid to test "currrent->active_mm == mm" here. +	/* It is not valid to test "current->active_mm == mm" here.  	 *  	 * The value of "current" is not changed atomically with  	 * switch_mm().  But that's OK, we just need to check the diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c index 441521ad8a3f..232df9949530 100644 --- a/arch/sparc/kernel/sys_sparc_64.c +++ b/arch/sparc/kernel/sys_sparc_64.c @@ -368,11 +368,11 @@ static unsigned long mmap_rnd(void)  	if (current->flags & PF_RANDOMIZE) {  		unsigned long val = get_random_int();  		if (test_thread_flag(TIF_32BIT)) -			rnd = (val % (1UL << (22UL-PAGE_SHIFT))); +			rnd = (val % (1UL << (23UL-PAGE_SHIFT)));  		else -			rnd = (val % (1UL << (29UL-PAGE_SHIFT))); +			rnd = (val % (1UL << (30UL-PAGE_SHIFT)));  	} -	return (rnd << PAGE_SHIFT) * 2; +	return rnd << PAGE_SHIFT;  }  void arch_pick_mmap_layout(struct mm_struct *mm) diff --git a/arch/sparc/kernel/sysfs.c b/arch/sparc/kernel/sysfs.c index 7408201d7efb..654e8aad3bbe 100644 --- a/arch/sparc/kernel/sysfs.c +++ b/arch/sparc/kernel/sysfs.c @@ -3,7 +3,7 @@   * Copyright (C) 2007 David S. Miller <davem@davemloft.net>   */  #include <linux/sched.h> -#include <linux/sysdev.h> +#include <linux/device.h>  #include <linux/cpu.h>  #include <linux/smp.h>  #include <linux/percpu.h> @@ -16,13 +16,13 @@  static DEFINE_PER_CPU(struct hv_mmu_statistics, mmu_stats) __attribute__((aligned(64)));  #define SHOW_MMUSTAT_ULONG(NAME) \ -static ssize_t show_##NAME(struct sys_device *dev, \ -			struct sysdev_attribute *attr, char *buf) \ +static ssize_t show_##NAME(struct device *dev, \ +			struct device_attribute *attr, char *buf) \  { \  	struct hv_mmu_statistics *p = &per_cpu(mmu_stats, dev->id); \  	return sprintf(buf, "%lu\n", p->NAME); \  } \ -static SYSDEV_ATTR(NAME, 0444, show_##NAME, NULL) +static DEVICE_ATTR(NAME, 0444, show_##NAME, NULL)  SHOW_MMUSTAT_ULONG(immu_tsb_hits_ctx0_8k_tte);  SHOW_MMUSTAT_ULONG(immu_tsb_ticks_ctx0_8k_tte); @@ -58,38 +58,38 @@ SHOW_MMUSTAT_ULONG(dmmu_tsb_hits_ctxnon0_256mb_tte);  SHOW_MMUSTAT_ULONG(dmmu_tsb_ticks_ctxnon0_256mb_tte);  static struct attribute *mmu_stat_attrs[] = { -	&attr_immu_tsb_hits_ctx0_8k_tte.attr, -	&attr_immu_tsb_ticks_ctx0_8k_tte.attr, -	&attr_immu_tsb_hits_ctx0_64k_tte.attr, -	&attr_immu_tsb_ticks_ctx0_64k_tte.attr, -	&attr_immu_tsb_hits_ctx0_4mb_tte.attr, -	&attr_immu_tsb_ticks_ctx0_4mb_tte.attr, -	&attr_immu_tsb_hits_ctx0_256mb_tte.attr, -	&attr_immu_tsb_ticks_ctx0_256mb_tte.attr, -	&attr_immu_tsb_hits_ctxnon0_8k_tte.attr, -	&attr_immu_tsb_ticks_ctxnon0_8k_tte.attr, -	&attr_immu_tsb_hits_ctxnon0_64k_tte.attr, -	&attr_immu_tsb_ticks_ctxnon0_64k_tte.attr, -	&attr_immu_tsb_hits_ctxnon0_4mb_tte.attr, -	&attr_immu_tsb_ticks_ctxnon0_4mb_tte.attr, -	&attr_immu_tsb_hits_ctxnon0_256mb_tte.attr, -	&attr_immu_tsb_ticks_ctxnon0_256mb_tte.attr, -	&attr_dmmu_tsb_hits_ctx0_8k_tte.attr, -	&attr_dmmu_tsb_ticks_ctx0_8k_tte.attr, -	&attr_dmmu_tsb_hits_ctx0_64k_tte.attr, -	&attr_dmmu_tsb_ticks_ctx0_64k_tte.attr, -	&attr_dmmu_tsb_hits_ctx0_4mb_tte.attr, -	&attr_dmmu_tsb_ticks_ctx0_4mb_tte.attr, -	&attr_dmmu_tsb_hits_ctx0_256mb_tte.attr, -	&attr_dmmu_tsb_ticks_ctx0_256mb_tte.attr, -	&attr_dmmu_tsb_hits_ctxnon0_8k_tte.attr, -	&attr_dmmu_tsb_ticks_ctxnon0_8k_tte.attr, -	&attr_dmmu_tsb_hits_ctxnon0_64k_tte.attr, -	&attr_dmmu_tsb_ticks_ctxnon0_64k_tte.attr, -	&attr_dmmu_tsb_hits_ctxnon0_4mb_tte.attr, -	&attr_dmmu_tsb_ticks_ctxnon0_4mb_tte.attr, -	&attr_dmmu_tsb_hits_ctxnon0_256mb_tte.attr, -	&attr_dmmu_tsb_ticks_ctxnon0_256mb_tte.attr, +	&dev_attr_immu_tsb_hits_ctx0_8k_tte.attr, +	&dev_attr_immu_tsb_ticks_ctx0_8k_tte.attr, +	&dev_attr_immu_tsb_hits_ctx0_64k_tte.attr, +	&dev_attr_immu_tsb_ticks_ctx0_64k_tte.attr, +	&dev_attr_immu_tsb_hits_ctx0_4mb_tte.attr, +	&dev_attr_immu_tsb_ticks_ctx0_4mb_tte.attr, +	&dev_attr_immu_tsb_hits_ctx0_256mb_tte.attr, +	&dev_attr_immu_tsb_ticks_ctx0_256mb_tte.attr, +	&dev_attr_immu_tsb_hits_ctxnon0_8k_tte.attr, +	&dev_attr_immu_tsb_ticks_ctxnon0_8k_tte.attr, +	&dev_attr_immu_tsb_hits_ctxnon0_64k_tte.attr, +	&dev_attr_immu_tsb_ticks_ctxnon0_64k_tte.attr, +	&dev_attr_immu_tsb_hits_ctxnon0_4mb_tte.attr, +	&dev_attr_immu_tsb_ticks_ctxnon0_4mb_tte.attr, +	&dev_attr_immu_tsb_hits_ctxnon0_256mb_tte.attr, +	&dev_attr_immu_tsb_ticks_ctxnon0_256mb_tte.attr, +	&dev_attr_dmmu_tsb_hits_ctx0_8k_tte.attr, +	&dev_attr_dmmu_tsb_ticks_ctx0_8k_tte.attr, +	&dev_attr_dmmu_tsb_hits_ctx0_64k_tte.attr, +	&dev_attr_dmmu_tsb_ticks_ctx0_64k_tte.attr, +	&dev_attr_dmmu_tsb_hits_ctx0_4mb_tte.attr, +	&dev_attr_dmmu_tsb_ticks_ctx0_4mb_tte.attr, +	&dev_attr_dmmu_tsb_hits_ctx0_256mb_tte.attr, +	&dev_attr_dmmu_tsb_ticks_ctx0_256mb_tte.attr, +	&dev_attr_dmmu_tsb_hits_ctxnon0_8k_tte.attr, +	&dev_attr_dmmu_tsb_ticks_ctxnon0_8k_tte.attr, +	&dev_attr_dmmu_tsb_hits_ctxnon0_64k_tte.attr, +	&dev_attr_dmmu_tsb_ticks_ctxnon0_64k_tte.attr, +	&dev_attr_dmmu_tsb_hits_ctxnon0_4mb_tte.attr, +	&dev_attr_dmmu_tsb_ticks_ctxnon0_4mb_tte.attr, +	&dev_attr_dmmu_tsb_hits_ctxnon0_256mb_tte.attr, +	&dev_attr_dmmu_tsb_ticks_ctxnon0_256mb_tte.attr,  	NULL,  }; @@ -139,15 +139,15 @@ static unsigned long write_mmustat_enable(unsigned long val)  	return sun4v_mmustat_conf(ra, &orig_ra);  } -static ssize_t show_mmustat_enable(struct sys_device *s, -				struct sysdev_attribute *attr, char *buf) +static ssize_t show_mmustat_enable(struct device *s, +				struct device_attribute *attr, char *buf)  {  	unsigned long val = run_on_cpu(s->id, read_mmustat_enable, 0);  	return sprintf(buf, "%lx\n", val);  } -static ssize_t store_mmustat_enable(struct sys_device *s, -			struct sysdev_attribute *attr, const char *buf, +static ssize_t store_mmustat_enable(struct device *s, +			struct device_attribute *attr, const char *buf,  			size_t count)  {  	unsigned long val, err; @@ -163,39 +163,39 @@ static ssize_t store_mmustat_enable(struct sys_device *s,  	return count;  } -static SYSDEV_ATTR(mmustat_enable, 0644, show_mmustat_enable, store_mmustat_enable); +static DEVICE_ATTR(mmustat_enable, 0644, show_mmustat_enable, store_mmustat_enable);  static int mmu_stats_supported; -static int register_mmu_stats(struct sys_device *s) +static int register_mmu_stats(struct device *s)  {  	if (!mmu_stats_supported)  		return 0; -	sysdev_create_file(s, &attr_mmustat_enable); +	device_create_file(s, &dev_attr_mmustat_enable);  	return sysfs_create_group(&s->kobj, &mmu_stat_group);  }  #ifdef CONFIG_HOTPLUG_CPU -static void unregister_mmu_stats(struct sys_device *s) +static void unregister_mmu_stats(struct device *s)  {  	if (!mmu_stats_supported)  		return;  	sysfs_remove_group(&s->kobj, &mmu_stat_group); -	sysdev_remove_file(s, &attr_mmustat_enable); +	device_remove_file(s, &dev_attr_mmustat_enable);  }  #endif  #define SHOW_CPUDATA_ULONG_NAME(NAME, MEMBER) \ -static ssize_t show_##NAME(struct sys_device *dev, \ -		struct sysdev_attribute *attr, char *buf) \ +static ssize_t show_##NAME(struct device *dev, \ +		struct device_attribute *attr, char *buf) \  { \  	cpuinfo_sparc *c = &cpu_data(dev->id); \  	return sprintf(buf, "%lu\n", c->MEMBER); \  }  #define SHOW_CPUDATA_UINT_NAME(NAME, MEMBER) \ -static ssize_t show_##NAME(struct sys_device *dev, \ -		struct sysdev_attribute *attr, char *buf) \ +static ssize_t show_##NAME(struct device *dev, \ +		struct device_attribute *attr, char *buf) \  { \  	cpuinfo_sparc *c = &cpu_data(dev->id); \  	return sprintf(buf, "%u\n", c->MEMBER); \ @@ -209,14 +209,14 @@ SHOW_CPUDATA_UINT_NAME(l1_icache_line_size, icache_line_size);  SHOW_CPUDATA_UINT_NAME(l2_cache_size, ecache_size);  SHOW_CPUDATA_UINT_NAME(l2_cache_line_size, ecache_line_size); -static struct sysdev_attribute cpu_core_attrs[] = { -	_SYSDEV_ATTR(clock_tick,          0444, show_clock_tick, NULL), -	_SYSDEV_ATTR(l1_dcache_size,      0444, show_l1_dcache_size, NULL), -	_SYSDEV_ATTR(l1_dcache_line_size, 0444, show_l1_dcache_line_size, NULL), -	_SYSDEV_ATTR(l1_icache_size,      0444, show_l1_icache_size, NULL), -	_SYSDEV_ATTR(l1_icache_line_size, 0444, show_l1_icache_line_size, NULL), -	_SYSDEV_ATTR(l2_cache_size,       0444, show_l2_cache_size, NULL), -	_SYSDEV_ATTR(l2_cache_line_size,  0444, show_l2_cache_line_size, NULL), +static struct device_attribute cpu_core_attrs[] = { +	__ATTR(clock_tick,          0444, show_clock_tick, NULL), +	__ATTR(l1_dcache_size,      0444, show_l1_dcache_size, NULL), +	__ATTR(l1_dcache_line_size, 0444, show_l1_dcache_line_size, NULL), +	__ATTR(l1_icache_size,      0444, show_l1_icache_size, NULL), +	__ATTR(l1_icache_line_size, 0444, show_l1_icache_line_size, NULL), +	__ATTR(l2_cache_size,       0444, show_l2_cache_size, NULL), +	__ATTR(l2_cache_line_size,  0444, show_l2_cache_line_size, NULL),  };  static DEFINE_PER_CPU(struct cpu, cpu_devices); @@ -224,11 +224,11 @@ static DEFINE_PER_CPU(struct cpu, cpu_devices);  static void register_cpu_online(unsigned int cpu)  {  	struct cpu *c = &per_cpu(cpu_devices, cpu); -	struct sys_device *s = &c->sysdev; +	struct device *s = &c->dev;  	int i;  	for (i = 0; i < ARRAY_SIZE(cpu_core_attrs); i++) -		sysdev_create_file(s, &cpu_core_attrs[i]); +		device_create_file(s, &cpu_core_attrs[i]);  	register_mmu_stats(s);  } @@ -237,12 +237,12 @@ static void register_cpu_online(unsigned int cpu)  static void unregister_cpu_online(unsigned int cpu)  {  	struct cpu *c = &per_cpu(cpu_devices, cpu); -	struct sys_device *s = &c->sysdev; +	struct device *s = &c->dev;  	int i;  	unregister_mmu_stats(s);  	for (i = 0; i < ARRAY_SIZE(cpu_core_attrs); i++) -		sysdev_remove_file(s, &cpu_core_attrs[i]); +		device_remove_file(s, &cpu_core_attrs[i]);  }  #endif diff --git a/arch/sparc/kernel/systbls_32.S b/arch/sparc/kernel/systbls_32.S index 09d8ec454450..63402f9e9f51 100644 --- a/arch/sparc/kernel/systbls_32.S +++ b/arch/sparc/kernel/systbls_32.S @@ -84,4 +84,4 @@ sys_call_table:  /*320*/	.long sys_dup3, sys_pipe2, sys_inotify_init1, sys_accept4, sys_preadv  /*325*/	.long sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open, sys_recvmmsg, sys_fanotify_init  /*330*/	.long sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime -/*335*/	.long sys_syncfs, sys_sendmmsg, sys_setns +/*335*/	.long sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev diff --git a/arch/sparc/kernel/systbls_64.S b/arch/sparc/kernel/systbls_64.S index edbec45d4688..db86b1a0e9a9 100644 --- a/arch/sparc/kernel/systbls_64.S +++ b/arch/sparc/kernel/systbls_64.S @@ -85,7 +85,7 @@ sys_call_table32:  /*320*/	.word sys_dup3, sys_pipe2, sys_inotify_init1, sys_accept4, compat_sys_preadv  	.word compat_sys_pwritev, compat_sys_rt_tgsigqueueinfo, sys_perf_event_open, compat_sys_recvmmsg, sys_fanotify_init  /*330*/	.word sys32_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, compat_sys_open_by_handle_at, compat_sys_clock_adjtime -	.word sys_syncfs, compat_sys_sendmmsg, sys_setns +	.word sys_syncfs, compat_sys_sendmmsg, sys_setns, compat_sys_process_vm_readv, compat_sys_process_vm_writev  #endif /* CONFIG_COMPAT */ @@ -162,4 +162,4 @@ sys_call_table:  /*320*/	.word sys_dup3, sys_pipe2, sys_inotify_init1, sys_accept4, sys_preadv  	.word sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open, sys_recvmmsg, sys_fanotify_init  /*330*/	.word sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime -	.word sys_syncfs, sys_sendmmsg, sys_setns +	.word sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev diff --git a/arch/sparc/lib/atomic_32.S b/arch/sparc/lib/atomic_32.S index 178cbb8ae1b9..eb6c7359cbd1 100644 --- a/arch/sparc/lib/atomic_32.S +++ b/arch/sparc/lib/atomic_32.S @@ -40,60 +40,5 @@ ___xchg32_sun4md:  	 mov	%g4, %o7  #endif -	/* Read asm-sparc/atomic.h carefully to understand how this works for SMP. -	 * Really, some things here for SMP are overly clever, go read the header. -	 */ -	.globl	___atomic24_add -___atomic24_add: -	rd	%psr, %g3		! Keep the code small, old way was stupid -	nop; nop; nop;			! Let the bits set -	or	%g3, PSR_PIL, %g7	! Disable interrupts -	wr	%g7, 0x0, %psr		! Set %psr -	nop; nop; nop;			! Let the bits set -#ifdef CONFIG_SMP -1:	ldstub	[%g1 + 3], %g7		! Spin on the byte lock for SMP. -	orcc	%g7, 0x0, %g0		! Did we get it? -	bne	1b			! Nope... -	 ld	[%g1], %g7		! Load locked atomic24_t -	sra	%g7, 8, %g7		! Get signed 24-bit integer -	add	%g7, %g2, %g2		! Add in argument -	sll	%g2, 8, %g7		! Transpose back to atomic24_t -	st	%g7, [%g1]		! Clever: This releases the lock as well. -#else -	ld	[%g1], %g7		! Load locked atomic24_t -	add	%g7, %g2, %g2		! Add in argument -	st	%g2, [%g1]		! Store it back -#endif -	wr	%g3, 0x0, %psr		! Restore original PSR_PIL -	nop; nop; nop;			! Let the bits set -	jmpl	%o7, %g0		! NOTE: not + 8, see callers in atomic.h -	 mov	%g4, %o7		! Restore %o7 - -	.globl	___atomic24_sub -___atomic24_sub: -	rd	%psr, %g3		! Keep the code small, old way was stupid -	nop; nop; nop;			! Let the bits set -	or	%g3, PSR_PIL, %g7	! Disable interrupts -	wr	%g7, 0x0, %psr		! Set %psr -	nop; nop; nop;			! Let the bits set -#ifdef CONFIG_SMP -1:	ldstub	[%g1 + 3], %g7		! Spin on the byte lock for SMP. -	orcc	%g7, 0x0, %g0		! Did we get it? -	bne	1b			! Nope... -	 ld	[%g1], %g7		! Load locked atomic24_t -	sra	%g7, 8, %g7		! Get signed 24-bit integer -	sub	%g7, %g2, %g2		! Subtract argument -	sll	%g2, 8, %g7		! Transpose back to atomic24_t -	st	%g7, [%g1]		! Clever: This releases the lock as well -#else -	ld	[%g1], %g7		! Load locked atomic24_t -	sub	%g7, %g2, %g2		! Subtract argument -	st	%g2, [%g1]		! Store it back -#endif -	wr	%g3, 0x0, %psr		! Restore original PSR_PIL -	nop; nop; nop;			! Let the bits set -	jmpl	%o7, %g0		! NOTE: not + 8, see callers in atomic.h -	 mov	%g4, %o7		! Restore %o7 -  	.globl  __atomic_end  __atomic_end: diff --git a/arch/sparc/lib/iomap.c b/arch/sparc/lib/iomap.c index 9ef37e13a920..c4d42a50ebc0 100644 --- a/arch/sparc/lib/iomap.c +++ b/arch/sparc/lib/iomap.c @@ -18,31 +18,8 @@ void ioport_unmap(void __iomem *addr)  EXPORT_SYMBOL(ioport_map);  EXPORT_SYMBOL(ioport_unmap); -/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ -void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) -{ -	resource_size_t start = pci_resource_start(dev, bar); -	resource_size_t len = pci_resource_len(dev, bar); -	unsigned long flags = pci_resource_flags(dev, bar); - -	if (!len || !start) -		return NULL; -	if (maxlen && len > maxlen) -		len = maxlen; -	if (flags & IORESOURCE_IO) -		return ioport_map(start, len); -	if (flags & IORESOURCE_MEM) { -		if (flags & IORESOURCE_CACHEABLE) -			return ioremap(start, len); -		return ioremap_nocache(start, len); -	} -	/* What? */ -	return NULL; -} -  void pci_iounmap(struct pci_dev *dev, void __iomem * addr)  {  	/* nothing to do */  } -EXPORT_SYMBOL(pci_iomap);  EXPORT_SYMBOL(pci_iounmap); diff --git a/arch/sparc/lib/ksyms.c b/arch/sparc/lib/ksyms.c index 1b30bb3bfdb1..f73c2240fe60 100644 --- a/arch/sparc/lib/ksyms.c +++ b/arch/sparc/lib/ksyms.c @@ -62,8 +62,6 @@ extern void ___rw_read_enter(void);  extern void ___rw_read_try(void);  extern void ___rw_read_exit(void);  extern void ___rw_write_enter(void); -extern void ___atomic24_add(void); -extern void ___atomic24_sub(void);  /* Alias functions whose names begin with "." and export the aliases.   * The module references will be fixed up by module_frob_arch_sections. @@ -97,10 +95,6 @@ EXPORT_SYMBOL(___rw_read_exit);  EXPORT_SYMBOL(___rw_write_enter);  #endif -/* Atomic operations. */ -EXPORT_SYMBOL(___atomic24_add); -EXPORT_SYMBOL(___atomic24_sub); -  EXPORT_SYMBOL(__ashrdi3);  EXPORT_SYMBOL(__ashldi3);  EXPORT_SYMBOL(__lshrdi3); diff --git a/arch/sparc/mm/Makefile b/arch/sparc/mm/Makefile index e3cda21b5ee9..301421c11291 100644 --- a/arch/sparc/mm/Makefile +++ b/arch/sparc/mm/Makefile @@ -8,7 +8,6 @@ obj-$(CONFIG_SPARC64)   += ultra.o tlb.o tsb.o gup.o  obj-y                   += fault_$(BITS).o  obj-y                   += init_$(BITS).o  obj-$(CONFIG_SPARC32)   += loadmmu.o -obj-y                   += generic_$(BITS).o  obj-$(CONFIG_SPARC32)   += extable.o btfixup.o srmmu.o iommu.o io-unit.o  obj-$(CONFIG_SPARC32)   += hypersparc.o viking.o tsunami.o swift.o  obj-$(CONFIG_SPARC_LEON)+= leon_mm.o diff --git a/arch/sparc/mm/btfixup.c b/arch/sparc/mm/btfixup.c index 5175ac2f4820..8a7f81743c12 100644 --- a/arch/sparc/mm/btfixup.c +++ b/arch/sparc/mm/btfixup.c @@ -302,8 +302,7 @@ void __init btfixup(void)  				case 'i':	/* INT */  					if ((insn & 0xc1c00000) == 0x01000000) /* %HI */  						set_addr(addr, q[1], fmangled, (insn & 0xffc00000) | (p[1] >> 10)); -					else if ((insn & 0x80002000) == 0x80002000 && -					         (insn & 0x01800000) != 0x01800000) /* %LO */ +					else if ((insn & 0x80002000) == 0x80002000) /* %LO */  						set_addr(addr, q[1], fmangled, (insn & 0xffffe000) | (p[1] & 0x3ff));  					else {  						prom_printf(insn_i, p, addr, insn); diff --git a/arch/sparc/mm/generic_32.c b/arch/sparc/mm/generic_32.c deleted file mode 100644 index 6ca39a60a196..000000000000 --- a/arch/sparc/mm/generic_32.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * generic.c: Generic Sparc mm routines that are not dependent upon - *            MMU type but are Sparc specific. - * - * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) - */ - -#include <linux/kernel.h> -#include <linux/mm.h> -#include <linux/swap.h> -#include <linux/pagemap.h> -#include <linux/export.h> - -#include <asm/pgalloc.h> -#include <asm/pgtable.h> -#include <asm/page.h> -#include <asm/cacheflush.h> -#include <asm/tlbflush.h> - -/* Remap IO memory, the same way as remap_pfn_range(), but use - * the obio memory space. - * - * They use a pgprot that sets PAGE_IO and does not check the - * mem_map table as this is independent of normal memory. - */ -static inline void io_remap_pte_range(struct mm_struct *mm, pte_t * pte, unsigned long address, unsigned long size, -	unsigned long offset, pgprot_t prot, int space) -{ -	unsigned long end; - -	address &= ~PMD_MASK; -	end = address + size; -	if (end > PMD_SIZE) -		end = PMD_SIZE; -	do { -		set_pte_at(mm, address, pte, mk_pte_io(offset, prot, space)); -		address += PAGE_SIZE; -		offset += PAGE_SIZE; -		pte++; -	} while (address < end); -} - -static inline int io_remap_pmd_range(struct mm_struct *mm, pmd_t * pmd, unsigned long address, unsigned long size, -	unsigned long offset, pgprot_t prot, int space) -{ -	unsigned long end; - -	address &= ~PGDIR_MASK; -	end = address + size; -	if (end > PGDIR_SIZE) -		end = PGDIR_SIZE; -	offset -= address; -	do { -		pte_t *pte = pte_alloc_map(mm, NULL, pmd, address); -		if (!pte) -			return -ENOMEM; -		io_remap_pte_range(mm, pte, address, end - address, address + offset, prot, space); -		address = (address + PMD_SIZE) & PMD_MASK; -		pmd++; -	} while (address < end); -	return 0; -} - -int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from, -		       unsigned long pfn, unsigned long size, pgprot_t prot) -{ -	int error = 0; -	pgd_t * dir; -	unsigned long beg = from; -	unsigned long end = from + size; -	struct mm_struct *mm = vma->vm_mm; -	int space = GET_IOSPACE(pfn); -	unsigned long offset = GET_PFN(pfn) << PAGE_SHIFT; - -	/* See comment in mm/memory.c remap_pfn_range */ -	vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP; -	vma->vm_pgoff = (offset >> PAGE_SHIFT) | -		((unsigned long)space << 28UL); - -	offset -= from; -	dir = pgd_offset(mm, from); -	flush_cache_range(vma, beg, end); - -	while (from < end) { -		pmd_t *pmd = pmd_alloc(mm, dir, from); -		error = -ENOMEM; -		if (!pmd) -			break; -		error = io_remap_pmd_range(mm, pmd, from, end - from, offset + from, prot, space); -		if (error) -			break; -		from = (from + PGDIR_SIZE) & PGDIR_MASK; -		dir++; -	} - -	flush_tlb_range(vma, beg, end); -	return error; -} -EXPORT_SYMBOL(io_remap_pfn_range); diff --git a/arch/sparc/mm/generic_64.c b/arch/sparc/mm/generic_64.c deleted file mode 100644 index 9b357ddae39d..000000000000 --- a/arch/sparc/mm/generic_64.c +++ /dev/null @@ -1,165 +0,0 @@ -/* - * generic.c: Generic Sparc mm routines that are not dependent upon - *            MMU type but are Sparc specific. - * - * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) - */ - -#include <linux/kernel.h> -#include <linux/mm.h> -#include <linux/swap.h> -#include <linux/export.h> -#include <linux/pagemap.h> - -#include <asm/pgalloc.h> -#include <asm/pgtable.h> -#include <asm/page.h> -#include <asm/tlbflush.h> - -/* Remap IO memory, the same way as remap_pfn_range(), but use - * the obio memory space. - * - * They use a pgprot that sets PAGE_IO and does not check the - * mem_map table as this is independent of normal memory. - */ -static inline void io_remap_pte_range(struct mm_struct *mm, pte_t * pte, -				      unsigned long address, -				      unsigned long size, -				      unsigned long offset, pgprot_t prot, -				      int space) -{ -	unsigned long end; - -	/* clear hack bit that was used as a write_combine side-effect flag */ -	offset &= ~0x1UL; -	address &= ~PMD_MASK; -	end = address + size; -	if (end > PMD_SIZE) -		end = PMD_SIZE; -	do { -		pte_t entry; -		unsigned long curend = address + PAGE_SIZE; -		 -		entry = mk_pte_io(offset, prot, space, PAGE_SIZE); -		if (!(address & 0xffff)) { -			if (PAGE_SIZE < (4 * 1024 * 1024) && -			    !(address & 0x3fffff) && -			    !(offset & 0x3ffffe) && -			    end >= address + 0x400000) { -				entry = mk_pte_io(offset, prot, space, -						  4 * 1024 * 1024); -				curend = address + 0x400000; -				offset += 0x400000; -			} else if (PAGE_SIZE < (512 * 1024) && -				   !(address & 0x7ffff) && -				   !(offset & 0x7fffe) && -				   end >= address + 0x80000) { -				entry = mk_pte_io(offset, prot, space, -						  512 * 1024 * 1024); -				curend = address + 0x80000; -				offset += 0x80000; -			} else if (PAGE_SIZE < (64 * 1024) && -				   !(offset & 0xfffe) && -				   end >= address + 0x10000) { -				entry = mk_pte_io(offset, prot, space, -						  64 * 1024); -				curend = address + 0x10000; -				offset += 0x10000; -			} else -				offset += PAGE_SIZE; -		} else -			offset += PAGE_SIZE; - -		if (pte_write(entry)) -			entry = pte_mkdirty(entry); -		do { -			BUG_ON(!pte_none(*pte)); -			set_pte_at(mm, address, pte, entry); -			address += PAGE_SIZE; -			pte_val(entry) += PAGE_SIZE; -			pte++; -		} while (address < curend); -	} while (address < end); -} - -static inline int io_remap_pmd_range(struct mm_struct *mm, pmd_t * pmd, unsigned long address, unsigned long size, -	unsigned long offset, pgprot_t prot, int space) -{ -	unsigned long end; - -	address &= ~PGDIR_MASK; -	end = address + size; -	if (end > PGDIR_SIZE) -		end = PGDIR_SIZE; -	offset -= address; -	do { -		pte_t *pte = pte_alloc_map(mm, NULL, pmd, address); -		if (!pte) -			return -ENOMEM; -		io_remap_pte_range(mm, pte, address, end - address, address + offset, prot, space); -		pte_unmap(pte); -		address = (address + PMD_SIZE) & PMD_MASK; -		pmd++; -	} while (address < end); -	return 0; -} - -static inline int io_remap_pud_range(struct mm_struct *mm, pud_t * pud, unsigned long address, unsigned long size, -	unsigned long offset, pgprot_t prot, int space) -{ -	unsigned long end; - -	address &= ~PUD_MASK; -	end = address + size; -	if (end > PUD_SIZE) -		end = PUD_SIZE; -	offset -= address; -	do { -		pmd_t *pmd = pmd_alloc(mm, pud, address); -		if (!pud) -			return -ENOMEM; -		io_remap_pmd_range(mm, pmd, address, end - address, address + offset, prot, space); -		address = (address + PUD_SIZE) & PUD_MASK; -		pud++; -	} while (address < end); -	return 0; -} - -int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from, -		unsigned long pfn, unsigned long size, pgprot_t prot) -{ -	int error = 0; -	pgd_t * dir; -	unsigned long beg = from; -	unsigned long end = from + size; -	struct mm_struct *mm = vma->vm_mm; -	int space = GET_IOSPACE(pfn); -	unsigned long offset = GET_PFN(pfn) << PAGE_SHIFT; -	unsigned long phys_base; - -	phys_base = offset | (((unsigned long) space) << 32UL); - -	/* See comment in mm/memory.c remap_pfn_range */ -	vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP; -	vma->vm_pgoff = phys_base >> PAGE_SHIFT; - -	offset -= from; -	dir = pgd_offset(mm, from); -	flush_cache_range(vma, beg, end); - -	while (from < end) { -		pud_t *pud = pud_alloc(mm, dir, from); -		error = -ENOMEM; -		if (!pud) -			break; -		error = io_remap_pud_range(mm, pud, from, end - from, offset + from, prot, space); -		if (error) -			break; -		from = (from + PGDIR_SIZE) & PGDIR_MASK; -		dir++; -	} - -	flush_tlb_range(vma, beg, end); -	return error; -} -EXPORT_SYMBOL(io_remap_pfn_range); diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c index 8e073d802139..b3f5e7dfea51 100644 --- a/arch/sparc/mm/init_64.c +++ b/arch/sparc/mm/init_64.c @@ -790,7 +790,7 @@ static int find_node(unsigned long addr)  	return -1;  } -u64 memblock_nid_range(u64 start, u64 end, int *nid) +static u64 memblock_nid_range(u64 start, u64 end, int *nid)  {  	*nid = find_node(start);  	start += PAGE_SIZE; @@ -808,7 +808,7 @@ u64 memblock_nid_range(u64 start, u64 end, int *nid)  	return start;  }  #else -u64 memblock_nid_range(u64 start, u64 end, int *nid) +static u64 memblock_nid_range(u64 start, u64 end, int *nid)  {  	*nid = 0;  	return end; @@ -816,7 +816,7 @@ u64 memblock_nid_range(u64 start, u64 end, int *nid)  #endif  /* This must be invoked after performing all of the necessary - * add_active_range() calls for 'nid'.  We need to be able to get + * memblock_set_node() calls for 'nid'.  We need to be able to get   * correct data from get_pfn_range_for_nid().   */  static void __init allocate_node_data(int nid) @@ -987,14 +987,11 @@ static void __init add_node_ranges(void)  			this_end = memblock_nid_range(start, end, &nid); -			numadbg("Adding active range nid[%d] " +			numadbg("Setting memblock NUMA node nid[%d] "  				"start[%lx] end[%lx]\n",  				nid, start, this_end); -			add_active_range(nid, -					 start >> PAGE_SHIFT, -					 this_end >> PAGE_SHIFT); - +			memblock_set_node(start, this_end - start, nid);  			start = this_end;  		}  	} @@ -1282,7 +1279,6 @@ static void __init bootmem_init_nonnuma(void)  {  	unsigned long top_of_ram = memblock_end_of_DRAM();  	unsigned long total_ram = memblock_phys_mem_size(); -	struct memblock_region *reg;  	numadbg("bootmem_init_nonnuma()\n"); @@ -1292,20 +1288,8 @@ static void __init bootmem_init_nonnuma(void)  	       (top_of_ram - total_ram) >> 20);  	init_node_masks_nonnuma(); - -	for_each_memblock(memory, reg) { -		unsigned long start_pfn, end_pfn; - -		if (!reg->size) -			continue; - -		start_pfn = memblock_region_memory_base_pfn(reg); -		end_pfn = memblock_region_memory_end_pfn(reg); -		add_active_range(0, start_pfn, end_pfn); -	} - +	memblock_set_node(0, (phys_addr_t)ULLONG_MAX, 0);  	allocate_node_data(0); -  	node_set_online(0);  } @@ -1769,8 +1753,6 @@ void __init paging_init(void)  		sun4v_ktsb_init();  	} -	memblock_init(); -  	/* Find available physical memory...  	 *  	 * Read it twice in order to work around a bug in openfirmware. @@ -1796,7 +1778,7 @@ void __init paging_init(void)  	memblock_enforce_memory_limit(cmdline_memory_size); -	memblock_analyze(); +	memblock_allow_resize();  	memblock_dump_all();  	set_bit(0, mmu_context_bmap);  | 
