Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.9 commit in: /
Date: Sun, 26 May 2019 17:12:45
Message-Id: 1558890746.964ba9de5a60daf668c15d305d02588e43f4a788.mpagano@gentoo
1 commit: 964ba9de5a60daf668c15d305d02588e43f4a788
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Sun May 26 17:12:26 2019 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Sun May 26 17:12:26 2019 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=964ba9de
7
8 Linux patch 4.9.179
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1178_linux-4.9.179.patch | 1654 ++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 1658 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index 5c096b9..1ff80f1 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -755,6 +755,10 @@ Patch: 1177_linux-4.9.178.patch
21 From: http://www.kernel.org
22 Desc: Linux 4.9.178
23
24 +Patch: 1178_linux-4.9.179.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 4.9.179
27 +
28 Patch: 1500_XATTR_USER_PREFIX.patch
29 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
30 Desc: Support for namespace user.pax.* on tmpfs.
31
32 diff --git a/1178_linux-4.9.179.patch b/1178_linux-4.9.179.patch
33 new file mode 100644
34 index 0000000..49807d6
35 --- /dev/null
36 +++ b/1178_linux-4.9.179.patch
37 @@ -0,0 +1,1654 @@
38 +diff --git a/Makefile b/Makefile
39 +index e9fae7a3c621..d60795319d8a 100644
40 +--- a/Makefile
41 ++++ b/Makefile
42 +@@ -1,6 +1,6 @@
43 + VERSION = 4
44 + PATCHLEVEL = 9
45 +-SUBLEVEL = 178
46 ++SUBLEVEL = 179
47 + EXTRAVERSION =
48 + NAME = Roaring Lionus
49 +
50 +diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c
51 +index a670c70f4def..dfc00a5bdc10 100644
52 +--- a/arch/arm/kvm/arm.c
53 ++++ b/arch/arm/kvm/arm.c
54 +@@ -801,7 +801,7 @@ int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_level,
55 + static int kvm_vcpu_set_target(struct kvm_vcpu *vcpu,
56 + const struct kvm_vcpu_init *init)
57 + {
58 +- unsigned int i;
59 ++ unsigned int i, ret;
60 + int phys_target = kvm_target_cpu();
61 +
62 + if (init->target != phys_target)
63 +@@ -836,9 +836,14 @@ static int kvm_vcpu_set_target(struct kvm_vcpu *vcpu,
64 + vcpu->arch.target = phys_target;
65 +
66 + /* Now we know what it is, we can reset it. */
67 +- return kvm_reset_vcpu(vcpu);
68 +-}
69 ++ ret = kvm_reset_vcpu(vcpu);
70 ++ if (ret) {
71 ++ vcpu->arch.target = -1;
72 ++ bitmap_zero(vcpu->arch.features, KVM_VCPU_MAX_FEATURES);
73 ++ }
74 +
75 ++ return ret;
76 ++}
77 +
78 + static int kvm_arch_vcpu_ioctl_vcpu_init(struct kvm_vcpu *vcpu,
79 + struct kvm_vcpu_init *init)
80 +diff --git a/arch/parisc/include/asm/assembly.h b/arch/parisc/include/asm/assembly.h
81 +index 60e6f07b7e32..eb83d65153b8 100644
82 +--- a/arch/parisc/include/asm/assembly.h
83 ++++ b/arch/parisc/include/asm/assembly.h
84 +@@ -59,14 +59,14 @@
85 + #define LDCW ldcw,co
86 + #define BL b,l
87 + # ifdef CONFIG_64BIT
88 +-# define LEVEL 2.0w
89 ++# define PA_ASM_LEVEL 2.0w
90 + # else
91 +-# define LEVEL 2.0
92 ++# define PA_ASM_LEVEL 2.0
93 + # endif
94 + #else
95 + #define LDCW ldcw
96 + #define BL bl
97 +-#define LEVEL 1.1
98 ++#define PA_ASM_LEVEL 1.1
99 + #endif
100 +
101 + #ifdef __ASSEMBLY__
102 +diff --git a/arch/parisc/kernel/head.S b/arch/parisc/kernel/head.S
103 +index bbbe360b458f..9b99eb0712ad 100644
104 +--- a/arch/parisc/kernel/head.S
105 ++++ b/arch/parisc/kernel/head.S
106 +@@ -22,7 +22,7 @@
107 + #include <linux/linkage.h>
108 + #include <linux/init.h>
109 +
110 +- .level LEVEL
111 ++ .level PA_ASM_LEVEL
112 +
113 + __INITDATA
114 + ENTRY(boot_args)
115 +@@ -254,7 +254,7 @@ stext_pdc_ret:
116 + ldo R%PA(fault_vector_11)(%r10),%r10
117 +
118 + $is_pa20:
119 +- .level LEVEL /* restore 1.1 || 2.0w */
120 ++ .level PA_ASM_LEVEL /* restore 1.1 || 2.0w */
121 + #endif /*!CONFIG_64BIT*/
122 + load32 PA(fault_vector_20),%r10
123 +
124 +diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c
125 +index 2e5216c28bb1..b4e3edad53ab 100644
126 +--- a/arch/parisc/kernel/process.c
127 ++++ b/arch/parisc/kernel/process.c
128 +@@ -189,6 +189,7 @@ int dump_task_fpu (struct task_struct *tsk, elf_fpregset_t *r)
129 + */
130 +
131 + int running_on_qemu __read_mostly;
132 ++EXPORT_SYMBOL(running_on_qemu);
133 +
134 + void __cpuidle arch_cpu_idle_dead(void)
135 + {
136 +diff --git a/arch/parisc/kernel/syscall.S b/arch/parisc/kernel/syscall.S
137 +index 5f7e57fcaeef..0cf379acb5ed 100644
138 +--- a/arch/parisc/kernel/syscall.S
139 ++++ b/arch/parisc/kernel/syscall.S
140 +@@ -48,7 +48,7 @@ registers).
141 + */
142 + #define KILL_INSN break 0,0
143 +
144 +- .level LEVEL
145 ++ .level PA_ASM_LEVEL
146 +
147 + .text
148 +
149 +diff --git a/drivers/clk/tegra/clk-pll.c b/drivers/clk/tegra/clk-pll.c
150 +index 66d1fc7dff58..1ab36a355daf 100644
151 +--- a/drivers/clk/tegra/clk-pll.c
152 ++++ b/drivers/clk/tegra/clk-pll.c
153 +@@ -638,8 +638,8 @@ static void _update_pll_mnp(struct tegra_clk_pll *pll,
154 + pll_override_writel(val, params->pmc_divp_reg, pll);
155 +
156 + val = pll_override_readl(params->pmc_divnm_reg, pll);
157 +- val &= ~(divm_mask(pll) << div_nmp->override_divm_shift) |
158 +- ~(divn_mask(pll) << div_nmp->override_divn_shift);
159 ++ val &= ~((divm_mask(pll) << div_nmp->override_divm_shift) |
160 ++ (divn_mask(pll) << div_nmp->override_divn_shift));
161 + val |= (cfg->m << div_nmp->override_divm_shift) |
162 + (cfg->n << div_nmp->override_divn_shift);
163 + pll_override_writel(val, params->pmc_divnm_reg, pll);
164 +diff --git a/drivers/hwtracing/intel_th/msu.c b/drivers/hwtracing/intel_th/msu.c
165 +index f91d9faf14ea..aadae9dc2aad 100644
166 +--- a/drivers/hwtracing/intel_th/msu.c
167 ++++ b/drivers/hwtracing/intel_th/msu.c
168 +@@ -90,6 +90,7 @@ struct msc_iter {
169 + * @reg_base: register window base address
170 + * @thdev: intel_th_device pointer
171 + * @win_list: list of windows in multiblock mode
172 ++ * @single_sgt: single mode buffer
173 + * @nr_pages: total number of pages allocated for this buffer
174 + * @single_sz: amount of data in single mode
175 + * @single_wrap: single mode wrap occurred
176 +@@ -110,6 +111,7 @@ struct msc {
177 + struct intel_th_device *thdev;
178 +
179 + struct list_head win_list;
180 ++ struct sg_table single_sgt;
181 + unsigned long nr_pages;
182 + unsigned long single_sz;
183 + unsigned int single_wrap : 1;
184 +@@ -623,22 +625,45 @@ static void intel_th_msc_deactivate(struct intel_th_device *thdev)
185 + */
186 + static int msc_buffer_contig_alloc(struct msc *msc, unsigned long size)
187 + {
188 ++ unsigned long nr_pages = size >> PAGE_SHIFT;
189 + unsigned int order = get_order(size);
190 + struct page *page;
191 ++ int ret;
192 +
193 + if (!size)
194 + return 0;
195 +
196 ++ ret = sg_alloc_table(&msc->single_sgt, 1, GFP_KERNEL);
197 ++ if (ret)
198 ++ goto err_out;
199 ++
200 ++ ret = -ENOMEM;
201 + page = alloc_pages(GFP_KERNEL | __GFP_ZERO, order);
202 + if (!page)
203 +- return -ENOMEM;
204 ++ goto err_free_sgt;
205 +
206 + split_page(page, order);
207 +- msc->nr_pages = size >> PAGE_SHIFT;
208 ++ sg_set_buf(msc->single_sgt.sgl, page_address(page), size);
209 ++
210 ++ ret = dma_map_sg(msc_dev(msc)->parent->parent, msc->single_sgt.sgl, 1,
211 ++ DMA_FROM_DEVICE);
212 ++ if (ret < 0)
213 ++ goto err_free_pages;
214 ++
215 ++ msc->nr_pages = nr_pages;
216 + msc->base = page_address(page);
217 +- msc->base_addr = page_to_phys(page);
218 ++ msc->base_addr = sg_dma_address(msc->single_sgt.sgl);
219 +
220 + return 0;
221 ++
222 ++err_free_pages:
223 ++ __free_pages(page, order);
224 ++
225 ++err_free_sgt:
226 ++ sg_free_table(&msc->single_sgt);
227 ++
228 ++err_out:
229 ++ return ret;
230 + }
231 +
232 + /**
233 +@@ -649,6 +674,10 @@ static void msc_buffer_contig_free(struct msc *msc)
234 + {
235 + unsigned long off;
236 +
237 ++ dma_unmap_sg(msc_dev(msc)->parent->parent, msc->single_sgt.sgl,
238 ++ 1, DMA_FROM_DEVICE);
239 ++ sg_free_table(&msc->single_sgt);
240 ++
241 + for (off = 0; off < msc->nr_pages << PAGE_SHIFT; off += PAGE_SIZE) {
242 + struct page *page = virt_to_page(msc->base + off);
243 +
244 +diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c
245 +index 3c45c1c15f7e..fd0ebec03ae7 100644
246 +--- a/drivers/hwtracing/stm/core.c
247 ++++ b/drivers/hwtracing/stm/core.c
248 +@@ -226,8 +226,8 @@ stm_output_disclaim(struct stm_device *stm, struct stm_output *output)
249 + bitmap_release_region(&master->chan_map[0], output->channel,
250 + ilog2(output->nr_chans));
251 +
252 +- output->nr_chans = 0;
253 + master->nr_free += output->nr_chans;
254 ++ output->nr_chans = 0;
255 + }
256 +
257 + /*
258 +diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c
259 +index 9305964250ac..c4eb293b1524 100644
260 +--- a/drivers/iommu/tegra-smmu.c
261 ++++ b/drivers/iommu/tegra-smmu.c
262 +@@ -91,7 +91,6 @@ static inline u32 smmu_readl(struct tegra_smmu *smmu, unsigned long offset)
263 + #define SMMU_TLB_FLUSH_VA_MATCH_ALL (0 << 0)
264 + #define SMMU_TLB_FLUSH_VA_MATCH_SECTION (2 << 0)
265 + #define SMMU_TLB_FLUSH_VA_MATCH_GROUP (3 << 0)
266 +-#define SMMU_TLB_FLUSH_ASID(x) (((x) & 0x7f) << 24)
267 + #define SMMU_TLB_FLUSH_VA_SECTION(addr) ((((addr) & 0xffc00000) >> 12) | \
268 + SMMU_TLB_FLUSH_VA_MATCH_SECTION)
269 + #define SMMU_TLB_FLUSH_VA_GROUP(addr) ((((addr) & 0xffffc000) >> 12) | \
270 +@@ -194,8 +193,12 @@ static inline void smmu_flush_tlb_asid(struct tegra_smmu *smmu,
271 + {
272 + u32 value;
273 +
274 +- value = SMMU_TLB_FLUSH_ASID_MATCH | SMMU_TLB_FLUSH_ASID(asid) |
275 +- SMMU_TLB_FLUSH_VA_MATCH_ALL;
276 ++ if (smmu->soc->num_asids == 4)
277 ++ value = (asid & 0x3) << 29;
278 ++ else
279 ++ value = (asid & 0x7f) << 24;
280 ++
281 ++ value |= SMMU_TLB_FLUSH_ASID_MATCH | SMMU_TLB_FLUSH_VA_MATCH_ALL;
282 + smmu_writel(smmu, value, SMMU_TLB_FLUSH);
283 + }
284 +
285 +@@ -205,8 +208,12 @@ static inline void smmu_flush_tlb_section(struct tegra_smmu *smmu,
286 + {
287 + u32 value;
288 +
289 +- value = SMMU_TLB_FLUSH_ASID_MATCH | SMMU_TLB_FLUSH_ASID(asid) |
290 +- SMMU_TLB_FLUSH_VA_SECTION(iova);
291 ++ if (smmu->soc->num_asids == 4)
292 ++ value = (asid & 0x3) << 29;
293 ++ else
294 ++ value = (asid & 0x7f) << 24;
295 ++
296 ++ value |= SMMU_TLB_FLUSH_ASID_MATCH | SMMU_TLB_FLUSH_VA_SECTION(iova);
297 + smmu_writel(smmu, value, SMMU_TLB_FLUSH);
298 + }
299 +
300 +@@ -216,8 +223,12 @@ static inline void smmu_flush_tlb_group(struct tegra_smmu *smmu,
301 + {
302 + u32 value;
303 +
304 +- value = SMMU_TLB_FLUSH_ASID_MATCH | SMMU_TLB_FLUSH_ASID(asid) |
305 +- SMMU_TLB_FLUSH_VA_GROUP(iova);
306 ++ if (smmu->soc->num_asids == 4)
307 ++ value = (asid & 0x3) << 29;
308 ++ else
309 ++ value = (asid & 0x7f) << 24;
310 ++
311 ++ value |= SMMU_TLB_FLUSH_ASID_MATCH | SMMU_TLB_FLUSH_VA_GROUP(iova);
312 + smmu_writel(smmu, value, SMMU_TLB_FLUSH);
313 + }
314 +
315 +diff --git a/drivers/md/dm-delay.c b/drivers/md/dm-delay.c
316 +index cc70871a6d29..3f01c5229e69 100644
317 +--- a/drivers/md/dm-delay.c
318 ++++ b/drivers/md/dm-delay.c
319 +@@ -222,7 +222,8 @@ static void delay_dtr(struct dm_target *ti)
320 + {
321 + struct delay_c *dc = ti->private;
322 +
323 +- destroy_workqueue(dc->kdelayd_wq);
324 ++ if (dc->kdelayd_wq)
325 ++ destroy_workqueue(dc->kdelayd_wq);
326 +
327 + dm_put_device(ti, dc->dev_read);
328 +
329 +diff --git a/drivers/md/md.c b/drivers/md/md.c
330 +index a7a0e3acdb2f..21698eb671d7 100644
331 +--- a/drivers/md/md.c
332 ++++ b/drivers/md/md.c
333 +@@ -2694,8 +2694,10 @@ state_store(struct md_rdev *rdev, const char *buf, size_t len)
334 + err = 0;
335 + }
336 + } else if (cmd_match(buf, "re-add")) {
337 +- if (test_bit(Faulty, &rdev->flags) && (rdev->raid_disk == -1) &&
338 +- rdev->saved_raid_disk >= 0) {
339 ++ if (!rdev->mddev->pers)
340 ++ err = -EINVAL;
341 ++ else if (test_bit(Faulty, &rdev->flags) && (rdev->raid_disk == -1) &&
342 ++ rdev->saved_raid_disk >= 0) {
343 + /* clear_bit is performed _after_ all the devices
344 + * have their local Faulty bit cleared. If any writes
345 + * happen in the meantime in the local node, they
346 +diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
347 +index 2a403e5c31aa..401e7c0e8802 100644
348 +--- a/drivers/md/raid5.c
349 ++++ b/drivers/md/raid5.c
350 +@@ -3878,7 +3878,7 @@ static void handle_parity_checks6(struct r5conf *conf, struct stripe_head *sh,
351 + /* now write out any block on a failed drive,
352 + * or P or Q if they were recomputed
353 + */
354 +- BUG_ON(s->uptodate < disks - 1); /* We don't need Q to recover */
355 ++ dev = NULL;
356 + if (s->failed == 2) {
357 + dev = &sh->dev[s->failed_num[1]];
358 + s->locked++;
359 +@@ -3903,6 +3903,14 @@ static void handle_parity_checks6(struct r5conf *conf, struct stripe_head *sh,
360 + set_bit(R5_LOCKED, &dev->flags);
361 + set_bit(R5_Wantwrite, &dev->flags);
362 + }
363 ++ if (WARN_ONCE(dev && !test_bit(R5_UPTODATE, &dev->flags),
364 ++ "%s: disk%td not up to date\n",
365 ++ mdname(conf->mddev),
366 ++ dev - (struct r5dev *) &sh->dev)) {
367 ++ clear_bit(R5_LOCKED, &dev->flags);
368 ++ clear_bit(R5_Wantwrite, &dev->flags);
369 ++ s->locked--;
370 ++ }
371 + clear_bit(STRIPE_DEGRADED, &sh->state);
372 +
373 + set_bit(STRIPE_INSYNC, &sh->state);
374 +@@ -3914,15 +3922,26 @@ static void handle_parity_checks6(struct r5conf *conf, struct stripe_head *sh,
375 + case check_state_check_result:
376 + sh->check_state = check_state_idle;
377 +
378 +- if (s->failed > 1)
379 +- break;
380 + /* handle a successful check operation, if parity is correct
381 + * we are done. Otherwise update the mismatch count and repair
382 + * parity if !MD_RECOVERY_CHECK
383 + */
384 + if (sh->ops.zero_sum_result == 0) {
385 +- /* Any parity checked was correct */
386 +- set_bit(STRIPE_INSYNC, &sh->state);
387 ++ /* both parities are correct */
388 ++ if (!s->failed)
389 ++ set_bit(STRIPE_INSYNC, &sh->state);
390 ++ else {
391 ++ /* in contrast to the raid5 case we can validate
392 ++ * parity, but still have a failure to write
393 ++ * back
394 ++ */
395 ++ sh->check_state = check_state_compute_result;
396 ++ /* Returning at this point means that we may go
397 ++ * off and bring p and/or q uptodate again so
398 ++ * we make sure to check zero_sum_result again
399 ++ * to verify if p or q need writeback
400 ++ */
401 ++ }
402 + } else {
403 + atomic64_add(STRIPE_SECTORS, &conf->mddev->resync_mismatches);
404 + if (test_bit(MD_RECOVERY_CHECK, &conf->mddev->recovery))
405 +diff --git a/drivers/media/i2c/soc_camera/ov6650.c b/drivers/media/i2c/soc_camera/ov6650.c
406 +index 8f85910eda5d..e21b7e1c2ee1 100644
407 +--- a/drivers/media/i2c/soc_camera/ov6650.c
408 ++++ b/drivers/media/i2c/soc_camera/ov6650.c
409 +@@ -844,6 +844,8 @@ static int ov6650_video_probe(struct i2c_client *client)
410 + if (ret < 0)
411 + return ret;
412 +
413 ++ msleep(20);
414 ++
415 + /*
416 + * check and show product ID and manufacturer ID
417 + */
418 +diff --git a/drivers/memory/tegra/mc.c b/drivers/memory/tegra/mc.c
419 +index 1d49a8dd4a37..7c040a3b45be 100644
420 +--- a/drivers/memory/tegra/mc.c
421 ++++ b/drivers/memory/tegra/mc.c
422 +@@ -72,7 +72,7 @@ static int tegra_mc_setup_latency_allowance(struct tegra_mc *mc)
423 + u32 value;
424 +
425 + /* compute the number of MC clock cycles per tick */
426 +- tick = mc->tick * clk_get_rate(mc->clk);
427 ++ tick = (unsigned long long)mc->tick * clk_get_rate(mc->clk);
428 + do_div(tick, NSEC_PER_SEC);
429 +
430 + value = readl(mc->regs + MC_EMEM_ARB_CFG);
431 +diff --git a/drivers/net/ethernet/mellanox/mlx4/mcg.c b/drivers/net/ethernet/mellanox/mlx4/mcg.c
432 +index 0710b3677464..cb186321edc1 100644
433 +--- a/drivers/net/ethernet/mellanox/mlx4/mcg.c
434 ++++ b/drivers/net/ethernet/mellanox/mlx4/mcg.c
435 +@@ -1490,7 +1490,7 @@ int mlx4_flow_steer_promisc_add(struct mlx4_dev *dev, u8 port,
436 + rule.port = port;
437 + rule.qpn = qpn;
438 + INIT_LIST_HEAD(&rule.list);
439 +- mlx4_err(dev, "going promisc on %x\n", port);
440 ++ mlx4_info(dev, "going promisc on %x\n", port);
441 +
442 + return mlx4_flow_attach(dev, &rule, regid_p);
443 + }
444 +diff --git a/drivers/net/ppp/ppp_deflate.c b/drivers/net/ppp/ppp_deflate.c
445 +index b5edc7f96a39..685e875f5164 100644
446 +--- a/drivers/net/ppp/ppp_deflate.c
447 ++++ b/drivers/net/ppp/ppp_deflate.c
448 +@@ -610,12 +610,20 @@ static struct compressor ppp_deflate_draft = {
449 +
450 + static int __init deflate_init(void)
451 + {
452 +- int answer = ppp_register_compressor(&ppp_deflate);
453 +- if (answer == 0)
454 +- printk(KERN_INFO
455 +- "PPP Deflate Compression module registered\n");
456 +- ppp_register_compressor(&ppp_deflate_draft);
457 +- return answer;
458 ++ int rc;
459 ++
460 ++ rc = ppp_register_compressor(&ppp_deflate);
461 ++ if (rc)
462 ++ return rc;
463 ++
464 ++ rc = ppp_register_compressor(&ppp_deflate_draft);
465 ++ if (rc) {
466 ++ ppp_unregister_compressor(&ppp_deflate);
467 ++ return rc;
468 ++ }
469 ++
470 ++ pr_info("PPP Deflate Compression module registered\n");
471 ++ return 0;
472 + }
473 +
474 + static void __exit deflate_cleanup(void)
475 +diff --git a/drivers/net/wireless/intersil/p54/p54pci.c b/drivers/net/wireless/intersil/p54/p54pci.c
476 +index 27a49068d32d..57ad56435dda 100644
477 +--- a/drivers/net/wireless/intersil/p54/p54pci.c
478 ++++ b/drivers/net/wireless/intersil/p54/p54pci.c
479 +@@ -554,7 +554,7 @@ static int p54p_probe(struct pci_dev *pdev,
480 + err = pci_enable_device(pdev);
481 + if (err) {
482 + dev_err(&pdev->dev, "Cannot enable new PCI device\n");
483 +- return err;
484 ++ goto err_put;
485 + }
486 +
487 + mem_addr = pci_resource_start(pdev, 0);
488 +@@ -639,6 +639,7 @@ static int p54p_probe(struct pci_dev *pdev,
489 + pci_release_regions(pdev);
490 + err_disable_dev:
491 + pci_disable_device(pdev);
492 ++err_put:
493 + pci_dev_put(pdev);
494 + return err;
495 + }
496 +diff --git a/drivers/parisc/led.c b/drivers/parisc/led.c
497 +index b48243131993..3a91e06926ad 100644
498 +--- a/drivers/parisc/led.c
499 ++++ b/drivers/parisc/led.c
500 +@@ -568,6 +568,9 @@ int __init register_led_driver(int model, unsigned long cmd_reg, unsigned long d
501 + break;
502 +
503 + case DISPLAY_MODEL_LASI:
504 ++ /* Skip to register LED in QEMU */
505 ++ if (running_on_qemu)
506 ++ return 1;
507 + LED_DATA_REG = data_reg;
508 + led_func_ptr = led_LASI_driver;
509 + printk(KERN_INFO "LED display at %lx registered\n", LED_DATA_REG);
510 +diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
511 +index 6643a7bc381c..b12fe65d07f8 100644
512 +--- a/drivers/pci/pcie/aspm.c
513 ++++ b/drivers/pci/pcie/aspm.c
514 +@@ -172,6 +172,38 @@ static void pcie_clkpm_cap_init(struct pcie_link_state *link, int blacklist)
515 + link->clkpm_capable = (blacklist) ? 0 : capable;
516 + }
517 +
518 ++static bool pcie_retrain_link(struct pcie_link_state *link)
519 ++{
520 ++ struct pci_dev *parent = link->pdev;
521 ++ unsigned long start_jiffies;
522 ++ u16 reg16;
523 ++
524 ++ pcie_capability_read_word(parent, PCI_EXP_LNKCTL, &reg16);
525 ++ reg16 |= PCI_EXP_LNKCTL_RL;
526 ++ pcie_capability_write_word(parent, PCI_EXP_LNKCTL, reg16);
527 ++ if (parent->clear_retrain_link) {
528 ++ /*
529 ++ * Due to an erratum in some devices the Retrain Link bit
530 ++ * needs to be cleared again manually to allow the link
531 ++ * training to succeed.
532 ++ */
533 ++ reg16 &= ~PCI_EXP_LNKCTL_RL;
534 ++ pcie_capability_write_word(parent, PCI_EXP_LNKCTL, reg16);
535 ++ }
536 ++
537 ++ /* Wait for link training end. Break out after waiting for timeout */
538 ++ start_jiffies = jiffies;
539 ++ for (;;) {
540 ++ pcie_capability_read_word(parent, PCI_EXP_LNKSTA, &reg16);
541 ++ if (!(reg16 & PCI_EXP_LNKSTA_LT))
542 ++ break;
543 ++ if (time_after(jiffies, start_jiffies + LINK_RETRAIN_TIMEOUT))
544 ++ break;
545 ++ msleep(1);
546 ++ }
547 ++ return !(reg16 & PCI_EXP_LNKSTA_LT);
548 ++}
549 ++
550 + /*
551 + * pcie_aspm_configure_common_clock: check if the 2 ends of a link
552 + * could use common clock. If they are, configure them to use the
553 +@@ -181,7 +213,6 @@ static void pcie_aspm_configure_common_clock(struct pcie_link_state *link)
554 + {
555 + int same_clock = 1;
556 + u16 reg16, parent_reg, child_reg[8];
557 +- unsigned long start_jiffies;
558 + struct pci_dev *child, *parent = link->pdev;
559 + struct pci_bus *linkbus = parent->subordinate;
560 + /*
561 +@@ -221,21 +252,7 @@ static void pcie_aspm_configure_common_clock(struct pcie_link_state *link)
562 + reg16 &= ~PCI_EXP_LNKCTL_CCC;
563 + pcie_capability_write_word(parent, PCI_EXP_LNKCTL, reg16);
564 +
565 +- /* Retrain link */
566 +- reg16 |= PCI_EXP_LNKCTL_RL;
567 +- pcie_capability_write_word(parent, PCI_EXP_LNKCTL, reg16);
568 +-
569 +- /* Wait for link training end. Break out after waiting for timeout */
570 +- start_jiffies = jiffies;
571 +- for (;;) {
572 +- pcie_capability_read_word(parent, PCI_EXP_LNKSTA, &reg16);
573 +- if (!(reg16 & PCI_EXP_LNKSTA_LT))
574 +- break;
575 +- if (time_after(jiffies, start_jiffies + LINK_RETRAIN_TIMEOUT))
576 +- break;
577 +- msleep(1);
578 +- }
579 +- if (!(reg16 & PCI_EXP_LNKSTA_LT))
580 ++ if (pcie_retrain_link(link))
581 + return;
582 +
583 + /* Training failed. Restore common clock configurations */
584 +diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
585 +index 6663b76934ad..f474899073e0 100644
586 +--- a/drivers/pci/quirks.c
587 ++++ b/drivers/pci/quirks.c
588 +@@ -2046,6 +2046,23 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10f1, quirk_disable_aspm_l0s);
589 + DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10f4, quirk_disable_aspm_l0s);
590 + DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x1508, quirk_disable_aspm_l0s);
591 +
592 ++/*
593 ++ * Some Pericom PCIe-to-PCI bridges in reverse mode need the PCIe Retrain
594 ++ * Link bit cleared after starting the link retrain process to allow this
595 ++ * process to finish.
596 ++ *
597 ++ * Affected devices: PI7C9X110, PI7C9X111SL, PI7C9X130. See also the
598 ++ * Pericom Errata Sheet PI7C9X111SLB_errata_rev1.2_102711.pdf.
599 ++ */
600 ++static void quirk_enable_clear_retrain_link(struct pci_dev *dev)
601 ++{
602 ++ dev->clear_retrain_link = 1;
603 ++ pci_info(dev, "Enable PCIe Retrain Link quirk\n");
604 ++}
605 ++DECLARE_PCI_FIXUP_HEADER(0x12d8, 0xe110, quirk_enable_clear_retrain_link);
606 ++DECLARE_PCI_FIXUP_HEADER(0x12d8, 0xe111, quirk_enable_clear_retrain_link);
607 ++DECLARE_PCI_FIXUP_HEADER(0x12d8, 0xe130, quirk_enable_clear_retrain_link);
608 ++
609 + static void fixup_rev1_53c810(struct pci_dev *dev)
610 + {
611 + u32 class = dev->class;
612 +@@ -3326,6 +3343,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x0030, quirk_no_bus_reset);
613 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x0032, quirk_no_bus_reset);
614 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x003c, quirk_no_bus_reset);
615 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x0033, quirk_no_bus_reset);
616 ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x0034, quirk_no_bus_reset);
617 +
618 + static void quirk_no_pm_reset(struct pci_dev *dev)
619 + {
620 +diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c
621 +index bcde8d13476a..c0fc98e03c91 100644
622 +--- a/drivers/power/supply/power_supply_sysfs.c
623 ++++ b/drivers/power/supply/power_supply_sysfs.c
624 +@@ -278,15 +278,11 @@ int power_supply_uevent(struct device *dev, struct kobj_uevent_env *env)
625 + char *prop_buf;
626 + char *attrname;
627 +
628 +- dev_dbg(dev, "uevent\n");
629 +-
630 + if (!psy || !psy->desc) {
631 + dev_dbg(dev, "No power supply yet\n");
632 + return ret;
633 + }
634 +
635 +- dev_dbg(dev, "POWER_SUPPLY_NAME=%s\n", psy->desc->name);
636 +-
637 + ret = add_uevent_var(env, "POWER_SUPPLY_NAME=%s", psy->desc->name);
638 + if (ret)
639 + return ret;
640 +@@ -322,8 +318,6 @@ int power_supply_uevent(struct device *dev, struct kobj_uevent_env *env)
641 + goto out;
642 + }
643 +
644 +- dev_dbg(dev, "prop %s=%s\n", attrname, prop_buf);
645 +-
646 + ret = add_uevent_var(env, "POWER_SUPPLY_%s=%s", attrname, prop_buf);
647 + kfree(attrname);
648 + if (ret)
649 +diff --git a/drivers/video/fbdev/sm712.h b/drivers/video/fbdev/sm712.h
650 +index aad1cc4be34a..c7ebf03b8d53 100644
651 +--- a/drivers/video/fbdev/sm712.h
652 ++++ b/drivers/video/fbdev/sm712.h
653 +@@ -15,14 +15,10 @@
654 +
655 + #define FB_ACCEL_SMI_LYNX 88
656 +
657 +-#define SCREEN_X_RES 1024
658 +-#define SCREEN_Y_RES 600
659 +-#define SCREEN_BPP 16
660 +-
661 +-/*Assume SM712 graphics chip has 4MB VRAM */
662 +-#define SM712_VIDEOMEMORYSIZE 0x00400000
663 +-/*Assume SM722 graphics chip has 8MB VRAM */
664 +-#define SM722_VIDEOMEMORYSIZE 0x00800000
665 ++#define SCREEN_X_RES 1024
666 ++#define SCREEN_Y_RES_PC 768
667 ++#define SCREEN_Y_RES_NETBOOK 600
668 ++#define SCREEN_BPP 16
669 +
670 + #define dac_reg (0x3c8)
671 + #define dac_val (0x3c9)
672 +diff --git a/drivers/video/fbdev/sm712fb.c b/drivers/video/fbdev/sm712fb.c
673 +index 73cb4ffff3c5..0d92ff366a7b 100644
674 +--- a/drivers/video/fbdev/sm712fb.c
675 ++++ b/drivers/video/fbdev/sm712fb.c
676 +@@ -530,6 +530,65 @@ static const struct modeinit vgamode[] = {
677 + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x15, 0x03,
678 + },
679 + },
680 ++ { /* 1024 x 768 16Bpp 60Hz */
681 ++ 1024, 768, 16, 60,
682 ++ /* Init_MISC */
683 ++ 0xEB,
684 ++ { /* Init_SR0_SR4 */
685 ++ 0x03, 0x01, 0x0F, 0x03, 0x0E,
686 ++ },
687 ++ { /* Init_SR10_SR24 */
688 ++ 0xF3, 0xB6, 0xC0, 0xDD, 0x00, 0x0E, 0x17, 0x2C,
689 ++ 0x99, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
690 ++ 0xC4, 0x30, 0x02, 0x01, 0x01,
691 ++ },
692 ++ { /* Init_SR30_SR75 */
693 ++ 0x38, 0x03, 0x20, 0x09, 0xC0, 0x3A, 0x3A, 0x3A,
694 ++ 0x3A, 0x3A, 0x3A, 0x3A, 0x00, 0x00, 0x03, 0xFF,
695 ++ 0x00, 0xFC, 0x00, 0x00, 0x20, 0x18, 0x00, 0xFC,
696 ++ 0x20, 0x0C, 0x44, 0x20, 0x00, 0x00, 0x00, 0x3A,
697 ++ 0x06, 0x68, 0xA7, 0x7F, 0x83, 0x24, 0xFF, 0x03,
698 ++ 0x0F, 0x60, 0x59, 0x3A, 0x3A, 0x00, 0x00, 0x3A,
699 ++ 0x01, 0x80, 0x7E, 0x1A, 0x1A, 0x00, 0x00, 0x00,
700 ++ 0x50, 0x03, 0x74, 0x14, 0x3B, 0x0D, 0x09, 0x02,
701 ++ 0x04, 0x45, 0x30, 0x30, 0x40, 0x20,
702 ++ },
703 ++ { /* Init_SR80_SR93 */
704 ++ 0xFF, 0x07, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x3A,
705 ++ 0xF7, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x3A, 0x3A,
706 ++ 0x00, 0x00, 0x00, 0x00,
707 ++ },
708 ++ { /* Init_SRA0_SRAF */
709 ++ 0x00, 0xFB, 0x9F, 0x01, 0x00, 0xED, 0xED, 0xED,
710 ++ 0x7B, 0xFB, 0xFF, 0xFF, 0x97, 0xEF, 0xBF, 0xDF,
711 ++ },
712 ++ { /* Init_GR00_GR08 */
713 ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F,
714 ++ 0xFF,
715 ++ },
716 ++ { /* Init_AR00_AR14 */
717 ++ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
718 ++ 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
719 ++ 0x41, 0x00, 0x0F, 0x00, 0x00,
720 ++ },
721 ++ { /* Init_CR00_CR18 */
722 ++ 0xA3, 0x7F, 0x7F, 0x00, 0x85, 0x16, 0x24, 0xF5,
723 ++ 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
724 ++ 0x03, 0x09, 0xFF, 0x80, 0x40, 0xFF, 0x00, 0xE3,
725 ++ 0xFF,
726 ++ },
727 ++ { /* Init_CR30_CR4D */
728 ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x20,
729 ++ 0x00, 0x00, 0x00, 0x40, 0x00, 0xFF, 0xBF, 0xFF,
730 ++ 0xA3, 0x7F, 0x00, 0x86, 0x15, 0x24, 0xFF, 0x00,
731 ++ 0x01, 0x07, 0xE5, 0x20, 0x7F, 0xFF,
732 ++ },
733 ++ { /* Init_CR90_CRA7 */
734 ++ 0x55, 0xD9, 0x5D, 0xE1, 0x86, 0x1B, 0x8E, 0x26,
735 ++ 0xDA, 0x8D, 0xDE, 0x94, 0x00, 0x00, 0x18, 0x00,
736 ++ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x15, 0x03,
737 ++ },
738 ++ },
739 + { /* mode#5: 1024 x 768 24Bpp 60Hz */
740 + 1024, 768, 24, 60,
741 + /* Init_MISC */
742 +@@ -827,67 +886,80 @@ static inline unsigned int chan_to_field(unsigned int chan,
743 +
744 + static int smtc_blank(int blank_mode, struct fb_info *info)
745 + {
746 ++ struct smtcfb_info *sfb = info->par;
747 ++
748 + /* clear DPMS setting */
749 + switch (blank_mode) {
750 + case FB_BLANK_UNBLANK:
751 + /* Screen On: HSync: On, VSync : On */
752 ++
753 ++ switch (sfb->chip_id) {
754 ++ case 0x710:
755 ++ case 0x712:
756 ++ smtc_seqw(0x6a, 0x16);
757 ++ smtc_seqw(0x6b, 0x02);
758 ++ break;
759 ++ case 0x720:
760 ++ smtc_seqw(0x6a, 0x0d);
761 ++ smtc_seqw(0x6b, 0x02);
762 ++ break;
763 ++ }
764 ++
765 ++ smtc_seqw(0x23, (smtc_seqr(0x23) & (~0xc0)));
766 + smtc_seqw(0x01, (smtc_seqr(0x01) & (~0x20)));
767 +- smtc_seqw(0x6a, 0x16);
768 +- smtc_seqw(0x6b, 0x02);
769 + smtc_seqw(0x21, (smtc_seqr(0x21) & 0x77));
770 + smtc_seqw(0x22, (smtc_seqr(0x22) & (~0x30)));
771 +- smtc_seqw(0x23, (smtc_seqr(0x23) & (~0xc0)));
772 +- smtc_seqw(0x24, (smtc_seqr(0x24) | 0x01));
773 + smtc_seqw(0x31, (smtc_seqr(0x31) | 0x03));
774 ++ smtc_seqw(0x24, (smtc_seqr(0x24) | 0x01));
775 + break;
776 + case FB_BLANK_NORMAL:
777 + /* Screen Off: HSync: On, VSync : On Soft blank */
778 ++ smtc_seqw(0x24, (smtc_seqr(0x24) | 0x01));
779 ++ smtc_seqw(0x31, ((smtc_seqr(0x31) & (~0x07)) | 0x00));
780 ++ smtc_seqw(0x23, (smtc_seqr(0x23) & (~0xc0)));
781 + smtc_seqw(0x01, (smtc_seqr(0x01) & (~0x20)));
782 ++ smtc_seqw(0x22, (smtc_seqr(0x22) & (~0x30)));
783 + smtc_seqw(0x6a, 0x16);
784 + smtc_seqw(0x6b, 0x02);
785 +- smtc_seqw(0x22, (smtc_seqr(0x22) & (~0x30)));
786 +- smtc_seqw(0x23, (smtc_seqr(0x23) & (~0xc0)));
787 +- smtc_seqw(0x24, (smtc_seqr(0x24) | 0x01));
788 +- smtc_seqw(0x31, ((smtc_seqr(0x31) & (~0x07)) | 0x00));
789 + break;
790 + case FB_BLANK_VSYNC_SUSPEND:
791 + /* Screen On: HSync: On, VSync : Off */
792 ++ smtc_seqw(0x24, (smtc_seqr(0x24) & (~0x01)));
793 ++ smtc_seqw(0x31, ((smtc_seqr(0x31) & (~0x07)) | 0x00));
794 ++ smtc_seqw(0x23, ((smtc_seqr(0x23) & (~0xc0)) | 0x20));
795 + smtc_seqw(0x01, (smtc_seqr(0x01) | 0x20));
796 +- smtc_seqw(0x20, (smtc_seqr(0x20) & (~0xB0)));
797 +- smtc_seqw(0x6a, 0x0c);
798 +- smtc_seqw(0x6b, 0x02);
799 + smtc_seqw(0x21, (smtc_seqr(0x21) | 0x88));
800 ++ smtc_seqw(0x20, (smtc_seqr(0x20) & (~0xB0)));
801 + smtc_seqw(0x22, ((smtc_seqr(0x22) & (~0x30)) | 0x20));
802 +- smtc_seqw(0x23, ((smtc_seqr(0x23) & (~0xc0)) | 0x20));
803 +- smtc_seqw(0x24, (smtc_seqr(0x24) & (~0x01)));
804 +- smtc_seqw(0x31, ((smtc_seqr(0x31) & (~0x07)) | 0x00));
805 + smtc_seqw(0x34, (smtc_seqr(0x34) | 0x80));
806 ++ smtc_seqw(0x6a, 0x0c);
807 ++ smtc_seqw(0x6b, 0x02);
808 + break;
809 + case FB_BLANK_HSYNC_SUSPEND:
810 + /* Screen On: HSync: Off, VSync : On */
811 ++ smtc_seqw(0x24, (smtc_seqr(0x24) & (~0x01)));
812 ++ smtc_seqw(0x31, ((smtc_seqr(0x31) & (~0x07)) | 0x00));
813 ++ smtc_seqw(0x23, ((smtc_seqr(0x23) & (~0xc0)) | 0xD8));
814 + smtc_seqw(0x01, (smtc_seqr(0x01) | 0x20));
815 +- smtc_seqw(0x20, (smtc_seqr(0x20) & (~0xB0)));
816 +- smtc_seqw(0x6a, 0x0c);
817 +- smtc_seqw(0x6b, 0x02);
818 + smtc_seqw(0x21, (smtc_seqr(0x21) | 0x88));
819 ++ smtc_seqw(0x20, (smtc_seqr(0x20) & (~0xB0)));
820 + smtc_seqw(0x22, ((smtc_seqr(0x22) & (~0x30)) | 0x10));
821 +- smtc_seqw(0x23, ((smtc_seqr(0x23) & (~0xc0)) | 0xD8));
822 +- smtc_seqw(0x24, (smtc_seqr(0x24) & (~0x01)));
823 +- smtc_seqw(0x31, ((smtc_seqr(0x31) & (~0x07)) | 0x00));
824 + smtc_seqw(0x34, (smtc_seqr(0x34) | 0x80));
825 ++ smtc_seqw(0x6a, 0x0c);
826 ++ smtc_seqw(0x6b, 0x02);
827 + break;
828 + case FB_BLANK_POWERDOWN:
829 + /* Screen On: HSync: Off, VSync : Off */
830 ++ smtc_seqw(0x24, (smtc_seqr(0x24) & (~0x01)));
831 ++ smtc_seqw(0x31, ((smtc_seqr(0x31) & (~0x07)) | 0x00));
832 ++ smtc_seqw(0x23, ((smtc_seqr(0x23) & (~0xc0)) | 0xD8));
833 + smtc_seqw(0x01, (smtc_seqr(0x01) | 0x20));
834 +- smtc_seqw(0x20, (smtc_seqr(0x20) & (~0xB0)));
835 +- smtc_seqw(0x6a, 0x0c);
836 +- smtc_seqw(0x6b, 0x02);
837 + smtc_seqw(0x21, (smtc_seqr(0x21) | 0x88));
838 ++ smtc_seqw(0x20, (smtc_seqr(0x20) & (~0xB0)));
839 + smtc_seqw(0x22, ((smtc_seqr(0x22) & (~0x30)) | 0x30));
840 +- smtc_seqw(0x23, ((smtc_seqr(0x23) & (~0xc0)) | 0xD8));
841 +- smtc_seqw(0x24, (smtc_seqr(0x24) & (~0x01)));
842 +- smtc_seqw(0x31, ((smtc_seqr(0x31) & (~0x07)) | 0x00));
843 + smtc_seqw(0x34, (smtc_seqr(0x34) | 0x80));
844 ++ smtc_seqw(0x6a, 0x0c);
845 ++ smtc_seqw(0x6b, 0x02);
846 + break;
847 + default:
848 + return -EINVAL;
849 +@@ -1144,8 +1216,10 @@ static void sm7xx_set_timing(struct smtcfb_info *sfb)
850 +
851 + /* init SEQ register SR30 - SR75 */
852 + for (i = 0; i < SIZE_SR30_SR75; i++)
853 +- if ((i + 0x30) != 0x62 && (i + 0x30) != 0x6a &&
854 +- (i + 0x30) != 0x6b)
855 ++ if ((i + 0x30) != 0x30 && (i + 0x30) != 0x62 &&
856 ++ (i + 0x30) != 0x6a && (i + 0x30) != 0x6b &&
857 ++ (i + 0x30) != 0x70 && (i + 0x30) != 0x71 &&
858 ++ (i + 0x30) != 0x74 && (i + 0x30) != 0x75)
859 + smtc_seqw(i + 0x30,
860 + vgamode[j].init_sr30_sr75[i]);
861 +
862 +@@ -1170,8 +1244,12 @@ static void sm7xx_set_timing(struct smtcfb_info *sfb)
863 + smtc_crtcw(i, vgamode[j].init_cr00_cr18[i]);
864 +
865 + /* init CRTC register CR30 - CR4D */
866 +- for (i = 0; i < SIZE_CR30_CR4D; i++)
867 ++ for (i = 0; i < SIZE_CR30_CR4D; i++) {
868 ++ if ((i + 0x30) >= 0x3B && (i + 0x30) <= 0x3F)
869 ++ /* side-effect, don't write to CR3B-CR3F */
870 ++ continue;
871 + smtc_crtcw(i + 0x30, vgamode[j].init_cr30_cr4d[i]);
872 ++ }
873 +
874 + /* init CRTC register CR90 - CRA7 */
875 + for (i = 0; i < SIZE_CR90_CRA7; i++)
876 +@@ -1322,6 +1400,11 @@ static int smtc_map_smem(struct smtcfb_info *sfb,
877 + {
878 + sfb->fb->fix.smem_start = pci_resource_start(pdev, 0);
879 +
880 ++ if (sfb->chip_id == 0x720)
881 ++ /* on SM720, the framebuffer starts at the 1 MB offset */
882 ++ sfb->fb->fix.smem_start += 0x00200000;
883 ++
884 ++ /* XXX: is it safe for SM720 on Big-Endian? */
885 + if (sfb->fb->var.bits_per_pixel == 32)
886 + sfb->fb->fix.smem_start += big_addr;
887 +
888 +@@ -1359,12 +1442,82 @@ static inline void sm7xx_init_hw(void)
889 + outb_p(0x11, 0x3c5);
890 + }
891 +
892 ++static u_long sm7xx_vram_probe(struct smtcfb_info *sfb)
893 ++{
894 ++ u8 vram;
895 ++
896 ++ switch (sfb->chip_id) {
897 ++ case 0x710:
898 ++ case 0x712:
899 ++ /*
900 ++ * Assume SM712 graphics chip has 4MB VRAM.
901 ++ *
902 ++ * FIXME: SM712 can have 2MB VRAM, which is used on earlier
903 ++ * laptops, such as IBM Thinkpad 240X. This driver would
904 ++ * probably crash on those machines. If anyone gets one of
905 ++ * those and is willing to help, run "git blame" and send me
906 ++ * an E-mail.
907 ++ */
908 ++ return 0x00400000;
909 ++ case 0x720:
910 ++ outb_p(0x76, 0x3c4);
911 ++ vram = inb_p(0x3c5) >> 6;
912 ++
913 ++ if (vram == 0x00)
914 ++ return 0x00800000; /* 8 MB */
915 ++ else if (vram == 0x01)
916 ++ return 0x01000000; /* 16 MB */
917 ++ else if (vram == 0x02)
918 ++ return 0x00400000; /* illegal, fallback to 4 MB */
919 ++ else if (vram == 0x03)
920 ++ return 0x00400000; /* 4 MB */
921 ++ }
922 ++ return 0; /* unknown hardware */
923 ++}
924 ++
925 ++static void sm7xx_resolution_probe(struct smtcfb_info *sfb)
926 ++{
927 ++ /* get mode parameter from smtc_scr_info */
928 ++ if (smtc_scr_info.lfb_width != 0) {
929 ++ sfb->fb->var.xres = smtc_scr_info.lfb_width;
930 ++ sfb->fb->var.yres = smtc_scr_info.lfb_height;
931 ++ sfb->fb->var.bits_per_pixel = smtc_scr_info.lfb_depth;
932 ++ goto final;
933 ++ }
934 ++
935 ++ /*
936 ++ * No parameter, default resolution is 1024x768-16.
937 ++ *
938 ++ * FIXME: earlier laptops, such as IBM Thinkpad 240X, has a 800x600
939 ++ * panel, also see the comments about Thinkpad 240X above.
940 ++ */
941 ++ sfb->fb->var.xres = SCREEN_X_RES;
942 ++ sfb->fb->var.yres = SCREEN_Y_RES_PC;
943 ++ sfb->fb->var.bits_per_pixel = SCREEN_BPP;
944 ++
945 ++#ifdef CONFIG_MIPS
946 ++ /*
947 ++ * Loongson MIPS netbooks use 1024x600 LCD panels, which is the original
948 ++ * target platform of this driver, but nearly all old x86 laptops have
949 ++ * 1024x768. Lighting 768 panels using 600's timings would partially
950 ++ * garble the display, so we don't want that. But it's not possible to
951 ++ * distinguish them reliably.
952 ++ *
953 ++ * So we change the default to 768, but keep 600 as-is on MIPS.
954 ++ */
955 ++ sfb->fb->var.yres = SCREEN_Y_RES_NETBOOK;
956 ++#endif
957 ++
958 ++final:
959 ++ big_pixel_depth(sfb->fb->var.bits_per_pixel, smtc_scr_info.lfb_depth);
960 ++}
961 ++
962 + static int smtcfb_pci_probe(struct pci_dev *pdev,
963 + const struct pci_device_id *ent)
964 + {
965 + struct smtcfb_info *sfb;
966 + struct fb_info *info;
967 +- u_long smem_size = 0x00800000; /* default 8MB */
968 ++ u_long smem_size;
969 + int err;
970 + unsigned long mmio_base;
971 +
972 +@@ -1404,29 +1557,19 @@ static int smtcfb_pci_probe(struct pci_dev *pdev,
973 +
974 + sm7xx_init_hw();
975 +
976 +- /* get mode parameter from smtc_scr_info */
977 +- if (smtc_scr_info.lfb_width != 0) {
978 +- sfb->fb->var.xres = smtc_scr_info.lfb_width;
979 +- sfb->fb->var.yres = smtc_scr_info.lfb_height;
980 +- sfb->fb->var.bits_per_pixel = smtc_scr_info.lfb_depth;
981 +- } else {
982 +- /* default resolution 1024x600 16bit mode */
983 +- sfb->fb->var.xres = SCREEN_X_RES;
984 +- sfb->fb->var.yres = SCREEN_Y_RES;
985 +- sfb->fb->var.bits_per_pixel = SCREEN_BPP;
986 +- }
987 +-
988 +- big_pixel_depth(sfb->fb->var.bits_per_pixel, smtc_scr_info.lfb_depth);
989 + /* Map address and memory detection */
990 + mmio_base = pci_resource_start(pdev, 0);
991 + pci_read_config_byte(pdev, PCI_REVISION_ID, &sfb->chip_rev_id);
992 +
993 ++ smem_size = sm7xx_vram_probe(sfb);
994 ++ dev_info(&pdev->dev, "%lu MiB of VRAM detected.\n",
995 ++ smem_size / 1048576);
996 ++
997 + switch (sfb->chip_id) {
998 + case 0x710:
999 + case 0x712:
1000 + sfb->fb->fix.mmio_start = mmio_base + 0x00400000;
1001 + sfb->fb->fix.mmio_len = 0x00400000;
1002 +- smem_size = SM712_VIDEOMEMORYSIZE;
1003 + sfb->lfb = ioremap(mmio_base, mmio_addr);
1004 + if (!sfb->lfb) {
1005 + dev_err(&pdev->dev,
1006 +@@ -1458,8 +1601,7 @@ static int smtcfb_pci_probe(struct pci_dev *pdev,
1007 + case 0x720:
1008 + sfb->fb->fix.mmio_start = mmio_base;
1009 + sfb->fb->fix.mmio_len = 0x00200000;
1010 +- smem_size = SM722_VIDEOMEMORYSIZE;
1011 +- sfb->dp_regs = ioremap(mmio_base, 0x00a00000);
1012 ++ sfb->dp_regs = ioremap(mmio_base, 0x00200000 + smem_size);
1013 + sfb->lfb = sfb->dp_regs + 0x00200000;
1014 + sfb->mmio = (smtc_regbaseaddress =
1015 + sfb->dp_regs + 0x000c0000);
1016 +@@ -1476,6 +1618,9 @@ static int smtcfb_pci_probe(struct pci_dev *pdev,
1017 + goto failed_fb;
1018 + }
1019 +
1020 ++ /* probe and decide resolution */
1021 ++ sm7xx_resolution_probe(sfb);
1022 ++
1023 + /* can support 32 bpp */
1024 + if (15 == sfb->fb->var.bits_per_pixel)
1025 + sfb->fb->var.bits_per_pixel = 16;
1026 +@@ -1486,7 +1631,11 @@ static int smtcfb_pci_probe(struct pci_dev *pdev,
1027 + if (err)
1028 + goto failed;
1029 +
1030 +- smtcfb_setmode(sfb);
1031 ++ /*
1032 ++ * The screen would be temporarily garbled when sm712fb takes over
1033 ++ * vesafb or VGA text mode. Zero the framebuffer.
1034 ++ */
1035 ++ memset_io(sfb->lfb, 0, sfb->fb->fix.smem_len);
1036 +
1037 + err = register_framebuffer(info);
1038 + if (err < 0)
1039 +diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
1040 +index 7938c48c72ff..6b29165f766f 100644
1041 +--- a/fs/btrfs/extent-tree.c
1042 ++++ b/fs/btrfs/extent-tree.c
1043 +@@ -11150,9 +11150,9 @@ int btrfs_error_unpin_extent_range(struct btrfs_root *root, u64 start, u64 end)
1044 + * transaction.
1045 + */
1046 + static int btrfs_trim_free_extents(struct btrfs_device *device,
1047 +- u64 minlen, u64 *trimmed)
1048 ++ struct fstrim_range *range, u64 *trimmed)
1049 + {
1050 +- u64 start = 0, len = 0;
1051 ++ u64 start = range->start, len = 0;
1052 + int ret;
1053 +
1054 + *trimmed = 0;
1055 +@@ -11188,8 +11188,8 @@ static int btrfs_trim_free_extents(struct btrfs_device *device,
1056 + atomic_inc(&trans->use_count);
1057 + spin_unlock(&fs_info->trans_lock);
1058 +
1059 +- ret = find_free_dev_extent_start(trans, device, minlen, start,
1060 +- &start, &len);
1061 ++ ret = find_free_dev_extent_start(trans, device, range->minlen,
1062 ++ start, &start, &len);
1063 + if (trans)
1064 + btrfs_put_transaction(trans);
1065 +
1066 +@@ -11201,6 +11201,16 @@ static int btrfs_trim_free_extents(struct btrfs_device *device,
1067 + break;
1068 + }
1069 +
1070 ++ /* If we are out of the passed range break */
1071 ++ if (start > range->start + range->len - 1) {
1072 ++ mutex_unlock(&fs_info->chunk_mutex);
1073 ++ ret = 0;
1074 ++ break;
1075 ++ }
1076 ++
1077 ++ start = max(range->start, start);
1078 ++ len = min(range->len, len);
1079 ++
1080 + ret = btrfs_issue_discard(device->bdev, start, len, &bytes);
1081 + up_read(&fs_info->commit_root_sem);
1082 + mutex_unlock(&fs_info->chunk_mutex);
1083 +@@ -11211,6 +11221,10 @@ static int btrfs_trim_free_extents(struct btrfs_device *device,
1084 + start += len;
1085 + *trimmed += bytes;
1086 +
1087 ++ /* We've trimmed enough */
1088 ++ if (*trimmed >= range->len)
1089 ++ break;
1090 ++
1091 + if (fatal_signal_pending(current)) {
1092 + ret = -ERESTARTSYS;
1093 + break;
1094 +@@ -11295,8 +11309,7 @@ int btrfs_trim_fs(struct btrfs_root *root, struct fstrim_range *range)
1095 + mutex_lock(&fs_info->fs_devices->device_list_mutex);
1096 + devices = &fs_info->fs_devices->devices;
1097 + list_for_each_entry(device, devices, dev_list) {
1098 +- ret = btrfs_trim_free_extents(device, range->minlen,
1099 +- &group_trimmed);
1100 ++ ret = btrfs_trim_free_extents(device, range, &group_trimmed);
1101 + if (ret) {
1102 + dev_failed++;
1103 + dev_ret = ret;
1104 +diff --git a/fs/ceph/super.c b/fs/ceph/super.c
1105 +index 2a8903025853..c42cbd19ff05 100644
1106 +--- a/fs/ceph/super.c
1107 ++++ b/fs/ceph/super.c
1108 +@@ -742,6 +742,12 @@ static void ceph_umount_begin(struct super_block *sb)
1109 + return;
1110 + }
1111 +
1112 ++static int ceph_remount(struct super_block *sb, int *flags, char *data)
1113 ++{
1114 ++ sync_filesystem(sb);
1115 ++ return 0;
1116 ++}
1117 ++
1118 + static const struct super_operations ceph_super_ops = {
1119 + .alloc_inode = ceph_alloc_inode,
1120 + .destroy_inode = ceph_destroy_inode,
1121 +@@ -750,6 +756,7 @@ static const struct super_operations ceph_super_ops = {
1122 + .evict_inode = ceph_evict_inode,
1123 + .sync_fs = ceph_sync_fs,
1124 + .put_super = ceph_put_super,
1125 ++ .remount_fs = ceph_remount,
1126 + .show_options = ceph_show_options,
1127 + .statfs = ceph_statfs,
1128 + .umount_begin = ceph_umount_begin,
1129 +diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
1130 +index 97d8e2a3df9b..f7ad2a3677be 100644
1131 +--- a/fs/cifs/smb2ops.c
1132 ++++ b/fs/cifs/smb2ops.c
1133 +@@ -1413,26 +1413,28 @@ smb21_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock,
1134 + unsigned int epoch, bool *purge_cache)
1135 + {
1136 + char message[5] = {0};
1137 ++ unsigned int new_oplock = 0;
1138 +
1139 + oplock &= 0xFF;
1140 + if (oplock == SMB2_OPLOCK_LEVEL_NOCHANGE)
1141 + return;
1142 +
1143 +- cinode->oplock = 0;
1144 + if (oplock & SMB2_LEASE_READ_CACHING_HE) {
1145 +- cinode->oplock |= CIFS_CACHE_READ_FLG;
1146 ++ new_oplock |= CIFS_CACHE_READ_FLG;
1147 + strcat(message, "R");
1148 + }
1149 + if (oplock & SMB2_LEASE_HANDLE_CACHING_HE) {
1150 +- cinode->oplock |= CIFS_CACHE_HANDLE_FLG;
1151 ++ new_oplock |= CIFS_CACHE_HANDLE_FLG;
1152 + strcat(message, "H");
1153 + }
1154 + if (oplock & SMB2_LEASE_WRITE_CACHING_HE) {
1155 +- cinode->oplock |= CIFS_CACHE_WRITE_FLG;
1156 ++ new_oplock |= CIFS_CACHE_WRITE_FLG;
1157 + strcat(message, "W");
1158 + }
1159 +- if (!cinode->oplock)
1160 +- strcat(message, "None");
1161 ++ if (!new_oplock)
1162 ++ strncpy(message, "None", sizeof(message));
1163 ++
1164 ++ cinode->oplock = new_oplock;
1165 + cifs_dbg(FYI, "%s Lease granted on inode %p\n", message,
1166 + &cinode->vfs_inode);
1167 + }
1168 +diff --git a/fs/fuse/file.c b/fs/fuse/file.c
1169 +index 30a607473621..037990342321 100644
1170 +--- a/fs/fuse/file.c
1171 ++++ b/fs/fuse/file.c
1172 +@@ -1521,7 +1521,7 @@ __acquires(fc->lock)
1173 + {
1174 + struct fuse_conn *fc = get_fuse_conn(inode);
1175 + struct fuse_inode *fi = get_fuse_inode(inode);
1176 +- size_t crop = i_size_read(inode);
1177 ++ loff_t crop = i_size_read(inode);
1178 + struct fuse_req *req;
1179 +
1180 + while (fi->writectr >= 0 && !list_empty(&fi->queued_writes)) {
1181 +@@ -2961,6 +2961,13 @@ static long fuse_file_fallocate(struct file *file, int mode, loff_t offset,
1182 + }
1183 + }
1184 +
1185 ++ if (!(mode & FALLOC_FL_KEEP_SIZE) &&
1186 ++ offset + length > i_size_read(inode)) {
1187 ++ err = inode_newsize_ok(inode, offset + length);
1188 ++ if (err)
1189 ++ return err;
1190 ++ }
1191 ++
1192 + if (!(mode & FALLOC_FL_KEEP_SIZE))
1193 + set_bit(FUSE_I_SIZE_UNSTABLE, &fi->state);
1194 +
1195 +diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
1196 +index 857af951831f..6f474b067032 100644
1197 +--- a/fs/nfs/nfs4state.c
1198 ++++ b/fs/nfs/nfs4state.c
1199 +@@ -143,6 +143,10 @@ int nfs40_discover_server_trunking(struct nfs_client *clp,
1200 + /* Sustain the lease, even if it's empty. If the clientid4
1201 + * goes stale it's of no use for trunking discovery. */
1202 + nfs4_schedule_state_renewal(*result);
1203 ++
1204 ++ /* If the client state need to recover, do it. */
1205 ++ if (clp->cl_state)
1206 ++ nfs4_schedule_state_manager(clp);
1207 + }
1208 + out:
1209 + return status;
1210 +diff --git a/fs/ufs/util.h b/fs/ufs/util.h
1211 +index 398019fb1448..9c4fb1fc0822 100644
1212 +--- a/fs/ufs/util.h
1213 ++++ b/fs/ufs/util.h
1214 +@@ -228,7 +228,7 @@ ufs_get_inode_gid(struct super_block *sb, struct ufs_inode *inode)
1215 + case UFS_UID_44BSD:
1216 + return fs32_to_cpu(sb, inode->ui_u3.ui_44.ui_gid);
1217 + case UFS_UID_EFT:
1218 +- if (inode->ui_u1.oldids.ui_suid == 0xFFFF)
1219 ++ if (inode->ui_u1.oldids.ui_sgid == 0xFFFF)
1220 + return fs32_to_cpu(sb, inode->ui_u3.ui_sun.ui_gid);
1221 + /* Fall through */
1222 + default:
1223 +diff --git a/include/linux/of.h b/include/linux/of.h
1224 +index aac3f09c5d90..56d83c2a6bbb 100644
1225 +--- a/include/linux/of.h
1226 ++++ b/include/linux/of.h
1227 +@@ -220,8 +220,8 @@ extern struct device_node *of_find_all_nodes(struct device_node *prev);
1228 + static inline u64 of_read_number(const __be32 *cell, int size)
1229 + {
1230 + u64 r = 0;
1231 +- while (size--)
1232 +- r = (r << 32) | be32_to_cpu(*(cell++));
1233 ++ for (; size--; cell++)
1234 ++ r = (r << 32) | be32_to_cpu(*cell);
1235 + return r;
1236 + }
1237 +
1238 +diff --git a/include/linux/pci.h b/include/linux/pci.h
1239 +index 534cb43e8635..b9ac0ba81221 100644
1240 +--- a/include/linux/pci.h
1241 ++++ b/include/linux/pci.h
1242 +@@ -320,6 +320,8 @@ struct pci_dev {
1243 + unsigned int hotplug_user_indicators:1; /* SlotCtl indicators
1244 + controlled exclusively by
1245 + user sysfs */
1246 ++ unsigned int clear_retrain_link:1; /* Need to clear Retrain Link
1247 ++ bit manually */
1248 + unsigned int d3_delay; /* D3->D0 transition time in ms */
1249 + unsigned int d3cold_delay; /* D3cold->D0 transition time in ms */
1250 +
1251 +diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
1252 +index 9549ed120556..af969f753e5e 100644
1253 +--- a/kernel/trace/trace_events.c
1254 ++++ b/kernel/trace/trace_events.c
1255 +@@ -1310,9 +1310,6 @@ event_id_read(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos)
1256 + char buf[32];
1257 + int len;
1258 +
1259 +- if (*ppos)
1260 +- return 0;
1261 +-
1262 + if (unlikely(!id))
1263 + return -ENODEV;
1264 +
1265 +diff --git a/net/core/dev.c b/net/core/dev.c
1266 +index 8e187f90c85d..5a3196448bd7 100644
1267 +--- a/net/core/dev.c
1268 ++++ b/net/core/dev.c
1269 +@@ -7499,7 +7499,7 @@ static void netdev_wait_allrefs(struct net_device *dev)
1270 +
1271 + refcnt = netdev_refcnt_read(dev);
1272 +
1273 +- if (time_after(jiffies, warning_time + 10 * HZ)) {
1274 ++ if (refcnt && time_after(jiffies, warning_time + 10 * HZ)) {
1275 + pr_emerg("unregister_netdevice: waiting for %s to become free. Usage count = %d\n",
1276 + dev->name, refcnt);
1277 + warning_time = jiffies;
1278 +diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c
1279 +index 270e79f4d40e..4e39c935e057 100644
1280 +--- a/net/ipv4/ip_vti.c
1281 ++++ b/net/ipv4/ip_vti.c
1282 +@@ -678,9 +678,9 @@ static int __init vti_init(void)
1283 + return err;
1284 +
1285 + rtnl_link_failed:
1286 +- xfrm4_protocol_deregister(&vti_ipcomp4_protocol, IPPROTO_COMP);
1287 +-xfrm_tunnel_failed:
1288 + xfrm4_tunnel_deregister(&ipip_handler, AF_INET);
1289 ++xfrm_tunnel_failed:
1290 ++ xfrm4_protocol_deregister(&vti_ipcomp4_protocol, IPPROTO_COMP);
1291 + xfrm_proto_comp_failed:
1292 + xfrm4_protocol_deregister(&vti_ah4_protocol, IPPROTO_AH);
1293 + xfrm_proto_ah_failed:
1294 +@@ -696,6 +696,7 @@ pernet_dev_failed:
1295 + static void __exit vti_fini(void)
1296 + {
1297 + rtnl_link_unregister(&vti_link_ops);
1298 ++ xfrm4_tunnel_deregister(&ipip_handler, AF_INET);
1299 + xfrm4_protocol_deregister(&vti_ipcomp4_protocol, IPPROTO_COMP);
1300 + xfrm4_protocol_deregister(&vti_ah4_protocol, IPPROTO_AH);
1301 + xfrm4_protocol_deregister(&vti_esp4_protocol, IPPROTO_ESP);
1302 +diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
1303 +index 622e158a6fc4..1805413cd225 100644
1304 +--- a/net/ipv4/xfrm4_policy.c
1305 ++++ b/net/ipv4/xfrm4_policy.c
1306 +@@ -108,7 +108,8 @@ static void
1307 + _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
1308 + {
1309 + const struct iphdr *iph = ip_hdr(skb);
1310 +- u8 *xprth = skb_network_header(skb) + iph->ihl * 4;
1311 ++ int ihl = iph->ihl;
1312 ++ u8 *xprth = skb_network_header(skb) + ihl * 4;
1313 + struct flowi4 *fl4 = &fl->u.ip4;
1314 + int oif = 0;
1315 +
1316 +@@ -119,6 +120,11 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
1317 + fl4->flowi4_mark = skb->mark;
1318 + fl4->flowi4_oif = reverse ? skb->skb_iif : oif;
1319 +
1320 ++ fl4->flowi4_proto = iph->protocol;
1321 ++ fl4->daddr = reverse ? iph->saddr : iph->daddr;
1322 ++ fl4->saddr = reverse ? iph->daddr : iph->saddr;
1323 ++ fl4->flowi4_tos = iph->tos;
1324 ++
1325 + if (!ip_is_fragment(iph)) {
1326 + switch (iph->protocol) {
1327 + case IPPROTO_UDP:
1328 +@@ -130,7 +136,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
1329 + pskb_may_pull(skb, xprth + 4 - skb->data)) {
1330 + __be16 *ports;
1331 +
1332 +- xprth = skb_network_header(skb) + iph->ihl * 4;
1333 ++ xprth = skb_network_header(skb) + ihl * 4;
1334 + ports = (__be16 *)xprth;
1335 +
1336 + fl4->fl4_sport = ports[!!reverse];
1337 +@@ -143,7 +149,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
1338 + pskb_may_pull(skb, xprth + 2 - skb->data)) {
1339 + u8 *icmp;
1340 +
1341 +- xprth = skb_network_header(skb) + iph->ihl * 4;
1342 ++ xprth = skb_network_header(skb) + ihl * 4;
1343 + icmp = xprth;
1344 +
1345 + fl4->fl4_icmp_type = icmp[0];
1346 +@@ -156,7 +162,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
1347 + pskb_may_pull(skb, xprth + 4 - skb->data)) {
1348 + __be32 *ehdr;
1349 +
1350 +- xprth = skb_network_header(skb) + iph->ihl * 4;
1351 ++ xprth = skb_network_header(skb) + ihl * 4;
1352 + ehdr = (__be32 *)xprth;
1353 +
1354 + fl4->fl4_ipsec_spi = ehdr[0];
1355 +@@ -168,7 +174,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
1356 + pskb_may_pull(skb, xprth + 8 - skb->data)) {
1357 + __be32 *ah_hdr;
1358 +
1359 +- xprth = skb_network_header(skb) + iph->ihl * 4;
1360 ++ xprth = skb_network_header(skb) + ihl * 4;
1361 + ah_hdr = (__be32 *)xprth;
1362 +
1363 + fl4->fl4_ipsec_spi = ah_hdr[1];
1364 +@@ -180,7 +186,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
1365 + pskb_may_pull(skb, xprth + 4 - skb->data)) {
1366 + __be16 *ipcomp_hdr;
1367 +
1368 +- xprth = skb_network_header(skb) + iph->ihl * 4;
1369 ++ xprth = skb_network_header(skb) + ihl * 4;
1370 + ipcomp_hdr = (__be16 *)xprth;
1371 +
1372 + fl4->fl4_ipsec_spi = htonl(ntohs(ipcomp_hdr[1]));
1373 +@@ -193,7 +199,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
1374 + __be16 *greflags;
1375 + __be32 *gre_hdr;
1376 +
1377 +- xprth = skb_network_header(skb) + iph->ihl * 4;
1378 ++ xprth = skb_network_header(skb) + ihl * 4;
1379 + greflags = (__be16 *)xprth;
1380 + gre_hdr = (__be32 *)xprth;
1381 +
1382 +@@ -210,10 +216,6 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
1383 + break;
1384 + }
1385 + }
1386 +- fl4->flowi4_proto = iph->protocol;
1387 +- fl4->daddr = reverse ? iph->saddr : iph->daddr;
1388 +- fl4->saddr = reverse ? iph->daddr : iph->saddr;
1389 +- fl4->flowi4_tos = iph->tos;
1390 + }
1391 +
1392 + static inline int xfrm4_garbage_collect(struct dst_ops *ops)
1393 +diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c
1394 +index 3a2701d42f47..07b7b2540579 100644
1395 +--- a/net/ipv6/xfrm6_tunnel.c
1396 ++++ b/net/ipv6/xfrm6_tunnel.c
1397 +@@ -391,6 +391,10 @@ static void __exit xfrm6_tunnel_fini(void)
1398 + xfrm6_tunnel_deregister(&xfrm6_tunnel_handler, AF_INET6);
1399 + xfrm_unregister_type(&xfrm6_tunnel_type, AF_INET6);
1400 + unregister_pernet_subsys(&xfrm6_tunnel_net_ops);
1401 ++ /* Someone maybe has gotten the xfrm6_tunnel_spi.
1402 ++ * So need to wait it.
1403 ++ */
1404 ++ rcu_barrier();
1405 + kmem_cache_destroy(xfrm6_tunnel_spi_kmem);
1406 + }
1407 +
1408 +diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
1409 +index 5768560cbfc3..ad03331ee785 100644
1410 +--- a/net/mac80211/iface.c
1411 ++++ b/net/mac80211/iface.c
1412 +@@ -1937,6 +1937,9 @@ void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata)
1413 + list_del_rcu(&sdata->list);
1414 + mutex_unlock(&sdata->local->iflist_mtx);
1415 +
1416 ++ if (sdata->vif.txq)
1417 ++ ieee80211_txq_purge(sdata->local, to_txq_info(sdata->vif.txq));
1418 ++
1419 + synchronize_rcu();
1420 +
1421 + if (sdata->dev) {
1422 +diff --git a/net/tipc/core.c b/net/tipc/core.c
1423 +index 236b043a4156..974694121ce9 100644
1424 +--- a/net/tipc/core.c
1425 ++++ b/net/tipc/core.c
1426 +@@ -62,6 +62,10 @@ static int __net_init tipc_init_net(struct net *net)
1427 + INIT_LIST_HEAD(&tn->node_list);
1428 + spin_lock_init(&tn->node_list_lock);
1429 +
1430 ++ err = tipc_socket_init();
1431 ++ if (err)
1432 ++ goto out_socket;
1433 ++
1434 + err = tipc_sk_rht_init(net);
1435 + if (err)
1436 + goto out_sk_rht;
1437 +@@ -88,6 +92,8 @@ out_subscr:
1438 + out_nametbl:
1439 + tipc_sk_rht_destroy(net);
1440 + out_sk_rht:
1441 ++ tipc_socket_stop();
1442 ++out_socket:
1443 + return err;
1444 + }
1445 +
1446 +@@ -98,6 +104,7 @@ static void __net_exit tipc_exit_net(struct net *net)
1447 + tipc_bcast_stop(net);
1448 + tipc_nametbl_stop(net);
1449 + tipc_sk_rht_destroy(net);
1450 ++ tipc_socket_stop();
1451 + }
1452 +
1453 + static struct pernet_operations tipc_net_ops = {
1454 +@@ -125,10 +132,6 @@ static int __init tipc_init(void)
1455 + if (err)
1456 + goto out_netlink_compat;
1457 +
1458 +- err = tipc_socket_init();
1459 +- if (err)
1460 +- goto out_socket;
1461 +-
1462 + err = tipc_register_sysctl();
1463 + if (err)
1464 + goto out_sysctl;
1465 +@@ -148,8 +151,6 @@ out_bearer:
1466 + out_pernet:
1467 + tipc_unregister_sysctl();
1468 + out_sysctl:
1469 +- tipc_socket_stop();
1470 +-out_socket:
1471 + tipc_netlink_compat_stop();
1472 + out_netlink_compat:
1473 + tipc_netlink_stop();
1474 +@@ -164,7 +165,6 @@ static void __exit tipc_exit(void)
1475 + unregister_pernet_subsys(&tipc_net_ops);
1476 + tipc_netlink_stop();
1477 + tipc_netlink_compat_stop();
1478 +- tipc_socket_stop();
1479 + tipc_unregister_sysctl();
1480 +
1481 + pr_info("Deactivated\n");
1482 +diff --git a/net/vmw_vsock/virtio_transport.c b/net/vmw_vsock/virtio_transport.c
1483 +index f66a6010ae07..0bd5a60f3bde 100644
1484 +--- a/net/vmw_vsock/virtio_transport.c
1485 ++++ b/net/vmw_vsock/virtio_transport.c
1486 +@@ -600,28 +600,27 @@ static int __init virtio_vsock_init(void)
1487 + if (!virtio_vsock_workqueue)
1488 + return -ENOMEM;
1489 +
1490 +- ret = register_virtio_driver(&virtio_vsock_driver);
1491 ++ ret = vsock_core_init(&virtio_transport.transport);
1492 + if (ret)
1493 + goto out_wq;
1494 +
1495 +- ret = vsock_core_init(&virtio_transport.transport);
1496 ++ ret = register_virtio_driver(&virtio_vsock_driver);
1497 + if (ret)
1498 +- goto out_vdr;
1499 ++ goto out_vci;
1500 +
1501 + return 0;
1502 +
1503 +-out_vdr:
1504 +- unregister_virtio_driver(&virtio_vsock_driver);
1505 ++out_vci:
1506 ++ vsock_core_exit();
1507 + out_wq:
1508 + destroy_workqueue(virtio_vsock_workqueue);
1509 + return ret;
1510 +-
1511 + }
1512 +
1513 + static void __exit virtio_vsock_exit(void)
1514 + {
1515 +- vsock_core_exit();
1516 + unregister_virtio_driver(&virtio_vsock_driver);
1517 ++ vsock_core_exit();
1518 + destroy_workqueue(virtio_vsock_workqueue);
1519 + }
1520 +
1521 +diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c
1522 +index cc4b4abb2759..aa9d1c7780c3 100644
1523 +--- a/net/vmw_vsock/virtio_transport_common.c
1524 ++++ b/net/vmw_vsock/virtio_transport_common.c
1525 +@@ -725,12 +725,19 @@ static bool virtio_transport_close(struct vsock_sock *vsk)
1526 +
1527 + void virtio_transport_release(struct vsock_sock *vsk)
1528 + {
1529 ++ struct virtio_vsock_sock *vvs = vsk->trans;
1530 ++ struct virtio_vsock_pkt *pkt, *tmp;
1531 + struct sock *sk = &vsk->sk;
1532 + bool remove_sock = true;
1533 +
1534 + lock_sock(sk);
1535 + if (sk->sk_type == SOCK_STREAM)
1536 + remove_sock = virtio_transport_close(vsk);
1537 ++
1538 ++ list_for_each_entry_safe(pkt, tmp, &vvs->rx_queue, list) {
1539 ++ list_del(&pkt->list);
1540 ++ virtio_transport_free_pkt(pkt);
1541 ++ }
1542 + release_sock(sk);
1543 +
1544 + if (remove_sock)
1545 +diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
1546 +index f6f91c3b2de0..ca5c79bfd9a5 100644
1547 +--- a/net/xfrm/xfrm_user.c
1548 ++++ b/net/xfrm/xfrm_user.c
1549 +@@ -1344,7 +1344,7 @@ static int verify_newpolicy_info(struct xfrm_userpolicy_info *p)
1550 + ret = verify_policy_dir(p->dir);
1551 + if (ret)
1552 + return ret;
1553 +- if (p->index && ((p->index & XFRM_POLICY_MAX) != p->dir))
1554 ++ if (p->index && (xfrm_policy_id2dir(p->index) != p->dir))
1555 + return -EINVAL;
1556 +
1557 + return 0;
1558 +diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile
1559 +index 8ae824dbfca3..884d4f1ed0c1 100644
1560 +--- a/tools/objtool/Makefile
1561 ++++ b/tools/objtool/Makefile
1562 +@@ -7,11 +7,12 @@ ARCH := x86
1563 + endif
1564 +
1565 + # always use the host compiler
1566 ++HOSTAR ?= ar
1567 + HOSTCC ?= gcc
1568 + HOSTLD ?= ld
1569 ++AR = $(HOSTAR)
1570 + CC = $(HOSTCC)
1571 + LD = $(HOSTLD)
1572 +-AR = ar
1573 +
1574 + ifeq ($(srctree),)
1575 + srctree := $(patsubst %/,%,$(dir $(CURDIR)))
1576 +diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c
1577 +index ee9565a033f4..e58be7eeced8 100644
1578 +--- a/tools/perf/bench/numa.c
1579 ++++ b/tools/perf/bench/numa.c
1580 +@@ -35,6 +35,10 @@
1581 + #include <numa.h>
1582 + #include <numaif.h>
1583 +
1584 ++#ifndef RUSAGE_THREAD
1585 ++# define RUSAGE_THREAD 1
1586 ++#endif
1587 ++
1588 + /*
1589 + * Regular printout to the terminal, supressed if -q is specified:
1590 + */
1591 +diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
1592 +index 3c1372655c33..63fa3a95a1d6 100644
1593 +--- a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
1594 ++++ b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
1595 +@@ -58,6 +58,7 @@ enum intel_pt_pkt_state {
1596 + INTEL_PT_STATE_NO_IP,
1597 + INTEL_PT_STATE_ERR_RESYNC,
1598 + INTEL_PT_STATE_IN_SYNC,
1599 ++ INTEL_PT_STATE_TNT_CONT,
1600 + INTEL_PT_STATE_TNT,
1601 + INTEL_PT_STATE_TIP,
1602 + INTEL_PT_STATE_TIP_PGD,
1603 +@@ -72,8 +73,9 @@ static inline bool intel_pt_sample_time(enum intel_pt_pkt_state pkt_state)
1604 + case INTEL_PT_STATE_NO_IP:
1605 + case INTEL_PT_STATE_ERR_RESYNC:
1606 + case INTEL_PT_STATE_IN_SYNC:
1607 +- case INTEL_PT_STATE_TNT:
1608 ++ case INTEL_PT_STATE_TNT_CONT:
1609 + return true;
1610 ++ case INTEL_PT_STATE_TNT:
1611 + case INTEL_PT_STATE_TIP:
1612 + case INTEL_PT_STATE_TIP_PGD:
1613 + case INTEL_PT_STATE_FUP:
1614 +@@ -856,16 +858,20 @@ static uint64_t intel_pt_next_period(struct intel_pt_decoder *decoder)
1615 + timestamp = decoder->timestamp + decoder->timestamp_insn_cnt;
1616 + masked_timestamp = timestamp & decoder->period_mask;
1617 + if (decoder->continuous_period) {
1618 +- if (masked_timestamp != decoder->last_masked_timestamp)
1619 ++ if (masked_timestamp > decoder->last_masked_timestamp)
1620 + return 1;
1621 + } else {
1622 + timestamp += 1;
1623 + masked_timestamp = timestamp & decoder->period_mask;
1624 +- if (masked_timestamp != decoder->last_masked_timestamp) {
1625 ++ if (masked_timestamp > decoder->last_masked_timestamp) {
1626 + decoder->last_masked_timestamp = masked_timestamp;
1627 + decoder->continuous_period = true;
1628 + }
1629 + }
1630 ++
1631 ++ if (masked_timestamp < decoder->last_masked_timestamp)
1632 ++ return decoder->period_ticks;
1633 ++
1634 + return decoder->period_ticks - (timestamp - masked_timestamp);
1635 + }
1636 +
1637 +@@ -894,7 +900,10 @@ static void intel_pt_sample_insn(struct intel_pt_decoder *decoder)
1638 + case INTEL_PT_PERIOD_TICKS:
1639 + timestamp = decoder->timestamp + decoder->timestamp_insn_cnt;
1640 + masked_timestamp = timestamp & decoder->period_mask;
1641 +- decoder->last_masked_timestamp = masked_timestamp;
1642 ++ if (masked_timestamp > decoder->last_masked_timestamp)
1643 ++ decoder->last_masked_timestamp = masked_timestamp;
1644 ++ else
1645 ++ decoder->last_masked_timestamp += decoder->period_ticks;
1646 + break;
1647 + case INTEL_PT_PERIOD_NONE:
1648 + case INTEL_PT_PERIOD_MTC:
1649 +@@ -1171,7 +1180,9 @@ static int intel_pt_walk_tnt(struct intel_pt_decoder *decoder)
1650 + return -ENOENT;
1651 + }
1652 + decoder->tnt.count -= 1;
1653 +- if (!decoder->tnt.count)
1654 ++ if (decoder->tnt.count)
1655 ++ decoder->pkt_state = INTEL_PT_STATE_TNT_CONT;
1656 ++ else
1657 + decoder->pkt_state = INTEL_PT_STATE_IN_SYNC;
1658 + decoder->tnt.payload <<= 1;
1659 + decoder->state.from_ip = decoder->ip;
1660 +@@ -1202,7 +1213,9 @@ static int intel_pt_walk_tnt(struct intel_pt_decoder *decoder)
1661 +
1662 + if (intel_pt_insn.branch == INTEL_PT_BR_CONDITIONAL) {
1663 + decoder->tnt.count -= 1;
1664 +- if (!decoder->tnt.count)
1665 ++ if (decoder->tnt.count)
1666 ++ decoder->pkt_state = INTEL_PT_STATE_TNT_CONT;
1667 ++ else
1668 + decoder->pkt_state = INTEL_PT_STATE_IN_SYNC;
1669 + if (decoder->tnt.payload & BIT63) {
1670 + decoder->tnt.payload <<= 1;
1671 +@@ -1222,8 +1235,11 @@ static int intel_pt_walk_tnt(struct intel_pt_decoder *decoder)
1672 + return 0;
1673 + }
1674 + decoder->ip += intel_pt_insn.length;
1675 +- if (!decoder->tnt.count)
1676 ++ if (!decoder->tnt.count) {
1677 ++ decoder->sample_timestamp = decoder->timestamp;
1678 ++ decoder->sample_insn_cnt = decoder->timestamp_insn_cnt;
1679 + return -EAGAIN;
1680 ++ }
1681 + decoder->tnt.payload <<= 1;
1682 + continue;
1683 + }
1684 +@@ -2146,6 +2162,7 @@ const struct intel_pt_state *intel_pt_decode(struct intel_pt_decoder *decoder)
1685 + err = intel_pt_walk_trace(decoder);
1686 + break;
1687 + case INTEL_PT_STATE_TNT:
1688 ++ case INTEL_PT_STATE_TNT_CONT:
1689 + err = intel_pt_walk_tnt(decoder);
1690 + if (err == -EAGAIN)
1691 + err = intel_pt_walk_trace(decoder);