diff options
Diffstat (limited to 'arch')
179 files changed, 1307 insertions, 913 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 6d6e18fee9f..2f88d8d9770 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -6,7 +6,7 @@ config ARM  	select HAVE_DMA_API_DEBUG  	select HAVE_IDE if PCI || ISA || PCMCIA  	select HAVE_DMA_ATTRS -	select HAVE_DMA_CONTIGUOUS if (CPU_V6 || CPU_V6K || CPU_V7) +	select HAVE_DMA_CONTIGUOUS if MMU  	select HAVE_MEMBLOCK  	select RTC_LIB  	select SYS_SUPPORTS_APM_EMULATION @@ -2144,6 +2144,7 @@ source "drivers/cpufreq/Kconfig"  config CPU_FREQ_IMX  	tristate "CPUfreq driver for i.MX CPUs"  	depends on ARCH_MXC && CPU_FREQ +	select CPU_FREQ_TABLE  	help  	  This enables the CPUfreq driver for i.MX CPUs. diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug index f15f82bf3a5..e968a52e488 100644 --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug @@ -356,15 +356,15 @@ choice  		  is nothing connected to read from the DCC.  	config DEBUG_SEMIHOSTING -		bool "Kernel low-level debug output via semihosting I" +		bool "Kernel low-level debug output via semihosting I/O"  		help  		  Semihosting enables code running on an ARM target to use  		  the I/O facilities on a host debugger/emulator through a -		  simple SVC calls. The host debugger or emulator must have +		  simple SVC call. The host debugger or emulator must have  		  semihosting enabled for the special svc call to be trapped  		  otherwise the kernel will crash. -		  This is known to work with OpenOCD, as wellas +		  This is known to work with OpenOCD, as well as  		  ARM's Fast Models, or any other controlling environment  		  that implements semihosting. diff --git a/arch/arm/Makefile b/arch/arm/Makefile index 30eae87ead6..a051dfbdd7d 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -284,10 +284,10 @@ zImage Image xipImage bootpImage uImage: vmlinux  zinstall uinstall install: vmlinux  	$(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@ -%.dtb: +%.dtb: scripts  	$(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@ -dtbs: +dtbs: scripts  	$(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@  # We use MRPROPER_FILES and CLEAN_FILES now diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S index b8c64b80baf..81769c1341f 100644 --- a/arch/arm/boot/compressed/head.S +++ b/arch/arm/boot/compressed/head.S @@ -659,10 +659,14 @@ __armv7_mmu_cache_on:  #ifdef CONFIG_CPU_ENDIAN_BE8  		orr	r0, r0, #1 << 25	@ big-endian page tables  #endif +		mrcne   p15, 0, r6, c2, c0, 2   @ read ttb control reg  		orrne	r0, r0, #1		@ MMU enabled  		movne	r1, #0xfffffffd		@ domain 0 = client +		bic     r6, r6, #1 << 31        @ 32-bit translation system +		bic     r6, r6, #3 << 0         @ use only ttbr0  		mcrne	p15, 0, r3, c2, c0, 0	@ load page table pointer  		mcrne	p15, 0, r1, c3, c0, 0	@ load domain access control +		mcrne   p15, 0, r6, c2, c0, 2   @ load ttb control  #endif  		mcr	p15, 0, r0, c7, c5, 4	@ ISB  		mcr	p15, 0, r0, c1, c0, 0	@ load control register diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi index 59509c48d7e..bd0cff3f808 100644 --- a/arch/arm/boot/dts/am33xx.dtsi +++ b/arch/arm/boot/dts/am33xx.dtsi @@ -154,5 +154,10 @@  			#size-cells = <0>;  			ti,hwmods = "i2c3";  		}; + +		wdt2: wdt@44e35000 { +			compatible = "ti,omap3-wdt"; +			ti,hwmods = "wd_timer2"; +		};  	};  }; diff --git a/arch/arm/boot/dts/at91sam9g25ek.dts b/arch/arm/boot/dts/at91sam9g25ek.dts index 7829a4d0cb2..96514c134e5 100644 --- a/arch/arm/boot/dts/at91sam9g25ek.dts +++ b/arch/arm/boot/dts/at91sam9g25ek.dts @@ -15,7 +15,7 @@  	compatible = "atmel,at91sam9g25ek", "atmel,at91sam9x5ek", "atmel,at91sam9x5", "atmel,at91sam9";  	chosen { -		bootargs = "128M console=ttyS0,115200 root=/dev/mtdblock1 rw rootfstype=ubifs ubi.mtd=1 root=ubi0:rootfs"; +		bootargs = "console=ttyS0,115200 root=/dev/mtdblock1 rw rootfstype=ubifs ubi.mtd=1 root=ubi0:rootfs";  	};  	ahb { diff --git a/arch/arm/boot/dts/imx51-babbage.dts b/arch/arm/boot/dts/imx51-babbage.dts index cd86177a3ea..59d9789e550 100644 --- a/arch/arm/boot/dts/imx51-babbage.dts +++ b/arch/arm/boot/dts/imx51-babbage.dts @@ -25,8 +25,8 @@  		aips@70000000 { /* aips-1 */  			spba@70000000 {  				esdhc@70004000 { /* ESDHC1 */ -					fsl,cd-internal; -					fsl,wp-internal; +					fsl,cd-controller; +					fsl,wp-controller;  					status = "okay";  				}; diff --git a/arch/arm/boot/dts/kirkwood-iconnect.dts b/arch/arm/boot/dts/kirkwood-iconnect.dts index 52d94704510..f8ca6fa8819 100644 --- a/arch/arm/boot/dts/kirkwood-iconnect.dts +++ b/arch/arm/boot/dts/kirkwood-iconnect.dts @@ -41,9 +41,13 @@  		};  		power-blue {  			label = "power:blue"; -			gpios = <&gpio1 11 0>; +			gpios = <&gpio1 10 0>;  			linux,default-trigger = "timer";  		}; +		power-red { +			label = "power:red"; +			gpios = <&gpio1 11 0>; +		};  		usb1 {  			label = "usb1:blue";  			gpios = <&gpio1 12 0>; diff --git a/arch/arm/boot/dts/twl6030.dtsi b/arch/arm/boot/dts/twl6030.dtsi index 3b2f3510d7e..d351b27d721 100644 --- a/arch/arm/boot/dts/twl6030.dtsi +++ b/arch/arm/boot/dts/twl6030.dtsi @@ -66,6 +66,7 @@  	vcxio: regulator@8 {  		compatible = "ti,twl6030-vcxio"; +		regulator-always-on;  	};  	vusb: regulator@9 { @@ -74,10 +75,12 @@  	v1v8: regulator@10 {  		compatible = "ti,twl6030-v1v8"; +		regulator-always-on;  	};  	v2v1: regulator@11 {  		compatible = "ti,twl6030-v2v1"; +		regulator-always-on;  	};  	clk32kg: regulator@12 { diff --git a/arch/arm/configs/armadillo800eva_defconfig b/arch/arm/configs/armadillo800eva_defconfig index 7d8718468e0..90610c7030f 100644 --- a/arch/arm/configs/armadillo800eva_defconfig +++ b/arch/arm/configs/armadillo800eva_defconfig @@ -33,7 +33,7 @@ CONFIG_AEABI=y  CONFIG_FORCE_MAX_ZONEORDER=13  CONFIG_ZBOOT_ROM_TEXT=0x0  CONFIG_ZBOOT_ROM_BSS=0x0 -CONFIG_CMDLINE="console=tty0 console=ttySC1,115200 earlyprintk=sh-sci.1,115200 ignore_loglevel root=/dev/nfs ip=dhcp nfsroot=,rsize=4096,wsize=4096" +CONFIG_CMDLINE="console=tty0 console=ttySC1,115200 earlyprintk=sh-sci.1,115200 ignore_loglevel root=/dev/nfs ip=dhcp nfsroot=,rsize=4096,wsize=4096 rw"  CONFIG_CMDLINE_FORCE=y  CONFIG_KEXEC=y  CONFIG_VFP=y diff --git a/arch/arm/configs/u8500_defconfig b/arch/arm/configs/u8500_defconfig index 2d4f661d1cf..da6845493ca 100644 --- a/arch/arm/configs/u8500_defconfig +++ b/arch/arm/configs/u8500_defconfig @@ -86,6 +86,7 @@ CONFIG_NEW_LEDS=y  CONFIG_LEDS_CLASS=y  CONFIG_LEDS_LM3530=y  CONFIG_LEDS_LP5521=y +CONFIG_LEDS_GPIO=y  CONFIG_RTC_CLASS=y  CONFIG_RTC_DRV_AB8500=y  CONFIG_RTC_DRV_PL031=y diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h index 03fb93621d0..5c8b3bf4d82 100644 --- a/arch/arm/include/asm/assembler.h +++ b/arch/arm/include/asm/assembler.h @@ -320,4 +320,12 @@  	.size \name , . - \name  	.endm +	.macro check_uaccess, addr:req, size:req, limit:req, tmp:req, bad:req +#ifndef CONFIG_CPU_USE_DOMAINS +	adds	\tmp, \addr, #\size - 1 +	sbcccs	\tmp, \tmp, \limit +	bcs	\bad +#endif +	.endm +  #endif /* __ASM_ASSEMBLER_H__ */ diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h index 2ae842df455..5c44dcb0987 100644 --- a/arch/arm/include/asm/dma-mapping.h +++ b/arch/arm/include/asm/dma-mapping.h @@ -203,6 +203,13 @@ static inline void dma_free_writecombine(struct device *dev, size_t size,  }  /* + * This can be called during early boot to increase the size of the atomic + * coherent DMA pool above the default value of 256KiB. It must be called + * before postcore_initcall. + */ +extern void __init init_dma_coherent_pool_size(unsigned long size); + +/*   * This can be called during boot to increase the size of the consistent   * DMA region above it's default value of 2MB. It must be called before the   * memory allocator is initialised, i.e. before any core_initcall. diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h index e965f1b560f..5f6ddcc5645 100644 --- a/arch/arm/include/asm/memory.h +++ b/arch/arm/include/asm/memory.h @@ -187,6 +187,7 @@ static inline unsigned long __phys_to_virt(unsigned long x)  #define __phys_to_virt(x)	((x) - PHYS_OFFSET + PAGE_OFFSET)  #endif  #endif +#endif /* __ASSEMBLY__ */  #ifndef PHYS_OFFSET  #ifdef PLAT_PHYS_OFFSET @@ -196,6 +197,8 @@ static inline unsigned long __phys_to_virt(unsigned long x)  #endif  #endif +#ifndef __ASSEMBLY__ +  /*   * PFNs are used to describe any physical page; this means   * PFN 0 == physical address 0. diff --git a/arch/arm/include/asm/tlb.h b/arch/arm/include/asm/tlb.h index 314d4664eae..99a19512ee2 100644 --- a/arch/arm/include/asm/tlb.h +++ b/arch/arm/include/asm/tlb.h @@ -199,6 +199,9 @@ static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte,  {  	pgtable_page_dtor(pte); +#ifdef CONFIG_ARM_LPAE +	tlb_add_flush(tlb, addr); +#else  	/*  	 * With the classic ARM MMU, a pte page has two corresponding pmd  	 * entries, each covering 1MB. @@ -206,6 +209,7 @@ static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte,  	addr &= PMD_MASK;  	tlb_add_flush(tlb, addr + SZ_1M - PAGE_SIZE);  	tlb_add_flush(tlb, addr + SZ_1M); +#endif  	tlb_remove_page(tlb, pte);  } diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h index 479a6352e0b..77bd79f2ffd 100644 --- a/arch/arm/include/asm/uaccess.h +++ b/arch/arm/include/asm/uaccess.h @@ -101,28 +101,39 @@ extern int __get_user_1(void *);  extern int __get_user_2(void *);  extern int __get_user_4(void *); -#define __get_user_x(__r2,__p,__e,__s,__i...)				\ +#define __GUP_CLOBBER_1	"lr", "cc" +#ifdef CONFIG_CPU_USE_DOMAINS +#define __GUP_CLOBBER_2	"ip", "lr", "cc" +#else +#define __GUP_CLOBBER_2 "lr", "cc" +#endif +#define __GUP_CLOBBER_4	"lr", "cc" + +#define __get_user_x(__r2,__p,__e,__l,__s)				\  	   __asm__ __volatile__ (					\  		__asmeq("%0", "r0") __asmeq("%1", "r2")			\ +		__asmeq("%3", "r1")					\  		"bl	__get_user_" #__s				\  		: "=&r" (__e), "=r" (__r2)				\ -		: "0" (__p)						\ -		: __i, "cc") +		: "0" (__p), "r" (__l)					\ +		: __GUP_CLOBBER_##__s) -#define get_user(x,p)							\ +#define __get_user_check(x,p)							\  	({								\ +		unsigned long __limit = current_thread_info()->addr_limit - 1; \  		register const typeof(*(p)) __user *__p asm("r0") = (p);\  		register unsigned long __r2 asm("r2");			\ +		register unsigned long __l asm("r1") = __limit;		\  		register int __e asm("r0");				\  		switch (sizeof(*(__p))) {				\  		case 1:							\ -			__get_user_x(__r2, __p, __e, 1, "lr");		\ -	       		break;						\ +			__get_user_x(__r2, __p, __e, __l, 1);		\ +			break;						\  		case 2:							\ -			__get_user_x(__r2, __p, __e, 2, "r3", "lr");	\ +			__get_user_x(__r2, __p, __e, __l, 2);		\  			break;						\  		case 4:							\ -	       		__get_user_x(__r2, __p, __e, 4, "lr");		\ +			__get_user_x(__r2, __p, __e, __l, 4);		\  			break;						\  		default: __e = __get_user_bad(); break;			\  		}							\ @@ -130,42 +141,57 @@ extern int __get_user_4(void *);  		__e;							\  	}) +#define get_user(x,p)							\ +	({								\ +		might_fault();						\ +		__get_user_check(x,p);					\ +	 }) +  extern int __put_user_1(void *, unsigned int);  extern int __put_user_2(void *, unsigned int);  extern int __put_user_4(void *, unsigned int);  extern int __put_user_8(void *, unsigned long long); -#define __put_user_x(__r2,__p,__e,__s)					\ +#define __put_user_x(__r2,__p,__e,__l,__s)				\  	   __asm__ __volatile__ (					\  		__asmeq("%0", "r0") __asmeq("%2", "r2")			\ +		__asmeq("%3", "r1")					\  		"bl	__put_user_" #__s				\  		: "=&r" (__e)						\ -		: "0" (__p), "r" (__r2)					\ +		: "0" (__p), "r" (__r2), "r" (__l)			\  		: "ip", "lr", "cc") -#define put_user(x,p)							\ +#define __put_user_check(x,p)							\  	({								\ +		unsigned long __limit = current_thread_info()->addr_limit - 1; \  		register const typeof(*(p)) __r2 asm("r2") = (x);	\  		register const typeof(*(p)) __user *__p asm("r0") = (p);\ +		register unsigned long __l asm("r1") = __limit;		\  		register int __e asm("r0");				\  		switch (sizeof(*(__p))) {				\  		case 1:							\ -			__put_user_x(__r2, __p, __e, 1);		\ +			__put_user_x(__r2, __p, __e, __l, 1);		\  			break;						\  		case 2:							\ -			__put_user_x(__r2, __p, __e, 2);		\ +			__put_user_x(__r2, __p, __e, __l, 2);		\  			break;						\  		case 4:							\ -			__put_user_x(__r2, __p, __e, 4);		\ +			__put_user_x(__r2, __p, __e, __l, 4);		\  			break;						\  		case 8:							\ -			__put_user_x(__r2, __p, __e, 8);		\ +			__put_user_x(__r2, __p, __e, __l, 8);		\  			break;						\  		default: __e = __put_user_bad(); break;			\  		}							\  		__e;							\  	}) +#define put_user(x,p)							\ +	({								\ +		might_fault();						\ +		__put_user_check(x,p);					\ +	 }) +  #else /* CONFIG_MMU */  /* @@ -219,6 +245,7 @@ do {									\  	unsigned long __gu_addr = (unsigned long)(ptr);			\  	unsigned long __gu_val;						\  	__chk_user_ptr(ptr);						\ +	might_fault();							\  	switch (sizeof(*(ptr))) {					\  	case 1:	__get_user_asm_byte(__gu_val,__gu_addr,err);	break;	\  	case 2:	__get_user_asm_half(__gu_val,__gu_addr,err);	break;	\ @@ -300,6 +327,7 @@ do {									\  	unsigned long __pu_addr = (unsigned long)(ptr);			\  	__typeof__(*(ptr)) __pu_val = (x);				\  	__chk_user_ptr(ptr);						\ +	might_fault();							\  	switch (sizeof(*(ptr))) {					\  	case 1: __put_user_asm_byte(__pu_val,__pu_addr,err);	break;	\  	case 2: __put_user_asm_half(__pu_val,__pu_addr,err);	break;	\ diff --git a/arch/arm/kernel/hw_breakpoint.c b/arch/arm/kernel/hw_breakpoint.c index ba386bd9410..281bf330124 100644 --- a/arch/arm/kernel/hw_breakpoint.c +++ b/arch/arm/kernel/hw_breakpoint.c @@ -159,6 +159,12 @@ static int debug_arch_supported(void)  		arch >= ARM_DEBUG_ARCH_V7_1;  } +/* Can we determine the watchpoint access type from the fsr? */ +static int debug_exception_updates_fsr(void) +{ +	return 0; +} +  /* Determine number of WRP registers available. */  static int get_num_wrp_resources(void)  { @@ -604,13 +610,14 @@ int arch_validate_hwbkpt_settings(struct perf_event *bp)  		/* Aligned */  		break;  	case 1: -		/* Allow single byte watchpoint. */ -		if (info->ctrl.len == ARM_BREAKPOINT_LEN_1) -			break;  	case 2:  		/* Allow halfword watchpoints and breakpoints. */  		if (info->ctrl.len == ARM_BREAKPOINT_LEN_2)  			break; +	case 3: +		/* Allow single byte watchpoint. */ +		if (info->ctrl.len == ARM_BREAKPOINT_LEN_1) +			break;  	default:  		ret = -EINVAL;  		goto out; @@ -619,18 +626,35 @@ int arch_validate_hwbkpt_settings(struct perf_event *bp)  	info->address &= ~alignment_mask;  	info->ctrl.len <<= offset; -	/* -	 * Currently we rely on an overflow handler to take -	 * care of single-stepping the breakpoint when it fires. -	 * In the case of userspace breakpoints on a core with V7 debug, -	 * we can use the mismatch feature as a poor-man's hardware -	 * single-step, but this only works for per-task breakpoints. -	 */ -	if (!bp->overflow_handler && (arch_check_bp_in_kernelspace(bp) || -	    !core_has_mismatch_brps() || !bp->hw.bp_target)) { -		pr_warning("overflow handler required but none found\n"); -		ret = -EINVAL; +	if (!bp->overflow_handler) { +		/* +		 * Mismatch breakpoints are required for single-stepping +		 * breakpoints. +		 */ +		if (!core_has_mismatch_brps()) +			return -EINVAL; + +		/* We don't allow mismatch breakpoints in kernel space. */ +		if (arch_check_bp_in_kernelspace(bp)) +			return -EPERM; + +		/* +		 * Per-cpu breakpoints are not supported by our stepping +		 * mechanism. +		 */ +		if (!bp->hw.bp_target) +			return -EINVAL; + +		/* +		 * We only support specific access types if the fsr +		 * reports them. +		 */ +		if (!debug_exception_updates_fsr() && +		    (info->ctrl.type == ARM_BREAKPOINT_LOAD || +		     info->ctrl.type == ARM_BREAKPOINT_STORE)) +			return -EINVAL;  	} +  out:  	return ret;  } @@ -706,10 +730,12 @@ static void watchpoint_handler(unsigned long addr, unsigned int fsr,  				goto unlock;  			/* Check that the access type matches. */ -			access = (fsr & ARM_FSR_ACCESS_MASK) ? HW_BREAKPOINT_W : -				 HW_BREAKPOINT_R; -			if (!(access & hw_breakpoint_type(wp))) -				goto unlock; +			if (debug_exception_updates_fsr()) { +				access = (fsr & ARM_FSR_ACCESS_MASK) ? +					  HW_BREAKPOINT_W : HW_BREAKPOINT_R; +				if (!(access & hw_breakpoint_type(wp))) +					goto unlock; +			}  			/* We have a winner. */  			info->trigger = addr; diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c index f7945218b8c..b0179b89a04 100644 --- a/arch/arm/kernel/traps.c +++ b/arch/arm/kernel/traps.c @@ -420,20 +420,23 @@ asmlinkage void __exception do_undefinstr(struct pt_regs *regs)  #endif  			instr = *(u32 *) pc;  	} else if (thumb_mode(regs)) { -		get_user(instr, (u16 __user *)pc); +		if (get_user(instr, (u16 __user *)pc)) +			goto die_sig;  		if (is_wide_instruction(instr)) {  			unsigned int instr2; -			get_user(instr2, (u16 __user *)pc+1); +			if (get_user(instr2, (u16 __user *)pc+1)) +				goto die_sig;  			instr <<= 16;  			instr |= instr2;  		} -	} else { -		get_user(instr, (u32 __user *)pc); +	} else if (get_user(instr, (u32 __user *)pc)) { +		goto die_sig;  	}  	if (call_undef_hook(regs, instr) == 0)  		return; +die_sig:  #ifdef CONFIG_DEBUG_USER  	if (user_debug & UDBG_UNDEFINED) {  		printk(KERN_INFO "%s (%d): undefined instruction: pc=%p\n", diff --git a/arch/arm/lib/delay.c b/arch/arm/lib/delay.c index d6dacc69254..395d5fbb8fa 100644 --- a/arch/arm/lib/delay.c +++ b/arch/arm/lib/delay.c @@ -59,6 +59,7 @@ void __init init_current_timer_delay(unsigned long freq)  {  	pr_info("Switching to timer-based delay loop\n");  	lpj_fine			= freq / HZ; +	loops_per_jiffy			= lpj_fine;  	arm_delay_ops.delay		= __timer_delay;  	arm_delay_ops.const_udelay	= __timer_const_udelay;  	arm_delay_ops.udelay		= __timer_udelay; diff --git a/arch/arm/lib/getuser.S b/arch/arm/lib/getuser.S index 11093a7c3e3..9b06bb41fca 100644 --- a/arch/arm/lib/getuser.S +++ b/arch/arm/lib/getuser.S @@ -16,8 +16,9 @@   * __get_user_X   *   * Inputs:	r0 contains the address + *		r1 contains the address limit, which must be preserved   * Outputs:	r0 is the error code - *		r2, r3 contains the zero-extended value + *		r2 contains the zero-extended value   *		lr corrupted   *   * No other registers must be altered.  (see <asm/uaccess.h> @@ -27,33 +28,39 @@   * Note also that it is intended that __get_user_bad is not global.   */  #include <linux/linkage.h> +#include <asm/assembler.h>  #include <asm/errno.h>  #include <asm/domain.h>  ENTRY(__get_user_1) +	check_uaccess r0, 1, r1, r2, __get_user_bad  1: TUSER(ldrb)	r2, [r0]  	mov	r0, #0  	mov	pc, lr  ENDPROC(__get_user_1)  ENTRY(__get_user_2) -#ifdef CONFIG_THUMB2_KERNEL -2: TUSER(ldrb)	r2, [r0] -3: TUSER(ldrb)	r3, [r0, #1] +	check_uaccess r0, 2, r1, r2, __get_user_bad +#ifdef CONFIG_CPU_USE_DOMAINS +rb	.req	ip +2:	ldrbt	r2, [r0], #1 +3:	ldrbt	rb, [r0], #0  #else -2: TUSER(ldrb)	r2, [r0], #1 -3: TUSER(ldrb)	r3, [r0] +rb	.req	r0 +2:	ldrb	r2, [r0] +3:	ldrb	rb, [r0, #1]  #endif  #ifndef __ARMEB__ -	orr	r2, r2, r3, lsl #8 +	orr	r2, r2, rb, lsl #8  #else -	orr	r2, r3, r2, lsl #8 +	orr	r2, rb, r2, lsl #8  #endif  	mov	r0, #0  	mov	pc, lr  ENDPROC(__get_user_2)  ENTRY(__get_user_4) +	check_uaccess r0, 4, r1, r2, __get_user_bad  4: TUSER(ldr)	r2, [r0]  	mov	r0, #0  	mov	pc, lr diff --git a/arch/arm/lib/putuser.S b/arch/arm/lib/putuser.S index 7db25990c58..3d73dcb959b 100644 --- a/arch/arm/lib/putuser.S +++ b/arch/arm/lib/putuser.S @@ -16,6 +16,7 @@   * __put_user_X   *   * Inputs:	r0 contains the address + *		r1 contains the address limit, which must be preserved   *		r2, r3 contains the value   * Outputs:	r0 is the error code   *		lr corrupted @@ -27,16 +28,19 @@   * Note also that it is intended that __put_user_bad is not global.   */  #include <linux/linkage.h> +#include <asm/assembler.h>  #include <asm/errno.h>  #include <asm/domain.h>  ENTRY(__put_user_1) +	check_uaccess r0, 1, r1, ip, __put_user_bad  1: TUSER(strb)	r2, [r0]  	mov	r0, #0  	mov	pc, lr  ENDPROC(__put_user_1)  ENTRY(__put_user_2) +	check_uaccess r0, 2, r1, ip, __put_user_bad  	mov	ip, r2, lsr #8  #ifdef CONFIG_THUMB2_KERNEL  #ifndef __ARMEB__ @@ -60,12 +64,14 @@ ENTRY(__put_user_2)  ENDPROC(__put_user_2)  ENTRY(__put_user_4) +	check_uaccess r0, 4, r1, ip, __put_user_bad  4: TUSER(str)	r2, [r0]  	mov	r0, #0  	mov	pc, lr  ENDPROC(__put_user_4)  ENTRY(__put_user_8) +	check_uaccess r0, 8, r1, ip, __put_user_bad  #ifdef CONFIG_THUMB2_KERNEL  5: TUSER(str)	r2, [r0]  6: TUSER(str)	r3, [r0, #4] diff --git a/arch/arm/mach-at91/at91rm9200_time.c b/arch/arm/mach-at91/at91rm9200_time.c index 104ca40d8d1..aaa443b48c9 100644 --- a/arch/arm/mach-at91/at91rm9200_time.c +++ b/arch/arm/mach-at91/at91rm9200_time.c @@ -197,7 +197,7 @@ void __init at91rm9200_timer_init(void)  	at91_st_read(AT91_ST_SR);  	/* Make IRQs happen for the system timer */ -	setup_irq(AT91_ID_SYS, &at91rm9200_timer_irq); +	setup_irq(NR_IRQS_LEGACY + AT91_ID_SYS, &at91rm9200_timer_irq);  	/* The 32KiHz "Slow Clock" (tick every 30517.58 nanoseconds) is used  	 * directly for the clocksource and all clockevents, after adjusting diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c index 7b9c2ba396e..bce572a530e 100644 --- a/arch/arm/mach-at91/at91sam9260_devices.c +++ b/arch/arm/mach-at91/at91sam9260_devices.c @@ -726,6 +726,8 @@ static struct resource rtt_resources[] = {  		.flags	= IORESOURCE_MEM,  	}, {  		.flags	= IORESOURCE_MEM, +	}, { +		.flags  = IORESOURCE_IRQ,  	},  }; @@ -744,10 +746,12 @@ static void __init at91_add_device_rtt_rtc(void)  	 * The second resource is needed:  	 * GPBR will serve as the storage for RTC time offset  	 */ -	at91sam9260_rtt_device.num_resources = 2; +	at91sam9260_rtt_device.num_resources = 3;  	rtt_resources[1].start = AT91SAM9260_BASE_GPBR +  				 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR;  	rtt_resources[1].end = rtt_resources[1].start + 3; +	rtt_resources[2].start = NR_IRQS_LEGACY + AT91_ID_SYS; +	rtt_resources[2].end = NR_IRQS_LEGACY + AT91_ID_SYS;  }  #else  static void __init at91_add_device_rtt_rtc(void) diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c index 8df5c1bdff9..bc2590d712d 100644 --- a/arch/arm/mach-at91/at91sam9261_devices.c +++ b/arch/arm/mach-at91/at91sam9261_devices.c @@ -609,6 +609,8 @@ static struct resource rtt_resources[] = {  		.flags	= IORESOURCE_MEM,  	}, {  		.flags	= IORESOURCE_MEM, +	}, { +		.flags  = IORESOURCE_IRQ,  	}  }; @@ -626,10 +628,12 @@ static void __init at91_add_device_rtt_rtc(void)  	 * The second resource is needed:  	 * GPBR will serve as the storage for RTC time offset  	 */ -	at91sam9261_rtt_device.num_resources = 2; +	at91sam9261_rtt_device.num_resources = 3;  	rtt_resources[1].start = AT91SAM9261_BASE_GPBR +  				 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR;  	rtt_resources[1].end = rtt_resources[1].start + 3; +	rtt_resources[2].start = NR_IRQS_LEGACY + AT91_ID_SYS; +	rtt_resources[2].end = NR_IRQS_LEGACY + AT91_ID_SYS;  }  #else  static void __init at91_add_device_rtt_rtc(void) diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c index eb6bbf86fb9..9b6ca734f1a 100644 --- a/arch/arm/mach-at91/at91sam9263_devices.c +++ b/arch/arm/mach-at91/at91sam9263_devices.c @@ -990,6 +990,8 @@ static struct resource rtt0_resources[] = {  		.flags	= IORESOURCE_MEM,  	}, {  		.flags	= IORESOURCE_MEM, +	}, { +		.flags  = IORESOURCE_IRQ,  	}  }; @@ -1006,6 +1008,8 @@ static struct resource rtt1_resources[] = {  		.flags	= IORESOURCE_MEM,  	}, {  		.flags	= IORESOURCE_MEM, +	}, { +		.flags  = IORESOURCE_IRQ,  	}  }; @@ -1027,14 +1031,14 @@ static void __init at91_add_device_rtt_rtc(void)  		 * The second resource is needed only for the chosen RTT:  		 * GPBR will serve as the storage for RTC time offset  		 */ -		at91sam9263_rtt0_device.num_resources = 2; +		at91sam9263_rtt0_device.num_resources = 3;  		at91sam9263_rtt1_device.num_resources = 1;  		pdev = &at91sam9263_rtt0_device;  		r = rtt0_resources;  		break;  	case 1:  		at91sam9263_rtt0_device.num_resources = 1; -		at91sam9263_rtt1_device.num_resources = 2; +		at91sam9263_rtt1_device.num_resources = 3;  		pdev = &at91sam9263_rtt1_device;  		r = rtt1_resources;  		break; @@ -1047,6 +1051,8 @@ static void __init at91_add_device_rtt_rtc(void)  	pdev->name = "rtc-at91sam9";  	r[1].start = AT91SAM9263_BASE_GPBR + 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR;  	r[1].end = r[1].start + 3; +	r[2].start = NR_IRQS_LEGACY + AT91_ID_SYS; +	r[2].end = NR_IRQS_LEGACY + AT91_ID_SYS;  }  #else  static void __init at91_add_device_rtt_rtc(void) diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c index 06073996a38..1b47319ca00 100644 --- a/arch/arm/mach-at91/at91sam9g45_devices.c +++ b/arch/arm/mach-at91/at91sam9g45_devices.c @@ -1293,6 +1293,8 @@ static struct resource rtt_resources[] = {  		.flags	= IORESOURCE_MEM,  	}, {  		.flags	= IORESOURCE_MEM, +	}, { +		.flags  = IORESOURCE_IRQ,  	}  }; @@ -1310,10 +1312,12 @@ static void __init at91_add_device_rtt_rtc(void)  	 * The second resource is needed:  	 * GPBR will serve as the storage for RTC time offset  	 */ -	at91sam9g45_rtt_device.num_resources = 2; +	at91sam9g45_rtt_device.num_resources = 3;  	rtt_resources[1].start = AT91SAM9G45_BASE_GPBR +  				 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR;  	rtt_resources[1].end = rtt_resources[1].start + 3; +	rtt_resources[2].start = NR_IRQS_LEGACY + AT91_ID_SYS; +	rtt_resources[2].end = NR_IRQS_LEGACY + AT91_ID_SYS;  }  #else  static void __init at91_add_device_rtt_rtc(void) diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c index f09fff93217..b3d365dadef 100644 --- a/arch/arm/mach-at91/at91sam9rl_devices.c +++ b/arch/arm/mach-at91/at91sam9rl_devices.c @@ -688,6 +688,8 @@ static struct resource rtt_resources[] = {  		.flags	= IORESOURCE_MEM,  	}, {  		.flags	= IORESOURCE_MEM, +	}, { +		.flags  = IORESOURCE_IRQ,  	}  }; @@ -705,10 +707,12 @@ static void __init at91_add_device_rtt_rtc(void)  	 * The second resource is needed:  	 * GPBR will serve as the storage for RTC time offset  	 */ -	at91sam9rl_rtt_device.num_resources = 2; +	at91sam9rl_rtt_device.num_resources = 3;  	rtt_resources[1].start = AT91SAM9RL_BASE_GPBR +  				 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR;  	rtt_resources[1].end = rtt_resources[1].start + 3; +	rtt_resources[2].start = NR_IRQS_LEGACY + AT91_ID_SYS; +	rtt_resources[2].end = NR_IRQS_LEGACY + AT91_ID_SYS;  }  #else  static void __init at91_add_device_rtt_rtc(void) diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c index de2ec6b8fea..188c82971eb 100644 --- a/arch/arm/mach-at91/clock.c +++ b/arch/arm/mach-at91/clock.c @@ -63,6 +63,12 @@ EXPORT_SYMBOL_GPL(at91_pmc_base);  #define cpu_has_300M_plla()	(cpu_is_at91sam9g10()) +#define cpu_has_240M_plla()	(cpu_is_at91sam9261() \ +				|| cpu_is_at91sam9263() \ +				|| cpu_is_at91sam9rl()) + +#define cpu_has_210M_plla()	(cpu_is_at91sam9260()) +  #define cpu_has_pllb()		(!(cpu_is_at91sam9rl() \  				|| cpu_is_at91sam9g45() \  				|| cpu_is_at91sam9x5() \ @@ -706,6 +712,12 @@ static int __init at91_pmc_init(unsigned long main_clock)  	} else if (cpu_has_800M_plla()) {  		if (plla.rate_hz > 800000000)  			pll_overclock = true; +	} else if (cpu_has_240M_plla()) { +		if (plla.rate_hz > 240000000) +			pll_overclock = true; +	} else if (cpu_has_210M_plla()) { +		if (plla.rate_hz > 210000000) +			pll_overclock = true;  	} else {  		if (plla.rate_hz > 209000000)  			pll_overclock = true; diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c index 4db5de54b6a..6321567d8ea 100644 --- a/arch/arm/mach-dove/common.c +++ b/arch/arm/mach-dove/common.c @@ -102,7 +102,8 @@ void __init dove_ehci1_init(void)  void __init dove_ge00_init(struct mv643xx_eth_platform_data *eth_data)  {  	orion_ge00_init(eth_data, DOVE_GE00_PHYS_BASE, -			IRQ_DOVE_GE00_SUM, IRQ_DOVE_GE00_ERR); +			IRQ_DOVE_GE00_SUM, IRQ_DOVE_GE00_ERR, +			1600);  }  /***************************************************************************** diff --git a/arch/arm/mach-exynos/mach-origen.c b/arch/arm/mach-exynos/mach-origen.c index 5ca80307d6d..4e574c24581 100644 --- a/arch/arm/mach-exynos/mach-origen.c +++ b/arch/arm/mach-exynos/mach-origen.c @@ -42,6 +42,7 @@  #include <plat/backlight.h>  #include <plat/fb.h>  #include <plat/mfc.h> +#include <plat/hdmi.h>  #include <mach/ohci.h>  #include <mach/map.h> @@ -734,6 +735,11 @@ static void __init origen_bt_setup(void)  	s3c_gpio_setpull(EXYNOS4_GPX2(2), S3C_GPIO_PULL_NONE);  } +/* I2C module and id for HDMIPHY */ +static struct i2c_board_info hdmiphy_info = { +	I2C_BOARD_INFO("hdmiphy-exynos4210", 0x38), +}; +  static void s5p_tv_setup(void)  {  	/* Direct HPD to HDMI chip */ @@ -781,6 +787,7 @@ static void __init origen_machine_init(void)  	s5p_tv_setup();  	s5p_i2c_hdmiphy_set_platdata(NULL); +	s5p_hdmi_set_platdata(&hdmiphy_info, NULL, 0);  #ifdef CONFIG_DRM_EXYNOS  	s5p_device_fimd0.dev.platform_data = &drm_fimd_pdata; diff --git a/arch/arm/mach-exynos/mach-smdkv310.c b/arch/arm/mach-exynos/mach-smdkv310.c index 3cfa688d274..73f2bce097e 100644 --- a/arch/arm/mach-exynos/mach-smdkv310.c +++ b/arch/arm/mach-exynos/mach-smdkv310.c @@ -40,6 +40,7 @@  #include <plat/mfc.h>  #include <plat/ehci.h>  #include <plat/clock.h> +#include <plat/hdmi.h>  #include <mach/map.h>  #include <mach/ohci.h> @@ -354,6 +355,11 @@ static struct platform_pwm_backlight_data smdkv310_bl_data = {  	.pwm_period_ns  = 1000,  }; +/* I2C module and id for HDMIPHY */ +static struct i2c_board_info hdmiphy_info = { +	I2C_BOARD_INFO("hdmiphy-exynos4210", 0x38), +}; +  static void s5p_tv_setup(void)  {  	/* direct HPD to HDMI chip */ @@ -388,6 +394,7 @@ static void __init smdkv310_machine_init(void)  	s5p_tv_setup();  	s5p_i2c_hdmiphy_set_platdata(NULL); +	s5p_hdmi_set_platdata(&hdmiphy_info, NULL, 0);  	samsung_keypad_set_platdata(&smdkv310_keypad_data); diff --git a/arch/arm/mach-gemini/irq.c b/arch/arm/mach-gemini/irq.c index ca70e5fcc7a..020852d3bdd 100644 --- a/arch/arm/mach-gemini/irq.c +++ b/arch/arm/mach-gemini/irq.c @@ -17,6 +17,7 @@  #include <linux/sched.h>  #include <asm/irq.h>  #include <asm/mach/irq.h> +#include <asm/system_misc.h>  #include <mach/hardware.h>  #define IRQ_SOURCE(base_addr)	(base_addr + 0x00) diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile index 07f7c226e4c..d004d37ad9d 100644 --- a/arch/arm/mach-imx/Makefile +++ b/arch/arm/mach-imx/Makefile @@ -9,7 +9,8 @@ obj-$(CONFIG_SOC_IMX27) += clk-imx27.o mm-imx27.o ehci-imx27.o  obj-$(CONFIG_SOC_IMX31) += mm-imx3.o cpu-imx31.o clk-imx31.o iomux-imx31.o ehci-imx31.o pm-imx3.o  obj-$(CONFIG_SOC_IMX35) += mm-imx3.o cpu-imx35.o clk-imx35.o ehci-imx35.o pm-imx3.o -obj-$(CONFIG_SOC_IMX5) += cpu-imx5.o mm-imx5.o clk-imx51-imx53.o ehci-imx5.o pm-imx5.o cpu_op-mx51.o +imx5-pm-$(CONFIG_PM) += pm-imx5.o +obj-$(CONFIG_SOC_IMX5) += cpu-imx5.o mm-imx5.o clk-imx51-imx53.o ehci-imx5.o $(imx5-pm-y) cpu_op-mx51.o  obj-$(CONFIG_COMMON_CLK) += clk-pllv1.o clk-pllv2.o clk-pllv3.o clk-gate2.o \  			    clk-pfd.o clk-busy.o @@ -70,14 +71,13 @@ obj-$(CONFIG_DEBUG_LL) += lluart.o  obj-$(CONFIG_HAVE_IMX_GPC) += gpc.o  obj-$(CONFIG_HAVE_IMX_MMDC) += mmdc.o  obj-$(CONFIG_HAVE_IMX_SRC) += src.o -obj-$(CONFIG_CPU_V7) += head-v7.o -AFLAGS_head-v7.o :=-Wa,-march=armv7-a -obj-$(CONFIG_SMP) += platsmp.o +AFLAGS_headsmp.o :=-Wa,-march=armv7-a +obj-$(CONFIG_SMP) += headsmp.o platsmp.o  obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o  obj-$(CONFIG_SOC_IMX6Q) += clk-imx6q.o mach-imx6q.o  ifeq ($(CONFIG_PM),y) -obj-$(CONFIG_SOC_IMX6Q) += pm-imx6q.o +obj-$(CONFIG_SOC_IMX6Q) += pm-imx6q.o headsmp.o  endif  # i.MX5 based machines diff --git a/arch/arm/mach-imx/clk-imx25.c b/arch/arm/mach-imx/clk-imx25.c index fdd8cc87c9f..4431a62fff5 100644 --- a/arch/arm/mach-imx/clk-imx25.c +++ b/arch/arm/mach-imx/clk-imx25.c @@ -222,10 +222,8 @@ int __init mx25_clocks_init(void)  	clk_register_clkdev(clk[lcdc_ipg], "ipg", "imx-fb.0");  	clk_register_clkdev(clk[lcdc_ahb], "ahb", "imx-fb.0");  	clk_register_clkdev(clk[wdt_ipg], NULL, "imx2-wdt.0"); -	clk_register_clkdev(clk[ssi1_ipg_per], "per", "imx-ssi.0"); -	clk_register_clkdev(clk[ssi1_ipg], "ipg", "imx-ssi.0"); -	clk_register_clkdev(clk[ssi2_ipg_per], "per", "imx-ssi.1"); -	clk_register_clkdev(clk[ssi2_ipg], "ipg", "imx-ssi.1"); +	clk_register_clkdev(clk[ssi1_ipg], NULL, "imx-ssi.0"); +	clk_register_clkdev(clk[ssi2_ipg], NULL, "imx-ssi.1");  	clk_register_clkdev(clk[esdhc1_ipg_per], "per", "sdhci-esdhc-imx25.0");  	clk_register_clkdev(clk[esdhc1_ipg], "ipg", "sdhci-esdhc-imx25.0");  	clk_register_clkdev(clk[esdhc1_ahb], "ahb", "sdhci-esdhc-imx25.0"); diff --git a/arch/arm/mach-imx/clk-imx35.c b/arch/arm/mach-imx/clk-imx35.c index c6422fb10ba..65fb8bcd86c 100644 --- a/arch/arm/mach-imx/clk-imx35.c +++ b/arch/arm/mach-imx/clk-imx35.c @@ -230,10 +230,8 @@ int __init mx35_clocks_init()  	clk_register_clkdev(clk[ipu_gate], NULL, "mx3_sdc_fb");  	clk_register_clkdev(clk[owire_gate], NULL, "mxc_w1");  	clk_register_clkdev(clk[sdma_gate], NULL, "imx35-sdma"); -	clk_register_clkdev(clk[ipg], "ipg", "imx-ssi.0"); -	clk_register_clkdev(clk[ssi1_div_post], "per", "imx-ssi.0"); -	clk_register_clkdev(clk[ipg], "ipg", "imx-ssi.1"); -	clk_register_clkdev(clk[ssi2_div_post], "per", "imx-ssi.1"); +	clk_register_clkdev(clk[ssi1_gate], NULL, "imx-ssi.0"); +	clk_register_clkdev(clk[ssi2_gate], NULL, "imx-ssi.1");  	/* i.mx35 has the i.mx21 type uart */  	clk_register_clkdev(clk[uart1_gate], "per", "imx21-uart.0");  	clk_register_clkdev(clk[ipg], "ipg", "imx21-uart.0"); diff --git a/arch/arm/mach-imx/clk-imx6q.c b/arch/arm/mach-imx/clk-imx6q.c index ea89520b6e2..4233d9e3531 100644 --- a/arch/arm/mach-imx/clk-imx6q.c +++ b/arch/arm/mach-imx/clk-imx6q.c @@ -152,7 +152,7 @@ enum mx6q_clks {  	ssi2, ssi3, uart_ipg, uart_serial, usboh3, usdhc1, usdhc2, usdhc3,  	usdhc4, vdo_axi, vpu_axi, cko1, pll1_sys, pll2_bus, pll3_usb_otg,  	pll4_audio, pll5_video, pll6_mlb, pll7_usb_host, pll8_enet, ssi1_ipg, -	ssi2_ipg, ssi3_ipg, rom, usbphy1, usbphy2, +	ssi2_ipg, ssi3_ipg, rom, usbphy1, usbphy2, ldb_di0_div_3_5, ldb_di1_div_3_5,  	clk_max  }; @@ -288,8 +288,10 @@ int __init mx6q_clocks_init(void)  	clk[gpu3d_shader]     = imx_clk_divider("gpu3d_shader",     "gpu3d_shader_sel",  base + 0x18, 29, 3);  	clk[ipu1_podf]        = imx_clk_divider("ipu1_podf",        "ipu1_sel",          base + 0x3c, 11, 3);  	clk[ipu2_podf]        = imx_clk_divider("ipu2_podf",        "ipu2_sel",          base + 0x3c, 16, 3); -	clk[ldb_di0_podf]     = imx_clk_divider("ldb_di0_podf",     "ldb_di0_sel",       base + 0x20, 10, 1); -	clk[ldb_di1_podf]     = imx_clk_divider("ldb_di1_podf",     "ldb_di1_sel",       base + 0x20, 11, 1); +	clk[ldb_di0_div_3_5]  = imx_clk_fixed_factor("ldb_di0_div_3_5", "ldb_di0_sel", 2, 7); +	clk[ldb_di0_podf]     = imx_clk_divider("ldb_di0_podf",     "ldb_di0_div_3_5",       base + 0x20, 10, 1); +	clk[ldb_di1_div_3_5]  = imx_clk_fixed_factor("ldb_di1_div_3_5", "ldb_di1_sel", 2, 7); +	clk[ldb_di1_podf]     = imx_clk_divider("ldb_di1_podf",     "ldb_di1_div_3_5",   base + 0x20, 11, 1);  	clk[ipu1_di0_pre]     = imx_clk_divider("ipu1_di0_pre",     "ipu1_di0_pre_sel",  base + 0x34, 3,  3);  	clk[ipu1_di1_pre]     = imx_clk_divider("ipu1_di1_pre",     "ipu1_di1_pre_sel",  base + 0x34, 12, 3);  	clk[ipu2_di0_pre]     = imx_clk_divider("ipu2_di0_pre",     "ipu2_di0_pre_sel",  base + 0x38, 3,  3); diff --git a/arch/arm/mach-imx/head-v7.S b/arch/arm/mach-imx/headsmp.S index 7e49deb128a..7e49deb128a 100644 --- a/arch/arm/mach-imx/head-v7.S +++ b/arch/arm/mach-imx/headsmp.S diff --git a/arch/arm/mach-imx/hotplug.c b/arch/arm/mach-imx/hotplug.c index 20ed2d56c1a..f8f7437c83b 100644 --- a/arch/arm/mach-imx/hotplug.c +++ b/arch/arm/mach-imx/hotplug.c @@ -42,22 +42,6 @@ static inline void cpu_enter_lowpower(void)  	  : "cc");  } -static inline void cpu_leave_lowpower(void) -{ -	unsigned int v; - -	asm volatile( -		"mrc	p15, 0, %0, c1, c0, 0\n" -	"	orr	%0, %0, %1\n" -	"	mcr	p15, 0, %0, c1, c0, 0\n" -	"	mrc	p15, 0, %0, c1, c0, 1\n" -	"	orr	%0, %0, %2\n" -	"	mcr	p15, 0, %0, c1, c0, 1\n" -	  : "=&r" (v) -	  : "Ir" (CR_C), "Ir" (0x40) -	  : "cc"); -} -  /*   * platform-specific code to shutdown a CPU   * @@ -67,11 +51,10 @@ void platform_cpu_die(unsigned int cpu)  {  	cpu_enter_lowpower();  	imx_enable_cpu(cpu, false); -	cpu_do_idle(); -	cpu_leave_lowpower(); -	/* We should never return from idle */ -	panic("cpu %d unexpectedly exit from shutdown\n", cpu); +	/* spin here until hardware takes it down */ +	while (1) +		;  }  int platform_cpu_disable(unsigned int cpu) diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c index 5ec0608f2a7..045b3f6a387 100644 --- a/arch/arm/mach-imx/mach-imx6q.c +++ b/arch/arm/mach-imx/mach-imx6q.c @@ -71,7 +71,7 @@ soft:  /* For imx6q sabrelite board: set KSZ9021RN RGMII pad skew */  static int ksz9021rn_phy_fixup(struct phy_device *phydev)  { -	if (IS_ENABLED(CONFIG_PHYLIB)) { +	if (IS_BUILTIN(CONFIG_PHYLIB)) {  		/* min rx data delay */  		phy_write(phydev, 0x0b, 0x8105);  		phy_write(phydev, 0x0c, 0x0000); @@ -112,7 +112,7 @@ put_clk:  static void __init imx6q_sabrelite_init(void)  { -	if (IS_ENABLED(CONFIG_PHYLIB)) +	if (IS_BUILTIN(CONFIG_PHYLIB))  		phy_register_fixup_for_uid(PHY_ID_KSZ9021, MICREL_PHY_ID_MASK,  				ksz9021rn_phy_fixup);  	imx6q_sabrelite_cko1_setup(); diff --git a/arch/arm/mach-kirkwood/Makefile.boot b/arch/arm/mach-kirkwood/Makefile.boot index a5717558ee8..a13299d758e 100644 --- a/arch/arm/mach-kirkwood/Makefile.boot +++ b/arch/arm/mach-kirkwood/Makefile.boot @@ -7,7 +7,8 @@ dtb-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += kirkwood-dns320.dtb  dtb-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += kirkwood-dns325.dtb  dtb-$(CONFIG_MACH_ICONNECT_DT) += kirkwood-iconnect.dtb  dtb-$(CONFIG_MACH_IB62X0_DT) += kirkwood-ib62x0.dtb -dtb-$(CONFIG_MACH_TS219_DT)	+= kirkwood-qnap-ts219.dtb +dtb-$(CONFIG_MACH_TS219_DT)	+= kirkwood-ts219-6281.dtb +dtb-$(CONFIG_MACH_TS219_DT)	+= kirkwood-ts219-6282.dtb  dtb-$(CONFIG_MACH_GOFLEXNET_DT) += kirkwood-goflexnet.dtb  dtb-$(CONFIG_MACH_LSXL_DT) += kirkwood-lschlv2.dtb  dtb-$(CONFIG_MACH_LSXL_DT) += kirkwood-lsxhl.dtb diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c index c4b64adcbfc..1201191d7f1 100644 --- a/arch/arm/mach-kirkwood/common.c +++ b/arch/arm/mach-kirkwood/common.c @@ -301,7 +301,7 @@ void __init kirkwood_ge00_init(struct mv643xx_eth_platform_data *eth_data)  {  	orion_ge00_init(eth_data,  			GE00_PHYS_BASE, IRQ_KIRKWOOD_GE00_SUM, -			IRQ_KIRKWOOD_GE00_ERR); +			IRQ_KIRKWOOD_GE00_ERR, 1600);  	/* The interface forgets the MAC address assigned by u-boot if  	the clock is turned off, so claim the clk now. */  	clk_prepare_enable(ge0); @@ -315,7 +315,7 @@ void __init kirkwood_ge01_init(struct mv643xx_eth_platform_data *eth_data)  {  	orion_ge01_init(eth_data,  			GE01_PHYS_BASE, IRQ_KIRKWOOD_GE01_SUM, -			IRQ_KIRKWOOD_GE01_ERR); +			IRQ_KIRKWOOD_GE01_ERR, 1600);  	clk_prepare_enable(ge1);  } @@ -517,6 +517,13 @@ void __init kirkwood_wdt_init(void)  void __init kirkwood_init_early(void)  {  	orion_time_set_base(TIMER_VIRT_BASE); + +	/* +	 * Some Kirkwood devices allocate their coherent buffers from atomic +	 * context. Increase size of atomic coherent pool to make sure such +	 * the allocations won't fail. +	 */ +	init_dma_coherent_pool_size(SZ_1M);  }  int kirkwood_tclk; diff --git a/arch/arm/mach-kirkwood/db88f6281-bp-setup.c b/arch/arm/mach-kirkwood/db88f6281-bp-setup.c index d9335937959..be90b7d0e10 100644 --- a/arch/arm/mach-kirkwood/db88f6281-bp-setup.c +++ b/arch/arm/mach-kirkwood/db88f6281-bp-setup.c @@ -10,6 +10,7 @@  #include <linux/kernel.h>  #include <linux/init.h> +#include <linux/sizes.h>  #include <linux/platform_device.h>  #include <linux/mtd/partitions.h>  #include <linux/ata_platform.h> diff --git a/arch/arm/mach-mmp/sram.c b/arch/arm/mach-mmp/sram.c index 4304f951937..7e8a5a2e1ec 100644 --- a/arch/arm/mach-mmp/sram.c +++ b/arch/arm/mach-mmp/sram.c @@ -68,7 +68,7 @@ static int __devinit sram_probe(struct platform_device *pdev)  	struct resource *res;  	int ret = 0; -	if (!pdata && !pdata->pool_name) +	if (!pdata || !pdata->pool_name)  		return -ENODEV;  	info = kzalloc(sizeof(*info), GFP_KERNEL); diff --git a/arch/arm/mach-mv78xx0/addr-map.c b/arch/arm/mach-mv78xx0/addr-map.c index 62b53d710ef..a9bc84180d2 100644 --- a/arch/arm/mach-mv78xx0/addr-map.c +++ b/arch/arm/mach-mv78xx0/addr-map.c @@ -37,7 +37,7 @@  #define WIN0_OFF(n)		(BRIDGE_VIRT_BASE + 0x0000 + ((n) << 4))  #define WIN8_OFF(n)		(BRIDGE_VIRT_BASE + 0x0900 + (((n) - 8) << 4)) -static void __init __iomem *win_cfg_base(int win) +static void __init __iomem *win_cfg_base(const struct orion_addr_map_cfg *cfg, int win)  {  	/*  	 * Find the control register base address for this window. diff --git a/arch/arm/mach-mv78xx0/common.c b/arch/arm/mach-mv78xx0/common.c index b4c53b846c9..3057f7d4329 100644 --- a/arch/arm/mach-mv78xx0/common.c +++ b/arch/arm/mach-mv78xx0/common.c @@ -213,7 +213,8 @@ void __init mv78xx0_ge00_init(struct mv643xx_eth_platform_data *eth_data)  {  	orion_ge00_init(eth_data,  			GE00_PHYS_BASE, IRQ_MV78XX0_GE00_SUM, -			IRQ_MV78XX0_GE_ERR); +			IRQ_MV78XX0_GE_ERR, +			MV643XX_TX_CSUM_DEFAULT_LIMIT);  } @@ -224,7 +225,8 @@ void __init mv78xx0_ge01_init(struct mv643xx_eth_platform_data *eth_data)  {  	orion_ge01_init(eth_data,  			GE01_PHYS_BASE, IRQ_MV78XX0_GE01_SUM, -			NO_IRQ); +			NO_IRQ, +			MV643XX_TX_CSUM_DEFAULT_LIMIT);  } diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig index dd2db025f77..346fd26f3aa 100644 --- a/arch/arm/mach-omap2/Kconfig +++ b/arch/arm/mach-omap2/Kconfig @@ -62,13 +62,14 @@ config ARCH_OMAP4  	select PM_OPP if PM  	select USB_ARCH_HAS_EHCI if USB_SUPPORT  	select ARM_CPU_SUSPEND if PM -	select ARCH_NEEDS_CPU_IDLE_COUPLED +	select ARCH_NEEDS_CPU_IDLE_COUPLED if SMP  config SOC_OMAP5  	bool "TI OMAP5"  	select CPU_V7  	select ARM_GIC  	select HAVE_SMP +	select ARM_CPU_SUSPEND if PM  comment "OMAP Core Type"  	depends on ARCH_OMAP2 @@ -231,10 +232,11 @@ config MACH_OMAP3_PANDORA  	select OMAP_PACKAGE_CBB  	select REGULATOR_FIXED_VOLTAGE if REGULATOR -config MACH_OMAP3_TOUCHBOOK +config MACH_TOUCHBOOK  	bool "OMAP3 Touch Book"  	depends on ARCH_OMAP3  	default y +	select OMAP_PACKAGE_CBB  config MACH_OMAP_3430SDP  	bool "OMAP 3430 SDP board" diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index f6a24b3f9c4..34c2c7f59f0 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile @@ -255,7 +255,7 @@ obj-$(CONFIG_MACH_OMAP_3630SDP)		+= board-zoom-display.o  obj-$(CONFIG_MACH_CM_T35)		+= board-cm-t35.o  obj-$(CONFIG_MACH_CM_T3517)		+= board-cm-t3517.o  obj-$(CONFIG_MACH_IGEP0020)		+= board-igep0020.o -obj-$(CONFIG_MACH_OMAP3_TOUCHBOOK)	+= board-omap3touchbook.o +obj-$(CONFIG_MACH_TOUCHBOOK)		+= board-omap3touchbook.o  obj-$(CONFIG_MACH_OMAP_4430SDP)		+= board-4430sdp.o  obj-$(CONFIG_MACH_OMAP4_PANDA)		+= board-omap4panda.o diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c index 74915295482..28214483aab 100644 --- a/arch/arm/mach-omap2/board-igep0020.c +++ b/arch/arm/mach-omap2/board-igep0020.c @@ -554,6 +554,8 @@ static const struct usbhs_omap_board_data igep3_usbhs_bdata __initconst = {  #ifdef CONFIG_OMAP_MUX  static struct omap_board_mux board_mux[] __initdata = { +	/* SMSC9221 LAN Controller ETH IRQ (GPIO_176) */ +	OMAP3_MUX(MCSPI1_CS2, OMAP_MUX_MODE4 | OMAP_PIN_INPUT),  	{ .reg_offset = OMAP_MUX_TERMINATOR },  };  #endif diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c index 9894e3df49c..3d2a988e3d9 100644 --- a/arch/arm/mach-omap2/board-omap3evm.c +++ b/arch/arm/mach-omap2/board-omap3evm.c @@ -59,6 +59,7 @@  #include "hsmmc.h"  #include "common-board-devices.h" +#define OMAP3_EVM_TS_GPIO	175  #define OMAP3_EVM_EHCI_VBUS	22  #define OMAP3_EVM_EHCI_SELECT	61 diff --git a/arch/arm/mach-omap2/clock33xx_data.c b/arch/arm/mach-omap2/clock33xx_data.c index 25bbcc7ca4d..ae27de8899a 100644 --- a/arch/arm/mach-omap2/clock33xx_data.c +++ b/arch/arm/mach-omap2/clock33xx_data.c @@ -1036,13 +1036,13 @@ static struct omap_clk am33xx_clks[] = {  	CLK(NULL,	"mmu_fck",		&mmu_fck,	CK_AM33XX),  	CLK(NULL,	"smartreflex0_fck",	&smartreflex0_fck,	CK_AM33XX),  	CLK(NULL,	"smartreflex1_fck",	&smartreflex1_fck,	CK_AM33XX), -	CLK(NULL,	"gpt1_fck",		&timer1_fck,	CK_AM33XX), -	CLK(NULL,	"gpt2_fck",		&timer2_fck,	CK_AM33XX), -	CLK(NULL,	"gpt3_fck",		&timer3_fck,	CK_AM33XX), -	CLK(NULL,	"gpt4_fck",		&timer4_fck,	CK_AM33XX), -	CLK(NULL,	"gpt5_fck",		&timer5_fck,	CK_AM33XX), -	CLK(NULL,	"gpt6_fck",		&timer6_fck,	CK_AM33XX), -	CLK(NULL,	"gpt7_fck",		&timer7_fck,	CK_AM33XX), +	CLK(NULL,	"timer1_fck",		&timer1_fck,	CK_AM33XX), +	CLK(NULL,	"timer2_fck",		&timer2_fck,	CK_AM33XX), +	CLK(NULL,	"timer3_fck",		&timer3_fck,	CK_AM33XX), +	CLK(NULL,	"timer4_fck",		&timer4_fck,	CK_AM33XX), +	CLK(NULL,	"timer5_fck",		&timer5_fck,	CK_AM33XX), +	CLK(NULL,	"timer6_fck",		&timer6_fck,	CK_AM33XX), +	CLK(NULL,	"timer7_fck",		&timer7_fck,	CK_AM33XX),  	CLK(NULL,	"usbotg_fck",		&usbotg_fck,	CK_AM33XX),  	CLK(NULL,	"ieee5000_fck",		&ieee5000_fck,	CK_AM33XX),  	CLK(NULL,	"wdt1_fck",		&wdt1_fck,	CK_AM33XX), diff --git a/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c b/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c index a0d68dbecfa..f99e65cfb86 100644 --- a/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c +++ b/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c @@ -241,6 +241,52 @@ static void omap3_clkdm_deny_idle(struct clockdomain *clkdm)  		_clkdm_del_autodeps(clkdm);  } +static int omap3xxx_clkdm_clk_enable(struct clockdomain *clkdm) +{ +	bool hwsup = false; + +	if (!clkdm->clktrctrl_mask) +		return 0; + +	hwsup = omap2_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs, +				clkdm->clktrctrl_mask); + +	if (hwsup) { +		/* Disable HW transitions when we are changing deps */ +		_disable_hwsup(clkdm); +		_clkdm_add_autodeps(clkdm); +		_enable_hwsup(clkdm); +	} else { +		if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP) +			omap3_clkdm_wakeup(clkdm); +	} + +	return 0; +} + +static int omap3xxx_clkdm_clk_disable(struct clockdomain *clkdm) +{ +	bool hwsup = false; + +	if (!clkdm->clktrctrl_mask) +		return 0; + +	hwsup = omap2_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs, +				clkdm->clktrctrl_mask); + +	if (hwsup) { +		/* Disable HW transitions when we are changing deps */ +		_disable_hwsup(clkdm); +		_clkdm_del_autodeps(clkdm); +		_enable_hwsup(clkdm); +	} else { +		if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP) +			omap3_clkdm_sleep(clkdm); +	} + +	return 0; +} +  struct clkdm_ops omap2_clkdm_operations = {  	.clkdm_add_wkdep	= omap2_clkdm_add_wkdep,  	.clkdm_del_wkdep	= omap2_clkdm_del_wkdep, @@ -267,6 +313,6 @@ struct clkdm_ops omap3_clkdm_operations = {  	.clkdm_wakeup		= omap3_clkdm_wakeup,  	.clkdm_allow_idle	= omap3_clkdm_allow_idle,  	.clkdm_deny_idle	= omap3_clkdm_deny_idle, -	.clkdm_clk_enable	= omap2_clkdm_clk_enable, -	.clkdm_clk_disable	= omap2_clkdm_clk_disable, +	.clkdm_clk_enable	= omap3xxx_clkdm_clk_enable, +	.clkdm_clk_disable	= omap3xxx_clkdm_clk_disable,  }; diff --git a/arch/arm/mach-omap2/cm-regbits-34xx.h b/arch/arm/mach-omap2/cm-regbits-34xx.h index 766338fe4d3..975f6bda0e0 100644 --- a/arch/arm/mach-omap2/cm-regbits-34xx.h +++ b/arch/arm/mach-omap2/cm-regbits-34xx.h @@ -67,6 +67,7 @@  #define OMAP3430_EN_IVA2_DPLL_MASK			(0x7 << 0)  /* CM_IDLEST_IVA2 */ +#define OMAP3430_ST_IVA2_SHIFT				0  #define OMAP3430_ST_IVA2_MASK				(1 << 0)  /* CM_IDLEST_PLL_IVA2 */ diff --git a/arch/arm/mach-omap2/common-board-devices.c b/arch/arm/mach-omap2/common-board-devices.c index 14734746457..c1875862679 100644 --- a/arch/arm/mach-omap2/common-board-devices.c +++ b/arch/arm/mach-omap2/common-board-devices.c @@ -35,16 +35,6 @@ static struct omap2_mcspi_device_config ads7846_mcspi_config = {  	.turbo_mode	= 0,  }; -/* - * ADS7846 driver maybe request a gpio according to the value - * of pdata->get_pendown_state, but we have done this. So set - * get_pendown_state to avoid twice gpio requesting. - */ -static int omap3_get_pendown_state(void) -{ -	return !gpio_get_value(OMAP3_EVM_TS_GPIO); -} -  static struct ads7846_platform_data ads7846_config = {  	.x_max			= 0x0fff,  	.y_max			= 0x0fff, @@ -55,7 +45,6 @@ static struct ads7846_platform_data ads7846_config = {  	.debounce_rep		= 1,  	.gpio_pendown		= -EINVAL,  	.keep_vref_on		= 1, -	.get_pendown_state	= &omap3_get_pendown_state,  };  static struct spi_board_info ads7846_spi_board_info __initdata = { diff --git a/arch/arm/mach-omap2/common-board-devices.h b/arch/arm/mach-omap2/common-board-devices.h index 4c4ef6a6166..a0b4a42836a 100644 --- a/arch/arm/mach-omap2/common-board-devices.h +++ b/arch/arm/mach-omap2/common-board-devices.h @@ -4,7 +4,6 @@  #include "twl-common.h"  #define NAND_BLOCK_SIZE	SZ_128K -#define OMAP3_EVM_TS_GPIO	175  struct mtd_partition;  struct ads7846_platform_data; diff --git a/arch/arm/mach-omap2/cpuidle44xx.c b/arch/arm/mach-omap2/cpuidle44xx.c index ee05e193fc6..288bee6cbb7 100644 --- a/arch/arm/mach-omap2/cpuidle44xx.c +++ b/arch/arm/mach-omap2/cpuidle44xx.c @@ -238,8 +238,9 @@ int __init omap4_idle_init(void)  	for_each_cpu(cpu_id, cpu_online_mask) {  		dev = &per_cpu(omap4_idle_dev, cpu_id);  		dev->cpu = cpu_id; +#ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED  		dev->coupled_cpus = *cpu_online_mask; - +#endif  		cpuidle_register_driver(&omap4_idle_driver);  		if (cpuidle_register_device(dev)) { diff --git a/arch/arm/mach-omap2/mux.h b/arch/arm/mach-omap2/mux.h index 471e62a74a1..76f9b3c2f58 100644 --- a/arch/arm/mach-omap2/mux.h +++ b/arch/arm/mach-omap2/mux.h @@ -127,7 +127,6 @@ struct omap_mux_partition {   * @gpio:	GPIO number   * @muxnames:	available signal modes for a ball   * @balls:	available balls on the package - * @partition:	mux partition   */  struct omap_mux {  	u16	reg_offset; diff --git a/arch/arm/mach-omap2/omap-wakeupgen.c b/arch/arm/mach-omap2/omap-wakeupgen.c index 05fdebfaa19..330d4c6e746 100644 --- a/arch/arm/mach-omap2/omap-wakeupgen.c +++ b/arch/arm/mach-omap2/omap-wakeupgen.c @@ -46,7 +46,7 @@  static void __iomem *wakeupgen_base;  static void __iomem *sar_base;  static DEFINE_SPINLOCK(wakeupgen_lock); -static unsigned int irq_target_cpu[NR_IRQS]; +static unsigned int irq_target_cpu[MAX_IRQS];  static unsigned int irq_banks = MAX_NR_REG_BANKS;  static unsigned int max_irqs = MAX_IRQS;  static unsigned int omap_secure_apis; diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 6ca8e519968..37afbd173c2 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -1889,6 +1889,7 @@ static int _enable(struct omap_hwmod *oh)  			_enable_sysc(oh);  		}  	} else { +		_omap4_disable_module(oh);  		_disable_clocks(oh);  		pr_debug("omap_hwmod: %s: _wait_target_ready: %d\n",  			 oh->name, r); diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c index c9e38200216..ce7e6068768 100644 --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c @@ -100,9 +100,9 @@ static struct omap_hwmod omap3xxx_mpu_hwmod = {  /* IVA2 (IVA2) */  static struct omap_hwmod_rst_info omap3xxx_iva_resets[] = { -	{ .name = "logic", .rst_shift = 0 }, -	{ .name = "seq0", .rst_shift = 1 }, -	{ .name = "seq1", .rst_shift = 2 }, +	{ .name = "logic", .rst_shift = 0, .st_shift = 8 }, +	{ .name = "seq0", .rst_shift = 1, .st_shift = 9 }, +	{ .name = "seq1", .rst_shift = 2, .st_shift = 10 },  };  static struct omap_hwmod omap3xxx_iva_hwmod = { @@ -112,6 +112,15 @@ static struct omap_hwmod omap3xxx_iva_hwmod = {  	.rst_lines	= omap3xxx_iva_resets,  	.rst_lines_cnt	= ARRAY_SIZE(omap3xxx_iva_resets),  	.main_clk	= "iva2_ck", +	.prcm = { +		.omap2 = { +			.module_offs = OMAP3430_IVA2_MOD, +			.prcm_reg_id = 1, +			.module_bit = OMAP3430_CM_FCLKEN_IVA2_EN_IVA2_SHIFT, +			.idlest_reg_id = 1, +			.idlest_idle_bit = OMAP3430_ST_IVA2_SHIFT, +		} +	},  };  /* timer class */ diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c index 3c19120e0cd..64b564f13d5 100644 --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c @@ -4210,7 +4210,7 @@ static struct omap_hwmod_ocp_if omap44xx_dsp__iva = {  };  /* dsp -> sl2if */ -static struct omap_hwmod_ocp_if omap44xx_dsp__sl2if = { +static struct omap_hwmod_ocp_if __maybe_unused omap44xx_dsp__sl2if = {  	.master		= &omap44xx_dsp_hwmod,  	.slave		= &omap44xx_sl2if_hwmod,  	.clk		= "dpll_iva_m5x2_ck", @@ -4828,7 +4828,7 @@ static struct omap_hwmod_ocp_if omap44xx_l3_main_2__iss = {  };  /* iva -> sl2if */ -static struct omap_hwmod_ocp_if omap44xx_iva__sl2if = { +static struct omap_hwmod_ocp_if __maybe_unused omap44xx_iva__sl2if = {  	.master		= &omap44xx_iva_hwmod,  	.slave		= &omap44xx_sl2if_hwmod,  	.clk		= "dpll_iva_m5x2_ck", @@ -5362,7 +5362,7 @@ static struct omap_hwmod_ocp_if omap44xx_l4_wkup__scrm = {  };  /* l3_main_2 -> sl2if */ -static struct omap_hwmod_ocp_if omap44xx_l3_main_2__sl2if = { +static struct omap_hwmod_ocp_if __maybe_unused omap44xx_l3_main_2__sl2if = {  	.master		= &omap44xx_l3_main_2_hwmod,  	.slave		= &omap44xx_sl2if_hwmod,  	.clk		= "l3_div_ck", @@ -6038,7 +6038,7 @@ static struct omap_hwmod_ocp_if *omap44xx_hwmod_ocp_ifs[] __initdata = {  	&omap44xx_l4_abe__dmic,  	&omap44xx_l4_abe__dmic_dma,  	&omap44xx_dsp__iva, -	&omap44xx_dsp__sl2if, +	/* &omap44xx_dsp__sl2if, */  	&omap44xx_l4_cfg__dsp,  	&omap44xx_l3_main_2__dss,  	&omap44xx_l4_per__dss, @@ -6074,7 +6074,7 @@ static struct omap_hwmod_ocp_if *omap44xx_hwmod_ocp_ifs[] __initdata = {  	&omap44xx_l4_per__i2c4,  	&omap44xx_l3_main_2__ipu,  	&omap44xx_l3_main_2__iss, -	&omap44xx_iva__sl2if, +	/* &omap44xx_iva__sl2if, */  	&omap44xx_l3_main_2__iva,  	&omap44xx_l4_wkup__kbd,  	&omap44xx_l4_cfg__mailbox, @@ -6105,7 +6105,7 @@ static struct omap_hwmod_ocp_if *omap44xx_hwmod_ocp_ifs[] __initdata = {  	&omap44xx_l4_cfg__cm_core,  	&omap44xx_l4_wkup__prm,  	&omap44xx_l4_wkup__scrm, -	&omap44xx_l3_main_2__sl2if, +	/* &omap44xx_l3_main_2__sl2if, */  	&omap44xx_l4_abe__slimbus1,  	&omap44xx_l4_abe__slimbus1_dma,  	&omap44xx_l4_per__slimbus2, diff --git a/arch/arm/mach-omap2/opp4xxx_data.c b/arch/arm/mach-omap2/opp4xxx_data.c index 2293ba27101..c95415da23c 100644 --- a/arch/arm/mach-omap2/opp4xxx_data.c +++ b/arch/arm/mach-omap2/opp4xxx_data.c @@ -94,7 +94,7 @@ int __init omap4_opp_init(void)  {  	int r = -ENODEV; -	if (!cpu_is_omap44xx()) +	if (!cpu_is_omap443x())  		return r;  	r = omap_init_opp_table(omap44xx_opp_def_list, diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c index e4fc88c65db..05bd8f02723 100644 --- a/arch/arm/mach-omap2/pm34xx.c +++ b/arch/arm/mach-omap2/pm34xx.c @@ -272,21 +272,16 @@ void omap_sram_idle(void)  	per_next_state = pwrdm_read_next_pwrst(per_pwrdm);  	core_next_state = pwrdm_read_next_pwrst(core_pwrdm); -	if (mpu_next_state < PWRDM_POWER_ON) { -		pwrdm_pre_transition(mpu_pwrdm); -		pwrdm_pre_transition(neon_pwrdm); -	} +	pwrdm_pre_transition(NULL);  	/* PER */  	if (per_next_state < PWRDM_POWER_ON) { -		pwrdm_pre_transition(per_pwrdm);  		per_going_off = (per_next_state == PWRDM_POWER_OFF) ? 1 : 0;  		omap2_gpio_prepare_for_idle(per_going_off);  	}  	/* CORE */  	if (core_next_state < PWRDM_POWER_ON) { -		pwrdm_pre_transition(core_pwrdm);  		if (core_next_state == PWRDM_POWER_OFF) {  			omap3_core_save_context();  			omap3_cm_save_context(); @@ -339,20 +334,14 @@ void omap_sram_idle(void)  			omap2_prm_clear_mod_reg_bits(OMAP3430_AUTO_OFF_MASK,  					       OMAP3430_GR_MOD,  					       OMAP3_PRM_VOLTCTRL_OFFSET); -		pwrdm_post_transition(core_pwrdm);  	}  	omap3_intc_resume_idle(); +	pwrdm_post_transition(NULL); +  	/* PER */ -	if (per_next_state < PWRDM_POWER_ON) { +	if (per_next_state < PWRDM_POWER_ON)  		omap2_gpio_resume_after_idle(); -		pwrdm_post_transition(per_pwrdm); -	} - -	if (mpu_next_state < PWRDM_POWER_ON) { -		pwrdm_post_transition(mpu_pwrdm); -		pwrdm_post_transition(neon_pwrdm); -	}  }  static void omap3_pm_idle(void) diff --git a/arch/arm/mach-omap2/sleep44xx.S b/arch/arm/mach-omap2/sleep44xx.S index 9f6b83d1b19..91e71d8f46f 100644 --- a/arch/arm/mach-omap2/sleep44xx.S +++ b/arch/arm/mach-omap2/sleep44xx.S @@ -56,9 +56,13 @@ ppa_por_params:   * The restore function pointer is stored at CPUx_WAKEUP_NS_PA_ADDR_OFFSET.   * It returns to the caller for CPU INACTIVE and ON power states or in case   * CPU failed to transition to targeted OFF/DORMANT state. + * + * omap4_finish_suspend() calls v7_flush_dcache_all() which doesn't save + * stack frame and it expects the caller to take care of it. Hence the entire + * stack frame is saved to avoid possible stack corruption.   */  ENTRY(omap4_finish_suspend) -	stmfd	sp!, {lr} +	stmfd	sp!, {r4-r12, lr}  	cmp	r0, #0x0  	beq	do_WFI				@ No lowpower state, jump to WFI @@ -226,7 +230,7 @@ scu_gp_clear:  skip_scu_gp_clear:  	isb  	dsb -	ldmfd	sp!, {pc} +	ldmfd	sp!, {r4-r12, pc}  ENDPROC(omap4_finish_suspend)  /* diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c index 2ff6d41ec6c..2ba4f57dda8 100644 --- a/arch/arm/mach-omap2/timer.c +++ b/arch/arm/mach-omap2/timer.c @@ -260,6 +260,7 @@ static u32 notrace dmtimer_read_sched_clock(void)  	return 0;  } +#ifdef CONFIG_OMAP_32K_TIMER  /* Setup free-running counter for clocksource */  static int __init omap2_sync32k_clocksource_init(void)  { @@ -299,6 +300,12 @@ static int __init omap2_sync32k_clocksource_init(void)  	return ret;  } +#else +static inline int omap2_sync32k_clocksource_init(void) +{ +	return -ENODEV; +} +#endif  static void __init omap2_gptimer_clocksource_init(int gptimer_id,  						const char *fck_source) diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c index e2cdf67f4b8..329b726012f 100644 --- a/arch/arm/mach-omap2/twl-common.c +++ b/arch/arm/mach-omap2/twl-common.c @@ -67,6 +67,7 @@ void __init omap_pmic_init(int bus, u32 clkrate,  			   const char *pmic_type, int pmic_irq,  			   struct twl4030_platform_data *pmic_data)  { +	omap_mux_init_signal("sys_nirq", OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE);  	strncpy(pmic_i2c_board_info.type, pmic_type,  		sizeof(pmic_i2c_board_info.type));  	pmic_i2c_board_info.irq = pmic_irq; diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c index 9148b229d0d..410291c6766 100644 --- a/arch/arm/mach-orion5x/common.c +++ b/arch/arm/mach-orion5x/common.c @@ -109,7 +109,8 @@ void __init orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data)  {  	orion_ge00_init(eth_data,  			ORION5X_ETH_PHYS_BASE, IRQ_ORION5X_ETH_SUM, -			IRQ_ORION5X_ETH_ERR); +			IRQ_ORION5X_ETH_ERR, +			MV643XX_TX_CSUM_DEFAULT_LIMIT);  } diff --git a/arch/arm/mach-s3c24xx/include/mach/dma.h b/arch/arm/mach-s3c24xx/include/mach/dma.h index 454831b6603..ee99fd56c04 100644 --- a/arch/arm/mach-s3c24xx/include/mach/dma.h +++ b/arch/arm/mach-s3c24xx/include/mach/dma.h @@ -24,7 +24,8 @@  */  enum dma_ch { -	DMACH_XD0, +	DMACH_DT_PROP = -1,	/* not yet supported, do not use */ +	DMACH_XD0 = 0,  	DMACH_XD1,  	DMACH_SDI,  	DMACH_SPI0, diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c index cf10f92856d..453a6e50db8 100644 --- a/arch/arm/mach-shmobile/board-armadillo800eva.c +++ b/arch/arm/mach-shmobile/board-armadillo800eva.c @@ -520,13 +520,14 @@ static struct platform_device hdmi_lcdc_device = {  };  /* GPIO KEY */ -#define GPIO_KEY(c, g, d) { .code = c, .gpio = g, .desc = d, .active_low = 1 } +#define GPIO_KEY(c, g, d, ...) \ +	{ .code = c, .gpio = g, .desc = d, .active_low = 1, __VA_ARGS__ }  static struct gpio_keys_button gpio_buttons[] = { -	GPIO_KEY(KEY_POWER,	GPIO_PORT99,	"SW1"), -	GPIO_KEY(KEY_BACK,	GPIO_PORT100,	"SW2"), -	GPIO_KEY(KEY_MENU,	GPIO_PORT97,	"SW3"), -	GPIO_KEY(KEY_HOME,	GPIO_PORT98,	"SW4"), +	GPIO_KEY(KEY_POWER,	GPIO_PORT99,	"SW3", .wakeup = 1), +	GPIO_KEY(KEY_BACK,	GPIO_PORT100,	"SW4"), +	GPIO_KEY(KEY_MENU,	GPIO_PORT97,	"SW5"), +	GPIO_KEY(KEY_HOME,	GPIO_PORT98,	"SW6"),  };  static struct gpio_keys_platform_data gpio_key_info = { @@ -901,8 +902,8 @@ static struct platform_device *eva_devices[] __initdata = {  	&camera_device,  	&ceu0_device,  	&fsi_device, -	&fsi_hdmi_device,  	&fsi_wm8978_device, +	&fsi_hdmi_device,  };  static void __init eva_clock_init(void) diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c index 7ea2b31e319..c129542f6ae 100644 --- a/arch/arm/mach-shmobile/board-mackerel.c +++ b/arch/arm/mach-shmobile/board-mackerel.c @@ -695,6 +695,7 @@ static struct platform_device usbhs0_device = {   *  - J30 "open"   *  - modify usbhs1_get_id() USBHS_HOST -> USBHS_GADGET   *  - add .get_vbus = usbhs_get_vbus in usbhs1_private + *  - check usbhs0_device(pio)/usbhs1_device(irq) order in mackerel_devices.   */  #define IRQ8 evt2irq(0x0300)  #define USB_PHY_MODE		(1 << 4) @@ -1325,8 +1326,8 @@ static struct platform_device *mackerel_devices[] __initdata = {  	&nor_flash_device,  	&smc911x_device,  	&lcdc_device, -	&usbhs1_device,  	&usbhs0_device, +	&usbhs1_device,  	&leds_device,  	&fsi_device,  	&fsi_ak4643_device, diff --git a/arch/arm/mach-shmobile/board-marzen.c b/arch/arm/mach-shmobile/board-marzen.c index 3a528cf4366..fcf5a47f477 100644 --- a/arch/arm/mach-shmobile/board-marzen.c +++ b/arch/arm/mach-shmobile/board-marzen.c @@ -67,7 +67,7 @@ static struct smsc911x_platform_config smsc911x_platdata = {  static struct platform_device eth_device = {  	.name		= "smsc911x", -	.id		= 0, +	.id		= -1,  	.dev  = {  		.platform_data = &smsc911x_platdata,  	}, diff --git a/arch/arm/mach-shmobile/intc-sh73a0.c b/arch/arm/mach-shmobile/intc-sh73a0.c index ee447404c85..588555a67d9 100644 --- a/arch/arm/mach-shmobile/intc-sh73a0.c +++ b/arch/arm/mach-shmobile/intc-sh73a0.c @@ -259,9 +259,9 @@ static int sh73a0_set_wake(struct irq_data *data, unsigned int on)  	return 0; /* always allow wakeup */  } -#define RELOC_BASE 0x1000 +#define RELOC_BASE 0x1200 -/* INTCA IRQ pins at INTCS + 0x1000 to make space for GIC+INTC handling */ +/* INTCA IRQ pins at INTCS + RELOC_BASE to make space for GIC+INTC handling */  #define INTCS_VECT_RELOC(n, vect) INTCS_VECT((n), (vect) + RELOC_BASE)  INTC_IRQ_PINS_32(intca_irq_pins, 0xe6900000, diff --git a/arch/arm/mach-ux500/Kconfig b/arch/arm/mach-ux500/Kconfig index c013bbf79ca..53d3d46dec1 100644 --- a/arch/arm/mach-ux500/Kconfig +++ b/arch/arm/mach-ux500/Kconfig @@ -41,7 +41,6 @@ config MACH_HREFV60  config MACH_SNOWBALL  	bool "U8500 Snowball platform"  	select MACH_MOP500 -	select LEDS_GPIO  	help  	  Include support for the snowball development platform. diff --git a/arch/arm/mach-ux500/board-mop500-msp.c b/arch/arm/mach-ux500/board-mop500-msp.c index 99604803874..df15646036a 100644 --- a/arch/arm/mach-ux500/board-mop500-msp.c +++ b/arch/arm/mach-ux500/board-mop500-msp.c @@ -191,9 +191,9 @@ static struct platform_device *db8500_add_msp_i2s(struct device *parent,  	return pdev;  } -/* Platform device for ASoC U8500 machine */ -static struct platform_device snd_soc_u8500 = { -		.name = "snd-soc-u8500", +/* Platform device for ASoC MOP500 machine */ +static struct platform_device snd_soc_mop500 = { +		.name = "snd-soc-mop500",  		.id = 0,  		.dev = {  			.platform_data = NULL, @@ -227,8 +227,8 @@ int mop500_msp_init(struct device *parent)  {  	struct platform_device *msp1; -	pr_info("%s: Register platform-device 'snd-soc-u8500'.\n", __func__); -	platform_device_register(&snd_soc_u8500); +	pr_info("%s: Register platform-device 'snd-soc-mop500'.\n", __func__); +	platform_device_register(&snd_soc_mop500);  	pr_info("Initialize MSP I2S-devices.\n");  	db8500_add_msp_i2s(parent, 0, U8500_MSP0_BASE, IRQ_DB8500_MSP0, diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c index 8674a890fd1..a534d8880de 100644 --- a/arch/arm/mach-ux500/board-mop500.c +++ b/arch/arm/mach-ux500/board-mop500.c @@ -797,6 +797,7 @@ static void __init u8500_init_machine(void)  				ARRAY_SIZE(mop500_platform_devs));  		mop500_sdi_init(parent); +		mop500_msp_init(parent);  		i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);  		i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);  		i2c_register_board_info(2, mop500_i2c2_devices, @@ -804,6 +805,8 @@ static void __init u8500_init_machine(void)  		mop500_uib_init(); +	} else if (of_machine_is_compatible("calaosystems,snowball-a9500")) { +		mop500_msp_init(parent);  	} else if (of_machine_is_compatible("st-ericsson,hrefv60+")) {  		/*  		 * The HREFv60 board removed a GPIO expander and routed @@ -815,6 +818,7 @@ static void __init u8500_init_machine(void)  				ARRAY_SIZE(mop500_platform_devs));  		hrefv60_sdi_init(parent); +		mop500_msp_init(parent);  		i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);  		i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES; diff --git a/arch/arm/mm/context.c b/arch/arm/mm/context.c index 119bc52ab93..4e07eec1270 100644 --- a/arch/arm/mm/context.c +++ b/arch/arm/mm/context.c @@ -63,10 +63,11 @@ static int contextidr_notifier(struct notifier_block *unused, unsigned long cmd,  	pid = task_pid_nr(thread->task) << ASID_BITS;  	asm volatile(  	"	mrc	p15, 0, %0, c13, c0, 1\n" -	"	bfi	%1, %0, #0, %2\n" -	"	mcr	p15, 0, %1, c13, c0, 1\n" +	"	and	%0, %0, %2\n" +	"	orr	%0, %0, %1\n" +	"	mcr	p15, 0, %0, c13, c0, 1\n"  	: "=r" (contextidr), "+r" (pid) -	: "I" (ASID_BITS)); +	: "I" (~ASID_MASK));  	isb();  	return NOTIFY_OK; diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index 4e7d1182e8a..e59c4ab71bc 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -267,17 +267,19 @@ static void __dma_free_remap(void *cpu_addr, size_t size)  	vunmap(cpu_addr);  } +#define DEFAULT_DMA_COHERENT_POOL_SIZE	SZ_256K +  struct dma_pool {  	size_t size;  	spinlock_t lock;  	unsigned long *bitmap;  	unsigned long nr_pages;  	void *vaddr; -	struct page *page; +	struct page **pages;  };  static struct dma_pool atomic_pool = { -	.size = SZ_256K, +	.size = DEFAULT_DMA_COHERENT_POOL_SIZE,  };  static int __init early_coherent_pool(char *p) @@ -287,6 +289,21 @@ static int __init early_coherent_pool(char *p)  }  early_param("coherent_pool", early_coherent_pool); +void __init init_dma_coherent_pool_size(unsigned long size) +{ +	/* +	 * Catch any attempt to set the pool size too late. +	 */ +	BUG_ON(atomic_pool.vaddr); + +	/* +	 * Set architecture specific coherent pool size only if +	 * it has not been changed by kernel command line parameter. +	 */ +	if (atomic_pool.size == DEFAULT_DMA_COHERENT_POOL_SIZE) +		atomic_pool.size = size; +} +  /*   * Initialise the coherent pool for atomic allocations.   */ @@ -297,6 +314,7 @@ static int __init atomic_pool_init(void)  	unsigned long nr_pages = pool->size >> PAGE_SHIFT;  	unsigned long *bitmap;  	struct page *page; +	struct page **pages;  	void *ptr;  	int bitmap_size = BITS_TO_LONGS(nr_pages) * sizeof(long); @@ -304,21 +322,31 @@ static int __init atomic_pool_init(void)  	if (!bitmap)  		goto no_bitmap; +	pages = kzalloc(nr_pages * sizeof(struct page *), GFP_KERNEL); +	if (!pages) +		goto no_pages; +  	if (IS_ENABLED(CONFIG_CMA))  		ptr = __alloc_from_contiguous(NULL, pool->size, prot, &page);  	else  		ptr = __alloc_remap_buffer(NULL, pool->size, GFP_KERNEL, prot,  					   &page, NULL);  	if (ptr) { +		int i; + +		for (i = 0; i < nr_pages; i++) +			pages[i] = page + i; +  		spin_lock_init(&pool->lock);  		pool->vaddr = ptr; -		pool->page = page; +		pool->pages = pages;  		pool->bitmap = bitmap;  		pool->nr_pages = nr_pages;  		pr_info("DMA: preallocated %u KiB pool for atomic coherent allocations\n",  		       (unsigned)pool->size / 1024);  		return 0;  	} +no_pages:  	kfree(bitmap);  no_bitmap:  	pr_err("DMA: failed to allocate %u KiB pool for atomic coherent allocation\n", @@ -443,27 +471,45 @@ static void *__alloc_from_pool(size_t size, struct page **ret_page)  	if (pageno < pool->nr_pages) {  		bitmap_set(pool->bitmap, pageno, count);  		ptr = pool->vaddr + PAGE_SIZE * pageno; -		*ret_page = pool->page + pageno; +		*ret_page = pool->pages[pageno]; +	} else { +		pr_err_once("ERROR: %u KiB atomic DMA coherent pool is too small!\n" +			    "Please increase it with coherent_pool= kernel parameter!\n", +			    (unsigned)pool->size / 1024);  	}  	spin_unlock_irqrestore(&pool->lock, flags);  	return ptr;  } +static bool __in_atomic_pool(void *start, size_t size) +{ +	struct dma_pool *pool = &atomic_pool; +	void *end = start + size; +	void *pool_start = pool->vaddr; +	void *pool_end = pool->vaddr + pool->size; + +	if (start < pool_start || start >= pool_end) +		return false; + +	if (end <= pool_end) +		return true; + +	WARN(1, "Wrong coherent size(%p-%p) from atomic pool(%p-%p)\n", +	     start, end - 1, pool_start, pool_end - 1); + +	return false; +} +  static int __free_from_pool(void *start, size_t size)  {  	struct dma_pool *pool = &atomic_pool;  	unsigned long pageno, count;  	unsigned long flags; -	if (start < pool->vaddr || start > pool->vaddr + pool->size) +	if (!__in_atomic_pool(start, size))  		return 0; -	if (start + size > pool->vaddr + pool->size) { -		WARN(1, "freeing wrong coherent size from pool\n"); -		return 0; -	} -  	pageno = (start - pool->vaddr) >> PAGE_SHIFT;  	count = size >> PAGE_SHIFT; @@ -1090,10 +1136,22 @@ static int __iommu_remove_mapping(struct device *dev, dma_addr_t iova, size_t si  	return 0;  } +static struct page **__atomic_get_pages(void *addr) +{ +	struct dma_pool *pool = &atomic_pool; +	struct page **pages = pool->pages; +	int offs = (addr - pool->vaddr) >> PAGE_SHIFT; + +	return pages + offs; +} +  static struct page **__iommu_get_pages(void *cpu_addr, struct dma_attrs *attrs)  {  	struct vm_struct *area; +	if (__in_atomic_pool(cpu_addr, PAGE_SIZE)) +		return __atomic_get_pages(cpu_addr); +  	if (dma_get_attr(DMA_ATTR_NO_KERNEL_MAPPING, attrs))  		return cpu_addr; @@ -1103,6 +1161,34 @@ static struct page **__iommu_get_pages(void *cpu_addr, struct dma_attrs *attrs)  	return NULL;  } +static void *__iommu_alloc_atomic(struct device *dev, size_t size, +				  dma_addr_t *handle) +{ +	struct page *page; +	void *addr; + +	addr = __alloc_from_pool(size, &page); +	if (!addr) +		return NULL; + +	*handle = __iommu_create_mapping(dev, &page, size); +	if (*handle == DMA_ERROR_CODE) +		goto err_mapping; + +	return addr; + +err_mapping: +	__free_from_pool(addr, size); +	return NULL; +} + +static void __iommu_free_atomic(struct device *dev, struct page **pages, +				dma_addr_t handle, size_t size) +{ +	__iommu_remove_mapping(dev, handle, size); +	__free_from_pool(page_address(pages[0]), size); +} +  static void *arm_iommu_alloc_attrs(struct device *dev, size_t size,  	    dma_addr_t *handle, gfp_t gfp, struct dma_attrs *attrs)  { @@ -1113,6 +1199,9 @@ static void *arm_iommu_alloc_attrs(struct device *dev, size_t size,  	*handle = DMA_ERROR_CODE;  	size = PAGE_ALIGN(size); +	if (gfp & GFP_ATOMIC) +		return __iommu_alloc_atomic(dev, size, handle); +  	pages = __iommu_alloc_buffer(dev, size, gfp);  	if (!pages)  		return NULL; @@ -1179,6 +1268,11 @@ void arm_iommu_free_attrs(struct device *dev, size_t size, void *cpu_addr,  		return;  	} +	if (__in_atomic_pool(cpu_addr, size)) { +		__iommu_free_atomic(dev, pages, handle, size); +		return; +	} +  	if (!dma_get_attr(DMA_ATTR_NO_KERNEL_MAPPING, attrs)) {  		unmap_kernel_range((unsigned long)cpu_addr, size);  		vunmap(cpu_addr); diff --git a/arch/arm/mm/mm.h b/arch/arm/mm/mm.h index 6776160618e..a8ee92da354 100644 --- a/arch/arm/mm/mm.h +++ b/arch/arm/mm/mm.h @@ -55,6 +55,9 @@ extern void __flush_dcache_page(struct address_space *mapping, struct page *page  /* permanent static mappings from iotable_init() */  #define VM_ARM_STATIC_MAPPING	0x40000000 +/* empty mapping */ +#define VM_ARM_EMPTY_MAPPING	0x20000000 +  /* mapping type (attributes) for permanent static mappings */  #define VM_ARM_MTYPE(mt)		((mt) << 20)  #define VM_ARM_MTYPE_MASK	(0x1f << 20) diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 4c2d0451e84..c2fa21d0103 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -807,7 +807,7 @@ static void __init pmd_empty_section_gap(unsigned long addr)  	vm = early_alloc_aligned(sizeof(*vm), __alignof__(*vm));  	vm->addr = (void *)addr;  	vm->size = SECTION_SIZE; -	vm->flags = VM_IOREMAP | VM_ARM_STATIC_MAPPING; +	vm->flags = VM_IOREMAP | VM_ARM_EMPTY_MAPPING;  	vm->caller = pmd_empty_section_gap;  	vm_area_add_early(vm);  } @@ -820,7 +820,7 @@ static void __init fill_pmd_gaps(void)  	/* we're still single threaded hence no lock needed here */  	for (vm = vmlist; vm; vm = vm->next) { -		if (!(vm->flags & VM_ARM_STATIC_MAPPING)) +		if (!(vm->flags & (VM_ARM_STATIC_MAPPING | VM_ARM_EMPTY_MAPPING)))  			continue;  		addr = (unsigned long)vm->addr;  		if (addr < next) @@ -961,8 +961,8 @@ void __init sanity_check_meminfo(void)  		 * Check whether this memory bank would partially overlap  		 * the vmalloc area.  		 */ -		if (__va(bank->start + bank->size) > vmalloc_min || -		    __va(bank->start + bank->size) < __va(bank->start)) { +		if (__va(bank->start + bank->size - 1) >= vmalloc_min || +		    __va(bank->start + bank->size - 1) <= __va(bank->start)) {  			unsigned long newsize = vmalloc_min - __va(bank->start);  			printk(KERN_NOTICE "Truncating RAM at %.8llx-%.8llx "  			       "to -%.8llx (vmalloc region overlap).\n", diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c index 626ad8cad7a..938b50a3343 100644 --- a/arch/arm/plat-omap/dmtimer.c +++ b/arch/arm/plat-omap/dmtimer.c @@ -189,6 +189,7 @@ struct omap_dm_timer *omap_dm_timer_request(void)  		timer->reserved = 1;  		break;  	} +	spin_unlock_irqrestore(&dm_timer_lock, flags);  	if (timer) {  		ret = omap_dm_timer_prepare(timer); @@ -197,7 +198,6 @@ struct omap_dm_timer *omap_dm_timer_request(void)  			timer = NULL;  		}  	} -	spin_unlock_irqrestore(&dm_timer_lock, flags);  	if (!timer)  		pr_debug("%s: timer request failed!\n", __func__); @@ -220,6 +220,7 @@ struct omap_dm_timer *omap_dm_timer_request_specific(int id)  			break;  		}  	} +	spin_unlock_irqrestore(&dm_timer_lock, flags);  	if (timer) {  		ret = omap_dm_timer_prepare(timer); @@ -228,7 +229,6 @@ struct omap_dm_timer *omap_dm_timer_request_specific(int id)  			timer = NULL;  		}  	} -	spin_unlock_irqrestore(&dm_timer_lock, flags);  	if (!timer)  		pr_debug("%s: timer%d request failed!\n", __func__, id); @@ -258,7 +258,7 @@ EXPORT_SYMBOL_GPL(omap_dm_timer_enable);  void omap_dm_timer_disable(struct omap_dm_timer *timer)  { -	pm_runtime_put(&timer->pdev->dev); +	pm_runtime_put_sync(&timer->pdev->dev);  }  EXPORT_SYMBOL_GPL(omap_dm_timer_disable); diff --git a/arch/arm/plat-omap/include/plat/cpu.h b/arch/arm/plat-omap/include/plat/cpu.h index 68b180edcff..bb5d08a70db 100644 --- a/arch/arm/plat-omap/include/plat/cpu.h +++ b/arch/arm/plat-omap/include/plat/cpu.h @@ -372,7 +372,8 @@ IS_OMAP_TYPE(3430, 0x3430)  #define cpu_class_is_omap1()	(cpu_is_omap7xx() || cpu_is_omap15xx() || \  				cpu_is_omap16xx())  #define cpu_class_is_omap2()	(cpu_is_omap24xx() || cpu_is_omap34xx() || \ -				cpu_is_omap44xx() || soc_is_omap54xx()) +				cpu_is_omap44xx() || soc_is_omap54xx() || \ +				soc_is_am33xx())  /* Various silicon revisions for omap2 */  #define OMAP242X_CLASS		0x24200024 diff --git a/arch/arm/plat-omap/include/plat/multi.h b/arch/arm/plat-omap/include/plat/multi.h index 045e320f106..324d31b1485 100644 --- a/arch/arm/plat-omap/include/plat/multi.h +++ b/arch/arm/plat-omap/include/plat/multi.h @@ -108,4 +108,13 @@  # endif  #endif +#ifdef CONFIG_SOC_AM33XX +# ifdef OMAP_NAME +#  undef  MULTI_OMAP2 +#  define MULTI_OMAP2 +# else +#  define OMAP_NAME am33xx +# endif +#endif +  #endif	/* __PLAT_OMAP_MULTI_H */ diff --git a/arch/arm/plat-omap/include/plat/uncompress.h b/arch/arm/plat-omap/include/plat/uncompress.h index b8d19a13678..7f7b112accc 100644 --- a/arch/arm/plat-omap/include/plat/uncompress.h +++ b/arch/arm/plat-omap/include/plat/uncompress.h @@ -110,7 +110,7 @@ static inline void flush(void)  	_DEBUG_LL_ENTRY(mach, AM33XX_UART##p##_BASE, OMAP_PORT_SHIFT,	\  		AM33XXUART##p) -static inline void __arch_decomp_setup(unsigned long arch_id) +static inline void arch_decomp_setup(void)  {  	int port = 0; @@ -198,8 +198,6 @@ static inline void __arch_decomp_setup(unsigned long arch_id)  	} while (0);  } -#define arch_decomp_setup()	__arch_decomp_setup(arch_id) -  /*   * nothing to do   */ diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c index 766181cb5c9..024f3b08db2 100644 --- a/arch/arm/plat-omap/sram.c +++ b/arch/arm/plat-omap/sram.c @@ -68,6 +68,7 @@  static unsigned long omap_sram_start;  static void __iomem *omap_sram_base; +static unsigned long omap_sram_skip;  static unsigned long omap_sram_size;  static void __iomem *omap_sram_ceil; @@ -106,6 +107,7 @@ static int is_sram_locked(void)   */  static void __init omap_detect_sram(void)  { +	omap_sram_skip = SRAM_BOOTLOADER_SZ;  	if (cpu_class_is_omap2()) {  		if (is_sram_locked()) {  			if (cpu_is_omap34xx()) { @@ -113,6 +115,7 @@ static void __init omap_detect_sram(void)  				if ((omap_type() == OMAP2_DEVICE_TYPE_EMU) ||  				    (omap_type() == OMAP2_DEVICE_TYPE_SEC)) {  					omap_sram_size = 0x7000; /* 28K */ +					omap_sram_skip += SZ_16K;  				} else {  					omap_sram_size = 0x8000; /* 32K */  				} @@ -175,8 +178,10 @@ static void __init omap_map_sram(void)  		return;  #ifdef CONFIG_OMAP4_ERRATA_I688 +	if (cpu_is_omap44xx()) {  		omap_sram_start += PAGE_SIZE;  		omap_sram_size -= SZ_16K; +	}  #endif  	if (cpu_is_omap34xx()) {  		/* @@ -203,8 +208,8 @@ static void __init omap_map_sram(void)  	 * Looks like we need to preserve some bootloader code at the  	 * beginning of SRAM for jumping to flash for reboot to work...  	 */ -	memset_io(omap_sram_base + SRAM_BOOTLOADER_SZ, 0, -		  omap_sram_size - SRAM_BOOTLOADER_SZ); +	memset_io(omap_sram_base + omap_sram_skip, 0, +		  omap_sram_size - omap_sram_skip);  }  /* @@ -218,7 +223,7 @@ void *omap_sram_push_address(unsigned long size)  {  	unsigned long available, new_ceil = (unsigned long)omap_sram_ceil; -	available = omap_sram_ceil - (omap_sram_base + SRAM_BOOTLOADER_SZ); +	available = omap_sram_ceil - (omap_sram_base + omap_sram_skip);  	if (size > available) {  		pr_err("Not enough space in SRAM\n"); diff --git a/arch/arm/plat-orion/common.c b/arch/arm/plat-orion/common.c index d245a87dc01..b8b747a9d36 100644 --- a/arch/arm/plat-orion/common.c +++ b/arch/arm/plat-orion/common.c @@ -291,10 +291,12 @@ static struct platform_device orion_ge00 = {  void __init orion_ge00_init(struct mv643xx_eth_platform_data *eth_data,  			    unsigned long mapbase,  			    unsigned long irq, -			    unsigned long irq_err) +			    unsigned long irq_err, +			    unsigned int tx_csum_limit)  {  	fill_resources(&orion_ge00_shared, orion_ge00_shared_resources,  		       mapbase + 0x2000, SZ_16K - 1, irq_err); +	orion_ge00_shared_data.tx_csum_limit = tx_csum_limit;  	ge_complete(&orion_ge00_shared_data,  		    orion_ge00_resources, irq, &orion_ge00_shared,  		    eth_data, &orion_ge00); @@ -343,10 +345,12 @@ static struct platform_device orion_ge01 = {  void __init orion_ge01_init(struct mv643xx_eth_platform_data *eth_data,  			    unsigned long mapbase,  			    unsigned long irq, -			    unsigned long irq_err) +			    unsigned long irq_err, +			    unsigned int tx_csum_limit)  {  	fill_resources(&orion_ge01_shared, orion_ge01_shared_resources,  		       mapbase + 0x2000, SZ_16K - 1, irq_err); +	orion_ge01_shared_data.tx_csum_limit = tx_csum_limit;  	ge_complete(&orion_ge01_shared_data,  		    orion_ge01_resources, irq, &orion_ge01_shared,  		    eth_data, &orion_ge01); diff --git a/arch/arm/plat-orion/include/plat/common.h b/arch/arm/plat-orion/include/plat/common.h index e00fdb21360..ae2377ef63e 100644 --- a/arch/arm/plat-orion/include/plat/common.h +++ b/arch/arm/plat-orion/include/plat/common.h @@ -39,12 +39,14 @@ void __init orion_rtc_init(unsigned long mapbase,  void __init orion_ge00_init(struct mv643xx_eth_platform_data *eth_data,  			    unsigned long mapbase,  			    unsigned long irq, -			    unsigned long irq_err); +			    unsigned long irq_err, +			    unsigned int tx_csum_limit);  void __init orion_ge01_init(struct mv643xx_eth_platform_data *eth_data,  			    unsigned long mapbase,  			    unsigned long irq, -			    unsigned long irq_err); +			    unsigned long irq_err, +			    unsigned int tx_csum_limit);  void __init orion_ge10_init(struct mv643xx_eth_platform_data *eth_data,  			    unsigned long mapbase, diff --git a/arch/arm/plat-s3c24xx/dma.c b/arch/arm/plat-s3c24xx/dma.c index 28f898f7538..db98e7021f0 100644 --- a/arch/arm/plat-s3c24xx/dma.c +++ b/arch/arm/plat-s3c24xx/dma.c @@ -430,7 +430,7 @@ s3c2410_dma_canload(struct s3c2410_dma_chan *chan)   * when necessary.  */ -int s3c2410_dma_enqueue(unsigned int channel, void *id, +int s3c2410_dma_enqueue(enum dma_ch channel, void *id,  			dma_addr_t data, int size)  {  	struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel); diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c index 74e31ce3553..fc49f3dabd7 100644 --- a/arch/arm/plat-samsung/devs.c +++ b/arch/arm/plat-samsung/devs.c @@ -32,6 +32,8 @@  #include <linux/platform_data/s3c-hsudc.h>  #include <linux/platform_data/s3c-hsotg.h> +#include <media/s5p_hdmi.h> +  #include <asm/irq.h>  #include <asm/pmu.h>  #include <asm/mach/arch.h> @@ -748,7 +750,8 @@ void __init s5p_i2c_hdmiphy_set_platdata(struct s3c2410_platform_i2c *pd)  	if (!pd) {  		pd = &default_i2c_data; -		if (soc_is_exynos4210()) +		if (soc_is_exynos4210() || +		    soc_is_exynos4212() || soc_is_exynos4412())  			pd->bus_num = 8;  		else if (soc_is_s5pv210())  			pd->bus_num = 3; @@ -759,6 +762,30 @@ void __init s5p_i2c_hdmiphy_set_platdata(struct s3c2410_platform_i2c *pd)  	npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),  			       &s5p_device_i2c_hdmiphy);  } + +struct s5p_hdmi_platform_data s5p_hdmi_def_platdata; + +void __init s5p_hdmi_set_platdata(struct i2c_board_info *hdmiphy_info, +				  struct i2c_board_info *mhl_info, int mhl_bus) +{ +	struct s5p_hdmi_platform_data *pd = &s5p_hdmi_def_platdata; + +	if (soc_is_exynos4210() || +	    soc_is_exynos4212() || soc_is_exynos4412()) +		pd->hdmiphy_bus = 8; +	else if (soc_is_s5pv210()) +		pd->hdmiphy_bus = 3; +	else +		pd->hdmiphy_bus = 0; + +	pd->hdmiphy_info = hdmiphy_info; +	pd->mhl_info = mhl_info; +	pd->mhl_bus = mhl_bus; + +	s3c_set_platdata(pd, sizeof(struct s5p_hdmi_platform_data), +			 &s5p_device_hdmi); +} +  #endif /* CONFIG_S5P_DEV_I2C_HDMIPHY */  /* I2S */ diff --git a/arch/arm/plat-samsung/include/plat/hdmi.h b/arch/arm/plat-samsung/include/plat/hdmi.h new file mode 100644 index 00000000000..331d046ac2c --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/hdmi.h @@ -0,0 +1,16 @@ +/* + * Copyright (C) 2012 Samsung Electronics Co.Ltd + * + * This program is free software; you can redistribute  it and/or modify it + * under  the terms of  the GNU General  Public License as published by the + * Free Software Foundation;  either version 2 of the  License, or (at your + * option) any later version. + */ + +#ifndef __PLAT_SAMSUNG_HDMI_H +#define __PLAT_SAMSUNG_HDMI_H __FILE__ + +extern void s5p_hdmi_set_platdata(struct i2c_board_info *hdmiphy_info, +				  struct i2c_board_info *mhl_info, int mhl_bus); + +#endif /* __PLAT_SAMSUNG_HDMI_H */ diff --git a/arch/arm/plat-samsung/pm.c b/arch/arm/plat-samsung/pm.c index 64ab65f0fdb..15070284343 100644 --- a/arch/arm/plat-samsung/pm.c +++ b/arch/arm/plat-samsung/pm.c @@ -74,7 +74,7 @@ unsigned char pm_uart_udivslot;  #ifdef CONFIG_SAMSUNG_PM_DEBUG -struct pm_uart_save uart_save[CONFIG_SERIAL_SAMSUNG_UARTS]; +static struct pm_uart_save uart_save[CONFIG_SERIAL_SAMSUNG_UARTS];  static void s3c_pm_save_uart(unsigned int uart, struct pm_uart_save *save)  { diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig index f3486192063..c7092e6057c 100644 --- a/arch/blackfin/Kconfig +++ b/arch/blackfin/Kconfig @@ -38,6 +38,7 @@ config BLACKFIN  	select GENERIC_ATOMIC64  	select GENERIC_IRQ_PROBE  	select IRQ_PER_CPU if SMP +	select USE_GENERIC_SMP_HELPERS if SMP  	select HAVE_NMI_WATCHDOG if NMI_WATCHDOG  	select GENERIC_SMP_IDLE_THREAD  	select ARCH_USES_GETTIMEOFFSET if !GENERIC_CLOCKEVENTS diff --git a/arch/blackfin/Makefile b/arch/blackfin/Makefile index d3d7e64ca96..66cf00095b8 100644 --- a/arch/blackfin/Makefile +++ b/arch/blackfin/Makefile @@ -20,7 +20,6 @@ endif  KBUILD_AFLAGS           += $(call cc-option,-mno-fdpic)  KBUILD_CFLAGS_MODULE    += -mlong-calls  LDFLAGS                 += -m elf32bfin -KALLSYMS         += --symbol-prefix=_  KBUILD_DEFCONFIG := BF537-STAMP_defconfig diff --git a/arch/blackfin/include/asm/smp.h b/arch/blackfin/include/asm/smp.h index dc3d144b4bb..9631598dcc5 100644 --- a/arch/blackfin/include/asm/smp.h +++ b/arch/blackfin/include/asm/smp.h @@ -18,6 +18,8 @@  #define raw_smp_processor_id()  blackfin_core_id()  extern void bfin_relocate_coreb_l1_mem(void); +extern void arch_send_call_function_single_ipi(int cpu); +extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);  #if defined(CONFIG_SMP) && defined(CONFIG_ICACHE_FLUSH_L1)  asmlinkage void blackfin_icache_flush_range_l1(unsigned long *ptr); diff --git a/arch/blackfin/mach-common/smp.c b/arch/blackfin/mach-common/smp.c index 00bbe672b3b..a40151306b7 100644 --- a/arch/blackfin/mach-common/smp.c +++ b/arch/blackfin/mach-common/smp.c @@ -48,10 +48,13 @@ unsigned long blackfin_iflush_l1_entry[NR_CPUS];  struct blackfin_initial_pda __cpuinitdata initial_pda_coreb; -#define BFIN_IPI_TIMER	      0 -#define BFIN_IPI_RESCHEDULE   1 -#define BFIN_IPI_CALL_FUNC    2 -#define BFIN_IPI_CPU_STOP     3 +enum ipi_message_type { +	BFIN_IPI_TIMER, +	BFIN_IPI_RESCHEDULE, +	BFIN_IPI_CALL_FUNC, +	BFIN_IPI_CALL_FUNC_SINGLE, +	BFIN_IPI_CPU_STOP, +};  struct blackfin_flush_data {  	unsigned long start; @@ -60,35 +63,20 @@ struct blackfin_flush_data {  void *secondary_stack; - -struct smp_call_struct { -	void (*func)(void *info); -	void *info; -	int wait; -	cpumask_t *waitmask; -}; -  static struct blackfin_flush_data smp_flush_data;  static DEFINE_SPINLOCK(stop_lock); -struct ipi_message { -	unsigned long type; -	struct smp_call_struct call_struct; -}; -  /* A magic number - stress test shows this is safe for common cases */  #define BFIN_IPI_MSGQ_LEN 5  /* Simple FIFO buffer, overflow leads to panic */ -struct ipi_message_queue { -	spinlock_t lock; +struct ipi_data {  	unsigned long count; -	unsigned long head; /* head of the queue */ -	struct ipi_message ipi_message[BFIN_IPI_MSGQ_LEN]; +	unsigned long bits;  }; -static DEFINE_PER_CPU(struct ipi_message_queue, ipi_msg_queue); +static DEFINE_PER_CPU(struct ipi_data, bfin_ipi);  static void ipi_cpu_stop(unsigned int cpu)  { @@ -129,28 +117,6 @@ static void ipi_flush_icache(void *info)  	blackfin_icache_flush_range(fdata->start, fdata->end);  } -static void ipi_call_function(unsigned int cpu, struct ipi_message *msg) -{ -	int wait; -	void (*func)(void *info); -	void *info; -	func = msg->call_struct.func; -	info = msg->call_struct.info; -	wait = msg->call_struct.wait; -	func(info); -	if (wait) { -#ifdef __ARCH_SYNC_CORE_DCACHE -		/* -		 * 'wait' usually means synchronization between CPUs. -		 * Invalidate D cache in case shared data was changed -		 * by func() to ensure cache coherence. -		 */ -		resync_core_dcache(); -#endif -		cpumask_clear_cpu(cpu, msg->call_struct.waitmask); -	} -} -  /* Use IRQ_SUPPLE_0 to request reschedule.   * When returning from interrupt to user space,   * there is chance to reschedule */ @@ -172,152 +138,95 @@ void ipi_timer(void)  static irqreturn_t ipi_handler_int1(int irq, void *dev_instance)  { -	struct ipi_message *msg; -	struct ipi_message_queue *msg_queue; +	struct ipi_data *bfin_ipi_data;  	unsigned int cpu = smp_processor_id(); -	unsigned long flags; +	unsigned long pending; +	unsigned long msg;  	platform_clear_ipi(cpu, IRQ_SUPPLE_1); -	msg_queue = &__get_cpu_var(ipi_msg_queue); +	bfin_ipi_data = &__get_cpu_var(bfin_ipi); + +	while ((pending = xchg(&bfin_ipi_data->bits, 0)) != 0) { +		msg = 0; +		do { +			msg = find_next_bit(&pending, BITS_PER_LONG, msg + 1); +			switch (msg) { +			case BFIN_IPI_TIMER: +				ipi_timer(); +				break; +			case BFIN_IPI_RESCHEDULE: +				scheduler_ipi(); +				break; +			case BFIN_IPI_CALL_FUNC: +				generic_smp_call_function_interrupt(); +				break; + +			case BFIN_IPI_CALL_FUNC_SINGLE: +				generic_smp_call_function_single_interrupt(); +				break; -	spin_lock_irqsave(&msg_queue->lock, flags); +			case BFIN_IPI_CPU_STOP: +				ipi_cpu_stop(cpu); +				break; +			} +		} while (msg < BITS_PER_LONG); -	while (msg_queue->count) { -		msg = &msg_queue->ipi_message[msg_queue->head]; -		switch (msg->type) { -		case BFIN_IPI_TIMER: -			ipi_timer(); -			break; -		case BFIN_IPI_RESCHEDULE: -			scheduler_ipi(); -			break; -		case BFIN_IPI_CALL_FUNC: -			ipi_call_function(cpu, msg); -			break; -		case BFIN_IPI_CPU_STOP: -			ipi_cpu_stop(cpu); -			break; -		default: -			printk(KERN_CRIT "CPU%u: Unknown IPI message 0x%lx\n", -			       cpu, msg->type); -			break; -		} -		msg_queue->head++; -		msg_queue->head %= BFIN_IPI_MSGQ_LEN; -		msg_queue->count--; +		smp_mb();  	} -	spin_unlock_irqrestore(&msg_queue->lock, flags);  	return IRQ_HANDLED;  } -static void ipi_queue_init(void) +static void bfin_ipi_init(void)  {  	unsigned int cpu; -	struct ipi_message_queue *msg_queue; +	struct ipi_data *bfin_ipi_data;  	for_each_possible_cpu(cpu) { -		msg_queue = &per_cpu(ipi_msg_queue, cpu); -		spin_lock_init(&msg_queue->lock); -		msg_queue->count = 0; -		msg_queue->head = 0; +		bfin_ipi_data = &per_cpu(bfin_ipi, cpu); +		bfin_ipi_data->bits = 0; +		bfin_ipi_data->count = 0;  	}  } -static inline void smp_send_message(cpumask_t callmap, unsigned long type, -					void (*func) (void *info), void *info, int wait) +void send_ipi(const struct cpumask *cpumask, enum ipi_message_type msg)  {  	unsigned int cpu; -	struct ipi_message_queue *msg_queue; -	struct ipi_message *msg; -	unsigned long flags, next_msg; -	cpumask_t waitmask; /* waitmask is shared by all cpus */ +	struct ipi_data *bfin_ipi_data; +	unsigned long flags; -	cpumask_copy(&waitmask, &callmap); -	for_each_cpu(cpu, &callmap) { -		msg_queue = &per_cpu(ipi_msg_queue, cpu); -		spin_lock_irqsave(&msg_queue->lock, flags); -		if (msg_queue->count < BFIN_IPI_MSGQ_LEN) { -			next_msg = (msg_queue->head + msg_queue->count) -					% BFIN_IPI_MSGQ_LEN; -			msg = &msg_queue->ipi_message[next_msg]; -			msg->type = type; -			if (type == BFIN_IPI_CALL_FUNC) { -				msg->call_struct.func = func; -				msg->call_struct.info = info; -				msg->call_struct.wait = wait; -				msg->call_struct.waitmask = &waitmask; -			} -			msg_queue->count++; -		} else -			panic("IPI message queue overflow\n"); -		spin_unlock_irqrestore(&msg_queue->lock, flags); +	local_irq_save(flags); + +	for_each_cpu(cpu, cpumask) { +		bfin_ipi_data = &per_cpu(bfin_ipi, cpu); +		smp_mb(); +		set_bit(msg, &bfin_ipi_data->bits); +		bfin_ipi_data->count++;  		platform_send_ipi_cpu(cpu, IRQ_SUPPLE_1);  	} -	if (wait) { -		while (!cpumask_empty(&waitmask)) -			blackfin_dcache_invalidate_range( -				(unsigned long)(&waitmask), -				(unsigned long)(&waitmask)); -#ifdef __ARCH_SYNC_CORE_DCACHE -		/* -		 * Invalidate D cache in case shared data was changed by -		 * other processors to ensure cache coherence. -		 */ -		resync_core_dcache(); -#endif -	} +	local_irq_restore(flags);  } -int smp_call_function(void (*func)(void *info), void *info, int wait) +void arch_send_call_function_single_ipi(int cpu)  { -	cpumask_t callmap; - -	preempt_disable(); -	cpumask_copy(&callmap, cpu_online_mask); -	cpumask_clear_cpu(smp_processor_id(), &callmap); -	if (!cpumask_empty(&callmap)) -		smp_send_message(callmap, BFIN_IPI_CALL_FUNC, func, info, wait); - -	preempt_enable(); - -	return 0; +	send_ipi(cpumask_of(cpu), BFIN_IPI_CALL_FUNC_SINGLE);  } -EXPORT_SYMBOL_GPL(smp_call_function); -int smp_call_function_single(int cpuid, void (*func) (void *info), void *info, -				int wait) +void arch_send_call_function_ipi_mask(const struct cpumask *mask)  { -	unsigned int cpu = cpuid; -	cpumask_t callmap; - -	if (cpu_is_offline(cpu)) -		return 0; -	cpumask_clear(&callmap); -	cpumask_set_cpu(cpu, &callmap); - -	smp_send_message(callmap, BFIN_IPI_CALL_FUNC, func, info, wait); - -	return 0; +	send_ipi(mask, BFIN_IPI_CALL_FUNC);  } -EXPORT_SYMBOL_GPL(smp_call_function_single);  void smp_send_reschedule(int cpu)  { -	cpumask_t callmap; -	/* simply trigger an ipi */ - -	cpumask_clear(&callmap); -	cpumask_set_cpu(cpu, &callmap); - -	smp_send_message(callmap, BFIN_IPI_RESCHEDULE, NULL, NULL, 0); +	send_ipi(cpumask_of(cpu), BFIN_IPI_RESCHEDULE);  	return;  }  void smp_send_msg(const struct cpumask *mask, unsigned long type)  { -	smp_send_message(*mask, type, NULL, NULL, 0); +	send_ipi(mask, type);  }  void smp_timer_broadcast(const struct cpumask *mask) @@ -333,7 +242,7 @@ void smp_send_stop(void)  	cpumask_copy(&callmap, cpu_online_mask);  	cpumask_clear_cpu(smp_processor_id(), &callmap);  	if (!cpumask_empty(&callmap)) -		smp_send_message(callmap, BFIN_IPI_CPU_STOP, NULL, NULL, 0); +		send_ipi(&callmap, BFIN_IPI_CPU_STOP);  	preempt_enable(); @@ -436,7 +345,7 @@ void __init smp_prepare_boot_cpu(void)  void __init smp_prepare_cpus(unsigned int max_cpus)  {  	platform_prepare_cpus(max_cpus); -	ipi_queue_init(); +	bfin_ipi_init();  	platform_request_ipi(IRQ_SUPPLE_0, ipi_handler_int0);  	platform_request_ipi(IRQ_SUPPLE_1, ipi_handler_int1);  } diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 331d574df99..faf65286574 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -89,6 +89,7 @@ config ATH79  	select CEVT_R4K  	select CSRC_R4K  	select DMA_NONCOHERENT +	select HAVE_CLK  	select IRQ_CPU  	select MIPS_MACHINE  	select SYS_HAS_CPU_MIPS32_R2 diff --git a/arch/mips/alchemy/board-mtx1.c b/arch/mips/alchemy/board-mtx1.c index 99969484c47..a124c251c0c 100644 --- a/arch/mips/alchemy/board-mtx1.c +++ b/arch/mips/alchemy/board-mtx1.c @@ -228,6 +228,8 @@ static int mtx1_pci_idsel(unsigned int devsel, int assert)  	 * adapter on the mtx-1 "singleboard" variant. It triggers a custom  	 * logic chip connected to EXT_IO3 (GPIO1) to suppress IDSEL signals.  	 */ +	udelay(1); +  	if (assert && devsel != 0)  		/* Suppress signal to Cardbus */  		alchemy_gpio_set_value(1, 0);	/* set EXT_IO3 OFF */ diff --git a/arch/mips/ath79/dev-usb.c b/arch/mips/ath79/dev-usb.c index 36e9570e7bc..b2a2311ec85 100644 --- a/arch/mips/ath79/dev-usb.c +++ b/arch/mips/ath79/dev-usb.c @@ -145,6 +145,8 @@ static void __init ar7240_usb_setup(void)  	ath79_ohci_resources[0].start = AR7240_OHCI_BASE;  	ath79_ohci_resources[0].end = AR7240_OHCI_BASE + AR7240_OHCI_SIZE - 1; +	ath79_ohci_resources[1].start = ATH79_CPU_IRQ_USB; +	ath79_ohci_resources[1].end = ATH79_CPU_IRQ_USB;  	platform_device_register(&ath79_ohci_device);  } diff --git a/arch/mips/ath79/gpio.c b/arch/mips/ath79/gpio.c index 29054f21183..48fe762d252 100644 --- a/arch/mips/ath79/gpio.c +++ b/arch/mips/ath79/gpio.c @@ -188,8 +188,10 @@ void __init ath79_gpio_init(void)  	if (soc_is_ar71xx())  		ath79_gpio_count = AR71XX_GPIO_COUNT; -	else if (soc_is_ar724x()) -		ath79_gpio_count = AR724X_GPIO_COUNT; +	else if (soc_is_ar7240()) +		ath79_gpio_count = AR7240_GPIO_COUNT; +	else if (soc_is_ar7241() || soc_is_ar7242()) +		ath79_gpio_count = AR7241_GPIO_COUNT;  	else if (soc_is_ar913x())  		ath79_gpio_count = AR913X_GPIO_COUNT;  	else if (soc_is_ar933x()) diff --git a/arch/mips/bcm63xx/dev-spi.c b/arch/mips/bcm63xx/dev-spi.c index e39f73048d4..f1c9c3e2f67 100644 --- a/arch/mips/bcm63xx/dev-spi.c +++ b/arch/mips/bcm63xx/dev-spi.c @@ -106,11 +106,15 @@ int __init bcm63xx_spi_register(void)  	if (BCMCPU_IS_6338() || BCMCPU_IS_6348()) {  		spi_resources[0].end += BCM_6338_RSET_SPI_SIZE - 1;  		spi_pdata.fifo_size = SPI_6338_MSG_DATA_SIZE; +		spi_pdata.msg_type_shift = SPI_6338_MSG_TYPE_SHIFT; +		spi_pdata.msg_ctl_width = SPI_6338_MSG_CTL_WIDTH;  	}  	if (BCMCPU_IS_6358() || BCMCPU_IS_6368()) {  		spi_resources[0].end += BCM_6358_RSET_SPI_SIZE - 1;  		spi_pdata.fifo_size = SPI_6358_MSG_DATA_SIZE; +		spi_pdata.msg_type_shift = SPI_6358_MSG_TYPE_SHIFT; +		spi_pdata.msg_ctl_width = SPI_6358_MSG_CTL_WIDTH;  	}  	bcm63xx_spi_regs_init(); diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon/octeon-irq.c index 7fb1f222b8a..274cd4fad30 100644 --- a/arch/mips/cavium-octeon/octeon-irq.c +++ b/arch/mips/cavium-octeon/octeon-irq.c @@ -61,6 +61,12 @@ static void octeon_irq_set_ciu_mapping(int irq, int line, int bit,  	octeon_irq_ciu_to_irq[line][bit] = irq;  } +static void octeon_irq_force_ciu_mapping(struct irq_domain *domain, +					 int irq, int line, int bit) +{ +	irq_domain_associate(domain, irq, line << 6 | bit); +} +  static int octeon_coreid_for_cpu(int cpu)  {  #ifdef CONFIG_SMP @@ -183,19 +189,9 @@ static void __init octeon_irq_init_core(void)  		mutex_init(&cd->core_irq_mutex);  		irq = OCTEON_IRQ_SW0 + i; -		switch (irq) { -		case OCTEON_IRQ_TIMER: -		case OCTEON_IRQ_SW0: -		case OCTEON_IRQ_SW1: -		case OCTEON_IRQ_5: -		case OCTEON_IRQ_PERF: -			irq_set_chip_data(irq, cd); -			irq_set_chip_and_handler(irq, &octeon_irq_chip_core, -						 handle_percpu_irq); -			break; -		default: -			break; -		} +		irq_set_chip_data(irq, cd); +		irq_set_chip_and_handler(irq, &octeon_irq_chip_core, +					 handle_percpu_irq);  	}  } @@ -890,7 +886,6 @@ static int octeon_irq_gpio_xlat(struct irq_domain *d,  	unsigned int type;  	unsigned int pin;  	unsigned int trigger; -	struct octeon_irq_gpio_domain_data *gpiod;  	if (d->of_node != node)  		return -EINVAL; @@ -925,8 +920,7 @@ static int octeon_irq_gpio_xlat(struct irq_domain *d,  		break;  	}  	*out_type = type; -	gpiod = d->host_data; -	*out_hwirq = gpiod->base_hwirq + pin; +	*out_hwirq = pin;  	return 0;  } @@ -996,19 +990,21 @@ static int octeon_irq_ciu_map(struct irq_domain *d,  static int octeon_irq_gpio_map(struct irq_domain *d,  			       unsigned int virq, irq_hw_number_t hw)  { -	unsigned int line = hw >> 6; -	unsigned int bit = hw & 63; +	struct octeon_irq_gpio_domain_data *gpiod = d->host_data; +	unsigned int line, bit;  	if (!octeon_irq_virq_in_range(virq))  		return -EINVAL; +	hw += gpiod->base_hwirq; +	line = hw >> 6; +	bit = hw & 63;  	if (line > 1 || octeon_irq_ciu_to_irq[line][bit] != 0)  		return -EINVAL;  	octeon_irq_set_ciu_mapping(virq, line, bit,  				   octeon_irq_gpio_chip,  				   octeon_irq_handle_gpio); -  	return 0;  } @@ -1149,6 +1145,7 @@ static void __init octeon_irq_init_ciu(void)  	struct irq_chip *chip_wd;  	struct device_node *gpio_node;  	struct device_node *ciu_node; +	struct irq_domain *ciu_domain = NULL;  	octeon_irq_init_ciu_percpu();  	octeon_irq_setup_secondary = octeon_irq_setup_secondary_ciu; @@ -1177,31 +1174,6 @@ static void __init octeon_irq_init_ciu(void)  	/* Mips internal */  	octeon_irq_init_core(); -	/* CIU_0 */ -	for (i = 0; i < 16; i++) -		octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_WORKQ0, 0, i + 0, chip, handle_level_irq); - -	octeon_irq_set_ciu_mapping(OCTEON_IRQ_MBOX0, 0, 32, chip_mbox, handle_percpu_irq); -	octeon_irq_set_ciu_mapping(OCTEON_IRQ_MBOX1, 0, 33, chip_mbox, handle_percpu_irq); - -	for (i = 0; i < 4; i++) -		octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_PCI_INT0, 0, i + 36, chip, handle_level_irq); -	for (i = 0; i < 4; i++) -		octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_PCI_MSI0, 0, i + 40, chip, handle_level_irq); - -	octeon_irq_set_ciu_mapping(OCTEON_IRQ_RML, 0, 46, chip, handle_level_irq); -	for (i = 0; i < 4; i++) -		octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_TIMER0, 0, i + 52, chip, handle_edge_irq); - -	octeon_irq_set_ciu_mapping(OCTEON_IRQ_USB0, 0, 56, chip, handle_level_irq); -	octeon_irq_set_ciu_mapping(OCTEON_IRQ_BOOTDMA, 0, 63, chip, handle_level_irq); - -	/* CIU_1 */ -	for (i = 0; i < 16; i++) -		octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_WDOG0, 1, i + 0, chip_wd, handle_level_irq); - -	octeon_irq_set_ciu_mapping(OCTEON_IRQ_USB1, 1, 17, chip, handle_level_irq); -  	gpio_node = of_find_compatible_node(NULL, NULL, "cavium,octeon-3860-gpio");  	if (gpio_node) {  		struct octeon_irq_gpio_domain_data *gpiod; @@ -1219,10 +1191,35 @@ static void __init octeon_irq_init_ciu(void)  	ciu_node = of_find_compatible_node(NULL, NULL, "cavium,octeon-3860-ciu");  	if (ciu_node) { -		irq_domain_add_tree(ciu_node, &octeon_irq_domain_ciu_ops, NULL); +		ciu_domain = irq_domain_add_tree(ciu_node, &octeon_irq_domain_ciu_ops, NULL);  		of_node_put(ciu_node);  	} else -		pr_warn("Cannot find device node for cavium,octeon-3860-ciu.\n"); +		panic("Cannot find device node for cavium,octeon-3860-ciu."); + +	/* CIU_0 */ +	for (i = 0; i < 16; i++) +		octeon_irq_force_ciu_mapping(ciu_domain, i + OCTEON_IRQ_WORKQ0, 0, i + 0); + +	octeon_irq_set_ciu_mapping(OCTEON_IRQ_MBOX0, 0, 32, chip_mbox, handle_percpu_irq); +	octeon_irq_set_ciu_mapping(OCTEON_IRQ_MBOX1, 0, 33, chip_mbox, handle_percpu_irq); + +	for (i = 0; i < 4; i++) +		octeon_irq_force_ciu_mapping(ciu_domain, i + OCTEON_IRQ_PCI_INT0, 0, i + 36); +	for (i = 0; i < 4; i++) +		octeon_irq_force_ciu_mapping(ciu_domain, i + OCTEON_IRQ_PCI_MSI0, 0, i + 40); + +	octeon_irq_force_ciu_mapping(ciu_domain, OCTEON_IRQ_RML, 0, 46); +	for (i = 0; i < 4; i++) +		octeon_irq_force_ciu_mapping(ciu_domain, i + OCTEON_IRQ_TIMER0, 0, i + 52); + +	octeon_irq_force_ciu_mapping(ciu_domain, OCTEON_IRQ_USB0, 0, 56); +	octeon_irq_force_ciu_mapping(ciu_domain, OCTEON_IRQ_BOOTDMA, 0, 63); + +	/* CIU_1 */ +	for (i = 0; i < 16; i++) +		octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_WDOG0, 1, i + 0, chip_wd, handle_level_irq); + +	octeon_irq_force_ciu_mapping(ciu_domain, OCTEON_IRQ_USB1, 1, 17);  	/* Enable the CIU lines */  	set_c0_status(STATUSF_IP3 | STATUSF_IP2); diff --git a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h index 1caa78ad06d..dde504477fa 100644 --- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h +++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h @@ -393,7 +393,8 @@  #define AR71XX_GPIO_REG_FUNC		0x28  #define AR71XX_GPIO_COUNT		16 -#define AR724X_GPIO_COUNT		18 +#define AR7240_GPIO_COUNT		18 +#define AR7241_GPIO_COUNT		20  #define AR913X_GPIO_COUNT		22  #define AR933X_GPIO_COUNT		30  #define AR934X_GPIO_COUNT		23 diff --git a/arch/mips/include/asm/mach-ath79/cpu-feature-overrides.h b/arch/mips/include/asm/mach-ath79/cpu-feature-overrides.h index 4476fa03bf3..6ddae926bf7 100644 --- a/arch/mips/include/asm/mach-ath79/cpu-feature-overrides.h +++ b/arch/mips/include/asm/mach-ath79/cpu-feature-overrides.h @@ -42,7 +42,6 @@  #define cpu_has_mips64r1	0  #define cpu_has_mips64r2	0 -#define cpu_has_dsp		0  #define cpu_has_mipsmt		0  #define cpu_has_64bits		0 diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_spi.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_spi.h index 7d98dbe5d4b..c9bae136260 100644 --- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_spi.h +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_spi.h @@ -9,6 +9,8 @@ int __init bcm63xx_spi_register(void);  struct bcm63xx_spi_pdata {  	unsigned int	fifo_size; +	unsigned int	msg_type_shift; +	unsigned int	msg_ctl_width;  	int		bus_num;  	int		num_chipselect;  	u32		speed_hz; diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h index 4ccc2a748af..61f2a2a5099 100644 --- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h @@ -1054,7 +1054,8 @@  #define SPI_6338_FILL_BYTE		0x07  #define SPI_6338_MSG_TAIL		0x09  #define SPI_6338_RX_TAIL		0x0b -#define SPI_6338_MSG_CTL		0x40 +#define SPI_6338_MSG_CTL		0x40	/* 8-bits register */ +#define SPI_6338_MSG_CTL_WIDTH		8  #define SPI_6338_MSG_DATA		0x41  #define SPI_6338_MSG_DATA_SIZE		0x3f  #define SPI_6338_RX_DATA		0x80 @@ -1070,7 +1071,8 @@  #define SPI_6348_FILL_BYTE		0x07  #define SPI_6348_MSG_TAIL		0x09  #define SPI_6348_RX_TAIL		0x0b -#define SPI_6348_MSG_CTL		0x40 +#define SPI_6348_MSG_CTL		0x40	/* 8-bits register */ +#define SPI_6348_MSG_CTL_WIDTH		8  #define SPI_6348_MSG_DATA		0x41  #define SPI_6348_MSG_DATA_SIZE		0x3f  #define SPI_6348_RX_DATA		0x80 @@ -1078,6 +1080,7 @@  /* BCM 6358 SPI core */  #define SPI_6358_MSG_CTL		0x00	/* 16-bits register */ +#define SPI_6358_MSG_CTL_WIDTH		16  #define SPI_6358_MSG_DATA		0x02  #define SPI_6358_MSG_DATA_SIZE		0x21e  #define SPI_6358_RX_DATA		0x400 @@ -1094,6 +1097,7 @@  /* BCM 6358 SPI core */  #define SPI_6368_MSG_CTL		0x00	/* 16-bits register */ +#define SPI_6368_MSG_CTL_WIDTH		16  #define SPI_6368_MSG_DATA		0x02  #define SPI_6368_MSG_DATA_SIZE		0x21e  #define SPI_6368_RX_DATA		0x400 @@ -1115,7 +1119,10 @@  #define SPI_HD_W			0x01  #define SPI_HD_R			0x02  #define SPI_BYTE_CNT_SHIFT		0 -#define SPI_MSG_TYPE_SHIFT		14 +#define SPI_6338_MSG_TYPE_SHIFT		6 +#define SPI_6348_MSG_TYPE_SHIFT		6 +#define SPI_6358_MSG_TYPE_SHIFT		14 +#define SPI_6368_MSG_TYPE_SHIFT		14  /* Command */  #define SPI_CMD_NOOP			0x00 diff --git a/arch/mips/include/asm/mach-cavium-octeon/irq.h b/arch/mips/include/asm/mach-cavium-octeon/irq.h index 418992042f6..c22a3078bf1 100644 --- a/arch/mips/include/asm/mach-cavium-octeon/irq.h +++ b/arch/mips/include/asm/mach-cavium-octeon/irq.h @@ -21,14 +21,10 @@ enum octeon_irq {  	OCTEON_IRQ_TIMER,  /* sources in CIU_INTX_EN0 */  	OCTEON_IRQ_WORKQ0, -	OCTEON_IRQ_GPIO0 = OCTEON_IRQ_WORKQ0 + 16, -	OCTEON_IRQ_WDOG0 = OCTEON_IRQ_GPIO0 + 16, +	OCTEON_IRQ_WDOG0 = OCTEON_IRQ_WORKQ0 + 16,  	OCTEON_IRQ_WDOG15 = OCTEON_IRQ_WDOG0 + 15,  	OCTEON_IRQ_MBOX0 = OCTEON_IRQ_WDOG0 + 16,  	OCTEON_IRQ_MBOX1, -	OCTEON_IRQ_UART0, -	OCTEON_IRQ_UART1, -	OCTEON_IRQ_UART2,  	OCTEON_IRQ_PCI_INT0,  	OCTEON_IRQ_PCI_INT1,  	OCTEON_IRQ_PCI_INT2, @@ -38,8 +34,6 @@ enum octeon_irq {  	OCTEON_IRQ_PCI_MSI2,  	OCTEON_IRQ_PCI_MSI3, -	OCTEON_IRQ_TWSI, -	OCTEON_IRQ_TWSI2,  	OCTEON_IRQ_RML,  	OCTEON_IRQ_TIMER0,  	OCTEON_IRQ_TIMER1, @@ -47,8 +41,6 @@ enum octeon_irq {  	OCTEON_IRQ_TIMER3,  	OCTEON_IRQ_USB0,  	OCTEON_IRQ_USB1, -	OCTEON_IRQ_MII0, -	OCTEON_IRQ_MII1,  	OCTEON_IRQ_BOOTDMA,  #ifndef CONFIG_PCI_MSI  	OCTEON_IRQ_LAST = 127 diff --git a/arch/mips/include/asm/module.h b/arch/mips/include/asm/module.h index 7531ecd654d..dca8bce8c7a 100644 --- a/arch/mips/include/asm/module.h +++ b/arch/mips/include/asm/module.h @@ -10,6 +10,7 @@ struct mod_arch_specific {  	struct list_head dbe_list;  	const struct exception_table_entry *dbe_start;  	const struct exception_table_entry *dbe_end; +	struct mips_hi16 *r_mips_hi16_list;  };  typedef uint8_t Elf64_Byte;		/* Type for a 8-bit quantity.  */ diff --git a/arch/mips/include/asm/r4k-timer.h b/arch/mips/include/asm/r4k-timer.h index a37d12b3b61..afe9e0e03fe 100644 --- a/arch/mips/include/asm/r4k-timer.h +++ b/arch/mips/include/asm/r4k-timer.h @@ -12,16 +12,16 @@  #ifdef CONFIG_SYNC_R4K -extern void synchronise_count_master(void); -extern void synchronise_count_slave(void); +extern void synchronise_count_master(int cpu); +extern void synchronise_count_slave(int cpu);  #else -static inline void synchronise_count_master(void) +static inline void synchronise_count_master(int cpu)  {  } -static inline void synchronise_count_slave(void) +static inline void synchronise_count_slave(int cpu)  {  } diff --git a/arch/mips/kernel/module.c b/arch/mips/kernel/module.c index a5066b1c3de..4f8c3cba8c0 100644 --- a/arch/mips/kernel/module.c +++ b/arch/mips/kernel/module.c @@ -39,8 +39,6 @@ struct mips_hi16 {  	Elf_Addr value;  }; -static struct mips_hi16 *mips_hi16_list; -  static LIST_HEAD(dbe_list);  static DEFINE_SPINLOCK(dbe_lock); @@ -128,8 +126,8 @@ static int apply_r_mips_hi16_rel(struct module *me, u32 *location, Elf_Addr v)  	n->addr = (Elf_Addr *)location;  	n->value = v; -	n->next = mips_hi16_list; -	mips_hi16_list = n; +	n->next = me->arch.r_mips_hi16_list; +	me->arch.r_mips_hi16_list = n;  	return 0;  } @@ -142,18 +140,28 @@ static int apply_r_mips_hi16_rela(struct module *me, u32 *location, Elf_Addr v)  	return 0;  } +static void free_relocation_chain(struct mips_hi16 *l) +{ +	struct mips_hi16 *next; + +	while (l) { +		next = l->next; +		kfree(l); +		l = next; +	} +} +  static int apply_r_mips_lo16_rel(struct module *me, u32 *location, Elf_Addr v)  {  	unsigned long insnlo = *location; +	struct mips_hi16 *l;  	Elf_Addr val, vallo;  	/* Sign extend the addend we extract from the lo insn.  */  	vallo = ((insnlo & 0xffff) ^ 0x8000) - 0x8000; -	if (mips_hi16_list != NULL) { -		struct mips_hi16 *l; - -		l = mips_hi16_list; +	if (me->arch.r_mips_hi16_list != NULL) { +		l = me->arch.r_mips_hi16_list;  		while (l != NULL) {  			struct mips_hi16 *next;  			unsigned long insn; @@ -188,7 +196,7 @@ static int apply_r_mips_lo16_rel(struct module *me, u32 *location, Elf_Addr v)  			l = next;  		} -		mips_hi16_list = NULL; +		me->arch.r_mips_hi16_list = NULL;  	}  	/* @@ -201,6 +209,9 @@ static int apply_r_mips_lo16_rel(struct module *me, u32 *location, Elf_Addr v)  	return 0;  out_danger: +	free_relocation_chain(l); +	me->arch.r_mips_hi16_list = NULL; +  	pr_err("module %s: dangerous R_MIPS_LO16 REL relocation\n", me->name);  	return -ENOEXEC; @@ -273,6 +284,7 @@ int apply_relocate(Elf_Shdr *sechdrs, const char *strtab,  	pr_debug("Applying relocate section %u to %u\n", relsec,  	       sechdrs[relsec].sh_info); +	me->arch.r_mips_hi16_list = NULL;  	for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) {  		/* This is where to make the change */  		location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr @@ -296,6 +308,19 @@ int apply_relocate(Elf_Shdr *sechdrs, const char *strtab,  			return res;  	} +	/* +	 * Normally the hi16 list should be deallocated at this point.  A +	 * malformed binary however could contain a series of R_MIPS_HI16 +	 * relocations not followed by a R_MIPS_LO16 relocation.  In that +	 * case, free up the list and return an error. +	 */ +	if (me->arch.r_mips_hi16_list) { +		free_relocation_chain(me->arch.r_mips_hi16_list); +		me->arch.r_mips_hi16_list = NULL; + +		return -ENOEXEC; +	} +  	return 0;  } diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c index 31637d8c873..9005bf9fb85 100644 --- a/arch/mips/kernel/smp.c +++ b/arch/mips/kernel/smp.c @@ -130,7 +130,7 @@ asmlinkage __cpuinit void start_secondary(void)  	cpu_set(cpu, cpu_callin_map); -	synchronise_count_slave(); +	synchronise_count_slave(cpu);  	/*  	 * irq will be enabled in ->smp_finish(), enabling it too early @@ -173,7 +173,6 @@ void smp_send_stop(void)  void __init smp_cpus_done(unsigned int max_cpus)  {  	mp_ops->cpus_done(); -	synchronise_count_master();  }  /* called from main before smp_init() */ @@ -206,6 +205,7 @@ int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle)  	while (!cpu_isset(cpu, cpu_callin_map))  		udelay(100); +	synchronise_count_master(cpu);  	return 0;  } diff --git a/arch/mips/kernel/sync-r4k.c b/arch/mips/kernel/sync-r4k.c index 842d55e411f..7f1eca3858d 100644 --- a/arch/mips/kernel/sync-r4k.c +++ b/arch/mips/kernel/sync-r4k.c @@ -28,12 +28,11 @@ static atomic_t __cpuinitdata count_reference = ATOMIC_INIT(0);  #define COUNTON	100  #define NR_LOOPS 5 -void __cpuinit synchronise_count_master(void) +void __cpuinit synchronise_count_master(int cpu)  {  	int i;  	unsigned long flags;  	unsigned int initcount; -	int nslaves;  #ifdef CONFIG_MIPS_MT_SMTC  	/* @@ -43,8 +42,7 @@ void __cpuinit synchronise_count_master(void)  	return;  #endif -	printk(KERN_INFO "Synchronize counters across %u CPUs: ", -	       num_online_cpus()); +	printk(KERN_INFO "Synchronize counters for CPU %u: ", cpu);  	local_irq_save(flags); @@ -52,7 +50,7 @@ void __cpuinit synchronise_count_master(void)  	 * Notify the slaves that it's time to start  	 */  	atomic_set(&count_reference, read_c0_count()); -	atomic_set(&count_start_flag, 1); +	atomic_set(&count_start_flag, cpu);  	smp_wmb();  	/* Count will be initialised to current timer for all CPU's */ @@ -69,10 +67,9 @@ void __cpuinit synchronise_count_master(void)  	 * two CPUs.  	 */ -	nslaves = num_online_cpus()-1;  	for (i = 0; i < NR_LOOPS; i++) { -		/* slaves loop on '!= ncpus' */ -		while (atomic_read(&count_count_start) != nslaves) +		/* slaves loop on '!= 2' */ +		while (atomic_read(&count_count_start) != 1)  			mb();  		atomic_set(&count_count_stop, 0);  		smp_wmb(); @@ -89,7 +86,7 @@ void __cpuinit synchronise_count_master(void)  		/*  		 * Wait for all slaves to leave the synchronization point:  		 */ -		while (atomic_read(&count_count_stop) != nslaves) +		while (atomic_read(&count_count_stop) != 1)  			mb();  		atomic_set(&count_count_start, 0);  		smp_wmb(); @@ -97,6 +94,7 @@ void __cpuinit synchronise_count_master(void)  	}  	/* Arrange for an interrupt in a short while */  	write_c0_compare(read_c0_count() + COUNTON); +	atomic_set(&count_start_flag, 0);  	local_irq_restore(flags); @@ -108,11 +106,10 @@ void __cpuinit synchronise_count_master(void)  	printk("done.\n");  } -void __cpuinit synchronise_count_slave(void) +void __cpuinit synchronise_count_slave(int cpu)  {  	int i;  	unsigned int initcount; -	int ncpus;  #ifdef CONFIG_MIPS_MT_SMTC  	/* @@ -127,16 +124,15 @@ void __cpuinit synchronise_count_slave(void)  	 * so we first wait for the master to say everyone is ready  	 */ -	while (!atomic_read(&count_start_flag)) +	while (atomic_read(&count_start_flag) != cpu)  		mb();  	/* Count will be initialised to next expire for all CPU's */  	initcount = atomic_read(&count_reference); -	ncpus = num_online_cpus();  	for (i = 0; i < NR_LOOPS; i++) {  		atomic_inc(&count_count_start); -		while (atomic_read(&count_count_start) != ncpus) +		while (atomic_read(&count_count_start) != 2)  			mb();  		/* @@ -146,7 +142,7 @@ void __cpuinit synchronise_count_slave(void)  			write_c0_count(initcount);  		atomic_inc(&count_count_stop); -		while (atomic_read(&count_count_stop) != ncpus) +		while (atomic_read(&count_count_stop) != 2)  			mb();  	}  	/* Arrange for an interrupt in a short while */ diff --git a/arch/mips/mti-malta/malta-pci.c b/arch/mips/mti-malta/malta-pci.c index 284dea54faf..2147cb34e70 100644 --- a/arch/mips/mti-malta/malta-pci.c +++ b/arch/mips/mti-malta/malta-pci.c @@ -252,16 +252,3 @@ void __init mips_pcibios_init(void)  	register_pci_controller(controller);  } - -/* Enable PCI 2.1 compatibility in PIIX4 */ -static void __devinit quirk_dlcsetup(struct pci_dev *dev) -{ -	u8 odlc, ndlc; -	(void) pci_read_config_byte(dev, 0x82, &odlc); -	/* Enable passive releases and delayed transaction */ -	ndlc = odlc | 7; -	(void) pci_write_config_byte(dev, 0x82, ndlc); -} - -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_0, -	quirk_dlcsetup); diff --git a/arch/mips/pci/pci-ar724x.c b/arch/mips/pci/pci-ar724x.c index 414a7459858..86d77a66645 100644 --- a/arch/mips/pci/pci-ar724x.c +++ b/arch/mips/pci/pci-ar724x.c @@ -23,9 +23,12 @@  #define AR724X_PCI_MEM_BASE	0x10000000  #define AR724X_PCI_MEM_SIZE	0x08000000 +#define AR724X_PCI_REG_RESET		0x18  #define AR724X_PCI_REG_INT_STATUS	0x4c  #define AR724X_PCI_REG_INT_MASK		0x50 +#define AR724X_PCI_RESET_LINK_UP	BIT(0) +  #define AR724X_PCI_INT_DEV0		BIT(14)  #define AR724X_PCI_IRQ_COUNT		1 @@ -38,6 +41,15 @@ static void __iomem *ar724x_pci_ctrl_base;  static u32 ar724x_pci_bar0_value;  static bool ar724x_pci_bar0_is_cached; +static bool ar724x_pci_link_up; + +static inline bool ar724x_pci_check_link(void) +{ +	u32 reset; + +	reset = __raw_readl(ar724x_pci_ctrl_base + AR724X_PCI_REG_RESET); +	return reset & AR724X_PCI_RESET_LINK_UP; +}  static int ar724x_pci_read(struct pci_bus *bus, unsigned int devfn, int where,  			    int size, uint32_t *value) @@ -46,6 +58,9 @@ static int ar724x_pci_read(struct pci_bus *bus, unsigned int devfn, int where,  	void __iomem *base;  	u32 data; +	if (!ar724x_pci_link_up) +		return PCIBIOS_DEVICE_NOT_FOUND; +  	if (devfn)  		return PCIBIOS_DEVICE_NOT_FOUND; @@ -96,6 +111,9 @@ static int ar724x_pci_write(struct pci_bus *bus, unsigned int devfn, int where,  	u32 data;  	int s; +	if (!ar724x_pci_link_up) +		return PCIBIOS_DEVICE_NOT_FOUND; +  	if (devfn)  		return PCIBIOS_DEVICE_NOT_FOUND; @@ -280,6 +298,10 @@ int __init ar724x_pcibios_init(int irq)  	if (ar724x_pci_ctrl_base == NULL)  		goto err_unmap_devcfg; +	ar724x_pci_link_up = ar724x_pci_check_link(); +	if (!ar724x_pci_link_up) +		pr_warn("ar724x: PCIe link is down\n"); +  	ar724x_pci_irq_init(irq);  	register_pci_controller(&ar724x_pci_controller); diff --git a/arch/parisc/include/asm/atomic.h b/arch/parisc/include/asm/atomic.h index 6c6defc2461..af9cf30ed47 100644 --- a/arch/parisc/include/asm/atomic.h +++ b/arch/parisc/include/asm/atomic.h @@ -141,7 +141,7 @@ static __inline__ int __atomic_add_unless(atomic_t *v, int a, int u)  #define atomic_sub_and_test(i,v)	(atomic_sub_return((i),(v)) == 0) -#define ATOMIC_INIT(i)	((atomic_t) { (i) }) +#define ATOMIC_INIT(i)	{ (i) }  #define smp_mb__before_atomic_dec()	smp_mb()  #define smp_mb__after_atomic_dec()	smp_mb() @@ -150,7 +150,7 @@ static __inline__ int __atomic_add_unless(atomic_t *v, int a, int u)  #ifdef CONFIG_64BIT -#define ATOMIC64_INIT(i) ((atomic64_t) { (i) }) +#define ATOMIC64_INIT(i) { (i) }  static __inline__ s64  __atomic64_add_return(s64 i, atomic64_t *v) diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c index d4b94b395c1..2c05a9292a8 100644 --- a/arch/parisc/kernel/process.c +++ b/arch/parisc/kernel/process.c @@ -309,7 +309,7 @@ copy_thread(unsigned long clone_flags, unsigned long usp,  		cregs->ksp = (unsigned long)stack  			+ (pregs->gr[21] & (THREAD_SIZE - 1));  		cregs->gr[30] = usp; -		if (p->personality == PER_HPUX) { +		if (personality(p->personality) == PER_HPUX) {  #ifdef CONFIG_HPUX  			cregs->kpc = (unsigned long) &hpux_child_return;  #else diff --git a/arch/parisc/kernel/sys_parisc.c b/arch/parisc/kernel/sys_parisc.c index c9b932260f4..7426e40699b 100644 --- a/arch/parisc/kernel/sys_parisc.c +++ b/arch/parisc/kernel/sys_parisc.c @@ -225,12 +225,12 @@ long parisc_personality(unsigned long personality)  	long err;  	if (personality(current->personality) == PER_LINUX32 -	    && personality == PER_LINUX) -		personality = PER_LINUX32; +	    && personality(personality) == PER_LINUX) +		personality = (personality & ~PER_MASK) | PER_LINUX32;  	err = sys_personality(personality); -	if (err == PER_LINUX32) -		err = PER_LINUX; +	if (personality(err) == PER_LINUX32) +		err = (err & ~PER_MASK) | PER_LINUX;  	return err;  } diff --git a/arch/powerpc/boot/dts/fsl/p4080si-post.dtsi b/arch/powerpc/boot/dts/fsl/p4080si-post.dtsi index 8d35d2c1f69..4f9c9f682ec 100644 --- a/arch/powerpc/boot/dts/fsl/p4080si-post.dtsi +++ b/arch/powerpc/boot/dts/fsl/p4080si-post.dtsi @@ -345,6 +345,13 @@  /include/ "qoriq-duart-1.dtsi"  /include/ "qoriq-gpio-0.dtsi"  /include/ "qoriq-usb2-mph-0.dtsi" +	usb@210000 { +		compatible = "fsl-usb2-mph-v1.6", "fsl,mpc85xx-usb2-mph", "fsl-usb2-mph"; +		port0; +	};  /include/ "qoriq-usb2-dr-0.dtsi" +	usb@211000 { +		compatible = "fsl-usb2-dr-v1.6", "fsl,mpc85xx-usb2-dr", "fsl-usb2-dr"; +	};  /include/ "qoriq-sec4.0-0.dtsi"  }; diff --git a/arch/powerpc/configs/85xx/p1023rds_defconfig b/arch/powerpc/configs/85xx/p1023rds_defconfig index f4337bacd0e..26e541c4662 100644 --- a/arch/powerpc/configs/85xx/p1023rds_defconfig +++ b/arch/powerpc/configs/85xx/p1023rds_defconfig @@ -6,28 +6,27 @@ CONFIG_SYSVIPC=y  CONFIG_POSIX_MQUEUE=y  CONFIG_BSD_PROCESS_ACCT=y  CONFIG_AUDIT=y -CONFIG_SPARSE_IRQ=y +CONFIG_IRQ_DOMAIN_DEBUG=y +CONFIG_NO_HZ=y +CONFIG_HIGH_RES_TIMERS=y  CONFIG_IKCONFIG=y  CONFIG_IKCONFIG_PROC=y  CONFIG_LOG_BUF_SHIFT=14  CONFIG_BLK_DEV_INITRD=y -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set  CONFIG_KALLSYMS_ALL=y -CONFIG_KALLSYMS_EXTRA_PASS=y  CONFIG_EMBEDDED=y  CONFIG_MODULES=y  CONFIG_MODULE_UNLOAD=y  CONFIG_MODULE_FORCE_UNLOAD=y  CONFIG_MODVERSIONS=y  # CONFIG_BLK_DEV_BSG is not set +CONFIG_PARTITION_ADVANCED=y +CONFIG_MAC_PARTITION=y  CONFIG_P1023_RDS=y  CONFIG_QUICC_ENGINE=y  CONFIG_QE_GPIO=y  CONFIG_CPM2=y -CONFIG_GPIO_MPC8XXX=y  CONFIG_HIGHMEM=y -CONFIG_NO_HZ=y -CONFIG_HIGH_RES_TIMERS=y  # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set  CONFIG_BINFMT_MISC=m  CONFIG_MATH_EMULATION=y @@ -63,11 +62,11 @@ CONFIG_INET_ESP=y  CONFIG_IPV6=y  CONFIG_IP_SCTP=m  CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" +CONFIG_DEVTMPFS=y  CONFIG_PROC_DEVICETREE=y  CONFIG_BLK_DEV_LOOP=y  CONFIG_BLK_DEV_RAM=y  CONFIG_BLK_DEV_RAM_SIZE=131072 -CONFIG_MISC_DEVICES=y  CONFIG_EEPROM_LEGACY=y  CONFIG_BLK_DEV_SD=y  CONFIG_CHR_DEV_ST=y @@ -80,15 +79,14 @@ CONFIG_SATA_FSL=y  CONFIG_SATA_SIL24=y  CONFIG_NETDEVICES=y  CONFIG_DUMMY=y +CONFIG_FS_ENET=y +CONFIG_FSL_PQ_MDIO=y +CONFIG_E1000E=y  CONFIG_MARVELL_PHY=y  CONFIG_DAVICOM_PHY=y  CONFIG_CICADA_PHY=y  CONFIG_VITESSE_PHY=y  CONFIG_FIXED_PHY=y -CONFIG_NET_ETHERNET=y -CONFIG_FS_ENET=y -CONFIG_E1000E=y -CONFIG_FSL_PQ_MDIO=y  CONFIG_INPUT_FF_MEMLESS=m  # CONFIG_INPUT_MOUSEDEV is not set  # CONFIG_INPUT_KEYBOARD is not set @@ -98,16 +96,15 @@ CONFIG_SERIAL_8250=y  CONFIG_SERIAL_8250_CONSOLE=y  CONFIG_SERIAL_8250_NR_UARTS=2  CONFIG_SERIAL_8250_RUNTIME_UARTS=2 -CONFIG_SERIAL_8250_EXTENDED=y  CONFIG_SERIAL_8250_MANY_PORTS=y  CONFIG_SERIAL_8250_DETECT_IRQ=y  CONFIG_SERIAL_8250_RSA=y  CONFIG_SERIAL_QE=m -CONFIG_HW_RANDOM=y  CONFIG_NVRAM=y  CONFIG_I2C=y  CONFIG_I2C_CPM=m  CONFIG_I2C_MPC=y +CONFIG_GPIO_MPC8XXX=y  # CONFIG_HWMON is not set  CONFIG_VIDEO_OUTPUT_CONTROL=y  CONFIG_SOUND=y @@ -123,7 +120,6 @@ CONFIG_DMADEVICES=y  CONFIG_FSL_DMA=y  # CONFIG_NET_DMA is not set  CONFIG_STAGING=y -# CONFIG_STAGING_EXCLUDE_BUILD is not set  CONFIG_EXT2_FS=y  CONFIG_EXT3_FS=y  # CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set @@ -150,22 +146,15 @@ CONFIG_QNX4FS_FS=m  CONFIG_SYSV_FS=m  CONFIG_UFS_FS=m  CONFIG_NFS_FS=y -CONFIG_NFS_V3=y  CONFIG_NFS_V4=y  CONFIG_ROOT_NFS=y  CONFIG_NFSD=y -CONFIG_PARTITION_ADVANCED=y -CONFIG_MAC_PARTITION=y  CONFIG_CRC_T10DIF=y  CONFIG_FRAME_WARN=8092  CONFIG_DEBUG_FS=y -CONFIG_DEBUG_KERNEL=y  CONFIG_DETECT_HUNG_TASK=y  # CONFIG_DEBUG_BUGVERBOSE is not set  CONFIG_DEBUG_INFO=y -# CONFIG_RCU_CPU_STALL_DETECTOR is not set -CONFIG_SYSCTL_SYSCALL_CHECK=y -CONFIG_IRQ_DOMAIN_DEBUG=y  CONFIG_CRYPTO_PCBC=m  CONFIG_CRYPTO_SHA256=y  CONFIG_CRYPTO_SHA512=y diff --git a/arch/powerpc/configs/corenet32_smp_defconfig b/arch/powerpc/configs/corenet32_smp_defconfig index cbb98c1234f..8b3d57c1ebe 100644 --- a/arch/powerpc/configs/corenet32_smp_defconfig +++ b/arch/powerpc/configs/corenet32_smp_defconfig @@ -6,8 +6,8 @@ CONFIG_SYSVIPC=y  CONFIG_POSIX_MQUEUE=y  CONFIG_BSD_PROCESS_ACCT=y  CONFIG_AUDIT=y -CONFIG_SPARSE_IRQ=y -CONFIG_RCU_TRACE=y +CONFIG_NO_HZ=y +CONFIG_HIGH_RES_TIMERS=y  CONFIG_IKCONFIG=y  CONFIG_IKCONFIG_PROC=y  CONFIG_LOG_BUF_SHIFT=14 @@ -21,23 +21,22 @@ CONFIG_MODULE_UNLOAD=y  CONFIG_MODULE_FORCE_UNLOAD=y  CONFIG_MODVERSIONS=y  # CONFIG_BLK_DEV_BSG is not set +CONFIG_PARTITION_ADVANCED=y +CONFIG_MAC_PARTITION=y  CONFIG_P2041_RDB=y  CONFIG_P3041_DS=y  CONFIG_P4080_DS=y  CONFIG_P5020_DS=y  CONFIG_HIGHMEM=y -CONFIG_NO_HZ=y -CONFIG_HIGH_RES_TIMERS=y  # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set  CONFIG_BINFMT_MISC=m  CONFIG_KEXEC=y  CONFIG_IRQ_ALL_CPUS=y  CONFIG_FORCE_MAX_ZONEORDER=13 -CONFIG_FSL_LBC=y  CONFIG_PCI=y  CONFIG_PCIEPORTBUS=y -CONFIG_PCI_MSI=y  # CONFIG_PCIEASPM is not set +CONFIG_PCI_MSI=y  CONFIG_RAPIDIO=y  CONFIG_FSL_RIO=y  CONFIG_NET=y @@ -70,6 +69,7 @@ CONFIG_INET_IPCOMP=y  CONFIG_IPV6=y  CONFIG_IP_SCTP=m  CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" +CONFIG_DEVTMPFS=y  CONFIG_MTD=y  CONFIG_MTD_CMDLINE_PARTS=y  CONFIG_MTD_CHAR=y @@ -77,17 +77,14 @@ CONFIG_MTD_BLOCK=y  CONFIG_MTD_CFI=y  CONFIG_MTD_CFI_AMDSTD=y  CONFIG_MTD_PHYSMAP_OF=y +CONFIG_MTD_M25P80=y  CONFIG_MTD_NAND=y -CONFIG_MTD_NAND_ECC=y -CONFIG_MTD_NAND_IDS=y -CONFIG_MTD_NAND_FSL_IFC=y  CONFIG_MTD_NAND_FSL_ELBC=y -CONFIG_MTD_M25P80=y +CONFIG_MTD_NAND_FSL_IFC=y  CONFIG_PROC_DEVICETREE=y  CONFIG_BLK_DEV_LOOP=y  CONFIG_BLK_DEV_RAM=y  CONFIG_BLK_DEV_RAM_SIZE=131072 -CONFIG_MISC_DEVICES=y  CONFIG_BLK_DEV_SD=y  CONFIG_CHR_DEV_ST=y  CONFIG_BLK_DEV_SR=y @@ -115,11 +112,9 @@ CONFIG_SERIO_LIBPS2=y  CONFIG_PPC_EPAPR_HV_BYTECHAN=y  CONFIG_SERIAL_8250=y  CONFIG_SERIAL_8250_CONSOLE=y -CONFIG_SERIAL_8250_EXTENDED=y  CONFIG_SERIAL_8250_MANY_PORTS=y  CONFIG_SERIAL_8250_DETECT_IRQ=y  CONFIG_SERIAL_8250_RSA=y -CONFIG_HW_RANDOM=y  CONFIG_NVRAM=y  CONFIG_I2C=y  CONFIG_I2C_CHARDEV=y @@ -132,7 +127,6 @@ CONFIG_SPI_FSL_ESPI=y  CONFIG_VIDEO_OUTPUT_CONTROL=y  CONFIG_USB_HID=m  CONFIG_USB=y -CONFIG_USB_DEVICEFS=y  CONFIG_USB_MON=y  CONFIG_USB_EHCI_HCD=y  CONFIG_USB_EHCI_FSL=y @@ -142,8 +136,6 @@ CONFIG_USB_OHCI_HCD_PPC_OF_LE=y  CONFIG_USB_STORAGE=y  CONFIG_MMC=y  CONFIG_MMC_SDHCI=y -CONFIG_MMC_SDHCI_OF=y -CONFIG_MMC_SDHCI_OF_ESDHC=y  CONFIG_EDAC=y  CONFIG_EDAC_MM_EDAC=y  CONFIG_EDAC_MPC85XX=y @@ -170,19 +162,16 @@ CONFIG_HUGETLBFS=y  CONFIG_JFFS2_FS=y  CONFIG_CRAMFS=y  CONFIG_NFS_FS=y -CONFIG_NFS_V3=y  CONFIG_NFS_V4=y  CONFIG_ROOT_NFS=y  CONFIG_NFSD=m -CONFIG_PARTITION_ADVANCED=y -CONFIG_MAC_PARTITION=y  CONFIG_NLS_ISO8859_1=y  CONFIG_NLS_UTF8=m  CONFIG_MAGIC_SYSRQ=y  CONFIG_DEBUG_SHIRQ=y  CONFIG_DETECT_HUNG_TASK=y  CONFIG_DEBUG_INFO=y -CONFIG_SYSCTL_SYSCALL_CHECK=y +CONFIG_RCU_TRACE=y  CONFIG_CRYPTO_NULL=y  CONFIG_CRYPTO_PCBC=m  CONFIG_CRYPTO_MD4=y diff --git a/arch/powerpc/configs/corenet64_smp_defconfig b/arch/powerpc/configs/corenet64_smp_defconfig index dd89de8b0b7..0516e22ca3d 100644 --- a/arch/powerpc/configs/corenet64_smp_defconfig +++ b/arch/powerpc/configs/corenet64_smp_defconfig @@ -56,6 +56,7 @@ CONFIG_INET_ESP=y  CONFIG_IPV6=y  CONFIG_IP_SCTP=m  CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" +CONFIG_DEVTMPFS=y  CONFIG_MTD=y  CONFIG_MTD_CMDLINE_PARTS=y  CONFIG_MTD_CHAR=y diff --git a/arch/powerpc/configs/g5_defconfig b/arch/powerpc/configs/g5_defconfig index 15130066e5e..07b7f2af2dc 100644 --- a/arch/powerpc/configs/g5_defconfig +++ b/arch/powerpc/configs/g5_defconfig @@ -1,8 +1,10 @@ +CONFIG_PPC64=y +CONFIG_ALTIVEC=y +CONFIG_SMP=y +CONFIG_NR_CPUS=4  CONFIG_EXPERIMENTAL=y  CONFIG_SYSVIPC=y  CONFIG_POSIX_MQUEUE=y -CONFIG_NO_HZ=y -CONFIG_HIGH_RES_TIMERS=y  CONFIG_IKCONFIG=y  CONFIG_IKCONFIG_PROC=y  CONFIG_BLK_DEV_INITRD=y @@ -13,15 +15,16 @@ CONFIG_MODULES=y  CONFIG_MODULE_UNLOAD=y  CONFIG_MODVERSIONS=y  CONFIG_MODULE_SRCVERSION_ALL=y -CONFIG_PARTITION_ADVANCED=y -CONFIG_MAC_PARTITION=y -CONFIG_SMP=y -CONFIG_NR_CPUS=4 -CONFIG_KEXEC=y -# CONFIG_RELOCATABLE is not set +# CONFIG_PPC_PSERIES is not set  CONFIG_CPU_FREQ=y  CONFIG_CPU_FREQ_GOV_POWERSAVE=y  CONFIG_CPU_FREQ_GOV_USERSPACE=y +CONFIG_CPU_FREQ_PMAC64=y +CONFIG_NO_HZ=y +CONFIG_HIGH_RES_TIMERS=y +CONFIG_KEXEC=y +CONFIG_IRQ_ALL_CPUS=y +# CONFIG_MIGRATION is not set  CONFIG_PCI_MSI=y  CONFIG_NET=y  CONFIG_PACKET=y @@ -49,6 +52,7 @@ CONFIG_NF_CT_NETLINK=m  CONFIG_NF_CONNTRACK_IPV4=m  CONFIG_IP_NF_QUEUE=m  CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" +CONFIG_PROC_DEVICETREE=y  CONFIG_BLK_DEV_LOOP=y  CONFIG_BLK_DEV_NBD=m  CONFIG_BLK_DEV_RAM=y @@ -56,6 +60,8 @@ CONFIG_BLK_DEV_RAM_SIZE=65536  CONFIG_CDROM_PKTCDVD=m  CONFIG_IDE=y  CONFIG_BLK_DEV_IDECD=y +CONFIG_BLK_DEV_IDE_PMAC=y +CONFIG_BLK_DEV_IDE_PMAC_ATA100FIRST=y  CONFIG_BLK_DEV_SD=y  CONFIG_CHR_DEV_ST=y  CONFIG_BLK_DEV_SR=y @@ -79,24 +85,33 @@ CONFIG_DM_CRYPT=m  CONFIG_DM_SNAPSHOT=m  CONFIG_DM_MIRROR=m  CONFIG_DM_ZERO=m -CONFIG_MACINTOSH_DRIVERS=y +CONFIG_IEEE1394=y +CONFIG_IEEE1394_OHCI1394=y +CONFIG_IEEE1394_SBP2=m +CONFIG_IEEE1394_ETH1394=m +CONFIG_IEEE1394_RAWIO=y +CONFIG_IEEE1394_VIDEO1394=m +CONFIG_IEEE1394_DV1394=m +CONFIG_ADB_PMU=y +CONFIG_PMAC_SMU=y  CONFIG_MAC_EMUMOUSEBTN=y +CONFIG_THERM_PM72=y +CONFIG_WINDFARM=y +CONFIG_WINDFARM_PM81=y +CONFIG_WINDFARM_PM91=y +CONFIG_WINDFARM_PM112=y +CONFIG_WINDFARM_PM121=y  CONFIG_NETDEVICES=y -CONFIG_BONDING=m  CONFIG_DUMMY=m -CONFIG_MII=y +CONFIG_BONDING=m  CONFIG_TUN=m +CONFIG_NET_ETHERNET=y +CONFIG_MII=y +CONFIG_SUNGEM=y  CONFIG_ACENIC=m  CONFIG_ACENIC_OMIT_TIGON_I=y -CONFIG_TIGON3=y  CONFIG_E1000=y -CONFIG_SUNGEM=y -CONFIG_PPP=m -CONFIG_PPP_BSDCOMP=m -CONFIG_PPP_DEFLATE=m -CONFIG_PPPOE=m -CONFIG_PPP_ASYNC=m -CONFIG_PPP_SYNC_TTY=m +CONFIG_TIGON3=y  CONFIG_USB_CATC=m  CONFIG_USB_KAWETH=m  CONFIG_USB_PEGASUS=m @@ -106,24 +121,36 @@ CONFIG_USB_USBNET=m  # CONFIG_USB_NET_NET1080 is not set  # CONFIG_USB_NET_CDC_SUBSET is not set  # CONFIG_USB_NET_ZAURUS is not set +CONFIG_PPP=m +CONFIG_PPP_ASYNC=m +CONFIG_PPP_SYNC_TTY=m +CONFIG_PPP_DEFLATE=m +CONFIG_PPP_BSDCOMP=m +CONFIG_PPPOE=m  # CONFIG_INPUT_MOUSEDEV_PSAUX is not set  CONFIG_INPUT_JOYDEV=m  CONFIG_INPUT_EVDEV=y +# CONFIG_KEYBOARD_ATKBD is not set  # CONFIG_MOUSE_PS2 is not set +# CONFIG_SERIO_I8042 is not set  # CONFIG_SERIO_SERPORT is not set -CONFIG_VT_HW_CONSOLE_BINDING=y  # CONFIG_HW_RANDOM is not set  CONFIG_GEN_RTC=y  CONFIG_RAW_DRIVER=y  CONFIG_I2C_CHARDEV=y  # CONFIG_HWMON is not set -CONFIG_AGP=y -CONFIG_DRM=y -CONFIG_DRM_NOUVEAU=y +CONFIG_AGP=m +CONFIG_AGP_UNINORTH=m  CONFIG_VIDEO_OUTPUT_CONTROL=m +CONFIG_FB=y  CONFIG_FIRMWARE_EDID=y  CONFIG_FB_TILEBLITTING=y +CONFIG_FB_OF=y +CONFIG_FB_NVIDIA=y +CONFIG_FB_NVIDIA_I2C=y  CONFIG_FB_RADEON=y +# CONFIG_VGA_CONSOLE is not set +CONFIG_FRAMEBUFFER_CONSOLE=y  CONFIG_LOGO=y  CONFIG_SOUND=m  CONFIG_SND=m @@ -131,7 +158,15 @@ CONFIG_SND_SEQUENCER=m  CONFIG_SND_MIXER_OSS=m  CONFIG_SND_PCM_OSS=m  CONFIG_SND_SEQUENCER_OSS=y +CONFIG_SND_POWERMAC=m +CONFIG_SND_AOA=m +CONFIG_SND_AOA_FABRIC_LAYOUT=m +CONFIG_SND_AOA_ONYX=m +CONFIG_SND_AOA_TAS=m +CONFIG_SND_AOA_TOONIE=m  CONFIG_SND_USB_AUDIO=m +CONFIG_HID_PID=y +CONFIG_USB_HIDDEV=y  CONFIG_HID_GYRATION=y  CONFIG_LOGITECH_FF=y  CONFIG_HID_PANTHERLORD=y @@ -139,12 +174,13 @@ CONFIG_HID_PETALYNX=y  CONFIG_HID_SAMSUNG=y  CONFIG_HID_SONY=y  CONFIG_HID_SUNPLUS=y -CONFIG_HID_PID=y -CONFIG_USB_HIDDEV=y  CONFIG_USB=y +CONFIG_USB_DEVICEFS=y  CONFIG_USB_MON=y  CONFIG_USB_EHCI_HCD=y +# CONFIG_USB_EHCI_HCD_PPC_OF is not set  CONFIG_USB_OHCI_HCD=y +CONFIG_USB_OHCI_HCD_PPC_OF_BE=y  CONFIG_USB_ACM=m  CONFIG_USB_PRINTER=y  CONFIG_USB_STORAGE=y @@ -208,6 +244,8 @@ CONFIG_REISERFS_FS_POSIX_ACL=y  CONFIG_REISERFS_FS_SECURITY=y  CONFIG_XFS_FS=m  CONFIG_XFS_POSIX_ACL=y +CONFIG_INOTIFY=y +CONFIG_AUTOFS_FS=m  CONFIG_ISO9660_FS=y  CONFIG_JOLIET=y  CONFIG_ZISOFS=y @@ -221,12 +259,14 @@ CONFIG_HFS_FS=m  CONFIG_HFSPLUS_FS=m  CONFIG_CRAMFS=y  CONFIG_NFS_FS=y +CONFIG_NFS_V3=y  CONFIG_NFS_V3_ACL=y  CONFIG_NFS_V4=y  CONFIG_NFSD=y  CONFIG_NFSD_V3_ACL=y  CONFIG_NFSD_V4=y  CONFIG_CIFS=m +CONFIG_PARTITION_ADVANCED=y  CONFIG_NLS_CODEPAGE_437=y  CONFIG_NLS_CODEPAGE_1250=y  CONFIG_NLS_CODEPAGE_1251=y @@ -234,23 +274,29 @@ CONFIG_NLS_ASCII=y  CONFIG_NLS_ISO8859_1=y  CONFIG_NLS_ISO8859_15=y  CONFIG_NLS_UTF8=y +CONFIG_CRC_T10DIF=y +CONFIG_LIBCRC32C=m  CONFIG_MAGIC_SYSRQ=y -# CONFIG_UNUSED_SYMBOLS is not set  CONFIG_DEBUG_FS=y  CONFIG_DEBUG_KERNEL=y  CONFIG_DEBUG_MUTEXES=y +# CONFIG_RCU_CPU_STALL_DETECTOR is not set  CONFIG_LATENCYTOP=y -CONFIG_STRICT_DEVMEM=y +CONFIG_SYSCTL_SYSCALL_CHECK=y +CONFIG_BOOTX_TEXT=y  CONFIG_CRYPTO_NULL=m  CONFIG_CRYPTO_TEST=m +CONFIG_CRYPTO_ECB=m  CONFIG_CRYPTO_PCBC=m  CONFIG_CRYPTO_HMAC=y +CONFIG_CRYPTO_MD4=m  CONFIG_CRYPTO_MICHAEL_MIC=m  CONFIG_CRYPTO_SHA256=m  CONFIG_CRYPTO_SHA512=m  CONFIG_CRYPTO_WP512=m  CONFIG_CRYPTO_AES=m  CONFIG_CRYPTO_ANUBIS=m +CONFIG_CRYPTO_ARC4=m  CONFIG_CRYPTO_BLOWFISH=m  CONFIG_CRYPTO_CAST5=m  CONFIG_CRYPTO_CAST6=m @@ -260,6 +306,3 @@ CONFIG_CRYPTO_TEA=m  CONFIG_CRYPTO_TWOFISH=m  # CONFIG_CRYPTO_ANSI_CPRNG is not set  # CONFIG_CRYPTO_HW is not set -# CONFIG_VIRTUALIZATION is not set -CONFIG_CRC_T10DIF=y -CONFIG_LIBCRC32C=m diff --git a/arch/powerpc/configs/mpc83xx_defconfig b/arch/powerpc/configs/mpc83xx_defconfig index 5aac9a8bc53..9352e4430c3 100644 --- a/arch/powerpc/configs/mpc83xx_defconfig +++ b/arch/powerpc/configs/mpc83xx_defconfig @@ -2,12 +2,12 @@ CONFIG_EXPERIMENTAL=y  CONFIG_SYSVIPC=y  CONFIG_LOG_BUF_SHIFT=14  CONFIG_BLK_DEV_INITRD=y -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set  CONFIG_EXPERT=y  CONFIG_SLAB=y  CONFIG_MODULES=y  CONFIG_MODULE_UNLOAD=y  # CONFIG_BLK_DEV_BSG is not set +CONFIG_PARTITION_ADVANCED=y  # CONFIG_PPC_CHRP is not set  # CONFIG_PPC_PMAC is not set  CONFIG_PPC_83xx=y @@ -25,7 +25,6 @@ CONFIG_ASP834x=y  CONFIG_QUICC_ENGINE=y  CONFIG_QE_GPIO=y  CONFIG_MATH_EMULATION=y -CONFIG_SPARSE_IRQ=y  CONFIG_PCI=y  CONFIG_NET=y  CONFIG_PACKET=y @@ -42,10 +41,9 @@ CONFIG_INET_ESP=y  # CONFIG_INET_LRO is not set  # CONFIG_IPV6 is not set  CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" +CONFIG_DEVTMPFS=y  # CONFIG_FW_LOADER is not set  CONFIG_MTD=y -CONFIG_MTD_PARTITIONS=y -CONFIG_MTD_OF_PARTS=y  CONFIG_MTD_CHAR=y  CONFIG_MTD_BLOCK=y  CONFIG_MTD_CFI=y @@ -64,15 +62,14 @@ CONFIG_ATA=y  CONFIG_SATA_FSL=y  CONFIG_SATA_SIL=y  CONFIG_NETDEVICES=y +CONFIG_MII=y +CONFIG_UCC_GETH=y +CONFIG_GIANFAR=y  CONFIG_MARVELL_PHY=y  CONFIG_DAVICOM_PHY=y  CONFIG_VITESSE_PHY=y  CONFIG_ICPLUS_PHY=y  CONFIG_FIXED_PHY=y -CONFIG_NET_ETHERNET=y -CONFIG_MII=y -CONFIG_GIANFAR=y -CONFIG_UCC_GETH=y  CONFIG_INPUT_FF_MEMLESS=m  # CONFIG_INPUT_MOUSEDEV is not set  # CONFIG_INPUT_KEYBOARD is not set @@ -112,17 +109,12 @@ CONFIG_RTC_DRV_DS1374=y  CONFIG_EXT2_FS=y  CONFIG_EXT3_FS=y  # CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set -CONFIG_INOTIFY=y  CONFIG_PROC_KCORE=y  CONFIG_TMPFS=y  CONFIG_NFS_FS=y -CONFIG_NFS_V3=y  CONFIG_NFS_V4=y  CONFIG_ROOT_NFS=y -CONFIG_PARTITION_ADVANCED=y  CONFIG_CRC_T10DIF=y -# CONFIG_RCU_CPU_STALL_DETECTOR is not set -CONFIG_SYSCTL_SYSCALL_CHECK=y  CONFIG_CRYPTO_ECB=m  CONFIG_CRYPTO_PCBC=m  CONFIG_CRYPTO_SHA256=y diff --git a/arch/powerpc/configs/mpc85xx_defconfig b/arch/powerpc/configs/mpc85xx_defconfig index 03ee911c457..8b5bda27d24 100644 --- a/arch/powerpc/configs/mpc85xx_defconfig +++ b/arch/powerpc/configs/mpc85xx_defconfig @@ -5,7 +5,9 @@ CONFIG_SYSVIPC=y  CONFIG_POSIX_MQUEUE=y  CONFIG_BSD_PROCESS_ACCT=y  CONFIG_AUDIT=y -CONFIG_SPARSE_IRQ=y +CONFIG_IRQ_DOMAIN_DEBUG=y +CONFIG_NO_HZ=y +CONFIG_HIGH_RES_TIMERS=y  CONFIG_IKCONFIG=y  CONFIG_IKCONFIG_PROC=y  CONFIG_LOG_BUF_SHIFT=14 @@ -17,6 +19,8 @@ CONFIG_MODULE_UNLOAD=y  CONFIG_MODULE_FORCE_UNLOAD=y  CONFIG_MODVERSIONS=y  # CONFIG_BLK_DEV_BSG is not set +CONFIG_PARTITION_ADVANCED=y +CONFIG_MAC_PARTITION=y  CONFIG_MPC8540_ADS=y  CONFIG_MPC8560_ADS=y  CONFIG_MPC85xx_CDS=y @@ -40,8 +44,6 @@ CONFIG_SBC8548=y  CONFIG_QUICC_ENGINE=y  CONFIG_QE_GPIO=y  CONFIG_HIGHMEM=y -CONFIG_NO_HZ=y -CONFIG_HIGH_RES_TIMERS=y  CONFIG_BINFMT_MISC=m  CONFIG_MATH_EMULATION=y  CONFIG_FORCE_MAX_ZONEORDER=12 @@ -74,36 +76,25 @@ CONFIG_INET_ESP=y  CONFIG_IPV6=y  CONFIG_IP_SCTP=m  CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" +CONFIG_DEVTMPFS=y  CONFIG_MTD=y  CONFIG_MTD_CMDLINE_PARTS=y  CONFIG_MTD_CHAR=y  CONFIG_MTD_BLOCK=y -CONFIG_MTD_CFI=y  CONFIG_FTL=y -CONFIG_MTD_GEN_PROBE=y -CONFIG_MTD_MAP_BANK_WIDTH_1=y -CONFIG_MTD_MAP_BANK_WIDTH_2=y -CONFIG_MTD_MAP_BANK_WIDTH_4=y -CONFIG_MTD_CFI_I1=y -CONFIG_MTD_CFI_I2=y +CONFIG_MTD_CFI=y  CONFIG_MTD_CFI_INTELEXT=y  CONFIG_MTD_CFI_AMDSTD=y -CONFIG_MTD_CFI_UTIL=y  CONFIG_MTD_PHYSMAP_OF=y -CONFIG_MTD_PARTITIONS=y -CONFIG_MTD_OF_PARTS=y +CONFIG_MTD_M25P80=y  CONFIG_MTD_NAND=y  CONFIG_MTD_NAND_FSL_ELBC=y  CONFIG_MTD_NAND_FSL_IFC=y -CONFIG_MTD_NAND_IDS=y -CONFIG_MTD_NAND_ECC=y -CONFIG_MTD_M25P80=y  CONFIG_PROC_DEVICETREE=y  CONFIG_BLK_DEV_LOOP=y  CONFIG_BLK_DEV_NBD=y  CONFIG_BLK_DEV_RAM=y  CONFIG_BLK_DEV_RAM_SIZE=131072 -CONFIG_MISC_DEVICES=y  CONFIG_EEPROM_LEGACY=y  CONFIG_BLK_DEV_SD=y  CONFIG_CHR_DEV_ST=y @@ -115,6 +106,7 @@ CONFIG_ATA=y  CONFIG_SATA_AHCI=y  CONFIG_SATA_FSL=y  CONFIG_PATA_ALI=y +CONFIG_PATA_VIA=y  CONFIG_NETDEVICES=y  CONFIG_DUMMY=y  CONFIG_FS_ENET=y @@ -134,7 +126,6 @@ CONFIG_SERIAL_8250=y  CONFIG_SERIAL_8250_CONSOLE=y  CONFIG_SERIAL_8250_NR_UARTS=2  CONFIG_SERIAL_8250_RUNTIME_UARTS=2 -CONFIG_SERIAL_8250_EXTENDED=y  CONFIG_SERIAL_8250_MANY_PORTS=y  CONFIG_SERIAL_8250_DETECT_IRQ=y  CONFIG_SERIAL_8250_RSA=y @@ -183,7 +174,6 @@ CONFIG_HID_SAMSUNG=y  CONFIG_HID_SONY=y  CONFIG_HID_SUNPLUS=y  CONFIG_USB=y -CONFIG_USB_DEVICEFS=y  CONFIG_USB_MON=y  CONFIG_USB_EHCI_HCD=y  CONFIG_USB_EHCI_FSL=y @@ -229,18 +219,13 @@ CONFIG_QNX4FS_FS=m  CONFIG_SYSV_FS=m  CONFIG_UFS_FS=m  CONFIG_NFS_FS=y -CONFIG_NFS_V3=y  CONFIG_NFS_V4=y  CONFIG_ROOT_NFS=y  CONFIG_NFSD=y -CONFIG_PARTITION_ADVANCED=y -CONFIG_MAC_PARTITION=y  CONFIG_CRC_T10DIF=y  CONFIG_DEBUG_FS=y  CONFIG_DETECT_HUNG_TASK=y  CONFIG_DEBUG_INFO=y -CONFIG_SYSCTL_SYSCALL_CHECK=y -CONFIG_IRQ_DOMAIN_DEBUG=y  CONFIG_CRYPTO_PCBC=m  CONFIG_CRYPTO_SHA256=y  CONFIG_CRYPTO_SHA512=y diff --git a/arch/powerpc/configs/mpc85xx_smp_defconfig b/arch/powerpc/configs/mpc85xx_smp_defconfig index fdfa84dc908..b0974e7e98a 100644 --- a/arch/powerpc/configs/mpc85xx_smp_defconfig +++ b/arch/powerpc/configs/mpc85xx_smp_defconfig @@ -7,7 +7,9 @@ CONFIG_SYSVIPC=y  CONFIG_POSIX_MQUEUE=y  CONFIG_BSD_PROCESS_ACCT=y  CONFIG_AUDIT=y -CONFIG_SPARSE_IRQ=y +CONFIG_IRQ_DOMAIN_DEBUG=y +CONFIG_NO_HZ=y +CONFIG_HIGH_RES_TIMERS=y  CONFIG_IKCONFIG=y  CONFIG_IKCONFIG_PROC=y  CONFIG_LOG_BUF_SHIFT=14 @@ -19,6 +21,8 @@ CONFIG_MODULE_UNLOAD=y  CONFIG_MODULE_FORCE_UNLOAD=y  CONFIG_MODVERSIONS=y  # CONFIG_BLK_DEV_BSG is not set +CONFIG_PARTITION_ADVANCED=y +CONFIG_MAC_PARTITION=y  CONFIG_MPC8540_ADS=y  CONFIG_MPC8560_ADS=y  CONFIG_MPC85xx_CDS=y @@ -42,8 +46,6 @@ CONFIG_SBC8548=y  CONFIG_QUICC_ENGINE=y  CONFIG_QE_GPIO=y  CONFIG_HIGHMEM=y -CONFIG_NO_HZ=y -CONFIG_HIGH_RES_TIMERS=y  CONFIG_BINFMT_MISC=m  CONFIG_MATH_EMULATION=y  CONFIG_IRQ_ALL_CPUS=y @@ -77,36 +79,25 @@ CONFIG_INET_ESP=y  CONFIG_IPV6=y  CONFIG_IP_SCTP=m  CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" +CONFIG_DEVTMPFS=y  CONFIG_MTD=y  CONFIG_MTD_CMDLINE_PARTS=y  CONFIG_MTD_CHAR=y  CONFIG_MTD_BLOCK=y -CONFIG_MTD_CFI=y  CONFIG_FTL=y -CONFIG_MTD_GEN_PROBE=y -CONFIG_MTD_MAP_BANK_WIDTH_1=y -CONFIG_MTD_MAP_BANK_WIDTH_2=y -CONFIG_MTD_MAP_BANK_WIDTH_4=y -CONFIG_MTD_CFI_I1=y -CONFIG_MTD_CFI_I2=y +CONFIG_MTD_CFI=y  CONFIG_MTD_CFI_INTELEXT=y  CONFIG_MTD_CFI_AMDSTD=y -CONFIG_MTD_CFI_UTIL=y  CONFIG_MTD_PHYSMAP_OF=y -CONFIG_MTD_PARTITIONS=y -CONFIG_MTD_OF_PARTS=y +CONFIG_MTD_M25P80=y  CONFIG_MTD_NAND=y  CONFIG_MTD_NAND_FSL_ELBC=y  CONFIG_MTD_NAND_FSL_IFC=y -CONFIG_MTD_NAND_IDS=y -CONFIG_MTD_NAND_ECC=y -CONFIG_MTD_M25P80=y  CONFIG_PROC_DEVICETREE=y  CONFIG_BLK_DEV_LOOP=y  CONFIG_BLK_DEV_NBD=y  CONFIG_BLK_DEV_RAM=y  CONFIG_BLK_DEV_RAM_SIZE=131072 -CONFIG_MISC_DEVICES=y  CONFIG_EEPROM_LEGACY=y  CONFIG_BLK_DEV_SD=y  CONFIG_CHR_DEV_ST=y @@ -137,7 +128,6 @@ CONFIG_SERIAL_8250=y  CONFIG_SERIAL_8250_CONSOLE=y  CONFIG_SERIAL_8250_NR_UARTS=2  CONFIG_SERIAL_8250_RUNTIME_UARTS=2 -CONFIG_SERIAL_8250_EXTENDED=y  CONFIG_SERIAL_8250_MANY_PORTS=y  CONFIG_SERIAL_8250_DETECT_IRQ=y  CONFIG_SERIAL_8250_RSA=y @@ -186,7 +176,6 @@ CONFIG_HID_SAMSUNG=y  CONFIG_HID_SONY=y  CONFIG_HID_SUNPLUS=y  CONFIG_USB=y -CONFIG_USB_DEVICEFS=y  CONFIG_USB_MON=y  CONFIG_USB_EHCI_HCD=y  CONFIG_USB_EHCI_FSL=y @@ -232,18 +221,13 @@ CONFIG_QNX4FS_FS=m  CONFIG_SYSV_FS=m  CONFIG_UFS_FS=m  CONFIG_NFS_FS=y -CONFIG_NFS_V3=y  CONFIG_NFS_V4=y  CONFIG_ROOT_NFS=y  CONFIG_NFSD=y -CONFIG_PARTITION_ADVANCED=y -CONFIG_MAC_PARTITION=y  CONFIG_CRC_T10DIF=y  CONFIG_DEBUG_FS=y  CONFIG_DETECT_HUNG_TASK=y  CONFIG_DEBUG_INFO=y -CONFIG_SYSCTL_SYSCALL_CHECK=y -CONFIG_IRQ_DOMAIN_DEBUG=y  CONFIG_CRYPTO_PCBC=m  CONFIG_CRYPTO_SHA256=y  CONFIG_CRYPTO_SHA512=y diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h index 50d82c8a037..b3c083de17a 100644 --- a/arch/powerpc/include/asm/cputable.h +++ b/arch/powerpc/include/asm/cputable.h @@ -553,9 +553,7 @@ static inline int cpu_has_feature(unsigned long feature)  		& feature);  } -#ifdef CONFIG_HAVE_HW_BREAKPOINT  #define HBP_NUM 1 -#endif /* CONFIG_HAVE_HW_BREAKPOINT */  #endif /* !__ASSEMBLY__ */ diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h index 50ea12fd7bf..a8bf5c673a3 100644 --- a/arch/powerpc/include/asm/kvm_host.h +++ b/arch/powerpc/include/asm/kvm_host.h @@ -33,6 +33,7 @@  #include <asm/kvm_asm.h>  #include <asm/processor.h>  #include <asm/page.h> +#include <asm/cacheflush.h>  #define KVM_MAX_VCPUS		NR_CPUS  #define KVM_MAX_VCORES		NR_CPUS diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h index 0124937a23b..e006f0bdea9 100644 --- a/arch/powerpc/include/asm/kvm_ppc.h +++ b/arch/powerpc/include/asm/kvm_ppc.h @@ -219,4 +219,16 @@ void kvmppc_claim_lpid(long lpid);  void kvmppc_free_lpid(long lpid);  void kvmppc_init_lpid(unsigned long nr_lpids); +static inline void kvmppc_mmu_flush_icache(pfn_t pfn) +{ +	/* Clear i-cache for new pages */ +	struct page *page; +	page = pfn_to_page(pfn); +	if (!test_bit(PG_arch_1, &page->flags)) { +		flush_dcache_icache_page(page); +		set_bit(PG_arch_1, &page->flags); +	} +} + +  #endif /* __POWERPC_KVM_PPC_H__ */ diff --git a/arch/powerpc/include/asm/mpic_msgr.h b/arch/powerpc/include/asm/mpic_msgr.h index 326d33ca55c..d4f471fb103 100644 --- a/arch/powerpc/include/asm/mpic_msgr.h +++ b/arch/powerpc/include/asm/mpic_msgr.h @@ -14,6 +14,7 @@  #include <linux/types.h>  #include <linux/spinlock.h>  #include <asm/smp.h> +#include <asm/io.h>  struct mpic_msgr {  	u32 __iomem *base; diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h index 53b6dfa8334..54b73a28c20 100644 --- a/arch/powerpc/include/asm/processor.h +++ b/arch/powerpc/include/asm/processor.h @@ -386,6 +386,7 @@ extern unsigned long cpuidle_disable;  enum idle_boot_override {IDLE_NO_OVERRIDE = 0, IDLE_POWERSAVE_OFF};  extern int powersave_nap;	/* set if nap mode can be used in idle loop */ +extern void power7_nap(void);  #ifdef CONFIG_PSERIES_IDLE  extern void update_smt_snooze_delay(int snooze); diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c index 85b05c463fa..e8995727b1c 100644 --- a/arch/powerpc/kernel/asm-offsets.c +++ b/arch/powerpc/kernel/asm-offsets.c @@ -76,6 +76,7 @@ int main(void)  	DEFINE(SIGSEGV, SIGSEGV);  	DEFINE(NMI_MASK, NMI_MASK);  	DEFINE(THREAD_DSCR, offsetof(struct thread_struct, dscr)); +	DEFINE(THREAD_DSCR_INHERIT, offsetof(struct thread_struct, dscr_inherit));  #else  	DEFINE(THREAD_INFO, offsetof(struct task_struct, stack));  #endif /* CONFIG_PPC64 */ diff --git a/arch/powerpc/kernel/dbell.c b/arch/powerpc/kernel/dbell.c index 5b25c8060fd..a892680668d 100644 --- a/arch/powerpc/kernel/dbell.c +++ b/arch/powerpc/kernel/dbell.c @@ -28,6 +28,8 @@ void doorbell_setup_this_cpu(void)  void doorbell_cause_ipi(int cpu, unsigned long data)  { +	/* Order previous accesses vs. msgsnd, which is treated as a store */ +	mb();  	ppc_msgsnd(PPC_DBELL, 0, data);  } diff --git a/arch/powerpc/kernel/dma-iommu.c b/arch/powerpc/kernel/dma-iommu.c index 2d7bb8ced13..e4897523de4 100644 --- a/arch/powerpc/kernel/dma-iommu.c +++ b/arch/powerpc/kernel/dma-iommu.c @@ -83,11 +83,10 @@ static int dma_iommu_dma_supported(struct device *dev, u64 mask)  		return 0;  	} -	if ((tbl->it_offset + tbl->it_size) > (mask >> IOMMU_PAGE_SHIFT)) { -		dev_info(dev, "Warning: IOMMU window too big for device mask\n"); -		dev_info(dev, "mask: 0x%08llx, table end: 0x%08lx\n", -				mask, (tbl->it_offset + tbl->it_size) << -				IOMMU_PAGE_SHIFT); +	if (tbl->it_offset > (mask >> IOMMU_PAGE_SHIFT)) { +		dev_info(dev, "Warning: IOMMU offset too big for device mask\n"); +		dev_info(dev, "mask: 0x%08llx, table offset: 0x%08lx\n", +				mask, tbl->it_offset << IOMMU_PAGE_SHIFT);  		return 0;  	} else  		return 1; diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S index 4b01a25e29e..b40e0b4815b 100644 --- a/arch/powerpc/kernel/entry_64.S +++ b/arch/powerpc/kernel/entry_64.S @@ -370,6 +370,12 @@ _GLOBAL(ret_from_fork)  	li	r3,0  	b	syscall_exit +	.section	".toc","aw" +DSCR_DEFAULT: +	.tc dscr_default[TC],dscr_default + +	.section	".text" +  /*   * This routine switches between two different tasks.  The process   * state of one is saved on its kernel stack.  Then the state @@ -509,9 +515,6 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_1T_SEGMENT)  	mr	r1,r8		/* start using new stack pointer */  	std	r7,PACAKSAVE(r13) -	ld	r6,_CCR(r1) -	mtcrf	0xFF,r6 -  #ifdef CONFIG_ALTIVEC  BEGIN_FTR_SECTION  	ld	r0,THREAD_VRSAVE(r4) @@ -520,14 +523,22 @@ END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)  #endif /* CONFIG_ALTIVEC */  #ifdef CONFIG_PPC64  BEGIN_FTR_SECTION +	lwz	r6,THREAD_DSCR_INHERIT(r4) +	ld	r7,DSCR_DEFAULT@toc(2)  	ld	r0,THREAD_DSCR(r4) -	cmpd	r0,r25 -	beq	1f +	cmpwi	r6,0 +	bne	1f +	ld	r0,0(r7) +1:	cmpd	r0,r25 +	beq	2f  	mtspr	SPRN_DSCR,r0 -1:	 +2:  END_FTR_SECTION_IFSET(CPU_FTR_DSCR)  #endif +	ld	r6,_CCR(r1) +	mtcrf	0xFF,r6 +  	/* r3-r13 are destroyed -- Cort */  	REST_8GPRS(14, r1)  	REST_10GPRS(22, r1) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index e894515e77b..39aa97d3ff8 100644 --- a/arch/powerpc/kernel/exceptions-64s.S +++ b/arch/powerpc/kernel/exceptions-64s.S @@ -186,7 +186,7 @@ hardware_interrupt_hv:  	KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0x800)  	MASKABLE_EXCEPTION_PSERIES(0x900, 0x900, decrementer) -	MASKABLE_EXCEPTION_HV(0x980, 0x982, decrementer) +	STD_EXCEPTION_HV(0x980, 0x982, hdecrementer)  	STD_EXCEPTION_PSERIES(0xa00, 0xa00, trap_0a)  	KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0xa00) @@ -486,6 +486,7 @@ machine_check_common:  	STD_EXCEPTION_COMMON_ASYNC(0x500, hardware_interrupt, do_IRQ)  	STD_EXCEPTION_COMMON_ASYNC(0x900, decrementer, .timer_interrupt) +	STD_EXCEPTION_COMMON(0x980, hdecrementer, .hdec_interrupt)  	STD_EXCEPTION_COMMON(0xa00, trap_0a, .unknown_exception)  	STD_EXCEPTION_COMMON(0xb00, trap_0b, .unknown_exception)  	STD_EXCEPTION_COMMON(0xd00, single_step, .single_step_exception) diff --git a/arch/powerpc/kernel/hw_breakpoint.c b/arch/powerpc/kernel/hw_breakpoint.c index f3a82dde61d..956a4c496de 100644 --- a/arch/powerpc/kernel/hw_breakpoint.c +++ b/arch/powerpc/kernel/hw_breakpoint.c @@ -253,7 +253,7 @@ int __kprobes hw_breakpoint_handler(struct die_args *args)  	/* Do not emulate user-space instructions, instead single-step them */  	if (user_mode(regs)) { -		bp->ctx->task->thread.last_hit_ubp = bp; +		current->thread.last_hit_ubp = bp;  		regs->msr |= MSR_SE;  		goto out;  	} diff --git a/arch/powerpc/kernel/idle_power7.S b/arch/powerpc/kernel/idle_power7.S index 7140d838339..e11863f4e59 100644 --- a/arch/powerpc/kernel/idle_power7.S +++ b/arch/powerpc/kernel/idle_power7.S @@ -28,7 +28,9 @@ _GLOBAL(power7_idle)  	lwz	r4,ADDROFF(powersave_nap)(r3)  	cmpwi	0,r4,0  	beqlr +	/* fall through */ +_GLOBAL(power7_nap)  	/* NAP is a state loss, we create a regs frame on the  	 * stack, fill it up with the state we care about and  	 * stick a pointer to it in PACAR1. We really only diff --git a/arch/powerpc/kernel/kgdb.c b/arch/powerpc/kernel/kgdb.c index 782bd0a3c2f..c470a40b29f 100644 --- a/arch/powerpc/kernel/kgdb.c +++ b/arch/powerpc/kernel/kgdb.c @@ -25,6 +25,7 @@  #include <asm/processor.h>  #include <asm/machdep.h>  #include <asm/debug.h> +#include <linux/slab.h>  /*   * This table contains the mapping between PowerPC hardware trap types, and @@ -101,6 +102,21 @@ static int computeSignal(unsigned int tt)  	return SIGHUP;		/* default for things we don't know about */  } +/** + * + *	kgdb_skipexception - Bail out of KGDB when we've been triggered. + *	@exception: Exception vector number + *	@regs: Current &struct pt_regs. + * + *	On some architectures we need to skip a breakpoint exception when + *	it occurs after a breakpoint has been removed. + * + */ +int kgdb_skipexception(int exception, struct pt_regs *regs) +{ +	return kgdb_isremovedbreak(regs->nip); +} +  static int kgdb_call_nmi_hook(struct pt_regs *regs)  {  	kgdb_nmicallback(raw_smp_processor_id(), regs); @@ -138,6 +154,8 @@ static int kgdb_handle_breakpoint(struct pt_regs *regs)  static int kgdb_singlestep(struct pt_regs *regs)  {  	struct thread_info *thread_info, *exception_thread_info; +	struct thread_info *backup_current_thread_info = \ +		(struct thread_info *)kmalloc(sizeof(struct thread_info), GFP_KERNEL);  	if (user_mode(regs))  		return 0; @@ -155,13 +173,17 @@ static int kgdb_singlestep(struct pt_regs *regs)  	thread_info = (struct thread_info *)(regs->gpr[1] & ~(THREAD_SIZE-1));  	exception_thread_info = current_thread_info(); -	if (thread_info != exception_thread_info) +	if (thread_info != exception_thread_info) { +		/* Save the original current_thread_info. */ +		memcpy(backup_current_thread_info, exception_thread_info, sizeof *thread_info);  		memcpy(exception_thread_info, thread_info, sizeof *thread_info); +	}  	kgdb_handle_exception(0, SIGTRAP, 0, regs);  	if (thread_info != exception_thread_info) -		memcpy(thread_info, exception_thread_info, sizeof *thread_info); +		/* Restore current_thread_info lastly. */ +		memcpy(exception_thread_info, backup_current_thread_info, sizeof *thread_info);  	return 1;  } @@ -410,7 +432,6 @@ int kgdb_arch_handle_exception(int vector, int signo, int err_code,  #else  			linux_regs->msr |= MSR_SE;  #endif -			kgdb_single_step = 1;  			atomic_set(&kgdb_cpu_doing_single_step,  				   raw_smp_processor_id());  		} diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index 710f400476d..1a1f2ddfb58 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c @@ -802,16 +802,8 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,  #endif /* CONFIG_PPC_STD_MMU_64 */  #ifdef CONFIG_PPC64   	if (cpu_has_feature(CPU_FTR_DSCR)) { -		if (current->thread.dscr_inherit) { -			p->thread.dscr_inherit = 1; -			p->thread.dscr = current->thread.dscr; -		} else if (0 != dscr_default) { -			p->thread.dscr_inherit = 1; -			p->thread.dscr = dscr_default; -		} else { -			p->thread.dscr_inherit = 0; -			p->thread.dscr = 0; -		} +		p->thread.dscr_inherit = current->thread.dscr_inherit; +		p->thread.dscr = current->thread.dscr;  	}  #endif diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index 0321007086f..8d4214afc21 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c @@ -198,8 +198,15 @@ void smp_muxed_ipi_message_pass(int cpu, int msg)  	struct cpu_messages *info = &per_cpu(ipi_message, cpu);  	char *message = (char *)&info->messages; +	/* +	 * Order previous accesses before accesses in the IPI handler. +	 */ +	smp_mb();  	message[msg] = 1; -	mb(); +	/* +	 * cause_ipi functions are required to include a full barrier +	 * before doing whatever causes the IPI. +	 */  	smp_ops->cause_ipi(cpu, info->data);  } @@ -211,7 +218,7 @@ irqreturn_t smp_ipi_demux(void)  	mb();	/* order any irq clear */  	do { -		all = xchg_local(&info->messages, 0); +		all = xchg(&info->messages, 0);  #ifdef __BIG_ENDIAN  		if (all & (1 << (24 - 8 * PPC_MSG_CALL_FUNCTION))) diff --git a/arch/powerpc/kernel/syscalls.c b/arch/powerpc/kernel/syscalls.c index f2496f2faec..4e3cc47f26b 100644 --- a/arch/powerpc/kernel/syscalls.c +++ b/arch/powerpc/kernel/syscalls.c @@ -107,11 +107,11 @@ long ppc64_personality(unsigned long personality)  	long ret;  	if (personality(current->personality) == PER_LINUX32 -	    && personality == PER_LINUX) -		personality = PER_LINUX32; +	    && personality(personality) == PER_LINUX) +		personality = (personality & ~PER_MASK) | PER_LINUX32;  	ret = sys_personality(personality); -	if (ret == PER_LINUX32) -		ret = PER_LINUX; +	if (personality(ret) == PER_LINUX32) +		ret = (ret & ~PER_MASK) | PER_LINUX;  	return ret;  }  #endif diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c index 3529446c2ab..8302af64921 100644 --- a/arch/powerpc/kernel/sysfs.c +++ b/arch/powerpc/kernel/sysfs.c @@ -194,6 +194,14 @@ static ssize_t show_dscr_default(struct device *dev,  	return sprintf(buf, "%lx\n", dscr_default);  } +static void update_dscr(void *dummy) +{ +	if (!current->thread.dscr_inherit) { +		current->thread.dscr = dscr_default; +		mtspr(SPRN_DSCR, dscr_default); +	} +} +  static ssize_t __used store_dscr_default(struct device *dev,  		struct device_attribute *attr, const char *buf,  		size_t count) @@ -206,6 +214,8 @@ static ssize_t __used store_dscr_default(struct device *dev,  		return -EINVAL;  	dscr_default = val; +	on_each_cpu(update_dscr, NULL, 1); +  	return count;  } diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c index be171ee73bf..e49e93191b6 100644 --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c @@ -535,6 +535,15 @@ void timer_interrupt(struct pt_regs * regs)  	trace_timer_interrupt_exit(regs);  } +/* + * Hypervisor decrementer interrupts shouldn't occur but are sometimes + * left pending on exit from a KVM guest.  We don't need to do anything + * to clear them, as they are edge-triggered. + */ +void hdec_interrupt(struct pt_regs *regs) +{ +} +  #ifdef CONFIG_SUSPEND  static void generic_suspend_disable_irqs(void)  { diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c index 158972341a2..ae0843fa7a6 100644 --- a/arch/powerpc/kernel/traps.c +++ b/arch/powerpc/kernel/traps.c @@ -972,8 +972,9 @@ static int emulate_instruction(struct pt_regs *regs)  			cpu_has_feature(CPU_FTR_DSCR)) {  		PPC_WARN_EMULATED(mtdscr, regs);  		rd = (instword >> 21) & 0x1f; -		mtspr(SPRN_DSCR, regs->gpr[rd]); +		current->thread.dscr = regs->gpr[rd];  		current->thread.dscr_inherit = 1; +		mtspr(SPRN_DSCR, current->thread.dscr);  		return 0;  	}  #endif diff --git a/arch/powerpc/kvm/book3s_32_mmu_host.c b/arch/powerpc/kvm/book3s_32_mmu_host.c index f922c29bb23..837f13e7b6b 100644 --- a/arch/powerpc/kvm/book3s_32_mmu_host.c +++ b/arch/powerpc/kvm/book3s_32_mmu_host.c @@ -211,6 +211,9 @@ next_pteg:  		pteg1 |= PP_RWRX;  	} +	if (orig_pte->may_execute) +		kvmppc_mmu_flush_icache(hpaddr >> PAGE_SHIFT); +  	local_irq_disable();  	if (pteg[rr]) { diff --git a/arch/powerpc/kvm/book3s_64_mmu_host.c b/arch/powerpc/kvm/book3s_64_mmu_host.c index 10fc8ec9d2a..0688b6b3958 100644 --- a/arch/powerpc/kvm/book3s_64_mmu_host.c +++ b/arch/powerpc/kvm/book3s_64_mmu_host.c @@ -126,6 +126,8 @@ int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *orig_pte)  	if (!orig_pte->may_execute)  		rflags |= HPTE_R_N; +	else +		kvmppc_mmu_flush_icache(hpaddr >> PAGE_SHIFT);  	hash = hpt_hash(va, PTE_SIZE, MMU_SEGSIZE_256M); diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S index 5a84c8d3d04..44b72feaff7 100644 --- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S +++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S @@ -1421,13 +1421,13 @@ _GLOBAL(kvmppc_h_cede)  	sync			/* order setting ceded vs. testing prodded */  	lbz	r5,VCPU_PRODDED(r3)  	cmpwi	r5,0 -	bne	1f +	bne	kvm_cede_prodded  	li	r0,0		/* set trap to 0 to say hcall is handled */  	stw	r0,VCPU_TRAP(r3)  	li	r0,H_SUCCESS  	std	r0,VCPU_GPR(R3)(r3)  BEGIN_FTR_SECTION -	b	2f		/* just send it up to host on 970 */ +	b	kvm_cede_exit	/* just send it up to host on 970 */  END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_206)  	/* @@ -1446,7 +1446,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_206)  	or	r4,r4,r0  	PPC_POPCNTW(R7,R4)  	cmpw	r7,r8 -	bge	2f +	bge	kvm_cede_exit  	stwcx.	r4,0,r6  	bne	31b  	li	r0,1 @@ -1555,7 +1555,8 @@ kvm_end_cede:  	b	hcall_real_fallback  	/* cede when already previously prodded case */ -1:	li	r0,0 +kvm_cede_prodded: +	li	r0,0  	stb	r0,VCPU_PRODDED(r3)  	sync			/* order testing prodded vs. clearing ceded */  	stb	r0,VCPU_CEDED(r3) @@ -1563,7 +1564,8 @@ kvm_end_cede:  	blr  	/* we've ceded but we want to give control to the host */ -2:	li	r3,H_TOO_HARD +kvm_cede_exit: +	li	r3,H_TOO_HARD  	blr  secondary_too_late: diff --git a/arch/powerpc/kvm/e500_tlb.c b/arch/powerpc/kvm/e500_tlb.c index c510fc96130..a2b66717813 100644 --- a/arch/powerpc/kvm/e500_tlb.c +++ b/arch/powerpc/kvm/e500_tlb.c @@ -322,11 +322,11 @@ static inline void kvmppc_e500_ref_release(struct tlbe_ref *ref)  static void clear_tlb1_bitmap(struct kvmppc_vcpu_e500 *vcpu_e500)  {  	if (vcpu_e500->g2h_tlb1_map) -		memset(vcpu_e500->g2h_tlb1_map, -		       sizeof(u64) * vcpu_e500->gtlb_params[1].entries, 0); +		memset(vcpu_e500->g2h_tlb1_map, 0, +		       sizeof(u64) * vcpu_e500->gtlb_params[1].entries);  	if (vcpu_e500->h2g_tlb1_rmap) -		memset(vcpu_e500->h2g_tlb1_rmap, -		       sizeof(unsigned int) * host_tlb_params[1].entries, 0); +		memset(vcpu_e500->h2g_tlb1_rmap, 0, +		       sizeof(unsigned int) * host_tlb_params[1].entries);  }  static void clear_tlb_privs(struct kvmppc_vcpu_e500 *vcpu_e500) @@ -539,6 +539,9 @@ static inline void kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500,  	kvmppc_e500_setup_stlbe(&vcpu_e500->vcpu, gtlbe, tsize,  				ref, gvaddr, stlbe); + +	/* Clear i-cache for new pages */ +	kvmppc_mmu_flush_icache(pfn);  }  /* XXX only map the one-one case, for now use TLB0 */ diff --git a/arch/powerpc/lib/code-patching.c b/arch/powerpc/lib/code-patching.c index dd223b3eb33..17e5b236431 100644 --- a/arch/powerpc/lib/code-patching.c +++ b/arch/powerpc/lib/code-patching.c @@ -20,7 +20,7 @@ int patch_instruction(unsigned int *addr, unsigned int instr)  {  	int err; -	err = __put_user(instr, addr); +	__put_user_size(instr, addr, 4, err);  	if (err)  		return err;  	asm ("dcbst 0, %0; sync; icbi 0,%0; sync; isync" : : "r" (addr)); diff --git a/arch/powerpc/lib/copyuser_power7.S b/arch/powerpc/lib/copyuser_power7.S index f9ede7c6606..0d24ff15f5f 100644 --- a/arch/powerpc/lib/copyuser_power7.S +++ b/arch/powerpc/lib/copyuser_power7.S @@ -288,7 +288,7 @@ err1;	stb	r0,0(r3)  	std	r0,16(r1)  	stdu	r1,-STACKFRAMESIZE(r1)  	bl	.enter_vmx_usercopy -	cmpwi	r3,0 +	cmpwi	cr1,r3,0  	ld	r0,STACKFRAMESIZE+16(r1)  	ld	r3,STACKFRAMESIZE+48(r1)  	ld	r4,STACKFRAMESIZE+56(r1) @@ -326,38 +326,7 @@ err1;	stb	r0,0(r3)  	dcbt	r0,r8,0b01010	/* GO */  .machine pop -	/* -	 * We prefetch both the source and destination using enhanced touch -	 * instructions. We use a stream ID of 0 for the load side and -	 * 1 for the store side. -	 */ -	clrrdi	r6,r4,7 -	clrrdi	r9,r3,7 -	ori	r9,r9,1		/* stream=1 */ - -	srdi	r7,r5,7		/* length in cachelines, capped at 0x3FF */ -	cmpldi	cr1,r7,0x3FF -	ble	cr1,1f -	li	r7,0x3FF -1:	lis	r0,0x0E00	/* depth=7 */ -	sldi	r7,r7,7 -	or	r7,r7,r0 -	ori	r10,r7,1	/* stream=1 */ - -	lis	r8,0x8000	/* GO=1 */ -	clrldi	r8,r8,32 - -.machine push -.machine "power4" -	dcbt	r0,r6,0b01000 -	dcbt	r0,r7,0b01010 -	dcbtst	r0,r9,0b01000 -	dcbtst	r0,r10,0b01010 -	eieio -	dcbt	r0,r8,0b01010	/* GO */ -.machine pop - -	beq	.Lunwind_stack_nonvmx_copy +	beq	cr1,.Lunwind_stack_nonvmx_copy  	/*  	 * If source and destination are not relatively aligned we use a diff --git a/arch/powerpc/lib/memcpy_power7.S b/arch/powerpc/lib/memcpy_power7.S index 0efdc51bc71..7ba6c96de77 100644 --- a/arch/powerpc/lib/memcpy_power7.S +++ b/arch/powerpc/lib/memcpy_power7.S @@ -222,7 +222,7 @@ _GLOBAL(memcpy_power7)  	std	r0,16(r1)  	stdu	r1,-STACKFRAMESIZE(r1)  	bl	.enter_vmx_copy -	cmpwi	r3,0 +	cmpwi	cr1,r3,0  	ld	r0,STACKFRAMESIZE+16(r1)  	ld	r3,STACKFRAMESIZE+48(r1)  	ld	r4,STACKFRAMESIZE+56(r1) @@ -260,7 +260,7 @@ _GLOBAL(memcpy_power7)  	dcbt	r0,r8,0b01010	/* GO */  .machine pop -	beq	.Lunwind_stack_nonvmx_copy +	beq	cr1,.Lunwind_stack_nonvmx_copy  	/*  	 * If source and destination are not relatively aligned we use a diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c index baaafde7d13..fbdad0e3929 100644 --- a/arch/powerpc/mm/mem.c +++ b/arch/powerpc/mm/mem.c @@ -469,6 +469,7 @@ void flush_dcache_icache_page(struct page *page)  	__flush_dcache_icache_phys(page_to_pfn(page) << PAGE_SHIFT);  #endif  } +EXPORT_SYMBOL(flush_dcache_icache_page);  void clear_user_page(void *page, unsigned long vaddr, struct page *pg)  { diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c index 39b159751c3..59213cfaeca 100644 --- a/arch/powerpc/mm/numa.c +++ b/arch/powerpc/mm/numa.c @@ -1436,11 +1436,11 @@ static long vphn_get_associativity(unsigned long cpu,  /*   * Update the node maps and sysfs entries for each cpu whose home node - * has changed. + * has changed. Returns 1 when the topology has changed, and 0 otherwise.   */  int arch_update_cpu_topology(void)  { -	int cpu, nid, old_nid; +	int cpu, nid, old_nid, changed = 0;  	unsigned int associativity[VPHN_ASSOC_BUFSIZE] = {0};  	struct device *dev; @@ -1466,9 +1466,10 @@ int arch_update_cpu_topology(void)  		dev = get_cpu_device(cpu);  		if (dev)  			kobject_uevent(&dev->kobj, KOBJ_CHANGE); +		changed = 1;  	} -	return 1; +	return changed;  }  static void topology_work_fn(struct work_struct *work) diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c index 77b49ddda9d..7cd2dbd6e4c 100644 --- a/arch/powerpc/perf/core-book3s.c +++ b/arch/powerpc/perf/core-book3s.c @@ -1431,7 +1431,7 @@ static void perf_event_interrupt(struct pt_regs *regs)  		if (!event->hw.idx || is_limited_pmc(event->hw.idx))  			continue;  		val = read_pmc(event->hw.idx); -		if ((int)val < 0) { +		if (pmc_overflow(val)) {  			/* event has overflowed */  			found = 1;  			record_and_restart(event, val, regs); diff --git a/arch/powerpc/platforms/powernv/smp.c b/arch/powerpc/platforms/powernv/smp.c index 3ef46254c35..7698b6e13c5 100644 --- a/arch/powerpc/platforms/powernv/smp.c +++ b/arch/powerpc/platforms/powernv/smp.c @@ -106,14 +106,6 @@ static void pnv_smp_cpu_kill_self(void)  {  	unsigned int cpu; -	/* If powersave_nap is enabled, use NAP mode, else just -	 * spin aimlessly -	 */ -	if (!powersave_nap) { -		generic_mach_cpu_die(); -		return; -	} -  	/* Standard hot unplug procedure */  	local_irq_disable();  	idle_task_exit(); @@ -128,7 +120,7 @@ static void pnv_smp_cpu_kill_self(void)  	 */  	mtspr(SPRN_LPCR, mfspr(SPRN_LPCR) & ~(u64)LPCR_PECE1);  	while (!generic_check_cpu_restart(cpu)) { -		power7_idle(); +		power7_nap();  		if (!generic_check_cpu_restart(cpu)) {  			DBG("CPU%d Unexpected exit while offline !\n", cpu);  			/* We may be getting an IPI, so we re-enable diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c index a7b2a600d0a..c37f4613632 100644 --- a/arch/powerpc/sysdev/fsl_pci.c +++ b/arch/powerpc/sysdev/fsl_pci.c @@ -465,7 +465,7 @@ int __init fsl_add_bridge(struct device_node *dev, int is_primary)  			iounmap(hose->cfg_data);  		iounmap(hose->cfg_addr);  		pcibios_free_controller(hose); -		return 0; +		return -ENODEV;  	}  	setup_pci_cmd(hose); @@ -827,6 +827,7 @@ struct device_node *fsl_pci_primary;  void __devinit fsl_pci_init(void)  { +	int ret;  	struct device_node *node;  	struct pci_controller *hose;  	dma_addr_t max = 0xffffffff; @@ -855,10 +856,12 @@ void __devinit fsl_pci_init(void)  			if (!fsl_pci_primary)  				fsl_pci_primary = node; -			fsl_add_bridge(node, fsl_pci_primary == node); -			hose = pci_find_hose_for_OF_device(node); -			max = min(max, hose->dma_window_base_cur + -					hose->dma_window_size); +			ret = fsl_add_bridge(node, fsl_pci_primary == node); +			if (ret == 0) { +				hose = pci_find_hose_for_OF_device(node); +				max = min(max, hose->dma_window_base_cur + +						hose->dma_window_size); +			}  		}  	} diff --git a/arch/powerpc/sysdev/mpic_msgr.c b/arch/powerpc/sysdev/mpic_msgr.c index 483d8fa72e8..e961f8c4a8f 100644 --- a/arch/powerpc/sysdev/mpic_msgr.c +++ b/arch/powerpc/sysdev/mpic_msgr.c @@ -14,6 +14,9 @@  #include <linux/list.h>  #include <linux/of_platform.h>  #include <linux/errno.h> +#include <linux/err.h> +#include <linux/export.h> +#include <linux/slab.h>  #include <asm/prom.h>  #include <asm/hw_irq.h>  #include <asm/ppc-pci.h> diff --git a/arch/powerpc/sysdev/xics/icp-hv.c b/arch/powerpc/sysdev/xics/icp-hv.c index 14469cf9df6..df0fc582146 100644 --- a/arch/powerpc/sysdev/xics/icp-hv.c +++ b/arch/powerpc/sysdev/xics/icp-hv.c @@ -65,7 +65,11 @@ static inline void icp_hv_set_xirr(unsigned int value)  static inline void icp_hv_set_qirr(int n_cpu , u8 value)  {  	int hw_cpu = get_hard_smp_processor_id(n_cpu); -	long rc = plpar_hcall_norets(H_IPI, hw_cpu, value); +	long rc; + +	/* Make sure all previous accesses are ordered before IPI sending */ +	mb(); +	rc = plpar_hcall_norets(H_IPI, hw_cpu, value);  	if (rc != H_SUCCESS) {  		pr_err("%s: bad return code qirr cpu=%d hw_cpu=%d mfrr=0x%x "  			"returned %ld\n", __func__, n_cpu, hw_cpu, value, rc); diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c index eab3492a45c..9b49c65ee7a 100644 --- a/arch/powerpc/xmon/xmon.c +++ b/arch/powerpc/xmon/xmon.c @@ -17,6 +17,7 @@  #include <linux/reboot.h>  #include <linux/delay.h>  #include <linux/kallsyms.h> +#include <linux/kmsg_dump.h>  #include <linux/cpumask.h>  #include <linux/export.h>  #include <linux/sysrq.h> @@ -894,13 +895,13 @@ cmds(struct pt_regs *excp)  #endif  		default:  			printf("Unrecognized command: "); -		        do { +			do {  				if (' ' < cmd && cmd <= '~')  					putchar(cmd);  				else  					printf("\\x%x", cmd);  				cmd = inchar(); -		        } while (cmd != '\n');  +			} while (cmd != '\n');  			printf(" (type ? for help)\n");  			break;  		} @@ -1097,7 +1098,7 @@ static long check_bp_loc(unsigned long addr)  	return 1;  } -static char *breakpoint_help_string =  +static char *breakpoint_help_string =      "Breakpoint command usage:\n"      "b                show breakpoints\n"      "b <addr> [cnt]   set breakpoint at given instr addr\n" @@ -1193,7 +1194,7 @@ bpt_cmds(void)  	default:  		termch = cmd; -	        cmd = skipbl(); +		cmd = skipbl();  		if (cmd == '?') {  			printf(breakpoint_help_string);  			break; @@ -1359,7 +1360,7 @@ static void xmon_show_stack(unsigned long sp, unsigned long lr,  				       sp + REGS_OFFSET);  				break;  			} -                        printf("--- Exception: %lx %s at ", regs.trap, +			printf("--- Exception: %lx %s at ", regs.trap,  			       getvecname(TRAP(®s)));  			pc = regs.nip;  			lr = regs.link; @@ -1623,14 +1624,14 @@ static void super_regs(void)  	cmd = skipbl();  	if (cmd == '\n') { -	        unsigned long sp, toc; +		unsigned long sp, toc;  		asm("mr %0,1" : "=r" (sp) :);  		asm("mr %0,2" : "=r" (toc) :);  		printf("msr  = "REG"  sprg0= "REG"\n",  		       mfmsr(), mfspr(SPRN_SPRG0));  		printf("pvr  = "REG"  sprg1= "REG"\n", -		       mfspr(SPRN_PVR), mfspr(SPRN_SPRG1));  +		       mfspr(SPRN_PVR), mfspr(SPRN_SPRG1));  		printf("dec  = "REG"  sprg2= "REG"\n",  		       mfspr(SPRN_DEC), mfspr(SPRN_SPRG2));  		printf("sp   = "REG"  sprg3= "REG"\n", sp, mfspr(SPRN_SPRG3)); @@ -1783,7 +1784,7 @@ byterev(unsigned char *val, int size)  static int brev;  static int mnoread; -static char *memex_help_string =  +static char *memex_help_string =      "Memory examine command usage:\n"      "m [addr] [flags] examine/change memory\n"      "  addr is optional.  will start where left off.\n" @@ -1798,7 +1799,7 @@ static char *memex_help_string =      "NOTE: flags are saved as defaults\n"      ""; -static char *memex_subcmd_help_string =  +static char *memex_subcmd_help_string =      "Memory examine subcommands:\n"      "  hexval   write this val to current location\n"      "  'string' write chars from string to this location\n" @@ -2064,7 +2065,7 @@ prdump(unsigned long adrs, long ndump)  		nr = mread(adrs, temp, r);  		adrs += nr;  		for (m = 0; m < r; ++m) { -		        if ((m & (sizeof(long) - 1)) == 0 && m > 0) +			if ((m & (sizeof(long) - 1)) == 0 && m > 0)  				putchar(' ');  			if (m < nr)  				printf("%.2x", temp[m]); @@ -2072,7 +2073,7 @@ prdump(unsigned long adrs, long ndump)  				printf("%s", fault_chars[fault_type]);  		}  		for (; m < 16; ++m) { -		        if ((m & (sizeof(long) - 1)) == 0) +			if ((m & (sizeof(long) - 1)) == 0)  				putchar(' ');  			printf("  ");  		} @@ -2148,45 +2149,28 @@ print_address(unsigned long addr)  void  dump_log_buf(void)  { -        const unsigned long size = 128; -        unsigned long end, addr; -        unsigned char buf[size + 1]; - -        addr = 0; -        buf[size] = '\0'; - -        if (setjmp(bus_error_jmp) != 0) { -                printf("Unable to lookup symbol __log_buf!\n"); -                return; -        } - -        catch_memory_errors = 1; -        sync(); -        addr = kallsyms_lookup_name("__log_buf"); - -        if (! addr) -                printf("Symbol __log_buf not found!\n"); -        else { -                end = addr + (1 << CONFIG_LOG_BUF_SHIFT); -                while (addr < end) { -                        if (! mread(addr, buf, size)) { -                                printf("Can't read memory at address 0x%lx\n", addr); -                                break; -                        } +	struct kmsg_dumper dumper = { .active = 1 }; +	unsigned char buf[128]; +	size_t len; -                        printf("%s", buf); +	if (setjmp(bus_error_jmp) != 0) { +		printf("Error dumping printk buffer!\n"); +		return; +	} -                        if (strlen(buf) < size) -                                break; +	catch_memory_errors = 1; +	sync(); -                        addr += size; -                } -        } +	kmsg_dump_rewind_nolock(&dumper); +	while (kmsg_dump_get_line_nolock(&dumper, false, buf, sizeof(buf), &len)) { +		buf[len] = '\0'; +		printf("%s", buf); +	} -        sync(); -        /* wait a little while to see if we get a machine check */ -        __delay(200); -        catch_memory_errors = 0; +	sync(); +	/* wait a little while to see if we get a machine check */ +	__delay(200); +	catch_memory_errors = 0;  }  /* diff --git a/arch/s390/include/asm/elf.h b/arch/s390/include/asm/elf.h index 32e8449640f..9b94a160fe7 100644 --- a/arch/s390/include/asm/elf.h +++ b/arch/s390/include/asm/elf.h @@ -180,7 +180,8 @@ extern char elf_platform[];  #define ELF_PLATFORM (elf_platform)  #ifndef CONFIG_64BIT -#define SET_PERSONALITY(ex) set_personality(PER_LINUX) +#define SET_PERSONALITY(ex) \ +	set_personality(PER_LINUX | (current->personality & (~PER_MASK)))  #else /* CONFIG_64BIT */  #define SET_PERSONALITY(ex)					\  do {								\ diff --git a/arch/s390/include/asm/posix_types.h b/arch/s390/include/asm/posix_types.h index 7bcc14e395f..bf2a2ad2f80 100644 --- a/arch/s390/include/asm/posix_types.h +++ b/arch/s390/include/asm/posix_types.h @@ -13,6 +13,7 @@   */  typedef unsigned long   __kernel_size_t; +typedef long            __kernel_ssize_t;  #define __kernel_size_t __kernel_size_t  typedef unsigned short	__kernel_old_dev_t; @@ -25,7 +26,6 @@ typedef unsigned short  __kernel_mode_t;  typedef unsigned short  __kernel_ipc_pid_t;  typedef unsigned short  __kernel_uid_t;  typedef unsigned short  __kernel_gid_t; -typedef int             __kernel_ssize_t;  typedef int             __kernel_ptrdiff_t;  #else /* __s390x__ */ @@ -35,7 +35,6 @@ typedef unsigned int    __kernel_mode_t;  typedef int             __kernel_ipc_pid_t;  typedef unsigned int    __kernel_uid_t;  typedef unsigned int    __kernel_gid_t; -typedef long            __kernel_ssize_t;  typedef long            __kernel_ptrdiff_t;  typedef unsigned long   __kernel_sigset_t;      /* at least 32 bits */ diff --git a/arch/s390/include/asm/smp.h b/arch/s390/include/asm/smp.h index a0a8340daaf..ce26ac3cb16 100644 --- a/arch/s390/include/asm/smp.h +++ b/arch/s390/include/asm/smp.h @@ -44,6 +44,7 @@ static inline void smp_call_online_cpu(void (*func)(void *), void *data)  }  static inline int smp_find_processor_id(int address) { return 0; } +static inline int smp_store_status(int cpu) { return 0; }  static inline int smp_vcpu_scheduled(int cpu) { return 1; }  static inline void smp_yield_cpu(int cpu) { }  static inline void smp_yield(void) { } diff --git a/arch/s390/oprofile/init.c b/arch/s390/oprofile/init.c index a1e9d69a9c9..584b93674ea 100644 --- a/arch/s390/oprofile/init.c +++ b/arch/s390/oprofile/init.c @@ -169,7 +169,7 @@ static ssize_t hw_interval_write(struct file *file, char const __user *buf,  	if (*offset)  		return -EINVAL;  	retval = oprofilefs_ulong_from_user(&val, buf, count); -	if (retval) +	if (retval <= 0)  		return retval;  	if (val < oprofile_min_interval)  		oprofile_hw_interval = oprofile_min_interval; @@ -212,7 +212,7 @@ static ssize_t hwsampler_zero_write(struct file *file, char const __user *buf,  		return -EINVAL;  	retval = oprofilefs_ulong_from_user(&val, buf, count); -	if (retval) +	if (retval <= 0)  		return retval;  	if (val != 0)  		return -EINVAL; @@ -243,7 +243,7 @@ static ssize_t hwsampler_kernel_write(struct file *file, char const __user *buf,  		return -EINVAL;  	retval = oprofilefs_ulong_from_user(&val, buf, count); -	if (retval) +	if (retval <= 0)  		return retval;  	if (val != 0 && val != 1) @@ -278,7 +278,7 @@ static ssize_t hwsampler_user_write(struct file *file, char const __user *buf,  		return -EINVAL;  	retval = oprofilefs_ulong_from_user(&val, buf, count); -	if (retval) +	if (retval <= 0)  		return retval;  	if (val != 0 && val != 1) @@ -317,7 +317,7 @@ static ssize_t timer_enabled_write(struct file *file, char const __user *buf,  		return -EINVAL;  	retval = oprofilefs_ulong_from_user(&val, buf, count); -	if (retval) +	if (retval <= 0)  		return retval;  	if (val != 0 && val != 1) diff --git a/arch/um/os-Linux/time.c b/arch/um/os-Linux/time.c index f60238559af..0748fe0c8a7 100644 --- a/arch/um/os-Linux/time.c +++ b/arch/um/os-Linux/time.c @@ -114,7 +114,7 @@ static void deliver_alarm(void)  	skew += this_tick - last_tick;  	while (skew >= one_tick) { -		alarm_handler(SIGVTALRM, NULL); +		alarm_handler(SIGVTALRM, NULL, NULL);  		skew -= one_tick;  	} diff --git a/arch/x86/include/asm/spinlock.h b/arch/x86/include/asm/spinlock.h index b315a33867f..33692eaabab 100644 --- a/arch/x86/include/asm/spinlock.h +++ b/arch/x86/include/asm/spinlock.h @@ -12,8 +12,7 @@   * Simple spin lock operations.  There are two variants, one clears IRQ's   * on the local processor, one does not.   * - * These are fair FIFO ticket locks, which are currently limited to 256 - * CPUs. + * These are fair FIFO ticket locks, which support up to 2^16 CPUs.   *   * (the type definitions are in asm/spinlock_types.h)   */ diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c index afb7ff79a29..ced4534baed 100644 --- a/arch/x86/kernel/alternative.c +++ b/arch/x86/kernel/alternative.c @@ -165,7 +165,7 @@ static const unsigned char * const k7_nops[ASM_NOP_MAX+2] =  #endif  #ifdef P6_NOP1 -static const unsigned char  __initconst_or_module p6nops[] = +static const unsigned char p6nops[] =  {  	P6_NOP1,  	P6_NOP2, diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c index 7f2739e03e7..0d3d63afa76 100644 --- a/arch/x86/kernel/cpu/perf_event_intel.c +++ b/arch/x86/kernel/cpu/perf_event_intel.c @@ -2008,6 +2008,7 @@ __init int intel_pmu_init(void)  		break;  	case 28: /* Atom */ +	case 54: /* Cedariew */  		memcpy(hw_cache_event_ids, atom_hw_cache_event_ids,  		       sizeof(hw_cache_event_ids)); diff --git a/arch/x86/kernel/cpu/perf_event_intel_lbr.c b/arch/x86/kernel/cpu/perf_event_intel_lbr.c index 520b4265fcd..da02e9cc375 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_lbr.c +++ b/arch/x86/kernel/cpu/perf_event_intel_lbr.c @@ -686,7 +686,8 @@ void intel_pmu_lbr_init_atom(void)  	 * to have an operational LBR which can freeze  	 * on PMU interrupt  	 */ -	if (boot_cpu_data.x86_mask < 10) { +	if (boot_cpu_data.x86_model == 28 +	    && boot_cpu_data.x86_mask < 10) {  		pr_cont("LBR disabled due to erratum");  		return;  	} diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c index 7ad683d7864..d44f7829968 100644 --- a/arch/x86/kernel/irq.c +++ b/arch/x86/kernel/irq.c @@ -270,7 +270,7 @@ void fixup_irqs(void)  		if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) {  			break_affinity = 1; -			affinity = cpu_all_mask; +			affinity = cpu_online_mask;  		}  		chip = irq_data_get_irq_chip(data); diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c index 8a2ce8fd41c..82746f942cd 100644 --- a/arch/x86/kernel/microcode_amd.c +++ b/arch/x86/kernel/microcode_amd.c @@ -143,11 +143,12 @@ static int get_matching_microcode(int cpu, const u8 *ucode_ptr,  				  unsigned int *current_size)  {  	struct microcode_header_amd *mc_hdr; -	unsigned int actual_size; +	unsigned int actual_size, patch_size;  	u16 equiv_cpu_id;  	/* size of the current patch we're staring at */ -	*current_size = *(u32 *)(ucode_ptr + 4) + SECTION_HDR_SIZE; +	patch_size = *(u32 *)(ucode_ptr + 4); +	*current_size = patch_size + SECTION_HDR_SIZE;  	equiv_cpu_id = find_equiv_id();  	if (!equiv_cpu_id) @@ -174,7 +175,7 @@ static int get_matching_microcode(int cpu, const u8 *ucode_ptr,  	/*  	 * now that the header looks sane, verify its size  	 */ -	actual_size = verify_ucode_size(cpu, *current_size, leftover_size); +	actual_size = verify_ucode_size(cpu, patch_size, leftover_size);  	if (!actual_size)  		return 0; diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c index 4873e62db6a..9e5bcf1e237 100644 --- a/arch/x86/kernel/microcode_core.c +++ b/arch/x86/kernel/microcode_core.c @@ -225,6 +225,9 @@ static ssize_t microcode_write(struct file *file, const char __user *buf,  	if (do_microcode_update(buf, len) == 0)  		ret = (ssize_t)len; +	if (ret > 0) +		perf_check_microcode(); +  	mutex_unlock(µcode_mutex);  	put_online_cpus(); diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 97d9a9914ba..a3b57a27be8 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -475,13 +475,26 @@ register_address(struct x86_emulate_ctxt *ctxt, unsigned long reg)  	return address_mask(ctxt, reg);  } +static void masked_increment(ulong *reg, ulong mask, int inc) +{ +	assign_masked(reg, *reg + inc, mask); +} +  static inline void  register_address_increment(struct x86_emulate_ctxt *ctxt, unsigned long *reg, int inc)  { +	ulong mask; +  	if (ctxt->ad_bytes == sizeof(unsigned long)) -		*reg += inc; +		mask = ~0UL;  	else -		*reg = (*reg & ~ad_mask(ctxt)) | ((*reg + inc) & ad_mask(ctxt)); +		mask = ad_mask(ctxt); +	masked_increment(reg, mask, inc); +} + +static void rsp_increment(struct x86_emulate_ctxt *ctxt, int inc) +{ +	masked_increment(&ctxt->regs[VCPU_REGS_RSP], stack_mask(ctxt), inc);  }  static inline void jmp_rel(struct x86_emulate_ctxt *ctxt, int rel) @@ -1522,8 +1535,8 @@ static int push(struct x86_emulate_ctxt *ctxt, void *data, int bytes)  {  	struct segmented_address addr; -	register_address_increment(ctxt, &ctxt->regs[VCPU_REGS_RSP], -bytes); -	addr.ea = register_address(ctxt, ctxt->regs[VCPU_REGS_RSP]); +	rsp_increment(ctxt, -bytes); +	addr.ea = ctxt->regs[VCPU_REGS_RSP] & stack_mask(ctxt);  	addr.seg = VCPU_SREG_SS;  	return segmented_write(ctxt, addr, data, bytes); @@ -1542,13 +1555,13 @@ static int emulate_pop(struct x86_emulate_ctxt *ctxt,  	int rc;  	struct segmented_address addr; -	addr.ea = register_address(ctxt, ctxt->regs[VCPU_REGS_RSP]); +	addr.ea = ctxt->regs[VCPU_REGS_RSP] & stack_mask(ctxt);  	addr.seg = VCPU_SREG_SS;  	rc = segmented_read(ctxt, addr, dest, len);  	if (rc != X86EMUL_CONTINUE)  		return rc; -	register_address_increment(ctxt, &ctxt->regs[VCPU_REGS_RSP], len); +	rsp_increment(ctxt, len);  	return rc;  } @@ -1688,8 +1701,7 @@ static int em_popa(struct x86_emulate_ctxt *ctxt)  	while (reg >= VCPU_REGS_RAX) {  		if (reg == VCPU_REGS_RSP) { -			register_address_increment(ctxt, &ctxt->regs[VCPU_REGS_RSP], -							ctxt->op_bytes); +			rsp_increment(ctxt, ctxt->op_bytes);  			--reg;  		} @@ -2825,7 +2837,7 @@ static int em_ret_near_imm(struct x86_emulate_ctxt *ctxt)  	rc = emulate_pop(ctxt, &ctxt->dst.val, ctxt->op_bytes);  	if (rc != X86EMUL_CONTINUE)  		return rc; -	register_address_increment(ctxt, &ctxt->regs[VCPU_REGS_RSP], ctxt->src.val); +	rsp_increment(ctxt, ctxt->src.val);  	return X86EMUL_CONTINUE;  } diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c index e498b18f010..9fc9aa7ac70 100644 --- a/arch/x86/kvm/i8259.c +++ b/arch/x86/kvm/i8259.c @@ -318,7 +318,7 @@ static void pic_ioport_write(void *opaque, u32 addr, u32 val)  		if (val & 0x10) {  			u8 edge_irr = s->irr & ~s->elcr;  			int i; -			bool found; +			bool found = false;  			struct kvm_vcpu *vcpu;  			s->init4 = val & 1; diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 01ca0042393..7fbd0d273ea 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -4113,16 +4113,21 @@ static int mmu_shrink(struct shrinker *shrink, struct shrink_control *sc)  		LIST_HEAD(invalid_list);  		/* +		 * Never scan more than sc->nr_to_scan VM instances. +		 * Will not hit this condition practically since we do not try +		 * to shrink more than one VM and it is very unlikely to see +		 * !n_used_mmu_pages so many times. +		 */ +		if (!nr_to_scan--) +			break; +		/*  		 * n_used_mmu_pages is accessed without holding kvm->mmu_lock  		 * here. We may skip a VM instance errorneosly, but we do not  		 * want to shrink a VM that only started to populate its MMU  		 * anyway.  		 */ -		if (kvm->arch.n_used_mmu_pages > 0) { -			if (!nr_to_scan--) -				break; +		if (!kvm->arch.n_used_mmu_pages)  			continue; -		}  		idx = srcu_read_lock(&kvm->srcu);  		spin_lock(&kvm->mmu_lock); diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index c00f03de1b7..b1eb202ee76 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -3619,6 +3619,7 @@ static void seg_setup(int seg)  static int alloc_apic_access_page(struct kvm *kvm)  { +	struct page *page;  	struct kvm_userspace_memory_region kvm_userspace_mem;  	int r = 0; @@ -3633,7 +3634,13 @@ static int alloc_apic_access_page(struct kvm *kvm)  	if (r)  		goto out; -	kvm->arch.apic_access_page = gfn_to_page(kvm, 0xfee00); +	page = gfn_to_page(kvm, 0xfee00); +	if (is_error_page(page)) { +		r = -EFAULT; +		goto out; +	} + +	kvm->arch.apic_access_page = page;  out:  	mutex_unlock(&kvm->slots_lock);  	return r; @@ -3641,6 +3648,7 @@ out:  static int alloc_identity_pagetable(struct kvm *kvm)  { +	struct page *page;  	struct kvm_userspace_memory_region kvm_userspace_mem;  	int r = 0; @@ -3656,8 +3664,13 @@ static int alloc_identity_pagetable(struct kvm *kvm)  	if (r)  		goto out; -	kvm->arch.ept_identity_pagetable = gfn_to_page(kvm, -			kvm->arch.ept_identity_map_addr >> PAGE_SHIFT); +	page = gfn_to_page(kvm, kvm->arch.ept_identity_map_addr >> PAGE_SHIFT); +	if (is_error_page(page)) { +		r = -EFAULT; +		goto out; +	} + +	kvm->arch.ept_identity_pagetable = page;  out:  	mutex_unlock(&kvm->slots_lock);  	return r; @@ -6575,7 +6588,7 @@ static void vmx_cpuid_update(struct kvm_vcpu *vcpu)  	/* Exposing INVPCID only when PCID is exposed */  	best = kvm_find_cpuid_entry(vcpu, 0x7, 0);  	if (vmx_invpcid_supported() && -	    best && (best->ecx & bit(X86_FEATURE_INVPCID)) && +	    best && (best->ebx & bit(X86_FEATURE_INVPCID)) &&  	    guest_cpuid_has_pcid(vcpu)) {  		exec_control |= SECONDARY_EXEC_ENABLE_INVPCID;  		vmcs_write32(SECONDARY_VM_EXEC_CONTROL, @@ -6585,7 +6598,7 @@ static void vmx_cpuid_update(struct kvm_vcpu *vcpu)  		vmcs_write32(SECONDARY_VM_EXEC_CONTROL,  			     exec_control);  		if (best) -			best->ecx &= ~bit(X86_FEATURE_INVPCID); +			best->ebx &= ~bit(X86_FEATURE_INVPCID);  	}  } diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 42bce48f692..2966c847d48 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -806,7 +806,7 @@ EXPORT_SYMBOL_GPL(kvm_rdpmc);   * kvm-specific. Those are put in the beginning of the list.   */ -#define KVM_SAVE_MSRS_BEGIN	9 +#define KVM_SAVE_MSRS_BEGIN	10  static u32 msrs_to_save[] = {  	MSR_KVM_SYSTEM_TIME, MSR_KVM_WALL_CLOCK,  	MSR_KVM_SYSTEM_TIME_NEW, MSR_KVM_WALL_CLOCK_NEW, @@ -2000,6 +2000,9 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata)  	case MSR_KVM_STEAL_TIME:  		data = vcpu->arch.st.msr_val;  		break; +	case MSR_KVM_PV_EOI_EN: +		data = vcpu->arch.pv_eoi.msr_val; +		break;  	case MSR_IA32_P5_MC_ADDR:  	case MSR_IA32_P5_MC_TYPE:  	case MSR_IA32_MCG_CAP: @@ -5110,17 +5113,20 @@ static void post_kvm_run_save(struct kvm_vcpu *vcpu)  			!kvm_event_needs_reinjection(vcpu);  } -static void vapic_enter(struct kvm_vcpu *vcpu) +static int vapic_enter(struct kvm_vcpu *vcpu)  {  	struct kvm_lapic *apic = vcpu->arch.apic;  	struct page *page;  	if (!apic || !apic->vapic_addr) -		return; +		return 0;  	page = gfn_to_page(vcpu->kvm, apic->vapic_addr >> PAGE_SHIFT); +	if (is_error_page(page)) +		return -EFAULT;  	vcpu->arch.apic->vapic_page = page; +	return 0;  }  static void vapic_exit(struct kvm_vcpu *vcpu) @@ -5427,7 +5433,11 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)  	}  	vcpu->srcu_idx = srcu_read_lock(&kvm->srcu); -	vapic_enter(vcpu); +	r = vapic_enter(vcpu); +	if (r) { +		srcu_read_unlock(&kvm->srcu, vcpu->srcu_idx); +		return r; +	}  	r = 1;  	while (r > 0) { diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index bf4bda6d3e9..9642d4a3860 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c @@ -31,7 +31,6 @@  #include <linux/pci.h>  #include <linux/gfp.h>  #include <linux/memblock.h> -#include <linux/syscore_ops.h>  #include <xen/xen.h>  #include <xen/interface/xen.h> @@ -1470,130 +1469,38 @@ asmlinkage void __init xen_start_kernel(void)  #endif  } -#ifdef CONFIG_XEN_PVHVM -/* - * The pfn containing the shared_info is located somewhere in RAM. This - * will cause trouble if the current kernel is doing a kexec boot into a - * new kernel. The new kernel (and its startup code) can not know where - * the pfn is, so it can not reserve the page. The hypervisor will - * continue to update the pfn, and as a result memory corruption occours - * in the new kernel. - * - * One way to work around this issue is to allocate a page in the - * xen-platform pci device's BAR memory range. But pci init is done very - * late and the shared_info page is already in use very early to read - * the pvclock. So moving the pfn from RAM to MMIO is racy because some - * code paths on other vcpus could access the pfn during the small - * window when the old pfn is moved to the new pfn. There is even a - * small window were the old pfn is not backed by a mfn, and during that - * time all reads return -1. - * - * Because it is not known upfront where the MMIO region is located it - * can not be used right from the start in xen_hvm_init_shared_info. - * - * To minimise trouble the move of the pfn is done shortly before kexec. - * This does not eliminate the race because all vcpus are still online - * when the syscore_ops will be called. But hopefully there is no work - * pending at this point in time. Also the syscore_op is run last which - * reduces the risk further. - */ - -static struct shared_info *xen_hvm_shared_info; - -static void xen_hvm_connect_shared_info(unsigned long pfn) +void __ref xen_hvm_init_shared_info(void)  { +	int cpu;  	struct xen_add_to_physmap xatp; +	static struct shared_info *shared_info_page = 0; +	if (!shared_info_page) +		shared_info_page = (struct shared_info *) +			extend_brk(PAGE_SIZE, PAGE_SIZE);  	xatp.domid = DOMID_SELF;  	xatp.idx = 0;  	xatp.space = XENMAPSPACE_shared_info; -	xatp.gpfn = pfn; +	xatp.gpfn = __pa(shared_info_page) >> PAGE_SHIFT;  	if (HYPERVISOR_memory_op(XENMEM_add_to_physmap, &xatp))  		BUG(); -} -static void xen_hvm_set_shared_info(struct shared_info *sip) -{ -	int cpu; - -	HYPERVISOR_shared_info = sip; +	HYPERVISOR_shared_info = (struct shared_info *)shared_info_page;  	/* xen_vcpu is a pointer to the vcpu_info struct in the shared_info  	 * page, we use it in the event channel upcall and in some pvclock  	 * related functions. We don't need the vcpu_info placement  	 * optimizations because we don't use any pv_mmu or pv_irq op on  	 * HVM. -	 * When xen_hvm_set_shared_info is run at boot time only vcpu 0 is -	 * online but xen_hvm_set_shared_info is run at resume time too and +	 * When xen_hvm_init_shared_info is run at boot time only vcpu 0 is +	 * online but xen_hvm_init_shared_info is run at resume time too and  	 * in that case multiple vcpus might be online. */  	for_each_online_cpu(cpu) {  		per_cpu(xen_vcpu, cpu) = &HYPERVISOR_shared_info->vcpu_info[cpu];  	}  } -/* Reconnect the shared_info pfn to a mfn */ -void xen_hvm_resume_shared_info(void) -{ -	xen_hvm_connect_shared_info(__pa(xen_hvm_shared_info) >> PAGE_SHIFT); -} - -#ifdef CONFIG_KEXEC -static struct shared_info *xen_hvm_shared_info_kexec; -static unsigned long xen_hvm_shared_info_pfn_kexec; - -/* Remember a pfn in MMIO space for kexec reboot */ -void __devinit xen_hvm_prepare_kexec(struct shared_info *sip, unsigned long pfn) -{ -	xen_hvm_shared_info_kexec = sip; -	xen_hvm_shared_info_pfn_kexec = pfn; -} - -static void xen_hvm_syscore_shutdown(void) -{ -	struct xen_memory_reservation reservation = { -		.domid = DOMID_SELF, -		.nr_extents = 1, -	}; -	unsigned long prev_pfn; -	int rc; - -	if (!xen_hvm_shared_info_kexec) -		return; - -	prev_pfn = __pa(xen_hvm_shared_info) >> PAGE_SHIFT; -	set_xen_guest_handle(reservation.extent_start, &prev_pfn); - -	/* Move pfn to MMIO, disconnects previous pfn from mfn */ -	xen_hvm_connect_shared_info(xen_hvm_shared_info_pfn_kexec); - -	/* Update pointers, following hypercall is also a memory barrier */ -	xen_hvm_set_shared_info(xen_hvm_shared_info_kexec); - -	/* Allocate new mfn for previous pfn */ -	do { -		rc = HYPERVISOR_memory_op(XENMEM_populate_physmap, &reservation); -		if (rc == 0) -			msleep(123); -	} while (rc == 0); - -	/* Make sure the previous pfn is really connected to a (new) mfn */ -	BUG_ON(rc != 1); -} - -static struct syscore_ops xen_hvm_syscore_ops = { -	.shutdown = xen_hvm_syscore_shutdown, -}; -#endif - -/* Use a pfn in RAM, may move to MMIO before kexec. */ -static void __init xen_hvm_init_shared_info(void) -{ -	/* Remember pointer for resume */ -	xen_hvm_shared_info = extend_brk(PAGE_SIZE, PAGE_SIZE); -	xen_hvm_connect_shared_info(__pa(xen_hvm_shared_info) >> PAGE_SHIFT); -	xen_hvm_set_shared_info(xen_hvm_shared_info); -} - +#ifdef CONFIG_XEN_PVHVM  static void __init init_hvm_pv_info(void)  {  	int major, minor; @@ -1644,9 +1551,6 @@ static void __init xen_hvm_guest_init(void)  	init_hvm_pv_info();  	xen_hvm_init_shared_info(); -#ifdef CONFIG_KEXEC -	register_syscore_ops(&xen_hvm_syscore_ops); -#endif  	if (xen_feature(XENFEAT_hvm_callback_vector))  		xen_have_vector_callback = 1; diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c index b65a76133f4..5141d808e75 100644 --- a/arch/x86/xen/mmu.c +++ b/arch/x86/xen/mmu.c @@ -1283,7 +1283,7 @@ static void xen_flush_tlb_others(const struct cpumask *cpus,  	cpumask_clear_cpu(smp_processor_id(), to_cpumask(args->mask));  	args->op.cmd = MMUEXT_TLB_FLUSH_MULTI; -	if (start != TLB_FLUSH_ALL && (end - start) <= PAGE_SIZE) { +	if (end != TLB_FLUSH_ALL && (end - start) <= PAGE_SIZE) {  		args->op.cmd = MMUEXT_INVLPG_MULTI;  		args->op.arg1.linear_addr = start;  	} diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c index b2e91d40a4c..76ba0e97e53 100644 --- a/arch/x86/xen/p2m.c +++ b/arch/x86/xen/p2m.c @@ -196,9 +196,11 @@ RESERVE_BRK(p2m_mid_identity, PAGE_SIZE * 2 * 3);  /* When we populate back during bootup, the amount of pages can vary. The   * max we have is seen is 395979, but that does not mean it can't be more. - * But some machines can have 3GB I/O holes even. So lets reserve enough - * for 4GB of I/O and E820 holes. */ -RESERVE_BRK(p2m_populated, PMD_SIZE * 4); + * Some machines can have 3GB I/O holes even. With early_can_reuse_p2m_middle + * it can re-use Xen provided mfn_list array, so we only need to allocate at + * most three P2M top nodes. */ +RESERVE_BRK(p2m_populated, PAGE_SIZE * 3); +  static inline unsigned p2m_top_index(unsigned long pfn)  {  	BUG_ON(pfn >= MAX_P2M_PFN); @@ -575,12 +577,99 @@ static bool __init early_alloc_p2m(unsigned long pfn)  	}  	return true;  } + +/* + * Skim over the P2M tree looking at pages that are either filled with + * INVALID_P2M_ENTRY or with 1:1 PFNs. If found, re-use that page and + * replace the P2M leaf with a p2m_missing or p2m_identity. + * Stick the old page in the new P2M tree location. + */ +bool __init early_can_reuse_p2m_middle(unsigned long set_pfn, unsigned long set_mfn) +{ +	unsigned topidx; +	unsigned mididx; +	unsigned ident_pfns; +	unsigned inv_pfns; +	unsigned long *p2m; +	unsigned long *mid_mfn_p; +	unsigned idx; +	unsigned long pfn; + +	/* We only look when this entails a P2M middle layer */ +	if (p2m_index(set_pfn)) +		return false; + +	for (pfn = 0; pfn < MAX_DOMAIN_PAGES; pfn += P2M_PER_PAGE) { +		topidx = p2m_top_index(pfn); + +		if (!p2m_top[topidx]) +			continue; + +		if (p2m_top[topidx] == p2m_mid_missing) +			continue; + +		mididx = p2m_mid_index(pfn); +		p2m = p2m_top[topidx][mididx]; +		if (!p2m) +			continue; + +		if ((p2m == p2m_missing) || (p2m == p2m_identity)) +			continue; + +		if ((unsigned long)p2m == INVALID_P2M_ENTRY) +			continue; + +		ident_pfns = 0; +		inv_pfns = 0; +		for (idx = 0; idx < P2M_PER_PAGE; idx++) { +			/* IDENTITY_PFNs are 1:1 */ +			if (p2m[idx] == IDENTITY_FRAME(pfn + idx)) +				ident_pfns++; +			else if (p2m[idx] == INVALID_P2M_ENTRY) +				inv_pfns++; +			else +				break; +		} +		if ((ident_pfns == P2M_PER_PAGE) || (inv_pfns == P2M_PER_PAGE)) +			goto found; +	} +	return false; +found: +	/* Found one, replace old with p2m_identity or p2m_missing */ +	p2m_top[topidx][mididx] = (ident_pfns ? p2m_identity : p2m_missing); +	/* And the other for save/restore.. */ +	mid_mfn_p = p2m_top_mfn_p[topidx]; +	/* NOTE: Even if it is a p2m_identity it should still be point to +	 * a page filled with INVALID_P2M_ENTRY entries. */ +	mid_mfn_p[mididx] = virt_to_mfn(p2m_missing); + +	/* Reset where we want to stick the old page in. */ +	topidx = p2m_top_index(set_pfn); +	mididx = p2m_mid_index(set_pfn); + +	/* This shouldn't happen */ +	if (WARN_ON(p2m_top[topidx] == p2m_mid_missing)) +		early_alloc_p2m(set_pfn); + +	if (WARN_ON(p2m_top[topidx][mididx] != p2m_missing)) +		return false; + +	p2m_init(p2m); +	p2m_top[topidx][mididx] = p2m; +	mid_mfn_p = p2m_top_mfn_p[topidx]; +	mid_mfn_p[mididx] = virt_to_mfn(p2m); + +	return true; +}  bool __init early_set_phys_to_machine(unsigned long pfn, unsigned long mfn)  {  	if (unlikely(!__set_phys_to_machine(pfn, mfn)))  {  		if (!early_alloc_p2m(pfn))  			return false; +		if (early_can_reuse_p2m_middle(pfn, mfn)) +			return __set_phys_to_machine(pfn, mfn); +  		if (!early_alloc_p2m_middle(pfn, false /* boundary crossover OK!*/))  			return false; diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index ead85576d54..d11ca11d14f 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c @@ -78,9 +78,16 @@ static void __init xen_add_extra_mem(u64 start, u64 size)  	memblock_reserve(start, size);  	xen_max_p2m_pfn = PFN_DOWN(start + size); +	for (pfn = PFN_DOWN(start); pfn < xen_max_p2m_pfn; pfn++) { +		unsigned long mfn = pfn_to_mfn(pfn); + +		if (WARN(mfn == pfn, "Trying to over-write 1-1 mapping (pfn: %lx)\n", pfn)) +			continue; +		WARN(mfn != INVALID_P2M_ENTRY, "Trying to remove %lx which has %lx mfn!\n", +			pfn, mfn); -	for (pfn = PFN_DOWN(start); pfn <= xen_max_p2m_pfn; pfn++)  		__set_phys_to_machine(pfn, INVALID_P2M_ENTRY); +	}  }  static unsigned long __init xen_do_chunk(unsigned long start, diff --git a/arch/x86/xen/suspend.c b/arch/x86/xen/suspend.c index ae8a00c39de..45329c8c226 100644 --- a/arch/x86/xen/suspend.c +++ b/arch/x86/xen/suspend.c @@ -30,7 +30,7 @@ void xen_arch_hvm_post_suspend(int suspend_cancelled)  {  #ifdef CONFIG_XEN_PVHVM  	int cpu; -	xen_hvm_resume_shared_info(); +	xen_hvm_init_shared_info();  	xen_callback_vector();  	xen_unplug_emulated_devices();  	if (xen_feature(XENFEAT_hvm_safe_pvclock)) { diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h index 1e4329e04e0..202d4c15015 100644 --- a/arch/x86/xen/xen-ops.h +++ b/arch/x86/xen/xen-ops.h @@ -41,7 +41,7 @@ void xen_enable_syscall(void);  void xen_vcpu_restore(void);  void xen_callback_vector(void); -void xen_hvm_resume_shared_info(void); +void xen_hvm_init_shared_info(void);  void xen_unplug_emulated_devices(void);  void __init xen_build_dynamic_phys_to_machine(void);  |