Magellan Linux

Annotation of /trunk/kernel-alx/patches-5.4/0130-5.4.31-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3511 - (hide annotations) (download)
Mon May 11 14:36:37 2020 UTC (4 years, 1 month ago) by niro
File size: 43307 byte(s)
-linux-5.4.31
1 niro 3511 diff --git a/Makefile b/Makefile
2     index e1f41756f475..af28533919cc 100644
3     --- a/Makefile
4     +++ b/Makefile
5     @@ -1,7 +1,7 @@
6     # SPDX-License-Identifier: GPL-2.0
7     VERSION = 5
8     PATCHLEVEL = 4
9     -SUBLEVEL = 30
10     +SUBLEVEL = 31
11     EXTRAVERSION =
12     NAME = Kleptomaniac Octopus
13    
14     diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c
15     index 415afaf479e7..0840c0f1bf2e 100644
16     --- a/drivers/extcon/extcon-axp288.c
17     +++ b/drivers/extcon/extcon-axp288.c
18     @@ -423,9 +423,40 @@ static int axp288_extcon_probe(struct platform_device *pdev)
19     /* Start charger cable type detection */
20     axp288_extcon_enable(info);
21    
22     + device_init_wakeup(dev, true);
23     + platform_set_drvdata(pdev, info);
24     +
25     + return 0;
26     +}
27     +
28     +static int __maybe_unused axp288_extcon_suspend(struct device *dev)
29     +{
30     + struct axp288_extcon_info *info = dev_get_drvdata(dev);
31     +
32     + if (device_may_wakeup(dev))
33     + enable_irq_wake(info->irq[VBUS_RISING_IRQ]);
34     +
35     return 0;
36     }
37    
38     +static int __maybe_unused axp288_extcon_resume(struct device *dev)
39     +{
40     + struct axp288_extcon_info *info = dev_get_drvdata(dev);
41     +
42     + /*
43     + * Wakeup when a charger is connected to do charger-type
44     + * connection and generate an extcon event which makes the
45     + * axp288 charger driver set the input current limit.
46     + */
47     + if (device_may_wakeup(dev))
48     + disable_irq_wake(info->irq[VBUS_RISING_IRQ]);
49     +
50     + return 0;
51     +}
52     +
53     +static SIMPLE_DEV_PM_OPS(axp288_extcon_pm_ops, axp288_extcon_suspend,
54     + axp288_extcon_resume);
55     +
56     static const struct platform_device_id axp288_extcon_table[] = {
57     { .name = "axp288_extcon" },
58     {},
59     @@ -437,6 +468,7 @@ static struct platform_driver axp288_extcon_driver = {
60     .id_table = axp288_extcon_table,
61     .driver = {
62     .name = "axp288_extcon",
63     + .pm = &axp288_extcon_pm_ops,
64     },
65     };
66    
67     diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
68     index 93b3500e522b..4f0f0de83293 100644
69     --- a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
70     +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
71     @@ -1375,7 +1375,7 @@ static int vcn_v1_0_set_clockgating_state(void *handle,
72    
73     if (enable) {
74     /* wait for STATUS to clear */
75     - if (vcn_v1_0_is_idle(handle))
76     + if (!vcn_v1_0_is_idle(handle))
77     return -EBUSY;
78     vcn_v1_0_enable_clock_gating(adev);
79     } else {
80     diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
81     index 0ab890c927ec..6dd2334dd5e6 100644
82     --- a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
83     +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
84     @@ -2879,6 +2879,17 @@ static bool retrieve_link_cap(struct dc_link *link)
85     sink_id.ieee_device_id,
86     sizeof(sink_id.ieee_device_id));
87    
88     + /* Quirk Apple MBP 2017 15" Retina panel: Wrong DP_MAX_LINK_RATE */
89     + {
90     + uint8_t str_mbp_2017[] = { 101, 68, 21, 101, 98, 97 };
91     +
92     + if ((link->dpcd_caps.sink_dev_id == 0x0010fa) &&
93     + !memcmp(link->dpcd_caps.sink_dev_id_str, str_mbp_2017,
94     + sizeof(str_mbp_2017))) {
95     + link->reported_link_cap.link_rate = 0x0c;
96     + }
97     + }
98     +
99     core_link_read_dpcd(
100     link,
101     DP_SINK_HW_REVISION_START,
102     diff --git a/drivers/gpu/drm/bochs/bochs_hw.c b/drivers/gpu/drm/bochs/bochs_hw.c
103     index e567bdfa2ab8..bb1391784caf 100644
104     --- a/drivers/gpu/drm/bochs/bochs_hw.c
105     +++ b/drivers/gpu/drm/bochs/bochs_hw.c
106     @@ -156,10 +156,8 @@ int bochs_hw_init(struct drm_device *dev)
107     size = min(size, mem);
108     }
109    
110     - if (pci_request_region(pdev, 0, "bochs-drm") != 0) {
111     - DRM_ERROR("Cannot request framebuffer\n");
112     - return -EBUSY;
113     - }
114     + if (pci_request_region(pdev, 0, "bochs-drm") != 0)
115     + DRM_WARN("Cannot request framebuffer, boot fb still active?\n");
116    
117     bochs->fb_map = ioremap(addr, size);
118     if (bochs->fb_map == NULL) {
119     diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
120     index f1c714acc280..3ff6fbd79b12 100644
121     --- a/drivers/i2c/busses/i2c-i801.c
122     +++ b/drivers/i2c/busses/i2c-i801.c
123     @@ -129,11 +129,6 @@
124     #define TCOBASE 0x050
125     #define TCOCTL 0x054
126    
127     -#define ACPIBASE 0x040
128     -#define ACPIBASE_SMI_OFF 0x030
129     -#define ACPICTRL 0x044
130     -#define ACPICTRL_EN 0x080
131     -
132     #define SBREG_BAR 0x10
133     #define SBREG_SMBCTRL 0xc6000c
134     #define SBREG_SMBCTRL_DNV 0xcf000c
135     @@ -1544,7 +1539,7 @@ i801_add_tco_spt(struct i801_priv *priv, struct pci_dev *pci_dev,
136     pci_bus_write_config_byte(pci_dev->bus, devfn, 0xe1, hidden);
137     spin_unlock(&p2sb_spinlock);
138    
139     - res = &tco_res[ICH_RES_MEM_OFF];
140     + res = &tco_res[1];
141     if (pci_dev->device == PCI_DEVICE_ID_INTEL_DNV_SMBUS)
142     res->start = (resource_size_t)base64_addr + SBREG_SMBCTRL_DNV;
143     else
144     @@ -1554,7 +1549,7 @@ i801_add_tco_spt(struct i801_priv *priv, struct pci_dev *pci_dev,
145     res->flags = IORESOURCE_MEM;
146    
147     return platform_device_register_resndata(&pci_dev->dev, "iTCO_wdt", -1,
148     - tco_res, 3, &spt_tco_platform_data,
149     + tco_res, 2, &spt_tco_platform_data,
150     sizeof(spt_tco_platform_data));
151     }
152    
153     @@ -1567,17 +1562,16 @@ static struct platform_device *
154     i801_add_tco_cnl(struct i801_priv *priv, struct pci_dev *pci_dev,
155     struct resource *tco_res)
156     {
157     - return platform_device_register_resndata(&pci_dev->dev, "iTCO_wdt", -1,
158     - tco_res, 2, &cnl_tco_platform_data,
159     - sizeof(cnl_tco_platform_data));
160     + return platform_device_register_resndata(&pci_dev->dev,
161     + "iTCO_wdt", -1, tco_res, 1, &cnl_tco_platform_data,
162     + sizeof(cnl_tco_platform_data));
163     }
164    
165     static void i801_add_tco(struct i801_priv *priv)
166     {
167     - u32 base_addr, tco_base, tco_ctl, ctrl_val;
168     struct pci_dev *pci_dev = priv->pci_dev;
169     - struct resource tco_res[3], *res;
170     - unsigned int devfn;
171     + struct resource tco_res[2], *res;
172     + u32 tco_base, tco_ctl;
173    
174     /* If we have ACPI based watchdog use that instead */
175     if (acpi_has_watchdog())
176     @@ -1592,30 +1586,15 @@ static void i801_add_tco(struct i801_priv *priv)
177     return;
178    
179     memset(tco_res, 0, sizeof(tco_res));
180     -
181     - res = &tco_res[ICH_RES_IO_TCO];
182     - res->start = tco_base & ~1;
183     - res->end = res->start + 32 - 1;
184     - res->flags = IORESOURCE_IO;
185     -
186     /*
187     - * Power Management registers.
188     + * Always populate the main iTCO IO resource here. The second entry
189     + * for NO_REBOOT MMIO is filled by the SPT specific function.
190     */
191     - devfn = PCI_DEVFN(PCI_SLOT(pci_dev->devfn), 2);
192     - pci_bus_read_config_dword(pci_dev->bus, devfn, ACPIBASE, &base_addr);
193     -
194     - res = &tco_res[ICH_RES_IO_SMI];
195     - res->start = (base_addr & ~1) + ACPIBASE_SMI_OFF;
196     - res->end = res->start + 3;
197     + res = &tco_res[0];
198     + res->start = tco_base & ~1;
199     + res->end = res->start + 32 - 1;
200     res->flags = IORESOURCE_IO;
201    
202     - /*
203     - * Enable the ACPI I/O space.
204     - */
205     - pci_bus_read_config_dword(pci_dev->bus, devfn, ACPICTRL, &ctrl_val);
206     - ctrl_val |= ACPICTRL_EN;
207     - pci_bus_write_config_dword(pci_dev->bus, devfn, ACPICTRL, ctrl_val);
208     -
209     if (priv->features & FEATURE_TCO_CNL)
210     priv->tco_pdev = i801_add_tco_cnl(priv, pci_dev, tco_res);
211     else
212     diff --git a/drivers/infiniband/hw/hfi1/user_sdma.c b/drivers/infiniband/hw/hfi1/user_sdma.c
213     index c2f0d9ba93de..13e4203497b3 100644
214     --- a/drivers/infiniband/hw/hfi1/user_sdma.c
215     +++ b/drivers/infiniband/hw/hfi1/user_sdma.c
216     @@ -141,6 +141,7 @@ static int defer_packet_queue(
217     */
218     xchg(&pq->state, SDMA_PKT_Q_DEFERRED);
219     if (list_empty(&pq->busy.list)) {
220     + pq->busy.lock = &sde->waitlock;
221     iowait_get_priority(&pq->busy);
222     iowait_queue(pkts_sent, &pq->busy, &sde->dmawait);
223     }
224     @@ -155,6 +156,7 @@ static void activate_packet_queue(struct iowait *wait, int reason)
225     {
226     struct hfi1_user_sdma_pkt_q *pq =
227     container_of(wait, struct hfi1_user_sdma_pkt_q, busy);
228     + pq->busy.lock = NULL;
229     xchg(&pq->state, SDMA_PKT_Q_ACTIVE);
230     wake_up(&wait->wait_dma);
231     };
232     @@ -256,6 +258,21 @@ pq_reqs_nomem:
233     return ret;
234     }
235    
236     +static void flush_pq_iowait(struct hfi1_user_sdma_pkt_q *pq)
237     +{
238     + unsigned long flags;
239     + seqlock_t *lock = pq->busy.lock;
240     +
241     + if (!lock)
242     + return;
243     + write_seqlock_irqsave(lock, flags);
244     + if (!list_empty(&pq->busy.list)) {
245     + list_del_init(&pq->busy.list);
246     + pq->busy.lock = NULL;
247     + }
248     + write_sequnlock_irqrestore(lock, flags);
249     +}
250     +
251     int hfi1_user_sdma_free_queues(struct hfi1_filedata *fd,
252     struct hfi1_ctxtdata *uctxt)
253     {
254     @@ -281,6 +298,7 @@ int hfi1_user_sdma_free_queues(struct hfi1_filedata *fd,
255     kfree(pq->reqs);
256     kfree(pq->req_in_use);
257     kmem_cache_destroy(pq->txreq_cache);
258     + flush_pq_iowait(pq);
259     kfree(pq);
260     } else {
261     spin_unlock(&fd->pq_rcu_lock);
262     @@ -587,11 +605,12 @@ int hfi1_user_sdma_process_request(struct hfi1_filedata *fd,
263     if (ret < 0) {
264     if (ret != -EBUSY)
265     goto free_req;
266     - wait_event_interruptible_timeout(
267     + if (wait_event_interruptible_timeout(
268     pq->busy.wait_dma,
269     - (pq->state == SDMA_PKT_Q_ACTIVE),
270     + pq->state == SDMA_PKT_Q_ACTIVE,
271     msecs_to_jiffies(
272     - SDMA_IOWAIT_TIMEOUT));
273     + SDMA_IOWAIT_TIMEOUT)) <= 0)
274     + flush_pq_iowait(pq);
275     }
276     }
277     *count += idx;
278     diff --git a/drivers/md/dm.c b/drivers/md/dm.c
279     index cf71a2277d60..1e6e0c970e19 100644
280     --- a/drivers/md/dm.c
281     +++ b/drivers/md/dm.c
282     @@ -1760,8 +1760,9 @@ static blk_qc_t dm_process_bio(struct mapped_device *md,
283     * won't be imposed.
284     */
285     if (current->bio_list) {
286     - blk_queue_split(md->queue, &bio);
287     - if (!is_abnormal_io(bio))
288     + if (is_abnormal_io(bio))
289     + blk_queue_split(md->queue, &bio);
290     + else
291     dm_queue_split(md, ti, &bio);
292     }
293    
294     diff --git a/drivers/misc/cardreader/rts5227.c b/drivers/misc/cardreader/rts5227.c
295     index 423fecc19fc4..3a9467aaa435 100644
296     --- a/drivers/misc/cardreader/rts5227.c
297     +++ b/drivers/misc/cardreader/rts5227.c
298     @@ -394,6 +394,7 @@ static const struct pcr_ops rts522a_pcr_ops = {
299     void rts522a_init_params(struct rtsx_pcr *pcr)
300     {
301     rts5227_init_params(pcr);
302     + pcr->ops = &rts522a_pcr_ops;
303     pcr->tx_initial_phase = SET_CLOCK_PHASE(20, 20, 11);
304     pcr->reg_pm_ctrl3 = RTS522A_PM_CTRL3;
305    
306     diff --git a/drivers/misc/mei/hw-me-regs.h b/drivers/misc/mei/hw-me-regs.h
307     index 69d9b1736bf9..e56dc4754064 100644
308     --- a/drivers/misc/mei/hw-me-regs.h
309     +++ b/drivers/misc/mei/hw-me-regs.h
310     @@ -87,6 +87,8 @@
311     #define MEI_DEV_ID_CMP_H 0x06e0 /* Comet Lake H */
312     #define MEI_DEV_ID_CMP_H_3 0x06e4 /* Comet Lake H 3 (iTouch) */
313    
314     +#define MEI_DEV_ID_CDF 0x18D3 /* Cedar Fork */
315     +
316     #define MEI_DEV_ID_ICP_LP 0x34E0 /* Ice Lake Point LP */
317    
318     #define MEI_DEV_ID_TGP_LP 0xA0E0 /* Tiger Lake Point LP */
319     diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c
320     index 309cb8a23381..75ab2ffbf235 100644
321     --- a/drivers/misc/mei/pci-me.c
322     +++ b/drivers/misc/mei/pci-me.c
323     @@ -109,6 +109,8 @@ static const struct pci_device_id mei_me_pci_tbl[] = {
324     {MEI_PCI_DEVICE(MEI_DEV_ID_MCC, MEI_ME_PCH12_CFG)},
325     {MEI_PCI_DEVICE(MEI_DEV_ID_MCC_4, MEI_ME_PCH8_CFG)},
326    
327     + {MEI_PCI_DEVICE(MEI_DEV_ID_CDF, MEI_ME_PCH8_CFG)},
328     +
329     /* required last entry */
330     {0, }
331     };
332     diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c
333     index 6e208a060a58..1154f0435b0a 100644
334     --- a/drivers/misc/pci_endpoint_test.c
335     +++ b/drivers/misc/pci_endpoint_test.c
336     @@ -98,6 +98,7 @@ struct pci_endpoint_test {
337     struct completion irq_raised;
338     int last_irq;
339     int num_irqs;
340     + int irq_type;
341     /* mutex to protect the ioctls */
342     struct mutex mutex;
343     struct miscdevice miscdev;
344     @@ -157,6 +158,7 @@ static void pci_endpoint_test_free_irq_vectors(struct pci_endpoint_test *test)
345     struct pci_dev *pdev = test->pdev;
346    
347     pci_free_irq_vectors(pdev);
348     + test->irq_type = IRQ_TYPE_UNDEFINED;
349     }
350    
351     static bool pci_endpoint_test_alloc_irq_vectors(struct pci_endpoint_test *test,
352     @@ -191,6 +193,8 @@ static bool pci_endpoint_test_alloc_irq_vectors(struct pci_endpoint_test *test,
353     irq = 0;
354     res = false;
355     }
356     +
357     + test->irq_type = type;
358     test->num_irqs = irq;
359    
360     return res;
361     @@ -330,6 +334,7 @@ static bool pci_endpoint_test_copy(struct pci_endpoint_test *test, size_t size)
362     dma_addr_t orig_dst_phys_addr;
363     size_t offset;
364     size_t alignment = test->alignment;
365     + int irq_type = test->irq_type;
366     u32 src_crc32;
367     u32 dst_crc32;
368    
369     @@ -426,6 +431,7 @@ static bool pci_endpoint_test_write(struct pci_endpoint_test *test, size_t size)
370     dma_addr_t orig_phys_addr;
371     size_t offset;
372     size_t alignment = test->alignment;
373     + int irq_type = test->irq_type;
374     u32 crc32;
375    
376     if (size > SIZE_MAX - alignment)
377     @@ -494,6 +500,7 @@ static bool pci_endpoint_test_read(struct pci_endpoint_test *test, size_t size)
378     dma_addr_t orig_phys_addr;
379     size_t offset;
380     size_t alignment = test->alignment;
381     + int irq_type = test->irq_type;
382     u32 crc32;
383    
384     if (size > SIZE_MAX - alignment)
385     @@ -555,7 +562,7 @@ static bool pci_endpoint_test_set_irq(struct pci_endpoint_test *test,
386     return false;
387     }
388    
389     - if (irq_type == req_irq_type)
390     + if (test->irq_type == req_irq_type)
391     return true;
392    
393     pci_endpoint_test_release_irq(test);
394     @@ -567,12 +574,10 @@ static bool pci_endpoint_test_set_irq(struct pci_endpoint_test *test,
395     if (!pci_endpoint_test_request_irq(test))
396     goto err;
397    
398     - irq_type = req_irq_type;
399     return true;
400    
401     err:
402     pci_endpoint_test_free_irq_vectors(test);
403     - irq_type = IRQ_TYPE_UNDEFINED;
404     return false;
405     }
406    
407     @@ -633,7 +638,7 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,
408     {
409     int err;
410     int id;
411     - char name[20];
412     + char name[24];
413     enum pci_barno bar;
414     void __iomem *base;
415     struct device *dev = &pdev->dev;
416     @@ -652,6 +657,7 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,
417     test->test_reg_bar = 0;
418     test->alignment = 0;
419     test->pdev = pdev;
420     + test->irq_type = IRQ_TYPE_UNDEFINED;
421    
422     if (no_msi)
423     irq_type = IRQ_TYPE_LEGACY;
424     diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.h b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.h
425     index a3efa29a4629..63116be6b1d6 100644
426     --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.h
427     +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.h
428     @@ -38,8 +38,8 @@ enum {
429    
430     enum {
431     MLX5E_TLS_PROGRESS_PARAMS_RECORD_TRACKER_STATE_START = 0,
432     - MLX5E_TLS_PROGRESS_PARAMS_RECORD_TRACKER_STATE_SEARCHING = 1,
433     - MLX5E_TLS_PROGRESS_PARAMS_RECORD_TRACKER_STATE_TRACKING = 2,
434     + MLX5E_TLS_PROGRESS_PARAMS_RECORD_TRACKER_STATE_TRACKING = 1,
435     + MLX5E_TLS_PROGRESS_PARAMS_RECORD_TRACKER_STATE_SEARCHING = 2,
436     };
437    
438     struct mlx5e_ktls_offload_context_tx {
439     diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c
440     index f260dd96873b..52a56622034a 100644
441     --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c
442     +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c
443     @@ -218,7 +218,7 @@ tx_sync_info_get(struct mlx5e_ktls_offload_context_tx *priv_tx,
444     * this packet was already acknowledged and its record info
445     * was released.
446     */
447     - ends_before = before(tcp_seq + datalen, tls_record_start_seq(record));
448     + ends_before = before(tcp_seq + datalen - 1, tls_record_start_seq(record));
449    
450     if (unlikely(tls_record_is_start_marker(record))) {
451     ret = ends_before ? MLX5E_KTLS_SYNC_SKIP_NO_DATA : MLX5E_KTLS_SYNC_FAIL;
452     diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
453     index a935993a3c51..d43247a95ce5 100644
454     --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
455     +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
456     @@ -1934,6 +1934,8 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes)
457     if (brcmf_sdio_hdparse(bus, bus->rxhdr, &rd_new,
458     BRCMF_SDIO_FT_NORMAL)) {
459     rd->len = 0;
460     + brcmf_sdio_rxfail(bus, true, true);
461     + sdio_release_host(bus->sdiodev->func1);
462     brcmu_pkt_buf_free_skb(pkt);
463     continue;
464     }
465     diff --git a/drivers/net/wireless/intel/iwlwifi/fw/dbg.c b/drivers/net/wireless/intel/iwlwifi/fw/dbg.c
466     index 386ca67ec7b4..cb5465d9c068 100644
467     --- a/drivers/net/wireless/intel/iwlwifi/fw/dbg.c
468     +++ b/drivers/net/wireless/intel/iwlwifi/fw/dbg.c
469     @@ -8,7 +8,7 @@
470     * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved.
471     * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
472     * Copyright(c) 2015 - 2017 Intel Deutschland GmbH
473     - * Copyright(c) 2018 - 2019 Intel Corporation
474     + * Copyright(c) 2018 - 2020 Intel Corporation
475     *
476     * This program is free software; you can redistribute it and/or modify
477     * it under the terms of version 2 of the GNU General Public License as
478     @@ -31,7 +31,7 @@
479     * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved.
480     * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
481     * Copyright(c) 2015 - 2017 Intel Deutschland GmbH
482     - * Copyright(c) 2018 - 2019 Intel Corporation
483     + * Copyright(c) 2018 - 2020 Intel Corporation
484     * All rights reserved.
485     *
486     * Redistribution and use in source and binary forms, with or without
487     @@ -1373,11 +1373,7 @@ static int iwl_dump_ini_rxf_iter(struct iwl_fw_runtime *fwrt,
488     goto out;
489     }
490    
491     - /*
492     - * region register have absolute value so apply rxf offset after
493     - * reading the registers
494     - */
495     - offs += rxf_data.offset;
496     + offs = rxf_data.offset;
497    
498     /* Lock fence */
499     iwl_write_prph_no_grab(fwrt->trans, RXF_SET_FENCE_MODE + offs, 0x1);
500     @@ -2315,10 +2311,7 @@ static void iwl_fw_dbg_collect_sync(struct iwl_fw_runtime *fwrt, u8 wk_idx)
501     goto out;
502     }
503    
504     - if (iwl_fw_dbg_stop_restart_recording(fwrt, &params, true)) {
505     - IWL_ERR(fwrt, "Failed to stop DBGC recording, aborting dump\n");
506     - goto out;
507     - }
508     + iwl_fw_dbg_stop_restart_recording(fwrt, &params, true);
509    
510     IWL_DEBUG_FW_INFO(fwrt, "WRT: Data collection start\n");
511     if (iwl_trans_dbg_ini_valid(fwrt->trans))
512     @@ -2484,14 +2477,14 @@ static int iwl_fw_dbg_restart_recording(struct iwl_trans *trans,
513     return 0;
514     }
515    
516     -int iwl_fw_dbg_stop_restart_recording(struct iwl_fw_runtime *fwrt,
517     - struct iwl_fw_dbg_params *params,
518     - bool stop)
519     +void iwl_fw_dbg_stop_restart_recording(struct iwl_fw_runtime *fwrt,
520     + struct iwl_fw_dbg_params *params,
521     + bool stop)
522     {
523     int ret = 0;
524    
525     if (test_bit(STATUS_FW_ERROR, &fwrt->trans->status))
526     - return 0;
527     + return;
528    
529     if (fw_has_capa(&fwrt->fw->ucode_capa,
530     IWL_UCODE_TLV_CAPA_DBG_SUSPEND_RESUME_CMD_SUPP))
531     @@ -2508,7 +2501,5 @@ int iwl_fw_dbg_stop_restart_recording(struct iwl_fw_runtime *fwrt,
532     iwl_fw_set_dbg_rec_on(fwrt);
533     }
534     #endif
535     -
536     - return ret;
537     }
538     IWL_EXPORT_SYMBOL(iwl_fw_dbg_stop_restart_recording);
539     diff --git a/drivers/net/wireless/intel/iwlwifi/fw/dbg.h b/drivers/net/wireless/intel/iwlwifi/fw/dbg.h
540     index e3b5dd34643f..2ac61629f46f 100644
541     --- a/drivers/net/wireless/intel/iwlwifi/fw/dbg.h
542     +++ b/drivers/net/wireless/intel/iwlwifi/fw/dbg.h
543     @@ -263,9 +263,9 @@ _iwl_fw_dbg_trigger_simple_stop(struct iwl_fw_runtime *fwrt,
544     _iwl_fw_dbg_trigger_simple_stop((fwrt), (wdev), \
545     iwl_fw_dbg_get_trigger((fwrt)->fw,\
546     (trig)))
547     -int iwl_fw_dbg_stop_restart_recording(struct iwl_fw_runtime *fwrt,
548     - struct iwl_fw_dbg_params *params,
549     - bool stop);
550     +void iwl_fw_dbg_stop_restart_recording(struct iwl_fw_runtime *fwrt,
551     + struct iwl_fw_dbg_params *params,
552     + bool stop);
553    
554     #ifdef CONFIG_IWLWIFI_DEBUGFS
555     static inline void iwl_fw_set_dbg_rec_on(struct iwl_fw_runtime *fwrt)
556     diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c
557     index 098d48153a38..24df3182ec9e 100644
558     --- a/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c
559     +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c
560     @@ -147,7 +147,11 @@ static u16 rs_fw_get_config_flags(struct iwl_mvm *mvm,
561     (vht_ena && (vht_cap->cap & IEEE80211_VHT_CAP_RXLDPC))))
562     flags |= IWL_TLC_MNG_CFG_FLAGS_LDPC_MSK;
563    
564     - /* consider our LDPC support in case of HE */
565     + /* consider LDPC support in case of HE */
566     + if (he_cap->has_he && (he_cap->he_cap_elem.phy_cap_info[1] &
567     + IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD))
568     + flags |= IWL_TLC_MNG_CFG_FLAGS_LDPC_MSK;
569     +
570     if (sband->iftype_data && sband->iftype_data->he_cap.has_he &&
571     !(sband->iftype_data->he_cap.he_cap_elem.phy_cap_info[1] &
572     IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD))
573     diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
574     index 4ff51da3b13f..73e8475ddc8a 100644
575     --- a/drivers/nvme/host/rdma.c
576     +++ b/drivers/nvme/host/rdma.c
577     @@ -850,9 +850,11 @@ out_free_tagset:
578     if (new)
579     blk_mq_free_tag_set(ctrl->ctrl.admin_tagset);
580     out_free_async_qe:
581     - nvme_rdma_free_qe(ctrl->device->dev, &ctrl->async_event_sqe,
582     - sizeof(struct nvme_command), DMA_TO_DEVICE);
583     - ctrl->async_event_sqe.data = NULL;
584     + if (ctrl->async_event_sqe.data) {
585     + nvme_rdma_free_qe(ctrl->device->dev, &ctrl->async_event_sqe,
586     + sizeof(struct nvme_command), DMA_TO_DEVICE);
587     + ctrl->async_event_sqe.data = NULL;
588     + }
589     out_free_queue:
590     nvme_rdma_free_queue(&ctrl->queues[0]);
591     return error;
592     diff --git a/drivers/nvmem/nvmem-sysfs.c b/drivers/nvmem/nvmem-sysfs.c
593     index 9e0c429cd08a..8759c4470012 100644
594     --- a/drivers/nvmem/nvmem-sysfs.c
595     +++ b/drivers/nvmem/nvmem-sysfs.c
596     @@ -56,6 +56,9 @@ static ssize_t bin_attr_nvmem_read(struct file *filp, struct kobject *kobj,
597    
598     count = round_down(count, nvmem->word_size);
599    
600     + if (!nvmem->reg_read)
601     + return -EPERM;
602     +
603     rc = nvmem->reg_read(nvmem->priv, pos, buf, count);
604    
605     if (rc)
606     @@ -90,6 +93,9 @@ static ssize_t bin_attr_nvmem_write(struct file *filp, struct kobject *kobj,
607    
608     count = round_down(count, nvmem->word_size);
609    
610     + if (!nvmem->reg_write)
611     + return -EPERM;
612     +
613     rc = nvmem->reg_write(nvmem->priv, pos, buf, count);
614    
615     if (rc)
616     diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
617     index 793412954529..e401f040f157 100644
618     --- a/drivers/pci/pci-sysfs.c
619     +++ b/drivers/pci/pci-sysfs.c
620     @@ -464,7 +464,8 @@ static ssize_t dev_rescan_store(struct device *dev,
621     }
622     return count;
623     }
624     -static DEVICE_ATTR_WO(dev_rescan);
625     +static struct device_attribute dev_attr_dev_rescan = __ATTR(rescan, 0200, NULL,
626     + dev_rescan_store);
627    
628     static ssize_t remove_store(struct device *dev, struct device_attribute *attr,
629     const char *buf, size_t count)
630     @@ -501,7 +502,8 @@ static ssize_t bus_rescan_store(struct device *dev,
631     }
632     return count;
633     }
634     -static DEVICE_ATTR_WO(bus_rescan);
635     +static struct device_attribute dev_attr_bus_rescan = __ATTR(rescan, 0200, NULL,
636     + bus_rescan_store);
637    
638     #if defined(CONFIG_PM) && defined(CONFIG_ACPI)
639     static ssize_t d3cold_allowed_store(struct device *dev,
640     diff --git a/drivers/power/supply/axp288_charger.c b/drivers/power/supply/axp288_charger.c
641     index 1bbba6bba673..cf4c67b2d235 100644
642     --- a/drivers/power/supply/axp288_charger.c
643     +++ b/drivers/power/supply/axp288_charger.c
644     @@ -21,6 +21,7 @@
645     #include <linux/property.h>
646     #include <linux/mfd/axp20x.h>
647     #include <linux/extcon.h>
648     +#include <linux/dmi.h>
649    
650     #define PS_STAT_VBUS_TRIGGER BIT(0)
651     #define PS_STAT_BAT_CHRG_DIR BIT(2)
652     @@ -545,6 +546,49 @@ out:
653     return IRQ_HANDLED;
654     }
655    
656     +/*
657     + * The HP Pavilion x2 10 series comes in a number of variants:
658     + * Bay Trail SoC + AXP288 PMIC, DMI_BOARD_NAME: "815D"
659     + * Cherry Trail SoC + AXP288 PMIC, DMI_BOARD_NAME: "813E"
660     + * Cherry Trail SoC + TI PMIC, DMI_BOARD_NAME: "827C" or "82F4"
661     + *
662     + * The variants with the AXP288 PMIC are all kinds of special:
663     + *
664     + * 1. All variants use a Type-C connector which the AXP288 does not support, so
665     + * when using a Type-C charger it is not recognized. Unlike most AXP288 devices,
666     + * this model actually has mostly working ACPI AC / Battery code, the ACPI code
667     + * "solves" this by simply setting the input_current_limit to 3A.
668     + * There are still some issues with the ACPI code, so we use this native driver,
669     + * and to solve the charging not working (500mA is not enough) issue we hardcode
670     + * the 3A input_current_limit like the ACPI code does.
671     + *
672     + * 2. If no charger is connected the machine boots with the vbus-path disabled.
673     + * Normally this is done when a 5V boost converter is active to avoid the PMIC
674     + * trying to charge from the 5V boost converter's output. This is done when
675     + * an OTG host cable is inserted and the ID pin on the micro-B receptacle is
676     + * pulled low and the ID pin has an ACPI event handler associated with it
677     + * which re-enables the vbus-path when the ID pin is pulled high when the
678     + * OTG host cable is removed. The Type-C connector has no ID pin, there is
679     + * no ID pin handler and there appears to be no 5V boost converter, so we
680     + * end up not charging because the vbus-path is disabled, until we unplug
681     + * the charger which automatically clears the vbus-path disable bit and then
682     + * on the second plug-in of the adapter we start charging. To solve the not
683     + * charging on first charger plugin we unconditionally enable the vbus-path at
684     + * probe on this model, which is safe since there is no 5V boost converter.
685     + */
686     +static const struct dmi_system_id axp288_hp_x2_dmi_ids[] = {
687     + {
688     + /*
689     + * Bay Trail model has "Hewlett-Packard" as sys_vendor, Cherry
690     + * Trail model has "HP", so we only match on product_name.
691     + */
692     + .matches = {
693     + DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion x2 Detachable"),
694     + },
695     + },
696     + {} /* Terminating entry */
697     +};
698     +
699     static void axp288_charger_extcon_evt_worker(struct work_struct *work)
700     {
701     struct axp288_chrg_info *info =
702     @@ -568,7 +612,11 @@ static void axp288_charger_extcon_evt_worker(struct work_struct *work)
703     }
704    
705     /* Determine cable/charger type */
706     - if (extcon_get_state(edev, EXTCON_CHG_USB_SDP) > 0) {
707     + if (dmi_check_system(axp288_hp_x2_dmi_ids)) {
708     + /* See comment above axp288_hp_x2_dmi_ids declaration */
709     + dev_dbg(&info->pdev->dev, "HP X2 with Type-C, setting inlmt to 3A\n");
710     + current_limit = 3000000;
711     + } else if (extcon_get_state(edev, EXTCON_CHG_USB_SDP) > 0) {
712     dev_dbg(&info->pdev->dev, "USB SDP charger is connected\n");
713     current_limit = 500000;
714     } else if (extcon_get_state(edev, EXTCON_CHG_USB_CDP) > 0) {
715     @@ -685,6 +733,13 @@ static int charger_init_hw_regs(struct axp288_chrg_info *info)
716     return ret;
717     }
718    
719     + if (dmi_check_system(axp288_hp_x2_dmi_ids)) {
720     + /* See comment above axp288_hp_x2_dmi_ids declaration */
721     + ret = axp288_charger_vbus_path_select(info, true);
722     + if (ret < 0)
723     + return ret;
724     + }
725     +
726     /* Read current charge voltage and current limit */
727     ret = regmap_read(info->regmap, AXP20X_CHRG_CTRL1, &val);
728     if (ret < 0) {
729     diff --git a/drivers/soc/mediatek/mtk-cmdq-helper.c b/drivers/soc/mediatek/mtk-cmdq-helper.c
730     index 3c82de5f9417..73a852b2f417 100644
731     --- a/drivers/soc/mediatek/mtk-cmdq-helper.c
732     +++ b/drivers/soc/mediatek/mtk-cmdq-helper.c
733     @@ -38,6 +38,7 @@ struct cmdq_client *cmdq_mbox_create(struct device *dev, int index, u32 timeout)
734     client->pkt_cnt = 0;
735     client->client.dev = dev;
736     client->client.tx_block = false;
737     + client->client.knows_txdone = true;
738     client->chan = mbox_request_channel(&client->client, index);
739    
740     if (IS_ERR(client->chan)) {
741     diff --git a/drivers/watchdog/iTCO_vendor.h b/drivers/watchdog/iTCO_vendor.h
742     index 0f7373ba10d5..69e92e692ae0 100644
743     --- a/drivers/watchdog/iTCO_vendor.h
744     +++ b/drivers/watchdog/iTCO_vendor.h
745     @@ -1,10 +1,12 @@
746     /* SPDX-License-Identifier: GPL-2.0 */
747     /* iTCO Vendor Specific Support hooks */
748     #ifdef CONFIG_ITCO_VENDOR_SUPPORT
749     +extern int iTCO_vendorsupport;
750     extern void iTCO_vendor_pre_start(struct resource *, unsigned int);
751     extern void iTCO_vendor_pre_stop(struct resource *);
752     extern int iTCO_vendor_check_noreboot_on(void);
753     #else
754     +#define iTCO_vendorsupport 0
755     #define iTCO_vendor_pre_start(acpibase, heartbeat) {}
756     #define iTCO_vendor_pre_stop(acpibase) {}
757     #define iTCO_vendor_check_noreboot_on() 1
758     diff --git a/drivers/watchdog/iTCO_vendor_support.c b/drivers/watchdog/iTCO_vendor_support.c
759     index 4f1b96f59349..cf0eaa04b064 100644
760     --- a/drivers/watchdog/iTCO_vendor_support.c
761     +++ b/drivers/watchdog/iTCO_vendor_support.c
762     @@ -39,8 +39,10 @@
763     /* Broken BIOS */
764     #define BROKEN_BIOS 911
765    
766     -static int vendorsupport;
767     -module_param(vendorsupport, int, 0);
768     +int iTCO_vendorsupport;
769     +EXPORT_SYMBOL(iTCO_vendorsupport);
770     +
771     +module_param_named(vendorsupport, iTCO_vendorsupport, int, 0);
772     MODULE_PARM_DESC(vendorsupport, "iTCO vendor specific support mode, default="
773     "0 (none), 1=SuperMicro Pent3, 911=Broken SMI BIOS");
774    
775     @@ -152,7 +154,7 @@ static void broken_bios_stop(struct resource *smires)
776     void iTCO_vendor_pre_start(struct resource *smires,
777     unsigned int heartbeat)
778     {
779     - switch (vendorsupport) {
780     + switch (iTCO_vendorsupport) {
781     case SUPERMICRO_OLD_BOARD:
782     supermicro_old_pre_start(smires);
783     break;
784     @@ -165,7 +167,7 @@ EXPORT_SYMBOL(iTCO_vendor_pre_start);
785    
786     void iTCO_vendor_pre_stop(struct resource *smires)
787     {
788     - switch (vendorsupport) {
789     + switch (iTCO_vendorsupport) {
790     case SUPERMICRO_OLD_BOARD:
791     supermicro_old_pre_stop(smires);
792     break;
793     @@ -178,7 +180,7 @@ EXPORT_SYMBOL(iTCO_vendor_pre_stop);
794    
795     int iTCO_vendor_check_noreboot_on(void)
796     {
797     - switch (vendorsupport) {
798     + switch (iTCO_vendorsupport) {
799     case SUPERMICRO_OLD_BOARD:
800     return 0;
801     default:
802     @@ -189,13 +191,13 @@ EXPORT_SYMBOL(iTCO_vendor_check_noreboot_on);
803    
804     static int __init iTCO_vendor_init_module(void)
805     {
806     - if (vendorsupport == SUPERMICRO_NEW_BOARD) {
807     + if (iTCO_vendorsupport == SUPERMICRO_NEW_BOARD) {
808     pr_warn("Option vendorsupport=%d is no longer supported, "
809     "please use the w83627hf_wdt driver instead\n",
810     SUPERMICRO_NEW_BOARD);
811     return -EINVAL;
812     }
813     - pr_info("vendor-support=%d\n", vendorsupport);
814     + pr_info("vendor-support=%d\n", iTCO_vendorsupport);
815     return 0;
816     }
817    
818     diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c
819     index 156360e37714..e707c4797f76 100644
820     --- a/drivers/watchdog/iTCO_wdt.c
821     +++ b/drivers/watchdog/iTCO_wdt.c
822     @@ -459,13 +459,25 @@ static int iTCO_wdt_probe(struct platform_device *pdev)
823     if (!p->tco_res)
824     return -ENODEV;
825    
826     - p->smi_res = platform_get_resource(pdev, IORESOURCE_IO, ICH_RES_IO_SMI);
827     - if (!p->smi_res)
828     - return -ENODEV;
829     -
830     p->iTCO_version = pdata->version;
831     p->pci_dev = to_pci_dev(dev->parent);
832    
833     + p->smi_res = platform_get_resource(pdev, IORESOURCE_IO, ICH_RES_IO_SMI);
834     + if (p->smi_res) {
835     + /* The TCO logic uses the TCO_EN bit in the SMI_EN register */
836     + if (!devm_request_region(dev, p->smi_res->start,
837     + resource_size(p->smi_res),
838     + pdev->name)) {
839     + pr_err("I/O address 0x%04llx already in use, device disabled\n",
840     + (u64)SMI_EN(p));
841     + return -EBUSY;
842     + }
843     + } else if (iTCO_vendorsupport ||
844     + turn_SMI_watchdog_clear_off >= p->iTCO_version) {
845     + pr_err("SMI I/O resource is missing\n");
846     + return -ENODEV;
847     + }
848     +
849     iTCO_wdt_no_reboot_bit_setup(p, pdata);
850    
851     /*
852     @@ -492,14 +504,6 @@ static int iTCO_wdt_probe(struct platform_device *pdev)
853     /* Set the NO_REBOOT bit to prevent later reboots, just for sure */
854     p->update_no_reboot_bit(p->no_reboot_priv, true);
855    
856     - /* The TCO logic uses the TCO_EN bit in the SMI_EN register */
857     - if (!devm_request_region(dev, p->smi_res->start,
858     - resource_size(p->smi_res),
859     - pdev->name)) {
860     - pr_err("I/O address 0x%04llx already in use, device disabled\n",
861     - (u64)SMI_EN(p));
862     - return -EBUSY;
863     - }
864     if (turn_SMI_watchdog_clear_off >= p->iTCO_version) {
865     /*
866     * Bit 13: TCO_EN -> 0
867     diff --git a/include/uapi/linux/coresight-stm.h b/include/uapi/linux/coresight-stm.h
868     index aac550a52f80..8847dbf24151 100644
869     --- a/include/uapi/linux/coresight-stm.h
870     +++ b/include/uapi/linux/coresight-stm.h
871     @@ -2,8 +2,10 @@
872     #ifndef __UAPI_CORESIGHT_STM_H_
873     #define __UAPI_CORESIGHT_STM_H_
874    
875     -#define STM_FLAG_TIMESTAMPED BIT(3)
876     -#define STM_FLAG_GUARANTEED BIT(7)
877     +#include <linux/const.h>
878     +
879     +#define STM_FLAG_TIMESTAMPED _BITUL(3)
880     +#define STM_FLAG_GUARANTEED _BITUL(7)
881    
882     /*
883     * The CoreSight STM supports guaranteed and invariant timing
884     diff --git a/kernel/padata.c b/kernel/padata.c
885     index fda7a7039422..c4b774331e46 100644
886     --- a/kernel/padata.c
887     +++ b/kernel/padata.c
888     @@ -516,7 +516,7 @@ static int padata_replace(struct padata_instance *pinst)
889     {
890     int notification_mask = 0;
891     struct padata_shell *ps;
892     - int err;
893     + int err = 0;
894    
895     pinst->flags |= PADATA_RESET;
896    
897     @@ -643,8 +643,8 @@ int padata_set_cpumask(struct padata_instance *pinst, int cpumask_type,
898     struct cpumask *serial_mask, *parallel_mask;
899     int err = -EINVAL;
900    
901     - mutex_lock(&pinst->lock);
902     get_online_cpus();
903     + mutex_lock(&pinst->lock);
904    
905     switch (cpumask_type) {
906     case PADATA_CPU_PARALLEL:
907     @@ -662,8 +662,8 @@ int padata_set_cpumask(struct padata_instance *pinst, int cpumask_type,
908     err = __padata_set_cpumasks(pinst, parallel_mask, serial_mask);
909    
910     out:
911     - put_online_cpus();
912     mutex_unlock(&pinst->lock);
913     + put_online_cpus();
914    
915     return err;
916     }
917     diff --git a/lib/test_xarray.c b/lib/test_xarray.c
918     index 55c14e8c8859..8c7d7a8468b8 100644
919     --- a/lib/test_xarray.c
920     +++ b/lib/test_xarray.c
921     @@ -12,6 +12,9 @@
922     static unsigned int tests_run;
923     static unsigned int tests_passed;
924    
925     +static const unsigned int order_limit =
926     + IS_ENABLED(CONFIG_XARRAY_MULTI) ? BITS_PER_LONG : 1;
927     +
928     #ifndef XA_DEBUG
929     # ifdef __KERNEL__
930     void xa_dump(const struct xarray *xa) { }
931     @@ -959,6 +962,20 @@ static noinline void check_multi_find_2(struct xarray *xa)
932     }
933     }
934    
935     +static noinline void check_multi_find_3(struct xarray *xa)
936     +{
937     + unsigned int order;
938     +
939     + for (order = 5; order < order_limit; order++) {
940     + unsigned long index = 1UL << (order - 5);
941     +
942     + XA_BUG_ON(xa, !xa_empty(xa));
943     + xa_store_order(xa, 0, order - 4, xa_mk_index(0), GFP_KERNEL);
944     + XA_BUG_ON(xa, xa_find_after(xa, &index, ULONG_MAX, XA_PRESENT));
945     + xa_erase_index(xa, 0);
946     + }
947     +}
948     +
949     static noinline void check_find_1(struct xarray *xa)
950     {
951     unsigned long i, j, k;
952     @@ -1081,6 +1098,7 @@ static noinline void check_find(struct xarray *xa)
953     for (i = 2; i < 10; i++)
954     check_multi_find_1(xa, i);
955     check_multi_find_2(xa);
956     + check_multi_find_3(xa);
957     }
958    
959     /* See find_swap_entry() in mm/shmem.c */
960     diff --git a/lib/xarray.c b/lib/xarray.c
961     index 1d9fab7db8da..acd1fad2e862 100644
962     --- a/lib/xarray.c
963     +++ b/lib/xarray.c
964     @@ -1839,7 +1839,8 @@ static bool xas_sibling(struct xa_state *xas)
965     if (!node)
966     return false;
967     mask = (XA_CHUNK_SIZE << node->shift) - 1;
968     - return (xas->xa_index & mask) > (xas->xa_offset << node->shift);
969     + return (xas->xa_index & mask) >
970     + ((unsigned long)xas->xa_offset << node->shift);
971     }
972    
973     /**
974     diff --git a/mm/mempolicy.c b/mm/mempolicy.c
975     index fbb3258af275..787c5fc91b21 100644
976     --- a/mm/mempolicy.c
977     +++ b/mm/mempolicy.c
978     @@ -2822,7 +2822,9 @@ int mpol_parse_str(char *str, struct mempolicy **mpol)
979     switch (mode) {
980     case MPOL_PREFERRED:
981     /*
982     - * Insist on a nodelist of one node only
983     + * Insist on a nodelist of one node only, although later
984     + * we use first_node(nodes) to grab a single node, so here
985     + * nodelist (or nodes) cannot be empty.
986     */
987     if (nodelist) {
988     char *rest = nodelist;
989     @@ -2830,6 +2832,8 @@ int mpol_parse_str(char *str, struct mempolicy **mpol)
990     rest++;
991     if (*rest)
992     goto out;
993     + if (nodes_empty(nodes))
994     + goto out;
995     }
996     break;
997     case MPOL_INTERLEAVE:
998     diff --git a/net/core/dev.c b/net/core/dev.c
999     index 931dfdcbabf1..c19c424197e3 100644
1000     --- a/net/core/dev.c
1001     +++ b/net/core/dev.c
1002     @@ -2795,6 +2795,8 @@ static u16 skb_tx_hash(const struct net_device *dev,
1003    
1004     if (skb_rx_queue_recorded(skb)) {
1005     hash = skb_get_rx_queue(skb);
1006     + if (hash >= qoffset)
1007     + hash -= qoffset;
1008     while (unlikely(hash >= qcount))
1009     hash -= qcount;
1010     return hash + qoffset;
1011     diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
1012     index 6f7155d91313..5af22c9712a6 100644
1013     --- a/net/ipv4/tcp_input.c
1014     +++ b/net/ipv4/tcp_input.c
1015     @@ -6096,7 +6096,11 @@ static void tcp_rcv_synrecv_state_fastopen(struct sock *sk)
1016     {
1017     struct request_sock *req;
1018    
1019     - tcp_try_undo_loss(sk, false);
1020     + /* If we are still handling the SYNACK RTO, see if timestamp ECR allows
1021     + * undo. If peer SACKs triggered fast recovery, we can't undo here.
1022     + */
1023     + if (inet_csk(sk)->icsk_ca_state == TCP_CA_Loss)
1024     + tcp_try_undo_loss(sk, false);
1025    
1026     /* Reset rtx states to prevent spurious retransmits_timed_out() */
1027     tcp_sk(sk)->retrans_stamp = 0;
1028     diff --git a/net/rxrpc/sendmsg.c b/net/rxrpc/sendmsg.c
1029     index 813fd6888142..136eb465bfcb 100644
1030     --- a/net/rxrpc/sendmsg.c
1031     +++ b/net/rxrpc/sendmsg.c
1032     @@ -58,8 +58,8 @@ static int rxrpc_wait_for_tx_window_nonintr(struct rxrpc_sock *rx,
1033    
1034     rtt = READ_ONCE(call->peer->rtt);
1035     rtt2 = nsecs_to_jiffies64(rtt) * 2;
1036     - if (rtt2 < 1)
1037     - rtt2 = 1;
1038     + if (rtt2 < 2)
1039     + rtt2 = 2;
1040    
1041     timeout = rtt2;
1042     tx_start = READ_ONCE(call->tx_hard_ack);
1043     diff --git a/scripts/Kconfig.include b/scripts/Kconfig.include
1044     index bfb44b265a94..77a69ba9cd19 100644
1045     --- a/scripts/Kconfig.include
1046     +++ b/scripts/Kconfig.include
1047     @@ -40,3 +40,10 @@ $(error-if,$(success, $(LD) -v | grep -q gold), gold linker '$(LD)' not supporte
1048    
1049     # gcc version including patch level
1050     gcc-version := $(shell,$(srctree)/scripts/gcc-version.sh $(CC))
1051     +
1052     +# machine bit flags
1053     +# $(m32-flag): -m32 if the compiler supports it, or an empty string otherwise.
1054     +# $(m64-flag): -m64 if the compiler supports it, or an empty string otherwise.
1055     +cc-option-bit = $(if-success,$(CC) -Werror $(1) -E -x c /dev/null -o /dev/null,$(1))
1056     +m32-flag := $(cc-option-bit,-m32)
1057     +m64-flag := $(cc-option-bit,-m64)
1058     diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c
1059     index 32ed46464af7..adad3651889e 100644
1060     --- a/sound/pci/hda/patch_ca0132.c
1061     +++ b/sound/pci/hda/patch_ca0132.c
1062     @@ -1180,6 +1180,7 @@ static const struct snd_pci_quirk ca0132_quirks[] = {
1063     SND_PCI_QUIRK(0x1458, 0xA016, "Recon3Di", QUIRK_R3DI),
1064     SND_PCI_QUIRK(0x1458, 0xA026, "Gigabyte G1.Sniper Z97", QUIRK_R3DI),
1065     SND_PCI_QUIRK(0x1458, 0xA036, "Gigabyte GA-Z170X-Gaming 7", QUIRK_R3DI),
1066     + SND_PCI_QUIRK(0x3842, 0x1038, "EVGA X99 Classified", QUIRK_R3DI),
1067     SND_PCI_QUIRK(0x1102, 0x0013, "Recon3D", QUIRK_R3D),
1068     SND_PCI_QUIRK(0x1102, 0x0051, "Sound Blaster AE-5", QUIRK_AE5),
1069     {}
1070     diff --git a/tools/power/x86/turbostat/Makefile b/tools/power/x86/turbostat/Makefile
1071     index 13f1e8b9ac52..2b6551269e43 100644
1072     --- a/tools/power/x86/turbostat/Makefile
1073     +++ b/tools/power/x86/turbostat/Makefile
1074     @@ -16,7 +16,7 @@ override CFLAGS += -D_FORTIFY_SOURCE=2
1075    
1076     %: %.c
1077     @mkdir -p $(BUILD_OUTPUT)
1078     - $(CC) $(CFLAGS) $< -o $(BUILD_OUTPUT)/$@ $(LDFLAGS)
1079     + $(CC) $(CFLAGS) $< -o $(BUILD_OUTPUT)/$@ $(LDFLAGS) -lcap
1080    
1081     .PHONY : clean
1082     clean :
1083     diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
1084     index 5d0fddda842c..988326b67a91 100644
1085     --- a/tools/power/x86/turbostat/turbostat.c
1086     +++ b/tools/power/x86/turbostat/turbostat.c
1087     @@ -30,7 +30,7 @@
1088     #include <sched.h>
1089     #include <time.h>
1090     #include <cpuid.h>
1091     -#include <linux/capability.h>
1092     +#include <sys/capability.h>
1093     #include <errno.h>
1094     #include <math.h>
1095    
1096     @@ -304,6 +304,10 @@ int *irqs_per_cpu; /* indexed by cpu_num */
1097    
1098     void setup_all_buffers(void);
1099    
1100     +char *sys_lpi_file;
1101     +char *sys_lpi_file_sysfs = "/sys/devices/system/cpu/cpuidle/low_power_idle_system_residency_us";
1102     +char *sys_lpi_file_debugfs = "/sys/kernel/debug/pmc_core/slp_s0_residency_usec";
1103     +
1104     int cpu_is_not_present(int cpu)
1105     {
1106     return !CPU_ISSET_S(cpu, cpu_present_setsize, cpu_present_set);
1107     @@ -2916,8 +2920,6 @@ int snapshot_gfx_mhz(void)
1108     *
1109     * record snapshot of
1110     * /sys/devices/system/cpu/cpuidle/low_power_idle_cpu_residency_us
1111     - *
1112     - * return 1 if config change requires a restart, else return 0
1113     */
1114     int snapshot_cpu_lpi_us(void)
1115     {
1116     @@ -2941,17 +2943,14 @@ int snapshot_cpu_lpi_us(void)
1117     /*
1118     * snapshot_sys_lpi()
1119     *
1120     - * record snapshot of
1121     - * /sys/devices/system/cpu/cpuidle/low_power_idle_system_residency_us
1122     - *
1123     - * return 1 if config change requires a restart, else return 0
1124     + * record snapshot of sys_lpi_file
1125     */
1126     int snapshot_sys_lpi_us(void)
1127     {
1128     FILE *fp;
1129     int retval;
1130    
1131     - fp = fopen_or_die("/sys/devices/system/cpu/cpuidle/low_power_idle_system_residency_us", "r");
1132     + fp = fopen_or_die(sys_lpi_file, "r");
1133    
1134     retval = fscanf(fp, "%lld", &cpuidle_cur_sys_lpi_us);
1135     if (retval != 1) {
1136     @@ -3151,28 +3150,42 @@ void check_dev_msr()
1137     err(-5, "no /dev/cpu/0/msr, Try \"# modprobe msr\" ");
1138     }
1139    
1140     -void check_permissions()
1141     +/*
1142     + * check for CAP_SYS_RAWIO
1143     + * return 0 on success
1144     + * return 1 on fail
1145     + */
1146     +int check_for_cap_sys_rawio(void)
1147     {
1148     - struct __user_cap_header_struct cap_header_data;
1149     - cap_user_header_t cap_header = &cap_header_data;
1150     - struct __user_cap_data_struct cap_data_data;
1151     - cap_user_data_t cap_data = &cap_data_data;
1152     - extern int capget(cap_user_header_t hdrp, cap_user_data_t datap);
1153     - int do_exit = 0;
1154     - char pathname[32];
1155     + cap_t caps;
1156     + cap_flag_value_t cap_flag_value;
1157    
1158     - /* check for CAP_SYS_RAWIO */
1159     - cap_header->pid = getpid();
1160     - cap_header->version = _LINUX_CAPABILITY_VERSION;
1161     - if (capget(cap_header, cap_data) < 0)
1162     - err(-6, "capget(2) failed");
1163     + caps = cap_get_proc();
1164     + if (caps == NULL)
1165     + err(-6, "cap_get_proc\n");
1166    
1167     - if ((cap_data->effective & (1 << CAP_SYS_RAWIO)) == 0) {
1168     - do_exit++;
1169     + if (cap_get_flag(caps, CAP_SYS_RAWIO, CAP_EFFECTIVE, &cap_flag_value))
1170     + err(-6, "cap_get\n");
1171     +
1172     + if (cap_flag_value != CAP_SET) {
1173     warnx("capget(CAP_SYS_RAWIO) failed,"
1174     " try \"# setcap cap_sys_rawio=ep %s\"", progname);
1175     + return 1;
1176     }
1177    
1178     + if (cap_free(caps) == -1)
1179     + err(-6, "cap_free\n");
1180     +
1181     + return 0;
1182     +}
1183     +void check_permissions(void)
1184     +{
1185     + int do_exit = 0;
1186     + char pathname[32];
1187     +
1188     + /* check for CAP_SYS_RAWIO */
1189     + do_exit += check_for_cap_sys_rawio();
1190     +
1191     /* test file permissions */
1192     sprintf(pathname, "/dev/cpu/%d/msr", base_cpu);
1193     if (euidaccess(pathname, R_OK)) {
1194     @@ -4907,10 +4920,16 @@ void process_cpuid()
1195     else
1196     BIC_NOT_PRESENT(BIC_CPU_LPI);
1197    
1198     - if (!access("/sys/devices/system/cpu/cpuidle/low_power_idle_system_residency_us", R_OK))
1199     + if (!access(sys_lpi_file_sysfs, R_OK)) {
1200     + sys_lpi_file = sys_lpi_file_sysfs;
1201     BIC_PRESENT(BIC_SYS_LPI);
1202     - else
1203     + } else if (!access(sys_lpi_file_debugfs, R_OK)) {
1204     + sys_lpi_file = sys_lpi_file_debugfs;
1205     + BIC_PRESENT(BIC_SYS_LPI);
1206     + } else {
1207     + sys_lpi_file_sysfs = NULL;
1208     BIC_NOT_PRESENT(BIC_SYS_LPI);
1209     + }
1210    
1211     if (!quiet)
1212     decode_misc_feature_control();
1213     @@ -5323,9 +5342,9 @@ int add_counter(unsigned int msr_num, char *path, char *name,
1214     }
1215    
1216     msrp->msr_num = msr_num;
1217     - strncpy(msrp->name, name, NAME_BYTES);
1218     + strncpy(msrp->name, name, NAME_BYTES - 1);
1219     if (path)
1220     - strncpy(msrp->path, path, PATH_BYTES);
1221     + strncpy(msrp->path, path, PATH_BYTES - 1);
1222     msrp->width = width;
1223     msrp->type = type;
1224     msrp->format = format;
1225     diff --git a/usr/Kconfig b/usr/Kconfig
1226     index a6b68503d177..a80cc7972274 100644
1227     --- a/usr/Kconfig
1228     +++ b/usr/Kconfig
1229     @@ -131,17 +131,6 @@ choice
1230    
1231     If in doubt, select 'None'
1232    
1233     -config INITRAMFS_COMPRESSION_NONE
1234     - bool "None"
1235     - help
1236     - Do not compress the built-in initramfs at all. This may sound wasteful
1237     - in space, but, you should be aware that the built-in initramfs will be
1238     - compressed at a later stage anyways along with the rest of the kernel,
1239     - on those architectures that support this. However, not compressing the
1240     - initramfs may lead to slightly higher memory consumption during a
1241     - short time at boot, while both the cpio image and the unpacked
1242     - filesystem image will be present in memory simultaneously
1243     -
1244     config INITRAMFS_COMPRESSION_GZIP
1245     bool "Gzip"
1246     depends on RD_GZIP
1247     @@ -214,6 +203,17 @@ config INITRAMFS_COMPRESSION_LZ4
1248     If you choose this, keep in mind that most distros don't provide lz4
1249     by default which could cause a build failure.
1250    
1251     +config INITRAMFS_COMPRESSION_NONE
1252     + bool "None"
1253     + help
1254     + Do not compress the built-in initramfs at all. This may sound wasteful
1255     + in space, but, you should be aware that the built-in initramfs will be
1256     + compressed at a later stage anyways along with the rest of the kernel,
1257     + on those architectures that support this. However, not compressing the
1258     + initramfs may lead to slightly higher memory consumption during a
1259     + short time at boot, while both the cpio image and the unpacked
1260     + filesystem image will be present in memory simultaneously
1261     +
1262     endchoice
1263    
1264     config INITRAMFS_COMPRESSION