diff options
44 files changed, 184 insertions, 406 deletions
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig index db5e47dfc30..c54e04c995e 100644 --- a/arch/arm/mm/Kconfig +++ b/arch/arm/mm/Kconfig @@ -370,21 +370,21 @@ config CPU_BIG_ENDIAN  config CPU_ICACHE_DISABLE  	bool "Disable I-Cache" -	depends on CPU_ARM920T || CPU_ARM922T || CPU_ARM925T || CPU_ARM926T || CPU_ARM1020 +	depends on CPU_ARM920T || CPU_ARM922T || CPU_ARM925T || CPU_ARM926T || CPU_ARM1020 || CPU_V6  	help  	  Say Y here to disable the processor instruction cache. Unless  	  you have a reason not to or are unsure, say N.  config CPU_DCACHE_DISABLE  	bool "Disable D-Cache" -	depends on CPU_ARM920T || CPU_ARM922T || CPU_ARM925T || CPU_ARM926T || CPU_ARM1020 +	depends on CPU_ARM920T || CPU_ARM922T || CPU_ARM925T || CPU_ARM926T || CPU_ARM1020 || CPU_V6  	help  	  Say Y here to disable the processor data cache. Unless  	  you have a reason not to or are unsure, say N.  config CPU_DCACHE_WRITETHROUGH  	bool "Force write through D-cache" -	depends on (CPU_ARM920T || CPU_ARM922T || CPU_ARM925T || CPU_ARM926T || CPU_ARM1020) && !CPU_DCACHE_DISABLE +	depends on (CPU_ARM920T || CPU_ARM922T || CPU_ARM925T || CPU_ARM926T || CPU_ARM1020 || CPU_V6) && !CPU_DCACHE_DISABLE  	default y if CPU_ARM925T  	help  	  Say Y here to use the data cache in writethrough mode. Unless you @@ -399,7 +399,7 @@ config CPU_CACHE_ROUND_ROBIN  config CPU_BPREDICT_DISABLE  	bool "Disable branch prediction" -	depends on CPU_ARM1020 +	depends on CPU_ARM1020 || CPU_V6  	help  	  Say Y here to disable branch prediction.  If unsure, say N. diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index aba05394d30..6537445dac0 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -25,62 +25,6 @@ source "init/Kconfig"  menu "General machine setup" -config VT -	bool -	select INPUT -	default y -	---help--- -	  If you say Y here, you will get support for terminal devices with -	  display and keyboard devices. These are called "virtual" because you -	  can run several virtual terminals (also called virtual consoles) on -	  one physical terminal. This is rather useful, for example one -	  virtual terminal can collect system messages and warnings, another -	  one can be used for a text-mode user session, and a third could run -	  an X session, all in parallel. Switching between virtual terminals -	  is done with certain key combinations, usually Alt-<function key>. - -	  The setterm command ("man setterm") can be used to change the -	  properties (such as colors or beeping) of a virtual terminal. The -	  man page console_codes(4) ("man console_codes") contains the special -	  character sequences that can be used to change those properties -	  directly. The fonts used on virtual terminals can be changed with -	  the setfont ("man setfont") command and the key bindings are defined -	  with the loadkeys ("man loadkeys") command. - -	  You need at least one virtual terminal device in order to make use -	  of your keyboard and monitor. Therefore, only people configuring an -	  embedded system would want to say N here in order to save some -	  memory; the only way to log into such a system is then via a serial -	  or network connection. - -	  If unsure, say Y, or else you won't be able to do much with your new -	  shiny Linux system :-) - -config VT_CONSOLE -	bool -	default y -	---help--- -	  The system console is the device which receives all kernel messages -	  and warnings and which allows logins in single user mode. If you -	  answer Y here, a virtual terminal (the device used to interact with -	  a physical terminal) can be used as system console. This is the most -	  common mode of operations, so you should say Y here unless you want -	  the kernel messages be output only to a serial port (in which case -	  you should say Y to "Console on serial port", below). - -	  If you do say Y here, by default the currently visible virtual -	  terminal (/dev/tty0) will be used as system console. You can change -	  that with a kernel command line option such as "console=tty3" which -	  would use the third virtual terminal as system console. (Try "man -	  bootparam" or see the documentation of your boot loader (lilo or -	  loadlin) about how to pass options to the kernel at boot time.) - -	  If unsure, say Y. - -config HW_CONSOLE -	bool -	default y -  config SMP  	bool "Symmetric multi-processing support (does not work on sun4/sun4c)"  	depends on BROKEN diff --git a/arch/sparc64/kernel/entry.S b/arch/sparc64/kernel/entry.S index 2879b107292..f685035dbdb 100644 --- a/arch/sparc64/kernel/entry.S +++ b/arch/sparc64/kernel/entry.S @@ -97,8 +97,8 @@ do_fpdis:  	faddd		%f0, %f2, %f4  	fmuld		%f0, %f2, %f6  	ldxa		[%g3] ASI_DMMU, %g5 -cplus_fptrap_insn_1: -	sethi		%hi(0), %g2 +	sethi		%hi(sparc64_kern_sec_context), %g2 +	ldx		[%g2 + %lo(sparc64_kern_sec_context)], %g2  	stxa		%g2, [%g3] ASI_DMMU  	membar		#Sync  	add		%g6, TI_FPREGS + 0xc0, %g2 @@ -126,8 +126,8 @@ cplus_fptrap_insn_1:  	fzero		%f34  	ldxa		[%g3] ASI_DMMU, %g5  	add		%g6, TI_FPREGS, %g1 -cplus_fptrap_insn_2: -	sethi		%hi(0), %g2 +	sethi		%hi(sparc64_kern_sec_context), %g2 +	ldx		[%g2 + %lo(sparc64_kern_sec_context)], %g2  	stxa		%g2, [%g3] ASI_DMMU  	membar		#Sync  	add		%g6, TI_FPREGS + 0x40, %g2 @@ -153,8 +153,8 @@ cplus_fptrap_insn_2:  3:	mov		SECONDARY_CONTEXT, %g3  	add		%g6, TI_FPREGS, %g1  	ldxa		[%g3] ASI_DMMU, %g5 -cplus_fptrap_insn_3: -	sethi		%hi(0), %g2 +	sethi		%hi(sparc64_kern_sec_context), %g2 +	ldx		[%g2 + %lo(sparc64_kern_sec_context)], %g2  	stxa		%g2, [%g3] ASI_DMMU  	membar		#Sync  	mov		0x40, %g2 @@ -319,8 +319,8 @@ do_fptrap_after_fsr:  	stx		%g3, [%g6 + TI_GSR]  	mov		SECONDARY_CONTEXT, %g3  	ldxa		[%g3] ASI_DMMU, %g5 -cplus_fptrap_insn_4: -	sethi		%hi(0), %g2 +	sethi		%hi(sparc64_kern_sec_context), %g2 +	ldx		[%g2 + %lo(sparc64_kern_sec_context)], %g2  	stxa		%g2, [%g3] ASI_DMMU  	membar		#Sync  	add		%g6, TI_FPREGS, %g2 @@ -341,33 +341,6 @@ cplus_fptrap_insn_4:  	ba,pt		%xcc, etrap  	 wr		%g0, 0, %fprs -cplus_fptrap_1: -	sethi		%hi(CTX_CHEETAH_PLUS_CTX0), %g2 - -	.globl		cheetah_plus_patch_fpdis -cheetah_plus_patch_fpdis: -	/* We configure the dTLB512_0 for 4MB pages and the -	 * dTLB512_1 for 8K pages when in context zero. -	 */ -	sethi			%hi(cplus_fptrap_1), %o0 -	lduw			[%o0 + %lo(cplus_fptrap_1)], %o1 - -	set			cplus_fptrap_insn_1, %o2 -	stw			%o1, [%o2] -	flush			%o2 -	set			cplus_fptrap_insn_2, %o2 -	stw			%o1, [%o2] -	flush			%o2 -	set			cplus_fptrap_insn_3, %o2 -	stw			%o1, [%o2] -	flush			%o2 -	set			cplus_fptrap_insn_4, %o2 -	stw			%o1, [%o2] -	flush			%o2 - -	retl -	 nop -  	/* The registers for cross calls will be:  	 *  	 * DATA 0: [low 32-bits]  Address of function to call, jmp to this diff --git a/arch/sparc64/kernel/etrap.S b/arch/sparc64/kernel/etrap.S index 50d2af1d98a..0d8eba21111 100644 --- a/arch/sparc64/kernel/etrap.S +++ b/arch/sparc64/kernel/etrap.S @@ -68,12 +68,8 @@ etrap_irq:  		wrpr	%g3, 0, %otherwin  		wrpr	%g2, 0, %wstate -cplus_etrap_insn_1: -		sethi	%hi(0), %g3 -		sllx	%g3, 32, %g3 -cplus_etrap_insn_2: -		sethi	%hi(0), %g2 -		or	%g3, %g2, %g3 +		sethi	%hi(sparc64_kern_pri_context), %g2 +		ldx	[%g2 + %lo(sparc64_kern_pri_context)], %g3  		stxa	%g3, [%l4] ASI_DMMU  		flush	%l6  		wr	%g0, ASI_AIUS, %asi @@ -215,12 +211,8 @@ scetrap:	rdpr	%pil, %g2  		mov	PRIMARY_CONTEXT, %l4  		wrpr	%g3, 0, %otherwin  		wrpr	%g2, 0, %wstate -cplus_etrap_insn_3: -		sethi	%hi(0), %g3 -		sllx	%g3, 32, %g3 -cplus_etrap_insn_4: -		sethi	%hi(0), %g2 -		or	%g3, %g2, %g3 +		sethi	%hi(sparc64_kern_pri_context), %g2 +		ldx	[%g2 + %lo(sparc64_kern_pri_context)], %g3  		stxa	%g3, [%l4] ASI_DMMU  		flush	%l6 @@ -264,38 +256,3 @@ cplus_etrap_insn_4:  #undef TASK_REGOFF  #undef ETRAP_PSTATE1 - -cplus_einsn_1: -		sethi			%uhi(CTX_CHEETAH_PLUS_NUC), %g3 -cplus_einsn_2: -		sethi			%hi(CTX_CHEETAH_PLUS_CTX0), %g2 - -		.globl			cheetah_plus_patch_etrap -cheetah_plus_patch_etrap: -		/* We configure the dTLB512_0 for 4MB pages and the -		 * dTLB512_1 for 8K pages when in context zero. -		 */ -		sethi			%hi(cplus_einsn_1), %o0 -		sethi			%hi(cplus_etrap_insn_1), %o2 -		lduw			[%o0 + %lo(cplus_einsn_1)], %o1 -		or			%o2, %lo(cplus_etrap_insn_1), %o2 -		stw			%o1, [%o2] -		flush			%o2 -		sethi			%hi(cplus_etrap_insn_3), %o2 -		or			%o2, %lo(cplus_etrap_insn_3), %o2 -		stw			%o1, [%o2] -		flush			%o2 - -		sethi			%hi(cplus_einsn_2), %o0 -		sethi			%hi(cplus_etrap_insn_2), %o2 -		lduw			[%o0 + %lo(cplus_einsn_2)], %o1 -		or			%o2, %lo(cplus_etrap_insn_2), %o2 -		stw			%o1, [%o2] -		flush			%o2 -		sethi			%hi(cplus_etrap_insn_4), %o2 -		or			%o2, %lo(cplus_etrap_insn_4), %o2 -		stw			%o1, [%o2] -		flush			%o2 - -		retl -		 nop diff --git a/arch/sparc64/kernel/head.S b/arch/sparc64/kernel/head.S index 89406f9649a..24340496cdd 100644 --- a/arch/sparc64/kernel/head.S +++ b/arch/sparc64/kernel/head.S @@ -325,23 +325,7 @@ cheetah_tlb_fixup:  1:	sethi	%hi(tlb_type), %g1  	stw	%g2, [%g1 + %lo(tlb_type)] -	BRANCH_IF_CHEETAH_PLUS_OR_FOLLOWON(g1,g7,1f) -	ba,pt	%xcc, 2f -	 nop - -1:	/* Patch context register writes to support nucleus page -	 * size correctly. -	 */ -	call	cheetah_plus_patch_etrap -	 nop -	call	cheetah_plus_patch_rtrap -	 nop -	call	cheetah_plus_patch_fpdis -	 nop -	call	cheetah_plus_patch_winfixup -	 nop - -2:	/* Patch copy/page operations to cheetah optimized versions. */ +	/* Patch copy/page operations to cheetah optimized versions. */  	call	cheetah_patch_copyops  	 nop  	call	cheetah_patch_copy_page @@ -484,20 +468,13 @@ spitfire_vpte_base:  	call	prom_set_trap_table  	 sethi	%hi(sparc64_ttable_tl0), %o0 -	BRANCH_IF_CHEETAH_PLUS_OR_FOLLOWON(g2,g3,1f) -	ba,pt	%xcc, 2f -	 nop - -1:	/* Start using proper page size encodings in ctx register.  */ -	sethi	%uhi(CTX_CHEETAH_PLUS_NUC), %g3 +	/* Start using proper page size encodings in ctx register.  */ +	sethi	%hi(sparc64_kern_pri_context), %g3 +	ldx	[%g3 + %lo(sparc64_kern_pri_context)], %g2  	mov	PRIMARY_CONTEXT, %g1 -	sllx	%g3, 32, %g3 -	sethi	%hi(CTX_CHEETAH_PLUS_CTX0), %g2 -	or	%g3, %g2, %g3 -	stxa	%g3, [%g1] ASI_DMMU +	stxa	%g2, [%g1] ASI_DMMU  	membar	#Sync -2:  	rdpr	%pstate, %o1  	or	%o1, PSTATE_IE, %o1  	wrpr	%o1, 0, %pstate diff --git a/arch/sparc64/kernel/rtrap.S b/arch/sparc64/kernel/rtrap.S index fafd227735f..ecfb42a69a4 100644 --- a/arch/sparc64/kernel/rtrap.S +++ b/arch/sparc64/kernel/rtrap.S @@ -256,9 +256,8 @@ rt_continue:	ldx			[%sp + PTREGS_OFF + PT_V9_G1], %g1  		brnz,pn			%l3, kern_rtt  		 mov			PRIMARY_CONTEXT, %l7  		ldxa			[%l7 + %l7] ASI_DMMU, %l0 -cplus_rtrap_insn_1: -		sethi			%hi(0), %l1 -		sllx			%l1, 32, %l1 +		sethi			%hi(sparc64_kern_pri_nuc_bits), %l1 +		ldx			[%l1 + %lo(sparc64_kern_pri_nuc_bits)], %l1  		or			%l0, %l1, %l0  		stxa			%l0, [%l7] ASI_DMMU  		flush			%g6 @@ -345,21 +344,3 @@ kern_fpucheck:	ldub			[%g6 + TI_FPDEPTH], %l5  		wr			%g0, FPRS_DU, %fprs  		ba,pt			%xcc, rt_continue  		 stb			%l5, [%g6 + TI_FPDEPTH] - -cplus_rinsn_1: -		sethi			%uhi(CTX_CHEETAH_PLUS_NUC), %l1 - -		.globl			cheetah_plus_patch_rtrap -cheetah_plus_patch_rtrap: -		/* We configure the dTLB512_0 for 4MB pages and the -		 * dTLB512_1 for 8K pages when in context zero. -		 */ -		sethi			%hi(cplus_rinsn_1), %o0 -		sethi			%hi(cplus_rtrap_insn_1), %o2 -		lduw			[%o0 + %lo(cplus_rinsn_1)], %o1 -		or			%o2, %lo(cplus_rtrap_insn_1), %o2 -		stw			%o1, [%o2] -		flush			%o2 - -		retl -		 nop diff --git a/arch/sparc64/kernel/setup.c b/arch/sparc64/kernel/setup.c index 4c9c8f24174..c1f34237cdf 100644 --- a/arch/sparc64/kernel/setup.c +++ b/arch/sparc64/kernel/setup.c @@ -187,17 +187,13 @@ int prom_callback(long *args)  		}  		if ((va >= KERNBASE) && (va < (KERNBASE + (4 * 1024 * 1024)))) { -			unsigned long kernel_pctx = 0; - -			if (tlb_type == cheetah_plus) -				kernel_pctx |= (CTX_CHEETAH_PLUS_NUC | -						CTX_CHEETAH_PLUS_CTX0); +			extern unsigned long sparc64_kern_pri_context;  			/* Spitfire Errata #32 workaround */  			__asm__ __volatile__("stxa	%0, [%1] %2\n\t"  					     "flush	%%g6"  					     : /* No outputs */ -					     : "r" (kernel_pctx), +					     : "r" (sparc64_kern_pri_context),  					       "r" (PRIMARY_CONTEXT),  					       "i" (ASI_DMMU)); diff --git a/arch/sparc64/kernel/trampoline.S b/arch/sparc64/kernel/trampoline.S index 89f2fcfcd66..9478551cb02 100644 --- a/arch/sparc64/kernel/trampoline.S +++ b/arch/sparc64/kernel/trampoline.S @@ -336,20 +336,13 @@ do_unlock:  	call		init_irqwork_curcpu  	 nop -	BRANCH_IF_CHEETAH_PLUS_OR_FOLLOWON(g2,g3,1f) -	ba,pt	%xcc, 2f -	 nop - -1:	/* Start using proper page size encodings in ctx register.  */ -	sethi	%uhi(CTX_CHEETAH_PLUS_NUC), %g3 +	/* Start using proper page size encodings in ctx register.  */ +	sethi	%hi(sparc64_kern_pri_context), %g3 +	ldx	[%g3 + %lo(sparc64_kern_pri_context)], %g2  	mov	PRIMARY_CONTEXT, %g1 -	sllx	%g3, 32, %g3 -	sethi	%hi(CTX_CHEETAH_PLUS_CTX0), %g2 -	or	%g3, %g2, %g3 -	stxa	%g3, [%g1] ASI_DMMU +	stxa	%g2, [%g1] ASI_DMMU  	membar	#Sync -2:  	rdpr		%pstate, %o1  	or		%o1, PSTATE_IE, %o1  	wrpr		%o1, 0, %pstate diff --git a/arch/sparc64/kernel/winfixup.S b/arch/sparc64/kernel/winfixup.S index 99c809a1e5a..39160926267 100644 --- a/arch/sparc64/kernel/winfixup.S +++ b/arch/sparc64/kernel/winfixup.S @@ -16,23 +16,14 @@  	.text  set_pcontext: -cplus_winfixup_insn_1: -	sethi	%hi(0), %l1 +	sethi	%hi(sparc64_kern_pri_context), %l1 +	ldx	[%l1 + %lo(sparc64_kern_pri_context)], %l1  	mov	PRIMARY_CONTEXT, %g1 -	sllx	%l1, 32, %l1 -cplus_winfixup_insn_2: -	sethi	%hi(0), %g2 -	or	%l1, %g2, %l1  	stxa	%l1, [%g1] ASI_DMMU  	flush	%g6  	retl  	 nop -cplus_wfinsn_1: -	sethi	%uhi(CTX_CHEETAH_PLUS_NUC), %l1 -cplus_wfinsn_2: -	sethi	%hi(CTX_CHEETAH_PLUS_CTX0), %g2 -  	.align	32  	/* Here are the rules, pay attention. @@ -395,23 +386,3 @@ window_dax_from_user_common:  	 add		%sp, PTREGS_OFF, %o0  	ba,pt		%xcc, rtrap  	 clr		%l6 -	 - -	.globl		cheetah_plus_patch_winfixup -cheetah_plus_patch_winfixup: -	sethi			%hi(cplus_wfinsn_1), %o0 -	sethi			%hi(cplus_winfixup_insn_1), %o2 -	lduw			[%o0 + %lo(cplus_wfinsn_1)], %o1 -	or			%o2, %lo(cplus_winfixup_insn_1), %o2 -	stw			%o1, [%o2] -	flush			%o2 - -	sethi			%hi(cplus_wfinsn_2), %o0 -	sethi			%hi(cplus_winfixup_insn_2), %o2 -	lduw			[%o0 + %lo(cplus_wfinsn_2)], %o1 -	or			%o2, %lo(cplus_winfixup_insn_2), %o2 -	stw			%o1, [%o2] -	flush			%o2 - -	retl -	 nop diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c index 5db50524f20..0d2e967c720 100644 --- a/arch/sparc64/mm/init.c +++ b/arch/sparc64/mm/init.c @@ -133,6 +133,12 @@ extern unsigned int sparc_ramdisk_size;  struct page *mem_map_zero __read_mostly; +unsigned int sparc64_highest_unlocked_tlb_ent __read_mostly; + +unsigned long sparc64_kern_pri_context __read_mostly; +unsigned long sparc64_kern_pri_nuc_bits __read_mostly; +unsigned long sparc64_kern_sec_context __read_mostly; +  int bigkernel = 0;  /* XXX Tune this... */ @@ -362,6 +368,7 @@ struct linux_prom_translation {  	unsigned long data;  };  static struct linux_prom_translation prom_trans[512] __initdata; +static unsigned int prom_trans_ents __initdata;  extern unsigned long prom_boot_page;  extern void prom_remap(unsigned long physpage, unsigned long virtpage, int mmu_ihandle); @@ -375,57 +382,7 @@ unsigned long kern_locked_tte_data;  unsigned long prom_pmd_phys __read_mostly;  unsigned int swapper_pgd_zero __read_mostly; -/* Allocate power-of-2 aligned chunks from the end of the - * kernel image.  Return physical address. - */ -static inline unsigned long early_alloc_phys(unsigned long size) -{ -	unsigned long base; - -	BUILD_BUG_ON(size & (size - 1)); - -	kern_size = (kern_size + (size - 1)) & ~(size - 1); -	base = kern_base + kern_size; -	kern_size += size; - -	return base; -} - -static inline unsigned long load_phys32(unsigned long pa) -{ -	unsigned long val; - -	__asm__ __volatile__("lduwa	[%1] %2, %0" -			     : "=&r" (val) -			     : "r" (pa), "i" (ASI_PHYS_USE_EC)); - -	return val; -} - -static inline unsigned long load_phys64(unsigned long pa) -{ -	unsigned long val; - -	__asm__ __volatile__("ldxa	[%1] %2, %0" -			     : "=&r" (val) -			     : "r" (pa), "i" (ASI_PHYS_USE_EC)); - -	return val; -} - -static inline void store_phys32(unsigned long pa, unsigned long val) -{ -	__asm__ __volatile__("stwa	%0, [%1] %2" -			     : /* no outputs */ -			     : "r" (val), "r" (pa), "i" (ASI_PHYS_USE_EC)); -} - -static inline void store_phys64(unsigned long pa, unsigned long val) -{ -	__asm__ __volatile__("stxa	%0, [%1] %2" -			     : /* no outputs */ -			     : "r" (val), "r" (pa), "i" (ASI_PHYS_USE_EC)); -} +static pmd_t *prompmd __read_mostly;  #define BASE_PAGE_SIZE 8192 @@ -435,34 +392,28 @@ static inline void store_phys64(unsigned long pa, unsigned long val)   */  unsigned long prom_virt_to_phys(unsigned long promva, int *error)  { -	unsigned long pmd_phys = (prom_pmd_phys + -				  ((promva >> 23) & 0x7ff) * sizeof(pmd_t)); -	unsigned long pte_phys; -	pmd_t pmd_ent; -	pte_t pte_ent; +	pmd_t *pmdp = prompmd + ((promva >> 23) & 0x7ff); +	pte_t *ptep;  	unsigned long base; -	pmd_val(pmd_ent) = load_phys32(pmd_phys); -	if (pmd_none(pmd_ent)) { +	if (pmd_none(*pmdp)) {  		if (error)  			*error = 1;  		return 0;  	} - -	pte_phys = (unsigned long)pmd_val(pmd_ent) << 11UL; -	pte_phys += ((promva >> 13) & 0x3ff) * sizeof(pte_t); -	pte_val(pte_ent) = load_phys64(pte_phys); -	if (!pte_present(pte_ent)) { +	ptep = (pte_t *)__pmd_page(*pmdp) + ((promva >> 13) & 0x3ff); +	if (!pte_present(*ptep)) {  		if (error)  			*error = 1;  		return 0;  	}  	if (error) {  		*error = 0; -		return pte_val(pte_ent); +		return pte_val(*ptep);  	} -	base = pte_val(pte_ent) & _PAGE_PADDR; -	return (base + (promva & (BASE_PAGE_SIZE - 1))); +	base = pte_val(*ptep) & _PAGE_PADDR; + +	return base + (promva & (BASE_PAGE_SIZE - 1));  }  /* The obp translations are saved based on 8k pagesize, since obp can @@ -475,25 +426,20 @@ static void __init build_obp_range(unsigned long start, unsigned long end, unsig  	unsigned long vaddr;  	for (vaddr = start; vaddr < end; vaddr += BASE_PAGE_SIZE) { -		unsigned long val, pte_phys, pmd_phys; -		pmd_t pmd_ent; -		int i; - -		pmd_phys = (prom_pmd_phys + -			    (((vaddr >> 23) & 0x7ff) * sizeof(pmd_t))); -		pmd_val(pmd_ent) = load_phys32(pmd_phys); -		if (pmd_none(pmd_ent)) { -			pte_phys = early_alloc_phys(BASE_PAGE_SIZE); - -			for (i = 0; i < BASE_PAGE_SIZE / sizeof(pte_t); i++) -				store_phys64(pte_phys+i*sizeof(pte_t),0); +		unsigned long val; +		pmd_t *pmd; +		pte_t *pte; -			pmd_val(pmd_ent) = pte_phys >> 11UL; -			store_phys32(pmd_phys, pmd_val(pmd_ent)); +		pmd = prompmd + ((vaddr >> 23) & 0x7ff); +		if (pmd_none(*pmd)) { +			pte = __alloc_bootmem(BASE_PAGE_SIZE, BASE_PAGE_SIZE, +					      PAGE_SIZE); +			if (!pte) +				prom_halt(); +			memset(pte, 0, BASE_PAGE_SIZE); +			pmd_set(pmd, pte);  		} - -		pte_phys = (unsigned long)pmd_val(pmd_ent) << 11UL; -		pte_phys += (((vaddr >> 13) & 0x3ff) * sizeof(pte_t)); +		pte = (pte_t *) __pmd_page(*pmd) + ((vaddr >> 13) & 0x3ff);  		val = data; @@ -501,7 +447,8 @@ static void __init build_obp_range(unsigned long start, unsigned long end, unsig  		if (tlb_type == spitfire)  			val &= ~0x0003fe0000000000UL; -		store_phys64(pte_phys, val | _PAGE_MODIFIED); +		set_pte_at(&init_mm, vaddr, pte, +			   __pte(val | _PAGE_MODIFIED));  		data += BASE_PAGE_SIZE;  	} @@ -514,13 +461,17 @@ static inline int in_obp_range(unsigned long vaddr)  }  #define OBP_PMD_SIZE 2048 -static void __init build_obp_pgtable(int prom_trans_ents) +static void __init build_obp_pgtable(void)  {  	unsigned long i; -	prom_pmd_phys = early_alloc_phys(OBP_PMD_SIZE); -	for (i = 0; i < OBP_PMD_SIZE; i += 4) -		store_phys32(prom_pmd_phys + i, 0); +	prompmd = __alloc_bootmem(OBP_PMD_SIZE, OBP_PMD_SIZE, PAGE_SIZE); +	if (!prompmd) +		prom_halt(); + +	memset(prompmd, 0, OBP_PMD_SIZE); + +	prom_pmd_phys = __pa(prompmd);  	for (i = 0; i < prom_trans_ents; i++) {  		unsigned long start, end; @@ -540,7 +491,7 @@ static void __init build_obp_pgtable(int prom_trans_ents)  /* Read OBP translations property into 'prom_trans[]'.   * Return the number of entries.   */ -static int __init read_obp_translations(void) +static void __init read_obp_translations(void)  {  	int n, node; @@ -561,8 +512,10 @@ static int __init read_obp_translations(void)  		prom_printf("prom_mappings: Couldn't get property.\n");  		prom_halt();  	} +  	n = n / sizeof(struct linux_prom_translation); -	return n; + +	prom_trans_ents = n;  }  static void __init remap_kernel(void) @@ -582,28 +535,38 @@ static void __init remap_kernel(void)  	prom_dtlb_load(tlb_ent, tte_data, tte_vaddr);  	prom_itlb_load(tlb_ent, tte_data, tte_vaddr);  	if (bigkernel) { -		prom_dtlb_load(tlb_ent - 1, +		tlb_ent -= 1; +		prom_dtlb_load(tlb_ent,  			       tte_data + 0x400000,   			       tte_vaddr + 0x400000); -		prom_itlb_load(tlb_ent - 1, +		prom_itlb_load(tlb_ent,  			       tte_data + 0x400000,   			       tte_vaddr + 0x400000);  	} +	sparc64_highest_unlocked_tlb_ent = tlb_ent - 1; +	if (tlb_type == cheetah_plus) { +		sparc64_kern_pri_context = (CTX_CHEETAH_PLUS_CTX0 | +					    CTX_CHEETAH_PLUS_NUC); +		sparc64_kern_pri_nuc_bits = CTX_CHEETAH_PLUS_NUC; +		sparc64_kern_sec_context = CTX_CHEETAH_PLUS_CTX0; +	}  } -static void __init inherit_prom_mappings(void) -{ -	int n; -	n = read_obp_translations(); -	build_obp_pgtable(n); +static void __init inherit_prom_mappings_pre(void) +{ +	read_obp_translations();  	/* Now fixup OBP's idea about where we really are mapped. */  	prom_printf("Remapping the kernel... ");  	remap_kernel();  	prom_printf("done.\n"); +} +static void __init inherit_prom_mappings_post(void) +{ +	build_obp_pgtable();  	register_prom_callbacks();  } @@ -788,8 +751,8 @@ void inherit_locked_prom_mappings(int save_p)  		}  	}  	if (tlb_type == spitfire) { -		int high = SPITFIRE_HIGHEST_LOCKED_TLBENT - bigkernel; -		for (i = 0; i < high; i++) { +		int high = sparc64_highest_unlocked_tlb_ent; +		for (i = 0; i <= high; i++) {  			unsigned long data;  			/* Spitfire Errata #32 workaround */ @@ -877,9 +840,9 @@ void inherit_locked_prom_mappings(int save_p)  			}  		}  	} else if (tlb_type == cheetah || tlb_type == cheetah_plus) { -		int high = CHEETAH_HIGHEST_LOCKED_TLBENT - bigkernel; +		int high = sparc64_highest_unlocked_tlb_ent; -		for (i = 0; i < high; i++) { +		for (i = 0; i <= high; i++) {  			unsigned long data;  			data = cheetah_get_ldtlb_data(i); @@ -1556,8 +1519,7 @@ void __init paging_init(void)  	swapper_pgd_zero = pgd_val(swapper_pg_dir[0]); -	/* Inherit non-locked OBP mappings. */ -	inherit_prom_mappings(); +	inherit_prom_mappings_pre();  	/* Ok, we can use our TLB miss and window trap handlers safely.  	 * We need to do a quick peek here to see if we are on StarFire @@ -1568,15 +1530,23 @@ void __init paging_init(void)  		extern void setup_tba(int);  		setup_tba(this_is_starfire);  	} - -	inherit_locked_prom_mappings(1); -  	__flush_tlb_all(); +	/* Everything from this point forward, until we are done with +	 * inherit_prom_mappings_post(), must complete successfully +	 * without calling into the firmware.  The firwmare page tables +	 * have not been built, but we are running on the Linux kernel's +	 * trap table. +	 */ +  	/* Setup bootmem... */  	pages_avail = 0;  	last_valid_pfn = end_pfn = bootmem_init(&pages_avail); +	inherit_prom_mappings_post(); + +	inherit_locked_prom_mappings(1); +  #ifdef CONFIG_DEBUG_PAGEALLOC  	kernel_physical_mapping_init();  #endif diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c index 2bf723a7b6e..6f1a83c9d9e 100644 --- a/drivers/atm/fore200e.c +++ b/drivers/atm/fore200e.c @@ -178,14 +178,12 @@ fore200e_irq_itoa(int irq)  static void* -fore200e_kmalloc(int size, int flags) +fore200e_kmalloc(int size, unsigned int __nocast flags)  { -    void* chunk = kmalloc(size, flags); +    void *chunk = kzalloc(size, flags); -    if (chunk) -	memset(chunk, 0x00, size); -    else -	printk(FORE200E "kmalloc() failed, requested size = %d, flags = 0x%x\n", size, flags); +    if (!chunk) +	printk(FORE200E "kmalloc() failed, requested size = %d, flags = 0x%x\n",			size, flags);      return chunk;  } diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c index bb0b3a8de14..1422285d537 100644 --- a/drivers/connector/connector.c +++ b/drivers/connector/connector.c @@ -69,7 +69,8 @@ int cn_already_initialized = 0;   * a new message.   *   */ -int cn_netlink_send(struct cn_msg *msg, u32 __group, int gfp_mask) +int cn_netlink_send(struct cn_msg *msg, u32 __group, +		    unsigned int __nocast gfp_mask)  {  	struct cn_callback_entry *__cbq;  	unsigned int size; diff --git a/drivers/mfd/ucb1x00-core.c b/drivers/mfd/ucb1x00-core.c index 10f6ce1bc0a..612564ac6f7 100644 --- a/drivers/mfd/ucb1x00-core.c +++ b/drivers/mfd/ucb1x00-core.c @@ -642,8 +642,6 @@ static void __exit ucb1x00_exit(void)  module_init(ucb1x00_init);  module_exit(ucb1x00_exit); -EXPORT_SYMBOL(ucb1x00_class); -  EXPORT_SYMBOL(ucb1x00_io_set_dir);  EXPORT_SYMBOL(ucb1x00_io_write);  EXPORT_SYMBOL(ucb1x00_io_read); diff --git a/drivers/mfd/ucb1x00.h b/drivers/mfd/ucb1x00.h index 6b632644f59..9c9a647d8b7 100644 --- a/drivers/mfd/ucb1x00.h +++ b/drivers/mfd/ucb1x00.h @@ -106,8 +106,6 @@ struct ucb1x00_irq {  	void (*fn)(int, void *);  }; -extern struct class ucb1x00_class; -  struct ucb1x00 {  	spinlock_t		lock;  	struct mcp		*mcp; diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index fd62e43a351..f0a5b772a38 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -1289,12 +1289,13 @@ static void bond_mc_list_destroy(struct bonding *bond)  /*   * Copy all the Multicast addresses from src to the bonding device dst   */ -static int bond_mc_list_copy(struct dev_mc_list *mc_list, struct bonding *bond, int gpf_flag) +static int bond_mc_list_copy(struct dev_mc_list *mc_list, struct bonding *bond, +			     unsigned int __nocast gfp_flag)  {  	struct dev_mc_list *dmi, *new_dmi;  	for (dmi = mc_list; dmi; dmi = dmi->next) { -		new_dmi = kmalloc(sizeof(struct dev_mc_list), gpf_flag); +		new_dmi = kmalloc(sizeof(struct dev_mc_list), gfp_flag);  		if (!new_dmi) {  			/* FIXME: Potential memory leak !!! */ diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h index 9f374cfa1b0..f1fd849e553 100644 --- a/include/linux/atmdev.h +++ b/include/linux/atmdev.h @@ -457,7 +457,7 @@ static inline void atm_dev_put(struct atm_dev *dev)  int atm_charge(struct atm_vcc *vcc,int truesize);  struct sk_buff *atm_alloc_charge(struct atm_vcc *vcc,int pdu_size, -    int gfp_flags); +    unsigned int __nocast gfp_flags);  int atm_pcr_goal(struct atm_trafprm *tp);  void vcc_release_async(struct atm_vcc *vcc, int reply); diff --git a/include/linux/connector.h b/include/linux/connector.h index 86d4b0a8171..96582c9911a 100644 --- a/include/linux/connector.h +++ b/include/linux/connector.h @@ -149,7 +149,7 @@ struct cn_dev {  int cn_add_callback(struct cb_id *, char *, void (*callback) (void *));  void cn_del_callback(struct cb_id *); -int cn_netlink_send(struct cn_msg *, u32, int); +int cn_netlink_send(struct cn_msg *, u32, unsigned int __nocast);  int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id, void (*callback)(void *));  void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id); diff --git a/include/linux/textsearch.h b/include/linux/textsearch.h index 941f45ac117..1a4990e448e 100644 --- a/include/linux/textsearch.h +++ b/include/linux/textsearch.h @@ -158,7 +158,8 @@ extern unsigned int textsearch_find_continuous(struct ts_config *,  #define TS_PRIV_ALIGNTO	8  #define TS_PRIV_ALIGN(len) (((len) + TS_PRIV_ALIGNTO-1) & ~(TS_PRIV_ALIGNTO-1)) -static inline struct ts_config *alloc_ts_config(size_t payload, int gfp_mask) +static inline struct ts_config *alloc_ts_config(size_t payload, +						unsigned int __nocast gfp_mask)  {  	struct ts_config *conf; diff --git a/include/net/dn_nsp.h b/include/net/dn_nsp.h index 6bbeafa73e8..8a0891e2e88 100644 --- a/include/net/dn_nsp.h +++ b/include/net/dn_nsp.h @@ -19,9 +19,9 @@ extern void dn_nsp_send_data_ack(struct sock *sk);  extern void dn_nsp_send_oth_ack(struct sock *sk);  extern void dn_nsp_delayed_ack(struct sock *sk);  extern void dn_send_conn_ack(struct sock *sk); -extern void dn_send_conn_conf(struct sock *sk, int gfp); +extern void dn_send_conn_conf(struct sock *sk, unsigned int __nocast gfp);  extern void dn_nsp_send_disc(struct sock *sk, unsigned char type,  -				unsigned short reason, int gfp); +			unsigned short reason, unsigned int __nocast gfp);  extern void dn_nsp_return_disc(struct sk_buff *skb, unsigned char type,  				unsigned short reason);  extern void dn_nsp_send_link(struct sock *sk, unsigned char lsflags, char fcval); @@ -29,14 +29,14 @@ extern void dn_nsp_send_conninit(struct sock *sk, unsigned char flags);  extern void dn_nsp_output(struct sock *sk);  extern int dn_nsp_check_xmit_queue(struct sock *sk, struct sk_buff *skb, struct sk_buff_head *q, unsigned short acknum); -extern void dn_nsp_queue_xmit(struct sock *sk, struct sk_buff *skb, int gfp, int oob); +extern void dn_nsp_queue_xmit(struct sock *sk, struct sk_buff *skb, unsigned int __nocast gfp, int oob);  extern unsigned long dn_nsp_persist(struct sock *sk);  extern int dn_nsp_xmit_timeout(struct sock *sk);  extern int dn_nsp_rx(struct sk_buff *);  extern int dn_nsp_backlog_rcv(struct sock *sk, struct sk_buff *skb); -extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, int pri); +extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, unsigned int __nocast pri);  extern struct sk_buff *dn_alloc_send_skb(struct sock *sk, size_t *size, int noblock, long timeo, int *err);  #define NSP_REASON_OK 0		/* No error */ diff --git a/include/net/dn_route.h b/include/net/dn_route.h index d084721db19..11fe973cf38 100644 --- a/include/net/dn_route.h +++ b/include/net/dn_route.h @@ -15,7 +15,7 @@      GNU General Public License for more details.  *******************************************************************************/ -extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, int pri); +extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, unsigned int __nocast pri);  extern int dn_route_output_sock(struct dst_entry **pprt, struct flowi *, struct sock *sk, int flags);  extern int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb);  extern int dn_cache_getroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg); diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h index 35f49e65e29..f50f9596834 100644 --- a/include/net/inet_hashtables.h +++ b/include/net/inet_hashtables.h @@ -40,7 +40,7 @@  struct inet_ehash_bucket {  	rwlock_t	  lock;  	struct hlist_head chain; -} __attribute__((__aligned__(8))); +};  /* There are a few simple rules, which allow for local port reuse by   * an application.  In essence: diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h index 06b4235aa01..ecb2b061f59 100644 --- a/include/net/ip_vs.h +++ b/include/net/ip_vs.h @@ -832,7 +832,7 @@ extern void ip_vs_app_inc_put(struct ip_vs_app *inc);  extern int ip_vs_app_pkt_out(struct ip_vs_conn *, struct sk_buff **pskb);  extern int ip_vs_app_pkt_in(struct ip_vs_conn *, struct sk_buff **pskb); -extern int ip_vs_skb_replace(struct sk_buff *skb, int pri, +extern int ip_vs_skb_replace(struct sk_buff *skb, unsigned int __nocast pri,  			     char *o_buf, int o_len, char *n_buf, int n_len);  extern int ip_vs_app_init(void);  extern void ip_vs_app_cleanup(void); diff --git a/include/net/xfrm.h b/include/net/xfrm.h index a9d0d8c5dfb..b6e72f890c6 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h @@ -875,7 +875,7 @@ static inline int xfrm_dst_lookup(struct xfrm_dst **dst, struct flowi *fl, unsig  }   #endif -struct xfrm_policy *xfrm_policy_alloc(int gfp); +struct xfrm_policy *xfrm_policy_alloc(unsigned int __nocast gfp);  extern int xfrm_policy_walk(int (*func)(struct xfrm_policy *, int, int, void*), void *);  int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl);  struct xfrm_policy *xfrm_policy_bysel(int dir, struct xfrm_selector *sel, @@ -931,4 +931,9 @@ static inline int xfrm_addr_cmp(xfrm_address_t *a, xfrm_address_t *b,  	}  } +static inline int xfrm_policy_id2dir(u32 index) +{ +	return index & 7; +} +  #endif	/* _NET_XFRM_H */ diff --git a/include/rxrpc/call.h b/include/rxrpc/call.h index f48f27e9e0a..8118731e7d9 100644 --- a/include/rxrpc/call.h +++ b/include/rxrpc/call.h @@ -203,7 +203,7 @@ extern int rxrpc_call_write_data(struct rxrpc_call *call,  				 size_t sioc,  				 struct kvec *siov,  				 uint8_t rxhdr_flags, -				 int alloc_flags, +				 unsigned int __nocast alloc_flags,  				 int dup_data,  				 size_t *size_sent); diff --git a/include/rxrpc/message.h b/include/rxrpc/message.h index 3a59df6870b..983d9f9eee1 100644 --- a/include/rxrpc/message.h +++ b/include/rxrpc/message.h @@ -63,7 +63,7 @@ extern int rxrpc_conn_newmsg(struct rxrpc_connection *conn,  			     uint8_t type,  			     int count,  			     struct kvec *diov, -			     int alloc_flags, +			     unsigned int __nocast alloc_flags,  			     struct rxrpc_message **_msg);  extern int rxrpc_conn_sendmsg(struct rxrpc_connection *conn, struct rxrpc_message *msg); diff --git a/lib/ts_bm.c b/lib/ts_bm.c index 2cc79112ecc..1b61fceef77 100644 --- a/lib/ts_bm.c +++ b/lib/ts_bm.c @@ -127,7 +127,7 @@ static void compute_prefix_tbl(struct ts_bm *bm, const u8 *pattern,  }  static struct ts_config *bm_init(const void *pattern, unsigned int len, -				 int gfp_mask) +				 unsigned int __nocast gfp_mask)  {  	struct ts_config *conf;  	struct ts_bm *bm; diff --git a/lib/ts_fsm.c b/lib/ts_fsm.c index d27c0a07294..ef9779e0050 100644 --- a/lib/ts_fsm.c +++ b/lib/ts_fsm.c @@ -258,7 +258,7 @@ found_match:  }  static struct ts_config *fsm_init(const void *pattern, unsigned int len, -				     int gfp_mask) +				     unsigned int __nocast gfp_mask)  {  	int i, err = -EINVAL;  	struct ts_config *conf; diff --git a/lib/ts_kmp.c b/lib/ts_kmp.c index 73266b97558..e45f0f0c237 100644 --- a/lib/ts_kmp.c +++ b/lib/ts_kmp.c @@ -87,7 +87,7 @@ static inline void compute_prefix_tbl(const u8 *pattern, unsigned int len,  }  static struct ts_config *kmp_init(const void *pattern, unsigned int len, -				  int gfp_mask) +				  unsigned int __nocast gfp_mask)  {  	struct ts_config *conf;  	struct ts_kmp *kmp; diff --git a/net/atm/atm_misc.c b/net/atm/atm_misc.c index b2113c3454a..71abc99ec81 100644 --- a/net/atm/atm_misc.c +++ b/net/atm/atm_misc.c @@ -25,7 +25,7 @@ int atm_charge(struct atm_vcc *vcc,int truesize)  struct sk_buff *atm_alloc_charge(struct atm_vcc *vcc,int pdu_size, -    int gfp_flags) +    unsigned int __nocast gfp_flags)  {  	struct sock *sk = sk_atm(vcc);  	int guess = atm_guess_pdu2truesize(pdu_size); diff --git a/net/ax25/ax25_in.c b/net/ax25/ax25_in.c index 810c9c76c2e..73cfc3411c4 100644 --- a/net/ax25/ax25_in.c +++ b/net/ax25/ax25_in.c @@ -123,7 +123,7 @@ int ax25_rx_iframe(ax25_cb *ax25, struct sk_buff *skb)  		}  		skb_pull(skb, 1);	/* Remove PID */ -		skb->h.raw    = skb->data; +		skb->mac.raw  = skb->nh.raw;  		skb->nh.raw   = skb->data;  		skb->dev      = ax25->ax25_dev->dev;  		skb->pkt_type = PACKET_HOST; diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c index 348f36b529f..34d4128d56d 100644 --- a/net/decnet/af_decnet.c +++ b/net/decnet/af_decnet.c @@ -452,7 +452,8 @@ static struct proto dn_proto = {  	.obj_size = sizeof(struct dn_sock),  }; -static struct sock *dn_alloc_sock(struct socket *sock, int gfp) +static struct sock *dn_alloc_sock(struct socket *sock, +				  unsigned int __nocast gfp)  {  	struct dn_scp *scp;  	struct sock *sk = sk_alloc(PF_DECnet, gfp, &dn_proto, 1); @@ -804,7 +805,8 @@ static int dn_auto_bind(struct socket *sock)  	return rv;  } -static int dn_confirm_accept(struct sock *sk, long *timeo, int allocation) +static int dn_confirm_accept(struct sock *sk, long *timeo, +				unsigned int __nocast allocation)  {  	struct dn_scp *scp = DN_SK(sk);  	DEFINE_WAIT(wait); diff --git a/net/decnet/dn_nsp_out.c b/net/decnet/dn_nsp_out.c index 53633d35286..cd08244aa10 100644 --- a/net/decnet/dn_nsp_out.c +++ b/net/decnet/dn_nsp_out.c @@ -117,7 +117,8 @@ try_again:   * The eventual aim is for each socket to have a cached header size   * for its outgoing packets, and to set hdr from this when sk != NULL.   */ -struct sk_buff *dn_alloc_skb(struct sock *sk, int size, int pri) +struct sk_buff *dn_alloc_skb(struct sock *sk, int size, +			     unsigned int __nocast pri)  {  	struct sk_buff *skb;  	int hdr = 64; @@ -210,7 +211,8 @@ static void dn_nsp_rtt(struct sock *sk, long rtt)   *   * Returns: The number of times the packet has been sent previously   */ -static inline unsigned dn_nsp_clone_and_send(struct sk_buff *skb, int gfp) +static inline unsigned dn_nsp_clone_and_send(struct sk_buff *skb, +					     unsigned int __nocast gfp)  {  	struct dn_skb_cb *cb = DN_SKB_CB(skb);  	struct sk_buff *skb2; @@ -350,7 +352,8 @@ static unsigned short *dn_nsp_mk_data_header(struct sock *sk, struct sk_buff *sk  	return ptr;  } -void dn_nsp_queue_xmit(struct sock *sk, struct sk_buff *skb, int gfp, int oth) +void dn_nsp_queue_xmit(struct sock *sk, struct sk_buff *skb, +			unsigned int __nocast gfp, int oth)  {  	struct dn_scp *scp = DN_SK(sk);  	struct dn_skb_cb *cb = DN_SKB_CB(skb); @@ -517,7 +520,7 @@ static int dn_nsp_retrans_conn_conf(struct sock *sk)  	return 0;  } -void dn_send_conn_conf(struct sock *sk, int gfp) +void dn_send_conn_conf(struct sock *sk, unsigned int __nocast gfp)  {  	struct dn_scp *scp = DN_SK(sk);  	struct sk_buff *skb = NULL; @@ -549,7 +552,8 @@ void dn_send_conn_conf(struct sock *sk, int gfp)  static __inline__ void dn_nsp_do_disc(struct sock *sk, unsigned char msgflg,  -			unsigned short reason, int gfp, struct dst_entry *dst, +			unsigned short reason, unsigned int __nocast gfp, +			struct dst_entry *dst,  			int ddl, unsigned char *dd, __u16 rem, __u16 loc)  {  	struct sk_buff *skb = NULL; @@ -591,7 +595,7 @@ static __inline__ void dn_nsp_do_disc(struct sock *sk, unsigned char msgflg,  void dn_nsp_send_disc(struct sock *sk, unsigned char msgflg,  -			unsigned short reason, int gfp) +			unsigned short reason, unsigned int __nocast gfp)  {  	struct dn_scp *scp = DN_SK(sk);  	int ddl = 0; @@ -612,7 +616,7 @@ void dn_nsp_return_disc(struct sk_buff *skb, unsigned char msgflg,  {  	struct dn_skb_cb *cb = DN_SKB_CB(skb);  	int ddl = 0; -	int gfp = GFP_ATOMIC; +	unsigned int __nocast gfp = GFP_ATOMIC;  	dn_nsp_do_disc(NULL, msgflg, reason, gfp, skb->dst, ddl,   			NULL, cb->src_port, cb->dst_port); @@ -624,7 +628,7 @@ void dn_nsp_send_link(struct sock *sk, unsigned char lsflags, char fcval)  	struct dn_scp *scp = DN_SK(sk);  	struct sk_buff *skb;  	unsigned char *ptr; -	int gfp = GFP_ATOMIC; +	unsigned int __nocast gfp = GFP_ATOMIC;  	if ((skb = dn_alloc_skb(sk, DN_MAX_NSP_DATA_HEADER + 2, gfp)) == NULL)  		return; @@ -659,7 +663,8 @@ void dn_nsp_send_conninit(struct sock *sk, unsigned char msgflg)  	unsigned char menuver;  	struct dn_skb_cb *cb;  	unsigned char type = 1; -	int allocation = (msgflg == NSP_CI) ? sk->sk_allocation : GFP_ATOMIC; +	unsigned int __nocast allocation = +			(msgflg == NSP_CI) ? sk->sk_allocation : GFP_ATOMIC;  	struct sk_buff *skb = dn_alloc_skb(sk, 200, allocation);  	if (!skb) diff --git a/net/ipv4/ipvs/ip_vs_app.c b/net/ipv4/ipvs/ip_vs_app.c index 6e092dadb38..b942ff3c886 100644 --- a/net/ipv4/ipvs/ip_vs_app.c +++ b/net/ipv4/ipvs/ip_vs_app.c @@ -604,7 +604,7 @@ static struct file_operations ip_vs_app_fops = {  /*   *	Replace a segment of data with a new segment   */ -int ip_vs_skb_replace(struct sk_buff *skb, int pri, +int ip_vs_skb_replace(struct sk_buff *skb, unsigned int __nocast pri,  		      char *o_buf, int o_len, char *n_buf, int n_len)  {  	struct iphdr *iph; diff --git a/net/ipv4/netfilter/Kconfig b/net/ipv4/netfilter/Kconfig index 2cd7e7d1ac9..a7659728e7a 100644 --- a/net/ipv4/netfilter/Kconfig +++ b/net/ipv4/netfilter/Kconfig @@ -141,7 +141,7 @@ config IP_NF_PPTP  	tristate  'PPTP protocol support'  	help  	  This module adds support for PPTP (Point to Point Tunnelling -	  Protocol, RFC2637) conncection tracking and NAT.  +	  Protocol, RFC2637) connection tracking and NAT.   	  If you are running PPTP sessions over a stateful firewall or NAT  	  box, you may want to enable this feature.   diff --git a/net/ipv4/tcp_bic.c b/net/ipv4/tcp_bic.c index b940346de4e..6d80e063c18 100644 --- a/net/ipv4/tcp_bic.c +++ b/net/ipv4/tcp_bic.c @@ -136,7 +136,7 @@ static inline void bictcp_update(struct bictcp *ca, u32 cwnd)  		else if (cwnd < ca->last_max_cwnd + max_increment*(BICTCP_B-1))  			/* slow start */  			ca->cnt = (cwnd * (BICTCP_B-1)) -				/ cwnd-ca->last_max_cwnd; +				/ (cwnd - ca->last_max_cwnd);  		else  			/* linear increase */  			ca->cnt = cwnd / max_increment; diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index 519899fb11d..39a96c76810 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c @@ -1393,7 +1393,7 @@ static void mld_sendpack(struct sk_buff *skb)  static int grec_size(struct ifmcaddr6 *pmc, int type, int gdel, int sdel)  { -	return sizeof(struct mld2_grec) + 4*mld_scount(pmc,type,gdel,sdel); +	return sizeof(struct mld2_grec) + 16 * mld_scount(pmc,type,gdel,sdel);  }  static struct sk_buff *add_grhead(struct sk_buff *skb, struct ifmcaddr6 *pmc, diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 555a31347ed..305d9ee6d7d 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c @@ -1450,7 +1450,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,  static void pndisc_redo(struct sk_buff *skb)  { -	ndisc_rcv(skb); +	ndisc_recv_ns(skb);  	kfree_skb(skb);  } diff --git a/net/key/af_key.c b/net/key/af_key.c index 4879743b945..bbf0f69181b 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c @@ -185,7 +185,7 @@ static int pfkey_release(struct socket *sock)  }  static int pfkey_broadcast_one(struct sk_buff *skb, struct sk_buff **skb2, -			       int allocation, struct sock *sk) +			       unsigned int __nocast allocation, struct sock *sk)  {  	int err = -ENOBUFS; @@ -217,7 +217,7 @@ static int pfkey_broadcast_one(struct sk_buff *skb, struct sk_buff **skb2,  #define BROADCAST_ONE		1  #define BROADCAST_REGISTERED	2  #define BROADCAST_PROMISC_ONLY	4 -static int pfkey_broadcast(struct sk_buff *skb, int allocation, +static int pfkey_broadcast(struct sk_buff *skb, unsigned int __nocast allocation,  			   int broadcast_flags, struct sock *one_sk)  {  	struct sock *sk; @@ -1416,7 +1416,8 @@ static int pfkey_get(struct sock *sk, struct sk_buff *skb, struct sadb_msg *hdr,  	return 0;  } -static struct sk_buff *compose_sadb_supported(struct sadb_msg *orig, int allocation) +static struct sk_buff *compose_sadb_supported(struct sadb_msg *orig, +					      unsigned int __nocast allocation)  {  	struct sk_buff *skb;  	struct sadb_msg *hdr; @@ -2153,6 +2154,7 @@ out:  static int pfkey_spdget(struct sock *sk, struct sk_buff *skb, struct sadb_msg *hdr, void **ext_hdrs)  { +	unsigned int dir;  	int err;  	struct sadb_x_policy *pol;  	struct xfrm_policy *xp; @@ -2161,7 +2163,11 @@ static int pfkey_spdget(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h  	if ((pol = ext_hdrs[SADB_X_EXT_POLICY-1]) == NULL)  		return -EINVAL; -	xp = xfrm_policy_byid(0, pol->sadb_x_policy_id, +	dir = xfrm_policy_id2dir(pol->sadb_x_policy_id); +	if (dir >= XFRM_POLICY_MAX) +		return -EINVAL; + +	xp = xfrm_policy_byid(dir, pol->sadb_x_policy_id,  			      hdr->sadb_msg_type == SADB_X_SPDDELETE2);  	if (xp == NULL)  		return -ENOENT; @@ -2173,9 +2179,9 @@ static int pfkey_spdget(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h  	if (hdr->sadb_msg_type == SADB_X_SPDDELETE2) {  		c.data.byid = 1;  		c.event = XFRM_MSG_DELPOLICY; -		km_policy_notify(xp, pol->sadb_x_policy_dir-1, &c); +		km_policy_notify(xp, dir, &c);  	} else { -		err = key_pol_get_resp(sk, xp, hdr, pol->sadb_x_policy_dir-1); +		err = key_pol_get_resp(sk, xp, hdr, dir);  	}  	xfrm_pol_put(xp); diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c index 49a3900e3d3..34d671974a4 100644 --- a/net/netfilter/nfnetlink.c +++ b/net/netfilter/nfnetlink.c @@ -195,7 +195,8 @@ nfnetlink_check_attributes(struct nfnetlink_subsystem *subsys,  int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group, int echo)  { -	int allocation = in_interrupt() ? GFP_ATOMIC : GFP_KERNEL; +	unsigned int __nocast allocation = +			in_interrupt() ? GFP_ATOMIC : GFP_KERNEL;  	int err = 0;  	NETLINK_CB(skb).dst_group = group; diff --git a/net/netrom/nr_dev.c b/net/netrom/nr_dev.c index 4e66eef9a03..509afddae56 100644 --- a/net/netrom/nr_dev.c +++ b/net/netrom/nr_dev.c @@ -58,7 +58,7 @@ int nr_rx_ip(struct sk_buff *skb, struct net_device *dev)  	/* Spoof incoming device */  	skb->dev      = dev; -	skb->h.raw    = skb->data; +	skb->mac.raw  = skb->nh.raw;  	skb->nh.raw   = skb->data;  	skb->pkt_type = PACKET_HOST; diff --git a/net/rxrpc/call.c b/net/rxrpc/call.c index 5cfd4cadee4..86f77705263 100644 --- a/net/rxrpc/call.c +++ b/net/rxrpc/call.c @@ -1923,7 +1923,7 @@ int rxrpc_call_write_data(struct rxrpc_call *call,  			  size_t sioc,  			  struct kvec *siov,  			  u8 rxhdr_flags, -			  int alloc_flags, +			  unsigned int __nocast alloc_flags,  			  int dup_data,  			  size_t *size_sent)  { diff --git a/net/rxrpc/connection.c b/net/rxrpc/connection.c index 61463c74f8c..be4b2be5895 100644 --- a/net/rxrpc/connection.c +++ b/net/rxrpc/connection.c @@ -522,7 +522,7 @@ int rxrpc_conn_newmsg(struct rxrpc_connection *conn,  		      uint8_t type,  		      int dcount,  		      struct kvec diov[], -		      int alloc_flags, +		      unsigned int __nocast alloc_flags,  		      struct rxrpc_message **_msg)  {  	struct rxrpc_message *msg; diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c index f3104035e35..ade730eaf40 100644 --- a/net/sunrpc/sched.c +++ b/net/sunrpc/sched.c @@ -719,7 +719,7 @@ static void rpc_async_schedule(void *arg)  void *  rpc_malloc(struct rpc_task *task, size_t size)  { -	int	gfp; +	unsigned int __nocast	gfp;  	if (task->tk_flags & RPC_TASK_SWAPPER)  		gfp = GFP_ATOMIC; diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index fda737d77ed..061b44cc245 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c @@ -163,7 +163,7 @@ static void xfrm_policy_timer(unsigned long data)  	if (xp->dead)  		goto out; -	dir = xp->index & 7; +	dir = xfrm_policy_id2dir(xp->index);  	if (xp->lft.hard_add_expires_seconds) {  		long tmo = xp->lft.hard_add_expires_seconds + @@ -225,7 +225,7 @@ expired:   * SPD calls.   */ -struct xfrm_policy *xfrm_policy_alloc(int gfp) +struct xfrm_policy *xfrm_policy_alloc(unsigned int __nocast gfp)  {  	struct xfrm_policy *policy; @@ -417,7 +417,7 @@ struct xfrm_policy *xfrm_policy_byid(int dir, u32 id, int delete)  	struct xfrm_policy *pol, **p;  	write_lock_bh(&xfrm_policy_lock); -	for (p = &xfrm_policy_list[id & 7]; (pol=*p)!=NULL; p = &pol->next) { +	for (p = &xfrm_policy_list[dir]; (pol=*p)!=NULL; p = &pol->next) {  		if (pol->index == id) {  			xfrm_pol_hold(pol);  			if (delete)  |