From: Greg Kroah-Hartman Date: Thu, 22 Mar 2018 13:29:16 +0000 (+0100) Subject: 4.14-stable patches X-Git-Tag: v3.18.102~19 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c44fe31c2e723774fe31e2c5d06a197f16a63688;p=thirdparty%2Fkernel%2Fstable-queue.git 4.14-stable patches added patches: arm-dts-aspeed-evb-add-unit-name-to-memory-node.patch ath10k-handling-qos-at-sta-side-based-on-ap-wmm-enable-disable.patch bluetooth-btqcomsmd-fix-skb-double-free-corruption.patch bluetooth-hci_qca-avoid-setup-failure-on-missing-rampatch.patch clk-at91-pmc-wait-for-clocks-when-resuming.patch clk-axi-clkgen-correctly-handle-nocount-bit-in-recalc_rate.patch clk-don-t-touch-hardware-when-reparenting-during-registration.patch clk-si5351-rename-internal-plls-to-avoid-name-collisions.patch coresight-fix-disabling-of-coresight-tpiu.patch cpufreq-longhaul-revert-transition_delay_us-to-200-ms.patch cros_ec-fix-nul-termination-for-firmware-build-info.patch crypto-artpec6-set-correct-iv-size-for-gcm-aes.patch dev-mem-add-bounce-buffer-for-copy-out.patch dm-ensure-bio-submission-follows-a-depth-first-tree-walk.patch dmaengine-ti-dma-crossbar-fix-event-mapping-for-tpcc_evt_mux_60_63.patch dmaengine-zynqmp_dma-fix-race-condition-in-the-probe.patch drm-msm-fix-leak-in-failed-get_pages.patch drm-omap-dmm-check-for-dmm-readiness-after-successful-transaction-commit.patch drm-tilcdc-ensure-nonatomic-iowrite64-is-not-used.patch hv_netvsc-fix-the-receive-buffer-size-limit.patch hv_netvsc-fix-the-tx-rx-buffer-default-sizes.patch ib-ipoib-avoid-memory-leak-if-the-sa-returns-a-different-dgid.patch ib-umem-fix-use-of-npages-nmap-fields.patch iommu-vt-d-clean-up-pr_irq-if-request_threaded_irq-fails.patch ip6_vti-adjust-vti-mtu-according-to-mtu-of-lower-device.patch ip_gre-fix-error-path-when-erspan_rcv-failed.patch ip_gre-fix-potential-memory-leak-in-erspan_rcv.patch iser-target-avoid-reinitializing-rdma-contexts-for-isert-commands.patch media-bt8xx-fix-err-bt878_probe.patch media-c8sectpfe-fix-potential-null-pointer-dereference-in-c8sectpfe_timer_interrupt.patch media-davinci-fix-a-debug-printk.patch media-media-dvb-frontends-add-delay-to-si2168-restart.patch media-s5p-mfc-fix-lock-contention-request_firmware-once.patch mmc-avoid-removing-non-removable-hosts-during-suspend.patch mmc-block-fix-logical-error-to-avoid-memory-leak.patch mmc-sdhci-xenon-wait-5ms-after-set-1.8v-signal-enable.patch net-fec-add-phy_reset_after_clk_enable-support.patch net-phy-meson-gxl-check-phy_write-return-value.patch nfsd4-permit-layoutget-of-executable-only-files.patch omapdrm-panel-fix-compatible-vendor-string-for-td028ttec1.patch pci-designware-ep-fix-get_msi-to-check-msi_en-bit.patch pci-endpoint-fix-find_first_zero_bit-usage.patch pci-rcar-handle-rcar_pcie_parse_request_of_pci_ranges-failures.patch pinctrl-really-force-states-during-suspend-resume.patch pinctrl-rockchip-enable-clock-when-reading-pin-direction-register.patch platform-chrome-use-proper-protocol-transfer-function.patch pty-cancel-pty-slave-port-buf-s-work-in-tty_release.patch qmi_wwan-set-flag_send_zlp-to-avoid-network-initiated-disconnect.patch rdma-cma-use-correct-size-when-writing-netlink-stats.patch rdma-iwpm-fix-uninitialized-error-code-in-iwpm_send_mapinfo.patch rdma-ocrdma-fix-permissions-for-ocrdma_reset_stats.patch rtc-ac100-fix-multiple-race-conditions.patch rtlwifi-always-initialize-variables-given-to-rt_trace.patch rtlwifi-rtl_pci-fix-the-bug-when-inactiveps-is-enabled.patch scsi-lpfc-fix-issues-connecting-with-nvme-initiator.patch scsi-lpfc-fix-scsi-lun-discovery-when-scsi-and-nvme-enabled.patch serial-8250_dw-disable-clock-on-error.patch sfp-fix-eeprom-reading-in-the-case-of-non-sff8472-sfps.patch sfp-fix-non-detection-of-phy.patch soc-qcom-smsm-fix-child-node-lookup.patch spi-sh-msiof-avoid-writing-to-registers-from-spi_master.setup.patch tty-goldfish-enable-earlycon-only-if-built-in.patch vgacon-set-vga-struct-resource-types.patch watchdog-fix-kref-imbalance-seen-if-handle_boot_enabled-0.patch watchdog-fix-potential-kref-imbalance-when-opening-watchdog.patch --- diff --git a/queue-4.14/arm-dts-aspeed-evb-add-unit-name-to-memory-node.patch b/queue-4.14/arm-dts-aspeed-evb-add-unit-name-to-memory-node.patch new file mode 100644 index 00000000000..4455efb2dc1 --- /dev/null +++ b/queue-4.14/arm-dts-aspeed-evb-add-unit-name-to-memory-node.patch @@ -0,0 +1,32 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Joel Stanley +Date: Mon, 18 Dec 2017 23:27:03 +1030 +Subject: ARM: dts: aspeed-evb: Add unit name to memory node + +From: Joel Stanley + + +[ Upstream commit e40ed274489a5f516da120186578eb379b452ac6 ] + +Fixes a warning when building with W=1. + +All of the ASPEED device trees build without warnings now. + +Signed-off-by: Joel Stanley +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + arch/arm/boot/dts/aspeed-ast2500-evb.dts | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/arm/boot/dts/aspeed-ast2500-evb.dts ++++ b/arch/arm/boot/dts/aspeed-ast2500-evb.dts +@@ -16,7 +16,7 @@ + bootargs = "console=ttyS4,115200 earlyprintk"; + }; + +- memory { ++ memory@80000000 { + reg = <0x80000000 0x20000000>; + }; + }; diff --git a/queue-4.14/ath10k-handling-qos-at-sta-side-based-on-ap-wmm-enable-disable.patch b/queue-4.14/ath10k-handling-qos-at-sta-side-based-on-ap-wmm-enable-disable.patch new file mode 100644 index 00000000000..6310eb9afda --- /dev/null +++ b/queue-4.14/ath10k-handling-qos-at-sta-side-based-on-ap-wmm-enable-disable.patch @@ -0,0 +1,45 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Balaji Pothunoori +Date: Thu, 7 Dec 2017 16:58:04 +0200 +Subject: ath10k: handling qos at STA side based on AP WMM enable/disable + +From: Balaji Pothunoori + + +[ Upstream commit 07ffb4497360ae8789f05555fec8171ee952304d ] + +Data packets are not sent by STA in case of STA joined to +non QOS AP (WMM disabled AP). This is happening because of STA +is sending data packets to firmware from host with qos enabled +along with non qos queue value(TID = 16). +Due to qos enabled, firmware is discarding the packet. + +This patch fixes this issue by updating the qos based on station +WME capability field if WMM is disabled in AP. + +This patch is required by 10.4 family chipsets like +QCA4019/QCA9888/QCA9884/QCA99X0. +Firmware Versoin : 10.4-3.5.1-00018. + +For 10.2.4 family chipsets QCA988X/QCA9887 and QCA6174 this patch +has no effect. + +Signed-off-by: Balaji Pothunoori +Signed-off-by: Kalle Valo +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/wireless/ath/ath10k/mac.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/ath/ath10k/mac.c ++++ b/drivers/net/wireless/ath/ath10k/mac.c +@@ -2553,7 +2553,7 @@ static void ath10k_peer_assoc_h_qos(stru + } + break; + case WMI_VDEV_TYPE_STA: +- if (vif->bss_conf.qos) ++ if (sta->wme) + arg->peer_flags |= arvif->ar->wmi.peer_flags->qos; + break; + case WMI_VDEV_TYPE_IBSS: diff --git a/queue-4.14/bluetooth-btqcomsmd-fix-skb-double-free-corruption.patch b/queue-4.14/bluetooth-btqcomsmd-fix-skb-double-free-corruption.patch new file mode 100644 index 00000000000..4973202a78b --- /dev/null +++ b/queue-4.14/bluetooth-btqcomsmd-fix-skb-double-free-corruption.patch @@ -0,0 +1,37 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Loic Poulain +Date: Wed, 22 Nov 2017 15:03:17 +0100 +Subject: Bluetooth: btqcomsmd: Fix skb double free corruption + +From: Loic Poulain + + +[ Upstream commit 67b8fbead4685b36d290a0ef91c6ddffc4920ec9 ] + +In case of hci send frame failure, skb is still owned +by the caller (hci_core) and then should not be freed. + +This fixes crash on dragonboard-410c when sending SCO +packet. skb is freed by both btqcomsmd and hci_core. + +Fixes: 1511cc750c3d ("Bluetooth: Introduce Qualcomm WCNSS SMD based HCI driver") +Signed-off-by: Loic Poulain +Signed-off-by: Marcel Holtmann +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/bluetooth/btqcomsmd.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/bluetooth/btqcomsmd.c ++++ b/drivers/bluetooth/btqcomsmd.c +@@ -86,7 +86,8 @@ static int btqcomsmd_send(struct hci_dev + break; + } + +- kfree_skb(skb); ++ if (!ret) ++ kfree_skb(skb); + + return ret; + } diff --git a/queue-4.14/bluetooth-hci_qca-avoid-setup-failure-on-missing-rampatch.patch b/queue-4.14/bluetooth-hci_qca-avoid-setup-failure-on-missing-rampatch.patch new file mode 100644 index 00000000000..5f16dc07782 --- /dev/null +++ b/queue-4.14/bluetooth-hci_qca-avoid-setup-failure-on-missing-rampatch.patch @@ -0,0 +1,45 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Loic Poulain +Date: Mon, 6 Nov 2017 12:16:56 +0100 +Subject: Bluetooth: hci_qca: Avoid setup failure on missing rampatch + +From: Loic Poulain + + +[ Upstream commit ba8f3597900291a93604643017fff66a14546015 ] + +Assuming that the original code idea was to enable in-band sleeping +only if the setup_rome method returns succes and run in 'standard' +mode otherwise, we should not return setup_rome return value which +makes qca_setup fail if no rampatch/nvm file found. + +This fixes BT issue on the dragonboard-820C p4 which includes the +following QCA controller: +hci0: Product:0x00000008 +hci0: Patch :0x00000111 +hci0: ROM :0x00000302 +hci0: SOC :0x00000044 + +Since there is no rampatch for this controller revision, just make +it work as is. + +Signed-off-by: Loic Poulain +Signed-off-by: Marcel Holtmann +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/bluetooth/hci_qca.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/bluetooth/hci_qca.c ++++ b/drivers/bluetooth/hci_qca.c +@@ -933,6 +933,9 @@ static int qca_setup(struct hci_uart *hu + if (!ret) { + set_bit(STATE_IN_BAND_SLEEP_ENABLED, &qca->flags); + qca_debugfs_init(hdev); ++ } else if (ret == -ENOENT) { ++ /* No patch/nvm-config found, run with original fw/config */ ++ ret = 0; + } + + /* Setup bdaddr */ diff --git a/queue-4.14/clk-at91-pmc-wait-for-clocks-when-resuming.patch b/queue-4.14/clk-at91-pmc-wait-for-clocks-when-resuming.patch new file mode 100644 index 00000000000..041e7f0567c --- /dev/null +++ b/queue-4.14/clk-at91-pmc-wait-for-clocks-when-resuming.patch @@ -0,0 +1,68 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Romain Izard +Date: Mon, 11 Dec 2017 17:55:33 +0100 +Subject: clk: at91: pmc: Wait for clocks when resuming + +From: Romain Izard + + +[ Upstream commit 960e1c4d93be86d3b118fe22d4edc69e401b28b5 ] + +Wait for the syncronization of all clocks when resuming, not only the +UPLL clock. Do not use regmap_read_poll_timeout, as it will call BUG() +when interrupts are masked, which is the case in here. + +Signed-off-by: Romain Izard +Acked-by: Ludovic Desroches +Acked-by: Nicolas Ferre +Acked-by: Alexandre Belloni +Signed-off-by: Stephen Boyd +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/clk/at91/pmc.c | 24 ++++++++++++++++-------- + 1 file changed, 16 insertions(+), 8 deletions(-) + +--- a/drivers/clk/at91/pmc.c ++++ b/drivers/clk/at91/pmc.c +@@ -107,10 +107,20 @@ static int pmc_suspend(void) + return 0; + } + ++static bool pmc_ready(unsigned int mask) ++{ ++ unsigned int status; ++ ++ regmap_read(pmcreg, AT91_PMC_SR, &status); ++ ++ return ((status & mask) == mask) ? 1 : 0; ++} ++ + static void pmc_resume(void) + { +- int i, ret = 0; ++ int i; + u32 tmp; ++ u32 mask = AT91_PMC_MCKRDY | AT91_PMC_LOCKA; + + regmap_read(pmcreg, AT91_PMC_MCKR, &tmp); + if (pmc_cache.mckr != tmp) +@@ -134,13 +144,11 @@ static void pmc_resume(void) + AT91_PMC_PCR_CMD); + } + +- if (pmc_cache.uckr & AT91_PMC_UPLLEN) { +- ret = regmap_read_poll_timeout(pmcreg, AT91_PMC_SR, tmp, +- !(tmp & AT91_PMC_LOCKU), +- 10, 5000); +- if (ret) +- pr_crit("USB PLL didn't lock when resuming\n"); +- } ++ if (pmc_cache.uckr & AT91_PMC_UPLLEN) ++ mask |= AT91_PMC_LOCKU; ++ ++ while (!pmc_ready(mask)) ++ cpu_relax(); + } + + static struct syscore_ops pmc_syscore_ops = { diff --git a/queue-4.14/clk-axi-clkgen-correctly-handle-nocount-bit-in-recalc_rate.patch b/queue-4.14/clk-axi-clkgen-correctly-handle-nocount-bit-in-recalc_rate.patch new file mode 100644 index 00000000000..9def18d1d16 --- /dev/null +++ b/queue-4.14/clk-axi-clkgen-correctly-handle-nocount-bit-in-recalc_rate.patch @@ -0,0 +1,73 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Lars-Peter Clausen +Date: Tue, 5 Sep 2017 11:32:40 +0200 +Subject: clk: axi-clkgen: Correctly handle nocount bit in recalc_rate() + +From: Lars-Peter Clausen + + +[ Upstream commit 063578dc5f407f67d149133818efabe457daafda ] + +If the nocount bit is set the divider is bypassed and the settings for the +divider count should be ignored and a divider value of 1 should be assumed. +Handle this correctly in the driver recalc_rate() callback. + +While the driver sets up the part so that the read back dividers values +yield the correct result the power-on reset settings of the part might not +reflect this and hence calling e.g. clk_get_rate() without prior calls to +clk_set_rate() will yield the wrong result. + +Signed-off-by: Lars-Peter Clausen +Signed-off-by: Stephen Boyd +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/clk/clk-axi-clkgen.c | 29 ++++++++++++++++++++++++----- + 1 file changed, 24 insertions(+), 5 deletions(-) + +--- a/drivers/clk/clk-axi-clkgen.c ++++ b/drivers/clk/clk-axi-clkgen.c +@@ -40,6 +40,10 @@ + #define MMCM_REG_FILTER1 0x4e + #define MMCM_REG_FILTER2 0x4f + ++#define MMCM_CLKOUT_NOCOUNT BIT(6) ++ ++#define MMCM_CLK_DIV_NOCOUNT BIT(12) ++ + struct axi_clkgen { + void __iomem *base; + struct clk_hw clk_hw; +@@ -315,12 +319,27 @@ static unsigned long axi_clkgen_recalc_r + unsigned int reg; + unsigned long long tmp; + +- axi_clkgen_mmcm_read(axi_clkgen, MMCM_REG_CLKOUT0_1, ®); +- dout = (reg & 0x3f) + ((reg >> 6) & 0x3f); ++ axi_clkgen_mmcm_read(axi_clkgen, MMCM_REG_CLKOUT0_2, ®); ++ if (reg & MMCM_CLKOUT_NOCOUNT) { ++ dout = 1; ++ } else { ++ axi_clkgen_mmcm_read(axi_clkgen, MMCM_REG_CLKOUT0_1, ®); ++ dout = (reg & 0x3f) + ((reg >> 6) & 0x3f); ++ } ++ + axi_clkgen_mmcm_read(axi_clkgen, MMCM_REG_CLK_DIV, ®); +- d = (reg & 0x3f) + ((reg >> 6) & 0x3f); +- axi_clkgen_mmcm_read(axi_clkgen, MMCM_REG_CLK_FB1, ®); +- m = (reg & 0x3f) + ((reg >> 6) & 0x3f); ++ if (reg & MMCM_CLK_DIV_NOCOUNT) ++ d = 1; ++ else ++ d = (reg & 0x3f) + ((reg >> 6) & 0x3f); ++ ++ axi_clkgen_mmcm_read(axi_clkgen, MMCM_REG_CLK_FB2, ®); ++ if (reg & MMCM_CLKOUT_NOCOUNT) { ++ m = 1; ++ } else { ++ axi_clkgen_mmcm_read(axi_clkgen, MMCM_REG_CLK_FB1, ®); ++ m = (reg & 0x3f) + ((reg >> 6) & 0x3f); ++ } + + if (d == 0 || dout == 0) + return 0; diff --git a/queue-4.14/clk-don-t-touch-hardware-when-reparenting-during-registration.patch b/queue-4.14/clk-don-t-touch-hardware-when-reparenting-during-registration.patch new file mode 100644 index 00000000000..5ca99d6b4da --- /dev/null +++ b/queue-4.14/clk-don-t-touch-hardware-when-reparenting-during-registration.patch @@ -0,0 +1,107 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Stephen Boyd +Date: Thu, 2 Nov 2017 00:36:09 -0700 +Subject: clk: Don't touch hardware when reparenting during registration + +From: Stephen Boyd + + +[ Upstream commit f8f8f1d04494d3a6546bee3f0618c4dba31d7b72 ] + +The orphan clocks reparent operation shouldn't touch the hardware +if clocks are enabled, otherwise it may get a chance to disable a +newly registered critical clock which triggers the warning below. + +Assuming we have two clocks: A and B, B is the parent of A. +Clock A has flag: CLK_OPS_PARENT_ENABLE +Clock B has flag: CLK_IS_CRITICAL + +Step 1: +Clock A is registered, then it becomes orphan. + +Step 2: +Clock B is registered. Before clock B reach the critical clock enable +operation, orphan A will find the newly registered parent B and do +reparent operation, then parent B will be finally disabled in +__clk_set_parent_after() due to CLK_OPS_PARENT_ENABLE flag as there's +still no users of B which will then trigger the following warning. + +WARNING: CPU: 0 PID: 0 at drivers/clk/clk.c:597 clk_core_disable+0xb4/0xe0 +Modules linked in: +CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.11.0-rc1-00056-gdff1f66-dirty #1373 +Hardware name: Generic DT based system +Backtrace: +[] (dump_backtrace) from [] (show_stack+0x18/0x1c) + r6:600000d3 r5:00000000 r4:c0e26358 r3:00000000 +[] (show_stack) from [] (dump_stack+0xb4/0xe8) +[] (dump_stack) from [] (__warn+0xd8/0x104) + r10:c0c21cd0 r9:c048aa78 r8:00000255 r7:00000009 r6:c0c1cd90 r5:00000000 + r4:00000000 r3:c0e01d34 +[] (__warn) from [] (warn_slowpath_null+0x28/0x30) + r9:00000000 r8:ef00bf80 r7:c165ac4c r6:ef00bf80 r5:ef00bf80 r4:ef00bf80 +[] (warn_slowpath_null) from [] (clk_core_disable+0xb4/0xe0) +[] (clk_core_disable) from [] (clk_core_disable_lock+0x20/0x2c) + r4:000000d3 r3:c0e0af00 +[] (clk_core_disable_lock) from [] (clk_core_disable_unprepare+0x14/0x28) + r5:00000000 r4:ef00bf80 +[] (clk_core_disable_unprepare) from [] (__clk_set_parent_after+0x38/0x54) + r4:ef00bd80 r3:000010a0 +[] (__clk_set_parent_after) from [] (clk_register+0x4d0/0x648) + r6:ef00d500 r5:ef00bf80 r4:ef00bd80 r3:ef00bfd4 +[] (clk_register) from [] (clk_hw_register+0x10/0x1c) + r9:00000000 r8:00000003 r7:00000000 r6:00000824 r5:00000001 r4:ef00d500 +[] (clk_hw_register) from [] (_register_divider+0xcc/0x120) +[] (_register_divider) from [] (clk_register_divider+0x44/0x54) + r10:00000004 r9:00000003 r8:00000001 r7:00000000 r6:00000003 r5:00000001 + r4:f0810030 +[] (clk_register_divider) from [] (imx7ulp_clocks_init+0x558/0xe98) + r7:c0e296f8 r6:c165c808 r5:00000000 r4:c165c808 +[] (imx7ulp_clocks_init) from [] (of_clk_init+0x118/0x1e0) + r10:00000001 r9:c0e01f68 r8:00000000 r7:c0e01f60 r6:ef7f8974 r5:ef0035c0 + r4:00000006 +[] (of_clk_init) from [] (time_init+0x2c/0x38) + r10:efffed40 r9:c0d61a48 r8:c0e78000 r7:c0e07900 r6:ffffffff r5:c0e78000 + r4:00000000 +[] (time_init) from [] (start_kernel+0x218/0x394) +[] (start_kernel) from [<6000807c>] (0x6000807c) + r10:00000000 r9:410fc075 r8:6000406a r7:c0e0c930 r6:c0d61a44 r5:c0e07918 + r4:c0e78294 + +We know that the clk isn't enabled with any sort of prepare_count +here so we don't need to enable anything to prevent a race. And +we're holding the prepare mutex so set_rate/set_parent can't race +here either. Based on an earlier patch by Dong Aisheng. + +Fixes: fc8726a2c021 ("clk: core: support clocks which requires parents enable (part 2)") +Cc: Michael Turquette +Cc: Shawn Guo +Reported-by: Dong Aisheng +Signed-off-by: Stephen Boyd +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/clk/clk.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +--- a/drivers/clk/clk.c ++++ b/drivers/clk/clk.c +@@ -2476,14 +2476,17 @@ static int __clk_core_init(struct clk_co + */ + hlist_for_each_entry_safe(orphan, tmp2, &clk_orphan_list, child_node) { + struct clk_core *parent = __clk_init_parent(orphan); ++ unsigned long flags; + + /* + * we could call __clk_set_parent, but that would result in a + * redundant call to the .set_rate op, if it exists + */ + if (parent) { +- __clk_set_parent_before(orphan, parent); +- __clk_set_parent_after(orphan, parent, NULL); ++ /* update the clk tree topology */ ++ flags = clk_enable_lock(); ++ clk_reparent(orphan, parent); ++ clk_enable_unlock(flags); + __clk_recalc_accuracies(orphan); + __clk_recalc_rates(orphan, 0); + } diff --git a/queue-4.14/clk-si5351-rename-internal-plls-to-avoid-name-collisions.patch b/queue-4.14/clk-si5351-rename-internal-plls-to-avoid-name-collisions.patch new file mode 100644 index 00000000000..c938f0ad7e6 --- /dev/null +++ b/queue-4.14/clk-si5351-rename-internal-plls-to-avoid-name-collisions.patch @@ -0,0 +1,37 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Sergej Sawazki +Date: Tue, 25 Jul 2017 23:21:02 +0200 +Subject: clk: si5351: Rename internal plls to avoid name collisions + +From: Sergej Sawazki + + +[ Upstream commit cdba9a4fb0b53703959ac861e415816cb61aded4 ] + +This drivers probe fails due to a clock name collision if a clock named +'plla' or 'pllb' is already registered when registering this drivers +internal plls. + +Fix it by renaming internal plls to avoid name collisions. + +Cc: Sebastian Hesselbarth +Cc: Rabeeh Khoury +Signed-off-by: Sergej Sawazki +Signed-off-by: Stephen Boyd +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/clk/clk-si5351.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/clk/clk-si5351.c ++++ b/drivers/clk/clk-si5351.c +@@ -72,7 +72,7 @@ static const char * const si5351_input_n + "xtal", "clkin" + }; + static const char * const si5351_pll_names[] = { +- "plla", "pllb", "vxco" ++ "si5351_plla", "si5351_pllb", "si5351_vxco" + }; + static const char * const si5351_msynth_names[] = { + "ms0", "ms1", "ms2", "ms3", "ms4", "ms5", "ms6", "ms7" diff --git a/queue-4.14/coresight-fix-disabling-of-coresight-tpiu.patch b/queue-4.14/coresight-fix-disabling-of-coresight-tpiu.patch new file mode 100644 index 00000000000..6dd5cf77419 --- /dev/null +++ b/queue-4.14/coresight-fix-disabling-of-coresight-tpiu.patch @@ -0,0 +1,60 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Robert Walker +Date: Mon, 18 Dec 2017 11:05:44 -0700 +Subject: coresight: Fix disabling of CoreSight TPIU + +From: Robert Walker + + +[ Upstream commit 11595db8e17faaa05fadc25746c870e31276962f ] + +The CoreSight TPIU should be disabled when tracing to other sinks to allow +them to operate at full bandwidth. + +This patch fixes tpiu_disable_hw() to correctly disable the TPIU by +configuring the TPIU to stop on flush, initiating a manual flush, waiting +for the flush to complete and then waits for the TPIU to indicate it has +stopped. + +Signed-off-by: Robert Walker +Tested-by: Mike Leach +Signed-off-by: Mathieu Poirier +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/hwtracing/coresight/coresight-tpiu.c | 13 ++++++++++--- + 1 file changed, 10 insertions(+), 3 deletions(-) + +--- a/drivers/hwtracing/coresight/coresight-tpiu.c ++++ b/drivers/hwtracing/coresight/coresight-tpiu.c +@@ -46,8 +46,11 @@ + #define TPIU_ITATBCTR0 0xef8 + + /** register definition **/ ++/* FFSR - 0x300 */ ++#define FFSR_FT_STOPPED BIT(1) + /* FFCR - 0x304 */ + #define FFCR_FON_MAN BIT(6) ++#define FFCR_STOP_FI BIT(12) + + /** + * @base: memory mapped base address for this component. +@@ -85,10 +88,14 @@ static void tpiu_disable_hw(struct tpiu_ + { + CS_UNLOCK(drvdata->base); + +- /* Clear formatter controle reg. */ +- writel_relaxed(0x0, drvdata->base + TPIU_FFCR); ++ /* Clear formatter and stop on flush */ ++ writel_relaxed(FFCR_STOP_FI, drvdata->base + TPIU_FFCR); + /* Generate manual flush */ +- writel_relaxed(FFCR_FON_MAN, drvdata->base + TPIU_FFCR); ++ writel_relaxed(FFCR_STOP_FI | FFCR_FON_MAN, drvdata->base + TPIU_FFCR); ++ /* Wait for flush to complete */ ++ coresight_timeout(drvdata->base, TPIU_FFCR, FFCR_FON_MAN, 0); ++ /* Wait for formatter to stop */ ++ coresight_timeout(drvdata->base, TPIU_FFSR, FFSR_FT_STOPPED, 1); + + CS_LOCK(drvdata->base); + } diff --git a/queue-4.14/cpufreq-longhaul-revert-transition_delay_us-to-200-ms.patch b/queue-4.14/cpufreq-longhaul-revert-transition_delay_us-to-200-ms.patch new file mode 100644 index 00000000000..6d4cc1f5712 --- /dev/null +++ b/queue-4.14/cpufreq-longhaul-revert-transition_delay_us-to-200-ms.patch @@ -0,0 +1,48 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Viresh Kumar +Date: Thu, 7 Dec 2017 15:15:19 +0530 +Subject: cpufreq: longhaul: Revert transition_delay_us to 200 ms + +From: Viresh Kumar + + +[ Upstream commit 1d0d064307cbfd8546841f6e9d94d02c55e45e1e ] + +The commit e948bc8fbee0 ("cpufreq: Cap the default transition delay +value to 10 ms") caused a regression on EPIA-M min-ITX computer where +shutdown or reboot hangs occasionally with a print message like: + +longhaul: Warning: Timeout while waiting for idle PCI bus +cpufreq: __target_index: Failed to change cpu frequency: -16 + +This probably happens because the cpufreq governor tries to change the +frequency of the CPU faster than allowed by the hardware. + +Before the above commit, the default transition delay was set to 200 ms +for a transition_latency of 200000 ns. Lets revert back to that +transition delay value to fix it. Note that several other transition +delay values were tested like 20 ms and 30 ms and none of them have +resolved system hang issue completely. + +Fixes: e948bc8fbee0 (cpufreq: Cap the default transition delay value to 10 ms) +Reported-by: Meelis Roos +Suggested-by: Rafael J. Wysocki +Signed-off-by: Viresh Kumar +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/cpufreq/longhaul.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/cpufreq/longhaul.c ++++ b/drivers/cpufreq/longhaul.c +@@ -894,7 +894,7 @@ static int longhaul_cpu_init(struct cpuf + if ((longhaul_version != TYPE_LONGHAUL_V1) && (scale_voltage != 0)) + longhaul_setup_voltagescaling(); + +- policy->cpuinfo.transition_latency = 200000; /* nsec */ ++ policy->transition_delay_us = 200000; /* usec */ + + return cpufreq_table_validate_and_show(policy, longhaul_table); + } diff --git a/queue-4.14/cros_ec-fix-nul-termination-for-firmware-build-info.patch b/queue-4.14/cros_ec-fix-nul-termination-for-firmware-build-info.patch new file mode 100644 index 00000000000..4644b7255bb --- /dev/null +++ b/queue-4.14/cros_ec-fix-nul-termination-for-firmware-build-info.patch @@ -0,0 +1,38 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Arnd Bergmann +Date: Mon, 4 Dec 2017 15:49:48 +0100 +Subject: cros_ec: fix nul-termination for firmware build info + +From: Arnd Bergmann + + +[ Upstream commit 50a0d71a5d20e1d3eff1d974fdc8559ad6d74892 ] + +As gcc-8 reports, we zero out the wrong byte: + +drivers/platform/chrome/cros_ec_sysfs.c: In function 'show_ec_version': +drivers/platform/chrome/cros_ec_sysfs.c:190:12: error: array subscript 4294967295 is above array bounds of 'uint8_t[]' [-Werror=array-bounds] + +This changes the code back to what it did before changing to a +zero-length array structure. + +Fixes: a841178445bb ("mfd: cros_ec: Use a zero-length array for command data") +Signed-off-by: Arnd Bergmann +Signed-off-by: Benson Leung +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/platform/chrome/cros_ec_sysfs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/platform/chrome/cros_ec_sysfs.c ++++ b/drivers/platform/chrome/cros_ec_sysfs.c +@@ -187,7 +187,7 @@ static ssize_t show_ec_version(struct de + count += scnprintf(buf + count, PAGE_SIZE - count, + "Build info: EC error %d\n", msg->result); + else { +- msg->data[sizeof(msg->data) - 1] = '\0'; ++ msg->data[EC_HOST_PARAM_SIZE - 1] = '\0'; + count += scnprintf(buf + count, PAGE_SIZE - count, + "Build info: %s\n", msg->data); + } diff --git a/queue-4.14/crypto-artpec6-set-correct-iv-size-for-gcm-aes.patch b/queue-4.14/crypto-artpec6-set-correct-iv-size-for-gcm-aes.patch new file mode 100644 index 00000000000..592de73fb11 --- /dev/null +++ b/queue-4.14/crypto-artpec6-set-correct-iv-size-for-gcm-aes.patch @@ -0,0 +1,51 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Lars Persson +Date: Tue, 12 Dec 2017 12:40:22 +0100 +Subject: crypto: artpec6 - set correct iv size for gcm(aes) + +From: Lars Persson + + +[ Upstream commit 6d6e71feb183aa588c849e20e7baa47cb162928a ] + +The IV size should not include the 32 bit counter. Because we had the +IV size set as 16 the transform only worked when the IV input was zero +padded. + +Fixes: a21eb94fc4d3 ("crypto: axis - add ARTPEC-6/7 crypto accelerator driver") +Signed-off-by: Lars Persson +Signed-off-by: Herbert Xu +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/crypto/axis/artpec6_crypto.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/drivers/crypto/axis/artpec6_crypto.c ++++ b/drivers/crypto/axis/artpec6_crypto.c +@@ -22,6 +22,7 @@ + #include + + #include ++#include + #include + #include + #include +@@ -1934,7 +1935,7 @@ static int artpec6_crypto_prepare_aead(s + + memcpy(req_ctx->hw_ctx.J0, areq->iv, crypto_aead_ivsize(cipher)); + // The HW omits the initial increment of the counter field. +- crypto_inc(req_ctx->hw_ctx.J0+12, 4); ++ memcpy(req_ctx->hw_ctx.J0 + GCM_AES_IV_SIZE, "\x00\x00\x00\x01", 4); + + ret = artpec6_crypto_setup_out_descr(common, &req_ctx->hw_ctx, + sizeof(struct artpec6_crypto_aead_hw_ctx), false, false); +@@ -2956,7 +2957,7 @@ static struct aead_alg aead_algos[] = { + .setkey = artpec6_crypto_aead_set_key, + .encrypt = artpec6_crypto_aead_encrypt, + .decrypt = artpec6_crypto_aead_decrypt, +- .ivsize = AES_BLOCK_SIZE, ++ .ivsize = GCM_AES_IV_SIZE, + .maxauthsize = AES_BLOCK_SIZE, + + .base = { diff --git a/queue-4.14/dev-mem-add-bounce-buffer-for-copy-out.patch b/queue-4.14/dev-mem-add-bounce-buffer-for-copy-out.patch new file mode 100644 index 00000000000..626a19199b6 --- /dev/null +++ b/queue-4.14/dev-mem-add-bounce-buffer-for-copy-out.patch @@ -0,0 +1,122 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Kees Cook +Date: Fri, 1 Dec 2017 13:19:39 -0800 +Subject: /dev/mem: Add bounce buffer for copy-out + +From: Kees Cook + + +[ Upstream commit 22ec1a2aea73b9dfe340dff7945bd85af4cc6280 ] + +As done for /proc/kcore in + + commit df04abfd181a ("fs/proc/kcore.c: Add bounce buffer for ktext data") + +this adds a bounce buffer when reading memory via /dev/mem. This +is needed to allow kernel text memory to be read out when built with +CONFIG_HARDENED_USERCOPY (which refuses to read out kernel text) and +without CONFIG_STRICT_DEVMEM (which would have refused to read any RAM +contents at all). + +Since this build configuration isn't common (most systems with +CONFIG_HARDENED_USERCOPY also have CONFIG_STRICT_DEVMEM), this also tries +to inform Kconfig about the recommended settings. + +This patch is modified from Brad Spengler/PaX Team's changes to /dev/mem +code in the last public patch of grsecurity/PaX based on my understanding +of the code. Changes or omissions from the original code are mine and +don't reflect the original grsecurity/PaX code. + +Reported-by: Michael Holzheu +Fixes: f5509cc18daa ("mm: Hardened usercopy") +Signed-off-by: Kees Cook +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/char/mem.c | 27 ++++++++++++++++++++++----- + security/Kconfig | 1 + + 2 files changed, 23 insertions(+), 5 deletions(-) + +--- a/drivers/char/mem.c ++++ b/drivers/char/mem.c +@@ -107,6 +107,8 @@ static ssize_t read_mem(struct file *fil + phys_addr_t p = *ppos; + ssize_t read, sz; + void *ptr; ++ char *bounce; ++ int err; + + if (p != *ppos) + return 0; +@@ -129,15 +131,22 @@ static ssize_t read_mem(struct file *fil + } + #endif + ++ bounce = kmalloc(PAGE_SIZE, GFP_KERNEL); ++ if (!bounce) ++ return -ENOMEM; ++ + while (count > 0) { + unsigned long remaining; + int allowed; + + sz = size_inside_page(p, count); + ++ err = -EPERM; + allowed = page_is_allowed(p >> PAGE_SHIFT); + if (!allowed) +- return -EPERM; ++ goto failed; ++ ++ err = -EFAULT; + if (allowed == 2) { + /* Show zeros for restricted memory. */ + remaining = clear_user(buf, sz); +@@ -149,24 +158,32 @@ static ssize_t read_mem(struct file *fil + */ + ptr = xlate_dev_mem_ptr(p); + if (!ptr) +- return -EFAULT; +- +- remaining = copy_to_user(buf, ptr, sz); ++ goto failed; + ++ err = probe_kernel_read(bounce, ptr, sz); + unxlate_dev_mem_ptr(p, ptr); ++ if (err) ++ goto failed; ++ ++ remaining = copy_to_user(buf, bounce, sz); + } + + if (remaining) +- return -EFAULT; ++ goto failed; + + buf += sz; + p += sz; + count -= sz; + read += sz; + } ++ kfree(bounce); + + *ppos += read; + return read; ++ ++failed: ++ kfree(bounce); ++ return err; + } + + static ssize_t write_mem(struct file *file, const char __user *buf, +--- a/security/Kconfig ++++ b/security/Kconfig +@@ -154,6 +154,7 @@ config HARDENED_USERCOPY + bool "Harden memory copies between kernel and userspace" + depends on HAVE_HARDENED_USERCOPY_ALLOCATOR + select BUG ++ imply STRICT_DEVMEM + help + This option checks for obviously wrong memory regions when + copying memory to/from the kernel (via copy_to_user() and diff --git a/queue-4.14/dm-ensure-bio-submission-follows-a-depth-first-tree-walk.patch b/queue-4.14/dm-ensure-bio-submission-follows-a-depth-first-tree-walk.patch new file mode 100644 index 00000000000..a5b91773b81 --- /dev/null +++ b/queue-4.14/dm-ensure-bio-submission-follows-a-depth-first-tree-walk.patch @@ -0,0 +1,137 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: NeilBrown +Date: Wed, 6 Sep 2017 09:43:28 +1000 +Subject: dm: ensure bio submission follows a depth-first tree walk + +From: NeilBrown + + +[ Upstream commit 18a25da84354c6bb655320de6072c00eda6eb602 ] + +A dm device can, in general, represent a tree of targets, each of which +handles a sub-range of the range of blocks handled by the parent. + +The bio sequencing managed by generic_make_request() requires that bios +are generated and handled in a depth-first manner. Each call to a +make_request_fn() may submit bios to a single member device, and may +submit bios for a reduced region of the same device as the +make_request_fn. + +In particular, any bios submitted to member devices must be expected to +be processed in order, so a later one must never wait for an earlier +one. + +This ordering is usually achieved by using bio_split() to reduce a bio +to a size that can be completely handled by one target, and resubmitting +the remainder to the originating device. bio_queue_split() shows the +canonical approach. + +dm doesn't follow this approach, largely because it has needed to split +bios since long before bio_split() was available. It currently can +submit bios to separate targets within the one dm_make_request() call. +Dependencies between these targets, as can happen with dm-snap, can +cause deadlocks if either bios gets stuck behind the other in the queues +managed by generic_make_request(). This requires the 'rescue' +functionality provided by dm_offload_{start,end}. + +Some of this requirement can be removed by changing the order of bio +submission to follow the canonical approach. That is, if dm finds that +it needs to split a bio, the remainder should be sent to +generic_make_request() rather than being handled immediately. This +delays the handling until the first part is completely processed, so the +deadlock problems do not occur. + +__split_and_process_bio() can be called both from dm_make_request() and +from dm_wq_work(). When called from dm_wq_work() the current approach +is perfectly satisfactory as each bio will be processed immediately. +When called from dm_make_request(), current->bio_list will be non-NULL, +and in this case it is best to create a separate "clone" bio for the +remainder. + +When we use bio_clone_bioset() to split off the front part of a bio +and chain the two together and submit the remainder to +generic_make_request(), it is important that the newly allocated +bio is used as the head to be processed immediately, and the original +bio gets "bio_advance()"d and sent to generic_make_request() as the +remainder. Otherwise, if the newly allocated bio is used as the +remainder, and if it then needs to be split again, then the next +bio_clone_bioset() call will be made while holding a reference a bio +(result of the first clone) from the same bioset. This can potentially +exhaust the bioset mempool and result in a memory allocation deadlock. + +Note that there is no race caused by reassigning cio.io->bio after already +calling __map_bio(). This bio will only be dereferenced again after +dec_pending() has found io->io_count to be zero, and this cannot happen +before the dec_pending() call at the end of __split_and_process_bio(). + +To provide the clone bio when splitting, we use q->bio_split. This +was previously being freed by bio-based dm to avoid having excess +rescuer threads. As bio_split bio sets no longer create rescuer +threads, there is little cost and much gain from restoring the +q->bio_split bio set. + +Signed-off-by: NeilBrown +Signed-off-by: Mike Snitzer +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/md/dm.c | 33 ++++++++++++++++++++++++--------- + 1 file changed, 24 insertions(+), 9 deletions(-) + +--- a/drivers/md/dm.c ++++ b/drivers/md/dm.c +@@ -1497,8 +1497,29 @@ static void __split_and_process_bio(stru + } else { + ci.bio = bio; + ci.sector_count = bio_sectors(bio); +- while (ci.sector_count && !error) ++ while (ci.sector_count && !error) { + error = __split_and_process_non_flush(&ci); ++ if (current->bio_list && ci.sector_count && !error) { ++ /* ++ * Remainder must be passed to generic_make_request() ++ * so that it gets handled *after* bios already submitted ++ * have been completely processed. ++ * We take a clone of the original to store in ++ * ci.io->bio to be used by end_io_acct() and ++ * for dec_pending to use for completion handling. ++ * As this path is not used for REQ_OP_ZONE_REPORT, ++ * the usage of io->bio in dm_remap_zone_report() ++ * won't be affected by this reassignment. ++ */ ++ struct bio *b = bio_clone_bioset(bio, GFP_NOIO, ++ md->queue->bio_split); ++ ci.io->bio = b; ++ bio_advance(bio, (bio_sectors(bio) - ci.sector_count) << 9); ++ bio_chain(b, bio); ++ generic_make_request(bio); ++ break; ++ } ++ } + } + + /* drop the extra reference count */ +@@ -1509,8 +1530,8 @@ static void __split_and_process_bio(stru + *---------------------------------------------------------------*/ + + /* +- * The request function that just remaps the bio built up by +- * dm_merge_bvec. ++ * The request function that remaps the bio to one target and ++ * splits off any remainder. + */ + static blk_qc_t dm_make_request(struct request_queue *q, struct bio *bio) + { +@@ -2044,12 +2065,6 @@ int dm_setup_md_queue(struct mapped_devi + case DM_TYPE_DAX_BIO_BASED: + dm_init_normal_md_queue(md); + blk_queue_make_request(md->queue, dm_make_request); +- /* +- * DM handles splitting bios as needed. Free the bio_split bioset +- * since it won't be used (saves 1 process per bio-based DM device). +- */ +- bioset_free(md->queue->bio_split); +- md->queue->bio_split = NULL; + + if (type == DM_TYPE_DAX_BIO_BASED) + queue_flag_set_unlocked(QUEUE_FLAG_DAX, md->queue); diff --git a/queue-4.14/dmaengine-ti-dma-crossbar-fix-event-mapping-for-tpcc_evt_mux_60_63.patch b/queue-4.14/dmaengine-ti-dma-crossbar-fix-event-mapping-for-tpcc_evt_mux_60_63.patch new file mode 100644 index 00000000000..b10bd7ffdfe --- /dev/null +++ b/queue-4.14/dmaengine-ti-dma-crossbar-fix-event-mapping-for-tpcc_evt_mux_60_63.patch @@ -0,0 +1,46 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Vignesh R +Date: Tue, 19 Dec 2017 12:51:16 +0200 +Subject: dmaengine: ti-dma-crossbar: Fix event mapping for TPCC_EVT_MUX_60_63 + +From: Vignesh R + + +[ Upstream commit d087f15786021a9605b20f4c678312510be4cac1 ] + +Register layout of a typical TPCC_EVT_MUX_M_N register is such that the +lowest numbered event is at the lowest byte address and highest numbered +event at highest byte address. But TPCC_EVT_MUX_60_63 register layout is +different, in that the lowest numbered event is at the highest address +and highest numbered event is at the lowest address. Therefore, modify +ti_am335x_xbar_write() to handle TPCC_EVT_MUX_60_63 register +accordingly. + +Signed-off-by: Vignesh R +Signed-off-by: Peter Ujfalusi +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/dma/ti-dma-crossbar.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +--- a/drivers/dma/ti-dma-crossbar.c ++++ b/drivers/dma/ti-dma-crossbar.c +@@ -54,7 +54,15 @@ struct ti_am335x_xbar_map { + + static inline void ti_am335x_xbar_write(void __iomem *iomem, int event, u8 val) + { +- writeb_relaxed(val, iomem + event); ++ /* ++ * TPCC_EVT_MUX_60_63 register layout is different than the ++ * rest, in the sense, that event 63 is mapped to lowest byte ++ * and event 60 is mapped to highest, handle it separately. ++ */ ++ if (event >= 60 && event <= 63) ++ writeb_relaxed(val, iomem + (63 - event % 4)); ++ else ++ writeb_relaxed(val, iomem + event); + } + + static void ti_am335x_xbar_free(struct device *dev, void *route_data) diff --git a/queue-4.14/dmaengine-zynqmp_dma-fix-race-condition-in-the-probe.patch b/queue-4.14/dmaengine-zynqmp_dma-fix-race-condition-in-the-probe.patch new file mode 100644 index 00000000000..0fe0f50d534 --- /dev/null +++ b/queue-4.14/dmaengine-zynqmp_dma-fix-race-condition-in-the-probe.patch @@ -0,0 +1,34 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Kedareswara rao Appana +Date: Thu, 7 Dec 2017 10:54:28 +0530 +Subject: dmaengine: zynqmp_dma: Fix race condition in the probe + +From: Kedareswara rao Appana + + +[ Upstream commit 5ba080aada5e739165e0f38d5cc3b04c82b323c8 ] + +Incase of interrupt property is not present, +Driver is trying to free an invalid irq, +This patch fixes it by adding a check before freeing the irq. + +Signed-off-by: Kedareswara rao Appana +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/dma/xilinx/zynqmp_dma.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/dma/xilinx/zynqmp_dma.c ++++ b/drivers/dma/xilinx/zynqmp_dma.c +@@ -838,7 +838,8 @@ static void zynqmp_dma_chan_remove(struc + if (!chan) + return; + +- devm_free_irq(chan->zdev->dev, chan->irq, chan); ++ if (chan->irq) ++ devm_free_irq(chan->zdev->dev, chan->irq, chan); + tasklet_kill(&chan->tasklet); + list_del(&chan->common.device_node); + clk_disable_unprepare(chan->clk_apb); diff --git a/queue-4.14/drm-msm-fix-leak-in-failed-get_pages.patch b/queue-4.14/drm-msm-fix-leak-in-failed-get_pages.patch new file mode 100644 index 00000000000..d2bcdaa7916 --- /dev/null +++ b/queue-4.14/drm-msm-fix-leak-in-failed-get_pages.patch @@ -0,0 +1,60 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Prakash Kamliya +Date: Mon, 4 Dec 2017 19:10:15 +0530 +Subject: drm/msm: fix leak in failed get_pages + +From: Prakash Kamliya + + +[ Upstream commit 62e3a3e342af3c313ab38603811ecdb1fcc79edb ] + +get_pages doesn't keep a reference of the pages allocated +when it fails later in the code path. This can lead to +a memory leak. Keep reference of the allocated pages so +that it can be freed when msm_gem_free_object gets called +later during cleanup. + +Signed-off-by: Prakash Kamliya +Signed-off-by: Sharat Masetty +Signed-off-by: Rob Clark +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/msm/msm_gem.c | 14 ++++++++++---- + 1 file changed, 10 insertions(+), 4 deletions(-) + +--- a/drivers/gpu/drm/msm/msm_gem.c ++++ b/drivers/gpu/drm/msm/msm_gem.c +@@ -93,14 +93,17 @@ static struct page **get_pages(struct dr + return p; + } + ++ msm_obj->pages = p; ++ + msm_obj->sgt = drm_prime_pages_to_sg(p, npages); + if (IS_ERR(msm_obj->sgt)) { ++ void *ptr = ERR_CAST(msm_obj->sgt); ++ + dev_err(dev->dev, "failed to allocate sgt\n"); +- return ERR_CAST(msm_obj->sgt); ++ msm_obj->sgt = NULL; ++ return ptr; + } + +- msm_obj->pages = p; +- + /* For non-cached buffers, ensure the new pages are clean + * because display controller, GPU, etc. are not coherent: + */ +@@ -135,7 +138,10 @@ static void put_pages(struct drm_gem_obj + if (msm_obj->flags & (MSM_BO_WC|MSM_BO_UNCACHED)) + dma_unmap_sg(obj->dev->dev, msm_obj->sgt->sgl, + msm_obj->sgt->nents, DMA_BIDIRECTIONAL); +- sg_free_table(msm_obj->sgt); ++ ++ if (msm_obj->sgt) ++ sg_free_table(msm_obj->sgt); ++ + kfree(msm_obj->sgt); + + if (use_pages(obj)) diff --git a/queue-4.14/drm-omap-dmm-check-for-dmm-readiness-after-successful-transaction-commit.patch b/queue-4.14/drm-omap-dmm-check-for-dmm-readiness-after-successful-transaction-commit.patch new file mode 100644 index 00000000000..9286e3eb01e --- /dev/null +++ b/queue-4.14/drm-omap-dmm-check-for-dmm-readiness-after-successful-transaction-commit.patch @@ -0,0 +1,41 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Peter Ujfalusi +Date: Fri, 29 Sep 2017 14:49:49 +0300 +Subject: drm/omap: DMM: Check for DMM readiness after successful transaction commit + +From: Peter Ujfalusi + + +[ Upstream commit b7ea6b286c4051e043f691781785e3c4672f014a ] + +Check the status of the DMM engine after it is reported that the +transaction was completed as in rare cases the engine might not reached a +working state. + +The wait_status() will print information in case the DMM is not reached the +expected state and the dmm_txn_commit() will return with an error code to +make sure that we are not continuing with a broken setup. + +Signed-off-by: Peter Ujfalusi +Signed-off-by: Tomi Valkeinen +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/omapdrm/omap_dmm_tiler.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c ++++ b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c +@@ -298,7 +298,12 @@ static int dmm_txn_commit(struct dmm_txn + msecs_to_jiffies(100))) { + dev_err(dmm->dev, "timed out waiting for done\n"); + ret = -ETIMEDOUT; ++ goto cleanup; + } ++ ++ /* Check the engine status before continue */ ++ ret = wait_status(engine, DMM_PATSTATUS_READY | ++ DMM_PATSTATUS_VALID | DMM_PATSTATUS_DONE); + } + + cleanup: diff --git a/queue-4.14/drm-tilcdc-ensure-nonatomic-iowrite64-is-not-used.patch b/queue-4.14/drm-tilcdc-ensure-nonatomic-iowrite64-is-not-used.patch new file mode 100644 index 00000000000..dd3bd732cf1 --- /dev/null +++ b/queue-4.14/drm-tilcdc-ensure-nonatomic-iowrite64-is-not-used.patch @@ -0,0 +1,52 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Logan Gunthorpe +Date: Tue, 5 Dec 2017 16:30:51 -0700 +Subject: drm/tilcdc: ensure nonatomic iowrite64 is not used + +From: Logan Gunthorpe + + +[ Upstream commit 4e5ca2d930aa8714400aedf4bf1dc959cb04280f ] + +Add a check to ensure iowrite64 is only used if it is atomic. + +It was decided in [1] that the tilcdc driver should not be using an +atomic operation (so it was left out of this patchset). However, it turns +out that through the drm code, a nonatomic header is actually included: + +include/linux/io-64-nonatomic-lo-hi.h +is included from include/drm/drm_os_linux.h:9:0, + from include/drm/drmP.h:74, + from include/drm/drm_modeset_helper.h:26, + from include/drm/drm_atomic_helper.h:33, + from drivers/gpu/drm/tilcdc/tilcdc_crtc.c:19: + +And thus, without this change, this patchset would inadvertantly +change the behaviour of the tilcdc driver. + +[1] lkml.kernel.org/r/CAK8P3a2HhO_zCnsTzq7hmWSz5La5Thu19FWZpun16iMnyyNreQ@mail.gmail.com + +Signed-off-by: Logan Gunthorpe +Reviewed-by: Andy Shevchenko +Cc: Jyri Sarha +Cc: Arnd Bergmann +Cc: Tomi Valkeinen +Cc: David Airlie +Signed-off-by: Jyri Sarha +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/tilcdc/tilcdc_regs.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/gpu/drm/tilcdc/tilcdc_regs.h ++++ b/drivers/gpu/drm/tilcdc/tilcdc_regs.h +@@ -133,7 +133,7 @@ static inline void tilcdc_write64(struct + struct tilcdc_drm_private *priv = dev->dev_private; + volatile void __iomem *addr = priv->mmio + reg; + +-#ifdef iowrite64 ++#if defined(iowrite64) && !defined(iowrite64_is_nonatomic) + iowrite64(data, addr); + #else + __iowmb(); diff --git a/queue-4.14/hv_netvsc-fix-the-receive-buffer-size-limit.patch b/queue-4.14/hv_netvsc-fix-the-receive-buffer-size-limit.patch new file mode 100644 index 00000000000..5f3babce09f --- /dev/null +++ b/queue-4.14/hv_netvsc-fix-the-receive-buffer-size-limit.patch @@ -0,0 +1,60 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Haiyang Zhang +Date: Mon, 11 Dec 2017 08:56:57 -0800 +Subject: hv_netvsc: Fix the receive buffer size limit + +From: Haiyang Zhang + + +[ Upstream commit 11b2b653102571ac791885324371d9a1a17b900e ] + +The max should be 31 MB on host with NVSP version > 2. + +On legacy hosts (NVSP version <=2) only 15 MB receive buffer is allowed, +otherwise the buffer request will be rejected by the host, resulting +vNIC not coming up. + +The NVSP version is only available after negotiation. So, we add the +limit checking for legacy hosts in netvsc_init_buf(). + +Fixes: 5023a6db73196 ("netvsc: increase default receive buffer size") +Signed-off-by: Haiyang Zhang +Signed-off-by: Stephen Hemminger +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/hyperv/hyperv_net.h | 6 ++++-- + drivers/net/hyperv/netvsc.c | 5 +++++ + 2 files changed, 9 insertions(+), 2 deletions(-) + +--- a/drivers/net/hyperv/hyperv_net.h ++++ b/drivers/net/hyperv/hyperv_net.h +@@ -635,9 +635,11 @@ struct nvsp_message { + #define NETVSC_MTU 65535 + #define NETVSC_MTU_MIN ETH_MIN_MTU + +-#define NETVSC_RECEIVE_BUFFER_SIZE (1024*1024*16) /* 16MB */ +-#define NETVSC_RECEIVE_BUFFER_SIZE_LEGACY (1024*1024*15) /* 15MB */ ++/* Max buffer sizes allowed by a host */ ++#define NETVSC_RECEIVE_BUFFER_SIZE (1024 * 1024 * 31) /* 31MB */ ++#define NETVSC_RECEIVE_BUFFER_SIZE_LEGACY (1024 * 1024 * 15) /* 15MB */ + #define NETVSC_SEND_BUFFER_SIZE (1024 * 1024 * 15) /* 15MB */ ++ + #define NETVSC_INVALID_INDEX -1 + + #define NETVSC_SEND_SECTION_SIZE 6144 +--- a/drivers/net/hyperv/netvsc.c ++++ b/drivers/net/hyperv/netvsc.c +@@ -262,6 +262,11 @@ static int netvsc_init_buf(struct hv_dev + buf_size = device_info->recv_sections * device_info->recv_section_size; + buf_size = roundup(buf_size, PAGE_SIZE); + ++ /* Legacy hosts only allow smaller receive buffer */ ++ if (net_device->nvsp_version <= NVSP_PROTOCOL_VERSION_2) ++ buf_size = min_t(unsigned int, buf_size, ++ NETVSC_RECEIVE_BUFFER_SIZE_LEGACY); ++ + net_device->recv_buf = vzalloc(buf_size); + if (!net_device->recv_buf) { + netdev_err(ndev, diff --git a/queue-4.14/hv_netvsc-fix-the-tx-rx-buffer-default-sizes.patch b/queue-4.14/hv_netvsc-fix-the-tx-rx-buffer-default-sizes.patch new file mode 100644 index 00000000000..de3e978809a --- /dev/null +++ b/queue-4.14/hv_netvsc-fix-the-tx-rx-buffer-default-sizes.patch @@ -0,0 +1,74 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Haiyang Zhang +Date: Mon, 11 Dec 2017 08:56:58 -0800 +Subject: hv_netvsc: Fix the TX/RX buffer default sizes + +From: Haiyang Zhang + + +[ Upstream commit 41f61db2cd24d5ad802386719cccde1479aa82a6 ] + +The values were not computed correctly. There are no significant +visible impact, though. + +The intended size of RX buffer is 16 MB, and the default slot size is 1728. +So, NETVSC_DEFAULT_RX should be 16*1024*1024 / 1728 = 9709. + +The intended size of TX buffer is 1 MB, and the slot size is 6144. +So, NETVSC_DEFAULT_TX should be 1024*1024 / 6144 = 170. + +The patch puts the formula directly into the macro, and moves them to +hyperv_net.h, together with related macros. + +Fixes: 5023a6db73196 ("netvsc: increase default receive buffer size") +Signed-off-by: Haiyang Zhang +Signed-off-by: Stephen Hemminger +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/hyperv/hyperv_net.h | 13 ++++++++++++- + drivers/net/hyperv/netvsc_drv.c | 4 ---- + 2 files changed, 12 insertions(+), 5 deletions(-) + +--- a/drivers/net/hyperv/hyperv_net.h ++++ b/drivers/net/hyperv/hyperv_net.h +@@ -638,13 +638,24 @@ struct nvsp_message { + /* Max buffer sizes allowed by a host */ + #define NETVSC_RECEIVE_BUFFER_SIZE (1024 * 1024 * 31) /* 31MB */ + #define NETVSC_RECEIVE_BUFFER_SIZE_LEGACY (1024 * 1024 * 15) /* 15MB */ +-#define NETVSC_SEND_BUFFER_SIZE (1024 * 1024 * 15) /* 15MB */ ++#define NETVSC_RECEIVE_BUFFER_DEFAULT (1024 * 1024 * 16) ++ ++#define NETVSC_SEND_BUFFER_SIZE (1024 * 1024 * 15) /* 15MB */ ++#define NETVSC_SEND_BUFFER_DEFAULT (1024 * 1024) + + #define NETVSC_INVALID_INDEX -1 + + #define NETVSC_SEND_SECTION_SIZE 6144 + #define NETVSC_RECV_SECTION_SIZE 1728 + ++/* Default size of TX buf: 1MB, RX buf: 16MB */ ++#define NETVSC_MIN_TX_SECTIONS 10 ++#define NETVSC_DEFAULT_TX (NETVSC_SEND_BUFFER_DEFAULT \ ++ / NETVSC_SEND_SECTION_SIZE) ++#define NETVSC_MIN_RX_SECTIONS 10 ++#define NETVSC_DEFAULT_RX (NETVSC_RECEIVE_BUFFER_DEFAULT \ ++ / NETVSC_RECV_SECTION_SIZE) ++ + #define NETVSC_RECEIVE_BUFFER_ID 0xcafe + #define NETVSC_SEND_BUFFER_ID 0 + +--- a/drivers/net/hyperv/netvsc_drv.c ++++ b/drivers/net/hyperv/netvsc_drv.c +@@ -46,10 +46,6 @@ + #include "hyperv_net.h" + + #define RING_SIZE_MIN 64 +-#define NETVSC_MIN_TX_SECTIONS 10 +-#define NETVSC_DEFAULT_TX 192 /* ~1M */ +-#define NETVSC_MIN_RX_SECTIONS 10 /* ~64K */ +-#define NETVSC_DEFAULT_RX 10485 /* Max ~16M */ + + #define LINKCHANGE_INT (2 * HZ) + #define VF_TAKEOVER_INT (HZ / 10) diff --git a/queue-4.14/ib-ipoib-avoid-memory-leak-if-the-sa-returns-a-different-dgid.patch b/queue-4.14/ib-ipoib-avoid-memory-leak-if-the-sa-returns-a-different-dgid.patch new file mode 100644 index 00000000000..c57e3c8cc47 --- /dev/null +++ b/queue-4.14/ib-ipoib-avoid-memory-leak-if-the-sa-returns-a-different-dgid.patch @@ -0,0 +1,64 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Erez Shitrit +Date: Tue, 14 Nov 2017 14:51:53 +0200 +Subject: IB/ipoib: Avoid memory leak if the SA returns a different DGID + +From: Erez Shitrit + + +[ Upstream commit 439000892ee17a9c92f1e4297818790ef8bb4ced ] + +The ipoib path database is organized around DGIDs from the LLADDR, but the +SA is free to return a different GID when asked for path. This causes a +bug because the SA's modified DGID is copied into the database key, even +though it is no longer the correct lookup key, causing a memory leak and +other malfunctions. + +Ensure the database key does not change after the SA query completes. + +Demonstration of the bug is as follows +ipoib wants to send to GID fe80:0000:0000:0000:0002:c903:00ef:5ee2, it +creates new record in the DB with that gid as a key, and issues a new +request to the SM. +Now, the SM from some reason returns path-record with other SGID (for +example, 2001:0000:0000:0000:0002:c903:00ef:5ee2 that contains the local +subnet prefix) now ipoib will overwrite the current entry with the new +one, and if new request to the original GID arrives ipoib will not find +it in the DB (was overwritten) and will create new record that in its +turn will also be overwritten by the response from the SM, and so on +till the driver eats all the device memory. + +Signed-off-by: Erez Shitrit +Signed-off-by: Leon Romanovsky +Signed-off-by: Jason Gunthorpe +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/infiniband/ulp/ipoib/ipoib_main.c | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c ++++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c +@@ -776,6 +776,22 @@ static void path_rec_completion(int stat + spin_lock_irqsave(&priv->lock, flags); + + if (!IS_ERR_OR_NULL(ah)) { ++ /* ++ * pathrec.dgid is used as the database key from the LLADDR, ++ * it must remain unchanged even if the SA returns a different ++ * GID to use in the AH. ++ */ ++ if (memcmp(pathrec->dgid.raw, path->pathrec.dgid.raw, ++ sizeof(union ib_gid))) { ++ ipoib_dbg( ++ priv, ++ "%s got PathRec for gid %pI6 while asked for %pI6\n", ++ dev->name, pathrec->dgid.raw, ++ path->pathrec.dgid.raw); ++ memcpy(pathrec->dgid.raw, path->pathrec.dgid.raw, ++ sizeof(union ib_gid)); ++ } ++ + path->pathrec = *pathrec; + + old_ah = path->ah; diff --git a/queue-4.14/ib-umem-fix-use-of-npages-nmap-fields.patch b/queue-4.14/ib-umem-fix-use-of-npages-nmap-fields.patch new file mode 100644 index 00000000000..cbfa9c12b90 --- /dev/null +++ b/queue-4.14/ib-umem-fix-use-of-npages-nmap-fields.patch @@ -0,0 +1,34 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Artemy Kovalyov +Date: Tue, 14 Nov 2017 14:51:59 +0200 +Subject: IB/umem: Fix use of npages/nmap fields + +From: Artemy Kovalyov + + +[ Upstream commit edf1a84fe37c51290e2c88154ecaf48dadff3d27 ] + +In ib_umem structure npages holds original number of sg entries, while +nmap is number of DMA blocks returned by dma_map_sg. + +Fixes: c5d76f130b28 ('IB/core: Add umem function to read data from user-space') +Signed-off-by: Artemy Kovalyov +Signed-off-by: Leon Romanovsky +Signed-off-by: Jason Gunthorpe +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/infiniband/core/umem.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/infiniband/core/umem.c ++++ b/drivers/infiniband/core/umem.c +@@ -352,7 +352,7 @@ int ib_umem_copy_from(void *dst, struct + return -EINVAL; + } + +- ret = sg_pcopy_to_buffer(umem->sg_head.sgl, umem->nmap, dst, length, ++ ret = sg_pcopy_to_buffer(umem->sg_head.sgl, umem->npages, dst, length, + offset + ib_umem_offset(umem)); + + if (ret < 0) diff --git a/queue-4.14/iommu-vt-d-clean-up-pr_irq-if-request_threaded_irq-fails.patch b/queue-4.14/iommu-vt-d-clean-up-pr_irq-if-request_threaded_irq-fails.patch new file mode 100644 index 00000000000..eacc2ffd9c6 --- /dev/null +++ b/queue-4.14/iommu-vt-d-clean-up-pr_irq-if-request_threaded_irq-fails.patch @@ -0,0 +1,130 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Jerry Snitselaar +Date: Wed, 20 Dec 2017 09:48:56 -0700 +Subject: iommu/vt-d: clean up pr_irq if request_threaded_irq fails + +From: Jerry Snitselaar + + +[ Upstream commit 72d548113881dd32bf7f0b221d031e6586468437 ] + +It is unlikely request_threaded_irq will fail, but if it does for some +reason we should clear iommu->pr_irq in the error path. Also +intel_svm_finish_prq shouldn't try to clean up the page request +interrupt if pr_irq is 0. Without these, if request_threaded_irq were +to fail the following occurs: + +fail with no fixes: + +[ 0.683147] ------------[ cut here ]------------ +[ 0.683148] NULL pointer, cannot free irq +[ 0.683158] WARNING: CPU: 1 PID: 1 at kernel/irq/irqdomain.c:1632 irq_domain_free_irqs+0x126/0x140 +[ 0.683160] Modules linked in: +[ 0.683163] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.15.0-rc2 #3 +[ 0.683165] Hardware name: /NUC7i3BNB, BIOS BNKBL357.86A.0036.2017.0105.1112 01/05/2017 +[ 0.683168] RIP: 0010:irq_domain_free_irqs+0x126/0x140 +[ 0.683169] RSP: 0000:ffffc90000037ce8 EFLAGS: 00010292 +[ 0.683171] RAX: 000000000000001d RBX: ffff880276283c00 RCX: ffffffff81c5e5e8 +[ 0.683172] RDX: 0000000000000001 RSI: 0000000000000096 RDI: 0000000000000246 +[ 0.683174] RBP: ffff880276283c00 R08: 0000000000000000 R09: 000000000000023c +[ 0.683175] R10: 0000000000000007 R11: 0000000000000000 R12: 000000000000007a +[ 0.683176] R13: 0000000000000001 R14: 0000000000000000 R15: 0000010010000000 +[ 0.683178] FS: 0000000000000000(0000) GS:ffff88027ec80000(0000) knlGS:0000000000000000 +[ 0.683180] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 +[ 0.683181] CR2: 0000000000000000 CR3: 0000000001c09001 CR4: 00000000003606e0 +[ 0.683182] Call Trace: +[ 0.683189] intel_svm_finish_prq+0x3c/0x60 +[ 0.683191] free_dmar_iommu+0x1ac/0x1b0 +[ 0.683195] init_dmars+0xaaa/0xaea +[ 0.683200] ? klist_next+0x19/0xc0 +[ 0.683203] ? pci_do_find_bus+0x50/0x50 +[ 0.683205] ? pci_get_dev_by_id+0x52/0x70 +[ 0.683208] intel_iommu_init+0x498/0x5c7 +[ 0.683211] pci_iommu_init+0x13/0x3c +[ 0.683214] ? e820__memblock_setup+0x61/0x61 +[ 0.683217] do_one_initcall+0x4d/0x1a0 +[ 0.683220] kernel_init_freeable+0x186/0x20e +[ 0.683222] ? set_debug_rodata+0x11/0x11 +[ 0.683225] ? rest_init+0xb0/0xb0 +[ 0.683226] kernel_init+0xa/0xff +[ 0.683229] ret_from_fork+0x1f/0x30 +[ 0.683259] Code: 89 ee 44 89 e7 e8 3b e8 ff ff 5b 5d 44 89 e7 44 89 ee 41 5c 41 5d 41 5e e9 a8 84 ff ff 48 c7 c7 a8 71 a7 81 31 c0 e8 6a d3 f9 ff <0f> ff 5b 5d 41 5c 41 5d 41 5 +e c3 0f 1f 44 00 00 66 2e 0f 1f 84 +[ 0.683285] ---[ end trace f7650e42792627ca ]--- + +with iommu->pr_irq = 0, but no check in intel_svm_finish_prq: + +[ 0.669561] ------------[ cut here ]------------ +[ 0.669563] Trying to free already-free IRQ 0 +[ 0.669573] WARNING: CPU: 3 PID: 1 at kernel/irq/manage.c:1546 __free_irq+0xa4/0x2c0 +[ 0.669574] Modules linked in: +[ 0.669577] CPU: 3 PID: 1 Comm: swapper/0 Not tainted 4.15.0-rc2 #4 +[ 0.669579] Hardware name: /NUC7i3BNB, BIOS BNKBL357.86A.0036.2017.0105.1112 01/05/2017 +[ 0.669581] RIP: 0010:__free_irq+0xa4/0x2c0 +[ 0.669582] RSP: 0000:ffffc90000037cc0 EFLAGS: 00010082 +[ 0.669584] RAX: 0000000000000021 RBX: 0000000000000000 RCX: ffffffff81c5e5e8 +[ 0.669585] RDX: 0000000000000001 RSI: 0000000000000086 RDI: 0000000000000046 +[ 0.669587] RBP: 0000000000000000 R08: 0000000000000000 R09: 000000000000023c +[ 0.669588] R10: 0000000000000007 R11: 0000000000000000 R12: ffff880276253960 +[ 0.669589] R13: ffff8802762538a4 R14: ffff880276253800 R15: ffff880276283600 +[ 0.669593] FS: 0000000000000000(0000) GS:ffff88027ed80000(0000) knlGS:0000000000000000 +[ 0.669594] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 +[ 0.669596] CR2: 0000000000000000 CR3: 0000000001c09001 CR4: 00000000003606e0 +[ 0.669602] Call Trace: +[ 0.669616] free_irq+0x30/0x60 +[ 0.669620] intel_svm_finish_prq+0x34/0x60 +[ 0.669623] free_dmar_iommu+0x1ac/0x1b0 +[ 0.669627] init_dmars+0xaaa/0xaea +[ 0.669631] ? klist_next+0x19/0xc0 +[ 0.669634] ? pci_do_find_bus+0x50/0x50 +[ 0.669637] ? pci_get_dev_by_id+0x52/0x70 +[ 0.669639] intel_iommu_init+0x498/0x5c7 +[ 0.669642] pci_iommu_init+0x13/0x3c +[ 0.669645] ? e820__memblock_setup+0x61/0x61 +[ 0.669648] do_one_initcall+0x4d/0x1a0 +[ 0.669651] kernel_init_freeable+0x186/0x20e +[ 0.669653] ? set_debug_rodata+0x11/0x11 +[ 0.669656] ? rest_init+0xb0/0xb0 +[ 0.669658] kernel_init+0xa/0xff +[ 0.669661] ret_from_fork+0x1f/0x30 +[ 0.669662] Code: 7a 08 75 0e e9 c3 01 00 00 4c 39 7b 08 74 57 48 89 da 48 8b 5a 18 48 85 db 75 ee 89 ee 48 c7 c7 78 67 a7 81 31 c0 e8 4c 37 fa ff <0f> ff 48 8b 34 24 4c 89 ef e +8 0e 4c 68 00 49 8b 46 40 48 8b 80 +[ 0.669688] ---[ end trace 58a470248700f2fc ]--- + +Cc: Alex Williamson +Cc: Joerg Roedel +Cc: Ashok Raj +Signed-off-by: Jerry Snitselaar +Reviewed-by: Ashok Raj +Signed-off-by: Alex Williamson +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/iommu/intel-svm.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +--- a/drivers/iommu/intel-svm.c ++++ b/drivers/iommu/intel-svm.c +@@ -129,6 +129,7 @@ int intel_svm_enable_prq(struct intel_io + pr_err("IOMMU: %s: Failed to request IRQ for page request queue\n", + iommu->name); + dmar_free_hwirq(irq); ++ iommu->pr_irq = 0; + goto err; + } + dmar_writeq(iommu->reg + DMAR_PQH_REG, 0ULL); +@@ -144,9 +145,11 @@ int intel_svm_finish_prq(struct intel_io + dmar_writeq(iommu->reg + DMAR_PQT_REG, 0ULL); + dmar_writeq(iommu->reg + DMAR_PQA_REG, 0ULL); + +- free_irq(iommu->pr_irq, iommu); +- dmar_free_hwirq(iommu->pr_irq); +- iommu->pr_irq = 0; ++ if (iommu->pr_irq) { ++ free_irq(iommu->pr_irq, iommu); ++ dmar_free_hwirq(iommu->pr_irq); ++ iommu->pr_irq = 0; ++ } + + free_pages((unsigned long)iommu->prq, PRQ_ORDER); + iommu->prq = NULL; diff --git a/queue-4.14/ip6_vti-adjust-vti-mtu-according-to-mtu-of-lower-device.patch b/queue-4.14/ip6_vti-adjust-vti-mtu-according-to-mtu-of-lower-device.patch new file mode 100644 index 00000000000..2eefe823ca5 --- /dev/null +++ b/queue-4.14/ip6_vti-adjust-vti-mtu-according-to-mtu-of-lower-device.patch @@ -0,0 +1,87 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Alexey Kodanev +Date: Tue, 19 Dec 2017 16:59:21 +0300 +Subject: ip6_vti: adjust vti mtu according to mtu of lower device + +From: Alexey Kodanev + + +[ Upstream commit 53c81e95df1793933f87748d36070a721f6cb287 ] + +LTP/udp6_ipsec_vti tests fail when sending large UDP datagrams over +ip6_vti that require fragmentation and the underlying device has an +MTU smaller than 1500 plus some extra space for headers. This happens +because ip6_vti, by default, sets MTU to ETH_DATA_LEN and not updating +it depending on a destination address or link parameter. Further +attempts to send UDP packets may succeed because pmtu gets updated on +ICMPV6_PKT_TOOBIG in vti6_err(). + +In case the lower device has larger MTU size, e.g. 9000, ip6_vti works +but not using the possible maximum size, output packets have 1500 limit. + +The above cases require manual MTU setup after ip6_vti creation. However +ip_vti already updates MTU based on lower device with ip_tunnel_bind_dev(). + +Here is the example when the lower device MTU is set to 9000: + + # ip a sh ltp_ns_veth2 + ltp_ns_veth2@if7: mtu 9000 ... + inet 10.0.0.2/24 scope global ltp_ns_veth2 + inet6 fd00::2/64 scope global + + # ip li add vti6 type vti6 local fd00::2 remote fd00::1 + # ip li show vti6 + vti6@NONE: mtu 1500 ... + link/tunnel6 fd00::2 peer fd00::1 + +After the patch: + # ip li add vti6 type vti6 local fd00::2 remote fd00::1 + # ip li show vti6 + vti6@NONE: mtu 8832 ... + link/tunnel6 fd00::2 peer fd00::1 + +Reported-by: Petr Vorel +Signed-off-by: Alexey Kodanev +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + net/ipv6/ip6_vti.c | 20 ++++++++++++++++++++ + 1 file changed, 20 insertions(+) + +--- a/net/ipv6/ip6_vti.c ++++ b/net/ipv6/ip6_vti.c +@@ -626,6 +626,7 @@ static void vti6_link_config(struct ip6_ + { + struct net_device *dev = t->dev; + struct __ip6_tnl_parm *p = &t->parms; ++ struct net_device *tdev = NULL; + + memcpy(dev->dev_addr, &p->laddr, sizeof(struct in6_addr)); + memcpy(dev->broadcast, &p->raddr, sizeof(struct in6_addr)); +@@ -638,6 +639,25 @@ static void vti6_link_config(struct ip6_ + dev->flags |= IFF_POINTOPOINT; + else + dev->flags &= ~IFF_POINTOPOINT; ++ ++ if (p->flags & IP6_TNL_F_CAP_XMIT) { ++ int strict = (ipv6_addr_type(&p->raddr) & ++ (IPV6_ADDR_MULTICAST | IPV6_ADDR_LINKLOCAL)); ++ struct rt6_info *rt = rt6_lookup(t->net, ++ &p->raddr, &p->laddr, ++ p->link, strict); ++ ++ if (rt) ++ tdev = rt->dst.dev; ++ ip6_rt_put(rt); ++ } ++ ++ if (!tdev && p->link) ++ tdev = __dev_get_by_index(t->net, p->link); ++ ++ if (tdev) ++ dev->mtu = max_t(int, tdev->mtu - dev->hard_header_len, ++ IPV6_MIN_MTU); + } + + /** diff --git a/queue-4.14/ip_gre-fix-error-path-when-erspan_rcv-failed.patch b/queue-4.14/ip_gre-fix-error-path-when-erspan_rcv-failed.patch new file mode 100644 index 00000000000..ce969f120d3 --- /dev/null +++ b/queue-4.14/ip_gre-fix-error-path-when-erspan_rcv-failed.patch @@ -0,0 +1,41 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Haishuang Yan +Date: Wed, 20 Dec 2017 10:21:46 +0800 +Subject: ip_gre: fix error path when erspan_rcv failed + +From: Haishuang Yan + + +[ Upstream commit dd8d5b8c5b22e31079b259b8bfb686f1fac1080a ] + +When erspan_rcv call return PACKET_REJECT, we shoudn't call ipgre_rcv to +process packets again, instead send icmp unreachable message in error +path. + +Fixes: 84e54fe0a5ea ("gre: introduce native tunnel support for ERSPAN") +Acked-by: William Tu +Cc: William Tu +Signed-off-by: Haishuang Yan +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + net/ipv4/ip_gre.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/net/ipv4/ip_gre.c ++++ b/net/ipv4/ip_gre.c +@@ -408,11 +408,13 @@ static int gre_rcv(struct sk_buff *skb) + if (unlikely(tpi.proto == htons(ETH_P_ERSPAN))) { + if (erspan_rcv(skb, &tpi, hdr_len) == PACKET_RCVD) + return 0; ++ goto out; + } + + if (ipgre_rcv(skb, &tpi, hdr_len) == PACKET_RCVD) + return 0; + ++out: + icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0); + drop: + kfree_skb(skb); diff --git a/queue-4.14/ip_gre-fix-potential-memory-leak-in-erspan_rcv.patch b/queue-4.14/ip_gre-fix-potential-memory-leak-in-erspan_rcv.patch new file mode 100644 index 00000000000..66927ad85ef --- /dev/null +++ b/queue-4.14/ip_gre-fix-potential-memory-leak-in-erspan_rcv.patch @@ -0,0 +1,37 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Haishuang Yan +Date: Wed, 20 Dec 2017 10:07:00 +0800 +Subject: ip_gre: fix potential memory leak in erspan_rcv + +From: Haishuang Yan + + +[ Upstream commit 50670b6ee9bc4ae8f9ce3112b437987adf273245 ] + +If md is NULL, tun_dst must be freed, otherwise it will cause memory +leak. + +Fixes: 1a66a836da6 ("gre: add collect_md mode to ERSPAN tunnel") +Cc: William Tu +Signed-off-by: Haishuang Yan +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + net/ipv4/ip_gre.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/net/ipv4/ip_gre.c ++++ b/net/ipv4/ip_gre.c +@@ -303,8 +303,10 @@ static int erspan_rcv(struct sk_buff *sk + return PACKET_REJECT; + + md = ip_tunnel_info_opts(&tun_dst->u.tun_info); +- if (!md) ++ if (!md) { ++ dst_release((struct dst_entry *)tun_dst); + return PACKET_REJECT; ++ } + + md->index = index; + info = &tun_dst->u.tun_info; diff --git a/queue-4.14/iser-target-avoid-reinitializing-rdma-contexts-for-isert-commands.patch b/queue-4.14/iser-target-avoid-reinitializing-rdma-contexts-for-isert-commands.patch new file mode 100644 index 00000000000..b279b309242 --- /dev/null +++ b/queue-4.14/iser-target-avoid-reinitializing-rdma-contexts-for-isert-commands.patch @@ -0,0 +1,85 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Bharat Potnuri +Date: Tue, 28 Nov 2017 23:58:07 +0530 +Subject: iser-target: avoid reinitializing rdma contexts for isert commands + +From: Bharat Potnuri + + +[ Upstream commit 66f53e6f5400578bae58db0c06d85a8820831f40 ] + +isert commands that failed during isert_rdma_rw_ctx_post() are queued to +Queue-Full(QF) queue and are scheduled to be reposted during queue-full +queue processing. During this reposting, the rdma contexts are initialised +again in isert_rdma_rw_ctx_post(), which is leaking significant memory. + +unreferenced object 0xffff8830201d9640 (size 64): + comm "kworker/0:2", pid 195, jiffies 4295374851 (age 4528.436s) + hex dump (first 32 bytes): + 00 60 8b cb 2e 00 00 00 00 10 00 00 00 00 00 00 .`.............. + 00 90 e3 cb 2e 00 00 00 00 10 00 00 00 00 00 00 ................ + backtrace: + [] kmemleak_alloc+0x4e/0xb0 + [] __kmalloc+0x125/0x2b0 + [] rdma_rw_ctx_init+0x15f/0x6f0 [ib_core] + [] isert_rdma_rw_ctx_post+0xc4/0x3c0 [ib_isert] + [] isert_put_datain+0x112/0x1c0 [ib_isert] + [] lio_queue_data_in+0x2e/0x30 [iscsi_target_mod] + [] target_qf_do_work+0x2b2/0x4b0 [target_core_mod] + [] process_one_work+0x1db/0x5d0 + [] worker_thread+0x4d/0x3e0 + [] kthread+0x117/0x150 + [] ret_from_fork+0x27/0x40 + [] 0xffffffffffffffff + +Here is patch to use the older rdma contexts while reposting +the isert commands intead of reinitialising them. + +Signed-off-by: Potnuri Bharat Teja +Reviewed-by: Sagi Grimberg +Signed-off-by: Jason Gunthorpe +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/infiniband/ulp/isert/ib_isert.c | 7 +++++++ + drivers/infiniband/ulp/isert/ib_isert.h | 1 + + 2 files changed, 8 insertions(+) + +--- a/drivers/infiniband/ulp/isert/ib_isert.c ++++ b/drivers/infiniband/ulp/isert/ib_isert.c +@@ -2124,6 +2124,9 @@ isert_rdma_rw_ctx_post(struct isert_cmd + u32 rkey, offset; + int ret; + ++ if (cmd->ctx_init_done) ++ goto rdma_ctx_post; ++ + if (dir == DMA_FROM_DEVICE) { + addr = cmd->write_va; + rkey = cmd->write_stag; +@@ -2151,11 +2154,15 @@ isert_rdma_rw_ctx_post(struct isert_cmd + se_cmd->t_data_sg, se_cmd->t_data_nents, + offset, addr, rkey, dir); + } ++ + if (ret < 0) { + isert_err("Cmd: %p failed to prepare RDMA res\n", cmd); + return ret; + } + ++ cmd->ctx_init_done = true; ++ ++rdma_ctx_post: + ret = rdma_rw_ctx_post(&cmd->rw, conn->qp, port_num, cqe, chain_wr); + if (ret < 0) + isert_err("Cmd: %p failed to post RDMA res\n", cmd); +--- a/drivers/infiniband/ulp/isert/ib_isert.h ++++ b/drivers/infiniband/ulp/isert/ib_isert.h +@@ -126,6 +126,7 @@ struct isert_cmd { + struct rdma_rw_ctx rw; + struct work_struct comp_work; + struct scatterlist sg; ++ bool ctx_init_done; + }; + + static inline struct isert_cmd *tx_desc_to_cmd(struct iser_tx_desc *desc) diff --git a/queue-4.14/media-bt8xx-fix-err-bt878_probe.patch b/queue-4.14/media-bt8xx-fix-err-bt878_probe.patch new file mode 100644 index 00000000000..9532ca23037 --- /dev/null +++ b/queue-4.14/media-bt8xx-fix-err-bt878_probe.patch @@ -0,0 +1,37 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Christophe JAILLET +Date: Thu, 21 Sep 2017 19:23:56 -0400 +Subject: media: bt8xx: Fix err 'bt878_probe()' + +From: Christophe JAILLET + + +[ Upstream commit 45392ff6881dbe56d41ef0b17c2e576065f8ffa1 ] + +This is odd to call 'pci_disable_device()' in an error path before a +coresponding successful 'pci_enable_device()'. + +Return directly instead. + +Fixes: 77e0be12100a ("V4L/DVB (4176): Bug-fix: Fix memory overflow") + +Signed-off-by: Christophe JAILLET +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/media/pci/bt8xx/bt878.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/drivers/media/pci/bt8xx/bt878.c ++++ b/drivers/media/pci/bt8xx/bt878.c +@@ -422,8 +422,7 @@ static int bt878_probe(struct pci_dev *d + bt878_num); + if (bt878_num >= BT878_MAX) { + printk(KERN_ERR "bt878: Too many devices inserted\n"); +- result = -ENOMEM; +- goto fail0; ++ return -ENOMEM; + } + if (pci_enable_device(dev)) + return -EIO; diff --git a/queue-4.14/media-c8sectpfe-fix-potential-null-pointer-dereference-in-c8sectpfe_timer_interrupt.patch b/queue-4.14/media-c8sectpfe-fix-potential-null-pointer-dereference-in-c8sectpfe_timer_interrupt.patch new file mode 100644 index 00000000000..1e68faf15da --- /dev/null +++ b/queue-4.14/media-c8sectpfe-fix-potential-null-pointer-dereference-in-c8sectpfe_timer_interrupt.patch @@ -0,0 +1,47 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: "Gustavo A. R. Silva" +Date: Mon, 20 Nov 2017 09:00:55 -0500 +Subject: media: c8sectpfe: fix potential NULL pointer dereference in c8sectpfe_timer_interrupt + +From: "Gustavo A. R. Silva" + + +[ Upstream commit baed3c4bc4c13de93e0dba0a26d601411ebcb389 ] + +_channel_ is being dereferenced before it is null checked, hence there is a +potential null pointer dereference. Fix this by moving the pointer dereference +after _channel_ has been null checked. + +This issue was detected with the help of Coccinelle. + +Fixes: c5f5d0f99794 ("[media] c8sectpfe: STiH407/10 Linux DVB demux support") + +Signed-off-by: Gustavo A. R. Silva +Acked-by: Patrice Chotard +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c ++++ b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c +@@ -83,7 +83,7 @@ static void c8sectpfe_timer_interrupt(un + static void channel_swdemux_tsklet(unsigned long data) + { + struct channel_info *channel = (struct channel_info *)data; +- struct c8sectpfei *fei = channel->fei; ++ struct c8sectpfei *fei; + unsigned long wp, rp; + int pos, num_packets, n, size; + u8 *buf; +@@ -91,6 +91,8 @@ static void channel_swdemux_tsklet(unsig + if (unlikely(!channel || !channel->irec)) + return; + ++ fei = channel->fei; ++ + wp = readl(channel->irec + DMA_PRDS_BUSWP_TP(0)); + rp = readl(channel->irec + DMA_PRDS_BUSRP_TP(0)); + diff --git a/queue-4.14/media-davinci-fix-a-debug-printk.patch b/queue-4.14/media-davinci-fix-a-debug-printk.patch new file mode 100644 index 00000000000..a76cc621a9e --- /dev/null +++ b/queue-4.14/media-davinci-fix-a-debug-printk.patch @@ -0,0 +1,52 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Mauro Carvalho Chehab +Date: Wed, 1 Nov 2017 17:05:49 -0400 +Subject: media: davinci: fix a debug printk + +From: Mauro Carvalho Chehab + + +[ Upstream commit 4f6c11044f512356cb63d3df0f3b38db79dc6736 ] + +Two orthogonal changesets caused a breakage at a printk +inside davinci. Commit a2d17962c9ca +("[media] davinci: Switch from V4L2 OF to V4L2 fwnode") +made davinci to use struct fwnode_handle instead of +struct device_node. Commit 68d9c47b1679 +("media: Convert to using %pOF instead of full_name") +changed the printk to not use ->full_name, but, instead, +to rely on %pOF. + +With both patches applied, the Kernel will do the wrong +thing, as warned by smatch: + drivers/media/platform/davinci/vpif_capture.c:1399 vpif_async_bound() error: '%pOF' expects argument of type 'struct device_node*', argument 5 has type 'void*' + +So, change the logic to actually print the device name +that was obtained before the print logic. + +Fixes: 68d9c47b1679 ("media: Convert to using %pOF instead of full_name") +Fixes: a2d17962c9ca ("[media] davinci: Switch from V4L2 OF to V4L2 fwnode") + +Signed-off-by: Mauro Carvalho Chehab +Acked-by: Lad, Prabhakar +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/media/platform/davinci/vpif_capture.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/media/platform/davinci/vpif_capture.c ++++ b/drivers/media/platform/davinci/vpif_capture.c +@@ -1397,9 +1397,9 @@ static int vpif_async_bound(struct v4l2_ + vpif_obj.config->chan_config->inputs[i].subdev_name = + (char *)to_of_node(subdev->fwnode)->full_name; + vpif_dbg(2, debug, +- "%s: setting input %d subdev_name = %pOF\n", ++ "%s: setting input %d subdev_name = %s\n", + __func__, i, +- to_of_node(subdev->fwnode)); ++ vpif_obj.config->chan_config->inputs[i].subdev_name); + return 0; + } + } diff --git a/queue-4.14/media-media-dvb-frontends-add-delay-to-si2168-restart.patch b/queue-4.14/media-media-dvb-frontends-add-delay-to-si2168-restart.patch new file mode 100644 index 00000000000..35dcb579bfa --- /dev/null +++ b/queue-4.14/media-media-dvb-frontends-add-delay-to-si2168-restart.patch @@ -0,0 +1,41 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Ron Economos +Date: Mon, 11 Dec 2017 19:51:53 -0500 +Subject: media: [RESEND] media: dvb-frontends: Add delay to Si2168 restart + +From: Ron Economos + + +[ Upstream commit 380a6c86457573aa42d27ae11e025eb25941a0b7 ] + +On faster CPUs a delay is required after the resume command and the restart command. Without the delay, the restart command often returns -EREMOTEIO and the Si2168 does not restart. + +Note that this patch fixes the same issue as https://patchwork.linuxtv.org/patch/44304/, but I believe my udelay() fix addresses the actual problem. + +Signed-off-by: Ron Economos +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/media/dvb-frontends/si2168.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/media/dvb-frontends/si2168.c ++++ b/drivers/media/dvb-frontends/si2168.c +@@ -14,6 +14,8 @@ + * GNU General Public License for more details. + */ + ++#include ++ + #include "si2168_priv.h" + + static const struct dvb_frontend_ops si2168_ops; +@@ -435,6 +437,7 @@ static int si2168_init(struct dvb_fronte + if (ret) + goto err; + ++ udelay(100); + memcpy(cmd.args, "\x85", 1); + cmd.wlen = 1; + cmd.rlen = 1; diff --git a/queue-4.14/media-s5p-mfc-fix-lock-contention-request_firmware-once.patch b/queue-4.14/media-s5p-mfc-fix-lock-contention-request_firmware-once.patch new file mode 100644 index 00000000000..234335e5e29 --- /dev/null +++ b/queue-4.14/media-s5p-mfc-fix-lock-contention-request_firmware-once.patch @@ -0,0 +1,175 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Shuah Khan +Date: Fri, 3 Nov 2017 22:01:58 -0400 +Subject: media: s5p-mfc: Fix lock contention - request_firmware() once + +From: Shuah Khan + + +[ Upstream commit f45ce9877561044090010e0eb0fad644232ded04 ] + +Driver calls request_firmware() whenever the device is opened for the +first time. As the device gets opened and closed, dev->num_inst == 1 +is true several times. This is not necessary since the firmware is saved +in the fw_buf. s5p_mfc_load_firmware() copies the buffer returned by +the request_firmware() to dev->fw_buf. + +fw_buf sticks around until it gets released from s5p_mfc_remove(), hence +there is no need to keep requesting firmware and copying it to fw_buf. + +This might have been overlooked when changes are made to free fw_buf from +the device release interface s5p_mfc_release(). + +Fix s5p_mfc_load_firmware() to call request_firmware() once and keep state. +Change _probe() to load firmware once fw_buf has been allocated. + +s5p_mfc_open() and it continues to call s5p_mfc_load_firmware() and init +hardware which is the step where firmware is written to the device. + +This addresses the mfc_mutex contention due to repeated request_firmware() +calls from open() in the following circular locking warning: + +[ 552.194115] qtdemux0:sink/2710 is trying to acquire lock: +[ 552.199488] (&dev->mfc_mutex){+.+.}, at: [] s5p_mfc_mmap+0x28/0xd4 [s5p_mfc] +[ 552.207459] + but task is already holding lock: +[ 552.213264] (&mm->mmap_sem){++++}, at: [] vm_mmap_pgoff+0x44/0xb8 +[ 552.220284] + which lock already depends on the new lock. + +[ 552.228429] + the existing dependency chain (in reverse order) is: +[ 552.235881] + -> #2 (&mm->mmap_sem){++++}: +[ 552.241259] __might_fault+0x80/0xb0 +[ 552.245331] filldir64+0xc0/0x2f8 +[ 552.249144] call_filldir+0xb0/0x14c +[ 552.253214] ext4_readdir+0x768/0x90c +[ 552.257374] iterate_dir+0x74/0x168 +[ 552.261360] SyS_getdents64+0x7c/0x1a0 +[ 552.265608] ret_fast_syscall+0x0/0x28 +[ 552.269850] + -> #1 (&type->i_mutex_dir_key#2){++++}: +[ 552.276180] down_read+0x48/0x90 +[ 552.279904] lookup_slow+0x74/0x178 +[ 552.283889] walk_component+0x1a4/0x2e4 +[ 552.288222] link_path_walk+0x174/0x4a0 +[ 552.292555] path_openat+0x68/0x944 +[ 552.296541] do_filp_open+0x60/0xc4 +[ 552.300528] file_open_name+0xe4/0x114 +[ 552.304772] filp_open+0x28/0x48 +[ 552.308499] kernel_read_file_from_path+0x30/0x78 +[ 552.313700] _request_firmware+0x3ec/0x78c +[ 552.318291] request_firmware+0x3c/0x54 +[ 552.322642] s5p_mfc_load_firmware+0x54/0x150 [s5p_mfc] +[ 552.328358] s5p_mfc_open+0x4e4/0x550 [s5p_mfc] +[ 552.333394] v4l2_open+0xa0/0x104 [videodev] +[ 552.338137] chrdev_open+0xa4/0x18c +[ 552.342121] do_dentry_open+0x208/0x310 +[ 552.346454] path_openat+0x28c/0x944 +[ 552.350526] do_filp_open+0x60/0xc4 +[ 552.354512] do_sys_open+0x118/0x1c8 +[ 552.358586] ret_fast_syscall+0x0/0x28 +[ 552.362830] + -> #0 (&dev->mfc_mutex){+.+.}: + -> #0 (&dev->mfc_mutex){+.+.}: +[ 552.368379] lock_acquire+0x6c/0x88 +[ 552.372364] __mutex_lock+0x68/0xa34 +[ 552.376437] mutex_lock_interruptible_nested+0x1c/0x24 +[ 552.382086] s5p_mfc_mmap+0x28/0xd4 [s5p_mfc] +[ 552.386939] v4l2_mmap+0x54/0x88 [videodev] +[ 552.391601] mmap_region+0x3a8/0x638 +[ 552.395673] do_mmap+0x330/0x3a4 +[ 552.399400] vm_mmap_pgoff+0x90/0xb8 +[ 552.403472] SyS_mmap_pgoff+0x90/0xc0 +[ 552.407632] ret_fast_syscall+0x0/0x28 +[ 552.411876] + other info that might help us debug this: + +[ 552.419848] Chain exists of: + &dev->mfc_mutex --> &type->i_mutex_dir_key#2 --> &mm->mmap_sem + +[ 552.431200] Possible unsafe locking scenario: + +[ 552.437092] CPU0 CPU1 +[ 552.441598] ---- ---- +[ 552.446104] lock(&mm->mmap_sem); +[ 552.449484] lock(&type->i_mutex_dir_key#2); +[ 552.456329] lock(&mm->mmap_sem); +[ 552.462222] lock(&dev->mfc_mutex); +[ 552.465775] + *** DEADLOCK *** + +Signed-off-by: Shuah Khan +Signed-off-by: Sylwester Nawrocki +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/media/platform/s5p-mfc/s5p_mfc.c | 6 ++++++ + drivers/media/platform/s5p-mfc/s5p_mfc_common.h | 3 +++ + drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c | 5 +++++ + 3 files changed, 14 insertions(+) + +--- a/drivers/media/platform/s5p-mfc/s5p_mfc.c ++++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c +@@ -1315,6 +1315,12 @@ static int s5p_mfc_probe(struct platform + goto err_dma; + } + ++ /* ++ * Load fails if fs isn't mounted. Try loading anyway. ++ * _open() will load it, it it fails now. Ignore failure. ++ */ ++ s5p_mfc_load_firmware(dev); ++ + mutex_init(&dev->mfc_mutex); + init_waitqueue_head(&dev->queue); + dev->hw_lock = 0; +--- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h ++++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h +@@ -290,6 +290,8 @@ struct s5p_mfc_priv_buf { + * @mfc_cmds: cmd structure holding HW commands function pointers + * @mfc_regs: structure holding MFC registers + * @fw_ver: loaded firmware sub-version ++ * @fw_get_done flag set when request_firmware() is complete and ++ * copied into fw_buf + * risc_on: flag indicates RISC is on or off + * + */ +@@ -336,6 +338,7 @@ struct s5p_mfc_dev { + struct s5p_mfc_hw_cmds *mfc_cmds; + const struct s5p_mfc_regs *mfc_regs; + enum s5p_mfc_fw_ver fw_ver; ++ bool fw_get_done; + bool risc_on; /* indicates if RISC is on or off */ + }; + +--- a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c ++++ b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c +@@ -55,6 +55,9 @@ int s5p_mfc_load_firmware(struct s5p_mfc + * into kernel. */ + mfc_debug_enter(); + ++ if (dev->fw_get_done) ++ return 0; ++ + for (i = MFC_FW_MAX_VERSIONS - 1; i >= 0; i--) { + if (!dev->variant->fw_name[i]) + continue; +@@ -82,6 +85,7 @@ int s5p_mfc_load_firmware(struct s5p_mfc + } + memcpy(dev->fw_buf.virt, fw_blob->data, fw_blob->size); + wmb(); ++ dev->fw_get_done = true; + release_firmware(fw_blob); + mfc_debug_leave(); + return 0; +@@ -93,6 +97,7 @@ int s5p_mfc_release_firmware(struct s5p_ + /* Before calling this function one has to make sure + * that MFC is no longer processing */ + s5p_mfc_release_priv_buf(dev, &dev->fw_buf); ++ dev->fw_get_done = false; + return 0; + } + diff --git a/queue-4.14/mmc-avoid-removing-non-removable-hosts-during-suspend.patch b/queue-4.14/mmc-avoid-removing-non-removable-hosts-during-suspend.patch new file mode 100644 index 00000000000..670618bf0b6 --- /dev/null +++ b/queue-4.14/mmc-avoid-removing-non-removable-hosts-during-suspend.patch @@ -0,0 +1,62 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Daniel Drake +Date: Tue, 12 Dec 2017 10:49:02 +0000 +Subject: mmc: avoid removing non-removable hosts during suspend + +From: Daniel Drake + + +[ Upstream commit de8dcc3d2c0e08e5068ee1e26fc46415c15e3637 ] + +The Weibu F3C MiniPC has an onboard AP6255 module, presenting +two SDIO functions on a single MMC host (Bluetooth/btsdio and +WiFi/brcmfmac), and the mmc layer correctly detects this as +non-removable. + +After suspend/resume, the wifi and bluetooth interfaces disappear +and do not get probed again. + +The conditions here are: + + 1. During suspend, we reach mmc_pm_notify() + + 2. mmc_pm_notify() calls mmc_sdio_pre_suspend() to see if we can + suspend the SDIO host. However, mmc_sdio_pre_suspend() returns + -ENOSYS because btsdio_driver does not have a suspend method. + + 3. mmc_pm_notify() proceeds to remove the card + + 4. Upon resume, mmc_rescan() does nothing with this host, because of + the rescan_entered check which aims to only scan a non-removable + device a single time (i.e. during boot). + +Fix the loss of functionality by detecting that we are unable to +suspend a non-removable host, so avoid the forced removal in that +case. The comment above this function already indicates that this +code was only intended for removable devices. + +Signed-off-by: Daniel Drake +Signed-off-by: Ulf Hansson +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/mmc/core/core.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +--- a/drivers/mmc/core/core.c ++++ b/drivers/mmc/core/core.c +@@ -2751,6 +2751,14 @@ static int mmc_pm_notify(struct notifier + if (!err) + break; + ++ if (!mmc_card_is_removable(host)) { ++ dev_warn(mmc_dev(host), ++ "pre_suspend failed for non-removable host: " ++ "%d\n", err); ++ /* Avoid removing non-removable hosts */ ++ break; ++ } ++ + /* Calling bus_ops->remove() with a claimed host can deadlock */ + host->bus_ops->remove(host); + mmc_claim_host(host); diff --git a/queue-4.14/mmc-block-fix-logical-error-to-avoid-memory-leak.patch b/queue-4.14/mmc-block-fix-logical-error-to-avoid-memory-leak.patch new file mode 100644 index 00000000000..b0020749133 --- /dev/null +++ b/queue-4.14/mmc-block-fix-logical-error-to-avoid-memory-leak.patch @@ -0,0 +1,33 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: "Liu, Changcheng" +Date: Sat, 16 Dec 2017 23:15:45 +0800 +Subject: mmc: block: fix logical error to avoid memory leak + +From: "Liu, Changcheng" + + +[ Upstream commit 0be55579a127916ebe39db2a74d906a2dfceed42 ] + +If the MMC_DRV_OP_GET_EXT_CSD request completes successfully, then +ext_csd must be freed, but in one case it was not. Fix that. + +Signed-off-by: Liu Changcheng +Acked-by: Adrian Hunter +Acked-by: Linus Walleij +Signed-off-by: Ulf Hansson +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/mmc/core/block.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/mmc/core/block.c ++++ b/drivers/mmc/core/block.c +@@ -2387,6 +2387,7 @@ static int mmc_ext_csd_open(struct inode + + if (n != EXT_CSD_STR_LEN) { + err = -EINVAL; ++ kfree(ext_csd); + goto out_free; + } + diff --git a/queue-4.14/mmc-sdhci-xenon-wait-5ms-after-set-1.8v-signal-enable.patch b/queue-4.14/mmc-sdhci-xenon-wait-5ms-after-set-1.8v-signal-enable.patch new file mode 100644 index 00000000000..707fba74adc --- /dev/null +++ b/queue-4.14/mmc-sdhci-xenon-wait-5ms-after-set-1.8v-signal-enable.patch @@ -0,0 +1,52 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Zhoujie Wu +Date: Mon, 18 Dec 2017 14:38:47 -0800 +Subject: mmc: sdhci-xenon: wait 5ms after set 1.8V signal enable + +From: Zhoujie Wu + + +[ Upstream commit 8d876bf472dba73c015cea9feea80dcb80626a7c ] + +According to SD spec 3.00 3.6.1 signal voltage switch +procedure step 6~8, +(6) Set 1.8V Signal Enable in the Host Control 2 register. +(7) Wait 5ms. 1.8V voltage regulator shall be stable within this period. +(8) If 1.8V Signal Enable is cleared by Host Controller, go to step (12). +Host should wait 5ms after set 1.8V signal enable bit in +Host Control 2 register and check if 1.8V is stable or not. + +But current code checks this bit right after set it. +On some platforms with xenon controller found the bit is +cleared right away and host reports "1.8V regulator output +did not became stable" and 5ms delay can help. + +Implement voltage_switch callback for xenon controller to add 5ms +delay to make sure the 1.8V signal enable bit is set by controller. + +Signed-off-by: Zhoujie Wu +Acked-by: Adrian Hunter +Signed-off-by: Ulf Hansson +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/mmc/host/sdhci-xenon.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- a/drivers/mmc/host/sdhci-xenon.c ++++ b/drivers/mmc/host/sdhci-xenon.c +@@ -230,7 +230,14 @@ static void xenon_set_power(struct sdhci + mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd); + } + ++static void xenon_voltage_switch(struct sdhci_host *host) ++{ ++ /* Wait for 5ms after set 1.8V signal enable bit */ ++ usleep_range(5000, 5500); ++} ++ + static const struct sdhci_ops sdhci_xenon_ops = { ++ .voltage_switch = xenon_voltage_switch, + .set_clock = sdhci_set_clock, + .set_power = xenon_set_power, + .set_bus_width = sdhci_set_bus_width, diff --git a/queue-4.14/net-fec-add-phy_reset_after_clk_enable-support.patch b/queue-4.14/net-fec-add-phy_reset_after_clk_enable-support.patch new file mode 100644 index 00000000000..0404c6ed7e9 --- /dev/null +++ b/queue-4.14/net-fec-add-phy_reset_after_clk_enable-support.patch @@ -0,0 +1,87 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Richard Leitner +Date: Mon, 11 Dec 2017 13:17:00 +0100 +Subject: net: fec: add phy_reset_after_clk_enable() support + +From: Richard Leitner + + +[ Upstream commit 1b0a83ac04e383e3bed21332962b90710fcf2828 ] + +Some PHYs (for example the SMSC LAN8710/LAN8720) doesn't allow turning +the refclk on and off again during operation (according to their +datasheet). Nonetheless exactly this behaviour was introduced for power +saving reasons by commit e8fcfcd5684a ("net: fec: optimize the clock management to save power"). +Therefore add support for the phy_reset_after_clk_enable function from +phylib to mitigate this issue. + +Generally speaking this issue is only relevant if the ref clk for the +PHY is generated by the SoC and therefore the PHY is configured to +"REF_CLK In Mode". In our specific case (PCB) this problem does occur at +about every 10th to 50th POR of an LAN8710 connected to an i.MX6SOLO +SoC. The typical symptom of this problem is a "swinging" ethernet link. +Similar issues were reported by users of the NXP forum: + https://community.nxp.com/thread/389902 + https://community.nxp.com/message/309354 +With this patch applied the issue didn't occur for at least a few +hundret PORs of our board. + +Fixes: e8fcfcd5684a ("net: fec: optimize the clock management to save power") +Signed-off-by: Richard Leitner +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/freescale/fec_main.c | 20 ++++++++++++++++++++ + 1 file changed, 20 insertions(+) + +--- a/drivers/net/ethernet/freescale/fec_main.c ++++ b/drivers/net/ethernet/freescale/fec_main.c +@@ -1872,6 +1872,8 @@ static int fec_enet_clk_enable(struct ne + ret = clk_prepare_enable(fep->clk_ref); + if (ret) + goto failed_clk_ref; ++ ++ phy_reset_after_clk_enable(ndev->phydev); + } else { + clk_disable_unprepare(fep->clk_ahb); + clk_disable_unprepare(fep->clk_enet_out); +@@ -2844,6 +2846,7 @@ fec_enet_open(struct net_device *ndev) + { + struct fec_enet_private *fep = netdev_priv(ndev); + int ret; ++ bool reset_again; + + ret = pm_runtime_get_sync(&fep->pdev->dev); + if (ret < 0) +@@ -2854,6 +2857,17 @@ fec_enet_open(struct net_device *ndev) + if (ret) + goto clk_enable; + ++ /* During the first fec_enet_open call the PHY isn't probed at this ++ * point. Therefore the phy_reset_after_clk_enable() call within ++ * fec_enet_clk_enable() fails. As we need this reset in order to be ++ * sure the PHY is working correctly we check if we need to reset again ++ * later when the PHY is probed ++ */ ++ if (ndev->phydev && ndev->phydev->drv) ++ reset_again = false; ++ else ++ reset_again = true; ++ + /* I should reset the ring buffers here, but I don't yet know + * a simple way to do that. + */ +@@ -2870,6 +2884,12 @@ fec_enet_open(struct net_device *ndev) + if (ret) + goto err_enet_mii_probe; + ++ /* Call phy_reset_after_clk_enable() again if it failed during ++ * phy_reset_after_clk_enable() before because the PHY wasn't probed. ++ */ ++ if (reset_again) ++ phy_reset_after_clk_enable(ndev->phydev); ++ + if (fep->quirks & FEC_QUIRK_ERR006687) + imx6q_cpuidle_fec_irqs_used(); + diff --git a/queue-4.14/net-phy-meson-gxl-check-phy_write-return-value.patch b/queue-4.14/net-phy-meson-gxl-check-phy_write-return-value.patch new file mode 100644 index 00000000000..a452ceaa50a --- /dev/null +++ b/queue-4.14/net-phy-meson-gxl-check-phy_write-return-value.patch @@ -0,0 +1,89 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Jerome Brunet +Date: Mon, 18 Dec 2017 10:44:40 +0100 +Subject: net: phy: meson-gxl: check phy_write return value + +From: Jerome Brunet + + +[ Upstream commit 9042b46eda33ef5db3cdfc9e12b3c8cabb196141 ] + +Always check phy_write return values. Better to be safe than sorry + +Reviewed-by: Andrew Lunn +Signed-off-by: Jerome Brunet +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/phy/meson-gxl.c | 50 +++++++++++++++++++++++++++++++++----------- + 1 file changed, 38 insertions(+), 12 deletions(-) + +--- a/drivers/net/phy/meson-gxl.c ++++ b/drivers/net/phy/meson-gxl.c +@@ -25,27 +25,53 @@ + + static int meson_gxl_config_init(struct phy_device *phydev) + { ++ int ret; ++ + /* Enable Analog and DSP register Bank access by */ +- phy_write(phydev, 0x14, 0x0000); +- phy_write(phydev, 0x14, 0x0400); +- phy_write(phydev, 0x14, 0x0000); +- phy_write(phydev, 0x14, 0x0400); ++ ret = phy_write(phydev, 0x14, 0x0000); ++ if (ret) ++ return ret; ++ ret = phy_write(phydev, 0x14, 0x0400); ++ if (ret) ++ return ret; ++ ret = phy_write(phydev, 0x14, 0x0000); ++ if (ret) ++ return ret; ++ ret = phy_write(phydev, 0x14, 0x0400); ++ if (ret) ++ return ret; + + /* Write Analog register 23 */ +- phy_write(phydev, 0x17, 0x8E0D); +- phy_write(phydev, 0x14, 0x4417); ++ ret = phy_write(phydev, 0x17, 0x8E0D); ++ if (ret) ++ return ret; ++ ret = phy_write(phydev, 0x14, 0x4417); ++ if (ret) ++ return ret; + + /* Enable fractional PLL */ +- phy_write(phydev, 0x17, 0x0005); +- phy_write(phydev, 0x14, 0x5C1B); ++ ret = phy_write(phydev, 0x17, 0x0005); ++ if (ret) ++ return ret; ++ ret = phy_write(phydev, 0x14, 0x5C1B); ++ if (ret) ++ return ret; + + /* Program fraction FR_PLL_DIV1 */ +- phy_write(phydev, 0x17, 0x029A); +- phy_write(phydev, 0x14, 0x5C1D); ++ ret = phy_write(phydev, 0x17, 0x029A); ++ if (ret) ++ return ret; ++ ret = phy_write(phydev, 0x14, 0x5C1D); ++ if (ret) ++ return ret; + + /* Program fraction FR_PLL_DIV1 */ +- phy_write(phydev, 0x17, 0xAAAA); +- phy_write(phydev, 0x14, 0x5C1C); ++ ret = phy_write(phydev, 0x17, 0xAAAA); ++ if (ret) ++ return ret; ++ ret = phy_write(phydev, 0x14, 0x5C1C); ++ if (ret) ++ return ret; + + return 0; + } diff --git a/queue-4.14/nfsd4-permit-layoutget-of-executable-only-files.patch b/queue-4.14/nfsd4-permit-layoutget-of-executable-only-files.patch new file mode 100644 index 00000000000..390109df325 --- /dev/null +++ b/queue-4.14/nfsd4-permit-layoutget-of-executable-only-files.patch @@ -0,0 +1,46 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Benjamin Coddington +Date: Tue, 19 Dec 2017 09:35:25 -0500 +Subject: nfsd4: permit layoutget of executable-only files + +From: Benjamin Coddington + + +[ Upstream commit 66282ec1cf004c09083c29cb5e49019037937bbd ] + +Clients must be able to read a file in order to execute it, and for pNFS +that means the client needs to be able to perform a LAYOUTGET on the file. + +This behavior for executable-only files was added for OPEN in commit +a043226bc140 "nfsd4: permit read opens of executable-only files". + +This fixes up xfstests generic/126 on block/scsi layouts. + +Signed-off-by: Benjamin Coddington +Signed-off-by: J. Bruce Fields +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + fs/nfsd/nfs4proc.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/fs/nfsd/nfs4proc.c ++++ b/fs/nfsd/nfs4proc.c +@@ -1372,14 +1372,14 @@ nfsd4_layoutget(struct svc_rqst *rqstp, + const struct nfsd4_layout_ops *ops; + struct nfs4_layout_stateid *ls; + __be32 nfserr; +- int accmode; ++ int accmode = NFSD_MAY_READ_IF_EXEC; + + switch (lgp->lg_seg.iomode) { + case IOMODE_READ: +- accmode = NFSD_MAY_READ; ++ accmode |= NFSD_MAY_READ; + break; + case IOMODE_RW: +- accmode = NFSD_MAY_READ | NFSD_MAY_WRITE; ++ accmode |= NFSD_MAY_READ | NFSD_MAY_WRITE; + break; + default: + dprintk("%s: invalid iomode %d\n", diff --git a/queue-4.14/omapdrm-panel-fix-compatible-vendor-string-for-td028ttec1.patch b/queue-4.14/omapdrm-panel-fix-compatible-vendor-string-for-td028ttec1.patch new file mode 100644 index 00000000000..76b1325dd94 --- /dev/null +++ b/queue-4.14/omapdrm-panel-fix-compatible-vendor-string-for-td028ttec1.patch @@ -0,0 +1,132 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: "H. Nikolaus Schaller" +Date: Tue, 28 Nov 2017 16:48:54 +0100 +Subject: omapdrm: panel: fix compatible vendor string for td028ttec1 + +From: "H. Nikolaus Schaller" + + +[ Upstream commit c1b9d4c75cd549e08bd0596d7f9dcc20f7f6e8fa ] + +The vendor name was "toppoly" but other panels and the vendor list +have defined it as "tpo". So let's fix it in driver and bindings. + +We keep the old definition in parallel to stay compatible with +potential older DTB setup. + +Signed-off-by: H. Nikolaus Schaller +Signed-off-by: Tomi Valkeinen +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + Documentation/devicetree/bindings/display/panel/toppoly,td028ttec1.txt | 30 ---------- + Documentation/devicetree/bindings/display/panel/tpo,td028ttec1.txt | 30 ++++++++++ + drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c | 3 + + drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td028ttec1.c | 3 + + 4 files changed, 36 insertions(+), 30 deletions(-) + rename Documentation/devicetree/bindings/display/panel/{toppoly,td028ttec1.txt => tpo,td028ttec1.txt} (84%) + +--- a/Documentation/devicetree/bindings/display/panel/toppoly,td028ttec1.txt ++++ /dev/null +@@ -1,30 +0,0 @@ +-Toppoly TD028TTEC1 Panel +-======================== +- +-Required properties: +-- compatible: "toppoly,td028ttec1" +- +-Optional properties: +-- label: a symbolic name for the panel +- +-Required nodes: +-- Video port for DPI input +- +-Example +-------- +- +-lcd-panel: td028ttec1@0 { +- compatible = "toppoly,td028ttec1"; +- reg = <0>; +- spi-max-frequency = <100000>; +- spi-cpol; +- spi-cpha; +- +- label = "lcd"; +- port { +- lcd_in: endpoint { +- remote-endpoint = <&dpi_out>; +- }; +- }; +-}; +- +--- /dev/null ++++ b/Documentation/devicetree/bindings/display/panel/tpo,td028ttec1.txt +@@ -0,0 +1,30 @@ ++Toppoly TD028TTEC1 Panel ++======================== ++ ++Required properties: ++- compatible: "tpo,td028ttec1" ++ ++Optional properties: ++- label: a symbolic name for the panel ++ ++Required nodes: ++- Video port for DPI input ++ ++Example ++------- ++ ++lcd-panel: td028ttec1@0 { ++ compatible = "tpo,td028ttec1"; ++ reg = <0>; ++ spi-max-frequency = <100000>; ++ spi-cpol; ++ spi-cpha; ++ ++ label = "lcd"; ++ port { ++ lcd_in: endpoint { ++ remote-endpoint = <&dpi_out>; ++ }; ++ }; ++}; ++ +--- a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c ++++ b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c +@@ -452,6 +452,8 @@ static int td028ttec1_panel_remove(struc + } + + static const struct of_device_id td028ttec1_of_match[] = { ++ { .compatible = "omapdss,tpo,td028ttec1", }, ++ /* keep to not break older DTB */ + { .compatible = "omapdss,toppoly,td028ttec1", }, + {}, + }; +@@ -471,6 +473,7 @@ static struct spi_driver td028ttec1_spi_ + + module_spi_driver(td028ttec1_spi_driver); + ++MODULE_ALIAS("spi:tpo,td028ttec1"); + MODULE_ALIAS("spi:toppoly,td028ttec1"); + MODULE_AUTHOR("H. Nikolaus Schaller "); + MODULE_DESCRIPTION("Toppoly TD028TTEC1 panel driver"); +--- a/drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td028ttec1.c ++++ b/drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td028ttec1.c +@@ -455,6 +455,8 @@ static int td028ttec1_panel_remove(struc + } + + static const struct of_device_id td028ttec1_of_match[] = { ++ { .compatible = "omapdss,tpo,td028ttec1", }, ++ /* keep to not break older DTB */ + { .compatible = "omapdss,toppoly,td028ttec1", }, + {}, + }; +@@ -474,6 +476,7 @@ static struct spi_driver td028ttec1_spi_ + + module_spi_driver(td028ttec1_spi_driver); + ++MODULE_ALIAS("spi:tpo,td028ttec1"); + MODULE_ALIAS("spi:toppoly,td028ttec1"); + MODULE_AUTHOR("H. Nikolaus Schaller "); + MODULE_DESCRIPTION("Toppoly TD028TTEC1 panel driver"); diff --git a/queue-4.14/pci-designware-ep-fix-get_msi-to-check-msi_en-bit.patch b/queue-4.14/pci-designware-ep-fix-get_msi-to-check-msi_en-bit.patch new file mode 100644 index 00000000000..0a72c156da2 --- /dev/null +++ b/queue-4.14/pci-designware-ep-fix-get_msi-to-check-msi_en-bit.patch @@ -0,0 +1,68 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Kishon Vijay Abraham I +Date: Tue, 19 Dec 2017 15:25:41 +0530 +Subject: PCI: designware-ep: Fix ->get_msi() to check MSI_EN bit + +From: Kishon Vijay Abraham I + + +[ Upstream commit a134a457ed985dca8cce7ac4ea66129ea70eba73 ] + +->get_msi() now checks MSI_EN bit in the MSI CAPABILITY register to +find whether the host supports MSI instead of using the +MSI ADDRESS in the MSI CAPABILITY register. + +This fixes the issue with the following sequence + 'modprobe pci_endpoint_test' enables MSI + 'rmmod pci_endpoint_test' disables MSI but MSI address (in EP's + capability register) has a valid value + 'modprobe pci_endpoint_test no_msi=1' - Since MSI address (in EP's + capability register) has a valid value (set during the previous + insertion of the module), EP thinks host supports MSI. + +Fixes: f8aed6ec624f ("PCI: dwc: designware: Add EP mode support") +Signed-off-by: Kishon Vijay Abraham I +Signed-off-by: Lorenzo Pieralisi +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/pci/dwc/pcie-designware-ep.c | 12 +++--------- + drivers/pci/dwc/pcie-designware.h | 1 + + 2 files changed, 4 insertions(+), 9 deletions(-) + +--- a/drivers/pci/dwc/pcie-designware-ep.c ++++ b/drivers/pci/dwc/pcie-designware-ep.c +@@ -197,20 +197,14 @@ static int dw_pcie_ep_map_addr(struct pc + static int dw_pcie_ep_get_msi(struct pci_epc *epc) + { + int val; +- u32 lower_addr; +- u32 upper_addr; + struct dw_pcie_ep *ep = epc_get_drvdata(epc); + struct dw_pcie *pci = to_dw_pcie_from_ep(ep); + +- val = dw_pcie_readb_dbi(pci, MSI_MESSAGE_CONTROL); +- val = (val & MSI_CAP_MME_MASK) >> MSI_CAP_MME_SHIFT; +- +- lower_addr = dw_pcie_readl_dbi(pci, MSI_MESSAGE_ADDR_L32); +- upper_addr = dw_pcie_readl_dbi(pci, MSI_MESSAGE_ADDR_U32); +- +- if (!(lower_addr || upper_addr)) ++ val = dw_pcie_readw_dbi(pci, MSI_MESSAGE_CONTROL); ++ if (!(val & MSI_CAP_MSI_EN_MASK)) + return -EINVAL; + ++ val = (val & MSI_CAP_MME_MASK) >> MSI_CAP_MME_SHIFT; + return val; + } + +--- a/drivers/pci/dwc/pcie-designware.h ++++ b/drivers/pci/dwc/pcie-designware.h +@@ -101,6 +101,7 @@ + #define MSI_MESSAGE_CONTROL 0x52 + #define MSI_CAP_MMC_SHIFT 1 + #define MSI_CAP_MME_SHIFT 4 ++#define MSI_CAP_MSI_EN_MASK 0x1 + #define MSI_CAP_MME_MASK (7 << MSI_CAP_MME_SHIFT) + #define MSI_MESSAGE_ADDR_L32 0x54 + #define MSI_MESSAGE_ADDR_U32 0x58 diff --git a/queue-4.14/pci-endpoint-fix-find_first_zero_bit-usage.patch b/queue-4.14/pci-endpoint-fix-find_first_zero_bit-usage.patch new file mode 100644 index 00000000000..f1f5d079894 --- /dev/null +++ b/queue-4.14/pci-endpoint-fix-find_first_zero_bit-usage.patch @@ -0,0 +1,44 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Niklas Cassel +Date: Thu, 14 Dec 2017 14:01:46 +0100 +Subject: PCI: endpoint: Fix find_first_zero_bit() usage + +From: Niklas Cassel + + +[ Upstream commit 35ad61921f495ee14915d185de79478c1737b4da ] + +find_first_zero_bit()'s parameter 'size' is defined in bits, +not in bytes. + +Calling find_first_zero_bit() with the wrong size unit +will lead to insidious bugs. + +Fix this by calling find_first_zero_bit() with size BITS_PER_LONG, +rather than sizeof() and add missing find_first_zero_bit() return +handling. + +Fixes: d74679911610 ("PCI: endpoint: Introduce configfs entry for configuring EP functions") +Signed-off-by: Niklas Cassel +Signed-off-by: Lorenzo Pieralisi +Acked-by: Kishon Vijay Abraham I +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/pci/endpoint/pci-ep-cfs.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/drivers/pci/endpoint/pci-ep-cfs.c ++++ b/drivers/pci/endpoint/pci-ep-cfs.c +@@ -109,7 +109,10 @@ static int pci_epc_epf_link(struct confi + goto err_add_epf; + + func_no = find_first_zero_bit(&epc_group->function_num_map, +- sizeof(epc_group->function_num_map)); ++ BITS_PER_LONG); ++ if (func_no >= BITS_PER_LONG) ++ return -EINVAL; ++ + set_bit(func_no, &epc_group->function_num_map); + epf->func_no = func_no; + diff --git a/queue-4.14/pci-rcar-handle-rcar_pcie_parse_request_of_pci_ranges-failures.patch b/queue-4.14/pci-rcar-handle-rcar_pcie_parse_request_of_pci_ranges-failures.patch new file mode 100644 index 00000000000..93c1d593bf8 --- /dev/null +++ b/queue-4.14/pci-rcar-handle-rcar_pcie_parse_request_of_pci_ranges-failures.patch @@ -0,0 +1,45 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Geert Uytterhoeven +Date: Thu, 7 Dec 2017 11:15:20 +0100 +Subject: PCI: rcar: Handle rcar_pcie_parse_request_of_pci_ranges() failures + +From: Geert Uytterhoeven + + +[ Upstream commit 83c75ddd816e979802bd244ad494139f28152921 ] + +rcar_pcie_parse_request_of_pci_ranges() can fail and return an error +code, but this is not checked nor handled. + +Fix this by adding the missing error handling. + +Fixes: 5d2917d469faab72 ("PCI: rcar: Convert to DT resource parsing API") +Signed-off-by: Geert Uytterhoeven +Signed-off-by: Lorenzo Pieralisi +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/pci/host/pcie-rcar.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/drivers/pci/host/pcie-rcar.c ++++ b/drivers/pci/host/pcie-rcar.c +@@ -1141,7 +1141,9 @@ static int rcar_pcie_probe(struct platfo + + INIT_LIST_HEAD(&pcie->resources); + +- rcar_pcie_parse_request_of_pci_ranges(pcie); ++ err = rcar_pcie_parse_request_of_pci_ranges(pcie); ++ if (err) ++ goto err_free_bridge; + + err = rcar_pcie_get_resources(pcie); + if (err < 0) { +@@ -1196,6 +1198,7 @@ err_pm_disable: + + err_free_resource_list: + pci_free_resource_list(&pcie->resources); ++err_free_bridge: + pci_free_host_bridge(bridge); + + return err; diff --git a/queue-4.14/pinctrl-really-force-states-during-suspend-resume.patch b/queue-4.14/pinctrl-really-force-states-during-suspend-resume.patch new file mode 100644 index 00000000000..64413587ec6 --- /dev/null +++ b/queue-4.14/pinctrl-really-force-states-during-suspend-resume.patch @@ -0,0 +1,107 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Florian Fainelli +Date: Wed, 1 Mar 2017 10:32:57 -0800 +Subject: pinctrl: Really force states during suspend/resume + +From: Florian Fainelli + + +[ Upstream commit 981ed1bfbc6c4660b2ddaa8392893e20a6255048 ] + +In case a platform only defaults a "default" set of pins, but not a +"sleep" set of pins, and this particular platform suspends and resumes +in a way that the pin states are not preserved by the hardware, when we +resume, we would call pinctrl_single_resume() -> pinctrl_force_default() +-> pinctrl_select_state() and the first thing we do is check that the +pins state is the same as before, and do nothing. + +In order to fix this, decouple the actual state change from +pinctrl_select_state() and move it pinctrl_commit_state(), while keeping +the p->state == state check in pinctrl_select_state() not to change the +caller assumptions. pinctrl_force_sleep() and pinctrl_force_default() +are updated to bypass the state check by calling pinctrl_commit_state(). + +[Linus Walleij] +The forced pin control states are currently only used in some pin +controller drivers that grab their own reference to their own pins. +This is equal to the pin control hogs: pins taken by pin control +devices since there are no corresponding device in the Linux device +hierarchy, such as memory controller lines or unused GPIO lines, +or GPIO lines that are used orthogonally from the GPIO subsystem +but pincontrol-wise managed as hogs (non-strict mode, allowing +simultaneous use by GPIO and pin control). For this case forcing +the state from the drivers' suspend()/resume() callbacks makes +sense and should semantically match the name of the function. + +Fixes: 6e5e959dde0d ("pinctrl: API changes to support multiple states per device") +Signed-off-by: Florian Fainelli +Reviewed-by: Andy Shevchenko +Signed-off-by: Linus Walleij +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/pinctrl/core.c | 24 +++++++++++++++++------- + 1 file changed, 17 insertions(+), 7 deletions(-) + +--- a/drivers/pinctrl/core.c ++++ b/drivers/pinctrl/core.c +@@ -1189,19 +1189,16 @@ struct pinctrl_state *pinctrl_lookup_sta + EXPORT_SYMBOL_GPL(pinctrl_lookup_state); + + /** +- * pinctrl_select_state() - select/activate/program a pinctrl state to HW ++ * pinctrl_commit_state() - select/activate/program a pinctrl state to HW + * @p: the pinctrl handle for the device that requests configuration + * @state: the state handle to select/activate/program + */ +-int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *state) ++static int pinctrl_commit_state(struct pinctrl *p, struct pinctrl_state *state) + { + struct pinctrl_setting *setting, *setting2; + struct pinctrl_state *old_state = p->state; + int ret; + +- if (p->state == state) +- return 0; +- + if (p->state) { + /* + * For each pinmux setting in the old state, forget SW's record +@@ -1265,6 +1262,19 @@ unapply_new_state: + + return ret; + } ++ ++/** ++ * pinctrl_select_state() - select/activate/program a pinctrl state to HW ++ * @p: the pinctrl handle for the device that requests configuration ++ * @state: the state handle to select/activate/program ++ */ ++int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *state) ++{ ++ if (p->state == state) ++ return 0; ++ ++ return pinctrl_commit_state(p, state); ++} + EXPORT_SYMBOL_GPL(pinctrl_select_state); + + static void devm_pinctrl_release(struct device *dev, void *res) +@@ -1430,7 +1440,7 @@ void pinctrl_unregister_map(const struct + int pinctrl_force_sleep(struct pinctrl_dev *pctldev) + { + if (!IS_ERR(pctldev->p) && !IS_ERR(pctldev->hog_sleep)) +- return pinctrl_select_state(pctldev->p, pctldev->hog_sleep); ++ return pinctrl_commit_state(pctldev->p, pctldev->hog_sleep); + return 0; + } + EXPORT_SYMBOL_GPL(pinctrl_force_sleep); +@@ -1442,7 +1452,7 @@ EXPORT_SYMBOL_GPL(pinctrl_force_sleep); + int pinctrl_force_default(struct pinctrl_dev *pctldev) + { + if (!IS_ERR(pctldev->p) && !IS_ERR(pctldev->hog_default)) +- return pinctrl_select_state(pctldev->p, pctldev->hog_default); ++ return pinctrl_commit_state(pctldev->p, pctldev->hog_default); + return 0; + } + EXPORT_SYMBOL_GPL(pinctrl_force_default); diff --git a/queue-4.14/pinctrl-rockchip-enable-clock-when-reading-pin-direction-register.patch b/queue-4.14/pinctrl-rockchip-enable-clock-when-reading-pin-direction-register.patch new file mode 100644 index 00000000000..f524b8aa8df --- /dev/null +++ b/queue-4.14/pinctrl-rockchip-enable-clock-when-reading-pin-direction-register.patch @@ -0,0 +1,51 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Brian Norris +Date: Tue, 12 Dec 2017 09:43:43 -0800 +Subject: pinctrl: rockchip: enable clock when reading pin direction register + +From: Brian Norris + + +[ Upstream commit 5c9d8c4f6b8168738a26bcf288516cc3a0886810 ] + +We generally leave the GPIO clock disabled, unless an interrupt is +requested or we're accessing IO registers. We forgot to do this for the +->get_direction() callback, which means we can sometimes [1] get +incorrect results [2] from, e.g., /sys/kernel/debug/gpio. + +Enable the clock, so we get the right results! + +[1] Sometimes, because many systems have 1 or mor interrupt requested on +each GPIO bank, so they always leave their clock on. + +[2] Incorrect, meaning the register returns 0, and so we interpret that +as "input". + +Signed-off-by: Brian Norris +Reviewed-by: Heiko Stuebner +Signed-off-by: Linus Walleij +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/pinctrl/pinctrl-rockchip.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +--- a/drivers/pinctrl/pinctrl-rockchip.c ++++ b/drivers/pinctrl/pinctrl-rockchip.c +@@ -1989,8 +1989,16 @@ static int rockchip_gpio_get_direction(s + { + struct rockchip_pin_bank *bank = gpiochip_get_data(chip); + u32 data; ++ int ret; + ++ ret = clk_enable(bank->clk); ++ if (ret < 0) { ++ dev_err(bank->drvdata->dev, ++ "failed to enable clock for bank %s\n", bank->name); ++ return ret; ++ } + data = readl_relaxed(bank->reg_base + GPIO_SWPORT_DDR); ++ clk_disable(bank->clk); + + return !(data & BIT(offset)); + } diff --git a/queue-4.14/platform-chrome-use-proper-protocol-transfer-function.patch b/queue-4.14/platform-chrome-use-proper-protocol-transfer-function.patch new file mode 100644 index 00000000000..2f6b564c9d9 --- /dev/null +++ b/queue-4.14/platform-chrome-use-proper-protocol-transfer-function.patch @@ -0,0 +1,56 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Shawn Nematbakhsh +Date: Fri, 8 Sep 2017 13:50:11 -0700 +Subject: platform/chrome: Use proper protocol transfer function + +From: Shawn Nematbakhsh + + +[ Upstream commit d48b8c58c57f6edbe2965f0a5f62c5cf9593ca96 ] + +pkt_xfer should be used for protocol v3, and cmd_xfer otherwise. We had +one instance of these functions correct, but not the second, fall-back +case. We use the fall-back only when the first command returns an +IN_PROGRESS status, which is only used on some EC firmwares where we +don't want to constantly poll the bus, but instead back off and +sleep/retry for a little while. + +Fixes: 2c7589af3c4d ("mfd: cros_ec: add proto v3 skeleton") +Signed-off-by: Shawn Nematbakhsh +Signed-off-by: Brian Norris +Reviewed-by: Javier Martinez Canillas +Signed-off-by: Benson Leung +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/platform/chrome/cros_ec_proto.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +--- a/drivers/platform/chrome/cros_ec_proto.c ++++ b/drivers/platform/chrome/cros_ec_proto.c +@@ -60,12 +60,14 @@ static int send_command(struct cros_ec_d + struct cros_ec_command *msg) + { + int ret; ++ int (*xfer_fxn)(struct cros_ec_device *ec, struct cros_ec_command *msg); + + if (ec_dev->proto_version > 2) +- ret = ec_dev->pkt_xfer(ec_dev, msg); ++ xfer_fxn = ec_dev->pkt_xfer; + else +- ret = ec_dev->cmd_xfer(ec_dev, msg); ++ xfer_fxn = ec_dev->cmd_xfer; + ++ ret = (*xfer_fxn)(ec_dev, msg); + if (msg->result == EC_RES_IN_PROGRESS) { + int i; + struct cros_ec_command *status_msg; +@@ -88,7 +90,7 @@ static int send_command(struct cros_ec_d + for (i = 0; i < EC_COMMAND_RETRIES; i++) { + usleep_range(10000, 11000); + +- ret = ec_dev->cmd_xfer(ec_dev, status_msg); ++ ret = (*xfer_fxn)(ec_dev, status_msg); + if (ret < 0) + break; + diff --git a/queue-4.14/pty-cancel-pty-slave-port-buf-s-work-in-tty_release.patch b/queue-4.14/pty-cancel-pty-slave-port-buf-s-work-in-tty_release.patch new file mode 100644 index 00000000000..8e245f4def8 --- /dev/null +++ b/queue-4.14/pty-cancel-pty-slave-port-buf-s-work-in-tty_release.patch @@ -0,0 +1,80 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Sahara +Date: Wed, 13 Dec 2017 09:10:48 +0400 +Subject: pty: cancel pty slave port buf's work in tty_release + +From: Sahara + + +[ Upstream commit 2b022ab7542df60021ab57854b3faaaf42552eaf ] + +In case that CONFIG_SLUB_DEBUG is on and pty is used, races between +release_one_tty and flush_to_ldisc work threads may happen and lead +to use-after-free condition on tty->link->port. Because SLUB_DEBUG +is turned on, freed tty->link->port is filled with POISON_FREE value. +So far without SLUB_DEBUG, port was filled with zero and flush_to_ldisc +could return without a problem by checking if tty is NULL. + +CPU 0 CPU 1 +----- ----- +release_tty pty_write + cancel_work_sync(tty) to = tty->link + tty_kref_put(tty->link) tty_schedule_flip(to->port) + << workqueue >> ... + release_one_tty ... + pty_cleanup ... + kfree(tty->link->port) << workqueue >> + flush_to_ldisc + tty = READ_ONCE(port->itty) + tty is 0x6b6b6b6b6b6b6b6b + !!PANIC!! access tty->ldisc + + Unable to handle kernel paging request at virtual address 6b6b6b6b6b6b6b93 + pgd = ffffffc0eb1c3000 + [6b6b6b6b6b6b6b93] *pgd=0000000000000000, *pud=0000000000000000 + ------------[ cut here ]------------ + Kernel BUG at ffffff800851154c [verbose debug info unavailable] + Internal error: Oops - BUG: 96000004 [#1] PREEMPT SMP + CPU: 3 PID: 265 Comm: kworker/u8:9 Tainted: G W 3.18.31-g0a58eeb #1 + Hardware name: Qualcomm Technologies, Inc. MSM 8996pro v1.1 + PMI8996 Carbide (DT) + Workqueue: events_unbound flush_to_ldisc + task: ffffffc0ed610ec0 ti: ffffffc0ed624000 task.ti: ffffffc0ed624000 + PC is at ldsem_down_read_trylock+0x0/0x4c + LR is at tty_ldisc_ref+0x24/0x4c + pc : [] lr : [] pstate: 80400145 + sp : ffffffc0ed627cd0 + x29: ffffffc0ed627cd0 x28: 0000000000000000 + x27: ffffff8009e05000 x26: ffffffc0d382cfa0 + x25: 0000000000000000 x24: ffffff800a012f08 + x23: 0000000000000000 x22: ffffffc0703fbc88 + x21: 6b6b6b6b6b6b6b6b x20: 6b6b6b6b6b6b6b93 + x19: 0000000000000000 x18: 0000000000000001 + x17: 00e80000f80d6f53 x16: 0000000000000001 + x15: 0000007f7d826fff x14: 00000000000000a0 + x13: 0000000000000000 x12: 0000000000000109 + x11: 0000000000000000 x10: 0000000000000000 + x9 : ffffffc0ed624000 x8 : ffffffc0ed611580 + x7 : 0000000000000000 x6 : ffffff800a42e000 + x5 : 00000000000003fc x4 : 0000000003bd1201 + x3 : 0000000000000001 x2 : 0000000000000001 + x1 : ffffff800851004c x0 : 6b6b6b6b6b6b6b93 + +Signed-off-by: Sahara +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/tty/tty_io.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/tty/tty_io.c ++++ b/drivers/tty/tty_io.c +@@ -1481,6 +1481,8 @@ static void release_tty(struct tty_struc + if (tty->link) + tty->link->port->itty = NULL; + tty_buffer_cancel_work(tty->port); ++ if (tty->link) ++ tty_buffer_cancel_work(tty->link->port); + + tty_kref_put(tty->link); + tty_kref_put(tty); diff --git a/queue-4.14/qmi_wwan-set-flag_send_zlp-to-avoid-network-initiated-disconnect.patch b/queue-4.14/qmi_wwan-set-flag_send_zlp-to-avoid-network-initiated-disconnect.patch new file mode 100644 index 00000000000..c4a4979bf49 --- /dev/null +++ b/queue-4.14/qmi_wwan-set-flag_send_zlp-to-avoid-network-initiated-disconnect.patch @@ -0,0 +1,46 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: "Bjørn Mork" +Date: Thu, 14 Dec 2017 19:55:50 +0100 +Subject: qmi_wwan: set FLAG_SEND_ZLP to avoid network initiated disconnect + +From: "Bjørn Mork" + + +[ Upstream commit 245d21190aec547c0de64f70c0e6de871c185a24 ] + +It has been reported that the dummy byte we add to avoid +ZLPs can be forwarded by the modem to the PGW/GGSN, and that +some operators will drop the connection if this happens. + +In theory, QMI devices are based on CDC ECM and should as such +both support ZLPs and silently ignore the dummy byte. The latter +assumption failed. Let's test out the first. + +Signed-off-by: Bjørn Mork +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/usb/qmi_wwan.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/net/usb/qmi_wwan.c ++++ b/drivers/net/usb/qmi_wwan.c +@@ -826,7 +826,7 @@ err: + + static const struct driver_info qmi_wwan_info = { + .description = "WWAN/QMI device", +- .flags = FLAG_WWAN, ++ .flags = FLAG_WWAN | FLAG_SEND_ZLP, + .bind = qmi_wwan_bind, + .unbind = qmi_wwan_unbind, + .manage_power = qmi_wwan_manage_power, +@@ -835,7 +835,7 @@ static const struct driver_info qmi_wwan + + static const struct driver_info qmi_wwan_info_quirk_dtr = { + .description = "WWAN/QMI device", +- .flags = FLAG_WWAN, ++ .flags = FLAG_WWAN | FLAG_SEND_ZLP, + .bind = qmi_wwan_bind, + .unbind = qmi_wwan_unbind, + .manage_power = qmi_wwan_manage_power, diff --git a/queue-4.14/rdma-cma-use-correct-size-when-writing-netlink-stats.patch b/queue-4.14/rdma-cma-use-correct-size-when-writing-netlink-stats.patch new file mode 100644 index 00000000000..33e3a8f52f8 --- /dev/null +++ b/queue-4.14/rdma-cma-use-correct-size-when-writing-netlink-stats.patch @@ -0,0 +1,35 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Parav Pandit +Date: Tue, 14 Nov 2017 14:51:55 +0200 +Subject: RDMA/cma: Use correct size when writing netlink stats + +From: Parav Pandit + + +[ Upstream commit 7baaa49af3716fb31877c61f59b74d029ce15b75 ] + +The code was using the src size when formatting the dst. They are almost +certainly the same value but it reads wrong. + +Fixes: ce117ffac2e9 ("RDMA/cma: Export AF_IB statistics") +Signed-off-by: Parav Pandit +Reviewed-by: Daniel Jurgens +Signed-off-by: Leon Romanovsky +Signed-off-by: Jason Gunthorpe +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/infiniband/core/cma.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/infiniband/core/cma.c ++++ b/drivers/infiniband/core/cma.c +@@ -4436,7 +4436,7 @@ static int cma_get_id_stats(struct sk_bu + RDMA_NL_RDMA_CM_ATTR_SRC_ADDR)) + goto out; + if (ibnl_put_attr(skb, nlh, +- rdma_addr_size(cma_src_addr(id_priv)), ++ rdma_addr_size(cma_dst_addr(id_priv)), + cma_dst_addr(id_priv), + RDMA_NL_RDMA_CM_ATTR_DST_ADDR)) + goto out; diff --git a/queue-4.14/rdma-iwpm-fix-uninitialized-error-code-in-iwpm_send_mapinfo.patch b/queue-4.14/rdma-iwpm-fix-uninitialized-error-code-in-iwpm_send_mapinfo.patch new file mode 100644 index 00000000000..6d1d08487ae --- /dev/null +++ b/queue-4.14/rdma-iwpm-fix-uninitialized-error-code-in-iwpm_send_mapinfo.patch @@ -0,0 +1,40 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Geert Uytterhoeven +Date: Wed, 29 Nov 2017 09:47:33 +0100 +Subject: RDMA/iwpm: Fix uninitialized error code in iwpm_send_mapinfo() + +From: Geert Uytterhoeven + + +[ Upstream commit 302d6424e4a293a5761997e6c9fc3dfb1e4c355f ] + +With gcc-4.1.2: + + drivers/infiniband/core/iwpm_util.c: In function ‘iwpm_send_mapinfo’: + drivers/infiniband/core/iwpm_util.c:647: warning: ‘ret’ may be used uninitialized in this function + +Indeed, if nl_client is not found in any of the scanned has buckets, ret +will be used uninitialized. + +Preinitialize ret to -EINVAL to fix this. + +Fixes: 30dc5e63d6a5ad24 ("RDMA/core: Add support for iWARP Port Mapper user space service") +Signed-off-by: Geert Uytterhoeven +Reviewed-by: Tatyana Nikolova +Signed-off-by: Jason Gunthorpe +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/infiniband/core/iwpm_util.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/infiniband/core/iwpm_util.c ++++ b/drivers/infiniband/core/iwpm_util.c +@@ -654,6 +654,7 @@ int iwpm_send_mapinfo(u8 nl_client, int + } + skb_num++; + spin_lock_irqsave(&iwpm_mapinfo_lock, flags); ++ ret = -EINVAL; + for (i = 0; i < IWPM_MAPINFO_HASH_SIZE; i++) { + hlist_for_each_entry(map_info, &iwpm_hash_bucket[i], + hlist_node) { diff --git a/queue-4.14/rdma-ocrdma-fix-permissions-for-ocrdma_reset_stats.patch b/queue-4.14/rdma-ocrdma-fix-permissions-for-ocrdma_reset_stats.patch new file mode 100644 index 00000000000..db252a4675a --- /dev/null +++ b/queue-4.14/rdma-ocrdma-fix-permissions-for-ocrdma_reset_stats.patch @@ -0,0 +1,38 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Anton Vasilyev +Date: Tue, 8 Aug 2017 18:56:37 +0300 +Subject: RDMA/ocrdma: Fix permissions for OCRDMA_RESET_STATS + +From: Anton Vasilyev + + +[ Upstream commit 744820869166c8c78be891240cf5f66e8a333694 ] + +Debugfs file reset_stats is created with S_IRUSR permissions, +but ocrdma_dbgfs_ops_read() doesn't support OCRDMA_RESET_STATS, +whereas ocrdma_dbgfs_ops_write() supports only OCRDMA_RESET_STATS. + +The patch fixes misstype with permissions. + +Found by Linux Driver Verification project (linuxtesting.org). + +Signed-off-by: Anton Vasilyev +Acked-by: Selvin Xavier +Signed-off-by: Jason Gunthorpe +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/infiniband/hw/ocrdma/ocrdma_stats.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/infiniband/hw/ocrdma/ocrdma_stats.c ++++ b/drivers/infiniband/hw/ocrdma/ocrdma_stats.c +@@ -834,7 +834,7 @@ void ocrdma_add_port_stats(struct ocrdma + + dev->reset_stats.type = OCRDMA_RESET_STATS; + dev->reset_stats.dev = dev; +- if (!debugfs_create_file("reset_stats", S_IRUSR, dev->dir, ++ if (!debugfs_create_file("reset_stats", 0200, dev->dir, + &dev->reset_stats, &ocrdma_dbg_ops)) + goto err; + diff --git a/queue-4.14/rtc-ac100-fix-multiple-race-conditions.patch b/queue-4.14/rtc-ac100-fix-multiple-race-conditions.patch new file mode 100644 index 00000000000..6b26c2ec53d --- /dev/null +++ b/queue-4.14/rtc-ac100-fix-multiple-race-conditions.patch @@ -0,0 +1,121 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Alexandre Belloni +Date: Mon, 4 Dec 2017 14:58:33 +0100 +Subject: rtc: ac100: Fix multiple race conditions + +From: Alexandre Belloni + + +[ Upstream commit 994ec64c0a193940be7a6fd074668b9446d3b6c3 ] + +The probe function is not allowed to fail after registering the RTC because +the following may happen: + +CPU0: CPU1: +sys_load_module() + do_init_module() + do_one_initcall() + cmos_do_probe() + rtc_device_register() + __register_chrdev() + cdev->owner = struct module* + open("/dev/rtc0") + rtc_device_unregister() + module_put() + free_module() + module_free(mod->module_core) + /* struct module *module is now + freed */ + chrdev_open() + spin_lock(cdev_lock) + cdev_get() + try_module_get() + module_is_live() + /* dereferences already + freed struct module* */ + +Also, the interrupt handler: ac100_rtc_irq() is dereferencing chip->rtc but +this may still be NULL when it is called, resulting in: +Unable to handle kernel NULL pointer dereference at virtual address 00000194 +pgd = (ptrval) +[00000194] *pgd=00000000 +Internal error: Oops: 5 [#1] SMP ARM +Modules linked in: +CPU: 0 PID: 72 Comm: irq/71-ac100-rt Not tainted 4.15.0-rc1-next-20171201-dirty #120 +Hardware name: Allwinner sun8i Family +task: (ptrval) task.stack: (ptrval) +PC is at mutex_lock+0x14/0x3c +LR is at ac100_rtc_irq+0x38/0xc8 +pc : [] lr : [] psr: 60000053 +sp : ee9c9f28 ip : 00000000 fp : ee9adfdc +r10: 00000000 r9 : c0a04c48 r8 : c015ed18 +r7 : ee9bd600 r6 : ee9c9f28 r5 : ee9af590 r4 : c0a04c48 +r3 : ef3cb3c0 r2 : 00000000 r1 : ee9af590 r0 : 00000194 +Flags: nZCv IRQs on FIQs off Mode SVC_32 ISA ARM Segment none +Control: 10c5387d Table: 4000406a DAC: 00000051 +Process irq/71-ac100-rt (pid: 72, stack limit = 0x(ptrval)) +Stack: (0xee9c9f28 to 0xee9ca000) +9f20: 00000000 7c2fd1be c015ed18 ee9adf40 ee9c0400 ee9c0400 +9f40: ee9adf40 c015ed34 ee9c8000 ee9adf64 ee9c0400 c015f040 ee9adf80 00000000 +9f60: c015ee24 7c2fd1be ee9adfc0 ee9adf80 00000000 ee9c8000 ee9adf40 c015eef4 +9f80: ef1eba34 c0138f14 ee9c8000 ee9adf80 c0138df4 00000000 00000000 00000000 +9fa0: 00000000 00000000 00000000 c01010e8 00000000 00000000 00000000 00000000 +9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 +9fe0: 00000000 00000000 00000000 00000000 00000013 00000000 ffffffff ffffffff +[] (mutex_lock) from [] (ac100_rtc_irq+0x38/0xc8) +[] (ac100_rtc_irq) from [] (irq_thread_fn+0x1c/0x54) +[] (irq_thread_fn) from [] (irq_thread+0x14c/0x214) +[] (irq_thread) from [] (kthread+0x120/0x150) +[] (kthread) from [] (ret_from_fork+0x14/0x2c) + +Solve both issues by moving to +devm_rtc_allocate_device()/rtc_register_device() + +Reported-by: Quentin Schulz +Tested-by: Quentin Schulz +Signed-off-by: Alexandre Belloni +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/rtc/rtc-ac100.c | 19 ++++++++++++------- + 1 file changed, 12 insertions(+), 7 deletions(-) + +--- a/drivers/rtc/rtc-ac100.c ++++ b/drivers/rtc/rtc-ac100.c +@@ -567,6 +567,12 @@ static int ac100_rtc_probe(struct platfo + return chip->irq; + } + ++ chip->rtc = devm_rtc_allocate_device(&pdev->dev); ++ if (IS_ERR(chip->rtc)) ++ return PTR_ERR(chip->rtc); ++ ++ chip->rtc->ops = &ac100_rtc_ops; ++ + ret = devm_request_threaded_irq(&pdev->dev, chip->irq, NULL, + ac100_rtc_irq, + IRQF_SHARED | IRQF_ONESHOT, +@@ -586,17 +592,16 @@ static int ac100_rtc_probe(struct platfo + /* clear counter alarm pending interrupts */ + regmap_write(chip->regmap, AC100_ALM_INT_STA, AC100_ALM_INT_ENABLE); + +- chip->rtc = devm_rtc_device_register(&pdev->dev, "rtc-ac100", +- &ac100_rtc_ops, THIS_MODULE); +- if (IS_ERR(chip->rtc)) { +- dev_err(&pdev->dev, "unable to register device\n"); +- return PTR_ERR(chip->rtc); +- } +- + ret = ac100_rtc_register_clks(chip); + if (ret) + return ret; + ++ ret = rtc_register_device(chip->rtc); ++ if (ret) { ++ dev_err(&pdev->dev, "unable to register device\n"); ++ return ret; ++ } ++ + dev_info(&pdev->dev, "RTC enabled\n"); + + return 0; diff --git a/queue-4.14/rtlwifi-always-initialize-variables-given-to-rt_trace.patch b/queue-4.14/rtlwifi-always-initialize-variables-given-to-rt_trace.patch new file mode 100644 index 00000000000..8962ecf8296 --- /dev/null +++ b/queue-4.14/rtlwifi-always-initialize-variables-given-to-rt_trace.patch @@ -0,0 +1,59 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Nicolas Iooss +Date: Sun, 10 Dec 2017 20:51:59 +0100 +Subject: rtlwifi: always initialize variables given to RT_TRACE() + +From: Nicolas Iooss + + +[ Upstream commit e4779162f7377baa9fb9a044555ecaae22c3f125 ] + +In rtl_rx_ampdu_apply(), when rtlpriv->cfg->ops->get_btc_status() +returns false, RT_TRACE() is called with the values of variables +reject_agg and agg_size, which have not been initialized. + +Always initialize these variables in order to prevent using +uninitialized values. + +This issue has been found with clang. The compiler reported: + + drivers/net/wireless/realtek/rtlwifi/base.c:1665:6: error: variable + 'agg_size' is used uninitialized whenever 'if' condition is false + [-Werror,-Wsometimes-uninitialized] + if (rtlpriv->cfg->ops->get_btc_status()) + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + drivers/net/wireless/realtek/rtlwifi/base.c:1671:31: note: + uninitialized use occurs here + reject_agg, ctrl_agg_size, agg_size); + ^~~~~~~~ + + drivers/net/wireless/realtek/rtlwifi/base.c:1665:6: error: variable + 'reject_agg' is used uninitialized whenever 'if' condition + is false [-Werror,-Wsometimes-uninitialized] + if (rtlpriv->cfg->ops->get_btc_status()) + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + drivers/net/wireless/realtek/rtlwifi/base.c:1671:4: note: + uninitialized use occurs here + reject_agg, ctrl_agg_size, agg_size); + ^~~~~~~~~~ + +Fixes: 2635664e6e4a ("rtlwifi: Add rx ampdu cfg for btcoexist.") +Signed-off-by: Nicolas Iooss +Signed-off-by: Kalle Valo +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/wireless/realtek/rtlwifi/base.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/realtek/rtlwifi/base.c ++++ b/drivers/net/wireless/realtek/rtlwifi/base.c +@@ -1664,7 +1664,7 @@ int rtl_tx_agg_oper(struct ieee80211_hw + void rtl_rx_ampdu_apply(struct rtl_priv *rtlpriv) + { + struct rtl_btc_ops *btc_ops = rtlpriv->btcoexist.btc_ops; +- u8 reject_agg, ctrl_agg_size = 0, agg_size; ++ u8 reject_agg = 0, ctrl_agg_size = 0, agg_size = 0; + + if (rtlpriv->cfg->ops->get_btc_status()) + btc_ops->btc_get_ampdu_cfg(rtlpriv, &reject_agg, diff --git a/queue-4.14/rtlwifi-rtl_pci-fix-the-bug-when-inactiveps-is-enabled.patch b/queue-4.14/rtlwifi-rtl_pci-fix-the-bug-when-inactiveps-is-enabled.patch new file mode 100644 index 00000000000..cfb3fdd4631 --- /dev/null +++ b/queue-4.14/rtlwifi-rtl_pci-fix-the-bug-when-inactiveps-is-enabled.patch @@ -0,0 +1,45 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Tsang-Shian Lin +Date: Sat, 9 Dec 2017 11:37:10 -0600 +Subject: rtlwifi: rtl_pci: Fix the bug when inactiveps is enabled. + +From: Tsang-Shian Lin + + +[ Upstream commit b7573a0a27bfa8270dea9b145448f6884b7cacc1 ] + +Reset the driver current tx read/write index to zero when inactiveps +nic out of sync with HW state. Wrong driver tx read/write index will +cause Tx fail. + +Signed-off-by: Tsang-Shian Lin +Signed-off-by: Ping-Ke Shih +Signed-off-by: Larry Finger +Cc: Yan-Hsuan Chuang +Cc: Birming Chiu +Cc: Shaofu +Cc: Steven Ting +Signed-off-by: Kalle Valo +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/wireless/realtek/rtlwifi/pci.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- a/drivers/net/wireless/realtek/rtlwifi/pci.c ++++ b/drivers/net/wireless/realtek/rtlwifi/pci.c +@@ -1568,7 +1568,14 @@ int rtl_pci_reset_trx_ring(struct ieee80 + dev_kfree_skb_irq(skb); + ring->idx = (ring->idx + 1) % ring->entries; + } ++ ++ if (rtlpriv->use_new_trx_flow) { ++ rtlpci->tx_ring[i].cur_tx_rp = 0; ++ rtlpci->tx_ring[i].cur_tx_wp = 0; ++ } ++ + ring->idx = 0; ++ ring->entries = rtlpci->txringcount[i]; + } + } + spin_unlock_irqrestore(&rtlpriv->locks.irq_th_lock, flags); diff --git a/queue-4.14/scsi-lpfc-fix-issues-connecting-with-nvme-initiator.patch b/queue-4.14/scsi-lpfc-fix-issues-connecting-with-nvme-initiator.patch new file mode 100644 index 00000000000..8954a3cde27 --- /dev/null +++ b/queue-4.14/scsi-lpfc-fix-issues-connecting-with-nvme-initiator.patch @@ -0,0 +1,48 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: James Smart +Date: Fri, 8 Dec 2017 17:18:08 -0800 +Subject: scsi: lpfc: Fix issues connecting with nvme initiator + +From: James Smart + + +[ Upstream commit e06351a002214d152142906a546006e3446d1ef7 ] + +In the lpfc discovery engine, when as a nvme target, where the driver +was performing mailbox io with the adapter for port login when a NVME +PRLI is received from the host. Rather than queue and eventually get +back to sending a response after the mailbox traffic, the driver +rejected the io with an error response. + +Turns out this particular initiator didn't like the rejection values +(unable to process command/command in progress) so it never attempted a +retry of the PRLI. Thus the host never established nvme connectivity +with the lpfc target. + +By changing the rejection values (to Logical Busy/nothing more), the +initiator accepted the response and would retry the PRLI, resulting in +nvme connectivity. + +Signed-off-by: Dick Kennedy +Signed-off-by: James Smart +Reviewed-by: Hannes Reinecke +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/scsi/lpfc/lpfc_nportdisc.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/scsi/lpfc/lpfc_nportdisc.c ++++ b/drivers/scsi/lpfc/lpfc_nportdisc.c +@@ -1569,8 +1569,8 @@ lpfc_rcv_prli_reglogin_issue(struct lpfc + ndlp->nlp_rpi, ndlp->nlp_state, + ndlp->nlp_flag); + memset(&stat, 0, sizeof(struct ls_rjt)); +- stat.un.b.lsRjtRsnCode = LSRJT_UNABLE_TPC; +- stat.un.b.lsRjtRsnCodeExp = LSEXP_CMD_IN_PROGRESS; ++ stat.un.b.lsRjtRsnCode = LSRJT_LOGICAL_BSY; ++ stat.un.b.lsRjtRsnCodeExp = LSEXP_NOTHING_MORE; + lpfc_els_rsp_reject(vport, stat.un.lsRjtError, cmdiocb, + ndlp, NULL); + return ndlp->nlp_state; diff --git a/queue-4.14/scsi-lpfc-fix-scsi-lun-discovery-when-scsi-and-nvme-enabled.patch b/queue-4.14/scsi-lpfc-fix-scsi-lun-discovery-when-scsi-and-nvme-enabled.patch new file mode 100644 index 00000000000..e9d6ef3a83d --- /dev/null +++ b/queue-4.14/scsi-lpfc-fix-scsi-lun-discovery-when-scsi-and-nvme-enabled.patch @@ -0,0 +1,219 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: James Smart +Date: Fri, 8 Dec 2017 17:18:07 -0800 +Subject: scsi: lpfc: Fix SCSI LUN discovery when SCSI and NVME enabled + +From: James Smart + + +[ Upstream commit 9de416ac67b54d666327ba927a190f4b7259f4a0 ] + +When enabled for both SCSI and NVME support, and connected pt2pt to a +SCSI only target, the driver nodelist entry for the remote port is left +in PRLI_ISSUE state and no SCSI LUNs are discovered. Works fine if only +configured for SCSI support. + +Error was due to some of the prli points still reflecting the need to +send only 1 PRLI. On a lot of fabric configs, targets were NVME only, +which meant the fabric-reported protocol attributes were only telling +the driver one protocol or the other. Thus things worked fine. With +pt2pt, the driver must send a PRLI for both protocols as there are no +hints on what the target supports. Thus pt2pt targets were hitting the +multiple PRLI issues. + +Complete the dual PRLI support. Track explicitly whether scsi (fcp) or +nvme prli's have been sent. Accurately track protocol support detected +on each node as reported by the fabric or probed by PRLI traffic. + +Signed-off-by: Dick Kennedy +Signed-off-by: James Smart +Reviewed-by: Hannes Reinecke +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/scsi/lpfc/lpfc_ct.c | 1 + + drivers/scsi/lpfc/lpfc_els.c | 30 ++++++++++++++++++++---------- + drivers/scsi/lpfc/lpfc_nportdisc.c | 30 +++++++++++++----------------- + 3 files changed, 34 insertions(+), 27 deletions(-) + +--- a/drivers/scsi/lpfc/lpfc_ct.c ++++ b/drivers/scsi/lpfc/lpfc_ct.c +@@ -471,6 +471,7 @@ lpfc_prep_node_fc4type(struct lpfc_vport + "Parse GID_FTrsp: did:x%x flg:x%x x%x", + Did, ndlp->nlp_flag, vport->fc_flag); + ++ ndlp->nlp_fc4_type &= ~(NLP_FC4_FCP | NLP_FC4_NVME); + /* By default, the driver expects to support FCP FC4 */ + if (fc4_type == FC_TYPE_FCP) + ndlp->nlp_fc4_type |= NLP_FC4_FCP; +--- a/drivers/scsi/lpfc/lpfc_els.c ++++ b/drivers/scsi/lpfc/lpfc_els.c +@@ -2088,6 +2088,10 @@ lpfc_cmpl_els_prli(struct lpfc_hba *phba + ndlp = (struct lpfc_nodelist *) cmdiocb->context1; + spin_lock_irq(shost->host_lock); + ndlp->nlp_flag &= ~NLP_PRLI_SND; ++ ++ /* Driver supports multiple FC4 types. Counters matter. */ ++ vport->fc_prli_sent--; ++ ndlp->fc4_prli_sent--; + spin_unlock_irq(shost->host_lock); + + lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_CMD, +@@ -2095,9 +2099,6 @@ lpfc_cmpl_els_prli(struct lpfc_hba *phba + irsp->ulpStatus, irsp->un.ulpWord[4], + ndlp->nlp_DID); + +- /* Ddriver supports multiple FC4 types. Counters matter. */ +- vport->fc_prli_sent--; +- + /* PRLI completes to NPort */ + lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, + "0103 PRLI completes to NPort x%06x " +@@ -2111,7 +2112,6 @@ lpfc_cmpl_els_prli(struct lpfc_hba *phba + + if (irsp->ulpStatus) { + /* Check for retry */ +- ndlp->fc4_prli_sent--; + if (lpfc_els_retry(phba, cmdiocb, rspiocb)) { + /* ELS command is being retried */ + goto out; +@@ -2190,6 +2190,15 @@ lpfc_issue_els_prli(struct lpfc_vport *v + ndlp->nlp_fc4_type |= NLP_FC4_NVME; + local_nlp_type = ndlp->nlp_fc4_type; + ++ /* This routine will issue 1 or 2 PRLIs, so zero all the ndlp ++ * fields here before any of them can complete. ++ */ ++ ndlp->nlp_type &= ~(NLP_FCP_TARGET | NLP_FCP_INITIATOR); ++ ndlp->nlp_type &= ~(NLP_NVME_TARGET | NLP_NVME_INITIATOR); ++ ndlp->nlp_fcp_info &= ~NLP_FCP_2_DEVICE; ++ ndlp->nlp_flag &= ~NLP_FIRSTBURST; ++ ndlp->nvme_fb_size = 0; ++ + send_next_prli: + if (local_nlp_type & NLP_FC4_FCP) { + /* Payload is 4 + 16 = 20 x14 bytes. */ +@@ -2298,6 +2307,13 @@ lpfc_issue_els_prli(struct lpfc_vport *v + elsiocb->iocb_cmpl = lpfc_cmpl_els_prli; + spin_lock_irq(shost->host_lock); + ndlp->nlp_flag |= NLP_PRLI_SND; ++ ++ /* The vport counters are used for lpfc_scan_finished, but ++ * the ndlp is used to track outstanding PRLIs for different ++ * FC4 types. ++ */ ++ vport->fc_prli_sent++; ++ ndlp->fc4_prli_sent++; + spin_unlock_irq(shost->host_lock); + if (lpfc_sli_issue_iocb(phba, LPFC_ELS_RING, elsiocb, 0) == + IOCB_ERROR) { +@@ -2308,12 +2324,6 @@ lpfc_issue_els_prli(struct lpfc_vport *v + return 1; + } + +- /* The vport counters are used for lpfc_scan_finished, but +- * the ndlp is used to track outstanding PRLIs for different +- * FC4 types. +- */ +- vport->fc_prli_sent++; +- ndlp->fc4_prli_sent++; + + /* The driver supports 2 FC4 types. Make sure + * a PRLI is issued for all types before exiting. +--- a/drivers/scsi/lpfc/lpfc_nportdisc.c ++++ b/drivers/scsi/lpfc/lpfc_nportdisc.c +@@ -390,6 +390,11 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, + break; + } + ++ ndlp->nlp_type &= ~(NLP_FCP_TARGET | NLP_FCP_INITIATOR); ++ ndlp->nlp_type &= ~(NLP_NVME_TARGET | NLP_NVME_INITIATOR); ++ ndlp->nlp_fcp_info &= ~NLP_FCP_2_DEVICE; ++ ndlp->nlp_flag &= ~NLP_FIRSTBURST; ++ + /* Check for Nport to NPort pt2pt protocol */ + if ((vport->fc_flag & FC_PT2PT) && + !(vport->fc_flag & FC_PT2PT_PLOGI)) { +@@ -742,9 +747,6 @@ lpfc_rcv_prli(struct lpfc_vport *vport, + lp = (uint32_t *) pcmd->virt; + npr = (PRLI *) ((uint8_t *) lp + sizeof (uint32_t)); + +- ndlp->nlp_type &= ~(NLP_FCP_TARGET | NLP_FCP_INITIATOR); +- ndlp->nlp_fcp_info &= ~NLP_FCP_2_DEVICE; +- ndlp->nlp_flag &= ~NLP_FIRSTBURST; + if ((npr->prliType == PRLI_FCP_TYPE) || + (npr->prliType == PRLI_NVME_TYPE)) { + if (npr->initiatorFunc) { +@@ -769,8 +771,12 @@ lpfc_rcv_prli(struct lpfc_vport *vport, + * type. Target mode does not issue gft_id so doesn't get + * the fc4 type set until now. + */ +- if ((phba->nvmet_support) && (npr->prliType == PRLI_NVME_TYPE)) ++ if (phba->nvmet_support && (npr->prliType == PRLI_NVME_TYPE)) { + ndlp->nlp_fc4_type |= NLP_FC4_NVME; ++ lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNMAPPED_NODE); ++ } ++ if (npr->prliType == PRLI_FCP_TYPE) ++ ndlp->nlp_fc4_type |= NLP_FC4_FCP; + } + if (rport) { + /* We need to update the rport role values */ +@@ -1552,7 +1558,6 @@ lpfc_rcv_prli_reglogin_issue(struct lpfc + if (ndlp->nlp_flag & NLP_RPI_REGISTERED) { + lpfc_rcv_prli(vport, ndlp, cmdiocb); + lpfc_els_rsp_prli_acc(vport, cmdiocb, ndlp); +- lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNMAPPED_NODE); + } else { + /* RPI registration has not completed. Reject the PRLI + * to prevent an illegal state transition when the +@@ -1568,6 +1573,7 @@ lpfc_rcv_prli_reglogin_issue(struct lpfc + stat.un.b.lsRjtRsnCodeExp = LSEXP_CMD_IN_PROGRESS; + lpfc_els_rsp_reject(vport, stat.un.lsRjtError, cmdiocb, + ndlp, NULL); ++ return ndlp->nlp_state; + } + } else { + /* Initiator mode. */ +@@ -1922,13 +1928,6 @@ lpfc_cmpl_prli_prli_issue(struct lpfc_vp + return ndlp->nlp_state; + } + +- /* Check out PRLI rsp */ +- ndlp->nlp_type &= ~(NLP_FCP_TARGET | NLP_FCP_INITIATOR); +- ndlp->nlp_fcp_info &= ~NLP_FCP_2_DEVICE; +- +- /* NVME or FCP first burst must be negotiated for each PRLI. */ +- ndlp->nlp_flag &= ~NLP_FIRSTBURST; +- ndlp->nvme_fb_size = 0; + if (npr && (npr->acceptRspCode == PRLI_REQ_EXECUTED) && + (npr->prliType == PRLI_FCP_TYPE)) { + lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME_DISC, +@@ -1945,8 +1944,6 @@ lpfc_cmpl_prli_prli_issue(struct lpfc_vp + if (npr->Retry) + ndlp->nlp_fcp_info |= NLP_FCP_2_DEVICE; + +- /* PRLI completed. Decrement count. */ +- ndlp->fc4_prli_sent--; + } else if (nvpr && + (bf_get_be32(prli_acc_rsp_code, nvpr) == + PRLI_REQ_EXECUTED) && +@@ -1991,8 +1988,6 @@ lpfc_cmpl_prli_prli_issue(struct lpfc_vp + be32_to_cpu(nvpr->word5), + ndlp->nlp_flag, ndlp->nlp_fcp_info, + ndlp->nlp_type); +- /* PRLI completed. Decrement count. */ +- ndlp->fc4_prli_sent--; + } + if (!(ndlp->nlp_type & NLP_FCP_TARGET) && + (vport->port_type == LPFC_NPIV_PORT) && +@@ -2016,7 +2011,8 @@ out_err: + ndlp->nlp_prev_state = NLP_STE_PRLI_ISSUE; + if (ndlp->nlp_type & (NLP_FCP_TARGET | NLP_NVME_TARGET)) + lpfc_nlp_set_state(vport, ndlp, NLP_STE_MAPPED_NODE); +- else ++ else if (ndlp->nlp_type & ++ (NLP_FCP_INITIATOR | NLP_NVME_INITIATOR)) + lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNMAPPED_NODE); + } else + lpfc_printf_vlog(vport, diff --git a/queue-4.14/serial-8250_dw-disable-clock-on-error.patch b/queue-4.14/serial-8250_dw-disable-clock-on-error.patch new file mode 100644 index 00000000000..b6bb05f09f3 --- /dev/null +++ b/queue-4.14/serial-8250_dw-disable-clock-on-error.patch @@ -0,0 +1,36 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Stefan Potyra +Date: Wed, 6 Dec 2017 16:46:12 +0100 +Subject: serial: 8250_dw: Disable clock on error + +From: Stefan Potyra + + +[ Upstream commit 8af016aa5a27c6a2505460eb4d83f1e70c38dc43 ] + +If there is no clock rate for uartclk defined, disable the previously +enabled clock again. + +Found by Linux Driver Verification project (linuxtesting.org). + +Fixes: 23f5b3fdd04e serial: 8250_dw: only get the clock rate in one place +Signed-off-by: Stefan Potyra +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/tty/serial/8250/8250_dw.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/tty/serial/8250/8250_dw.c ++++ b/drivers/tty/serial/8250/8250_dw.c +@@ -513,7 +513,8 @@ static int dw8250_probe(struct platform_ + /* If no clock rate is defined, fail. */ + if (!p->uartclk) { + dev_err(dev, "clock rate not defined\n"); +- return -EINVAL; ++ err = -EINVAL; ++ goto err_clk; + } + + data->pclk = devm_clk_get(dev, "apb_pclk"); diff --git a/queue-4.14/series b/queue-4.14/series index 20846c5cc1d..7867e03857b 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -1,2 +1,67 @@ scsi-megaraid_sas-do-not-use-32-bit-atomic-request-descriptor-for-ventura-controllers.patch staging-android-ashmem-fix-possible-deadlock-in-ashmem_ioctl.patch +bluetooth-hci_qca-avoid-setup-failure-on-missing-rampatch.patch +bluetooth-btqcomsmd-fix-skb-double-free-corruption.patch +cpufreq-longhaul-revert-transition_delay_us-to-200-ms.patch +media-c8sectpfe-fix-potential-null-pointer-dereference-in-c8sectpfe_timer_interrupt.patch +drm-msm-fix-leak-in-failed-get_pages.patch +net-fec-add-phy_reset_after_clk_enable-support.patch +dm-ensure-bio-submission-follows-a-depth-first-tree-walk.patch +rdma-iwpm-fix-uninitialized-error-code-in-iwpm_send_mapinfo.patch +hv_netvsc-fix-the-receive-buffer-size-limit.patch +hv_netvsc-fix-the-tx-rx-buffer-default-sizes.patch +spi-sh-msiof-avoid-writing-to-registers-from-spi_master.setup.patch +rtlwifi-rtl_pci-fix-the-bug-when-inactiveps-is-enabled.patch +rtlwifi-always-initialize-variables-given-to-rt_trace.patch +media-bt8xx-fix-err-bt878_probe.patch +ath10k-handling-qos-at-sta-side-based-on-ap-wmm-enable-disable.patch +media-media-dvb-frontends-add-delay-to-si2168-restart.patch +qmi_wwan-set-flag_send_zlp-to-avoid-network-initiated-disconnect.patch +tty-goldfish-enable-earlycon-only-if-built-in.patch +serial-8250_dw-disable-clock-on-error.patch +cros_ec-fix-nul-termination-for-firmware-build-info.patch +watchdog-fix-potential-kref-imbalance-when-opening-watchdog.patch +watchdog-fix-kref-imbalance-seen-if-handle_boot_enabled-0.patch +platform-chrome-use-proper-protocol-transfer-function.patch +dmaengine-zynqmp_dma-fix-race-condition-in-the-probe.patch +drm-tilcdc-ensure-nonatomic-iowrite64-is-not-used.patch +mmc-avoid-removing-non-removable-hosts-during-suspend.patch +mmc-block-fix-logical-error-to-avoid-memory-leak.patch +dev-mem-add-bounce-buffer-for-copy-out.patch +net-phy-meson-gxl-check-phy_write-return-value.patch +sfp-fix-eeprom-reading-in-the-case-of-non-sff8472-sfps.patch +sfp-fix-non-detection-of-phy.patch +media-s5p-mfc-fix-lock-contention-request_firmware-once.patch +rtc-ac100-fix-multiple-race-conditions.patch +ib-ipoib-avoid-memory-leak-if-the-sa-returns-a-different-dgid.patch +rdma-cma-use-correct-size-when-writing-netlink-stats.patch +ib-umem-fix-use-of-npages-nmap-fields.patch +iser-target-avoid-reinitializing-rdma-contexts-for-isert-commands.patch +vgacon-set-vga-struct-resource-types.patch +omapdrm-panel-fix-compatible-vendor-string-for-td028ttec1.patch +mmc-sdhci-xenon-wait-5ms-after-set-1.8v-signal-enable.patch +drm-omap-dmm-check-for-dmm-readiness-after-successful-transaction-commit.patch +pty-cancel-pty-slave-port-buf-s-work-in-tty_release.patch +coresight-fix-disabling-of-coresight-tpiu.patch +pci-designware-ep-fix-get_msi-to-check-msi_en-bit.patch +pci-endpoint-fix-find_first_zero_bit-usage.patch +pci-rcar-handle-rcar_pcie_parse_request_of_pci_ranges-failures.patch +media-davinci-fix-a-debug-printk.patch +pinctrl-really-force-states-during-suspend-resume.patch +pinctrl-rockchip-enable-clock-when-reading-pin-direction-register.patch +iommu-vt-d-clean-up-pr_irq-if-request_threaded_irq-fails.patch +ip6_vti-adjust-vti-mtu-according-to-mtu-of-lower-device.patch +ip_gre-fix-error-path-when-erspan_rcv-failed.patch +ip_gre-fix-potential-memory-leak-in-erspan_rcv.patch +soc-qcom-smsm-fix-child-node-lookup.patch +scsi-lpfc-fix-scsi-lun-discovery-when-scsi-and-nvme-enabled.patch +scsi-lpfc-fix-issues-connecting-with-nvme-initiator.patch +rdma-ocrdma-fix-permissions-for-ocrdma_reset_stats.patch +arm-dts-aspeed-evb-add-unit-name-to-memory-node.patch +nfsd4-permit-layoutget-of-executable-only-files.patch +clk-at91-pmc-wait-for-clocks-when-resuming.patch +clk-don-t-touch-hardware-when-reparenting-during-registration.patch +clk-axi-clkgen-correctly-handle-nocount-bit-in-recalc_rate.patch +clk-si5351-rename-internal-plls-to-avoid-name-collisions.patch +crypto-artpec6-set-correct-iv-size-for-gcm-aes.patch +dmaengine-ti-dma-crossbar-fix-event-mapping-for-tpcc_evt_mux_60_63.patch diff --git a/queue-4.14/sfp-fix-eeprom-reading-in-the-case-of-non-sff8472-sfps.patch b/queue-4.14/sfp-fix-eeprom-reading-in-the-case-of-non-sff8472-sfps.patch new file mode 100644 index 00000000000..f20b0d47031 --- /dev/null +++ b/queue-4.14/sfp-fix-eeprom-reading-in-the-case-of-non-sff8472-sfps.patch @@ -0,0 +1,50 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Russell King +Date: Fri, 15 Dec 2017 16:09:41 +0000 +Subject: sfp: fix EEPROM reading in the case of non-SFF8472 SFPs + +From: Russell King + + +[ Upstream commit 2794ffc441dde3109804085dc745e8014a4de224 ] + +The EEPROM reading was trying to read from the second EEPROM address +if we requested the last byte from the SFF8079 EEPROM, which caused a +failure when the second EEPROM is not present. Discovered with a +S-RJ01 SFP module. Fix this. + +Fixes: 73970055450e ("sfp: add SFP module support") +Signed-off-by: Russell King +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/phy/sfp.c | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +--- a/drivers/net/phy/sfp.c ++++ b/drivers/net/phy/sfp.c +@@ -667,20 +667,19 @@ static int sfp_module_eeprom(struct sfp + len = min_t(unsigned int, last, ETH_MODULE_SFF_8079_LEN); + len -= first; + +- ret = sfp->read(sfp, false, first, data, len); ++ ret = sfp_read(sfp, false, first, data, len); + if (ret < 0) + return ret; + + first += len; + data += len; + } +- if (first >= ETH_MODULE_SFF_8079_LEN && +- first < ETH_MODULE_SFF_8472_LEN) { ++ if (first < ETH_MODULE_SFF_8472_LEN && last > ETH_MODULE_SFF_8079_LEN) { + len = min_t(unsigned int, last, ETH_MODULE_SFF_8472_LEN); + len -= first; + first -= ETH_MODULE_SFF_8079_LEN; + +- ret = sfp->read(sfp, true, first, data, len); ++ ret = sfp_read(sfp, true, first, data, len); + if (ret < 0) + return ret; + } diff --git a/queue-4.14/sfp-fix-non-detection-of-phy.patch b/queue-4.14/sfp-fix-non-detection-of-phy.patch new file mode 100644 index 00000000000..d3505654c65 --- /dev/null +++ b/queue-4.14/sfp-fix-non-detection-of-phy.patch @@ -0,0 +1,42 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Russell King +Date: Fri, 15 Dec 2017 16:09:36 +0000 +Subject: sfp: fix non-detection of PHY + +From: Russell King + + +[ Upstream commit 20b56ed9f8adfb9a7fb1c878878c54aa4ed645c1 ] + +The detection of a PHY changed in commit e98a3aabf85f ("mdio_bus: don't +return NULL from mdiobus_scan()") which now causes sfp to print an +error message. Update for this change. + +Fixes: 73970055450e ("sfp: add SFP module support") +Signed-off-by: Russell King +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/phy/sfp.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/drivers/net/phy/sfp.c ++++ b/drivers/net/phy/sfp.c +@@ -318,12 +318,12 @@ static void sfp_sm_probe_phy(struct sfp + msleep(T_PHY_RESET_MS); + + phy = mdiobus_scan(sfp->i2c_mii, SFP_PHY_ADDR); +- if (IS_ERR(phy)) { +- dev_err(sfp->dev, "mdiobus scan returned %ld\n", PTR_ERR(phy)); ++ if (phy == ERR_PTR(-ENODEV)) { ++ dev_info(sfp->dev, "no PHY detected\n"); + return; + } +- if (!phy) { +- dev_info(sfp->dev, "no PHY detected\n"); ++ if (IS_ERR(phy)) { ++ dev_err(sfp->dev, "mdiobus scan returned %ld\n", PTR_ERR(phy)); + return; + } + diff --git a/queue-4.14/soc-qcom-smsm-fix-child-node-lookup.patch b/queue-4.14/soc-qcom-smsm-fix-child-node-lookup.patch new file mode 100644 index 00000000000..30782bff395 --- /dev/null +++ b/queue-4.14/soc-qcom-smsm-fix-child-node-lookup.patch @@ -0,0 +1,49 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Johan Hovold +Date: Wed, 15 Nov 2017 12:07:24 +0100 +Subject: soc: qcom: smsm: fix child-node lookup + +From: Johan Hovold + + +[ Upstream commit 8804517e9fc16c10081ff5e42e7d80704973a8e2 ] + +Fix child-node lookup during probe, which ended up searching the whole +device tree depth-first starting at the parent rather than just matching +on its children. + +Note that the original premature free of the parent node has already +been fixed separately. + +Also note that this pattern of looking up the first child node with a +given property is rare enough that a generic helper is probably not +warranted. + +Fixes: c97c4090ff72 ("soc: qcom: smsm: Add driver for Qualcomm SMSM") +Fixes: 3e8b55411468 ("soc: qcom: smsm: fix of_node refcnting problem") +Cc: Bjorn Andersson +Cc: Rob Clark +Signed-off-by: Johan Hovold +Reviewed-by: Bjorn Andersson +Signed-off-by: Andy Gross +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/soc/qcom/smsm.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/drivers/soc/qcom/smsm.c ++++ b/drivers/soc/qcom/smsm.c +@@ -496,8 +496,10 @@ static int qcom_smsm_probe(struct platfo + if (!smsm->hosts) + return -ENOMEM; + +- local_node = of_find_node_with_property(of_node_get(pdev->dev.of_node), +- "#qcom,smem-state-cells"); ++ for_each_child_of_node(pdev->dev.of_node, local_node) { ++ if (of_find_property(local_node, "#qcom,smem-state-cells", NULL)) ++ break; ++ } + if (!local_node) { + dev_err(&pdev->dev, "no state entry\n"); + return -EINVAL; diff --git a/queue-4.14/spi-sh-msiof-avoid-writing-to-registers-from-spi_master.setup.patch b/queue-4.14/spi-sh-msiof-avoid-writing-to-registers-from-spi_master.setup.patch new file mode 100644 index 00000000000..18b446da8e4 --- /dev/null +++ b/queue-4.14/spi-sh-msiof-avoid-writing-to-registers-from-spi_master.setup.patch @@ -0,0 +1,93 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Geert Uytterhoeven +Date: Wed, 13 Dec 2017 20:05:10 +0100 +Subject: spi: sh-msiof: Avoid writing to registers from spi_master.setup() + +From: Geert Uytterhoeven + + +[ Upstream commit 7ff0b53c4051145d1cf992d2f60987e6447eed4f ] + +The spi_master.setup() callback must not change configuration registers, +as that could corrupt I/O that is in progress for other SPI slaves. + +The only exception is the configuration of the native chip select +polarity in SPI master mode, as a wrong chip select polarity will cause +havoc during all future transfers to any other SPI slave. + +Hence stop writing to registers in sh_msiof_spi_setup(), unless it is +the first call for a controller using a native chip select, or unless +native chip select polarity has changed (note that you'll loose anyway +if I/O is in progress). Even then, only do what is strictly necessary, +instead of calling sh_msiof_spi_set_pin_regs(). + +Signed-off-by: Geert Uytterhoeven +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/spi/spi-sh-msiof.c | 35 ++++++++++++++++++++++++----------- + 1 file changed, 24 insertions(+), 11 deletions(-) + +--- a/drivers/spi/spi-sh-msiof.c ++++ b/drivers/spi/spi-sh-msiof.c +@@ -55,6 +55,8 @@ struct sh_msiof_spi_priv { + void *rx_dma_page; + dma_addr_t tx_dma_addr; + dma_addr_t rx_dma_addr; ++ bool native_cs_inited; ++ bool native_cs_high; + bool slave_aborted; + }; + +@@ -528,8 +530,7 @@ static int sh_msiof_spi_setup(struct spi + { + struct device_node *np = spi->master->dev.of_node; + struct sh_msiof_spi_priv *p = spi_master_get_devdata(spi->master); +- +- pm_runtime_get_sync(&p->pdev->dev); ++ u32 clr, set, tmp; + + if (!np) { + /* +@@ -539,19 +540,31 @@ static int sh_msiof_spi_setup(struct spi + spi->cs_gpio = (uintptr_t)spi->controller_data; + } + +- /* Configure pins before deasserting CS */ +- sh_msiof_spi_set_pin_regs(p, !!(spi->mode & SPI_CPOL), +- !!(spi->mode & SPI_CPHA), +- !!(spi->mode & SPI_3WIRE), +- !!(spi->mode & SPI_LSB_FIRST), +- !!(spi->mode & SPI_CS_HIGH)); +- +- if (spi->cs_gpio >= 0) ++ if (spi->cs_gpio >= 0) { + gpio_set_value(spi->cs_gpio, !(spi->mode & SPI_CS_HIGH)); ++ return 0; ++ } ++ ++ if (spi_controller_is_slave(p->master)) ++ return 0; + ++ if (p->native_cs_inited && ++ (p->native_cs_high == !!(spi->mode & SPI_CS_HIGH))) ++ return 0; + ++ /* Configure native chip select mode/polarity early */ ++ clr = MDR1_SYNCMD_MASK; ++ set = MDR1_TRMD | TMDR1_PCON | MDR1_SYNCMD_SPI; ++ if (spi->mode & SPI_CS_HIGH) ++ clr |= BIT(MDR1_SYNCAC_SHIFT); ++ else ++ set |= BIT(MDR1_SYNCAC_SHIFT); ++ pm_runtime_get_sync(&p->pdev->dev); ++ tmp = sh_msiof_read(p, TMDR1) & ~clr; ++ sh_msiof_write(p, TMDR1, tmp | set); + pm_runtime_put(&p->pdev->dev); +- ++ p->native_cs_high = spi->mode & SPI_CS_HIGH; ++ p->native_cs_inited = true; + return 0; + } + diff --git a/queue-4.14/tty-goldfish-enable-earlycon-only-if-built-in.patch b/queue-4.14/tty-goldfish-enable-earlycon-only-if-built-in.patch new file mode 100644 index 00000000000..6958671a58d --- /dev/null +++ b/queue-4.14/tty-goldfish-enable-earlycon-only-if-built-in.patch @@ -0,0 +1,76 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Sebastian Andrzej Siewior +Date: Thu, 30 Nov 2017 09:16:31 +0100 +Subject: tty: goldfish: Enable 'earlycon' only if built-in + +From: Sebastian Andrzej Siewior + + +[ Upstream commit 6a28fd2bbc94bfca105632e5ef8a9dbe63ba0b39 ] + +Commit 3840ed9548f7 ("tty: goldfish: Implement support for kernel +'earlycon' parameter") breaks an allmodconfig config on x86: +| LD vmlinux.o +| MODPOST vmlinux.o +|drivers/tty/serial/earlycon.o: In function `parse_options': +|drivers/tty/serial/earlycon.c:97: undefined reference to `uart_parse_earlycon' +|Makefile:1005: recipe for target 'vmlinux' failed + +earlycon.c::parse_options() invokes uart_parse_earlycon() from serial_core.c +which is compiled=m because GOLDFISH_TTY itself (and most others) are =m. +To avoid that, I'm adding the _CONSOLE config option which is selected if the +GOLDFISH module itself is =y since it doesn't need the early bits for the =m +case (other drivers do the same dance). +The alternative would be to move uart_parse_earlycon() from +serial_core.c to earlycon.c (we don't have that many users of that +function). + +Fixes: 3840ed9548f7 ("tty: goldfish: Implement support for kernel + 'earlycon' parameter") +Signed-off-by: Sebastian Andrzej Siewior +Reviewed-by: Miodrag Dinic +Acked-by: Miodrag Dinic +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/tty/Kconfig | 6 +++++- + drivers/tty/goldfish.c | 2 ++ + 2 files changed, 7 insertions(+), 1 deletion(-) + +--- a/drivers/tty/Kconfig ++++ b/drivers/tty/Kconfig +@@ -394,10 +394,14 @@ config GOLDFISH_TTY + depends on GOLDFISH + select SERIAL_CORE + select SERIAL_CORE_CONSOLE +- select SERIAL_EARLYCON + help + Console and system TTY driver for the Goldfish virtual platform. + ++config GOLDFISH_TTY_EARLY_CONSOLE ++ bool ++ default y if GOLDFISH_TTY=y ++ select SERIAL_EARLYCON ++ + config DA_TTY + bool "DA TTY" + depends on METAG_DA +--- a/drivers/tty/goldfish.c ++++ b/drivers/tty/goldfish.c +@@ -442,6 +442,7 @@ static int goldfish_tty_remove(struct pl + return 0; + } + ++#ifdef CONFIG_GOLDFISH_TTY_EARLY_CONSOLE + static void gf_early_console_putchar(struct uart_port *port, int ch) + { + __raw_writel(ch, port->membase); +@@ -465,6 +466,7 @@ static int __init gf_earlycon_setup(stru + } + + OF_EARLYCON_DECLARE(early_gf_tty, "google,goldfish-tty", gf_earlycon_setup); ++#endif + + static const struct of_device_id goldfish_tty_of_match[] = { + { .compatible = "google,goldfish-tty", }, diff --git a/queue-4.14/vgacon-set-vga-struct-resource-types.patch b/queue-4.14/vgacon-set-vga-struct-resource-types.patch new file mode 100644 index 00000000000..55ef26a8e0e --- /dev/null +++ b/queue-4.14/vgacon-set-vga-struct-resource-types.patch @@ -0,0 +1,110 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Bjorn Helgaas +Date: Fri, 1 Dec 2017 11:06:39 -0600 +Subject: vgacon: Set VGA struct resource types + +From: Bjorn Helgaas + + +[ Upstream commit c82084117f79bcae085e40da526253736a247120 ] + +Set the resource type when we reserve VGA-related I/O port resources. + +The resource code doesn't actually look at the type, so it inserts +resources without a type in the tree correctly even without this change. +But if we ever print a resource without a type, it looks like this: + + vga+ [??? 0x000003c0-0x000003df flags 0x0] + +Setting the type means it will be printed correctly as: + + vga+ [io 0x000003c0-0x000003df] + +Signed-off-by: Bjorn Helgaas +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + arch/alpha/kernel/console.c | 1 + + drivers/video/console/vgacon.c | 34 ++++++++++++++++++++++++++-------- + 2 files changed, 27 insertions(+), 8 deletions(-) + +--- a/arch/alpha/kernel/console.c ++++ b/arch/alpha/kernel/console.c +@@ -21,6 +21,7 @@ + struct pci_controller *pci_vga_hose; + static struct resource alpha_vga = { + .name = "alpha-vga+", ++ .flags = IORESOURCE_IO, + .start = 0x3C0, + .end = 0x3DF + }; +--- a/drivers/video/console/vgacon.c ++++ b/drivers/video/console/vgacon.c +@@ -422,7 +422,10 @@ static const char *vgacon_startup(void) + vga_video_port_val = VGA_CRT_DM; + if ((screen_info.orig_video_ega_bx & 0xff) != 0x10) { + static struct resource ega_console_resource = +- { .name = "ega", .start = 0x3B0, .end = 0x3BF }; ++ { .name = "ega", ++ .flags = IORESOURCE_IO, ++ .start = 0x3B0, ++ .end = 0x3BF }; + vga_video_type = VIDEO_TYPE_EGAM; + vga_vram_size = 0x8000; + display_desc = "EGA+"; +@@ -430,9 +433,15 @@ static const char *vgacon_startup(void) + &ega_console_resource); + } else { + static struct resource mda1_console_resource = +- { .name = "mda", .start = 0x3B0, .end = 0x3BB }; ++ { .name = "mda", ++ .flags = IORESOURCE_IO, ++ .start = 0x3B0, ++ .end = 0x3BB }; + static struct resource mda2_console_resource = +- { .name = "mda", .start = 0x3BF, .end = 0x3BF }; ++ { .name = "mda", ++ .flags = IORESOURCE_IO, ++ .start = 0x3BF, ++ .end = 0x3BF }; + vga_video_type = VIDEO_TYPE_MDA; + vga_vram_size = 0x2000; + display_desc = "*MDA"; +@@ -454,15 +463,21 @@ static const char *vgacon_startup(void) + vga_vram_size = 0x8000; + + if (!screen_info.orig_video_isVGA) { +- static struct resource ega_console_resource +- = { .name = "ega", .start = 0x3C0, .end = 0x3DF }; ++ static struct resource ega_console_resource = ++ { .name = "ega", ++ .flags = IORESOURCE_IO, ++ .start = 0x3C0, ++ .end = 0x3DF }; + vga_video_type = VIDEO_TYPE_EGAC; + display_desc = "EGA"; + request_resource(&ioport_resource, + &ega_console_resource); + } else { +- static struct resource vga_console_resource +- = { .name = "vga+", .start = 0x3C0, .end = 0x3DF }; ++ static struct resource vga_console_resource = ++ { .name = "vga+", ++ .flags = IORESOURCE_IO, ++ .start = 0x3C0, ++ .end = 0x3DF }; + vga_video_type = VIDEO_TYPE_VGAC; + display_desc = "VGA+"; + request_resource(&ioport_resource, +@@ -494,7 +509,10 @@ static const char *vgacon_startup(void) + } + } else { + static struct resource cga_console_resource = +- { .name = "cga", .start = 0x3D4, .end = 0x3D5 }; ++ { .name = "cga", ++ .flags = IORESOURCE_IO, ++ .start = 0x3D4, ++ .end = 0x3D5 }; + vga_video_type = VIDEO_TYPE_CGA; + vga_vram_size = 0x2000; + display_desc = "*CGA"; diff --git a/queue-4.14/watchdog-fix-kref-imbalance-seen-if-handle_boot_enabled-0.patch b/queue-4.14/watchdog-fix-kref-imbalance-seen-if-handle_boot_enabled-0.patch new file mode 100644 index 00000000000..9a4737e60f2 --- /dev/null +++ b/queue-4.14/watchdog-fix-kref-imbalance-seen-if-handle_boot_enabled-0.patch @@ -0,0 +1,53 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Guenter Roeck +Date: Mon, 25 Sep 2017 09:17:02 -0700 +Subject: watchdog: Fix kref imbalance seen if handle_boot_enabled=0 + +From: Guenter Roeck + + +[ Upstream commit 914d65f3f013ba2556c7beec5d3baac7b3292504 ] + +If handle_boot_enabled is set to 0, the watchdog driver module use +counter will not be increased and kref_get() will not be called when +registering the watchdog. Subsequently, on open, this does not happen +either because the code believes that it was already done because the +hardware watchdog is marked as running. + +We could introduce a state variable to indicate this state, but let's +just increase the module use counter and call kref_get() unconditionally +if the hardware watchdog is running when a driver is registering itself +to keep the code simple. + +Fixes: 2501b015313fe ("watchdog: core: add option to avoid early ...") +Cc: Sebastian Reichel +Signed-off-by: Guenter Roeck +Signed-off-by: Wim Van Sebroeck +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/watchdog/watchdog_dev.c | 11 +++++------ + 1 file changed, 5 insertions(+), 6 deletions(-) + +--- a/drivers/watchdog/watchdog_dev.c ++++ b/drivers/watchdog/watchdog_dev.c +@@ -966,14 +966,13 @@ static int watchdog_cdev_register(struct + * and schedule an immediate ping. + */ + if (watchdog_hw_running(wdd)) { +- if (handle_boot_enabled) { +- __module_get(wdd->ops->owner); +- kref_get(&wd_data->kref); ++ __module_get(wdd->ops->owner); ++ kref_get(&wd_data->kref); ++ if (handle_boot_enabled) + queue_delayed_work(watchdog_wq, &wd_data->work, 0); +- } else { ++ else + pr_info("watchdog%d running and kernel based pre-userspace handler disabled\n", +- wdd->id); +- } ++ wdd->id); + } + + return 0; diff --git a/queue-4.14/watchdog-fix-potential-kref-imbalance-when-opening-watchdog.patch b/queue-4.14/watchdog-fix-potential-kref-imbalance-when-opening-watchdog.patch new file mode 100644 index 00000000000..90973ec4774 --- /dev/null +++ b/queue-4.14/watchdog-fix-potential-kref-imbalance-when-opening-watchdog.patch @@ -0,0 +1,56 @@ +From foo@baz Thu Mar 22 14:26:48 CET 2018 +From: Guenter Roeck +Date: Mon, 25 Sep 2017 09:17:01 -0700 +Subject: watchdog: Fix potential kref imbalance when opening watchdog + +From: Guenter Roeck + + +[ Upstream commit 4bcd615fad6adddc68b058d498b30a9e0e0db77a ] + +If a watchdog driver's open function sets WDOG_HW_RUNNING with the +expectation that the watchdog can not be stopped, but then stops the +watchdog anyway in its stop function, kref_get() wil not be called in +watchdog_open(). If the watchdog then stops on close, WDOG_HW_RUNNING +will be cleared and kref_put() will be called, causing a kref imbalance. +As result the character device data structure will be released, which in +turn will cause the system to crash on the next call to watchdog_open(). + +Fixes: ee142889e32f5 ("watchdog: Introduce WDOG_HW_RUNNING flag") +Signed-off-by: Guenter Roeck +Signed-off-by: Wim Van Sebroeck +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/watchdog/watchdog_dev.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/drivers/watchdog/watchdog_dev.c ++++ b/drivers/watchdog/watchdog_dev.c +@@ -768,6 +768,7 @@ static int watchdog_open(struct inode *i + { + struct watchdog_core_data *wd_data; + struct watchdog_device *wdd; ++ bool hw_running; + int err; + + /* Get the corresponding watchdog device */ +@@ -787,7 +788,8 @@ static int watchdog_open(struct inode *i + * If the /dev/watchdog device is open, we don't want the module + * to be unloaded. + */ +- if (!watchdog_hw_running(wdd) && !try_module_get(wdd->ops->owner)) { ++ hw_running = watchdog_hw_running(wdd); ++ if (!hw_running && !try_module_get(wdd->ops->owner)) { + err = -EBUSY; + goto out_clear; + } +@@ -798,7 +800,7 @@ static int watchdog_open(struct inode *i + + file->private_data = wd_data; + +- if (!watchdog_hw_running(wdd)) ++ if (!hw_running) + kref_get(&wd_data->kref); + + /* dev/watchdog is a virtual (and thus non-seekable) filesystem */