Magellan Linux

Annotation of /trunk/kernel-alx/patches-4.9/0278-4.9.179-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


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