aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/mips/alchemy/common/dbdma.c8
-rw-r--r--arch/mips/basler/excite/excite_iodev.c2
-rw-r--r--arch/mips/bcm63xx/Makefile2
-rw-r--r--arch/mips/bcm63xx/boards/board_bcm963xx.c8
-rw-r--r--arch/mips/bcm63xx/dev-pcmcia.c144
-rw-r--r--arch/mips/bcm63xx/dev-uart.c41
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_pcmcia.h13
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_uart.h6
-rw-r--r--arch/mips/include/asm/smp.h15
-rw-r--r--arch/mips/include/asm/unaligned.h4
-rw-r--r--arch/mips/kernel/kspd.c33
-rw-r--r--arch/mips/kernel/rtlx.c15
-rw-r--r--arch/mips/kernel/smp.c14
-rw-r--r--arch/mips/kernel/smtc.c5
-rw-r--r--arch/mips/kernel/vpe.c77
-rw-r--r--arch/mips/mm/sc-mips.c5
-rw-r--r--arch/mips/oprofile/op_model_loongson2.c14
-rw-r--r--arch/mips/pci/ops-pmcmsp.c5
-rw-r--r--arch/mips/sgi-ip27/ip27-smp.c2
-rw-r--r--arch/mips/sibyte/bcm1480/irq.c4
-rw-r--r--arch/mips/sibyte/common/sb_tbprof.c33
-rw-r--r--arch/mips/sibyte/swarm/setup.c2
22 files changed, 338 insertions, 114 deletions
diff --git a/arch/mips/alchemy/common/dbdma.c b/arch/mips/alchemy/common/dbdma.c
index 3ab6d80d150d..19c1c82849ff 100644
--- a/arch/mips/alchemy/common/dbdma.c
+++ b/arch/mips/alchemy/common/dbdma.c
@@ -175,7 +175,7 @@ static dbdev_tab_t dbdev_tab[] = {
175#define DBDEV_TAB_SIZE ARRAY_SIZE(dbdev_tab) 175#define DBDEV_TAB_SIZE ARRAY_SIZE(dbdev_tab)
176 176
177#ifdef CONFIG_PM 177#ifdef CONFIG_PM
178static u32 au1xxx_dbdma_pm_regs[NUM_DBDMA_CHANS + 1][8]; 178static u32 au1xxx_dbdma_pm_regs[NUM_DBDMA_CHANS + 1][6];
179#endif 179#endif
180 180
181 181
@@ -993,14 +993,13 @@ void au1xxx_dbdma_suspend(void)
993 au1xxx_dbdma_pm_regs[0][3] = au_readl(addr + 0x0c); 993 au1xxx_dbdma_pm_regs[0][3] = au_readl(addr + 0x0c);
994 994
995 /* save channel configurations */ 995 /* save channel configurations */
996 for (i = 1, addr = DDMA_CHANNEL_BASE; i < NUM_DBDMA_CHANS; i++) { 996 for (i = 1, addr = DDMA_CHANNEL_BASE; i <= NUM_DBDMA_CHANS; i++) {
997 au1xxx_dbdma_pm_regs[i][0] = au_readl(addr + 0x00); 997 au1xxx_dbdma_pm_regs[i][0] = au_readl(addr + 0x00);
998 au1xxx_dbdma_pm_regs[i][1] = au_readl(addr + 0x04); 998 au1xxx_dbdma_pm_regs[i][1] = au_readl(addr + 0x04);
999 au1xxx_dbdma_pm_regs[i][2] = au_readl(addr + 0x08); 999 au1xxx_dbdma_pm_regs[i][2] = au_readl(addr + 0x08);
1000 au1xxx_dbdma_pm_regs[i][3] = au_readl(addr + 0x0c); 1000 au1xxx_dbdma_pm_regs[i][3] = au_readl(addr + 0x0c);
1001 au1xxx_dbdma_pm_regs[i][4] = au_readl(addr + 0x10); 1001 au1xxx_dbdma_pm_regs[i][4] = au_readl(addr + 0x10);
1002 au1xxx_dbdma_pm_regs[i][5] = au_readl(addr + 0x14); 1002 au1xxx_dbdma_pm_regs[i][5] = au_readl(addr + 0x14);
1003 au1xxx_dbdma_pm_regs[i][6] = au_readl(addr + 0x18);
1004 1003
1005 /* halt channel */ 1004 /* halt channel */
1006 au_writel(au1xxx_dbdma_pm_regs[i][0] & ~1, addr + 0x00); 1005 au_writel(au1xxx_dbdma_pm_regs[i][0] & ~1, addr + 0x00);
@@ -1027,14 +1026,13 @@ void au1xxx_dbdma_resume(void)
1027 au_writel(au1xxx_dbdma_pm_regs[0][3], addr + 0x0c); 1026 au_writel(au1xxx_dbdma_pm_regs[0][3], addr + 0x0c);
1028 1027
1029 /* restore channel configurations */ 1028 /* restore channel configurations */
1030 for (i = 1, addr = DDMA_CHANNEL_BASE; i < NUM_DBDMA_CHANS; i++) { 1029 for (i = 1, addr = DDMA_CHANNEL_BASE; i <= NUM_DBDMA_CHANS; i++) {
1031 au_writel(au1xxx_dbdma_pm_regs[i][0], addr + 0x00); 1030 au_writel(au1xxx_dbdma_pm_regs[i][0], addr + 0x00);
1032 au_writel(au1xxx_dbdma_pm_regs[i][1], addr + 0x04); 1031 au_writel(au1xxx_dbdma_pm_regs[i][1], addr + 0x04);
1033 au_writel(au1xxx_dbdma_pm_regs[i][2], addr + 0x08); 1032 au_writel(au1xxx_dbdma_pm_regs[i][2], addr + 0x08);
1034 au_writel(au1xxx_dbdma_pm_regs[i][3], addr + 0x0c); 1033 au_writel(au1xxx_dbdma_pm_regs[i][3], addr + 0x0c);
1035 au_writel(au1xxx_dbdma_pm_regs[i][4], addr + 0x10); 1034 au_writel(au1xxx_dbdma_pm_regs[i][4], addr + 0x10);
1036 au_writel(au1xxx_dbdma_pm_regs[i][5], addr + 0x14); 1035 au_writel(au1xxx_dbdma_pm_regs[i][5], addr + 0x14);
1037 au_writel(au1xxx_dbdma_pm_regs[i][6], addr + 0x18);
1038 au_sync(); 1036 au_sync();
1039 addr += 0x100; /* next channel base */ 1037 addr += 0x100; /* next channel base */
1040 } 1038 }
diff --git a/arch/mips/basler/excite/excite_iodev.c b/arch/mips/basler/excite/excite_iodev.c
index dfbfd7e2ac08..938b1d0b7652 100644
--- a/arch/mips/basler/excite/excite_iodev.c
+++ b/arch/mips/basler/excite/excite_iodev.c
@@ -112,10 +112,8 @@ static int iodev_open(struct inode *i, struct file *f)
112{ 112{
113 int ret; 113 int ret;
114 114
115 lock_kernel();
116 ret = request_irq(iodev_irq, iodev_irqhdl, IRQF_DISABLED, 115 ret = request_irq(iodev_irq, iodev_irqhdl, IRQF_DISABLED,
117 iodev_name, &miscdev); 116 iodev_name, &miscdev);
118 unlock_kernel();
119 117
120 return ret; 118 return ret;
121} 119}
diff --git a/arch/mips/bcm63xx/Makefile b/arch/mips/bcm63xx/Makefile
index aaa585cf26e3..c146d1ededed 100644
--- a/arch/mips/bcm63xx/Makefile
+++ b/arch/mips/bcm63xx/Makefile
@@ -1,5 +1,5 @@
1obj-y += clk.o cpu.o cs.o gpio.o irq.o prom.o setup.o timer.o \ 1obj-y += clk.o cpu.o cs.o gpio.o irq.o prom.o setup.o timer.o \
2 dev-dsp.o dev-enet.o 2 dev-dsp.o dev-enet.o dev-pcmcia.o dev-uart.o
3obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 3obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
4 4
5obj-y += boards/ 5obj-y += boards/
diff --git a/arch/mips/bcm63xx/boards/board_bcm963xx.c b/arch/mips/bcm63xx/boards/board_bcm963xx.c
index fd77f548207a..78e155d21be6 100644
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
@@ -20,10 +20,11 @@
20#include <bcm63xx_cpu.h> 20#include <bcm63xx_cpu.h>
21#include <bcm63xx_regs.h> 21#include <bcm63xx_regs.h>
22#include <bcm63xx_io.h> 22#include <bcm63xx_io.h>
23#include <bcm63xx_board.h>
24#include <bcm63xx_dev_pci.h> 23#include <bcm63xx_dev_pci.h>
25#include <bcm63xx_dev_enet.h> 24#include <bcm63xx_dev_enet.h>
26#include <bcm63xx_dev_dsp.h> 25#include <bcm63xx_dev_dsp.h>
26#include <bcm63xx_dev_pcmcia.h>
27#include <bcm63xx_dev_uart.h>
27#include <board_bcm963xx.h> 28#include <board_bcm963xx.h>
28 29
29#define PFX "board_bcm963xx: " 30#define PFX "board_bcm963xx: "
@@ -793,6 +794,11 @@ int __init board_register_devices(void)
793{ 794{
794 u32 val; 795 u32 val;
795 796
797 bcm63xx_uart_register();
798
799 if (board.has_pccard)
800 bcm63xx_pcmcia_register();
801
796 if (board.has_enet0 && 802 if (board.has_enet0 &&
797 !board_get_mac_address(board.enet0.mac_addr)) 803 !board_get_mac_address(board.enet0.mac_addr))
798 bcm63xx_enet_register(0, &board.enet0); 804 bcm63xx_enet_register(0, &board.enet0);
diff --git a/arch/mips/bcm63xx/dev-pcmcia.c b/arch/mips/bcm63xx/dev-pcmcia.c
new file mode 100644
index 000000000000..de4d917fd54d
--- /dev/null
+++ b/arch/mips/bcm63xx/dev-pcmcia.c
@@ -0,0 +1,144 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
7 */
8
9#include <linux/init.h>
10#include <linux/kernel.h>
11#include <asm/bootinfo.h>
12#include <linux/platform_device.h>
13#include <bcm63xx_cs.h>
14#include <bcm63xx_cpu.h>
15#include <bcm63xx_dev_pcmcia.h>
16#include <bcm63xx_io.h>
17#include <bcm63xx_regs.h>
18
19static struct resource pcmcia_resources[] = {
20 /* pcmcia registers */
21 {
22 /* start & end filled at runtime */
23 .flags = IORESOURCE_MEM,
24 },
25
26 /* pcmcia memory zone resources */
27 {
28 .start = BCM_PCMCIA_COMMON_BASE_PA,
29 .end = BCM_PCMCIA_COMMON_END_PA,
30 .flags = IORESOURCE_MEM,
31 },
32 {
33 .start = BCM_PCMCIA_ATTR_BASE_PA,
34 .end = BCM_PCMCIA_ATTR_END_PA,
35 .flags = IORESOURCE_MEM,
36 },
37 {
38 .start = BCM_PCMCIA_IO_BASE_PA,
39 .end = BCM_PCMCIA_IO_END_PA,
40 .flags = IORESOURCE_MEM,
41 },
42
43 /* PCMCIA irq */
44 {
45 /* start filled at runtime */
46 .flags = IORESOURCE_IRQ,
47 },
48
49 /* declare PCMCIA IO resource also */
50 {
51 .start = BCM_PCMCIA_IO_BASE_PA,
52 .end = BCM_PCMCIA_IO_END_PA,
53 .flags = IORESOURCE_IO,
54 },
55};
56
57static struct bcm63xx_pcmcia_platform_data pd;
58
59static struct platform_device bcm63xx_pcmcia_device = {
60 .name = "bcm63xx_pcmcia",
61 .id = 0,
62 .num_resources = ARRAY_SIZE(pcmcia_resources),
63 .resource = pcmcia_resources,
64 .dev = {
65 .platform_data = &pd,
66 },
67};
68
69static int __init config_pcmcia_cs(unsigned int cs,
70 u32 base, unsigned int size)
71{
72 int ret;
73
74 ret = bcm63xx_set_cs_status(cs, 0);
75 if (!ret)
76 ret = bcm63xx_set_cs_base(cs, base, size);
77 if (!ret)
78 ret = bcm63xx_set_cs_status(cs, 1);
79 return ret;
80}
81
82static const __initdata struct {
83 unsigned int cs;
84 unsigned int base;
85 unsigned int size;
86} pcmcia_cs[3] = {
87 {
88 .cs = MPI_CS_PCMCIA_COMMON,
89 .base = BCM_PCMCIA_COMMON_BASE_PA,
90 .size = BCM_PCMCIA_COMMON_SIZE
91 },
92 {
93 .cs = MPI_CS_PCMCIA_ATTR,
94 .base = BCM_PCMCIA_ATTR_BASE_PA,
95 .size = BCM_PCMCIA_ATTR_SIZE
96 },
97 {
98 .cs = MPI_CS_PCMCIA_IO,
99 .base = BCM_PCMCIA_IO_BASE_PA,
100 .size = BCM_PCMCIA_IO_SIZE
101 },
102};
103
104int __init bcm63xx_pcmcia_register(void)
105{
106 int ret, i;
107
108 if (!BCMCPU_IS_6348() && !BCMCPU_IS_6358())
109 return 0;
110
111 /* use correct pcmcia ready gpio depending on processor */
112 switch (bcm63xx_get_cpu_id()) {
113 case BCM6348_CPU_ID:
114 pd.ready_gpio = 22;
115 break;
116
117 case BCM6358_CPU_ID:
118 pd.ready_gpio = 18;
119 break;
120
121 default:
122 return -ENODEV;
123 }
124
125 pcmcia_resources[0].start = bcm63xx_regset_address(RSET_PCMCIA);
126 pcmcia_resources[0].end = pcmcia_resources[0].start +
127 RSET_PCMCIA_SIZE - 1;
128 pcmcia_resources[4].start = bcm63xx_get_irq_number(IRQ_PCMCIA);
129
130 /* configure pcmcia chip selects */
131 for (i = 0; i < 3; i++) {
132 ret = config_pcmcia_cs(pcmcia_cs[i].cs,
133 pcmcia_cs[i].base,
134 pcmcia_cs[i].size);
135 if (ret)
136 goto out_err;
137 }
138
139 return platform_device_register(&bcm63xx_pcmcia_device);
140
141out_err:
142 printk(KERN_ERR "unable to set pcmcia chip select\n");
143 return ret;
144}
diff --git a/arch/mips/bcm63xx/dev-uart.c b/arch/mips/bcm63xx/dev-uart.c
new file mode 100644
index 000000000000..5f3d89c4a988
--- /dev/null
+++ b/arch/mips/bcm63xx/dev-uart.c
@@ -0,0 +1,41 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
7 */
8
9#include <linux/init.h>
10#include <linux/kernel.h>
11#include <linux/platform_device.h>
12#include <bcm63xx_cpu.h>
13#include <bcm63xx_dev_uart.h>
14
15static struct resource uart_resources[] = {
16 {
17 .start = -1, /* filled at runtime */
18 .end = -1, /* filled at runtime */
19 .flags = IORESOURCE_MEM,
20 },
21 {
22 .start = -1, /* filled at runtime */
23 .flags = IORESOURCE_IRQ,
24 },
25};
26
27static struct platform_device bcm63xx_uart_device = {
28 .name = "bcm63xx_uart",
29 .id = 0,
30 .num_resources = ARRAY_SIZE(uart_resources),
31 .resource = uart_resources,
32};
33
34int __init bcm63xx_uart_register(void)
35{
36 uart_resources[0].start = bcm63xx_regset_address(RSET_UART0);
37 uart_resources[0].end = uart_resources[0].start;
38 uart_resources[0].end += RSET_UART_SIZE - 1;
39 uart_resources[1].start = bcm63xx_get_irq_number(IRQ_UART0);
40 return platform_device_register(&bcm63xx_uart_device);
41}
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_pcmcia.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_pcmcia.h
new file mode 100644
index 000000000000..2beb3969ce3b
--- /dev/null
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_pcmcia.h
@@ -0,0 +1,13 @@
1#ifndef BCM63XX_DEV_PCMCIA_H_
2#define BCM63XX_DEV_PCMCIA_H_
3
4/*
5 * PCMCIA driver platform data
6 */
7struct bcm63xx_pcmcia_platform_data {
8 unsigned int ready_gpio;
9};
10
11int bcm63xx_pcmcia_register(void);
12
13#endif /* BCM63XX_DEV_PCMCIA_H_ */
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_uart.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_uart.h
new file mode 100644
index 000000000000..bf348f573bbc
--- /dev/null
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_uart.h
@@ -0,0 +1,6 @@
1#ifndef BCM63XX_DEV_UART_H_
2#define BCM63XX_DEV_UART_H_
3
4int bcm63xx_uart_register(void);
5
6#endif /* BCM63XX_DEV_UART_H_ */
diff --git a/arch/mips/include/asm/smp.h b/arch/mips/include/asm/smp.h
index e15f11a09311..af42385245d5 100644
--- a/arch/mips/include/asm/smp.h
+++ b/arch/mips/include/asm/smp.h
@@ -77,7 +77,18 @@ extern void play_dead(void);
77 77
78extern asmlinkage void smp_call_function_interrupt(void); 78extern asmlinkage void smp_call_function_interrupt(void);
79 79
80extern void arch_send_call_function_single_ipi(int cpu); 80static inline void arch_send_call_function_single_ipi(int cpu)
81extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); 81{
82 extern struct plat_smp_ops *mp_ops; /* private */
83
84 mp_ops->send_ipi_mask(&cpumask_of_cpu(cpu), SMP_CALL_FUNCTION);
85}
86
87static inline void arch_send_call_function_ipi_mask(const struct cpumask *mask)
88{
89 extern struct plat_smp_ops *mp_ops; /* private */
90
91 mp_ops->send_ipi_mask(mask, SMP_CALL_FUNCTION);
92}
82 93
83#endif /* __ASM_SMP_H */ 94#endif /* __ASM_SMP_H */
diff --git a/arch/mips/include/asm/unaligned.h b/arch/mips/include/asm/unaligned.h
index 792404948571..42f66c311473 100644
--- a/arch/mips/include/asm/unaligned.h
+++ b/arch/mips/include/asm/unaligned.h
@@ -12,17 +12,17 @@
12#if defined(__MIPSEB__) 12#if defined(__MIPSEB__)
13# include <linux/unaligned/be_struct.h> 13# include <linux/unaligned/be_struct.h>
14# include <linux/unaligned/le_byteshift.h> 14# include <linux/unaligned/le_byteshift.h>
15# include <linux/unaligned/generic.h>
16# define get_unaligned __get_unaligned_be 15# define get_unaligned __get_unaligned_be
17# define put_unaligned __put_unaligned_be 16# define put_unaligned __put_unaligned_be
18#elif defined(__MIPSEL__) 17#elif defined(__MIPSEL__)
19# include <linux/unaligned/le_struct.h> 18# include <linux/unaligned/le_struct.h>
20# include <linux/unaligned/be_byteshift.h> 19# include <linux/unaligned/be_byteshift.h>
21# include <linux/unaligned/generic.h>
22# define get_unaligned __get_unaligned_le 20# define get_unaligned __get_unaligned_le
23# define put_unaligned __put_unaligned_le 21# define put_unaligned __put_unaligned_le
24#else 22#else
25# error "MIPS, but neither __MIPSEB__, nor __MIPSEL__???" 23# error "MIPS, but neither __MIPSEB__, nor __MIPSEL__???"
26#endif 24#endif
27 25
26# include <linux/unaligned/generic.h>
27
28#endif /* _ASM_MIPS_UNALIGNED_H */ 28#endif /* _ASM_MIPS_UNALIGNED_H */
diff --git a/arch/mips/kernel/kspd.c b/arch/mips/kernel/kspd.c
index f2397f00db43..ad4e017ed2f3 100644
--- a/arch/mips/kernel/kspd.c
+++ b/arch/mips/kernel/kspd.c
@@ -172,13 +172,20 @@ static unsigned int translate_open_flags(int flags)
172} 172}
173 173
174 174
175static void sp_setfsuidgid( uid_t uid, gid_t gid) 175static int sp_setfsuidgid(uid_t uid, gid_t gid)
176{ 176{
177 current->cred->fsuid = uid; 177 struct cred *new;
178 current->cred->fsgid = gid;
179 178
180 key_fsuid_changed(current); 179 new = prepare_creds();
181 key_fsgid_changed(current); 180 if (!new)
181 return -ENOMEM;
182
183 new->fsuid = uid;
184 new->fsgid = gid;
185
186 commit_creds(new);
187
188 return 0;
182} 189}
183 190
184/* 191/*
@@ -196,7 +203,7 @@ void sp_work_handle_request(void)
196 mm_segment_t old_fs; 203 mm_segment_t old_fs;
197 struct timeval tv; 204 struct timeval tv;
198 struct timezone tz; 205 struct timezone tz;
199 int cmd; 206 int err, cmd;
200 207
201 char *vcwd; 208 char *vcwd;
202 int size; 209 int size;
@@ -225,8 +232,11 @@ void sp_work_handle_request(void)
225 /* Run the syscall at the privilege of the user who loaded the 232 /* Run the syscall at the privilege of the user who loaded the
226 SP program */ 233 SP program */
227 234
228 if (vpe_getuid(tclimit)) 235 if (vpe_getuid(tclimit)) {
229 sp_setfsuidgid(vpe_getuid(tclimit), vpe_getgid(tclimit)); 236 err = sp_setfsuidgid(vpe_getuid(tclimit), vpe_getgid(tclimit));
237 if (!err)
238 pr_err("Change of creds failed\n");
239 }
230 240
231 switch (sc.cmd) { 241 switch (sc.cmd) {
232 /* needs the flags argument translating from SDE kit to 242 /* needs the flags argument translating from SDE kit to
@@ -283,8 +293,11 @@ void sp_work_handle_request(void)
283 break; 293 break;
284 } /* switch */ 294 } /* switch */
285 295
286 if (vpe_getuid(tclimit)) 296 if (vpe_getuid(tclimit)) {
287 sp_setfsuidgid( 0, 0); 297 err = sp_setfsuidgid(0, 0);
298 if (!err)
299 pr_err("restoring old creds failed\n");
300 }
288 301
289 old_fs = get_fs(); 302 old_fs = get_fs();
290 set_fs(KERNEL_DS); 303 set_fs(KERNEL_DS);
diff --git a/arch/mips/kernel/rtlx.c b/arch/mips/kernel/rtlx.c
index a10ebfdc28ae..364f066cb497 100644
--- a/arch/mips/kernel/rtlx.c
+++ b/arch/mips/kernel/rtlx.c
@@ -72,8 +72,9 @@ static void rtlx_dispatch(void)
72*/ 72*/
73static irqreturn_t rtlx_interrupt(int irq, void *dev_id) 73static irqreturn_t rtlx_interrupt(int irq, void *dev_id)
74{ 74{
75 unsigned int vpeflags;
76 unsigned long flags;
75 int i; 77 int i;
76 unsigned int flags, vpeflags;
77 78
78 /* Ought not to be strictly necessary for SMTC builds */ 79 /* Ought not to be strictly necessary for SMTC builds */
79 local_irq_save(flags); 80 local_irq_save(flags);
@@ -392,20 +393,12 @@ out:
392 393
393static int file_open(struct inode *inode, struct file *filp) 394static int file_open(struct inode *inode, struct file *filp)
394{ 395{
395 int minor = iminor(inode); 396 return rtlx_open(iminor(inode), (filp->f_flags & O_NONBLOCK) ? 0 : 1);
396 int err;
397
398 lock_kernel();
399 err = rtlx_open(minor, (filp->f_flags & O_NONBLOCK) ? 0 : 1);
400 unlock_kernel();
401 return err;
402} 397}
403 398
404static int file_release(struct inode *inode, struct file *filp) 399static int file_release(struct inode *inode, struct file *filp)
405{ 400{
406 int minor = iminor(inode); 401 return rtlx_release(iminor(inode));
407
408 return rtlx_release(minor);
409} 402}
410 403
411static unsigned int file_poll(struct file *file, poll_table * wait) 404static unsigned int file_poll(struct file *file, poll_table * wait)
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index 4eb106c6a3ec..e72e6844d134 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -32,7 +32,6 @@
32#include <linux/cpumask.h> 32#include <linux/cpumask.h>
33#include <linux/cpu.h> 33#include <linux/cpu.h>
34#include <linux/err.h> 34#include <linux/err.h>
35#include <linux/smp.h>
36 35
37#include <asm/atomic.h> 36#include <asm/atomic.h>
38#include <asm/cpu.h> 37#include <asm/cpu.h>
@@ -128,19 +127,6 @@ asmlinkage __cpuinit void start_secondary(void)
128 cpu_idle(); 127 cpu_idle();
129} 128}
130 129
131void arch_send_call_function_ipi_mask(const struct cpumask *mask)
132{
133 mp_ops->send_ipi_mask(mask, SMP_CALL_FUNCTION);
134}
135
136/*
137 * We reuse the same vector for the single IPI
138 */
139void arch_send_call_function_single_ipi(int cpu)
140{
141 mp_ops->send_ipi_mask(cpumask_of_cpu(cpu), SMP_CALL_FUNCTION);
142}
143
144/* 130/*
145 * Call into both interrupt handlers, as we share the IPI for them 131 * Call into both interrupt handlers, as we share the IPI for them
146 */ 132 */
diff --git a/arch/mips/kernel/smtc.c b/arch/mips/kernel/smtc.c
index 67153a0dc267..4d181df44a40 100644
--- a/arch/mips/kernel/smtc.c
+++ b/arch/mips/kernel/smtc.c
@@ -1098,9 +1098,8 @@ static void ipi_irq_dispatch(void)
1098 1098
1099static struct irqaction irq_ipi = { 1099static struct irqaction irq_ipi = {
1100 .handler = ipi_interrupt, 1100 .handler = ipi_interrupt,
1101 .flags = IRQF_DISABLED, 1101 .flags = IRQF_DISABLED | IRQF_PERCPU,
1102 .name = "SMTC_IPI", 1102 .name = "SMTC_IPI"
1103 .flags = IRQF_PERCPU
1104}; 1103};
1105 1104
1106static void setup_cross_vpe_interrupts(unsigned int nvpe) 1105static void setup_cross_vpe_interrupts(unsigned int nvpe)
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c
index eb6c4c5b7fbe..03092ab2a296 100644
--- a/arch/mips/kernel/vpe.c
+++ b/arch/mips/kernel/vpe.c
@@ -144,14 +144,15 @@ struct tc {
144}; 144};
145 145
146struct { 146struct {
147 /* Virtual processing elements */ 147 spinlock_t vpe_list_lock;
148 struct list_head vpe_list; 148 struct list_head vpe_list; /* Virtual processing elements */
149 149 spinlock_t tc_list_lock;
150 /* Thread contexts */ 150 struct list_head tc_list; /* Thread contexts */
151 struct list_head tc_list;
152} vpecontrol = { 151} vpecontrol = {
153 .vpe_list = LIST_HEAD_INIT(vpecontrol.vpe_list), 152 .vpe_list_lock = SPIN_LOCK_UNLOCKED,
154 .tc_list = LIST_HEAD_INIT(vpecontrol.tc_list) 153 .vpe_list = LIST_HEAD_INIT(vpecontrol.vpe_list),
154 .tc_list_lock = SPIN_LOCK_UNLOCKED,
155 .tc_list = LIST_HEAD_INIT(vpecontrol.tc_list)
155}; 156};
156 157
157static void release_progmem(void *ptr); 158static void release_progmem(void *ptr);
@@ -159,28 +160,38 @@ static void release_progmem(void *ptr);
159/* get the vpe associated with this minor */ 160/* get the vpe associated with this minor */
160static struct vpe *get_vpe(int minor) 161static struct vpe *get_vpe(int minor)
161{ 162{
162 struct vpe *v; 163 struct vpe *res, *v;
163 164
164 if (!cpu_has_mipsmt) 165 if (!cpu_has_mipsmt)
165 return NULL; 166 return NULL;
166 167
168 res = NULL;
169 spin_lock(&vpecontrol.vpe_list_lock);
167 list_for_each_entry(v, &vpecontrol.vpe_list, list) { 170 list_for_each_entry(v, &vpecontrol.vpe_list, list) {
168 if (v->minor == minor) 171 if (v->minor == minor) {
169 return v; 172 res = v;
173 break;
174 }
170 } 175 }
176 spin_unlock(&vpecontrol.vpe_list_lock);
171 177
172 return NULL; 178 return res;
173} 179}
174 180
175/* get the vpe associated with this minor */ 181/* get the vpe associated with this minor */
176static struct tc *get_tc(int index) 182static struct tc *get_tc(int index)
177{ 183{
178 struct tc *t; 184 struct tc *res, *t;
179 185
186 res = NULL;
187 spin_lock(&vpecontrol.tc_list_lock);
180 list_for_each_entry(t, &vpecontrol.tc_list, list) { 188 list_for_each_entry(t, &vpecontrol.tc_list, list) {
181 if (t->index == index) 189 if (t->index == index) {
182 return t; 190 res = t;
191 break;
192 }
183 } 193 }
194 spin_unlock(&vpecontrol.tc_list_lock);
184 195
185 return NULL; 196 return NULL;
186} 197}
@@ -190,15 +201,17 @@ static struct vpe *alloc_vpe(int minor)
190{ 201{
191 struct vpe *v; 202 struct vpe *v;
192 203
193 if ((v = kzalloc(sizeof(struct vpe), GFP_KERNEL)) == NULL) { 204 if ((v = kzalloc(sizeof(struct vpe), GFP_KERNEL)) == NULL)
194 return NULL; 205 return NULL;
195 }
196 206
197 INIT_LIST_HEAD(&v->tc); 207 INIT_LIST_HEAD(&v->tc);
208 spin_lock(&vpecontrol.vpe_list_lock);
198 list_add_tail(&v->list, &vpecontrol.vpe_list); 209 list_add_tail(&v->list, &vpecontrol.vpe_list);
210 spin_unlock(&vpecontrol.vpe_list_lock);
199 211
200 INIT_LIST_HEAD(&v->notify); 212 INIT_LIST_HEAD(&v->notify);
201 v->minor = minor; 213 v->minor = minor;
214
202 return v; 215 return v;
203} 216}
204 217
@@ -212,7 +225,10 @@ static struct tc *alloc_tc(int index)
212 225
213 INIT_LIST_HEAD(&tc->tc); 226 INIT_LIST_HEAD(&tc->tc);
214 tc->index = index; 227 tc->index = index;
228
229 spin_lock(&vpecontrol.tc_list_lock);
215 list_add_tail(&tc->list, &vpecontrol.tc_list); 230 list_add_tail(&tc->list, &vpecontrol.tc_list);
231 spin_unlock(&vpecontrol.tc_list_lock);
216 232
217out: 233out:
218 return tc; 234 return tc;
@@ -227,7 +243,7 @@ static void release_vpe(struct vpe *v)
227 kfree(v); 243 kfree(v);
228} 244}
229 245
230static void dump_mtregs(void) 246static void __maybe_unused dump_mtregs(void)
231{ 247{
232 unsigned long val; 248 unsigned long val;
233 249
@@ -1048,20 +1064,19 @@ static int vpe_open(struct inode *inode, struct file *filp)
1048 enum vpe_state state; 1064 enum vpe_state state;
1049 struct vpe_notifications *not; 1065 struct vpe_notifications *not;
1050 struct vpe *v; 1066 struct vpe *v;
1051 int ret, err = 0; 1067 int ret;
1052 1068
1053 lock_kernel();
1054 if (minor != iminor(inode)) { 1069 if (minor != iminor(inode)) {
1055 /* assume only 1 device at the moment. */ 1070 /* assume only 1 device at the moment. */
1056 printk(KERN_WARNING "VPE loader: only vpe1 is supported\n"); 1071 pr_warning("VPE loader: only vpe1 is supported\n");
1057 err = -ENODEV; 1072
1058 goto out; 1073 return -ENODEV;
1059 } 1074 }
1060 1075
1061 if ((v = get_vpe(tclimit)) == NULL) { 1076 if ((v = get_vpe(tclimit)) == NULL) {
1062 printk(KERN_WARNING "VPE loader: unable to get vpe\n"); 1077 pr_warning("VPE loader: unable to get vpe\n");
1063 err = -ENODEV; 1078
1064 goto out; 1079 return -ENODEV;
1065 } 1080 }
1066 1081
1067 state = xchg(&v->state, VPE_STATE_INUSE); 1082 state = xchg(&v->state, VPE_STATE_INUSE);
@@ -1101,8 +1116,8 @@ static int vpe_open(struct inode *inode, struct file *filp)
1101 v->shared_ptr = NULL; 1116 v->shared_ptr = NULL;
1102 v->__start = 0; 1117 v->__start = 0;
1103 1118
1104out:
1105 unlock_kernel(); 1119 unlock_kernel();
1120
1106 return 0; 1121 return 0;
1107} 1122}
1108 1123
@@ -1594,14 +1609,14 @@ static void __exit vpe_module_exit(void)
1594{ 1609{
1595 struct vpe *v, *n; 1610 struct vpe *v, *n;
1596 1611
1612 device_del(&vpe_device);
1613 unregister_chrdev(major, module_name);
1614
1615 /* No locking needed here */
1597 list_for_each_entry_safe(v, n, &vpecontrol.vpe_list, list) { 1616 list_for_each_entry_safe(v, n, &vpecontrol.vpe_list, list) {
1598 if (v->state != VPE_STATE_UNUSED) { 1617 if (v->state != VPE_STATE_UNUSED)
1599 release_vpe(v); 1618 release_vpe(v);
1600 }
1601 } 1619 }
1602
1603 device_del(&vpe_device);
1604 unregister_chrdev(major, module_name);
1605} 1620}
1606 1621
1607module_init(vpe_module_init); 1622module_init(vpe_module_init);
diff --git a/arch/mips/mm/sc-mips.c b/arch/mips/mm/sc-mips.c
index b55c2d1b998f..5ab5fa8c1d82 100644
--- a/arch/mips/mm/sc-mips.c
+++ b/arch/mips/mm/sc-mips.c
@@ -32,6 +32,11 @@ static void mips_sc_wback_inv(unsigned long addr, unsigned long size)
32 */ 32 */
33static void mips_sc_inv(unsigned long addr, unsigned long size) 33static void mips_sc_inv(unsigned long addr, unsigned long size)
34{ 34{
35 unsigned long lsize = cpu_scache_line_size();
36 unsigned long almask = ~(lsize - 1);
37
38 cache_op(Hit_Writeback_Inv_SD, addr & almask);
39 cache_op(Hit_Writeback_Inv_SD, (addr + size - 1) & almask);
35 blast_inv_scache_range(addr, addr + size); 40 blast_inv_scache_range(addr, addr + size);
36} 41}
37 42
diff --git a/arch/mips/oprofile/op_model_loongson2.c b/arch/mips/oprofile/op_model_loongson2.c
index 655cb8dec340..deed1d5d4982 100644
--- a/arch/mips/oprofile/op_model_loongson2.c
+++ b/arch/mips/oprofile/op_model_loongson2.c
@@ -44,7 +44,7 @@ static struct loongson2_register_config {
44 unsigned int ctrl; 44 unsigned int ctrl;
45 unsigned long long reset_counter1; 45 unsigned long long reset_counter1;
46 unsigned long long reset_counter2; 46 unsigned long long reset_counter2;
47 int cnt1_enalbed, cnt2_enalbed; 47 int cnt1_enabled, cnt2_enabled;
48} reg; 48} reg;
49 49
50DEFINE_SPINLOCK(sample_lock); 50DEFINE_SPINLOCK(sample_lock);
@@ -81,8 +81,8 @@ static void loongson2_reg_setup(struct op_counter_config *cfg)
81 81
82 reg.ctrl = ctrl; 82 reg.ctrl = ctrl;
83 83
84 reg.cnt1_enalbed = cfg[0].enabled; 84 reg.cnt1_enabled = cfg[0].enabled;
85 reg.cnt2_enalbed = cfg[1].enabled; 85 reg.cnt2_enabled = cfg[1].enabled;
86 86
87} 87}
88 88
@@ -99,7 +99,7 @@ static void loongson2_cpu_setup(void *args)
99static void loongson2_cpu_start(void *args) 99static void loongson2_cpu_start(void *args)
100{ 100{
101 /* Start all counters on current CPU */ 101 /* Start all counters on current CPU */
102 if (reg.cnt1_enalbed || reg.cnt2_enalbed) 102 if (reg.cnt1_enabled || reg.cnt2_enabled)
103 write_c0_perfctrl(reg.ctrl); 103 write_c0_perfctrl(reg.ctrl);
104} 104}
105 105
@@ -125,7 +125,7 @@ static irqreturn_t loongson2_perfcount_handler(int irq, void *dev_id)
125 */ 125 */
126 126
127 /* Check whether the irq belongs to me */ 127 /* Check whether the irq belongs to me */
128 enabled = reg.cnt1_enalbed | reg.cnt2_enalbed; 128 enabled = reg.cnt1_enabled | reg.cnt2_enabled;
129 if (!enabled) 129 if (!enabled)
130 return IRQ_NONE; 130 return IRQ_NONE;
131 131
@@ -136,12 +136,12 @@ static irqreturn_t loongson2_perfcount_handler(int irq, void *dev_id)
136 spin_lock_irqsave(&sample_lock, flags); 136 spin_lock_irqsave(&sample_lock, flags);
137 137
138 if (counter1 & LOONGSON2_PERFCNT_OVERFLOW) { 138 if (counter1 & LOONGSON2_PERFCNT_OVERFLOW) {
139 if (reg.cnt1_enalbed) 139 if (reg.cnt1_enabled)
140 oprofile_add_sample(regs, 0); 140 oprofile_add_sample(regs, 0);
141 counter1 = reg.reset_counter1; 141 counter1 = reg.reset_counter1;
142 } 142 }
143 if (counter2 & LOONGSON2_PERFCNT_OVERFLOW) { 143 if (counter2 & LOONGSON2_PERFCNT_OVERFLOW) {
144 if (reg.cnt2_enalbed) 144 if (reg.cnt2_enabled)
145 oprofile_add_sample(regs, 1); 145 oprofile_add_sample(regs, 1);
146 counter2 = reg.reset_counter2; 146 counter2 = reg.reset_counter2;
147 } 147 }
diff --git a/arch/mips/pci/ops-pmcmsp.c b/arch/mips/pci/ops-pmcmsp.c
index 109c95ca698b..32548b5d68d6 100644
--- a/arch/mips/pci/ops-pmcmsp.c
+++ b/arch/mips/pci/ops-pmcmsp.c
@@ -385,6 +385,7 @@ int msp_pcibios_config_access(unsigned char access_type,
385 unsigned long intr; 385 unsigned long intr;
386 unsigned long value; 386 unsigned long value;
387 static char pciirqflag; 387 static char pciirqflag;
388 int ret;
388#if defined(CONFIG_PMC_MSP7120_GW) || defined(CONFIG_PMC_MSP7120_EVAL) 389#if defined(CONFIG_PMC_MSP7120_GW) || defined(CONFIG_PMC_MSP7120_EVAL)
389 unsigned int vpe_status; 390 unsigned int vpe_status;
390#endif 391#endif
@@ -402,11 +403,13 @@ int msp_pcibios_config_access(unsigned char access_type,
402 * allocation assigns an interrupt handler to the interrupt. 403 * allocation assigns an interrupt handler to the interrupt.
403 */ 404 */
404 if (pciirqflag == 0) { 405 if (pciirqflag == 0) {
405 request_irq(MSP_INT_PCI,/* Hardcoded internal MSP7120 wiring */ 406 ret = request_irq(MSP_INT_PCI,/* Hardcoded internal MSP7120 wiring */
406 bpci_interrupt, 407 bpci_interrupt,
407 IRQF_SHARED | IRQF_DISABLED, 408 IRQF_SHARED | IRQF_DISABLED,
408 "PMC MSP PCI Host", 409 "PMC MSP PCI Host",
409 preg); 410 preg);
411 if (ret != 0)
412 return ret;
410 pciirqflag = ~0; 413 pciirqflag = ~0;
411 } 414 }
412 415
diff --git a/arch/mips/sgi-ip27/ip27-smp.c b/arch/mips/sgi-ip27/ip27-smp.c
index 9aa8f2951df6..c6851df9ab74 100644
--- a/arch/mips/sgi-ip27/ip27-smp.c
+++ b/arch/mips/sgi-ip27/ip27-smp.c
@@ -165,7 +165,7 @@ static void ip27_send_ipi_single(int destid, unsigned int action)
165 REMOTE_HUB_SEND_INTR(COMPACT_TO_NASID_NODEID(cpu_to_node(destid)), irq); 165 REMOTE_HUB_SEND_INTR(COMPACT_TO_NASID_NODEID(cpu_to_node(destid)), irq);
166} 166}
167 167
168static void ip27_send_ipi(const struct cpumask *mask, unsigned int action) 168static void ip27_send_ipi_mask(const struct cpumask *mask, unsigned int action)
169{ 169{
170 unsigned int i; 170 unsigned int i;
171 171
diff --git a/arch/mips/sibyte/bcm1480/irq.c b/arch/mips/sibyte/bcm1480/irq.c
index ba59839a021e..4070268aa769 100644
--- a/arch/mips/sibyte/bcm1480/irq.c
+++ b/arch/mips/sibyte/bcm1480/irq.c
@@ -117,10 +117,6 @@ static int bcm1480_set_affinity(unsigned int irq, const struct cpumask *mask)
117 unsigned long flags; 117 unsigned long flags;
118 unsigned int irq_dirty; 118 unsigned int irq_dirty;
119 119
120 if (cpumask_weight(mask) != 1) {
121 printk("attempted to set irq affinity for irq %d to multiple CPUs\n", irq);
122 return -1;
123 }
124 i = cpumask_first(mask); 120 i = cpumask_first(mask);
125 121
126 /* Convert logical CPU to physical CPU */ 122 /* Convert logical CPU to physical CPU */
diff --git a/arch/mips/sibyte/common/sb_tbprof.c b/arch/mips/sibyte/common/sb_tbprof.c
index 637a194e5cd5..15ea778b5e66 100644
--- a/arch/mips/sibyte/common/sb_tbprof.c
+++ b/arch/mips/sibyte/common/sb_tbprof.c
@@ -403,36 +403,31 @@ static int sbprof_zbprof_stop(void)
403static int sbprof_tb_open(struct inode *inode, struct file *filp) 403static int sbprof_tb_open(struct inode *inode, struct file *filp)
404{ 404{
405 int minor; 405 int minor;
406 int err = 0;
407 406
408 lock_kernel();
409 minor = iminor(inode); 407 minor = iminor(inode);
410 if (minor != 0) { 408 if (minor != 0)
411 err = -ENODEV; 409 return -ENODEV;
412 goto out;
413 }
414 410
415 if (xchg(&sbp.open, SB_OPENING) != SB_CLOSED) { 411 if (xchg(&sbp.open, SB_OPENING) != SB_CLOSED)
416 err = -EBUSY; 412 return -EBUSY;
417 goto out;
418 }
419 413
420 memset(&sbp, 0, sizeof(struct sbprof_tb)); 414 memset(&sbp, 0, sizeof(struct sbprof_tb));
421 sbp.sbprof_tbbuf = vmalloc(MAX_TBSAMPLE_BYTES); 415 sbp.sbprof_tbbuf = vmalloc(MAX_TBSAMPLE_BYTES);
422 if (!sbp.sbprof_tbbuf) { 416 if (!sbp.sbprof_tbbuf) {
423 err = -ENOMEM; 417 sbp.open = SB_CLOSED;
424 goto out; 418 wmb();
419 return -ENOMEM;
425 } 420 }
421
426 memset(sbp.sbprof_tbbuf, 0, MAX_TBSAMPLE_BYTES); 422 memset(sbp.sbprof_tbbuf, 0, MAX_TBSAMPLE_BYTES);
427 init_waitqueue_head(&sbp.tb_sync); 423 init_waitqueue_head(&sbp.tb_sync);
428 init_waitqueue_head(&sbp.tb_read); 424 init_waitqueue_head(&sbp.tb_read);
429 mutex_init(&sbp.lock); 425 mutex_init(&sbp.lock);
430 426
431 sbp.open = SB_OPEN; 427 sbp.open = SB_OPEN;
428 wmb();
432 429
433 out: 430 return 0;
434 unlock_kernel();
435 return err;
436} 431}
437 432
438static int sbprof_tb_release(struct inode *inode, struct file *filp) 433static int sbprof_tb_release(struct inode *inode, struct file *filp)
@@ -440,7 +435,7 @@ static int sbprof_tb_release(struct inode *inode, struct file *filp)
440 int minor; 435 int minor;
441 436
442 minor = iminor(inode); 437 minor = iminor(inode);
443 if (minor != 0 || !sbp.open) 438 if (minor != 0 || sbp.open != SB_CLOSED)
444 return -ENODEV; 439 return -ENODEV;
445 440
446 mutex_lock(&sbp.lock); 441 mutex_lock(&sbp.lock);
@@ -449,7 +444,8 @@ static int sbprof_tb_release(struct inode *inode, struct file *filp)
449 sbprof_zbprof_stop(); 444 sbprof_zbprof_stop();
450 445
451 vfree(sbp.sbprof_tbbuf); 446 vfree(sbp.sbprof_tbbuf);
452 sbp.open = 0; 447 sbp.open = SB_CLOSED;
448 wmb();
453 449
454 mutex_unlock(&sbp.lock); 450 mutex_unlock(&sbp.lock);
455 451
@@ -583,7 +579,8 @@ static int __init sbprof_tb_init(void)
583 } 579 }
584 tb_dev = dev; 580 tb_dev = dev;
585 581
586 sbp.open = 0; 582 sbp.open = SB_CLOSED;
583 wmb();
587 tb_period = zbbus_mhz * 10000LL; 584 tb_period = zbbus_mhz * 10000LL;
588 pr_info(DEVNAME ": initialized - tb_period = %lld\n", 585 pr_info(DEVNAME ": initialized - tb_period = %lld\n",
589 (long long) tb_period); 586 (long long) tb_period);
diff --git a/arch/mips/sibyte/swarm/setup.c b/arch/mips/sibyte/swarm/setup.c
index 623ffc933c4c..5277aac96b0f 100644
--- a/arch/mips/sibyte/swarm/setup.c
+++ b/arch/mips/sibyte/swarm/setup.c
@@ -106,7 +106,7 @@ void read_persistent_clock(struct timespec *ts)
106 break; 106 break;
107 } 107 }
108 ts->tv_sec = sec; 108 ts->tv_sec = sec;
109 tv->tv_nsec = 0; 109 ts->tv_nsec = 0;
110} 110}
111 111
112int rtc_mips_set_time(unsigned long sec) 112int rtc_mips_set_time(unsigned long sec)