Annotation of /trunk/kernel-alx/patches-3.14/0106-3.14.7-all-fixes.patch
Parent Directory | Revision Log
Revision 2506 -
(hide annotations)
(download)
Fri Oct 17 07:55:45 2014 UTC (9 years, 11 months ago) by niro
File size: 90750 byte(s)
Fri Oct 17 07:55:45 2014 UTC (9 years, 11 months ago) by niro
File size: 90750 byte(s)
-patches for 3.14
1 | niro | 2506 | diff --git a/Documentation/DocBook/media/Makefile b/Documentation/DocBook/media/Makefile |
2 | index f9fd615427fb..1d27f0a1abd1 100644 | ||
3 | --- a/Documentation/DocBook/media/Makefile | ||
4 | +++ b/Documentation/DocBook/media/Makefile | ||
5 | @@ -195,7 +195,7 @@ DVB_DOCUMENTED = \ | ||
6 | # | ||
7 | |||
8 | install_media_images = \ | ||
9 | - $(Q)cp $(OBJIMGFILES) $(MEDIA_SRC_DIR)/v4l/*.svg $(MEDIA_OBJ_DIR)/media_api | ||
10 | + $(Q)-cp $(OBJIMGFILES) $(MEDIA_SRC_DIR)/v4l/*.svg $(MEDIA_OBJ_DIR)/media_api | ||
11 | |||
12 | $(MEDIA_OBJ_DIR)/%: $(MEDIA_SRC_DIR)/%.b64 | ||
13 | $(Q)base64 -d $< >$@ | ||
14 | diff --git a/Documentation/debugging-via-ohci1394.txt b/Documentation/debugging-via-ohci1394.txt | ||
15 | index fa0151a712f9..5c9a567b3fac 100644 | ||
16 | --- a/Documentation/debugging-via-ohci1394.txt | ||
17 | +++ b/Documentation/debugging-via-ohci1394.txt | ||
18 | @@ -25,9 +25,11 @@ using data transfer rates in the order of 10MB/s or more. | ||
19 | With most FireWire controllers, memory access is limited to the low 4 GB | ||
20 | of physical address space. This can be a problem on IA64 machines where | ||
21 | memory is located mostly above that limit, but it is rarely a problem on | ||
22 | -more common hardware such as x86, x86-64 and PowerPC. However, at least | ||
23 | -Agere/LSI FW643e and FW643e2 controllers are known to support access to | ||
24 | -physical addresses above 4 GB. | ||
25 | +more common hardware such as x86, x86-64 and PowerPC. | ||
26 | + | ||
27 | +At least LSI FW643e and FW643e2 controllers are known to support access to | ||
28 | +physical addresses above 4 GB, but this feature is currently not enabled by | ||
29 | +Linux. | ||
30 | |||
31 | Together with a early initialization of the OHCI-1394 controller for debugging, | ||
32 | this facility proved most useful for examining long debugs logs in the printk | ||
33 | @@ -101,8 +103,9 @@ Step-by-step instructions for using firescope with early OHCI initialization: | ||
34 | compliant, they are based on TI PCILynx chips and require drivers for Win- | ||
35 | dows operating systems. | ||
36 | |||
37 | - The mentioned kernel log message contains ">4 GB phys DMA" in case of | ||
38 | - OHCI-1394 controllers which support accesses above this limit. | ||
39 | + The mentioned kernel log message contains the string "physUB" if the | ||
40 | + controller implements a writable Physical Upper Bound register. This is | ||
41 | + required for physical DMA above 4 GB (but not utilized by Linux yet). | ||
42 | |||
43 | 2) Establish a working FireWire cable connection: | ||
44 | |||
45 | diff --git a/Documentation/device-mapper/thin-provisioning.txt b/Documentation/device-mapper/thin-provisioning.txt | ||
46 | index 05a27e9442bd..2f5173500bd9 100644 | ||
47 | --- a/Documentation/device-mapper/thin-provisioning.txt | ||
48 | +++ b/Documentation/device-mapper/thin-provisioning.txt | ||
49 | @@ -309,7 +309,10 @@ ii) Status | ||
50 | error_if_no_space|queue_if_no_space | ||
51 | If the pool runs out of data or metadata space, the pool will | ||
52 | either queue or error the IO destined to the data device. The | ||
53 | - default is to queue the IO until more space is added. | ||
54 | + default is to queue the IO until more space is added or the | ||
55 | + 'no_space_timeout' expires. The 'no_space_timeout' dm-thin-pool | ||
56 | + module parameter can be used to change this timeout -- it | ||
57 | + defaults to 60 seconds but may be disabled using a value of 0. | ||
58 | |||
59 | iii) Messages | ||
60 | |||
61 | diff --git a/Makefile b/Makefile | ||
62 | index 0d499e6896cd..f2d1225828c2 100644 | ||
63 | --- a/Makefile | ||
64 | +++ b/Makefile | ||
65 | @@ -1,6 +1,6 @@ | ||
66 | VERSION = 3 | ||
67 | PATCHLEVEL = 14 | ||
68 | -SUBLEVEL = 6 | ||
69 | +SUBLEVEL = 7 | ||
70 | EXTRAVERSION = | ||
71 | NAME = Remembering Coco | ||
72 | |||
73 | diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h | ||
74 | index 72abdc541f38..7f3f3cc25d7e 100644 | ||
75 | --- a/arch/arm/include/asm/uaccess.h | ||
76 | +++ b/arch/arm/include/asm/uaccess.h | ||
77 | @@ -171,8 +171,9 @@ extern int __put_user_8(void *, unsigned long long); | ||
78 | #define __put_user_check(x,p) \ | ||
79 | ({ \ | ||
80 | unsigned long __limit = current_thread_info()->addr_limit - 1; \ | ||
81 | + const typeof(*(p)) __user *__tmp_p = (p); \ | ||
82 | register const typeof(*(p)) __r2 asm("r2") = (x); \ | ||
83 | - register const typeof(*(p)) __user *__p asm("r0") = (p);\ | ||
84 | + register const typeof(*(p)) __user *__p asm("r0") = __tmp_p; \ | ||
85 | register unsigned long __l asm("r1") = __limit; \ | ||
86 | register int __e asm("r0"); \ | ||
87 | switch (sizeof(*(__p))) { \ | ||
88 | diff --git a/arch/arm/kernel/entry-header.S b/arch/arm/kernel/entry-header.S | ||
89 | index 39f89fbd5111..88c6babeb0b5 100644 | ||
90 | --- a/arch/arm/kernel/entry-header.S | ||
91 | +++ b/arch/arm/kernel/entry-header.S | ||
92 | @@ -132,6 +132,10 @@ | ||
93 | orrne r5, V7M_xPSR_FRAMEPTRALIGN | ||
94 | biceq r5, V7M_xPSR_FRAMEPTRALIGN | ||
95 | |||
96 | + @ ensure bit 0 is cleared in the PC, otherwise behaviour is | ||
97 | + @ unpredictable | ||
98 | + bic r4, #1 | ||
99 | + | ||
100 | @ write basic exception frame | ||
101 | stmdb r2!, {r1, r3-r5} | ||
102 | ldmia sp, {r1, r3-r5} | ||
103 | diff --git a/arch/arm/mach-imx/devices/platform-ipu-core.c b/arch/arm/mach-imx/devices/platform-ipu-core.c | ||
104 | index fc4dd7cedc11..6bd7c3f37ac0 100644 | ||
105 | --- a/arch/arm/mach-imx/devices/platform-ipu-core.c | ||
106 | +++ b/arch/arm/mach-imx/devices/platform-ipu-core.c | ||
107 | @@ -77,7 +77,7 @@ struct platform_device *__init imx_alloc_mx3_camera( | ||
108 | |||
109 | pdev = platform_device_alloc("mx3-camera", 0); | ||
110 | if (!pdev) | ||
111 | - goto err; | ||
112 | + return ERR_PTR(-ENOMEM); | ||
113 | |||
114 | pdev->dev.dma_mask = kmalloc(sizeof(*pdev->dev.dma_mask), GFP_KERNEL); | ||
115 | if (!pdev->dev.dma_mask) | ||
116 | diff --git a/arch/arm/mach-omap2/board-flash.c b/arch/arm/mach-omap2/board-flash.c | ||
117 | index ac82512b9c8c..b6885e42c0a0 100644 | ||
118 | --- a/arch/arm/mach-omap2/board-flash.c | ||
119 | +++ b/arch/arm/mach-omap2/board-flash.c | ||
120 | @@ -142,7 +142,7 @@ __init board_nand_init(struct mtd_partition *nand_parts, u8 nr_parts, u8 cs, | ||
121 | board_nand_data.nr_parts = nr_parts; | ||
122 | board_nand_data.devsize = nand_type; | ||
123 | |||
124 | - board_nand_data.ecc_opt = OMAP_ECC_BCH8_CODE_HW; | ||
125 | + board_nand_data.ecc_opt = OMAP_ECC_HAM1_CODE_HW; | ||
126 | gpmc_nand_init(&board_nand_data, gpmc_t); | ||
127 | } | ||
128 | #endif /* CONFIG_MTD_NAND_OMAP2 || CONFIG_MTD_NAND_OMAP2_MODULE */ | ||
129 | diff --git a/arch/arm/mach-omap2/cclock3xxx_data.c b/arch/arm/mach-omap2/cclock3xxx_data.c | ||
130 | index 11ed9152e665..793039a9bd26 100644 | ||
131 | --- a/arch/arm/mach-omap2/cclock3xxx_data.c | ||
132 | +++ b/arch/arm/mach-omap2/cclock3xxx_data.c | ||
133 | @@ -456,7 +456,8 @@ static struct clk_hw_omap dpll4_m5x2_ck_hw = { | ||
134 | .clkdm_name = "dpll4_clkdm", | ||
135 | }; | ||
136 | |||
137 | -DEFINE_STRUCT_CLK(dpll4_m5x2_ck, dpll4_m5x2_ck_parent_names, dpll4_m5x2_ck_ops); | ||
138 | +DEFINE_STRUCT_CLK_FLAGS(dpll4_m5x2_ck, dpll4_m5x2_ck_parent_names, | ||
139 | + dpll4_m5x2_ck_ops, CLK_SET_RATE_PARENT); | ||
140 | |||
141 | static struct clk dpll4_m5x2_ck_3630 = { | ||
142 | .name = "dpll4_m5x2_ck", | ||
143 | diff --git a/arch/arm/mach-omap2/cpuidle44xx.c b/arch/arm/mach-omap2/cpuidle44xx.c | ||
144 | index 01fc710c8181..2498ab025fa2 100644 | ||
145 | --- a/arch/arm/mach-omap2/cpuidle44xx.c | ||
146 | +++ b/arch/arm/mach-omap2/cpuidle44xx.c | ||
147 | @@ -14,6 +14,7 @@ | ||
148 | #include <linux/cpuidle.h> | ||
149 | #include <linux/cpu_pm.h> | ||
150 | #include <linux/export.h> | ||
151 | +#include <linux/clockchips.h> | ||
152 | |||
153 | #include <asm/cpuidle.h> | ||
154 | #include <asm/proc-fns.h> | ||
155 | @@ -83,6 +84,7 @@ static int omap_enter_idle_coupled(struct cpuidle_device *dev, | ||
156 | { | ||
157 | struct idle_statedata *cx = state_ptr + index; | ||
158 | u32 mpuss_can_lose_context = 0; | ||
159 | + int cpu_id = smp_processor_id(); | ||
160 | |||
161 | /* | ||
162 | * CPU0 has to wait and stay ON until CPU1 is OFF state. | ||
163 | @@ -110,6 +112,8 @@ static int omap_enter_idle_coupled(struct cpuidle_device *dev, | ||
164 | mpuss_can_lose_context = (cx->mpu_state == PWRDM_POWER_RET) && | ||
165 | (cx->mpu_logic_state == PWRDM_POWER_OFF); | ||
166 | |||
167 | + clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &cpu_id); | ||
168 | + | ||
169 | /* | ||
170 | * Call idle CPU PM enter notifier chain so that | ||
171 | * VFP and per CPU interrupt context is saved. | ||
172 | @@ -165,6 +169,8 @@ static int omap_enter_idle_coupled(struct cpuidle_device *dev, | ||
173 | if (dev->cpu == 0 && mpuss_can_lose_context) | ||
174 | cpu_cluster_pm_exit(); | ||
175 | |||
176 | + clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &cpu_id); | ||
177 | + | ||
178 | fail: | ||
179 | cpuidle_coupled_parallel_barrier(dev, &abort_barrier); | ||
180 | cpu_done[dev->cpu] = false; | ||
181 | @@ -172,6 +178,16 @@ fail: | ||
182 | return index; | ||
183 | } | ||
184 | |||
185 | +/* | ||
186 | + * For each cpu, setup the broadcast timer because local timers | ||
187 | + * stops for the states above C1. | ||
188 | + */ | ||
189 | +static void omap_setup_broadcast_timer(void *arg) | ||
190 | +{ | ||
191 | + int cpu = smp_processor_id(); | ||
192 | + clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ON, &cpu); | ||
193 | +} | ||
194 | + | ||
195 | static struct cpuidle_driver omap4_idle_driver = { | ||
196 | .name = "omap4_idle", | ||
197 | .owner = THIS_MODULE, | ||
198 | @@ -189,8 +205,7 @@ static struct cpuidle_driver omap4_idle_driver = { | ||
199 | /* C2 - CPU0 OFF + CPU1 OFF + MPU CSWR */ | ||
200 | .exit_latency = 328 + 440, | ||
201 | .target_residency = 960, | ||
202 | - .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED | | ||
203 | - CPUIDLE_FLAG_TIMER_STOP, | ||
204 | + .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED, | ||
205 | .enter = omap_enter_idle_coupled, | ||
206 | .name = "C2", | ||
207 | .desc = "CPUx OFF, MPUSS CSWR", | ||
208 | @@ -199,8 +214,7 @@ static struct cpuidle_driver omap4_idle_driver = { | ||
209 | /* C3 - CPU0 OFF + CPU1 OFF + MPU OSWR */ | ||
210 | .exit_latency = 460 + 518, | ||
211 | .target_residency = 1100, | ||
212 | - .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED | | ||
213 | - CPUIDLE_FLAG_TIMER_STOP, | ||
214 | + .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED, | ||
215 | .enter = omap_enter_idle_coupled, | ||
216 | .name = "C3", | ||
217 | .desc = "CPUx OFF, MPUSS OSWR", | ||
218 | @@ -231,5 +245,8 @@ int __init omap4_idle_init(void) | ||
219 | if (!cpu_clkdm[0] || !cpu_clkdm[1]) | ||
220 | return -ENODEV; | ||
221 | |||
222 | + /* Configure the broadcast timer on each cpu */ | ||
223 | + on_each_cpu(omap_setup_broadcast_timer, NULL, 1); | ||
224 | + | ||
225 | return cpuidle_register(&omap4_idle_driver, cpu_online_mask); | ||
226 | } | ||
227 | diff --git a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c | ||
228 | index e297d6231c3a..7babf515465c 100644 | ||
229 | --- a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c | ||
230 | +++ b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c | ||
231 | @@ -895,7 +895,7 @@ static struct omap_hwmod omap54xx_mcpdm_hwmod = { | ||
232 | * current exception. | ||
233 | */ | ||
234 | |||
235 | - .flags = HWMOD_EXT_OPT_MAIN_CLK, | ||
236 | + .flags = HWMOD_EXT_OPT_MAIN_CLK | HWMOD_SWSUP_SIDLE, | ||
237 | .main_clk = "pad_clks_ck", | ||
238 | .prcm = { | ||
239 | .omap4 = { | ||
240 | diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c | ||
241 | index e0b499694d18..81e6ae0220bc 100644 | ||
242 | --- a/arch/mips/kernel/traps.c | ||
243 | +++ b/arch/mips/kernel/traps.c | ||
244 | @@ -1429,7 +1429,7 @@ asmlinkage void cache_parity_error(void) | ||
245 | reg_val & (1<<30) ? "secondary" : "primary", | ||
246 | reg_val & (1<<31) ? "data" : "insn"); | ||
247 | if (cpu_has_mips_r2 && | ||
248 | - ((current_cpu_data.processor_id && 0xff0000) == PRID_COMP_MIPS)) { | ||
249 | + ((current_cpu_data.processor_id & 0xff0000) == PRID_COMP_MIPS)) { | ||
250 | pr_err("Error bits: %s%s%s%s%s%s%s%s\n", | ||
251 | reg_val & (1<<29) ? "ED " : "", | ||
252 | reg_val & (1<<28) ? "ET " : "", | ||
253 | @@ -1469,7 +1469,7 @@ asmlinkage void do_ftlb(void) | ||
254 | |||
255 | /* For the moment, report the problem and hang. */ | ||
256 | if (cpu_has_mips_r2 && | ||
257 | - ((current_cpu_data.processor_id && 0xff0000) == PRID_COMP_MIPS)) { | ||
258 | + ((current_cpu_data.processor_id & 0xff0000) == PRID_COMP_MIPS)) { | ||
259 | pr_err("FTLB error exception, cp0_ecc=0x%08x:\n", | ||
260 | read_c0_ecc()); | ||
261 | pr_err("cp0_errorepc == %0*lx\n", field, read_c0_errorepc()); | ||
262 | diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c | ||
263 | index bb26636f10c8..62fda16c8377 100644 | ||
264 | --- a/drivers/ata/libata-core.c | ||
265 | +++ b/drivers/ata/libata-core.c | ||
266 | @@ -4224,10 +4224,10 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | ||
267 | { "PIONEER DVD-RW DVR-216D", NULL, ATA_HORKAGE_NOSETXFER }, | ||
268 | |||
269 | /* devices that don't properly handle queued TRIM commands */ | ||
270 | - { "Micron_M500*", "MU0[1-4]*", ATA_HORKAGE_NO_NCQ_TRIM, }, | ||
271 | - { "Crucial_CT???M500SSD*", "MU0[1-4]*", ATA_HORKAGE_NO_NCQ_TRIM, }, | ||
272 | - { "Micron_M550*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, | ||
273 | - { "Crucial_CT???M550SSD*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, | ||
274 | + { "Micron_M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, | ||
275 | + { "Crucial_CT???M500SSD*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, | ||
276 | + { "Micron_M550*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, | ||
277 | + { "Crucial_CT???M550SSD*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, | ||
278 | |||
279 | /* | ||
280 | * Some WD SATA-I drives spin up and down erratically when the link | ||
281 | diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c | ||
282 | index b1cb3f4c4db4..6c911c86fb5a 100644 | ||
283 | --- a/drivers/block/virtio_blk.c | ||
284 | +++ b/drivers/block/virtio_blk.c | ||
285 | @@ -144,11 +144,11 @@ static void virtblk_done(struct virtqueue *vq) | ||
286 | if (unlikely(virtqueue_is_broken(vq))) | ||
287 | break; | ||
288 | } while (!virtqueue_enable_cb(vq)); | ||
289 | - spin_unlock_irqrestore(&vblk->vq_lock, flags); | ||
290 | |||
291 | /* In case queue is stopped waiting for more buffers. */ | ||
292 | if (req_done) | ||
293 | blk_mq_start_stopped_hw_queues(vblk->disk->queue); | ||
294 | + spin_unlock_irqrestore(&vblk->vq_lock, flags); | ||
295 | } | ||
296 | |||
297 | static int virtio_queue_rq(struct blk_mq_hw_ctx *hctx, struct request *req) | ||
298 | @@ -200,8 +200,8 @@ static int virtio_queue_rq(struct blk_mq_hw_ctx *hctx, struct request *req) | ||
299 | spin_lock_irqsave(&vblk->vq_lock, flags); | ||
300 | if (__virtblk_add_req(vblk->vq, vbr, vbr->sg, num) < 0) { | ||
301 | virtqueue_kick(vblk->vq); | ||
302 | - spin_unlock_irqrestore(&vblk->vq_lock, flags); | ||
303 | blk_mq_stop_hw_queue(hctx); | ||
304 | + spin_unlock_irqrestore(&vblk->vq_lock, flags); | ||
305 | return BLK_MQ_RQ_QUEUE_BUSY; | ||
306 | } | ||
307 | |||
308 | diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c | ||
309 | index 0c12ffc0ebcb..51322856f908 100644 | ||
310 | --- a/drivers/cpufreq/cpufreq-cpu0.c | ||
311 | +++ b/drivers/cpufreq/cpufreq-cpu0.c | ||
312 | @@ -131,7 +131,7 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev) | ||
313 | return -ENOENT; | ||
314 | } | ||
315 | |||
316 | - cpu_reg = devm_regulator_get_optional(cpu_dev, "cpu0"); | ||
317 | + cpu_reg = regulator_get_optional(cpu_dev, "cpu0"); | ||
318 | if (IS_ERR(cpu_reg)) { | ||
319 | /* | ||
320 | * If cpu0 regulator supply node is present, but regulator is | ||
321 | @@ -146,23 +146,23 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev) | ||
322 | PTR_ERR(cpu_reg)); | ||
323 | } | ||
324 | |||
325 | - cpu_clk = devm_clk_get(cpu_dev, NULL); | ||
326 | + cpu_clk = clk_get(cpu_dev, NULL); | ||
327 | if (IS_ERR(cpu_clk)) { | ||
328 | ret = PTR_ERR(cpu_clk); | ||
329 | pr_err("failed to get cpu0 clock: %d\n", ret); | ||
330 | - goto out_put_node; | ||
331 | + goto out_put_reg; | ||
332 | } | ||
333 | |||
334 | ret = of_init_opp_table(cpu_dev); | ||
335 | if (ret) { | ||
336 | pr_err("failed to init OPP table: %d\n", ret); | ||
337 | - goto out_put_node; | ||
338 | + goto out_put_clk; | ||
339 | } | ||
340 | |||
341 | ret = dev_pm_opp_init_cpufreq_table(cpu_dev, &freq_table); | ||
342 | if (ret) { | ||
343 | pr_err("failed to init cpufreq table: %d\n", ret); | ||
344 | - goto out_put_node; | ||
345 | + goto out_put_clk; | ||
346 | } | ||
347 | |||
348 | of_property_read_u32(np, "voltage-tolerance", &voltage_tolerance); | ||
349 | @@ -217,6 +217,12 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev) | ||
350 | |||
351 | out_free_table: | ||
352 | dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table); | ||
353 | +out_put_clk: | ||
354 | + if (!IS_ERR(cpu_clk)) | ||
355 | + clk_put(cpu_clk); | ||
356 | +out_put_reg: | ||
357 | + if (!IS_ERR(cpu_reg)) | ||
358 | + regulator_put(cpu_reg); | ||
359 | out_put_node: | ||
360 | of_node_put(np); | ||
361 | return ret; | ||
362 | diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c | ||
363 | index ba43991ba98a..e1c6433b16e0 100644 | ||
364 | --- a/drivers/cpufreq/cpufreq_governor.c | ||
365 | +++ b/drivers/cpufreq/cpufreq_governor.c | ||
366 | @@ -366,6 +366,11 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy, | ||
367 | break; | ||
368 | |||
369 | case CPUFREQ_GOV_LIMITS: | ||
370 | + mutex_lock(&dbs_data->mutex); | ||
371 | + if (!cpu_cdbs->cur_policy) { | ||
372 | + mutex_unlock(&dbs_data->mutex); | ||
373 | + break; | ||
374 | + } | ||
375 | mutex_lock(&cpu_cdbs->timer_mutex); | ||
376 | if (policy->max < cpu_cdbs->cur_policy->cur) | ||
377 | __cpufreq_driver_target(cpu_cdbs->cur_policy, | ||
378 | @@ -375,6 +380,7 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy, | ||
379 | policy->min, CPUFREQ_RELATION_L); | ||
380 | dbs_check_cpu(dbs_data, cpu); | ||
381 | mutex_unlock(&cpu_cdbs->timer_mutex); | ||
382 | + mutex_unlock(&dbs_data->mutex); | ||
383 | break; | ||
384 | } | ||
385 | return 0; | ||
386 | diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c | ||
387 | index 9ac378380677..de9ef4a1986d 100644 | ||
388 | --- a/drivers/cpufreq/intel_pstate.c | ||
389 | +++ b/drivers/cpufreq/intel_pstate.c | ||
390 | @@ -40,10 +40,10 @@ | ||
391 | #define BYT_TURBO_VIDS 0x66d | ||
392 | |||
393 | |||
394 | -#define FRAC_BITS 6 | ||
395 | +#define FRAC_BITS 8 | ||
396 | #define int_tofp(X) ((int64_t)(X) << FRAC_BITS) | ||
397 | #define fp_toint(X) ((X) >> FRAC_BITS) | ||
398 | -#define FP_ROUNDUP(X) ((X) += 1 << FRAC_BITS) | ||
399 | + | ||
400 | |||
401 | static inline int32_t mul_fp(int32_t x, int32_t y) | ||
402 | { | ||
403 | @@ -59,8 +59,8 @@ struct sample { | ||
404 | int32_t core_pct_busy; | ||
405 | u64 aperf; | ||
406 | u64 mperf; | ||
407 | - unsigned long long tsc; | ||
408 | int freq; | ||
409 | + ktime_t time; | ||
410 | }; | ||
411 | |||
412 | struct pstate_data { | ||
413 | @@ -98,11 +98,10 @@ struct cpudata { | ||
414 | struct vid_data vid; | ||
415 | struct _pid pid; | ||
416 | |||
417 | + ktime_t last_sample_time; | ||
418 | u64 prev_aperf; | ||
419 | u64 prev_mperf; | ||
420 | - unsigned long long prev_tsc; | ||
421 | - int sample_ptr; | ||
422 | - struct sample samples[SAMPLE_COUNT]; | ||
423 | + struct sample sample; | ||
424 | }; | ||
425 | |||
426 | static struct cpudata **all_cpu_data; | ||
427 | @@ -201,7 +200,10 @@ static signed int pid_calc(struct _pid *pid, int32_t busy) | ||
428 | pid->last_err = fp_error; | ||
429 | |||
430 | result = pterm + mul_fp(pid->integral, pid->i_gain) + dterm; | ||
431 | - | ||
432 | + if (result >= 0) | ||
433 | + result = result + (1 << (FRAC_BITS-1)); | ||
434 | + else | ||
435 | + result = result - (1 << (FRAC_BITS-1)); | ||
436 | return (signed int)fp_toint(result); | ||
437 | } | ||
438 | |||
439 | @@ -561,48 +563,42 @@ static void intel_pstate_get_cpu_pstates(struct cpudata *cpu) | ||
440 | static inline void intel_pstate_calc_busy(struct cpudata *cpu, | ||
441 | struct sample *sample) | ||
442 | { | ||
443 | - int32_t core_pct; | ||
444 | - int32_t c0_pct; | ||
445 | + int64_t core_pct; | ||
446 | + int32_t rem; | ||
447 | |||
448 | - core_pct = div_fp(int_tofp((sample->aperf)), | ||
449 | - int_tofp((sample->mperf))); | ||
450 | - core_pct = mul_fp(core_pct, int_tofp(100)); | ||
451 | - FP_ROUNDUP(core_pct); | ||
452 | + core_pct = int_tofp(sample->aperf) * int_tofp(100); | ||
453 | + core_pct = div_u64_rem(core_pct, int_tofp(sample->mperf), &rem); | ||
454 | |||
455 | - c0_pct = div_fp(int_tofp(sample->mperf), int_tofp(sample->tsc)); | ||
456 | + if ((rem << 1) >= int_tofp(sample->mperf)) | ||
457 | + core_pct += 1; | ||
458 | |||
459 | sample->freq = fp_toint( | ||
460 | mul_fp(int_tofp(cpu->pstate.max_pstate * 1000), core_pct)); | ||
461 | |||
462 | - sample->core_pct_busy = mul_fp(core_pct, c0_pct); | ||
463 | + sample->core_pct_busy = (int32_t)core_pct; | ||
464 | } | ||
465 | |||
466 | static inline void intel_pstate_sample(struct cpudata *cpu) | ||
467 | { | ||
468 | u64 aperf, mperf; | ||
469 | - unsigned long long tsc; | ||
470 | |||
471 | rdmsrl(MSR_IA32_APERF, aperf); | ||
472 | rdmsrl(MSR_IA32_MPERF, mperf); | ||
473 | - tsc = native_read_tsc(); | ||
474 | |||
475 | aperf = aperf >> FRAC_BITS; | ||
476 | mperf = mperf >> FRAC_BITS; | ||
477 | - tsc = tsc >> FRAC_BITS; | ||
478 | |||
479 | - cpu->sample_ptr = (cpu->sample_ptr + 1) % SAMPLE_COUNT; | ||
480 | - cpu->samples[cpu->sample_ptr].aperf = aperf; | ||
481 | - cpu->samples[cpu->sample_ptr].mperf = mperf; | ||
482 | - cpu->samples[cpu->sample_ptr].tsc = tsc; | ||
483 | - cpu->samples[cpu->sample_ptr].aperf -= cpu->prev_aperf; | ||
484 | - cpu->samples[cpu->sample_ptr].mperf -= cpu->prev_mperf; | ||
485 | - cpu->samples[cpu->sample_ptr].tsc -= cpu->prev_tsc; | ||
486 | + cpu->last_sample_time = cpu->sample.time; | ||
487 | + cpu->sample.time = ktime_get(); | ||
488 | + cpu->sample.aperf = aperf; | ||
489 | + cpu->sample.mperf = mperf; | ||
490 | + cpu->sample.aperf -= cpu->prev_aperf; | ||
491 | + cpu->sample.mperf -= cpu->prev_mperf; | ||
492 | |||
493 | - intel_pstate_calc_busy(cpu, &cpu->samples[cpu->sample_ptr]); | ||
494 | + intel_pstate_calc_busy(cpu, &cpu->sample); | ||
495 | |||
496 | cpu->prev_aperf = aperf; | ||
497 | cpu->prev_mperf = mperf; | ||
498 | - cpu->prev_tsc = tsc; | ||
499 | } | ||
500 | |||
501 | static inline void intel_pstate_set_sample_time(struct cpudata *cpu) | ||
502 | @@ -616,13 +612,25 @@ static inline void intel_pstate_set_sample_time(struct cpudata *cpu) | ||
503 | |||
504 | static inline int32_t intel_pstate_get_scaled_busy(struct cpudata *cpu) | ||
505 | { | ||
506 | - int32_t core_busy, max_pstate, current_pstate; | ||
507 | + int32_t core_busy, max_pstate, current_pstate, sample_ratio; | ||
508 | + u32 duration_us; | ||
509 | + u32 sample_time; | ||
510 | |||
511 | - core_busy = cpu->samples[cpu->sample_ptr].core_pct_busy; | ||
512 | + core_busy = cpu->sample.core_pct_busy; | ||
513 | max_pstate = int_tofp(cpu->pstate.max_pstate); | ||
514 | current_pstate = int_tofp(cpu->pstate.current_pstate); | ||
515 | core_busy = mul_fp(core_busy, div_fp(max_pstate, current_pstate)); | ||
516 | - return FP_ROUNDUP(core_busy); | ||
517 | + | ||
518 | + sample_time = (pid_params.sample_rate_ms * USEC_PER_MSEC); | ||
519 | + duration_us = (u32) ktime_us_delta(cpu->sample.time, | ||
520 | + cpu->last_sample_time); | ||
521 | + if (duration_us > sample_time * 3) { | ||
522 | + sample_ratio = div_fp(int_tofp(sample_time), | ||
523 | + int_tofp(duration_us)); | ||
524 | + core_busy = mul_fp(core_busy, sample_ratio); | ||
525 | + } | ||
526 | + | ||
527 | + return core_busy; | ||
528 | } | ||
529 | |||
530 | static inline void intel_pstate_adjust_busy_pstate(struct cpudata *cpu) | ||
531 | @@ -652,7 +660,7 @@ static void intel_pstate_timer_func(unsigned long __data) | ||
532 | |||
533 | intel_pstate_sample(cpu); | ||
534 | |||
535 | - sample = &cpu->samples[cpu->sample_ptr]; | ||
536 | + sample = &cpu->sample; | ||
537 | |||
538 | intel_pstate_adjust_busy_pstate(cpu); | ||
539 | |||
540 | @@ -727,7 +735,7 @@ static unsigned int intel_pstate_get(unsigned int cpu_num) | ||
541 | cpu = all_cpu_data[cpu_num]; | ||
542 | if (!cpu) | ||
543 | return 0; | ||
544 | - sample = &cpu->samples[cpu->sample_ptr]; | ||
545 | + sample = &cpu->sample; | ||
546 | return sample->freq; | ||
547 | } | ||
548 | |||
549 | diff --git a/drivers/firewire/core.h b/drivers/firewire/core.h | ||
550 | index c98764aeeec6..f477308b6e9c 100644 | ||
551 | --- a/drivers/firewire/core.h | ||
552 | +++ b/drivers/firewire/core.h | ||
553 | @@ -237,8 +237,8 @@ static inline bool is_next_generation(int new_generation, int old_generation) | ||
554 | |||
555 | #define LOCAL_BUS 0xffc0 | ||
556 | |||
557 | -/* arbitrarily chosen maximum range for physical DMA: 128 TB */ | ||
558 | -#define FW_MAX_PHYSICAL_RANGE (128ULL << 40) | ||
559 | +/* OHCI-1394's default upper bound for physical DMA: 4 GB */ | ||
560 | +#define FW_MAX_PHYSICAL_RANGE (1ULL << 32) | ||
561 | |||
562 | void fw_core_handle_request(struct fw_card *card, struct fw_packet *request); | ||
563 | void fw_core_handle_response(struct fw_card *card, struct fw_packet *packet); | ||
564 | diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c | ||
565 | index 8db663219560..586f2f7f6993 100644 | ||
566 | --- a/drivers/firewire/ohci.c | ||
567 | +++ b/drivers/firewire/ohci.c | ||
568 | @@ -3716,7 +3716,7 @@ static int pci_probe(struct pci_dev *dev, | ||
569 | version >> 16, version & 0xff, ohci->card.index, | ||
570 | ohci->n_ir, ohci->n_it, ohci->quirks, | ||
571 | reg_read(ohci, OHCI1394_PhyUpperBound) ? | ||
572 | - ", >4 GB phys DMA" : ""); | ||
573 | + ", physUB" : ""); | ||
574 | |||
575 | return 0; | ||
576 | |||
577 | diff --git a/drivers/gpio/gpio-mcp23s08.c b/drivers/gpio/gpio-mcp23s08.c | ||
578 | index 1ac288ea810d..aa379971d703 100644 | ||
579 | --- a/drivers/gpio/gpio-mcp23s08.c | ||
580 | +++ b/drivers/gpio/gpio-mcp23s08.c | ||
581 | @@ -895,8 +895,11 @@ static int mcp23s08_probe(struct spi_device *spi) | ||
582 | return -ENODEV; | ||
583 | } | ||
584 | |||
585 | - for (addr = 0; addr < ARRAY_SIZE(pdata->chip); addr++) | ||
586 | + for (addr = 0; addr < ARRAY_SIZE(pdata->chip); addr++) { | ||
587 | pullups[addr] = 0; | ||
588 | + if (spi_present_mask & (1 << addr)) | ||
589 | + chips++; | ||
590 | + } | ||
591 | } else { | ||
592 | type = spi_get_device_id(spi)->driver_data; | ||
593 | pdata = dev_get_platdata(&spi->dev); | ||
594 | @@ -919,12 +922,12 @@ static int mcp23s08_probe(struct spi_device *spi) | ||
595 | pullups[addr] = pdata->chip[addr].pullups; | ||
596 | } | ||
597 | |||
598 | - if (!chips) | ||
599 | - return -ENODEV; | ||
600 | - | ||
601 | base = pdata->base; | ||
602 | } | ||
603 | |||
604 | + if (!chips) | ||
605 | + return -ENODEV; | ||
606 | + | ||
607 | data = kzalloc(sizeof *data + chips * sizeof(struct mcp23s08), | ||
608 | GFP_KERNEL); | ||
609 | if (!data) | ||
610 | diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h | ||
611 | index 697f2150a997..4677af964df7 100644 | ||
612 | --- a/drivers/gpu/drm/i915/i915_drv.h | ||
613 | +++ b/drivers/gpu/drm/i915/i915_drv.h | ||
614 | @@ -2426,6 +2426,7 @@ extern void intel_modeset_suspend_hw(struct drm_device *dev); | ||
615 | extern void intel_modeset_init(struct drm_device *dev); | ||
616 | extern void intel_modeset_gem_init(struct drm_device *dev); | ||
617 | extern void intel_modeset_cleanup(struct drm_device *dev); | ||
618 | +extern void intel_connector_unregister(struct intel_connector *); | ||
619 | extern int intel_modeset_vga_set_state(struct drm_device *dev, bool state); | ||
620 | extern void intel_modeset_setup_hw_state(struct drm_device *dev, | ||
621 | bool force_restore); | ||
622 | diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c | ||
623 | index d269ecf46e26..768e6665e4e3 100644 | ||
624 | --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c | ||
625 | +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c | ||
626 | @@ -766,9 +766,9 @@ i915_gem_execbuffer_relocate_slow(struct drm_device *dev, | ||
627 | * relocations were valid. | ||
628 | */ | ||
629 | for (j = 0; j < exec[i].relocation_count; j++) { | ||
630 | - if (copy_to_user(&user_relocs[j].presumed_offset, | ||
631 | - &invalid_offset, | ||
632 | - sizeof(invalid_offset))) { | ||
633 | + if (__copy_to_user(&user_relocs[j].presumed_offset, | ||
634 | + &invalid_offset, | ||
635 | + sizeof(invalid_offset))) { | ||
636 | ret = -EFAULT; | ||
637 | mutex_lock(&dev->struct_mutex); | ||
638 | goto err; | ||
639 | @@ -1329,18 +1329,21 @@ i915_gem_execbuffer(struct drm_device *dev, void *data, | ||
640 | ret = i915_gem_do_execbuffer(dev, data, file, &exec2, exec2_list, | ||
641 | &dev_priv->gtt.base); | ||
642 | if (!ret) { | ||
643 | + struct drm_i915_gem_exec_object __user *user_exec_list = | ||
644 | + to_user_ptr(args->buffers_ptr); | ||
645 | + | ||
646 | /* Copy the new buffer offsets back to the user's exec list. */ | ||
647 | - for (i = 0; i < args->buffer_count; i++) | ||
648 | - exec_list[i].offset = exec2_list[i].offset; | ||
649 | - /* ... and back out to userspace */ | ||
650 | - ret = copy_to_user(to_user_ptr(args->buffers_ptr), | ||
651 | - exec_list, | ||
652 | - sizeof(*exec_list) * args->buffer_count); | ||
653 | - if (ret) { | ||
654 | - ret = -EFAULT; | ||
655 | - DRM_DEBUG("failed to copy %d exec entries " | ||
656 | - "back to user (%d)\n", | ||
657 | - args->buffer_count, ret); | ||
658 | + for (i = 0; i < args->buffer_count; i++) { | ||
659 | + ret = __copy_to_user(&user_exec_list[i].offset, | ||
660 | + &exec2_list[i].offset, | ||
661 | + sizeof(user_exec_list[i].offset)); | ||
662 | + if (ret) { | ||
663 | + ret = -EFAULT; | ||
664 | + DRM_DEBUG("failed to copy %d exec entries " | ||
665 | + "back to user (%d)\n", | ||
666 | + args->buffer_count, ret); | ||
667 | + break; | ||
668 | + } | ||
669 | } | ||
670 | } | ||
671 | |||
672 | @@ -1388,14 +1391,21 @@ i915_gem_execbuffer2(struct drm_device *dev, void *data, | ||
673 | &dev_priv->gtt.base); | ||
674 | if (!ret) { | ||
675 | /* Copy the new buffer offsets back to the user's exec list. */ | ||
676 | - ret = copy_to_user(to_user_ptr(args->buffers_ptr), | ||
677 | - exec2_list, | ||
678 | - sizeof(*exec2_list) * args->buffer_count); | ||
679 | - if (ret) { | ||
680 | - ret = -EFAULT; | ||
681 | - DRM_DEBUG("failed to copy %d exec entries " | ||
682 | - "back to user (%d)\n", | ||
683 | - args->buffer_count, ret); | ||
684 | + struct drm_i915_gem_exec_object2 *user_exec_list = | ||
685 | + to_user_ptr(args->buffers_ptr); | ||
686 | + int i; | ||
687 | + | ||
688 | + for (i = 0; i < args->buffer_count; i++) { | ||
689 | + ret = __copy_to_user(&user_exec_list[i].offset, | ||
690 | + &exec2_list[i].offset, | ||
691 | + sizeof(user_exec_list[i].offset)); | ||
692 | + if (ret) { | ||
693 | + ret = -EFAULT; | ||
694 | + DRM_DEBUG("failed to copy %d exec entries " | ||
695 | + "back to user\n", | ||
696 | + args->buffer_count); | ||
697 | + break; | ||
698 | + } | ||
699 | } | ||
700 | } | ||
701 | |||
702 | diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c | ||
703 | index a60a755f9977..b19ddacbe19d 100644 | ||
704 | --- a/drivers/gpu/drm/i915/intel_crt.c | ||
705 | +++ b/drivers/gpu/drm/i915/intel_crt.c | ||
706 | @@ -841,6 +841,7 @@ void intel_crt_init(struct drm_device *dev) | ||
707 | crt->base.get_hw_state = intel_crt_get_hw_state; | ||
708 | } | ||
709 | intel_connector->get_hw_state = intel_connector_get_hw_state; | ||
710 | + intel_connector->unregister = intel_connector_unregister; | ||
711 | |||
712 | drm_connector_helper_add(connector, &intel_crt_connector_helper_funcs); | ||
713 | |||
714 | diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c | ||
715 | index 9d4d837506d0..b6fb3ebe553a 100644 | ||
716 | --- a/drivers/gpu/drm/i915/intel_display.c | ||
717 | +++ b/drivers/gpu/drm/i915/intel_display.c | ||
718 | @@ -11368,6 +11368,14 @@ void intel_modeset_gem_init(struct drm_device *dev) | ||
719 | mutex_unlock(&dev->mode_config.mutex); | ||
720 | } | ||
721 | |||
722 | +void intel_connector_unregister(struct intel_connector *intel_connector) | ||
723 | +{ | ||
724 | + struct drm_connector *connector = &intel_connector->base; | ||
725 | + | ||
726 | + intel_panel_destroy_backlight(connector); | ||
727 | + drm_sysfs_connector_remove(connector); | ||
728 | +} | ||
729 | + | ||
730 | void intel_modeset_cleanup(struct drm_device *dev) | ||
731 | { | ||
732 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
733 | @@ -11412,8 +11420,10 @@ void intel_modeset_cleanup(struct drm_device *dev) | ||
734 | |||
735 | /* destroy the backlight and sysfs files before encoders/connectors */ | ||
736 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { | ||
737 | - intel_panel_destroy_backlight(connector); | ||
738 | - drm_sysfs_connector_remove(connector); | ||
739 | + struct intel_connector *intel_connector; | ||
740 | + | ||
741 | + intel_connector = to_intel_connector(connector); | ||
742 | + intel_connector->unregister(intel_connector); | ||
743 | } | ||
744 | |||
745 | drm_mode_config_cleanup(dev); | ||
746 | diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c | ||
747 | index 2688f6d64bb9..b2d0887b3d12 100644 | ||
748 | --- a/drivers/gpu/drm/i915/intel_dp.c | ||
749 | +++ b/drivers/gpu/drm/i915/intel_dp.c | ||
750 | @@ -744,6 +744,16 @@ out: | ||
751 | return ret; | ||
752 | } | ||
753 | |||
754 | +static void | ||
755 | +intel_dp_connector_unregister(struct intel_connector *intel_connector) | ||
756 | +{ | ||
757 | + struct intel_dp *intel_dp = intel_attached_dp(&intel_connector->base); | ||
758 | + | ||
759 | + sysfs_remove_link(&intel_connector->base.kdev->kobj, | ||
760 | + intel_dp->adapter.dev.kobj.name); | ||
761 | + intel_connector_unregister(intel_connector); | ||
762 | +} | ||
763 | + | ||
764 | static int | ||
765 | intel_dp_i2c_init(struct intel_dp *intel_dp, | ||
766 | struct intel_connector *intel_connector, const char *name) | ||
767 | @@ -761,9 +771,19 @@ intel_dp_i2c_init(struct intel_dp *intel_dp, | ||
768 | strncpy(intel_dp->adapter.name, name, sizeof(intel_dp->adapter.name) - 1); | ||
769 | intel_dp->adapter.name[sizeof(intel_dp->adapter.name) - 1] = '\0'; | ||
770 | intel_dp->adapter.algo_data = &intel_dp->algo; | ||
771 | - intel_dp->adapter.dev.parent = intel_connector->base.kdev; | ||
772 | + intel_dp->adapter.dev.parent = intel_connector->base.dev->dev; | ||
773 | |||
774 | ret = i2c_dp_aux_add_bus(&intel_dp->adapter); | ||
775 | + if (ret < 0) | ||
776 | + return ret; | ||
777 | + | ||
778 | + ret = sysfs_create_link(&intel_connector->base.kdev->kobj, | ||
779 | + &intel_dp->adapter.dev.kobj, | ||
780 | + intel_dp->adapter.dev.kobj.name); | ||
781 | + | ||
782 | + if (ret < 0) | ||
783 | + i2c_del_adapter(&intel_dp->adapter); | ||
784 | + | ||
785 | return ret; | ||
786 | } | ||
787 | |||
788 | @@ -3686,6 +3706,7 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port, | ||
789 | intel_connector->get_hw_state = intel_ddi_connector_get_hw_state; | ||
790 | else | ||
791 | intel_connector->get_hw_state = intel_connector_get_hw_state; | ||
792 | + intel_connector->unregister = intel_dp_connector_unregister; | ||
793 | |||
794 | intel_dp->aux_ch_ctl_reg = intel_dp->output_reg + 0x10; | ||
795 | if (HAS_DDI(dev)) { | ||
796 | diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h | ||
797 | index 00de120531ac..0b59914344e4 100644 | ||
798 | --- a/drivers/gpu/drm/i915/intel_drv.h | ||
799 | +++ b/drivers/gpu/drm/i915/intel_drv.h | ||
800 | @@ -187,6 +187,14 @@ struct intel_connector { | ||
801 | * and active (i.e. dpms ON state). */ | ||
802 | bool (*get_hw_state)(struct intel_connector *); | ||
803 | |||
804 | + /* | ||
805 | + * Removes all interfaces through which the connector is accessible | ||
806 | + * - like sysfs, debugfs entries -, so that no new operations can be | ||
807 | + * started on the connector. Also makes sure all currently pending | ||
808 | + * operations finish before returing. | ||
809 | + */ | ||
810 | + void (*unregister)(struct intel_connector *); | ||
811 | + | ||
812 | /* Panel info for eDP and LVDS */ | ||
813 | struct intel_panel panel; | ||
814 | |||
815 | diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c | ||
816 | index fabbf0d895cf..ad05683ac5b6 100644 | ||
817 | --- a/drivers/gpu/drm/i915/intel_dsi.c | ||
818 | +++ b/drivers/gpu/drm/i915/intel_dsi.c | ||
819 | @@ -586,6 +586,7 @@ bool intel_dsi_init(struct drm_device *dev) | ||
820 | intel_encoder->get_config = intel_dsi_get_config; | ||
821 | |||
822 | intel_connector->get_hw_state = intel_connector_get_hw_state; | ||
823 | + intel_connector->unregister = intel_connector_unregister; | ||
824 | |||
825 | for (i = 0; i < ARRAY_SIZE(intel_dsi_devices); i++) { | ||
826 | dsi = &intel_dsi_devices[i]; | ||
827 | diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c | ||
828 | index eeff998e52ef..86eeb8b7d435 100644 | ||
829 | --- a/drivers/gpu/drm/i915/intel_dvo.c | ||
830 | +++ b/drivers/gpu/drm/i915/intel_dvo.c | ||
831 | @@ -477,6 +477,7 @@ void intel_dvo_init(struct drm_device *dev) | ||
832 | intel_encoder->compute_config = intel_dvo_compute_config; | ||
833 | intel_encoder->mode_set = intel_dvo_mode_set; | ||
834 | intel_connector->get_hw_state = intel_dvo_connector_get_hw_state; | ||
835 | + intel_connector->unregister = intel_connector_unregister; | ||
836 | |||
837 | /* Now, try to find a controller */ | ||
838 | for (i = 0; i < ARRAY_SIZE(intel_dvo_devices); i++) { | ||
839 | diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c | ||
840 | index ca5d23d17d20..7b277c369dce 100644 | ||
841 | --- a/drivers/gpu/drm/i915/intel_hdmi.c | ||
842 | +++ b/drivers/gpu/drm/i915/intel_hdmi.c | ||
843 | @@ -1262,6 +1262,7 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port, | ||
844 | intel_connector->get_hw_state = intel_ddi_connector_get_hw_state; | ||
845 | else | ||
846 | intel_connector->get_hw_state = intel_connector_get_hw_state; | ||
847 | + intel_connector->unregister = intel_connector_unregister; | ||
848 | |||
849 | intel_hdmi_add_properties(intel_hdmi, connector); | ||
850 | |||
851 | diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c | ||
852 | index 8bcb93a2a9f6..eb8f64b5fb85 100644 | ||
853 | --- a/drivers/gpu/drm/i915/intel_lvds.c | ||
854 | +++ b/drivers/gpu/drm/i915/intel_lvds.c | ||
855 | @@ -957,6 +957,7 @@ void intel_lvds_init(struct drm_device *dev) | ||
856 | intel_encoder->get_hw_state = intel_lvds_get_hw_state; | ||
857 | intel_encoder->get_config = intel_lvds_get_config; | ||
858 | intel_connector->get_hw_state = intel_connector_get_hw_state; | ||
859 | + intel_connector->unregister = intel_connector_unregister; | ||
860 | |||
861 | intel_connector_attach_encoder(intel_connector, intel_encoder); | ||
862 | intel_encoder->type = INTEL_OUTPUT_LVDS; | ||
863 | diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c | ||
864 | index 95bdfb3c431c..cbc2feeda59d 100644 | ||
865 | --- a/drivers/gpu/drm/i915/intel_sdvo.c | ||
866 | +++ b/drivers/gpu/drm/i915/intel_sdvo.c | ||
867 | @@ -2397,6 +2397,7 @@ intel_sdvo_connector_init(struct intel_sdvo_connector *connector, | ||
868 | connector->base.base.doublescan_allowed = 0; | ||
869 | connector->base.base.display_info.subpixel_order = SubPixelHorizontalRGB; | ||
870 | connector->base.get_hw_state = intel_sdvo_connector_get_hw_state; | ||
871 | + connector->base.unregister = intel_connector_unregister; | ||
872 | |||
873 | intel_connector_attach_encoder(&connector->base, &encoder->base); | ||
874 | drm_sysfs_connector_add(&connector->base.base); | ||
875 | diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c | ||
876 | index 99faac555d3b..365c7c47c46c 100644 | ||
877 | --- a/drivers/gpu/drm/i915/intel_tv.c | ||
878 | +++ b/drivers/gpu/drm/i915/intel_tv.c | ||
879 | @@ -1639,6 +1639,7 @@ intel_tv_init(struct drm_device *dev) | ||
880 | intel_encoder->disable = intel_disable_tv; | ||
881 | intel_encoder->get_hw_state = intel_tv_get_hw_state; | ||
882 | intel_connector->get_hw_state = intel_connector_get_hw_state; | ||
883 | + intel_connector->unregister = intel_connector_unregister; | ||
884 | |||
885 | intel_connector_attach_encoder(intel_connector, intel_encoder); | ||
886 | intel_encoder->type = INTEL_OUTPUT_TVOUT; | ||
887 | diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/nvd0.c b/drivers/gpu/drm/nouveau/core/engine/disp/nvd0.c | ||
888 | index 1c5e4e8b2c82..e031d7c88fa3 100644 | ||
889 | --- a/drivers/gpu/drm/nouveau/core/engine/disp/nvd0.c | ||
890 | +++ b/drivers/gpu/drm/nouveau/core/engine/disp/nvd0.c | ||
891 | @@ -732,7 +732,7 @@ exec_clkcmp(struct nv50_disp_priv *priv, int head, int id, | ||
892 | } | ||
893 | |||
894 | if (outp == 8) | ||
895 | - return false; | ||
896 | + return conf; | ||
897 | |||
898 | data = exec_lookup(priv, head, outp, ctrl, dcb, &ver, &hdr, &cnt, &len, &info1); | ||
899 | if (data == 0x0000) | ||
900 | diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c | ||
901 | index daa4dd375ab1..41a9a9cb271a 100644 | ||
902 | --- a/drivers/gpu/drm/radeon/atombios_crtc.c | ||
903 | +++ b/drivers/gpu/drm/radeon/atombios_crtc.c | ||
904 | @@ -270,8 +270,6 @@ void atombios_crtc_dpms(struct drm_crtc *crtc, int mode) | ||
905 | switch (mode) { | ||
906 | case DRM_MODE_DPMS_ON: | ||
907 | radeon_crtc->enabled = true; | ||
908 | - /* adjust pm to dpms changes BEFORE enabling crtcs */ | ||
909 | - radeon_pm_compute_clocks(rdev); | ||
910 | atombios_enable_crtc(crtc, ATOM_ENABLE); | ||
911 | if (ASIC_IS_DCE3(rdev) && !ASIC_IS_DCE6(rdev)) | ||
912 | atombios_enable_crtc_memreq(crtc, ATOM_ENABLE); | ||
913 | @@ -289,10 +287,10 @@ void atombios_crtc_dpms(struct drm_crtc *crtc, int mode) | ||
914 | atombios_enable_crtc_memreq(crtc, ATOM_DISABLE); | ||
915 | atombios_enable_crtc(crtc, ATOM_DISABLE); | ||
916 | radeon_crtc->enabled = false; | ||
917 | - /* adjust pm to dpms changes AFTER disabling crtcs */ | ||
918 | - radeon_pm_compute_clocks(rdev); | ||
919 | break; | ||
920 | } | ||
921 | + /* adjust pm to dpms */ | ||
922 | + radeon_pm_compute_clocks(rdev); | ||
923 | } | ||
924 | |||
925 | static void | ||
926 | diff --git a/drivers/gpu/drm/radeon/radeon_asic.c b/drivers/gpu/drm/radeon/radeon_asic.c | ||
927 | index dda02bfc10a4..5600d4c5f981 100644 | ||
928 | --- a/drivers/gpu/drm/radeon/radeon_asic.c | ||
929 | +++ b/drivers/gpu/drm/radeon/radeon_asic.c | ||
930 | @@ -2034,8 +2034,8 @@ static struct radeon_asic ci_asic = { | ||
931 | .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX, | ||
932 | .dma = &cik_copy_dma, | ||
933 | .dma_ring_index = R600_RING_TYPE_DMA_INDEX, | ||
934 | - .copy = &cik_copy_dma, | ||
935 | - .copy_ring_index = R600_RING_TYPE_DMA_INDEX, | ||
936 | + .copy = &cik_copy_cpdma, | ||
937 | + .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX, | ||
938 | }, | ||
939 | .surface = { | ||
940 | .set_reg = r600_set_surface_reg, | ||
941 | diff --git a/drivers/gpu/drm/radeon/radeon_bios.c b/drivers/gpu/drm/radeon/radeon_bios.c | ||
942 | index b3633d9a5317..9ab30976287d 100644 | ||
943 | --- a/drivers/gpu/drm/radeon/radeon_bios.c | ||
944 | +++ b/drivers/gpu/drm/radeon/radeon_bios.c | ||
945 | @@ -196,6 +196,20 @@ static bool radeon_atrm_get_bios(struct radeon_device *rdev) | ||
946 | } | ||
947 | } | ||
948 | |||
949 | + if (!found) { | ||
950 | + while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_OTHER << 8, pdev)) != NULL) { | ||
951 | + dhandle = ACPI_HANDLE(&pdev->dev); | ||
952 | + if (!dhandle) | ||
953 | + continue; | ||
954 | + | ||
955 | + status = acpi_get_handle(dhandle, "ATRM", &atrm_handle); | ||
956 | + if (!ACPI_FAILURE(status)) { | ||
957 | + found = true; | ||
958 | + break; | ||
959 | + } | ||
960 | + } | ||
961 | + } | ||
962 | + | ||
963 | if (!found) | ||
964 | return false; | ||
965 | |||
966 | diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c | ||
967 | index dfb5a1db87d4..7993aec86acc 100644 | ||
968 | --- a/drivers/gpu/drm/radeon/radeon_cs.c | ||
969 | +++ b/drivers/gpu/drm/radeon/radeon_cs.c | ||
970 | @@ -276,10 +276,17 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data) | ||
971 | return -EINVAL; | ||
972 | |||
973 | /* we only support VM on some SI+ rings */ | ||
974 | - if ((p->rdev->asic->ring[p->ring]->cs_parse == NULL) && | ||
975 | - ((p->cs_flags & RADEON_CS_USE_VM) == 0)) { | ||
976 | - DRM_ERROR("Ring %d requires VM!\n", p->ring); | ||
977 | - return -EINVAL; | ||
978 | + if ((p->cs_flags & RADEON_CS_USE_VM) == 0) { | ||
979 | + if (p->rdev->asic->ring[p->ring]->cs_parse == NULL) { | ||
980 | + DRM_ERROR("Ring %d requires VM!\n", p->ring); | ||
981 | + return -EINVAL; | ||
982 | + } | ||
983 | + } else { | ||
984 | + if (p->rdev->asic->ring[p->ring]->ib_parse == NULL) { | ||
985 | + DRM_ERROR("VM not supported on ring %d!\n", | ||
986 | + p->ring); | ||
987 | + return -EINVAL; | ||
988 | + } | ||
989 | } | ||
990 | } | ||
991 | |||
992 | diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c | ||
993 | index 7f370b309590..0bf6f4a2bb97 100644 | ||
994 | --- a/drivers/gpu/drm/radeon/radeon_device.c | ||
995 | +++ b/drivers/gpu/drm/radeon/radeon_device.c | ||
996 | @@ -1536,6 +1536,10 @@ int radeon_resume_kms(struct drm_device *dev, bool resume, bool fbcon) | ||
997 | |||
998 | radeon_restore_bios_scratch_regs(rdev); | ||
999 | |||
1000 | + /* set the power state here in case we are a PX system or headless */ | ||
1001 | + if ((rdev->pm.pm_method == PM_METHOD_DPM) && rdev->pm.dpm_enabled) | ||
1002 | + radeon_pm_compute_clocks(rdev); | ||
1003 | + | ||
1004 | if (fbcon) { | ||
1005 | radeon_fbdev_set_suspend(rdev, 0); | ||
1006 | console_unlock(); | ||
1007 | diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c | ||
1008 | index 08595cf90b01..11bb88afbac1 100644 | ||
1009 | --- a/drivers/gpu/drm/radeon/radeon_object.c | ||
1010 | +++ b/drivers/gpu/drm/radeon/radeon_object.c | ||
1011 | @@ -586,22 +586,30 @@ int radeon_bo_fault_reserve_notify(struct ttm_buffer_object *bo) | ||
1012 | rbo = container_of(bo, struct radeon_bo, tbo); | ||
1013 | radeon_bo_check_tiling(rbo, 0, 0); | ||
1014 | rdev = rbo->rdev; | ||
1015 | - if (bo->mem.mem_type == TTM_PL_VRAM) { | ||
1016 | - size = bo->mem.num_pages << PAGE_SHIFT; | ||
1017 | - offset = bo->mem.start << PAGE_SHIFT; | ||
1018 | - if ((offset + size) > rdev->mc.visible_vram_size) { | ||
1019 | - /* hurrah the memory is not visible ! */ | ||
1020 | - radeon_ttm_placement_from_domain(rbo, RADEON_GEM_DOMAIN_VRAM); | ||
1021 | - rbo->placement.lpfn = rdev->mc.visible_vram_size >> PAGE_SHIFT; | ||
1022 | - r = ttm_bo_validate(bo, &rbo->placement, false, false); | ||
1023 | - if (unlikely(r != 0)) | ||
1024 | - return r; | ||
1025 | - offset = bo->mem.start << PAGE_SHIFT; | ||
1026 | - /* this should not happen */ | ||
1027 | - if ((offset + size) > rdev->mc.visible_vram_size) | ||
1028 | - return -EINVAL; | ||
1029 | - } | ||
1030 | + if (bo->mem.mem_type != TTM_PL_VRAM) | ||
1031 | + return 0; | ||
1032 | + | ||
1033 | + size = bo->mem.num_pages << PAGE_SHIFT; | ||
1034 | + offset = bo->mem.start << PAGE_SHIFT; | ||
1035 | + if ((offset + size) <= rdev->mc.visible_vram_size) | ||
1036 | + return 0; | ||
1037 | + | ||
1038 | + /* hurrah the memory is not visible ! */ | ||
1039 | + radeon_ttm_placement_from_domain(rbo, RADEON_GEM_DOMAIN_VRAM); | ||
1040 | + rbo->placement.lpfn = rdev->mc.visible_vram_size >> PAGE_SHIFT; | ||
1041 | + r = ttm_bo_validate(bo, &rbo->placement, false, false); | ||
1042 | + if (unlikely(r == -ENOMEM)) { | ||
1043 | + radeon_ttm_placement_from_domain(rbo, RADEON_GEM_DOMAIN_GTT); | ||
1044 | + return ttm_bo_validate(bo, &rbo->placement, false, false); | ||
1045 | + } else if (unlikely(r != 0)) { | ||
1046 | + return r; | ||
1047 | } | ||
1048 | + | ||
1049 | + offset = bo->mem.start << PAGE_SHIFT; | ||
1050 | + /* this should never happen */ | ||
1051 | + if ((offset + size) > rdev->mc.visible_vram_size) | ||
1052 | + return -EINVAL; | ||
1053 | + | ||
1054 | return 0; | ||
1055 | } | ||
1056 | |||
1057 | diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c | ||
1058 | index a957024eae24..f77d9d0d54b5 100644 | ||
1059 | --- a/drivers/gpu/drm/radeon/radeon_pm.c | ||
1060 | +++ b/drivers/gpu/drm/radeon/radeon_pm.c | ||
1061 | @@ -361,6 +361,11 @@ static ssize_t radeon_set_pm_profile(struct device *dev, | ||
1062 | struct drm_device *ddev = dev_get_drvdata(dev); | ||
1063 | struct radeon_device *rdev = ddev->dev_private; | ||
1064 | |||
1065 | + /* Can't set profile when the card is off */ | ||
1066 | + if ((rdev->flags & RADEON_IS_PX) && | ||
1067 | + (ddev->switch_power_state != DRM_SWITCH_POWER_ON)) | ||
1068 | + return -EINVAL; | ||
1069 | + | ||
1070 | mutex_lock(&rdev->pm.mutex); | ||
1071 | if (rdev->pm.pm_method == PM_METHOD_PROFILE) { | ||
1072 | if (strncmp("default", buf, strlen("default")) == 0) | ||
1073 | @@ -409,6 +414,13 @@ static ssize_t radeon_set_pm_method(struct device *dev, | ||
1074 | struct drm_device *ddev = dev_get_drvdata(dev); | ||
1075 | struct radeon_device *rdev = ddev->dev_private; | ||
1076 | |||
1077 | + /* Can't set method when the card is off */ | ||
1078 | + if ((rdev->flags & RADEON_IS_PX) && | ||
1079 | + (ddev->switch_power_state != DRM_SWITCH_POWER_ON)) { | ||
1080 | + count = -EINVAL; | ||
1081 | + goto fail; | ||
1082 | + } | ||
1083 | + | ||
1084 | /* we don't support the legacy modes with dpm */ | ||
1085 | if (rdev->pm.pm_method == PM_METHOD_DPM) { | ||
1086 | count = -EINVAL; | ||
1087 | @@ -446,6 +458,10 @@ static ssize_t radeon_get_dpm_state(struct device *dev, | ||
1088 | struct radeon_device *rdev = ddev->dev_private; | ||
1089 | enum radeon_pm_state_type pm = rdev->pm.dpm.user_state; | ||
1090 | |||
1091 | + if ((rdev->flags & RADEON_IS_PX) && | ||
1092 | + (ddev->switch_power_state != DRM_SWITCH_POWER_ON)) | ||
1093 | + return snprintf(buf, PAGE_SIZE, "off\n"); | ||
1094 | + | ||
1095 | return snprintf(buf, PAGE_SIZE, "%s\n", | ||
1096 | (pm == POWER_STATE_TYPE_BATTERY) ? "battery" : | ||
1097 | (pm == POWER_STATE_TYPE_BALANCED) ? "balanced" : "performance"); | ||
1098 | @@ -459,6 +475,11 @@ static ssize_t radeon_set_dpm_state(struct device *dev, | ||
1099 | struct drm_device *ddev = dev_get_drvdata(dev); | ||
1100 | struct radeon_device *rdev = ddev->dev_private; | ||
1101 | |||
1102 | + /* Can't set dpm state when the card is off */ | ||
1103 | + if ((rdev->flags & RADEON_IS_PX) && | ||
1104 | + (ddev->switch_power_state != DRM_SWITCH_POWER_ON)) | ||
1105 | + return -EINVAL; | ||
1106 | + | ||
1107 | mutex_lock(&rdev->pm.mutex); | ||
1108 | if (strncmp("battery", buf, strlen("battery")) == 0) | ||
1109 | rdev->pm.dpm.user_state = POWER_STATE_TYPE_BATTERY; | ||
1110 | @@ -485,6 +506,10 @@ static ssize_t radeon_get_dpm_forced_performance_level(struct device *dev, | ||
1111 | struct radeon_device *rdev = ddev->dev_private; | ||
1112 | enum radeon_dpm_forced_level level = rdev->pm.dpm.forced_level; | ||
1113 | |||
1114 | + if ((rdev->flags & RADEON_IS_PX) && | ||
1115 | + (ddev->switch_power_state != DRM_SWITCH_POWER_ON)) | ||
1116 | + return snprintf(buf, PAGE_SIZE, "off\n"); | ||
1117 | + | ||
1118 | return snprintf(buf, PAGE_SIZE, "%s\n", | ||
1119 | (level == RADEON_DPM_FORCED_LEVEL_AUTO) ? "auto" : | ||
1120 | (level == RADEON_DPM_FORCED_LEVEL_LOW) ? "low" : "high"); | ||
1121 | @@ -500,6 +525,11 @@ static ssize_t radeon_set_dpm_forced_performance_level(struct device *dev, | ||
1122 | enum radeon_dpm_forced_level level; | ||
1123 | int ret = 0; | ||
1124 | |||
1125 | + /* Can't force performance level when the card is off */ | ||
1126 | + if ((rdev->flags & RADEON_IS_PX) && | ||
1127 | + (ddev->switch_power_state != DRM_SWITCH_POWER_ON)) | ||
1128 | + return -EINVAL; | ||
1129 | + | ||
1130 | mutex_lock(&rdev->pm.mutex); | ||
1131 | if (strncmp("low", buf, strlen("low")) == 0) { | ||
1132 | level = RADEON_DPM_FORCED_LEVEL_LOW; | ||
1133 | @@ -538,8 +568,14 @@ static ssize_t radeon_hwmon_show_temp(struct device *dev, | ||
1134 | char *buf) | ||
1135 | { | ||
1136 | struct radeon_device *rdev = dev_get_drvdata(dev); | ||
1137 | + struct drm_device *ddev = rdev->ddev; | ||
1138 | int temp; | ||
1139 | |||
1140 | + /* Can't get temperature when the card is off */ | ||
1141 | + if ((rdev->flags & RADEON_IS_PX) && | ||
1142 | + (ddev->switch_power_state != DRM_SWITCH_POWER_ON)) | ||
1143 | + return -EINVAL; | ||
1144 | + | ||
1145 | if (rdev->asic->pm.get_temperature) | ||
1146 | temp = radeon_get_temperature(rdev); | ||
1147 | else | ||
1148 | @@ -1046,7 +1082,6 @@ static void radeon_pm_resume_dpm(struct radeon_device *rdev) | ||
1149 | if (ret) | ||
1150 | goto dpm_resume_fail; | ||
1151 | rdev->pm.dpm_enabled = true; | ||
1152 | - radeon_pm_compute_clocks(rdev); | ||
1153 | return; | ||
1154 | |||
1155 | dpm_resume_fail: | ||
1156 | @@ -1591,8 +1626,12 @@ static int radeon_debugfs_pm_info(struct seq_file *m, void *data) | ||
1157 | struct drm_info_node *node = (struct drm_info_node *) m->private; | ||
1158 | struct drm_device *dev = node->minor->dev; | ||
1159 | struct radeon_device *rdev = dev->dev_private; | ||
1160 | + struct drm_device *ddev = rdev->ddev; | ||
1161 | |||
1162 | - if (rdev->pm.dpm_enabled) { | ||
1163 | + if ((rdev->flags & RADEON_IS_PX) && | ||
1164 | + (ddev->switch_power_state != DRM_SWITCH_POWER_ON)) { | ||
1165 | + seq_printf(m, "PX asic powered off\n"); | ||
1166 | + } else if (rdev->pm.dpm_enabled) { | ||
1167 | mutex_lock(&rdev->pm.mutex); | ||
1168 | if (rdev->asic->dpm.debugfs_print_current_performance_level) | ||
1169 | radeon_dpm_debugfs_print_current_performance_level(rdev, m); | ||
1170 | diff --git a/drivers/gpu/drm/radeon/sid.h b/drivers/gpu/drm/radeon/sid.h | ||
1171 | index 9239a6d29128..3007cddc7e70 100644 | ||
1172 | --- a/drivers/gpu/drm/radeon/sid.h | ||
1173 | +++ b/drivers/gpu/drm/radeon/sid.h | ||
1174 | @@ -107,8 +107,8 @@ | ||
1175 | #define SPLL_CHG_STATUS (1 << 1) | ||
1176 | #define SPLL_CNTL_MODE 0x618 | ||
1177 | #define SPLL_SW_DIR_CONTROL (1 << 0) | ||
1178 | -# define SPLL_REFCLK_SEL(x) ((x) << 8) | ||
1179 | -# define SPLL_REFCLK_SEL_MASK 0xFF00 | ||
1180 | +# define SPLL_REFCLK_SEL(x) ((x) << 26) | ||
1181 | +# define SPLL_REFCLK_SEL_MASK (3 << 26) | ||
1182 | |||
1183 | #define CG_SPLL_SPREAD_SPECTRUM 0x620 | ||
1184 | #define SSEN (1 << 0) | ||
1185 | diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig | ||
1186 | index 5ce43d8dfa98..7703e3bc604b 100644 | ||
1187 | --- a/drivers/hwmon/Kconfig | ||
1188 | +++ b/drivers/hwmon/Kconfig | ||
1189 | @@ -971,7 +971,7 @@ config SENSORS_NCT6775 | ||
1190 | |||
1191 | config SENSORS_NTC_THERMISTOR | ||
1192 | tristate "NTC thermistor support" | ||
1193 | - depends on (!OF && !IIO) || (OF && IIO) | ||
1194 | + depends on !OF || IIO=n || IIO | ||
1195 | help | ||
1196 | This driver supports NTC thermistors sensor reading and its | ||
1197 | interpretation. The driver can also monitor the temperature and | ||
1198 | diff --git a/drivers/hwmon/ntc_thermistor.c b/drivers/hwmon/ntc_thermistor.c | ||
1199 | index 8a17f01e8672..e76feb86a1d4 100644 | ||
1200 | --- a/drivers/hwmon/ntc_thermistor.c | ||
1201 | +++ b/drivers/hwmon/ntc_thermistor.c | ||
1202 | @@ -44,6 +44,7 @@ struct ntc_compensation { | ||
1203 | unsigned int ohm; | ||
1204 | }; | ||
1205 | |||
1206 | +/* Order matters, ntc_match references the entries by index */ | ||
1207 | static const struct platform_device_id ntc_thermistor_id[] = { | ||
1208 | { "ncp15wb473", TYPE_NCPXXWB473 }, | ||
1209 | { "ncp18wb473", TYPE_NCPXXWB473 }, | ||
1210 | @@ -141,7 +142,7 @@ struct ntc_data { | ||
1211 | char name[PLATFORM_NAME_SIZE]; | ||
1212 | }; | ||
1213 | |||
1214 | -#ifdef CONFIG_OF | ||
1215 | +#if defined(CONFIG_OF) && IS_ENABLED(CONFIG_IIO) | ||
1216 | static int ntc_adc_iio_read(struct ntc_thermistor_platform_data *pdata) | ||
1217 | { | ||
1218 | struct iio_channel *channel = pdata->chan; | ||
1219 | @@ -163,15 +164,15 @@ static int ntc_adc_iio_read(struct ntc_thermistor_platform_data *pdata) | ||
1220 | |||
1221 | static const struct of_device_id ntc_match[] = { | ||
1222 | { .compatible = "ntc,ncp15wb473", | ||
1223 | - .data = &ntc_thermistor_id[TYPE_NCPXXWB473] }, | ||
1224 | + .data = &ntc_thermistor_id[0] }, | ||
1225 | { .compatible = "ntc,ncp18wb473", | ||
1226 | - .data = &ntc_thermistor_id[TYPE_NCPXXWB473] }, | ||
1227 | + .data = &ntc_thermistor_id[1] }, | ||
1228 | { .compatible = "ntc,ncp21wb473", | ||
1229 | - .data = &ntc_thermistor_id[TYPE_NCPXXWB473] }, | ||
1230 | + .data = &ntc_thermistor_id[2] }, | ||
1231 | { .compatible = "ntc,ncp03wb473", | ||
1232 | - .data = &ntc_thermistor_id[TYPE_NCPXXWB473] }, | ||
1233 | + .data = &ntc_thermistor_id[3] }, | ||
1234 | { .compatible = "ntc,ncp15wl333", | ||
1235 | - .data = &ntc_thermistor_id[TYPE_NCPXXWL333] }, | ||
1236 | + .data = &ntc_thermistor_id[4] }, | ||
1237 | { }, | ||
1238 | }; | ||
1239 | MODULE_DEVICE_TABLE(of, ntc_match); | ||
1240 | @@ -223,6 +224,8 @@ ntc_thermistor_parse_dt(struct platform_device *pdev) | ||
1241 | return NULL; | ||
1242 | } | ||
1243 | |||
1244 | +#define ntc_match NULL | ||
1245 | + | ||
1246 | static void ntc_iio_channel_release(struct ntc_thermistor_platform_data *pdata) | ||
1247 | { } | ||
1248 | #endif | ||
1249 | diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c | ||
1250 | index 51766b3bc678..b7794792760d 100644 | ||
1251 | --- a/drivers/infiniband/ulp/isert/ib_isert.c | ||
1252 | +++ b/drivers/infiniband/ulp/isert/ib_isert.c | ||
1253 | @@ -1117,6 +1117,8 @@ sequence_cmd: | ||
1254 | |||
1255 | if (!rc && dump_payload == false && unsol_data) | ||
1256 | iscsit_set_unsoliticed_dataout(cmd); | ||
1257 | + else if (dump_payload && imm_data) | ||
1258 | + target_put_sess_cmd(conn->sess->se_sess, &cmd->se_cmd); | ||
1259 | |||
1260 | return 0; | ||
1261 | } | ||
1262 | diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c | ||
1263 | index a22c86c867fa..40f6b47c28f6 100644 | ||
1264 | --- a/drivers/iommu/intel-iommu.c | ||
1265 | +++ b/drivers/iommu/intel-iommu.c | ||
1266 | @@ -4075,7 +4075,7 @@ static size_t intel_iommu_unmap(struct iommu_domain *domain, | ||
1267 | unsigned long iova, size_t size) | ||
1268 | { | ||
1269 | struct dmar_domain *dmar_domain = domain->priv; | ||
1270 | - int order; | ||
1271 | + int order, iommu_id; | ||
1272 | |||
1273 | order = dma_pte_clear_range(dmar_domain, iova >> VTD_PAGE_SHIFT, | ||
1274 | (iova + size - 1) >> VTD_PAGE_SHIFT); | ||
1275 | @@ -4083,6 +4083,22 @@ static size_t intel_iommu_unmap(struct iommu_domain *domain, | ||
1276 | if (dmar_domain->max_addr == iova + size) | ||
1277 | dmar_domain->max_addr = iova; | ||
1278 | |||
1279 | + for_each_set_bit(iommu_id, dmar_domain->iommu_bmp, g_num_of_iommus) { | ||
1280 | + struct intel_iommu *iommu = g_iommus[iommu_id]; | ||
1281 | + int num, ndomains; | ||
1282 | + | ||
1283 | + /* | ||
1284 | + * find bit position of dmar_domain | ||
1285 | + */ | ||
1286 | + ndomains = cap_ndoms(iommu->cap); | ||
1287 | + for_each_set_bit(num, iommu->domain_ids, ndomains) { | ||
1288 | + if (iommu->domains[num] == dmar_domain) | ||
1289 | + iommu_flush_iotlb_psi(iommu, num, | ||
1290 | + iova >> VTD_PAGE_SHIFT, | ||
1291 | + 1 << order, 0); | ||
1292 | + } | ||
1293 | + } | ||
1294 | + | ||
1295 | return PAGE_SIZE << order; | ||
1296 | } | ||
1297 | |||
1298 | diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c | ||
1299 | index 9306e0bcb564..c0ad90d91252 100644 | ||
1300 | --- a/drivers/md/dm-cache-target.c | ||
1301 | +++ b/drivers/md/dm-cache-target.c | ||
1302 | @@ -2195,6 +2195,8 @@ static int cache_create(struct cache_args *ca, struct cache **result) | ||
1303 | ti->num_discard_bios = 1; | ||
1304 | ti->discards_supported = true; | ||
1305 | ti->discard_zeroes_data_unsupported = true; | ||
1306 | + /* Discard bios must be split on a block boundary */ | ||
1307 | + ti->split_discard_bios = true; | ||
1308 | |||
1309 | cache->features = ca->features; | ||
1310 | ti->per_bio_data_size = get_per_bio_data_size(cache); | ||
1311 | diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c | ||
1312 | index fa602b56b648..94d2ac1b493e 100644 | ||
1313 | --- a/drivers/md/dm-thin.c | ||
1314 | +++ b/drivers/md/dm-thin.c | ||
1315 | @@ -25,7 +25,9 @@ | ||
1316 | #define MAPPING_POOL_SIZE 1024 | ||
1317 | #define PRISON_CELLS 1024 | ||
1318 | #define COMMIT_PERIOD HZ | ||
1319 | -#define NO_SPACE_TIMEOUT (HZ * 60) | ||
1320 | +#define NO_SPACE_TIMEOUT_SECS 60 | ||
1321 | + | ||
1322 | +static unsigned no_space_timeout_secs = NO_SPACE_TIMEOUT_SECS; | ||
1323 | |||
1324 | DECLARE_DM_KCOPYD_THROTTLE_WITH_MODULE_PARM(snapshot_copy_throttle, | ||
1325 | "A percentage of time allocated for copy on write"); | ||
1326 | @@ -1529,6 +1531,7 @@ static void set_pool_mode(struct pool *pool, enum pool_mode new_mode) | ||
1327 | struct pool_c *pt = pool->ti->private; | ||
1328 | bool needs_check = dm_pool_metadata_needs_check(pool->pmd); | ||
1329 | enum pool_mode old_mode = get_pool_mode(pool); | ||
1330 | + unsigned long no_space_timeout = ACCESS_ONCE(no_space_timeout_secs) * HZ; | ||
1331 | |||
1332 | /* | ||
1333 | * Never allow the pool to transition to PM_WRITE mode if user | ||
1334 | @@ -1591,8 +1594,8 @@ static void set_pool_mode(struct pool *pool, enum pool_mode new_mode) | ||
1335 | pool->process_prepared_mapping = process_prepared_mapping; | ||
1336 | pool->process_prepared_discard = process_prepared_discard_passdown; | ||
1337 | |||
1338 | - if (!pool->pf.error_if_no_space) | ||
1339 | - queue_delayed_work(pool->wq, &pool->no_space_timeout, NO_SPACE_TIMEOUT); | ||
1340 | + if (!pool->pf.error_if_no_space && no_space_timeout) | ||
1341 | + queue_delayed_work(pool->wq, &pool->no_space_timeout, no_space_timeout); | ||
1342 | break; | ||
1343 | |||
1344 | case PM_WRITE: | ||
1345 | @@ -3326,6 +3329,9 @@ static void dm_thin_exit(void) | ||
1346 | module_init(dm_thin_init); | ||
1347 | module_exit(dm_thin_exit); | ||
1348 | |||
1349 | +module_param_named(no_space_timeout, no_space_timeout_secs, uint, S_IRUGO | S_IWUSR); | ||
1350 | +MODULE_PARM_DESC(no_space_timeout, "Out of data space queue IO timeout in seconds"); | ||
1351 | + | ||
1352 | MODULE_DESCRIPTION(DM_NAME " thin provisioning target"); | ||
1353 | MODULE_AUTHOR("Joe Thornber <dm-devel@redhat.com>"); | ||
1354 | MODULE_LICENSE("GPL"); | ||
1355 | diff --git a/drivers/md/md.c b/drivers/md/md.c | ||
1356 | index 51c431c3a411..8b013f87c9d8 100644 | ||
1357 | --- a/drivers/md/md.c | ||
1358 | +++ b/drivers/md/md.c | ||
1359 | @@ -7395,8 +7395,10 @@ void md_do_sync(struct md_thread *thread) | ||
1360 | /* just incase thread restarts... */ | ||
1361 | if (test_bit(MD_RECOVERY_DONE, &mddev->recovery)) | ||
1362 | return; | ||
1363 | - if (mddev->ro) /* never try to sync a read-only array */ | ||
1364 | + if (mddev->ro) {/* never try to sync a read-only array */ | ||
1365 | + set_bit(MD_RECOVERY_INTR, &mddev->recovery); | ||
1366 | return; | ||
1367 | + } | ||
1368 | |||
1369 | if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) { | ||
1370 | if (test_bit(MD_RECOVERY_CHECK, &mddev->recovery)) { | ||
1371 | @@ -7838,6 +7840,7 @@ void md_check_recovery(struct mddev *mddev) | ||
1372 | /* There is no thread, but we need to call | ||
1373 | * ->spare_active and clear saved_raid_disk | ||
1374 | */ | ||
1375 | + set_bit(MD_RECOVERY_INTR, &mddev->recovery); | ||
1376 | md_reap_sync_thread(mddev); | ||
1377 | clear_bit(MD_RECOVERY_NEEDED, &mddev->recovery); | ||
1378 | goto unlock; | ||
1379 | diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c | ||
1380 | index 1b681427dde0..c341f855fadc 100644 | ||
1381 | --- a/drivers/scsi/scsi_transport_sas.c | ||
1382 | +++ b/drivers/scsi/scsi_transport_sas.c | ||
1383 | @@ -1621,8 +1621,6 @@ void sas_rphy_free(struct sas_rphy *rphy) | ||
1384 | list_del(&rphy->list); | ||
1385 | mutex_unlock(&sas_host->lock); | ||
1386 | |||
1387 | - sas_bsg_remove(shost, rphy); | ||
1388 | - | ||
1389 | transport_destroy_device(dev); | ||
1390 | |||
1391 | put_device(dev); | ||
1392 | @@ -1681,6 +1679,7 @@ sas_rphy_remove(struct sas_rphy *rphy) | ||
1393 | } | ||
1394 | |||
1395 | sas_rphy_unlink(rphy); | ||
1396 | + sas_bsg_remove(NULL, rphy); | ||
1397 | transport_remove_device(dev); | ||
1398 | device_del(dev); | ||
1399 | } | ||
1400 | diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c | ||
1401 | index e4cdca349157..6417af0bdaab 100644 | ||
1402 | --- a/drivers/staging/comedi/drivers/ni_daq_700.c | ||
1403 | +++ b/drivers/staging/comedi/drivers/ni_daq_700.c | ||
1404 | @@ -122,6 +122,8 @@ static int daq700_ai_rinsn(struct comedi_device *dev, | ||
1405 | /* write channel to multiplexer */ | ||
1406 | /* set mask scan bit high to disable scanning */ | ||
1407 | outb(chan | 0x80, dev->iobase + CMD_R1); | ||
1408 | + /* mux needs 2us to really settle [Fred Brooks]. */ | ||
1409 | + udelay(2); | ||
1410 | |||
1411 | /* convert n samples */ | ||
1412 | for (n = 0; n < insn->n; n++) { | ||
1413 | diff --git a/drivers/staging/rtl8192e/rtllib_tx.c b/drivers/staging/rtl8192e/rtllib_tx.c | ||
1414 | index 77964885b3f2..334d949afd63 100644 | ||
1415 | --- a/drivers/staging/rtl8192e/rtllib_tx.c | ||
1416 | +++ b/drivers/staging/rtl8192e/rtllib_tx.c | ||
1417 | @@ -171,7 +171,7 @@ inline int rtllib_put_snap(u8 *data, u16 h_proto) | ||
1418 | snap->oui[1] = oui[1]; | ||
1419 | snap->oui[2] = oui[2]; | ||
1420 | |||
1421 | - *(u16 *)(data + SNAP_SIZE) = h_proto; | ||
1422 | + *(__be16 *)(data + SNAP_SIZE) = htons(h_proto); | ||
1423 | |||
1424 | return SNAP_SIZE + sizeof(u16); | ||
1425 | } | ||
1426 | diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c | ||
1427 | index ef5933b93590..f61f9cf95ed7 100644 | ||
1428 | --- a/drivers/staging/speakup/main.c | ||
1429 | +++ b/drivers/staging/speakup/main.c | ||
1430 | @@ -2218,6 +2218,7 @@ static void __exit speakup_exit(void) | ||
1431 | unregister_keyboard_notifier(&keyboard_notifier_block); | ||
1432 | unregister_vt_notifier(&vt_notifier_block); | ||
1433 | speakup_unregister_devsynth(); | ||
1434 | + speakup_cancel_paste(); | ||
1435 | del_timer(&cursor_timer); | ||
1436 | kthread_stop(speakup_task); | ||
1437 | speakup_task = NULL; | ||
1438 | diff --git a/drivers/staging/speakup/selection.c b/drivers/staging/speakup/selection.c | ||
1439 | index f0fb00392d6b..ca04d3669acc 100644 | ||
1440 | --- a/drivers/staging/speakup/selection.c | ||
1441 | +++ b/drivers/staging/speakup/selection.c | ||
1442 | @@ -4,6 +4,10 @@ | ||
1443 | #include <linux/sched.h> | ||
1444 | #include <linux/device.h> /* for dev_warn */ | ||
1445 | #include <linux/selection.h> | ||
1446 | +#include <linux/workqueue.h> | ||
1447 | +#include <linux/tty.h> | ||
1448 | +#include <linux/tty_flip.h> | ||
1449 | +#include <asm/cmpxchg.h> | ||
1450 | |||
1451 | #include "speakup.h" | ||
1452 | |||
1453 | @@ -121,31 +125,61 @@ int speakup_set_selection(struct tty_struct *tty) | ||
1454 | return 0; | ||
1455 | } | ||
1456 | |||
1457 | -/* TODO: move to some helper thread, probably. That'd fix having to check for | ||
1458 | - * in_atomic(). */ | ||
1459 | -int speakup_paste_selection(struct tty_struct *tty) | ||
1460 | +struct speakup_paste_work { | ||
1461 | + struct work_struct work; | ||
1462 | + struct tty_struct *tty; | ||
1463 | +}; | ||
1464 | + | ||
1465 | +static void __speakup_paste_selection(struct work_struct *work) | ||
1466 | { | ||
1467 | + struct speakup_paste_work *spw = | ||
1468 | + container_of(work, struct speakup_paste_work, work); | ||
1469 | + struct tty_struct *tty = xchg(&spw->tty, NULL); | ||
1470 | struct vc_data *vc = (struct vc_data *) tty->driver_data; | ||
1471 | int pasted = 0, count; | ||
1472 | + struct tty_ldisc *ld; | ||
1473 | DECLARE_WAITQUEUE(wait, current); | ||
1474 | + | ||
1475 | + ld = tty_ldisc_ref_wait(tty); | ||
1476 | + tty_buffer_lock_exclusive(&vc->port); | ||
1477 | + | ||
1478 | add_wait_queue(&vc->paste_wait, &wait); | ||
1479 | while (sel_buffer && sel_buffer_lth > pasted) { | ||
1480 | set_current_state(TASK_INTERRUPTIBLE); | ||
1481 | if (test_bit(TTY_THROTTLED, &tty->flags)) { | ||
1482 | - if (in_atomic()) | ||
1483 | - /* if we are in an interrupt handler, abort */ | ||
1484 | - break; | ||
1485 | schedule(); | ||
1486 | continue; | ||
1487 | } | ||
1488 | count = sel_buffer_lth - pasted; | ||
1489 | - count = min_t(int, count, tty->receive_room); | ||
1490 | - tty->ldisc->ops->receive_buf(tty, sel_buffer + pasted, | ||
1491 | - NULL, count); | ||
1492 | + count = tty_ldisc_receive_buf(ld, sel_buffer + pasted, NULL, | ||
1493 | + count); | ||
1494 | pasted += count; | ||
1495 | } | ||
1496 | remove_wait_queue(&vc->paste_wait, &wait); | ||
1497 | current->state = TASK_RUNNING; | ||
1498 | + | ||
1499 | + tty_buffer_unlock_exclusive(&vc->port); | ||
1500 | + tty_ldisc_deref(ld); | ||
1501 | + tty_kref_put(tty); | ||
1502 | +} | ||
1503 | + | ||
1504 | +static struct speakup_paste_work speakup_paste_work = { | ||
1505 | + .work = __WORK_INITIALIZER(speakup_paste_work.work, | ||
1506 | + __speakup_paste_selection) | ||
1507 | +}; | ||
1508 | + | ||
1509 | +int speakup_paste_selection(struct tty_struct *tty) | ||
1510 | +{ | ||
1511 | + if (cmpxchg(&speakup_paste_work.tty, NULL, tty) != NULL) | ||
1512 | + return -EBUSY; | ||
1513 | + | ||
1514 | + tty_kref_get(tty); | ||
1515 | + schedule_work_on(WORK_CPU_UNBOUND, &speakup_paste_work.work); | ||
1516 | return 0; | ||
1517 | } | ||
1518 | |||
1519 | +void speakup_cancel_paste(void) | ||
1520 | +{ | ||
1521 | + cancel_work_sync(&speakup_paste_work.work); | ||
1522 | + tty_kref_put(speakup_paste_work.tty); | ||
1523 | +} | ||
1524 | diff --git a/drivers/staging/speakup/speakup.h b/drivers/staging/speakup/speakup.h | ||
1525 | index 0126f714821a..74fe72429b2d 100644 | ||
1526 | --- a/drivers/staging/speakup/speakup.h | ||
1527 | +++ b/drivers/staging/speakup/speakup.h | ||
1528 | @@ -77,6 +77,7 @@ extern void synth_buffer_clear(void); | ||
1529 | extern void speakup_clear_selection(void); | ||
1530 | extern int speakup_set_selection(struct tty_struct *tty); | ||
1531 | extern int speakup_paste_selection(struct tty_struct *tty); | ||
1532 | +extern void speakup_cancel_paste(void); | ||
1533 | extern void speakup_register_devsynth(void); | ||
1534 | extern void speakup_unregister_devsynth(void); | ||
1535 | extern void synth_write(const char *buf, size_t count); | ||
1536 | diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c | ||
1537 | index e29279e6b577..369ef10e8077 100644 | ||
1538 | --- a/drivers/target/iscsi/iscsi_target_login.c | ||
1539 | +++ b/drivers/target/iscsi/iscsi_target_login.c | ||
1540 | @@ -249,6 +249,28 @@ static void iscsi_login_set_conn_values( | ||
1541 | mutex_unlock(&auth_id_lock); | ||
1542 | } | ||
1543 | |||
1544 | +static __printf(2, 3) int iscsi_change_param_sprintf( | ||
1545 | + struct iscsi_conn *conn, | ||
1546 | + const char *fmt, ...) | ||
1547 | +{ | ||
1548 | + va_list args; | ||
1549 | + unsigned char buf[64]; | ||
1550 | + | ||
1551 | + memset(buf, 0, sizeof buf); | ||
1552 | + | ||
1553 | + va_start(args, fmt); | ||
1554 | + vsnprintf(buf, sizeof buf, fmt, args); | ||
1555 | + va_end(args); | ||
1556 | + | ||
1557 | + if (iscsi_change_param_value(buf, conn->param_list, 0) < 0) { | ||
1558 | + iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR, | ||
1559 | + ISCSI_LOGIN_STATUS_NO_RESOURCES); | ||
1560 | + return -1; | ||
1561 | + } | ||
1562 | + | ||
1563 | + return 0; | ||
1564 | +} | ||
1565 | + | ||
1566 | /* | ||
1567 | * This is the leading connection of a new session, | ||
1568 | * or session reinstatement. | ||
1569 | @@ -337,7 +359,6 @@ static int iscsi_login_zero_tsih_s2( | ||
1570 | { | ||
1571 | struct iscsi_node_attrib *na; | ||
1572 | struct iscsi_session *sess = conn->sess; | ||
1573 | - unsigned char buf[32]; | ||
1574 | bool iser = false; | ||
1575 | |||
1576 | sess->tpg = conn->tpg; | ||
1577 | @@ -378,26 +399,16 @@ static int iscsi_login_zero_tsih_s2( | ||
1578 | * | ||
1579 | * In our case, we have already located the struct iscsi_tiqn at this point. | ||
1580 | */ | ||
1581 | - memset(buf, 0, 32); | ||
1582 | - sprintf(buf, "TargetPortalGroupTag=%hu", sess->tpg->tpgt); | ||
1583 | - if (iscsi_change_param_value(buf, conn->param_list, 0) < 0) { | ||
1584 | - iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR, | ||
1585 | - ISCSI_LOGIN_STATUS_NO_RESOURCES); | ||
1586 | + if (iscsi_change_param_sprintf(conn, "TargetPortalGroupTag=%hu", sess->tpg->tpgt)) | ||
1587 | return -1; | ||
1588 | - } | ||
1589 | |||
1590 | /* | ||
1591 | * Workaround for Initiators that have broken connection recovery logic. | ||
1592 | * | ||
1593 | * "We would really like to get rid of this." Linux-iSCSI.org team | ||
1594 | */ | ||
1595 | - memset(buf, 0, 32); | ||
1596 | - sprintf(buf, "ErrorRecoveryLevel=%d", na->default_erl); | ||
1597 | - if (iscsi_change_param_value(buf, conn->param_list, 0) < 0) { | ||
1598 | - iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR, | ||
1599 | - ISCSI_LOGIN_STATUS_NO_RESOURCES); | ||
1600 | + if (iscsi_change_param_sprintf(conn, "ErrorRecoveryLevel=%d", na->default_erl)) | ||
1601 | return -1; | ||
1602 | - } | ||
1603 | |||
1604 | if (iscsi_login_disable_FIM_keys(conn->param_list, conn) < 0) | ||
1605 | return -1; | ||
1606 | @@ -409,12 +420,9 @@ static int iscsi_login_zero_tsih_s2( | ||
1607 | unsigned long mrdsl, off; | ||
1608 | int rc; | ||
1609 | |||
1610 | - sprintf(buf, "RDMAExtensions=Yes"); | ||
1611 | - if (iscsi_change_param_value(buf, conn->param_list, 0) < 0) { | ||
1612 | - iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR, | ||
1613 | - ISCSI_LOGIN_STATUS_NO_RESOURCES); | ||
1614 | + if (iscsi_change_param_sprintf(conn, "RDMAExtensions=Yes")) | ||
1615 | return -1; | ||
1616 | - } | ||
1617 | + | ||
1618 | /* | ||
1619 | * Make MaxRecvDataSegmentLength PAGE_SIZE aligned for | ||
1620 | * Immediate Data + Unsolicitied Data-OUT if necessary.. | ||
1621 | @@ -444,12 +452,8 @@ static int iscsi_login_zero_tsih_s2( | ||
1622 | pr_warn("Aligning ISER MaxRecvDataSegmentLength: %lu down" | ||
1623 | " to PAGE_SIZE\n", mrdsl); | ||
1624 | |||
1625 | - sprintf(buf, "MaxRecvDataSegmentLength=%lu\n", mrdsl); | ||
1626 | - if (iscsi_change_param_value(buf, conn->param_list, 0) < 0) { | ||
1627 | - iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR, | ||
1628 | - ISCSI_LOGIN_STATUS_NO_RESOURCES); | ||
1629 | + if (iscsi_change_param_sprintf(conn, "MaxRecvDataSegmentLength=%lu\n", mrdsl)) | ||
1630 | return -1; | ||
1631 | - } | ||
1632 | } | ||
1633 | |||
1634 | return 0; | ||
1635 | @@ -591,13 +595,8 @@ static int iscsi_login_non_zero_tsih_s2( | ||
1636 | * | ||
1637 | * In our case, we have already located the struct iscsi_tiqn at this point. | ||
1638 | */ | ||
1639 | - memset(buf, 0, 32); | ||
1640 | - sprintf(buf, "TargetPortalGroupTag=%hu", sess->tpg->tpgt); | ||
1641 | - if (iscsi_change_param_value(buf, conn->param_list, 0) < 0) { | ||
1642 | - iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR, | ||
1643 | - ISCSI_LOGIN_STATUS_NO_RESOURCES); | ||
1644 | + if (iscsi_change_param_sprintf(conn, "TargetPortalGroupTag=%hu", sess->tpg->tpgt)) | ||
1645 | return -1; | ||
1646 | - } | ||
1647 | |||
1648 | return iscsi_login_disable_FIM_keys(conn->param_list, conn); | ||
1649 | } | ||
1650 | diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c | ||
1651 | index f0e85b119692..483d324020a6 100644 | ||
1652 | --- a/drivers/target/target_core_configfs.c | ||
1653 | +++ b/drivers/target/target_core_configfs.c | ||
1654 | @@ -2223,6 +2223,11 @@ static ssize_t target_core_alua_tg_pt_gp_store_attr_alua_access_state( | ||
1655 | " tg_pt_gp ID: %hu\n", tg_pt_gp->tg_pt_gp_valid_id); | ||
1656 | return -EINVAL; | ||
1657 | } | ||
1658 | + if (!(dev->dev_flags & DF_CONFIGURED)) { | ||
1659 | + pr_err("Unable to set alua_access_state while device is" | ||
1660 | + " not configured\n"); | ||
1661 | + return -ENODEV; | ||
1662 | + } | ||
1663 | |||
1664 | ret = kstrtoul(page, 0, &tmp); | ||
1665 | if (ret < 0) { | ||
1666 | diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c | ||
1667 | index cf78d1985cd8..143deb62467d 100644 | ||
1668 | --- a/drivers/tty/tty_buffer.c | ||
1669 | +++ b/drivers/tty/tty_buffer.c | ||
1670 | @@ -60,6 +60,7 @@ void tty_buffer_lock_exclusive(struct tty_port *port) | ||
1671 | atomic_inc(&buf->priority); | ||
1672 | mutex_lock(&buf->lock); | ||
1673 | } | ||
1674 | +EXPORT_SYMBOL_GPL(tty_buffer_lock_exclusive); | ||
1675 | |||
1676 | void tty_buffer_unlock_exclusive(struct tty_port *port) | ||
1677 | { | ||
1678 | @@ -73,6 +74,7 @@ void tty_buffer_unlock_exclusive(struct tty_port *port) | ||
1679 | if (restart) | ||
1680 | queue_work(system_unbound_wq, &buf->work); | ||
1681 | } | ||
1682 | +EXPORT_SYMBOL_GPL(tty_buffer_unlock_exclusive); | ||
1683 | |||
1684 | /** | ||
1685 | * tty_buffer_space_avail - return unused buffer space | ||
1686 | diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c | ||
1687 | index 4ebf1b2034e8..39c7cd6ffa4b 100644 | ||
1688 | --- a/drivers/usb/core/driver.c | ||
1689 | +++ b/drivers/usb/core/driver.c | ||
1690 | @@ -1801,10 +1801,13 @@ int usb_runtime_suspend(struct device *dev) | ||
1691 | if (status == -EAGAIN || status == -EBUSY) | ||
1692 | usb_mark_last_busy(udev); | ||
1693 | |||
1694 | - /* The PM core reacts badly unless the return code is 0, | ||
1695 | - * -EAGAIN, or -EBUSY, so always return -EBUSY on an error. | ||
1696 | + /* | ||
1697 | + * The PM core reacts badly unless the return code is 0, | ||
1698 | + * -EAGAIN, or -EBUSY, so always return -EBUSY on an error | ||
1699 | + * (except for root hubs, because they don't suspend through | ||
1700 | + * an upstream port like other USB devices). | ||
1701 | */ | ||
1702 | - if (status != 0) | ||
1703 | + if (status != 0 && udev->parent) | ||
1704 | return -EBUSY; | ||
1705 | return status; | ||
1706 | } | ||
1707 | diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c | ||
1708 | index d498d03afdbd..3baa51bf8a6a 100644 | ||
1709 | --- a/drivers/usb/core/hub.c | ||
1710 | +++ b/drivers/usb/core/hub.c | ||
1711 | @@ -1679,8 +1679,19 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id) | ||
1712 | */ | ||
1713 | pm_runtime_set_autosuspend_delay(&hdev->dev, 0); | ||
1714 | |||
1715 | - /* Hubs have proper suspend/resume support. */ | ||
1716 | - usb_enable_autosuspend(hdev); | ||
1717 | + /* | ||
1718 | + * Hubs have proper suspend/resume support, except for root hubs | ||
1719 | + * where the controller driver doesn't have bus_suspend and | ||
1720 | + * bus_resume methods. | ||
1721 | + */ | ||
1722 | + if (hdev->parent) { /* normal device */ | ||
1723 | + usb_enable_autosuspend(hdev); | ||
1724 | + } else { /* root hub */ | ||
1725 | + const struct hc_driver *drv = bus_to_hcd(hdev->bus)->driver; | ||
1726 | + | ||
1727 | + if (drv->bus_suspend && drv->bus_resume) | ||
1728 | + usb_enable_autosuspend(hdev); | ||
1729 | + } | ||
1730 | |||
1731 | if (hdev->level == MAX_TOPO_LEVEL) { | ||
1732 | dev_err(&intf->dev, | ||
1733 | diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c | ||
1734 | index 00661d305143..4a6d3dd68572 100644 | ||
1735 | --- a/drivers/usb/host/pci-quirks.c | ||
1736 | +++ b/drivers/usb/host/pci-quirks.c | ||
1737 | @@ -847,6 +847,13 @@ void usb_enable_intel_xhci_ports(struct pci_dev *xhci_pdev) | ||
1738 | bool ehci_found = false; | ||
1739 | struct pci_dev *companion = NULL; | ||
1740 | |||
1741 | + /* Sony VAIO t-series with subsystem device ID 90a8 is not capable of | ||
1742 | + * switching ports from EHCI to xHCI | ||
1743 | + */ | ||
1744 | + if (xhci_pdev->subsystem_vendor == PCI_VENDOR_ID_SONY && | ||
1745 | + xhci_pdev->subsystem_device == 0x90a8) | ||
1746 | + return; | ||
1747 | + | ||
1748 | /* make sure an intel EHCI controller exists */ | ||
1749 | for_each_pci_dev(companion) { | ||
1750 | if (companion->class == PCI_CLASS_SERIAL_USB_EHCI && | ||
1751 | diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c | ||
1752 | index bce4391a0e7d..4133a00461b1 100644 | ||
1753 | --- a/drivers/usb/host/xhci-mem.c | ||
1754 | +++ b/drivers/usb/host/xhci-mem.c | ||
1755 | @@ -1722,6 +1722,16 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) | ||
1756 | kfree(cur_cd); | ||
1757 | } | ||
1758 | |||
1759 | + num_ports = HCS_MAX_PORTS(xhci->hcs_params1); | ||
1760 | + for (i = 0; i < num_ports; i++) { | ||
1761 | + struct xhci_interval_bw_table *bwt = &xhci->rh_bw[i].bw_table; | ||
1762 | + for (j = 0; j < XHCI_MAX_INTERVAL; j++) { | ||
1763 | + struct list_head *ep = &bwt->interval_bw[j].endpoints; | ||
1764 | + while (!list_empty(ep)) | ||
1765 | + list_del_init(ep->next); | ||
1766 | + } | ||
1767 | + } | ||
1768 | + | ||
1769 | for (i = 1; i < MAX_HC_SLOTS; ++i) | ||
1770 | xhci_free_virt_device(xhci, i); | ||
1771 | |||
1772 | @@ -1757,16 +1767,6 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) | ||
1773 | if (!xhci->rh_bw) | ||
1774 | goto no_bw; | ||
1775 | |||
1776 | - num_ports = HCS_MAX_PORTS(xhci->hcs_params1); | ||
1777 | - for (i = 0; i < num_ports; i++) { | ||
1778 | - struct xhci_interval_bw_table *bwt = &xhci->rh_bw[i].bw_table; | ||
1779 | - for (j = 0; j < XHCI_MAX_INTERVAL; j++) { | ||
1780 | - struct list_head *ep = &bwt->interval_bw[j].endpoints; | ||
1781 | - while (!list_empty(ep)) | ||
1782 | - list_del_init(ep->next); | ||
1783 | - } | ||
1784 | - } | ||
1785 | - | ||
1786 | for (i = 0; i < num_ports; i++) { | ||
1787 | struct xhci_tt_bw_info *tt, *n; | ||
1788 | list_for_each_entry_safe(tt, n, &xhci->rh_bw[i].tts, tt_list) { | ||
1789 | diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c | ||
1790 | index 7c6e1dedeb06..edf3b124583c 100644 | ||
1791 | --- a/drivers/usb/serial/ftdi_sio.c | ||
1792 | +++ b/drivers/usb/serial/ftdi_sio.c | ||
1793 | @@ -580,6 +580,8 @@ static const struct usb_device_id id_table_combined[] = { | ||
1794 | { USB_DEVICE(FTDI_VID, FTDI_TAVIR_STK500_PID) }, | ||
1795 | { USB_DEVICE(FTDI_VID, FTDI_TIAO_UMPA_PID), | ||
1796 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | ||
1797 | + { USB_DEVICE(FTDI_VID, FTDI_NT_ORIONLXM_PID), | ||
1798 | + .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | ||
1799 | /* | ||
1800 | * ELV devices: | ||
1801 | */ | ||
1802 | diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h | ||
1803 | index 993c93df6874..500474c48f4b 100644 | ||
1804 | --- a/drivers/usb/serial/ftdi_sio_ids.h | ||
1805 | +++ b/drivers/usb/serial/ftdi_sio_ids.h | ||
1806 | @@ -538,6 +538,11 @@ | ||
1807 | */ | ||
1808 | #define FTDI_TIAO_UMPA_PID 0x8a98 /* TIAO/DIYGADGET USB Multi-Protocol Adapter */ | ||
1809 | |||
1810 | +/* | ||
1811 | + * NovaTech product ids (FTDI_VID) | ||
1812 | + */ | ||
1813 | +#define FTDI_NT_ORIONLXM_PID 0x7c90 /* OrionLXm Substation Automation Platform */ | ||
1814 | + | ||
1815 | |||
1816 | /********************************/ | ||
1817 | /** third-party VID/PID combos **/ | ||
1818 | diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c | ||
1819 | index df90dae53eb9..c0a42e9e6777 100644 | ||
1820 | --- a/drivers/usb/serial/io_ti.c | ||
1821 | +++ b/drivers/usb/serial/io_ti.c | ||
1822 | @@ -821,7 +821,7 @@ static int build_i2c_fw_hdr(__u8 *header, struct device *dev) | ||
1823 | firmware_rec = (struct ti_i2c_firmware_rec*)i2c_header->Data; | ||
1824 | |||
1825 | i2c_header->Type = I2C_DESC_TYPE_FIRMWARE_BLANK; | ||
1826 | - i2c_header->Size = (__u16)buffer_size; | ||
1827 | + i2c_header->Size = cpu_to_le16(buffer_size); | ||
1828 | i2c_header->CheckSum = cs; | ||
1829 | firmware_rec->Ver_Major = OperationalMajorVersion; | ||
1830 | firmware_rec->Ver_Minor = OperationalMinorVersion; | ||
1831 | diff --git a/drivers/usb/serial/io_usbvend.h b/drivers/usb/serial/io_usbvend.h | ||
1832 | index 51f83fbb73bb..6f6a856bc37c 100644 | ||
1833 | --- a/drivers/usb/serial/io_usbvend.h | ||
1834 | +++ b/drivers/usb/serial/io_usbvend.h | ||
1835 | @@ -594,7 +594,7 @@ struct edge_boot_descriptor { | ||
1836 | |||
1837 | struct ti_i2c_desc { | ||
1838 | __u8 Type; // Type of descriptor | ||
1839 | - __u16 Size; // Size of data only not including header | ||
1840 | + __le16 Size; // Size of data only not including header | ||
1841 | __u8 CheckSum; // Checksum (8 bit sum of data only) | ||
1842 | __u8 Data[0]; // Data starts here | ||
1843 | } __attribute__((packed)); | ||
1844 | diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c | ||
1845 | index f213ee978516..948a19f0cdf7 100644 | ||
1846 | --- a/drivers/usb/serial/option.c | ||
1847 | +++ b/drivers/usb/serial/option.c | ||
1848 | @@ -161,6 +161,7 @@ static void option_instat_callback(struct urb *urb); | ||
1849 | #define NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_FULLSPEED 0x9000 | ||
1850 | #define NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_HIGHSPEED 0x9001 | ||
1851 | #define NOVATELWIRELESS_PRODUCT_E362 0x9010 | ||
1852 | +#define NOVATELWIRELESS_PRODUCT_E371 0x9011 | ||
1853 | #define NOVATELWIRELESS_PRODUCT_G2 0xA010 | ||
1854 | #define NOVATELWIRELESS_PRODUCT_MC551 0xB001 | ||
1855 | |||
1856 | @@ -1012,6 +1013,7 @@ static const struct usb_device_id option_ids[] = { | ||
1857 | /* Novatel Ovation MC551 a.k.a. Verizon USB551L */ | ||
1858 | { USB_DEVICE_AND_INTERFACE_INFO(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC551, 0xff, 0xff, 0xff) }, | ||
1859 | { USB_DEVICE_AND_INTERFACE_INFO(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_E362, 0xff, 0xff, 0xff) }, | ||
1860 | + { USB_DEVICE_AND_INTERFACE_INFO(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_E371, 0xff, 0xff, 0xff) }, | ||
1861 | |||
1862 | { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01) }, | ||
1863 | { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01A) }, | ||
1864 | diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c | ||
1865 | index fb52b548080d..8f788193e3d4 100644 | ||
1866 | --- a/fs/proc/task_mmu.c | ||
1867 | +++ b/fs/proc/task_mmu.c | ||
1868 | @@ -1350,7 +1350,7 @@ static int gather_hugetbl_stats(pte_t *pte, unsigned long hmask, | ||
1869 | struct numa_maps *md; | ||
1870 | struct page *page; | ||
1871 | |||
1872 | - if (pte_none(*pte)) | ||
1873 | + if (!pte_present(*pte)) | ||
1874 | return 0; | ||
1875 | |||
1876 | page = pte_page(*pte); | ||
1877 | diff --git a/include/linux/percpu-refcount.h b/include/linux/percpu-refcount.h | ||
1878 | index 95961f0bf62d..0afb48fd449d 100644 | ||
1879 | --- a/include/linux/percpu-refcount.h | ||
1880 | +++ b/include/linux/percpu-refcount.h | ||
1881 | @@ -110,7 +110,7 @@ static inline void percpu_ref_get(struct percpu_ref *ref) | ||
1882 | pcpu_count = ACCESS_ONCE(ref->pcpu_count); | ||
1883 | |||
1884 | if (likely(REF_STATUS(pcpu_count) == PCPU_REF_PTR)) | ||
1885 | - __this_cpu_inc(*pcpu_count); | ||
1886 | + this_cpu_inc(*pcpu_count); | ||
1887 | else | ||
1888 | atomic_inc(&ref->count); | ||
1889 | |||
1890 | @@ -139,7 +139,7 @@ static inline bool percpu_ref_tryget(struct percpu_ref *ref) | ||
1891 | pcpu_count = ACCESS_ONCE(ref->pcpu_count); | ||
1892 | |||
1893 | if (likely(REF_STATUS(pcpu_count) == PCPU_REF_PTR)) { | ||
1894 | - __this_cpu_inc(*pcpu_count); | ||
1895 | + this_cpu_inc(*pcpu_count); | ||
1896 | ret = true; | ||
1897 | } | ||
1898 | |||
1899 | @@ -164,7 +164,7 @@ static inline void percpu_ref_put(struct percpu_ref *ref) | ||
1900 | pcpu_count = ACCESS_ONCE(ref->pcpu_count); | ||
1901 | |||
1902 | if (likely(REF_STATUS(pcpu_count) == PCPU_REF_PTR)) | ||
1903 | - __this_cpu_dec(*pcpu_count); | ||
1904 | + this_cpu_dec(*pcpu_count); | ||
1905 | else if (unlikely(atomic_dec_and_test(&ref->count))) | ||
1906 | ref->release(ref); | ||
1907 | |||
1908 | diff --git a/include/uapi/linux/usb/Kbuild b/include/uapi/linux/usb/Kbuild | ||
1909 | index 6cb4ea826834..4cc4d6e7e523 100644 | ||
1910 | --- a/include/uapi/linux/usb/Kbuild | ||
1911 | +++ b/include/uapi/linux/usb/Kbuild | ||
1912 | @@ -1,6 +1,7 @@ | ||
1913 | # UAPI Header export list | ||
1914 | header-y += audio.h | ||
1915 | header-y += cdc.h | ||
1916 | +header-y += cdc-wdm.h | ||
1917 | header-y += ch11.h | ||
1918 | header-y += ch9.h | ||
1919 | header-y += functionfs.h | ||
1920 | diff --git a/include/uapi/linux/usb/cdc-wdm.h b/include/uapi/linux/usb/cdc-wdm.h | ||
1921 | index f03134feebd6..0dc132e75030 100644 | ||
1922 | --- a/include/uapi/linux/usb/cdc-wdm.h | ||
1923 | +++ b/include/uapi/linux/usb/cdc-wdm.h | ||
1924 | @@ -9,6 +9,8 @@ | ||
1925 | #ifndef _UAPI__LINUX_USB_CDC_WDM_H | ||
1926 | #define _UAPI__LINUX_USB_CDC_WDM_H | ||
1927 | |||
1928 | +#include <linux/types.h> | ||
1929 | + | ||
1930 | /* | ||
1931 | * This IOCTL is used to retrieve the wMaxCommand for the device, | ||
1932 | * defining the message limit for both reading and writing. | ||
1933 | diff --git a/kernel/cpu.c b/kernel/cpu.c | ||
1934 | index deff2e693766..9a1ba77d6a50 100644 | ||
1935 | --- a/kernel/cpu.c | ||
1936 | +++ b/kernel/cpu.c | ||
1937 | @@ -692,10 +692,12 @@ void set_cpu_present(unsigned int cpu, bool present) | ||
1938 | |||
1939 | void set_cpu_online(unsigned int cpu, bool online) | ||
1940 | { | ||
1941 | - if (online) | ||
1942 | + if (online) { | ||
1943 | cpumask_set_cpu(cpu, to_cpumask(cpu_online_bits)); | ||
1944 | - else | ||
1945 | + cpumask_set_cpu(cpu, to_cpumask(cpu_active_bits)); | ||
1946 | + } else { | ||
1947 | cpumask_clear_cpu(cpu, to_cpumask(cpu_online_bits)); | ||
1948 | + } | ||
1949 | } | ||
1950 | |||
1951 | void set_cpu_active(unsigned int cpu, bool active) | ||
1952 | diff --git a/kernel/events/core.c b/kernel/events/core.c | ||
1953 | index fa0b2d4ad83c..0e7fea78f565 100644 | ||
1954 | --- a/kernel/events/core.c | ||
1955 | +++ b/kernel/events/core.c | ||
1956 | @@ -1439,6 +1439,11 @@ group_sched_out(struct perf_event *group_event, | ||
1957 | cpuctx->exclusive = 0; | ||
1958 | } | ||
1959 | |||
1960 | +struct remove_event { | ||
1961 | + struct perf_event *event; | ||
1962 | + bool detach_group; | ||
1963 | +}; | ||
1964 | + | ||
1965 | /* | ||
1966 | * Cross CPU call to remove a performance event | ||
1967 | * | ||
1968 | @@ -1447,12 +1452,15 @@ group_sched_out(struct perf_event *group_event, | ||
1969 | */ | ||
1970 | static int __perf_remove_from_context(void *info) | ||
1971 | { | ||
1972 | - struct perf_event *event = info; | ||
1973 | + struct remove_event *re = info; | ||
1974 | + struct perf_event *event = re->event; | ||
1975 | struct perf_event_context *ctx = event->ctx; | ||
1976 | struct perf_cpu_context *cpuctx = __get_cpu_context(ctx); | ||
1977 | |||
1978 | raw_spin_lock(&ctx->lock); | ||
1979 | event_sched_out(event, cpuctx, ctx); | ||
1980 | + if (re->detach_group) | ||
1981 | + perf_group_detach(event); | ||
1982 | list_del_event(event, ctx); | ||
1983 | if (!ctx->nr_events && cpuctx->task_ctx == ctx) { | ||
1984 | ctx->is_active = 0; | ||
1985 | @@ -1477,10 +1485,14 @@ static int __perf_remove_from_context(void *info) | ||
1986 | * When called from perf_event_exit_task, it's OK because the | ||
1987 | * context has been detached from its task. | ||
1988 | */ | ||
1989 | -static void perf_remove_from_context(struct perf_event *event) | ||
1990 | +static void perf_remove_from_context(struct perf_event *event, bool detach_group) | ||
1991 | { | ||
1992 | struct perf_event_context *ctx = event->ctx; | ||
1993 | struct task_struct *task = ctx->task; | ||
1994 | + struct remove_event re = { | ||
1995 | + .event = event, | ||
1996 | + .detach_group = detach_group, | ||
1997 | + }; | ||
1998 | |||
1999 | lockdep_assert_held(&ctx->mutex); | ||
2000 | |||
2001 | @@ -1489,12 +1501,12 @@ static void perf_remove_from_context(struct perf_event *event) | ||
2002 | * Per cpu events are removed via an smp call and | ||
2003 | * the removal is always successful. | ||
2004 | */ | ||
2005 | - cpu_function_call(event->cpu, __perf_remove_from_context, event); | ||
2006 | + cpu_function_call(event->cpu, __perf_remove_from_context, &re); | ||
2007 | return; | ||
2008 | } | ||
2009 | |||
2010 | retry: | ||
2011 | - if (!task_function_call(task, __perf_remove_from_context, event)) | ||
2012 | + if (!task_function_call(task, __perf_remove_from_context, &re)) | ||
2013 | return; | ||
2014 | |||
2015 | raw_spin_lock_irq(&ctx->lock); | ||
2016 | @@ -1511,6 +1523,8 @@ retry: | ||
2017 | * Since the task isn't running, its safe to remove the event, us | ||
2018 | * holding the ctx->lock ensures the task won't get scheduled in. | ||
2019 | */ | ||
2020 | + if (detach_group) | ||
2021 | + perf_group_detach(event); | ||
2022 | list_del_event(event, ctx); | ||
2023 | raw_spin_unlock_irq(&ctx->lock); | ||
2024 | } | ||
2025 | @@ -3279,10 +3293,7 @@ int perf_event_release_kernel(struct perf_event *event) | ||
2026 | * to trigger the AB-BA case. | ||
2027 | */ | ||
2028 | mutex_lock_nested(&ctx->mutex, SINGLE_DEPTH_NESTING); | ||
2029 | - raw_spin_lock_irq(&ctx->lock); | ||
2030 | - perf_group_detach(event); | ||
2031 | - raw_spin_unlock_irq(&ctx->lock); | ||
2032 | - perf_remove_from_context(event); | ||
2033 | + perf_remove_from_context(event, true); | ||
2034 | mutex_unlock(&ctx->mutex); | ||
2035 | |||
2036 | free_event(event); | ||
2037 | @@ -5406,6 +5417,9 @@ struct swevent_htable { | ||
2038 | |||
2039 | /* Recursion avoidance in each contexts */ | ||
2040 | int recursion[PERF_NR_CONTEXTS]; | ||
2041 | + | ||
2042 | + /* Keeps track of cpu being initialized/exited */ | ||
2043 | + bool online; | ||
2044 | }; | ||
2045 | |||
2046 | static DEFINE_PER_CPU(struct swevent_htable, swevent_htable); | ||
2047 | @@ -5652,8 +5666,14 @@ static int perf_swevent_add(struct perf_event *event, int flags) | ||
2048 | hwc->state = !(flags & PERF_EF_START); | ||
2049 | |||
2050 | head = find_swevent_head(swhash, event); | ||
2051 | - if (WARN_ON_ONCE(!head)) | ||
2052 | + if (!head) { | ||
2053 | + /* | ||
2054 | + * We can race with cpu hotplug code. Do not | ||
2055 | + * WARN if the cpu just got unplugged. | ||
2056 | + */ | ||
2057 | + WARN_ON_ONCE(swhash->online); | ||
2058 | return -EINVAL; | ||
2059 | + } | ||
2060 | |||
2061 | hlist_add_head_rcu(&event->hlist_entry, head); | ||
2062 | |||
2063 | @@ -7016,6 +7036,9 @@ SYSCALL_DEFINE5(perf_event_open, | ||
2064 | if (attr.freq) { | ||
2065 | if (attr.sample_freq > sysctl_perf_event_sample_rate) | ||
2066 | return -EINVAL; | ||
2067 | + } else { | ||
2068 | + if (attr.sample_period & (1ULL << 63)) | ||
2069 | + return -EINVAL; | ||
2070 | } | ||
2071 | |||
2072 | /* | ||
2073 | @@ -7163,7 +7186,7 @@ SYSCALL_DEFINE5(perf_event_open, | ||
2074 | struct perf_event_context *gctx = group_leader->ctx; | ||
2075 | |||
2076 | mutex_lock(&gctx->mutex); | ||
2077 | - perf_remove_from_context(group_leader); | ||
2078 | + perf_remove_from_context(group_leader, false); | ||
2079 | |||
2080 | /* | ||
2081 | * Removing from the context ends up with disabled | ||
2082 | @@ -7173,7 +7196,7 @@ SYSCALL_DEFINE5(perf_event_open, | ||
2083 | perf_event__state_init(group_leader); | ||
2084 | list_for_each_entry(sibling, &group_leader->sibling_list, | ||
2085 | group_entry) { | ||
2086 | - perf_remove_from_context(sibling); | ||
2087 | + perf_remove_from_context(sibling, false); | ||
2088 | perf_event__state_init(sibling); | ||
2089 | put_ctx(gctx); | ||
2090 | } | ||
2091 | @@ -7303,7 +7326,7 @@ void perf_pmu_migrate_context(struct pmu *pmu, int src_cpu, int dst_cpu) | ||
2092 | mutex_lock(&src_ctx->mutex); | ||
2093 | list_for_each_entry_safe(event, tmp, &src_ctx->event_list, | ||
2094 | event_entry) { | ||
2095 | - perf_remove_from_context(event); | ||
2096 | + perf_remove_from_context(event, false); | ||
2097 | unaccount_event_cpu(event, src_cpu); | ||
2098 | put_ctx(src_ctx); | ||
2099 | list_add(&event->migrate_entry, &events); | ||
2100 | @@ -7365,13 +7388,7 @@ __perf_event_exit_task(struct perf_event *child_event, | ||
2101 | struct perf_event_context *child_ctx, | ||
2102 | struct task_struct *child) | ||
2103 | { | ||
2104 | - if (child_event->parent) { | ||
2105 | - raw_spin_lock_irq(&child_ctx->lock); | ||
2106 | - perf_group_detach(child_event); | ||
2107 | - raw_spin_unlock_irq(&child_ctx->lock); | ||
2108 | - } | ||
2109 | - | ||
2110 | - perf_remove_from_context(child_event); | ||
2111 | + perf_remove_from_context(child_event, !!child_event->parent); | ||
2112 | |||
2113 | /* | ||
2114 | * It can happen that the parent exits first, and has events | ||
2115 | @@ -7833,6 +7850,7 @@ static void perf_event_init_cpu(int cpu) | ||
2116 | struct swevent_htable *swhash = &per_cpu(swevent_htable, cpu); | ||
2117 | |||
2118 | mutex_lock(&swhash->hlist_mutex); | ||
2119 | + swhash->online = true; | ||
2120 | if (swhash->hlist_refcount > 0) { | ||
2121 | struct swevent_hlist *hlist; | ||
2122 | |||
2123 | @@ -7855,14 +7873,14 @@ static void perf_pmu_rotate_stop(struct pmu *pmu) | ||
2124 | |||
2125 | static void __perf_event_exit_context(void *__info) | ||
2126 | { | ||
2127 | + struct remove_event re = { .detach_group = false }; | ||
2128 | struct perf_event_context *ctx = __info; | ||
2129 | - struct perf_event *event; | ||
2130 | |||
2131 | perf_pmu_rotate_stop(ctx->pmu); | ||
2132 | |||
2133 | rcu_read_lock(); | ||
2134 | - list_for_each_entry_rcu(event, &ctx->event_list, event_entry) | ||
2135 | - __perf_remove_from_context(event); | ||
2136 | + list_for_each_entry_rcu(re.event, &ctx->event_list, event_entry) | ||
2137 | + __perf_remove_from_context(&re); | ||
2138 | rcu_read_unlock(); | ||
2139 | } | ||
2140 | |||
2141 | @@ -7890,6 +7908,7 @@ static void perf_event_exit_cpu(int cpu) | ||
2142 | perf_event_exit_cpu_context(cpu); | ||
2143 | |||
2144 | mutex_lock(&swhash->hlist_mutex); | ||
2145 | + swhash->online = false; | ||
2146 | swevent_hlist_release(swhash); | ||
2147 | mutex_unlock(&swhash->hlist_mutex); | ||
2148 | } | ||
2149 | diff --git a/kernel/sched/core.c b/kernel/sched/core.c | ||
2150 | index f5c6635b806c..0aae0fcec026 100644 | ||
2151 | --- a/kernel/sched/core.c | ||
2152 | +++ b/kernel/sched/core.c | ||
2153 | @@ -3242,17 +3242,40 @@ __getparam_dl(struct task_struct *p, struct sched_attr *attr) | ||
2154 | * We ask for the deadline not being zero, and greater or equal | ||
2155 | * than the runtime, as well as the period of being zero or | ||
2156 | * greater than deadline. Furthermore, we have to be sure that | ||
2157 | - * user parameters are above the internal resolution (1us); we | ||
2158 | - * check sched_runtime only since it is always the smaller one. | ||
2159 | + * user parameters are above the internal resolution of 1us (we | ||
2160 | + * check sched_runtime only since it is always the smaller one) and | ||
2161 | + * below 2^63 ns (we have to check both sched_deadline and | ||
2162 | + * sched_period, as the latter can be zero). | ||
2163 | */ | ||
2164 | static bool | ||
2165 | __checkparam_dl(const struct sched_attr *attr) | ||
2166 | { | ||
2167 | - return attr && attr->sched_deadline != 0 && | ||
2168 | - (attr->sched_period == 0 || | ||
2169 | - (s64)(attr->sched_period - attr->sched_deadline) >= 0) && | ||
2170 | - (s64)(attr->sched_deadline - attr->sched_runtime ) >= 0 && | ||
2171 | - attr->sched_runtime >= (2 << (DL_SCALE - 1)); | ||
2172 | + /* deadline != 0 */ | ||
2173 | + if (attr->sched_deadline == 0) | ||
2174 | + return false; | ||
2175 | + | ||
2176 | + /* | ||
2177 | + * Since we truncate DL_SCALE bits, make sure we're at least | ||
2178 | + * that big. | ||
2179 | + */ | ||
2180 | + if (attr->sched_runtime < (1ULL << DL_SCALE)) | ||
2181 | + return false; | ||
2182 | + | ||
2183 | + /* | ||
2184 | + * Since we use the MSB for wrap-around and sign issues, make | ||
2185 | + * sure it's not set (mind that period can be equal to zero). | ||
2186 | + */ | ||
2187 | + if (attr->sched_deadline & (1ULL << 63) || | ||
2188 | + attr->sched_period & (1ULL << 63)) | ||
2189 | + return false; | ||
2190 | + | ||
2191 | + /* runtime <= deadline <= period (if period != 0) */ | ||
2192 | + if ((attr->sched_period != 0 && | ||
2193 | + attr->sched_period < attr->sched_deadline) || | ||
2194 | + attr->sched_deadline < attr->sched_runtime) | ||
2195 | + return false; | ||
2196 | + | ||
2197 | + return true; | ||
2198 | } | ||
2199 | |||
2200 | /* | ||
2201 | @@ -3680,8 +3703,12 @@ SYSCALL_DEFINE3(sched_setattr, pid_t, pid, struct sched_attr __user *, uattr, | ||
2202 | if (!uattr || pid < 0 || flags) | ||
2203 | return -EINVAL; | ||
2204 | |||
2205 | - if (sched_copy_attr(uattr, &attr)) | ||
2206 | - return -EFAULT; | ||
2207 | + retval = sched_copy_attr(uattr, &attr); | ||
2208 | + if (retval) | ||
2209 | + return retval; | ||
2210 | + | ||
2211 | + if ((int)attr.sched_policy < 0) | ||
2212 | + return -EINVAL; | ||
2213 | |||
2214 | rcu_read_lock(); | ||
2215 | retval = -ESRCH; | ||
2216 | @@ -3731,7 +3758,7 @@ SYSCALL_DEFINE1(sched_getscheduler, pid_t, pid) | ||
2217 | */ | ||
2218 | SYSCALL_DEFINE2(sched_getparam, pid_t, pid, struct sched_param __user *, param) | ||
2219 | { | ||
2220 | - struct sched_param lp; | ||
2221 | + struct sched_param lp = { .sched_priority = 0 }; | ||
2222 | struct task_struct *p; | ||
2223 | int retval; | ||
2224 | |||
2225 | @@ -3748,11 +3775,8 @@ SYSCALL_DEFINE2(sched_getparam, pid_t, pid, struct sched_param __user *, param) | ||
2226 | if (retval) | ||
2227 | goto out_unlock; | ||
2228 | |||
2229 | - if (task_has_dl_policy(p)) { | ||
2230 | - retval = -EINVAL; | ||
2231 | - goto out_unlock; | ||
2232 | - } | ||
2233 | - lp.sched_priority = p->rt_priority; | ||
2234 | + if (task_has_rt_policy(p)) | ||
2235 | + lp.sched_priority = p->rt_priority; | ||
2236 | rcu_read_unlock(); | ||
2237 | |||
2238 | /* | ||
2239 | @@ -5051,7 +5075,6 @@ static int sched_cpu_active(struct notifier_block *nfb, | ||
2240 | unsigned long action, void *hcpu) | ||
2241 | { | ||
2242 | switch (action & ~CPU_TASKS_FROZEN) { | ||
2243 | - case CPU_STARTING: | ||
2244 | case CPU_DOWN_FAILED: | ||
2245 | set_cpu_active((long)hcpu, true); | ||
2246 | return NOTIFY_OK; | ||
2247 | diff --git a/kernel/sched/cpudeadline.c b/kernel/sched/cpudeadline.c | ||
2248 | index 5b9bb42b2d47..ab001b5d5048 100644 | ||
2249 | --- a/kernel/sched/cpudeadline.c | ||
2250 | +++ b/kernel/sched/cpudeadline.c | ||
2251 | @@ -210,7 +210,5 @@ int cpudl_init(struct cpudl *cp) | ||
2252 | */ | ||
2253 | void cpudl_cleanup(struct cpudl *cp) | ||
2254 | { | ||
2255 | - /* | ||
2256 | - * nothing to do for the moment | ||
2257 | - */ | ||
2258 | + free_cpumask_var(cp->free_cpus); | ||
2259 | } | ||
2260 | diff --git a/kernel/sched/cpupri.c b/kernel/sched/cpupri.c | ||
2261 | index 8b836b376d91..3031bac8aa3e 100644 | ||
2262 | --- a/kernel/sched/cpupri.c | ||
2263 | +++ b/kernel/sched/cpupri.c | ||
2264 | @@ -70,8 +70,7 @@ int cpupri_find(struct cpupri *cp, struct task_struct *p, | ||
2265 | int idx = 0; | ||
2266 | int task_pri = convert_prio(p->prio); | ||
2267 | |||
2268 | - if (task_pri >= MAX_RT_PRIO) | ||
2269 | - return 0; | ||
2270 | + BUG_ON(task_pri >= CPUPRI_NR_PRIORITIES); | ||
2271 | |||
2272 | for (idx = 0; idx < task_pri; idx++) { | ||
2273 | struct cpupri_vec *vec = &cp->pri_to_cpu[idx]; | ||
2274 | diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c | ||
2275 | index 99947919e30b..cfe2f268afaa 100644 | ||
2276 | --- a/kernel/sched/cputime.c | ||
2277 | +++ b/kernel/sched/cputime.c | ||
2278 | @@ -326,50 +326,50 @@ out: | ||
2279 | * softirq as those do not count in task exec_runtime any more. | ||
2280 | */ | ||
2281 | static void irqtime_account_process_tick(struct task_struct *p, int user_tick, | ||
2282 | - struct rq *rq) | ||
2283 | + struct rq *rq, int ticks) | ||
2284 | { | ||
2285 | - cputime_t one_jiffy_scaled = cputime_to_scaled(cputime_one_jiffy); | ||
2286 | + cputime_t scaled = cputime_to_scaled(cputime_one_jiffy); | ||
2287 | + u64 cputime = (__force u64) cputime_one_jiffy; | ||
2288 | u64 *cpustat = kcpustat_this_cpu->cpustat; | ||
2289 | |||
2290 | if (steal_account_process_tick()) | ||
2291 | return; | ||
2292 | |||
2293 | + cputime *= ticks; | ||
2294 | + scaled *= ticks; | ||
2295 | + | ||
2296 | if (irqtime_account_hi_update()) { | ||
2297 | - cpustat[CPUTIME_IRQ] += (__force u64) cputime_one_jiffy; | ||
2298 | + cpustat[CPUTIME_IRQ] += cputime; | ||
2299 | } else if (irqtime_account_si_update()) { | ||
2300 | - cpustat[CPUTIME_SOFTIRQ] += (__force u64) cputime_one_jiffy; | ||
2301 | + cpustat[CPUTIME_SOFTIRQ] += cputime; | ||
2302 | } else if (this_cpu_ksoftirqd() == p) { | ||
2303 | /* | ||
2304 | * ksoftirqd time do not get accounted in cpu_softirq_time. | ||
2305 | * So, we have to handle it separately here. | ||
2306 | * Also, p->stime needs to be updated for ksoftirqd. | ||
2307 | */ | ||
2308 | - __account_system_time(p, cputime_one_jiffy, one_jiffy_scaled, | ||
2309 | - CPUTIME_SOFTIRQ); | ||
2310 | + __account_system_time(p, cputime, scaled, CPUTIME_SOFTIRQ); | ||
2311 | } else if (user_tick) { | ||
2312 | - account_user_time(p, cputime_one_jiffy, one_jiffy_scaled); | ||
2313 | + account_user_time(p, cputime, scaled); | ||
2314 | } else if (p == rq->idle) { | ||
2315 | - account_idle_time(cputime_one_jiffy); | ||
2316 | + account_idle_time(cputime); | ||
2317 | } else if (p->flags & PF_VCPU) { /* System time or guest time */ | ||
2318 | - account_guest_time(p, cputime_one_jiffy, one_jiffy_scaled); | ||
2319 | + account_guest_time(p, cputime, scaled); | ||
2320 | } else { | ||
2321 | - __account_system_time(p, cputime_one_jiffy, one_jiffy_scaled, | ||
2322 | - CPUTIME_SYSTEM); | ||
2323 | + __account_system_time(p, cputime, scaled, CPUTIME_SYSTEM); | ||
2324 | } | ||
2325 | } | ||
2326 | |||
2327 | static void irqtime_account_idle_ticks(int ticks) | ||
2328 | { | ||
2329 | - int i; | ||
2330 | struct rq *rq = this_rq(); | ||
2331 | |||
2332 | - for (i = 0; i < ticks; i++) | ||
2333 | - irqtime_account_process_tick(current, 0, rq); | ||
2334 | + irqtime_account_process_tick(current, 0, rq, ticks); | ||
2335 | } | ||
2336 | #else /* CONFIG_IRQ_TIME_ACCOUNTING */ | ||
2337 | static inline void irqtime_account_idle_ticks(int ticks) {} | ||
2338 | static inline void irqtime_account_process_tick(struct task_struct *p, int user_tick, | ||
2339 | - struct rq *rq) {} | ||
2340 | + struct rq *rq, int nr_ticks) {} | ||
2341 | #endif /* CONFIG_IRQ_TIME_ACCOUNTING */ | ||
2342 | |||
2343 | /* | ||
2344 | @@ -458,7 +458,7 @@ void account_process_tick(struct task_struct *p, int user_tick) | ||
2345 | return; | ||
2346 | |||
2347 | if (sched_clock_irqtime) { | ||
2348 | - irqtime_account_process_tick(p, user_tick, rq); | ||
2349 | + irqtime_account_process_tick(p, user_tick, rq, 1); | ||
2350 | return; | ||
2351 | } | ||
2352 | |||
2353 | diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c | ||
2354 | index 6e79b3faa4cd..ce852643854b 100644 | ||
2355 | --- a/kernel/sched/deadline.c | ||
2356 | +++ b/kernel/sched/deadline.c | ||
2357 | @@ -490,9 +490,17 @@ static enum hrtimer_restart dl_task_timer(struct hrtimer *timer) | ||
2358 | struct sched_dl_entity, | ||
2359 | dl_timer); | ||
2360 | struct task_struct *p = dl_task_of(dl_se); | ||
2361 | - struct rq *rq = task_rq(p); | ||
2362 | + struct rq *rq; | ||
2363 | +again: | ||
2364 | + rq = task_rq(p); | ||
2365 | raw_spin_lock(&rq->lock); | ||
2366 | |||
2367 | + if (rq != task_rq(p)) { | ||
2368 | + /* Task was moved, retrying. */ | ||
2369 | + raw_spin_unlock(&rq->lock); | ||
2370 | + goto again; | ||
2371 | + } | ||
2372 | + | ||
2373 | /* | ||
2374 | * We need to take care of a possible races here. In fact, the | ||
2375 | * task might have changed its scheduling policy to something | ||
2376 | diff --git a/mm/memory-failure.c b/mm/memory-failure.c | ||
2377 | index 66586bb44c62..e346fa9d30ea 100644 | ||
2378 | --- a/mm/memory-failure.c | ||
2379 | +++ b/mm/memory-failure.c | ||
2380 | @@ -1157,6 +1157,8 @@ int memory_failure(unsigned long pfn, int trapno, int flags) | ||
2381 | */ | ||
2382 | if (!PageHWPoison(p)) { | ||
2383 | printk(KERN_ERR "MCE %#lx: just unpoisoned\n", pfn); | ||
2384 | + atomic_long_sub(nr_pages, &num_poisoned_pages); | ||
2385 | + put_page(hpage); | ||
2386 | res = 0; | ||
2387 | goto out; | ||
2388 | } | ||
2389 | diff --git a/mm/mempolicy.c b/mm/mempolicy.c | ||
2390 | index ae3c8f3595d4..56224d998c39 100644 | ||
2391 | --- a/mm/mempolicy.c | ||
2392 | +++ b/mm/mempolicy.c | ||
2393 | @@ -526,9 +526,13 @@ static void queue_pages_hugetlb_pmd_range(struct vm_area_struct *vma, | ||
2394 | int nid; | ||
2395 | struct page *page; | ||
2396 | spinlock_t *ptl; | ||
2397 | + pte_t entry; | ||
2398 | |||
2399 | ptl = huge_pte_lock(hstate_vma(vma), vma->vm_mm, (pte_t *)pmd); | ||
2400 | - page = pte_page(huge_ptep_get((pte_t *)pmd)); | ||
2401 | + entry = huge_ptep_get((pte_t *)pmd); | ||
2402 | + if (!pte_present(entry)) | ||
2403 | + goto unlock; | ||
2404 | + page = pte_page(entry); | ||
2405 | nid = page_to_nid(page); | ||
2406 | if (node_isset(nid, *nodes) == !!(flags & MPOL_MF_INVERT)) | ||
2407 | goto unlock; | ||
2408 | diff --git a/mm/rmap.c b/mm/rmap.c | ||
2409 | index d3cbac508c2f..5d91bb71e751 100644 | ||
2410 | --- a/mm/rmap.c | ||
2411 | +++ b/mm/rmap.c | ||
2412 | @@ -1554,10 +1554,9 @@ void __put_anon_vma(struct anon_vma *anon_vma) | ||
2413 | { | ||
2414 | struct anon_vma *root = anon_vma->root; | ||
2415 | |||
2416 | + anon_vma_free(anon_vma); | ||
2417 | if (root != anon_vma && atomic_dec_and_test(&root->refcount)) | ||
2418 | anon_vma_free(root); | ||
2419 | - | ||
2420 | - anon_vma_free(anon_vma); | ||
2421 | } | ||
2422 | |||
2423 | static struct anon_vma *rmap_walk_anon_lock(struct page *page, | ||
2424 | diff --git a/mm/vmscan.c b/mm/vmscan.c | ||
2425 | index 30a4b096ff6e..a9c74b409681 100644 | ||
2426 | --- a/mm/vmscan.c | ||
2427 | +++ b/mm/vmscan.c | ||
2428 | @@ -1916,24 +1916,6 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc, | ||
2429 | } | ||
2430 | |||
2431 | /* | ||
2432 | - * Prevent the reclaimer from falling into the cache trap: as | ||
2433 | - * cache pages start out inactive, every cache fault will tip | ||
2434 | - * the scan balance towards the file LRU. And as the file LRU | ||
2435 | - * shrinks, so does the window for rotation from references. | ||
2436 | - * This means we have a runaway feedback loop where a tiny | ||
2437 | - * thrashing file LRU becomes infinitely more attractive than | ||
2438 | - * anon pages. Try to detect this based on file LRU size. | ||
2439 | - */ | ||
2440 | - if (global_reclaim(sc)) { | ||
2441 | - unsigned long free = zone_page_state(zone, NR_FREE_PAGES); | ||
2442 | - | ||
2443 | - if (unlikely(file + free <= high_wmark_pages(zone))) { | ||
2444 | - scan_balance = SCAN_ANON; | ||
2445 | - goto out; | ||
2446 | - } | ||
2447 | - } | ||
2448 | - | ||
2449 | - /* | ||
2450 | * There is enough inactive page cache, do not reclaim | ||
2451 | * anything from the anonymous working set right now. | ||
2452 | */ | ||
2453 | diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c | ||
2454 | index b0ad2c752d73..6afa3b45f25a 100644 | ||
2455 | --- a/net/bluetooth/l2cap_core.c | ||
2456 | +++ b/net/bluetooth/l2cap_core.c | ||
2457 | @@ -7471,9 +7471,9 @@ int __init l2cap_init(void) | ||
2458 | l2cap_debugfs = debugfs_create_file("l2cap", 0444, bt_debugfs, | ||
2459 | NULL, &l2cap_debugfs_fops); | ||
2460 | |||
2461 | - debugfs_create_u16("l2cap_le_max_credits", 0466, bt_debugfs, | ||
2462 | + debugfs_create_u16("l2cap_le_max_credits", 0644, bt_debugfs, | ||
2463 | &le_max_credits); | ||
2464 | - debugfs_create_u16("l2cap_le_default_mps", 0466, bt_debugfs, | ||
2465 | + debugfs_create_u16("l2cap_le_default_mps", 0644, bt_debugfs, | ||
2466 | &le_default_mps); | ||
2467 | |||
2468 | bt_6lowpan_init(); | ||
2469 | diff --git a/net/ipv6/netfilter.c b/net/ipv6/netfilter.c | ||
2470 | index 95f3f1da0d7f..d38e6a8d8b9f 100644 | ||
2471 | --- a/net/ipv6/netfilter.c | ||
2472 | +++ b/net/ipv6/netfilter.c | ||
2473 | @@ -30,13 +30,15 @@ int ip6_route_me_harder(struct sk_buff *skb) | ||
2474 | .daddr = iph->daddr, | ||
2475 | .saddr = iph->saddr, | ||
2476 | }; | ||
2477 | + int err; | ||
2478 | |||
2479 | dst = ip6_route_output(net, skb->sk, &fl6); | ||
2480 | - if (dst->error) { | ||
2481 | + err = dst->error; | ||
2482 | + if (err) { | ||
2483 | IP6_INC_STATS(net, ip6_dst_idev(dst), IPSTATS_MIB_OUTNOROUTES); | ||
2484 | LIMIT_NETDEBUG(KERN_DEBUG "ip6_route_me_harder: No more route.\n"); | ||
2485 | dst_release(dst); | ||
2486 | - return dst->error; | ||
2487 | + return err; | ||
2488 | } | ||
2489 | |||
2490 | /* Drop old route. */ | ||
2491 | diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c | ||
2492 | index 046aa13b4fea..880418d3ee50 100644 | ||
2493 | --- a/net/netfilter/nfnetlink.c | ||
2494 | +++ b/net/netfilter/nfnetlink.c | ||
2495 | @@ -248,15 +248,15 @@ replay: | ||
2496 | #endif | ||
2497 | { | ||
2498 | nfnl_unlock(subsys_id); | ||
2499 | - kfree_skb(nskb); | ||
2500 | - return netlink_ack(skb, nlh, -EOPNOTSUPP); | ||
2501 | + netlink_ack(skb, nlh, -EOPNOTSUPP); | ||
2502 | + return kfree_skb(nskb); | ||
2503 | } | ||
2504 | } | ||
2505 | |||
2506 | if (!ss->commit || !ss->abort) { | ||
2507 | nfnl_unlock(subsys_id); | ||
2508 | - kfree_skb(nskb); | ||
2509 | - return netlink_ack(skb, nlh, -EOPNOTSUPP); | ||
2510 | + netlink_ack(skb, nlh, -EOPNOTSUPP); | ||
2511 | + return kfree_skb(skb); | ||
2512 | } | ||
2513 | |||
2514 | while (skb->len >= nlmsg_total_size(0)) { | ||
2515 | diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c | ||
2516 | index 8ed0bcc01386..eaf64ea2e1c1 100644 | ||
2517 | --- a/sound/pci/hda/patch_analog.c | ||
2518 | +++ b/sound/pci/hda/patch_analog.c | ||
2519 | @@ -333,6 +333,7 @@ static const struct hda_fixup ad1986a_fixups[] = { | ||
2520 | |||
2521 | static const struct snd_pci_quirk ad1986a_fixup_tbl[] = { | ||
2522 | SND_PCI_QUIRK(0x103c, 0x30af, "HP B2800", AD1986A_FIXUP_LAPTOP_IMIC), | ||
2523 | + SND_PCI_QUIRK(0x1043, 0x1447, "ASUS A8JN", AD1986A_FIXUP_EAPD), | ||
2524 | SND_PCI_QUIRK_MASK(0x1043, 0xff00, 0x8100, "ASUS P5", AD1986A_FIXUP_3STACK), | ||
2525 | SND_PCI_QUIRK_MASK(0x1043, 0xff00, 0x8200, "ASUS M2", AD1986A_FIXUP_3STACK), | ||
2526 | SND_PCI_QUIRK(0x10de, 0xcb84, "ASUS A8N-VM", AD1986A_FIXUP_3STACK), | ||
2527 | diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c | ||
2528 | index 41106813a9aa..0b6ee2b37bdb 100644 | ||
2529 | --- a/sound/pci/hda/patch_realtek.c | ||
2530 | +++ b/sound/pci/hda/patch_realtek.c | ||
2531 | @@ -1646,12 +1646,10 @@ static const struct hda_fixup alc260_fixups[] = { | ||
2532 | [ALC260_FIXUP_COEF] = { | ||
2533 | .type = HDA_FIXUP_VERBS, | ||
2534 | .v.verbs = (const struct hda_verb[]) { | ||
2535 | - { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, | ||
2536 | - { 0x20, AC_VERB_SET_PROC_COEF, 0x3040 }, | ||
2537 | + { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 }, | ||
2538 | + { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 }, | ||
2539 | { } | ||
2540 | }, | ||
2541 | - .chained = true, | ||
2542 | - .chain_id = ALC260_FIXUP_HP_PIN_0F, | ||
2543 | }, | ||
2544 | [ALC260_FIXUP_GPIO1] = { | ||
2545 | .type = HDA_FIXUP_VERBS, | ||
2546 | @@ -1666,8 +1664,8 @@ static const struct hda_fixup alc260_fixups[] = { | ||
2547 | [ALC260_FIXUP_REPLACER] = { | ||
2548 | .type = HDA_FIXUP_VERBS, | ||
2549 | .v.verbs = (const struct hda_verb[]) { | ||
2550 | - { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, | ||
2551 | - { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 }, | ||
2552 | + { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 }, | ||
2553 | + { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 }, | ||
2554 | { } | ||
2555 | }, | ||
2556 | .chained = true, |