diff options
Diffstat (limited to 'arch')
41 files changed, 174 insertions, 166 deletions
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig index 60cde53d266..8bb936226de 100644 --- a/arch/alpha/Kconfig +++ b/arch/alpha/Kconfig @@ -51,7 +51,7 @@ config GENERIC_CMOS_UPDATE          def_bool y  config GENERIC_GPIO -	def_bool y +	bool  config ZONE_DMA  	bool diff --git a/arch/arm/boot/dts/tegra-harmony.dts b/arch/arm/boot/dts/tegra-harmony.dts index 4c053340ce3..e5818668d09 100644 --- a/arch/arm/boot/dts/tegra-harmony.dts +++ b/arch/arm/boot/dts/tegra-harmony.dts @@ -57,14 +57,14 @@  	};  	sdhci@c8000200 { -		gpios = <&gpio 69 0>, /* cd, gpio PI5 */ -			<&gpio 57 0>, /* wp, gpio PH1 */ -			<&gpio 155 0>; /* power, gpio PT3 */ +		cd-gpios = <&gpio 69 0>; /* gpio PI5 */ +		wp-gpios = <&gpio 57 0>; /* gpio PH1 */ +		power-gpios = <&gpio 155 0>; /* gpio PT3 */  	};  	sdhci@c8000600 { -		gpios = <&gpio 58 0>, /* cd, gpio PH2 */ -			<&gpio 59 0>, /* wp, gpio PH3 */ -			<&gpio 70 0>; /* power, gpio PI6 */ +		cd-gpios = <&gpio 58 0>; /* gpio PH2 */ +		wp-gpios = <&gpio 59 0>; /* gpio PH3 */ +		power-gpios = <&gpio 70 0>; /* gpio PI6 */  	};  }; diff --git a/arch/arm/boot/dts/tegra-seaboard.dts b/arch/arm/boot/dts/tegra-seaboard.dts index 1940cae0074..64cedca6fc7 100644 --- a/arch/arm/boot/dts/tegra-seaboard.dts +++ b/arch/arm/boot/dts/tegra-seaboard.dts @@ -21,8 +21,8 @@  	};  	sdhci@c8000400 { -		gpios = <&gpio 69 0>, /* cd, gpio PI5 */ -			<&gpio 57 0>, /* wp, gpio PH1 */ -			<&gpio 70 0>; /* power, gpio PI6 */ +		cd-gpios = <&gpio 69 0>; /* gpio PI5 */ +		wp-gpios = <&gpio 57 0>; /* gpio PH1 */ +		power-gpios = <&gpio 70 0>; /* gpio PI6 */  	};  }; diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c index 83dce859886..a9e0dae86a2 100644 --- a/arch/arm/mach-dove/common.c +++ b/arch/arm/mach-dove/common.c @@ -158,7 +158,7 @@ void __init dove_spi0_init(void)  void __init dove_spi1_init(void)  { -	orion_spi_init(DOVE_SPI1_PHYS_BASE, get_tclk()); +	orion_spi_1_init(DOVE_SPI1_PHYS_BASE, get_tclk());  }  /***************************************************************************** diff --git a/arch/arm/mach-exynos4/clock.c b/arch/arm/mach-exynos4/clock.c index 1561b036a9b..79d6cd0c8e7 100644 --- a/arch/arm/mach-exynos4/clock.c +++ b/arch/arm/mach-exynos4/clock.c @@ -1160,7 +1160,7 @@ void __init_or_cpufreq exynos4_setup_clocks(void)  	vpllsrc = clk_get_rate(&clk_vpllsrc.clk);  	vpll = s5p_get_pll46xx(vpllsrc, __raw_readl(S5P_VPLL_CON0), -				__raw_readl(S5P_VPLL_CON1), pll_4650); +				__raw_readl(S5P_VPLL_CON1), pll_4650c);  	clk_fout_apll.ops = &exynos4_fout_apll_ops;  	clk_fout_mpll.rate = mpll; diff --git a/arch/arm/mach-exynos4/mct.c b/arch/arm/mach-exynos4/mct.c index 1ae059b7ad7..ddd86864fb8 100644 --- a/arch/arm/mach-exynos4/mct.c +++ b/arch/arm/mach-exynos4/mct.c @@ -132,12 +132,18 @@ static cycle_t exynos4_frc_read(struct clocksource *cs)  	return ((cycle_t)hi << 32) | lo;  } +static void exynos4_frc_resume(struct clocksource *cs) +{ +	exynos4_mct_frc_start(0, 0); +} +  struct clocksource mct_frc = {  	.name		= "mct-frc",  	.rating		= 400,  	.read		= exynos4_frc_read,  	.mask		= CLOCKSOURCE_MASK(64),  	.flags		= CLOCK_SOURCE_IS_CONTINUOUS, +	.resume		= exynos4_frc_resume,  };  static void __init exynos4_clocksource_init(void) @@ -389,9 +395,11 @@ static void exynos4_mct_tick_init(struct clock_event_device *evt)  }  /* Setup the local clock events for a CPU */ -void __cpuinit local_timer_setup(struct clock_event_device *evt) +int __cpuinit local_timer_setup(struct clock_event_device *evt)  {  	exynos4_mct_tick_init(evt); + +	return 0;  }  int local_timer_ack(void) diff --git a/arch/arm/mach-exynos4/platsmp.c b/arch/arm/mach-exynos4/platsmp.c index 7c2282c6ba8..df6ef1b2f98 100644 --- a/arch/arm/mach-exynos4/platsmp.c +++ b/arch/arm/mach-exynos4/platsmp.c @@ -106,6 +106,8 @@ void __cpuinit platform_secondary_init(unsigned int cpu)  	 */  	spin_lock(&boot_lock);  	spin_unlock(&boot_lock); + +	set_cpu_online(cpu, true);  }  int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle) diff --git a/arch/arm/mach-exynos4/setup-keypad.c b/arch/arm/mach-exynos4/setup-keypad.c index 1ee0ebff111..7862bfb5933 100644 --- a/arch/arm/mach-exynos4/setup-keypad.c +++ b/arch/arm/mach-exynos4/setup-keypad.c @@ -19,15 +19,16 @@ void samsung_keypad_cfg_gpio(unsigned int rows, unsigned int cols)  	if (rows > 8) {  		/* Set all the necessary GPX2 pins: KP_ROW[0~7] */ -		s3c_gpio_cfgrange_nopull(EXYNOS4_GPX2(0), 8, S3C_GPIO_SFN(3)); +		s3c_gpio_cfgall_range(EXYNOS4_GPX2(0), 8, S3C_GPIO_SFN(3), +					S3C_GPIO_PULL_UP);  		/* Set all the necessary GPX3 pins: KP_ROW[8~] */ -		s3c_gpio_cfgrange_nopull(EXYNOS4_GPX3(0), (rows - 8), -					 S3C_GPIO_SFN(3)); +		s3c_gpio_cfgall_range(EXYNOS4_GPX3(0), (rows - 8), +					 S3C_GPIO_SFN(3), S3C_GPIO_PULL_UP);  	} else {  		/* Set all the necessary GPX2 pins: KP_ROW[x] */ -		s3c_gpio_cfgrange_nopull(EXYNOS4_GPX2(0), rows, -					 S3C_GPIO_SFN(3)); +		s3c_gpio_cfgall_range(EXYNOS4_GPX2(0), rows, S3C_GPIO_SFN(3), +					S3C_GPIO_PULL_UP);  	}  	/* Set all the necessary GPX1 pins to special-function 3: KP_COL[x] */ diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c index fcf0ae95651..8cdc730dcb3 100644 --- a/arch/arm/mach-integrator/integrator_ap.c +++ b/arch/arm/mach-integrator/integrator_ap.c @@ -32,6 +32,7 @@  #include <linux/interrupt.h>  #include <linux/io.h>  #include <linux/mtd/physmap.h> +#include <video/vga.h>  #include <mach/hardware.h>  #include <mach/platform.h> @@ -154,6 +155,7 @@ static struct map_desc ap_io_desc[] __initdata = {  static void __init ap_map_io(void)  {  	iotable_init(ap_io_desc, ARRAY_SIZE(ap_io_desc)); +	vga_base = PCI_MEMORY_VADDR;  }  #define INTEGRATOR_SC_VALID_INT	0x003fffff diff --git a/arch/arm/mach-integrator/pci_v3.c b/arch/arm/mach-integrator/pci_v3.c index dd56bfb351e..11b86e5b71c 100644 --- a/arch/arm/mach-integrator/pci_v3.c +++ b/arch/arm/mach-integrator/pci_v3.c @@ -27,7 +27,6 @@  #include <linux/spinlock.h>  #include <linux/init.h>  #include <linux/io.h> -#include <video/vga.h>  #include <mach/hardware.h>  #include <mach/platform.h> @@ -505,7 +504,6 @@ void __init pci_v3_preinit(void)  	pcibios_min_io = 0x6000;  	pcibios_min_mem = 0x00100000; -	vga_base = PCI_MEMORY_VADDR;  	/*  	 * Hook in our fault handler for PCI errors diff --git a/arch/arm/mach-prima2/clock.c b/arch/arm/mach-prima2/clock.c index 615a4e75cea..aebad7e565c 100644 --- a/arch/arm/mach-prima2/clock.c +++ b/arch/arm/mach-prima2/clock.c @@ -350,10 +350,10 @@ static struct clk_lookup onchip_clks[] = {  		.clk = &clk_mem,  	}, {  		.dev_id = "sys", -			.clk = &clk_sys, +		.clk = &clk_sys,  	}, {  		.dev_id = "io", -			.clk = &clk_io, +		.clk = &clk_io,  	},  }; diff --git a/arch/arm/mach-prima2/prima2.c b/arch/arm/mach-prima2/prima2.c index f57124bdd14..0ddf44698ec 100644 --- a/arch/arm/mach-prima2/prima2.c +++ b/arch/arm/mach-prima2/prima2.c @@ -1,5 +1,5 @@  /* - * Defines machines for CSR SiRFprimaII  + * Defines machines for CSR SiRFprimaII   *   * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.   * diff --git a/arch/arm/mach-prima2/timer.c b/arch/arm/mach-prima2/timer.c index ed7ec48d11d..26ab6fee561 100644 --- a/arch/arm/mach-prima2/timer.c +++ b/arch/arm/mach-prima2/timer.c @@ -133,14 +133,14 @@ static struct irqaction sirfsoc_timer_irq = {  /* Overwrite weak default sched_clock with more precise one */  unsigned long long notrace sched_clock(void)  { -	static int is_mapped = 0; +	static int is_mapped;  	/*  	 * sched_clock is called earlier than .init of sys_timer  	 * if we map timer memory in .init of sys_timer, system  	 * will panic due to illegal memory access  	 */ -	if(!is_mapped) { +	if (!is_mapped) {  		sirfsoc_of_timer_map();  		is_mapped = 1;  	} diff --git a/arch/arm/mach-s3c64xx/mach-smdk6410.c b/arch/arm/mach-s3c64xx/mach-smdk6410.c index c5190a50f0d..d831c97833b 100644 --- a/arch/arm/mach-s3c64xx/mach-smdk6410.c +++ b/arch/arm/mach-s3c64xx/mach-smdk6410.c @@ -262,45 +262,6 @@ static struct samsung_keypad_platdata smdk6410_keypad_data __initdata = {  	.cols		= 8,  }; -static int smdk6410_backlight_init(struct device *dev) -{ -	int ret; - -	ret = gpio_request(S3C64XX_GPF(15), "Backlight"); -	if (ret) { -		printk(KERN_ERR "failed to request GPF for PWM-OUT1\n"); -		return ret; -	} - -	/* Configure GPIO pin with S3C64XX_GPF15_PWM_TOUT1 */ -	s3c_gpio_cfgpin(S3C64XX_GPF(15), S3C_GPIO_SFN(2)); - -	return 0; -} - -static void smdk6410_backlight_exit(struct device *dev) -{ -	s3c_gpio_cfgpin(S3C64XX_GPF(15), S3C_GPIO_OUTPUT); -	gpio_free(S3C64XX_GPF(15)); -} - -static struct platform_pwm_backlight_data smdk6410_backlight_data = { -	.pwm_id		= 1, -	.max_brightness	= 255, -	.dft_brightness	= 255, -	.pwm_period_ns	= 78770, -	.init		= smdk6410_backlight_init, -	.exit		= smdk6410_backlight_exit, -}; - -static struct platform_device smdk6410_backlight_device = { -	.name		= "pwm-backlight", -	.dev		= { -		.parent		= &s3c_device_timer[1].dev, -		.platform_data	= &smdk6410_backlight_data, -	}, -}; -  static struct map_desc smdk6410_iodesc[] = {};  static struct platform_device *smdk6410_devices[] __initdata = { diff --git a/arch/arm/plat-samsung/clock.c b/arch/arm/plat-samsung/clock.c index 302c42670bd..3b4451979d1 100644 --- a/arch/arm/plat-samsung/clock.c +++ b/arch/arm/plat-samsung/clock.c @@ -64,6 +64,17 @@ static LIST_HEAD(clocks);   */  DEFINE_SPINLOCK(clocks_lock); +/* Global watchdog clock used by arch_wtd_reset() callback */ +struct clk *s3c2410_wdtclk; +static int __init s3c_wdt_reset_init(void) +{ +	s3c2410_wdtclk = clk_get(NULL, "watchdog"); +	if (IS_ERR(s3c2410_wdtclk)) +		printk(KERN_WARNING "%s: warning: cannot get watchdog clock\n", __func__); +	return 0; +} +arch_initcall(s3c_wdt_reset_init); +  /* enable and disable calls for use with the clk struct */  static int clk_null_enable(struct clk *clk, int enable) diff --git a/arch/arm/plat-samsung/include/plat/clock.h b/arch/arm/plat-samsung/include/plat/clock.h index 87d5b38a86f..73c66d4d10f 100644 --- a/arch/arm/plat-samsung/include/plat/clock.h +++ b/arch/arm/plat-samsung/include/plat/clock.h @@ -9,6 +9,9 @@   * published by the Free Software Foundation.  */ +#ifndef __ASM_PLAT_CLOCK_H +#define __ASM_PLAT_CLOCK_H __FILE__ +  #include <linux/spinlock.h>  #include <linux/clkdev.h> @@ -121,3 +124,8 @@ extern int s3c64xx_sclk_ctrl(struct clk *clk, int enable);  extern void s3c_pwmclk_init(void); +/* Global watchdog clock used by arch_wtd_reset() callback */ + +extern struct clk *s3c2410_wdtclk; + +#endif /* __ASM_PLAT_CLOCK_H */ diff --git a/arch/arm/plat-samsung/include/plat/watchdog-reset.h b/arch/arm/plat-samsung/include/plat/watchdog-reset.h index 54b762acb5a..40dbb2b0ae2 100644 --- a/arch/arm/plat-samsung/include/plat/watchdog-reset.h +++ b/arch/arm/plat-samsung/include/plat/watchdog-reset.h @@ -10,6 +10,7 @@   * published by the Free Software Foundation.  */ +#include <plat/clock.h>  #include <plat/regs-watchdog.h>  #include <mach/map.h> @@ -19,17 +20,12 @@  static inline void arch_wdt_reset(void)  { -	struct clk *wdtclk; -  	printk("arch_reset: attempting watchdog reset\n");  	__raw_writel(0, S3C2410_WTCON);	  /* disable watchdog, to be safe  */ -	wdtclk = clk_get(NULL, "watchdog"); -	if (!IS_ERR(wdtclk)) { -		clk_enable(wdtclk); -	} else -		printk(KERN_WARNING "%s: warning: cannot get watchdog clock\n", __func__); +	if (s3c2410_wdtclk) +		clk_enable(s3c2410_wdtclk);  	/* put initial values into count and data */  	__raw_writel(0x80, S3C2410_WTCNT); diff --git a/arch/um/Kconfig.x86 b/arch/um/Kconfig.x86 index d31ecf346b4..21bebe63df6 100644 --- a/arch/um/Kconfig.x86 +++ b/arch/um/Kconfig.x86 @@ -10,6 +10,10 @@ config CMPXCHG_LOCAL  	bool  	default n +config CMPXCHG_DOUBLE +	bool +	default n +  source "arch/x86/Kconfig.cpu"  endmenu diff --git a/arch/um/Makefile b/arch/um/Makefile index fab8121d2b3..c0f712cc7c5 100644 --- a/arch/um/Makefile +++ b/arch/um/Makefile @@ -41,7 +41,7 @@ KBUILD_CPPFLAGS += -I$(srctree)/$(ARCH_DIR)/sys-$(SUBARCH)  KBUILD_CFLAGS += $(CFLAGS) $(CFLAGS-y) -D__arch_um__ -DSUBARCH=\"$(SUBARCH)\" \  	$(ARCH_INCLUDE) $(MODE_INCLUDE) -Dvmap=kernel_vmap	\  	-Din6addr_loopback=kernel_in6addr_loopback \ -	-Din6addr_any=kernel_in6addr_any +	-Din6addr_any=kernel_in6addr_any -Dstrrchr=kernel_strrchr  KBUILD_AFLAGS += $(ARCH_INCLUDE) diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c index d51c404239a..364c8a15c4c 100644 --- a/arch/um/drivers/line.c +++ b/arch/um/drivers/line.c @@ -399,8 +399,8 @@ int line_setup_irq(int fd, int input, int output, struct line *line, void *data)   * is done under a spinlock.  Checking whether the device is in use is   * line->tty->count > 1, also under the spinlock.   * - * tty->count serves to decide whether the device should be enabled or - * disabled on the host.  If it's equal to 1, then we are doing the + * line->count serves to decide whether the device should be enabled or + * disabled on the host.  If it's equal to 0, then we are doing the   * first open or last close.  Otherwise, open and close just return.   */ @@ -414,16 +414,16 @@ int line_open(struct line *lines, struct tty_struct *tty)  		goto out_unlock;  	err = 0; -	if (tty->count > 1) +	if (line->count++)  		goto out_unlock; -	spin_unlock(&line->count_lock); - +	BUG_ON(tty->driver_data);  	tty->driver_data = line;  	line->tty = tty; +	spin_unlock(&line->count_lock);  	err = enable_chan(line); -	if (err) +	if (err) /* line_close() will be called by our caller */  		return err;  	INIT_DELAYED_WORK(&line->task, line_timer_cb); @@ -436,7 +436,7 @@ int line_open(struct line *lines, struct tty_struct *tty)  	chan_window_size(&line->chan_list, &tty->winsize.ws_row,  			 &tty->winsize.ws_col); -	return err; +	return 0;  out_unlock:  	spin_unlock(&line->count_lock); @@ -460,17 +460,16 @@ void line_close(struct tty_struct *tty, struct file * filp)  	flush_buffer(line);  	spin_lock(&line->count_lock); -	if (!line->valid) -		goto out_unlock; +	BUG_ON(!line->valid); -	if (tty->count > 1) +	if (--line->count)  		goto out_unlock; -	spin_unlock(&line->count_lock); -  	line->tty = NULL;  	tty->driver_data = NULL; +	spin_unlock(&line->count_lock); +  	if (line->sigio) {  		unregister_winch(tty);  		line->sigio = 0; @@ -498,7 +497,7 @@ static int setup_one_line(struct line *lines, int n, char *init, int init_prio,  	spin_lock(&line->count_lock); -	if (line->tty != NULL) { +	if (line->count) {  		*error_out = "Device is already open";  		goto out;  	} @@ -722,41 +721,53 @@ struct winch {  	int pid;  	struct tty_struct *tty;  	unsigned long stack; +	struct work_struct work;  }; -static void free_winch(struct winch *winch, int free_irq_ok) +static void __free_winch(struct work_struct *work)  { -	if (free_irq_ok) -		free_irq(WINCH_IRQ, winch); - -	list_del(&winch->list); +	struct winch *winch = container_of(work, struct winch, work); +	free_irq(WINCH_IRQ, winch);  	if (winch->pid != -1)  		os_kill_process(winch->pid, 1); -	if (winch->fd != -1) -		os_close_file(winch->fd);  	if (winch->stack != 0)  		free_stack(winch->stack, 0);  	kfree(winch);  } +static void free_winch(struct winch *winch) +{ +	int fd = winch->fd; +	winch->fd = -1; +	if (fd != -1) +		os_close_file(fd); +	list_del(&winch->list); +	__free_winch(&winch->work); +} +  static irqreturn_t winch_interrupt(int irq, void *data)  {  	struct winch *winch = data;  	struct tty_struct *tty;  	struct line *line; +	int fd = winch->fd;  	int err;  	char c; -	if (winch->fd != -1) { -		err = generic_read(winch->fd, &c, NULL); +	if (fd != -1) { +		err = generic_read(fd, &c, NULL);  		if (err < 0) {  			if (err != -EAGAIN) { +				winch->fd = -1; +				list_del(&winch->list); +				os_close_file(fd);  				printk(KERN_ERR "winch_interrupt : "  				       "read failed, errno = %d\n", -err);  				printk(KERN_ERR "fd %d is losing SIGWINCH "  				       "support\n", winch->tty_fd); -				free_winch(winch, 0); +				INIT_WORK(&winch->work, __free_winch); +				schedule_work(&winch->work);  				return IRQ_HANDLED;  			}  			goto out; @@ -828,7 +839,7 @@ static void unregister_winch(struct tty_struct *tty)  	list_for_each_safe(ele, next, &winch_handlers) {  		winch = list_entry(ele, struct winch, list);  		if (winch->tty == tty) { -			free_winch(winch, 1); +			free_winch(winch);  			break;  		}  	} @@ -844,7 +855,7 @@ static void winch_cleanup(void)  	list_for_each_safe(ele, next, &winch_handlers) {  		winch = list_entry(ele, struct winch, list); -		free_winch(winch, 1); +		free_winch(winch);  	}  	spin_unlock(&winch_handler_lock); diff --git a/arch/um/drivers/xterm.c b/arch/um/drivers/xterm.c index 8ac7146c237..2e1de572860 100644 --- a/arch/um/drivers/xterm.c +++ b/arch/um/drivers/xterm.c @@ -123,6 +123,7 @@ static int xterm_open(int input, int output, int primary, void *d,  		err = -errno;  		printk(UM_KERN_ERR "xterm_open : unlink failed, errno = %d\n",  		       errno); +		close(fd);  		return err;  	}  	close(fd); diff --git a/arch/um/include/asm/ptrace-generic.h b/arch/um/include/asm/ptrace-generic.h index ae084ad1a3a..1a7d2757fe0 100644 --- a/arch/um/include/asm/ptrace-generic.h +++ b/arch/um/include/asm/ptrace-generic.h @@ -42,10 +42,6 @@ extern long subarch_ptrace(struct task_struct *child, long request,  	unsigned long addr, unsigned long data);  extern unsigned long getreg(struct task_struct *child, int regno);  extern int putreg(struct task_struct *child, int regno, unsigned long value); -extern int get_fpregs(struct user_i387_struct __user *buf, -		      struct task_struct *child); -extern int set_fpregs(struct user_i387_struct __user *buf, -		      struct task_struct *child);  extern int arch_copy_tls(struct task_struct *new);  extern void clear_flushed_tls(struct task_struct *task); diff --git a/arch/um/include/shared/line.h b/arch/um/include/shared/line.h index 72f4f25af24..63df3ca02ac 100644 --- a/arch/um/include/shared/line.h +++ b/arch/um/include/shared/line.h @@ -33,6 +33,7 @@ struct line_driver {  struct line {  	struct tty_struct *tty;  	spinlock_t count_lock; +	unsigned long count;  	int valid;  	char *init_str; diff --git a/arch/um/include/shared/registers.h b/arch/um/include/shared/registers.h index b0b4589e0eb..f1e0aa56c52 100644 --- a/arch/um/include/shared/registers.h +++ b/arch/um/include/shared/registers.h @@ -16,7 +16,7 @@ extern int restore_fpx_registers(int pid, unsigned long *fp_regs);  extern int save_registers(int pid, struct uml_pt_regs *regs);  extern int restore_registers(int pid, struct uml_pt_regs *regs);  extern int init_registers(int pid); -extern void get_safe_registers(unsigned long *regs); +extern void get_safe_registers(unsigned long *regs, unsigned long *fp_regs);  extern unsigned long get_thread_reg(int reg, jmp_buf *buf);  extern int get_fp_registers(int pid, unsigned long *regs);  extern int put_fp_registers(int pid, unsigned long *regs); diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c index fab4371184f..21c1ae7c3d7 100644 --- a/arch/um/kernel/process.c +++ b/arch/um/kernel/process.c @@ -202,7 +202,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,  		arch_copy_thread(¤t->thread.arch, &p->thread.arch);  	}  	else { -		get_safe_registers(p->thread.regs.regs.gp); +		get_safe_registers(p->thread.regs.regs.gp, p->thread.regs.regs.fp);  		p->thread.request.u.thread = current->thread.request.u.thread;  		handler = new_thread_handler;  	} diff --git a/arch/um/kernel/ptrace.c b/arch/um/kernel/ptrace.c index 701b672c112..c9da32b0c70 100644 --- a/arch/um/kernel/ptrace.c +++ b/arch/um/kernel/ptrace.c @@ -50,23 +50,11 @@ long arch_ptrace(struct task_struct *child, long request,  	void __user *vp = p;  	switch (request) { -	/* read word at location addr. */ -	case PTRACE_PEEKTEXT: -	case PTRACE_PEEKDATA: -		ret = generic_ptrace_peekdata(child, addr, data); -		break; -  	/* read the word at location addr in the USER area. */  	case PTRACE_PEEKUSR:  		ret = peek_user(child, addr, data);  		break; -	/* write the word at location addr. */ -	case PTRACE_POKETEXT: -	case PTRACE_POKEDATA: -		ret = generic_ptrace_pokedata(child, addr, data); -		break; -  	/* write the word at location addr in the USER area */  	case PTRACE_POKEUSR:  		ret = poke_user(child, addr, data); @@ -107,16 +95,6 @@ long arch_ptrace(struct task_struct *child, long request,  		break;  	}  #endif -#ifdef PTRACE_GETFPREGS -	case PTRACE_GETFPREGS: /* Get the child FPU state. */ -		ret = get_fpregs(vp, child); -		break; -#endif -#ifdef PTRACE_SETFPREGS -	case PTRACE_SETFPREGS: /* Set the child FPU state. */ -		ret = set_fpregs(vp, child); -		break; -#endif  	case PTRACE_GET_THREAD_AREA:  		ret = ptrace_get_thread_area(child, addr, vp);  		break; @@ -154,12 +132,6 @@ long arch_ptrace(struct task_struct *child, long request,  		break;  	}  #endif -#ifdef PTRACE_ARCH_PRCTL -	case PTRACE_ARCH_PRCTL: -		/* XXX Calls ptrace on the host - needs some SMP thinking */ -		ret = arch_prctl(child, data, (void __user *) addr); -		break; -#endif  	default:  		ret = ptrace_request(child, request, addr, data);  		if (ret == -EIO) diff --git a/arch/um/os-Linux/registers.c b/arch/um/os-Linux/registers.c index 830fe6a1518..b866b9e3bef 100644 --- a/arch/um/os-Linux/registers.c +++ b/arch/um/os-Linux/registers.c @@ -8,6 +8,8 @@  #include <string.h>  #include <sys/ptrace.h>  #include "sysdep/ptrace.h" +#include "sysdep/ptrace_user.h" +#include "registers.h"  int save_registers(int pid, struct uml_pt_regs *regs)  { @@ -32,6 +34,7 @@ int restore_registers(int pid, struct uml_pt_regs *regs)  /* This is set once at boot time and not changed thereafter */  static unsigned long exec_regs[MAX_REG_NR]; +static unsigned long exec_fp_regs[FP_SIZE];  int init_registers(int pid)  { @@ -42,10 +45,14 @@ int init_registers(int pid)  		return -errno;  	arch_init_registers(pid); +	get_fp_registers(pid, exec_fp_regs);  	return 0;  } -void get_safe_registers(unsigned long *regs) +void get_safe_registers(unsigned long *regs, unsigned long *fp_regs)  {  	memcpy(regs, exec_regs, sizeof(exec_regs)); + +	if (fp_regs) +		memcpy(fp_regs, exec_fp_regs, sizeof(exec_fp_regs));  } diff --git a/arch/um/os-Linux/skas/mem.c b/arch/um/os-Linux/skas/mem.c index d261f170d12..e771398be5f 100644 --- a/arch/um/os-Linux/skas/mem.c +++ b/arch/um/os-Linux/skas/mem.c @@ -39,7 +39,7 @@ static unsigned long syscall_regs[MAX_REG_NR];  static int __init init_syscall_regs(void)  { -	get_safe_registers(syscall_regs); +	get_safe_registers(syscall_regs, NULL);  	syscall_regs[REGS_IP_INDEX] = STUB_CODE +  		((unsigned long) &batch_syscall_stub -  		 (unsigned long) &__syscall_stub_start); diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c index d6e0a2234b8..dee0e8cf8ad 100644 --- a/arch/um/os-Linux/skas/process.c +++ b/arch/um/os-Linux/skas/process.c @@ -373,6 +373,9 @@ void userspace(struct uml_pt_regs *regs)  		if (ptrace(PTRACE_SETREGS, pid, 0, regs->gp))  			fatal_sigsegv(); +		if (put_fp_registers(pid, regs->fp)) +			fatal_sigsegv(); +  		/* Now we set local_using_sysemu to be used for one loop */  		local_using_sysemu = get_using_sysemu(); @@ -399,6 +402,12 @@ void userspace(struct uml_pt_regs *regs)  			fatal_sigsegv();  		} +		if (get_fp_registers(pid, regs->fp)) { +			printk(UM_KERN_ERR "userspace -  get_fp_registers failed, " +			       "errno = %d\n", errno); +			fatal_sigsegv(); +		} +  		UPT_SYSCALL_NR(regs) = -1; /* Assume: It's not a syscall */  		if (WIFSTOPPED(status)) { @@ -457,10 +466,11 @@ void userspace(struct uml_pt_regs *regs)  }  static unsigned long thread_regs[MAX_REG_NR]; +static unsigned long thread_fp_regs[FP_SIZE];  static int __init init_thread_regs(void)  { -	get_safe_registers(thread_regs); +	get_safe_registers(thread_regs, thread_fp_regs);  	/* Set parent's instruction pointer to start of clone-stub */  	thread_regs[REGS_IP_INDEX] = STUB_CODE +  				(unsigned long) stub_clone_handler - @@ -503,6 +513,13 @@ int copy_context_skas0(unsigned long new_stack, int pid)  		return err;  	} +	err = put_fp_registers(pid, thread_fp_regs); +	if (err < 0) { +		printk(UM_KERN_ERR "copy_context_skas0 : put_fp_registers " +		       "failed, pid = %d, err = %d\n", pid, err); +		return err; +	} +  	/* set a well known return code for detection of child write failure */  	child_data->err = 12345678; diff --git a/arch/um/sys-i386/asm/ptrace.h b/arch/um/sys-i386/asm/ptrace.h index 0273e4d09af..5d2a5911253 100644 --- a/arch/um/sys-i386/asm/ptrace.h +++ b/arch/um/sys-i386/asm/ptrace.h @@ -42,11 +42,6 @@   */  struct user_desc; -extern int get_fpxregs(struct user_fxsr_struct __user *buf, -		       struct task_struct *child); -extern int set_fpxregs(struct user_fxsr_struct __user *buf, -		       struct task_struct *tsk); -  extern int ptrace_get_thread_area(struct task_struct *child, int idx,                                    struct user_desc __user *user_desc); diff --git a/arch/um/sys-i386/ptrace.c b/arch/um/sys-i386/ptrace.c index d23b2d3ea38..3375c271785 100644 --- a/arch/um/sys-i386/ptrace.c +++ b/arch/um/sys-i386/ptrace.c @@ -145,7 +145,7 @@ int peek_user(struct task_struct *child, long addr, long data)  	return put_user(tmp, (unsigned long __user *) data);  } -int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child) +static int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)  {  	int err, n, cpu = ((struct thread_info *) child->stack)->cpu;  	struct user_i387_struct fpregs; @@ -161,7 +161,7 @@ int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)  	return n;  } -int set_fpregs(struct user_i387_struct __user *buf, struct task_struct *child) +static int set_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)  {  	int n, cpu = ((struct thread_info *) child->stack)->cpu;  	struct user_i387_struct fpregs; @@ -174,7 +174,7 @@ int set_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)  				    (unsigned long *) &fpregs);  } -int get_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child) +static int get_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child)  {  	int err, n, cpu = ((struct thread_info *) child->stack)->cpu;  	struct user_fxsr_struct fpregs; @@ -190,7 +190,7 @@ int get_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child)  	return n;  } -int set_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child) +static int set_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child)  {  	int n, cpu = ((struct thread_info *) child->stack)->cpu;  	struct user_fxsr_struct fpregs; @@ -206,5 +206,23 @@ int set_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child)  long subarch_ptrace(struct task_struct *child, long request,  		    unsigned long addr, unsigned long data)  { -	return -EIO; +	int ret = -EIO; +	void __user *datap = (void __user *) data; +	switch (request) { +	case PTRACE_GETFPREGS: /* Get the child FPU state. */ +		ret = get_fpregs(datap, child); +		break; +	case PTRACE_SETFPREGS: /* Set the child FPU state. */ +		ret = set_fpregs(datap, child); +		break; +	case PTRACE_GETFPXREGS: /* Get the child FPU state. */ +		ret = get_fpxregs(datap, child); +		break; +	case PTRACE_SETFPXREGS: /* Set the child FPU state. */ +		ret = set_fpxregs(datap, child); +		break; +	default: +		ret = -EIO; +	} +	return ret;  } diff --git a/arch/um/sys-i386/shared/sysdep/ptrace.h b/arch/um/sys-i386/shared/sysdep/ptrace.h index d50e62e0707..c398a507611 100644 --- a/arch/um/sys-i386/shared/sysdep/ptrace.h +++ b/arch/um/sys-i386/shared/sysdep/ptrace.h @@ -53,6 +53,7 @@ extern int sysemu_supported;  struct uml_pt_regs {  	unsigned long gp[MAX_REG_NR]; +	unsigned long fp[HOST_FPX_SIZE];  	struct faultinfo faultinfo;  	long syscall;  	int is_user; diff --git a/arch/um/sys-x86_64/ptrace.c b/arch/um/sys-x86_64/ptrace.c index f43613643cd..4005506834f 100644 --- a/arch/um/sys-x86_64/ptrace.c +++ b/arch/um/sys-x86_64/ptrace.c @@ -145,7 +145,7 @@ int is_syscall(unsigned long addr)  	return instr == 0x050f;  } -int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child) +static int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)  {  	int err, n, cpu = ((struct thread_info *) child->stack)->cpu;  	long fpregs[HOST_FP_SIZE]; @@ -162,7 +162,7 @@ int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)  	return n;  } -int set_fpregs(struct user_i387_struct __user *buf, struct task_struct *child) +static int set_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)  {  	int n, cpu = ((struct thread_info *) child->stack)->cpu;  	long fpregs[HOST_FP_SIZE]; @@ -182,12 +182,16 @@ long subarch_ptrace(struct task_struct *child, long request,  	void __user *datap = (void __user *) data;  	switch (request) { -	case PTRACE_GETFPXREGS: /* Get the child FPU state. */ +	case PTRACE_GETFPREGS: /* Get the child FPU state. */  		ret = get_fpregs(datap, child);  		break; -	case PTRACE_SETFPXREGS: /* Set the child FPU state. */ +	case PTRACE_SETFPREGS: /* Set the child FPU state. */  		ret = set_fpregs(datap, child);  		break; +	case PTRACE_ARCH_PRCTL: +		/* XXX Calls ptrace on the host - needs some SMP thinking */ +		ret = arch_prctl(child, data, (void __user *) addr); +		break;  	}  	return ret; diff --git a/arch/um/sys-x86_64/shared/sysdep/ptrace.h b/arch/um/sys-x86_64/shared/sysdep/ptrace.h index fdba5457947..8ee8f8e12af 100644 --- a/arch/um/sys-x86_64/shared/sysdep/ptrace.h +++ b/arch/um/sys-x86_64/shared/sysdep/ptrace.h @@ -85,6 +85,7 @@  struct uml_pt_regs {  	unsigned long gp[MAX_REG_NR]; +	unsigned long fp[HOST_FP_SIZE];  	struct faultinfo faultinfo;  	long syscall;  	int is_user; diff --git a/arch/x86/include/asm/alternative-asm.h b/arch/x86/include/asm/alternative-asm.h index 4554cc6fb96..091508b533b 100644 --- a/arch/x86/include/asm/alternative-asm.h +++ b/arch/x86/include/asm/alternative-asm.h @@ -16,7 +16,6 @@  #endif  .macro altinstruction_entry orig alt feature orig_len alt_len -	.align 8  	.long \orig - .  	.long \alt - .  	.word \feature diff --git a/arch/x86/include/asm/alternative.h b/arch/x86/include/asm/alternative.h index 23fb6d79f20..37ad100a221 100644 --- a/arch/x86/include/asm/alternative.h +++ b/arch/x86/include/asm/alternative.h @@ -48,9 +48,6 @@ struct alt_instr {  	u16 cpuid;		/* cpuid bit set for replacement */  	u8  instrlen;		/* length of original instruction */  	u8  replacementlen;	/* length of new instruction, <= instrlen */ -#ifdef CONFIG_X86_64 -	u32 pad2; -#endif  };  extern void alternative_instructions(void); @@ -83,7 +80,6 @@ static inline int alternatives_text_reserved(void *start, void *end)  									\        "661:\n\t" oldinstr "\n662:\n"					\        ".section .altinstructions,\"a\"\n"				\ -      _ASM_ALIGN "\n"							\        "	 .long 661b - .\n"			/* label           */	\        "	 .long 663f - .\n"			/* new instruction */	\        "	 .word " __stringify(feature) "\n"	/* feature bit     */	\ diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h index 4258aac99a6..88b23a43f34 100644 --- a/arch/x86/include/asm/cpufeature.h +++ b/arch/x86/include/asm/cpufeature.h @@ -332,7 +332,6 @@ static __always_inline __pure bool __static_cpu_has(u16 bit)  		asm goto("1: jmp %l[t_no]\n"  			 "2:\n"  			 ".section .altinstructions,\"a\"\n" -			 _ASM_ALIGN "\n"  			 " .long 1b - .\n"  			 " .long 0\n"		/* no replacement */  			 " .word %P0\n"		/* feature bit */ @@ -350,7 +349,6 @@ static __always_inline __pure bool __static_cpu_has(u16 bit)  		asm volatile("1: movb $0,%0\n"  			     "2:\n"  			     ".section .altinstructions,\"a\"\n" -			     _ASM_ALIGN "\n"  			     " .long 1b - .\n"  			     " .long 3f - .\n"  			     " .word %P1\n"		/* feature bit */ diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c index 20a61427506..3dd53f997b1 100644 --- a/arch/x86/xen/mmu.c +++ b/arch/x86/xen/mmu.c @@ -1721,10 +1721,8 @@ void __init xen_setup_machphys_mapping(void)  		machine_to_phys_nr = MACH2PHYS_NR_ENTRIES;  	}  #ifdef CONFIG_X86_32 -	if ((machine_to_phys_mapping + machine_to_phys_nr) -	    < machine_to_phys_mapping) -		machine_to_phys_nr = (unsigned long *)NULL -				     - machine_to_phys_mapping; +	WARN_ON((machine_to_phys_mapping + (machine_to_phys_nr - 1)) +		< machine_to_phys_mapping);  #endif  } diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index c3b8d440873..46d6d21dbdb 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c @@ -306,10 +306,12 @@ char * __init xen_memory_setup(void)  	sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);  	extra_limit = xen_get_max_pages(); -	if (extra_limit >= max_pfn) -		extra_pages = extra_limit - max_pfn; -	else -		extra_pages = 0; +	if (max_pfn + extra_pages > extra_limit) { +		if (extra_limit > max_pfn) +			extra_pages = extra_limit - max_pfn; +		else +			extra_pages = 0; +	}  	extra_pages += xen_return_unused_memory(xen_start_info->nr_pages, &e820); diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c index d4fc6d454f8..041d4fe9dfe 100644 --- a/arch/x86/xen/smp.c +++ b/arch/x86/xen/smp.c @@ -532,7 +532,6 @@ static void __init xen_hvm_smp_prepare_cpus(unsigned int max_cpus)  	WARN_ON(xen_smp_intr_init(0));  	xen_init_lock_cpu(0); -	xen_init_spinlocks();  }  static int __cpuinit xen_hvm_cpu_up(unsigned int cpu) diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c index 5158c505bef..163b4679556 100644 --- a/arch/x86/xen/time.c +++ b/arch/x86/xen/time.c @@ -168,9 +168,10 @@ cycle_t xen_clocksource_read(void)          struct pvclock_vcpu_time_info *src;  	cycle_t ret; -	src = &get_cpu_var(xen_vcpu)->time; +	preempt_disable_notrace(); +	src = &__get_cpu_var(xen_vcpu)->time;  	ret = pvclock_clocksource_read(src); -	put_cpu_var(xen_vcpu); +	preempt_enable_notrace();  	return ret;  }  |