From: Sasha Levin Date: Thu, 19 Aug 2021 13:00:06 +0000 (-0400) Subject: Fixes for 5.13 X-Git-Tag: v5.13.13~38 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=079bbf1878c117ca699f0463e39b8ee9da586f87;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 5.13 Signed-off-by: Sasha Levin --- diff --git a/queue-5.13/arm-dts-am43x-epos-evm-reduce-i2c0-bus-speed-for-tps.patch b/queue-5.13/arm-dts-am43x-epos-evm-reduce-i2c0-bus-speed-for-tps.patch new file mode 100644 index 00000000000..b124a5a319f --- /dev/null +++ b/queue-5.13/arm-dts-am43x-epos-evm-reduce-i2c0-bus-speed-for-tps.patch @@ -0,0 +1,50 @@ +From 137932d73b628a592cb1ea86d2fa00dda505901e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 16 Jul 2021 09:07:30 -0700 +Subject: ARM: dts: am43x-epos-evm: Reduce i2c0 bus speed for tps65218 + +From: Dave Gerlach + +[ Upstream commit 20a6b3fd8e2e2c063b25fbf2ee74d86b898e5087 ] + +Based on the latest timing specifications for the TPS65218 from the data +sheet, http://www.ti.com/lit/ds/symlink/tps65218.pdf, document SLDS206 +from November 2014, we must change the i2c bus speed to better fit within +the minimum high SCL time required for proper i2c transfer. + +When running at 400khz, measurements show that SCL spends +0.8125 uS/1.666 uS high/low which violates the requirement for minimum +high period of SCL provided in datasheet Table 7.6 which is 1 uS. +Switching to 100khz gives us 5 uS/5 uS high/low which both fall above +the minimum given values for 100 khz, 4.0 uS/4.7 uS high/low. + +Without this patch occasionally a voltage set operation from the kernel +will appear to have worked but the actual voltage reflected on the PMIC +will not have updated, causing problems especially with cpufreq that may +update to a higher OPP without actually raising the voltage on DCDC2, +leading to a hang. + +Signed-off-by: Dave Gerlach +Signed-off-by: Kevin Hilman +Signed-off-by: Tony Lindgren +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/am43x-epos-evm.dts | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/am43x-epos-evm.dts b/arch/arm/boot/dts/am43x-epos-evm.dts +index 8b696107eef8..d2aebdbc7e0f 100644 +--- a/arch/arm/boot/dts/am43x-epos-evm.dts ++++ b/arch/arm/boot/dts/am43x-epos-evm.dts +@@ -582,7 +582,7 @@ + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&i2c0_pins>; +- clock-frequency = <400000>; ++ clock-frequency = <100000>; + + tps65218: tps65218@24 { + reg = <0x24>; +-- +2.30.2 + diff --git a/queue-5.13/arm-dts-nomadik-fix-up-interrupt-controller-node-nam.patch b/queue-5.13/arm-dts-nomadik-fix-up-interrupt-controller-node-nam.patch new file mode 100644 index 00000000000..86d827369cc --- /dev/null +++ b/queue-5.13/arm-dts-nomadik-fix-up-interrupt-controller-node-nam.patch @@ -0,0 +1,54 @@ +From b12fe213d6d564a4d4ac5344851c49cc0a6bc5fe Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 26 Jun 2021 02:01:03 +0200 +Subject: ARM: dts: nomadik: Fix up interrupt controller node names + +From: Sudeep Holla + +[ Upstream commit 47091f473b364c98207c4def197a0ae386fc9af1 ] + +Once the new schema interrupt-controller/arm,vic.yaml is added, we get +the below warnings: + + arch/arm/boot/dts/ste-nomadik-nhk15.dt.yaml: + intc@10140000: $nodename:0: 'intc@10140000' does not match + '^interrupt-controller(@[0-9a-f,]+)*$' + +Fix the node names for the interrupt controller to conform +to the standard node name interrupt-controller@.. + +Signed-off-by: Sudeep Holla +Signed-off-by: Linus Walleij +Cc: Linus Walleij +Link: https://lore.kernel.org/r/20210617210825.3064367-2-sudeep.holla@arm.com +Link: https://lore.kernel.org/r/20210626000103.830184-1-linus.walleij@linaro.org' +Signed-off-by: Arnd Bergmann +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/ste-nomadik-stn8815.dtsi | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi b/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi +index c9b906432341..1815361fe73c 100644 +--- a/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi ++++ b/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi +@@ -755,14 +755,14 @@ + status = "disabled"; + }; + +- vica: intc@10140000 { ++ vica: interrupt-controller@10140000 { + compatible = "arm,versatile-vic"; + interrupt-controller; + #interrupt-cells = <1>; + reg = <0x10140000 0x20>; + }; + +- vicb: intc@10140020 { ++ vicb: interrupt-controller@10140020 { + compatible = "arm,versatile-vic"; + interrupt-controller; + #interrupt-cells = <1>; +-- +2.30.2 + diff --git a/queue-5.13/arm-ixp4xx-goramo_mlr-depends-on-old-pci-driver.patch b/queue-5.13/arm-ixp4xx-goramo_mlr-depends-on-old-pci-driver.patch new file mode 100644 index 00000000000..9fc61239318 --- /dev/null +++ b/queue-5.13/arm-ixp4xx-goramo_mlr-depends-on-old-pci-driver.patch @@ -0,0 +1,55 @@ +From 80dbc63aa6264ab8d9274381973ddb6beb243c1f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 21 Jul 2021 17:16:04 +0200 +Subject: ARM: ixp4xx: goramo_mlr depends on old PCI driver + +From: Arnd Bergmann + +[ Upstream commit 796a8c85b1216618258e08b463d3bef0d7123760 ] + +When this driver is disabled, the board file fails to build, +so add a dependency: + +arch/arm/mach-ixp4xx/goramo_mlr.c: In function 'gmlr_pci_preinit': +arch/arm/mach-ixp4xx/goramo_mlr.c:472:9: error: implicit declaration of function 'ixp4xx_pci_preinit'; did you mean 'iop3xx_pci_preinit'? [-Werror=implicit-function-declaration] + 472 | ixp4xx_pci_preinit(); + | ^~~~~~~~~~~~~~~~~~ + | iop3xx_pci_preinit +arch/arm/mach-ixp4xx/goramo_mlr.c: In function 'gmlr_pci_postinit': +arch/arm/mach-ixp4xx/goramo_mlr.c:481:22: error: implicit declaration of function 'ixp4xx_pci_read' [-Werror=implicit-function-declaration] + 481 | if (!ixp4xx_pci_read(addr, NP_CMD_CONFIGREAD, &value)) { + | ^~~~~~~~~~~~~~~ +arch/arm/mach-ixp4xx/goramo_mlr.c:231:35: error: 'IXP4XX_UART1_BASE_PHYS' undeclared here (not in a function) + 231 | .start = IXP4XX_UART1_BASE_PHYS, + | ^~~~~~~~~~~~~~~~~~~~~~ +arch/arm/mach-ixp4xx/goramo_mlr.c: In function 'gmlr_init': +arch/arm/mach-ixp4xx/goramo_mlr.c:376:9: error: implicit declaration of function 'ixp4xx_sys_init' [-Werror=implicit-function-declaration] + 376 | ixp4xx_sys_init(); + | ^~~~~~~~~~~~~~~ + +Signed-off-by: Arnd Bergmann +Reviewed-by: Linus Walleij +Cc: Linus Walleij +Cc: soc@kernel.org +Link: https://lore.kernel.org/r/20210721151620.2373500-1-arnd@kernel.org' +Signed-off-by: Arnd Bergmann +Signed-off-by: Sasha Levin +--- + arch/arm/mach-ixp4xx/Kconfig | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/arm/mach-ixp4xx/Kconfig b/arch/arm/mach-ixp4xx/Kconfig +index 165c184801e1..57e61e797189 100644 +--- a/arch/arm/mach-ixp4xx/Kconfig ++++ b/arch/arm/mach-ixp4xx/Kconfig +@@ -89,6 +89,7 @@ config MACH_IXDP465 + + config MACH_GORAMO_MLR + bool "GORAMO Multi Link Router" ++ depends on IXP4XX_PCI_LEGACY + help + Say 'Y' here if you want your kernel to support GORAMO + MultiLink router. +-- +2.30.2 + diff --git a/queue-5.13/dmaengine-of-dma-router_xlate-to-return-eprobe_defer.patch b/queue-5.13/dmaengine-of-dma-router_xlate-to-return-eprobe_defer.patch new file mode 100644 index 00000000000..90ce9e3445e --- /dev/null +++ b/queue-5.13/dmaengine-of-dma-router_xlate-to-return-eprobe_defer.patch @@ -0,0 +1,63 @@ +From 1f33ef14d86bc6f627e865d6c2417f613b45f5ff Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 17 Jul 2021 22:00:21 +0300 +Subject: dmaengine: of-dma: router_xlate to return -EPROBE_DEFER if controller + is not yet available + +From: Peter Ujfalusi + +[ Upstream commit eda97cb095f2958bbad55684a6ca3e7d7af0176a ] + +If the router_xlate can not find the controller in the available DMA +devices then it should return with -EPORBE_DEFER in a same way as the +of_dma_request_slave_channel() does. + +The issue can be reproduced if the event router is registered before the +DMA controller itself and a driver would request for a channel before the +controller is registered. +In of_dma_request_slave_channel(): +1. of_dma_find_controller() would find the dma_router +2. ofdma->of_dma_xlate() would fail and returned NULL +3. -ENODEV is returned as error code + +with this patch we would return in this case the correct -EPROBE_DEFER and +the client can try to request the channel later. + +Signed-off-by: Peter Ujfalusi +Link: https://lore.kernel.org/r/20210717190021.21897-1-peter.ujfalusi@gmail.com +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/dma/of-dma.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/drivers/dma/of-dma.c b/drivers/dma/of-dma.c +index ec00b20ae8e4..ac61ecda2926 100644 +--- a/drivers/dma/of-dma.c ++++ b/drivers/dma/of-dma.c +@@ -67,8 +67,12 @@ static struct dma_chan *of_dma_router_xlate(struct of_phandle_args *dma_spec, + return NULL; + + ofdma_target = of_dma_find_controller(&dma_spec_target); +- if (!ofdma_target) +- return NULL; ++ if (!ofdma_target) { ++ ofdma->dma_router->route_free(ofdma->dma_router->dev, ++ route_data); ++ chan = ERR_PTR(-EPROBE_DEFER); ++ goto err; ++ } + + chan = ofdma_target->of_dma_xlate(&dma_spec_target, ofdma_target); + if (IS_ERR_OR_NULL(chan)) { +@@ -89,6 +93,7 @@ static struct dma_chan *of_dma_router_xlate(struct of_phandle_args *dma_spec, + } + } + ++err: + /* + * Need to put the node back since the ofdma->of_dma_route_allocate + * has taken it for generating the new, translated dma_spec +-- +2.30.2 + diff --git a/queue-5.13/dmaengine-usb-dmac-fix-pm-reference-leak-in-usb_dmac.patch b/queue-5.13/dmaengine-usb-dmac-fix-pm-reference-leak-in-usb_dmac.patch new file mode 100644 index 00000000000..23ecad2bffc --- /dev/null +++ b/queue-5.13/dmaengine-usb-dmac-fix-pm-reference-leak-in-usb_dmac.patch @@ -0,0 +1,40 @@ +From 893ac6493ee1d7e60ca9c800cafb8eb9d5402033 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 6 Jul 2021 20:45:21 +0800 +Subject: dmaengine: usb-dmac: Fix PM reference leak in usb_dmac_probe() + +From: Yu Kuai + +[ Upstream commit 1da569fa7ec8cb0591c74aa3050d4ea1397778b4 ] + +pm_runtime_get_sync will increment pm usage counter even it failed. +Forgetting to putting operation will result in reference leak here. +Fix it by moving the error_pm label above the pm_runtime_put() in +the error path. + +Reported-by: Hulk Robot +Signed-off-by: Yu Kuai +Link: https://lore.kernel.org/r/20210706124521.1371901-1-yukuai3@huawei.com +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/dma/sh/usb-dmac.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/dma/sh/usb-dmac.c b/drivers/dma/sh/usb-dmac.c +index 8f7ceb698226..1cc06900153e 100644 +--- a/drivers/dma/sh/usb-dmac.c ++++ b/drivers/dma/sh/usb-dmac.c +@@ -855,8 +855,8 @@ static int usb_dmac_probe(struct platform_device *pdev) + + error: + of_dma_controller_free(pdev->dev.of_node); +- pm_runtime_put(&pdev->dev); + error_pm: ++ pm_runtime_put(&pdev->dev); + pm_runtime_disable(&pdev->dev); + return ret; + } +-- +2.30.2 + diff --git a/queue-5.13/dmaengine-xilinx_dma-fix-read-after-free-bug-when-te.patch b/queue-5.13/dmaengine-xilinx_dma-fix-read-after-free-bug-when-te.patch new file mode 100644 index 00000000000..f7cd56d8b84 --- /dev/null +++ b/queue-5.13/dmaengine-xilinx_dma-fix-read-after-free-bug-when-te.patch @@ -0,0 +1,83 @@ +From cb9e885b24b9c687ec956cfe5937e71bb4af20cf Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 7 Jul 2021 00:43:38 +0100 +Subject: dmaengine: xilinx_dma: Fix read-after-free bug when terminating + transfers + +From: Adrian Larumbe + +[ Upstream commit 7dd2dd4ff9f3abda601f22b9d01441a0869d20d7 ] + +When user calls dmaengine_terminate_sync, the driver will clean up any +remaining descriptors for all the pending or active transfers that had +previously been submitted. However, this might happen whilst the tasklet is +invoking the DMA callback for the last finished transfer, so by the time it +returns and takes over the channel's spinlock, the list of completed +descriptors it was traversing is no longer valid. This leads to a +read-after-free situation. + +Fix it by signalling whether a user-triggered termination has happened by +means of a boolean variable. + +Signed-off-by: Adrian Larumbe +Link: https://lore.kernel.org/r/20210706234338.7696-3-adrian.martinezlarumbe@imgtec.com +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/dma/xilinx/xilinx_dma.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c +index 75c0b8e904e5..4b9530a7bf65 100644 +--- a/drivers/dma/xilinx/xilinx_dma.c ++++ b/drivers/dma/xilinx/xilinx_dma.c +@@ -394,6 +394,7 @@ struct xilinx_dma_tx_descriptor { + * @genlock: Support genlock mode + * @err: Channel has errors + * @idle: Check for channel idle ++ * @terminating: Check for channel being synchronized by user + * @tasklet: Cleanup work after irq + * @config: Device configuration info + * @flush_on_fsync: Flush on Frame sync +@@ -431,6 +432,7 @@ struct xilinx_dma_chan { + bool genlock; + bool err; + bool idle; ++ bool terminating; + struct tasklet_struct tasklet; + struct xilinx_vdma_config config; + bool flush_on_fsync; +@@ -1049,6 +1051,13 @@ static void xilinx_dma_chan_desc_cleanup(struct xilinx_dma_chan *chan) + /* Run any dependencies, then free the descriptor */ + dma_run_dependencies(&desc->async_tx); + xilinx_dma_free_tx_descriptor(chan, desc); ++ ++ /* ++ * While we ran a callback the user called a terminate function, ++ * which takes care of cleaning up any remaining descriptors ++ */ ++ if (chan->terminating) ++ break; + } + + spin_unlock_irqrestore(&chan->lock, flags); +@@ -1965,6 +1974,8 @@ static dma_cookie_t xilinx_dma_tx_submit(struct dma_async_tx_descriptor *tx) + if (desc->cyclic) + chan->cyclic = true; + ++ chan->terminating = false; ++ + spin_unlock_irqrestore(&chan->lock, flags); + + return cookie; +@@ -2436,6 +2447,7 @@ static int xilinx_dma_terminate_all(struct dma_chan *dchan) + + xilinx_dma_chan_reset(chan); + /* Remove and free all of the descriptors in the lists */ ++ chan->terminating = true; + xilinx_dma_free_descriptors(chan); + chan->idle = true; + +-- +2.30.2 + diff --git a/queue-5.13/drm-amd-display-fix-dynamic-bpp-issue-with-8k30-with.patch b/queue-5.13/drm-amd-display-fix-dynamic-bpp-issue-with-8k30-with.patch new file mode 100644 index 00000000000..6925ab738b3 --- /dev/null +++ b/queue-5.13/drm-amd-display-fix-dynamic-bpp-issue-with-8k30-with.patch @@ -0,0 +1,42 @@ +From da45e7134a1e2a015f7ee4d495838aa9b1e7c2cd Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 19 Jul 2021 18:24:06 -0400 +Subject: drm/amd/display: Fix Dynamic bpp issue with 8K30 with Navi 1X + +From: Bing Guo + +[ Upstream commit 06050a0f01dbac2ca33145ef19a72041206ea983 ] + +Why: +In DCN2x, HW doesn't automatically divide MASTER_UPDATE_LOCK_DB_X +by the number of pipes ODM Combined. + +How: +Set MASTER_UPDATE_LOCK_DB_X to the value that is adjusted by the +number of pipes ODM Combined. + +Reviewed-by: Martin Leung +Acked-by: Aurabindo Pillai +Signed-off-by: Bing Guo +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/display/dc/dcn20/dcn20_optc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_optc.c b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_optc.c +index 3139d90017ee..23f830986f78 100644 +--- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_optc.c ++++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_optc.c +@@ -464,7 +464,7 @@ void optc2_lock_doublebuffer_enable(struct timing_generator *optc) + + REG_UPDATE_2(OTG_GLOBAL_CONTROL1, + MASTER_UPDATE_LOCK_DB_X, +- h_blank_start - 200 - 1, ++ (h_blank_start - 200 - 1) / optc1->opp_count, + MASTER_UPDATE_LOCK_DB_Y, + v_blank_start - 1); + } +-- +2.30.2 + diff --git a/queue-5.13/drm-amd-display-workaround-for-hard-hang-on-hpd-on-n.patch b/queue-5.13/drm-amd-display-workaround-for-hard-hang-on-hpd-on-n.patch new file mode 100644 index 00000000000..ca222fe7bcd --- /dev/null +++ b/queue-5.13/drm-amd-display-workaround-for-hard-hang-on-hpd-on-n.patch @@ -0,0 +1,49 @@ +From 8738b5226dc25a45a08637d475f2066935fc1b18 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 22 Jul 2021 14:48:54 -0400 +Subject: drm/amd/display: workaround for hard hang on HPD on native DP + +From: Qingqing Zhuo + +[ Upstream commit c4152b297d56d3696ad0a9003169bc5b98ad7b72 ] + +[Why] +HPD disable and enable sequences are not mutually exclusive +on Linux. For HPDs that spans over 1s (i.e. HPD low = 1s), +part of the disable sequence (specifically, a request to SMU +to lower refclk) could come right before the call to PHY +enable, causing DMUB to access an unresponsive PHY +and thus a hard hang on the system. + +[How] +Disable 48mhz refclk off on native DP. + +Reviewed-by: Hersen Wu +Acked-by: Aurabindo Pillai +Signed-off-by: Qingqing Zhuo +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c +index 75ba86f951f8..7bbedb6b4a9e 100644 +--- a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c ++++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c +@@ -66,9 +66,11 @@ int rn_get_active_display_cnt_wa( + for (i = 0; i < context->stream_count; i++) { + const struct dc_stream_state *stream = context->streams[i]; + ++ /* Extend the WA to DP for Linux*/ + if (stream->signal == SIGNAL_TYPE_HDMI_TYPE_A || + stream->signal == SIGNAL_TYPE_DVI_SINGLE_LINK || +- stream->signal == SIGNAL_TYPE_DVI_DUAL_LINK) ++ stream->signal == SIGNAL_TYPE_DVI_DUAL_LINK || ++ stream->signal == SIGNAL_TYPE_DISPLAY_PORT) + tmds_present = true; + } + +-- +2.30.2 + diff --git a/queue-5.13/drm-amdgpu-fix-the-doorbell-missing-when-in-cgpg-iss.patch b/queue-5.13/drm-amdgpu-fix-the-doorbell-missing-when-in-cgpg-iss.patch new file mode 100644 index 00000000000..8caf846c9d2 --- /dev/null +++ b/queue-5.13/drm-amdgpu-fix-the-doorbell-missing-when-in-cgpg-iss.patch @@ -0,0 +1,62 @@ +From ca88f6ef8ef95f6d8a09011abe96d0ebae4014d7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 10 Jun 2021 09:55:01 +0800 +Subject: drm/amdgpu: fix the doorbell missing when in CGPG issue for renoir. + +From: Yifan Zhang + +[ Upstream commit 1c0539a6fc8a4a4b77278e35d763073890de96b9 ] + +If GC has entered CGPG, ringing doorbell > first page doesn't wakeup GC. +Enlarge CP_MEC_DOORBELL_RANGE_UPPER to workaround this issue. + +Signed-off-by: Yifan Zhang +Reviewed-by: Alex Deucher +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 21 ++++++++++++++++++++- + 1 file changed, 20 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +index 516467e962b7..3a476b86485e 100644 +--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c ++++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +@@ -1293,6 +1293,16 @@ static bool is_raven_kicker(struct amdgpu_device *adev) + return false; + } + ++static bool check_if_enlarge_doorbell_range(struct amdgpu_device *adev) ++{ ++ if ((adev->asic_type == CHIP_RENOIR) && ++ (adev->gfx.me_fw_version >= 0x000000a5) && ++ (adev->gfx.me_feature_version >= 52)) ++ return true; ++ else ++ return false; ++} ++ + static void gfx_v9_0_check_if_need_gfxoff(struct amdgpu_device *adev) + { + if (gfx_v9_0_should_disable_gfxoff(adev->pdev)) +@@ -3673,7 +3683,16 @@ static int gfx_v9_0_kiq_init_register(struct amdgpu_ring *ring) + if (ring->use_doorbell) { + WREG32_SOC15(GC, 0, mmCP_MEC_DOORBELL_RANGE_LOWER, + (adev->doorbell_index.kiq * 2) << 2); +- WREG32_SOC15(GC, 0, mmCP_MEC_DOORBELL_RANGE_UPPER, ++ /* If GC has entered CGPG, ringing doorbell > first page ++ * doesn't wakeup GC. Enlarge CP_MEC_DOORBELL_RANGE_UPPER to ++ * workaround this issue. And this change has to align with firmware ++ * update. ++ */ ++ if (check_if_enlarge_doorbell_range(adev)) ++ WREG32_SOC15(GC, 0, mmCP_MEC_DOORBELL_RANGE_UPPER, ++ (adev->doorbell.size - 4)); ++ else ++ WREG32_SOC15(GC, 0, mmCP_MEC_DOORBELL_RANGE_UPPER, + (adev->doorbell_index.userqueue_end * 2) << 2); + } + +-- +2.30.2 + diff --git a/queue-5.13/kyber-make-trace_block_rq-call-consistent-with-docum.patch b/queue-5.13/kyber-make-trace_block_rq-call-consistent-with-docum.patch new file mode 100644 index 00000000000..60368b4466b --- /dev/null +++ b/queue-5.13/kyber-make-trace_block_rq-call-consistent-with-docum.patch @@ -0,0 +1,46 @@ +From b6eed561e2f934c6708a94c08faf3df3cf676ba5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 4 Aug 2021 19:49:23 +0000 +Subject: kyber: make trace_block_rq call consistent with documentation + +From: Vincent Fu + +[ Upstream commit fb7b9b0231ba8f77587c23f5257a4fdb6df1219e ] + +The kyber ioscheduler calls trace_block_rq_insert() *after* the request +is added to the queue but the documentation for trace_block_rq_insert() +says that the call should be made *before* the request is added to the +queue. Move the tracepoint for the kyber ioscheduler so that it is +consistent with the documentation. + +Signed-off-by: Vincent Fu +Link: https://lore.kernel.org/r/20210804194913.10497-1-vincent.fu@samsung.com +Reviewed by: Adam Manzanares +Signed-off-by: Jens Axboe +Signed-off-by: Sasha Levin +--- + block/kyber-iosched.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/block/kyber-iosched.c b/block/kyber-iosched.c +index 81e3279ecd57..15a8be57203d 100644 +--- a/block/kyber-iosched.c ++++ b/block/kyber-iosched.c +@@ -596,13 +596,13 @@ static void kyber_insert_requests(struct blk_mq_hw_ctx *hctx, + struct list_head *head = &kcq->rq_list[sched_domain]; + + spin_lock(&kcq->lock); ++ trace_block_rq_insert(rq); + if (at_head) + list_move(&rq->queuelist, head); + else + list_move_tail(&rq->queuelist, head); + sbitmap_set_bit(&khd->kcq_map[sched_domain], + rq->mq_ctx->index_hw[hctx->type]); +- trace_block_rq_insert(rq); + spin_unlock(&kcq->lock); + } + } +-- +2.30.2 + diff --git a/queue-5.13/net-usb-lan78xx-don-t-modify-phy_device-state-concur.patch b/queue-5.13/net-usb-lan78xx-don-t-modify-phy_device-state-concur.patch new file mode 100644 index 00000000000..bcea9834d49 --- /dev/null +++ b/queue-5.13/net-usb-lan78xx-don-t-modify-phy_device-state-concur.patch @@ -0,0 +1,79 @@ +From 263e95186f75cc6efa0c90039c2e6df5d23e26d2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 4 Aug 2021 11:13:39 +0300 +Subject: net: usb: lan78xx: don't modify phy_device state concurrently + +From: Ivan T. Ivanov + +[ Upstream commit 6b67d4d63edece1033972214704c04f36c5be89a ] + +Currently phy_device state could be left in inconsistent state shown +by following alert message[1]. This is because phy_read_status could +be called concurrently from lan78xx_delayedwork, phy_state_machine and +__ethtool_get_link. Fix this by making sure that phy_device state is +updated atomically. + +[1] lan78xx 1-1.1.1:1.0 eth0: No phy led trigger registered for speed(-1) + +Signed-off-by: Ivan T. Ivanov +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/usb/lan78xx.c | 16 ++++++++++++---- + 1 file changed, 12 insertions(+), 4 deletions(-) + +diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c +index 02bce40a67e5..c46a66ea32eb 100644 +--- a/drivers/net/usb/lan78xx.c ++++ b/drivers/net/usb/lan78xx.c +@@ -1154,7 +1154,7 @@ static int lan78xx_link_reset(struct lan78xx_net *dev) + { + struct phy_device *phydev = dev->net->phydev; + struct ethtool_link_ksettings ecmd; +- int ladv, radv, ret; ++ int ladv, radv, ret, link; + u32 buf; + + /* clear LAN78xx interrupt status */ +@@ -1162,9 +1162,12 @@ static int lan78xx_link_reset(struct lan78xx_net *dev) + if (unlikely(ret < 0)) + return -EIO; + ++ mutex_lock(&phydev->lock); + phy_read_status(phydev); ++ link = phydev->link; ++ mutex_unlock(&phydev->lock); + +- if (!phydev->link && dev->link_on) { ++ if (!link && dev->link_on) { + dev->link_on = false; + + /* reset MAC */ +@@ -1177,7 +1180,7 @@ static int lan78xx_link_reset(struct lan78xx_net *dev) + return -EIO; + + del_timer(&dev->stat_monitor); +- } else if (phydev->link && !dev->link_on) { ++ } else if (link && !dev->link_on) { + dev->link_on = true; + + phy_ethtool_ksettings_get(phydev, &ecmd); +@@ -1466,9 +1469,14 @@ static int lan78xx_set_eee(struct net_device *net, struct ethtool_eee *edata) + + static u32 lan78xx_get_link(struct net_device *net) + { ++ u32 link; ++ ++ mutex_lock(&net->phydev->lock); + phy_read_status(net->phydev); ++ link = net->phydev->link; ++ mutex_unlock(&net->phydev->lock); + +- return net->phydev->link; ++ return link; + } + + static void lan78xx_get_drvinfo(struct net_device *net, +-- +2.30.2 + diff --git a/queue-5.13/net-usb-pegasus-check-the-return-value-of-get_gerist.patch b/queue-5.13/net-usb-pegasus-check-the-return-value-of-get_gerist.patch new file mode 100644 index 00000000000..5341776f9da --- /dev/null +++ b/queue-5.13/net-usb-pegasus-check-the-return-value-of-get_gerist.patch @@ -0,0 +1,315 @@ +From e6296a924133ebdbd66ba85ef1ece0ce05038096 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 3 Aug 2021 20:25:23 +0300 +Subject: net: usb: pegasus: Check the return value of get_geristers() and + friends; + +From: Petko Manolov + +[ Upstream commit 8a160e2e9aeb8318159b48701ad8a6e22274372d ] + +Certain call sites of get_geristers() did not do proper error handling. This +could be a problem as get_geristers() typically return the data via pointer to a +buffer. If an error occurred the code is carelessly manipulating the wrong data. + +Signed-off-by: Petko Manolov +Reviewed-by: Pavel Skripkin +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/usb/pegasus.c | 108 ++++++++++++++++++++++++++------------ + 1 file changed, 75 insertions(+), 33 deletions(-) + +diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c +index bc2dbf86496b..a08a46fef0d2 100644 +--- a/drivers/net/usb/pegasus.c ++++ b/drivers/net/usb/pegasus.c +@@ -132,9 +132,15 @@ static int get_registers(pegasus_t *pegasus, __u16 indx, __u16 size, void *data) + static int set_registers(pegasus_t *pegasus, __u16 indx, __u16 size, + const void *data) + { +- return usb_control_msg_send(pegasus->usb, 0, PEGASUS_REQ_SET_REGS, ++ int ret; ++ ++ ret = usb_control_msg_send(pegasus->usb, 0, PEGASUS_REQ_SET_REGS, + PEGASUS_REQT_WRITE, 0, indx, data, size, + 1000, GFP_NOIO); ++ if (ret < 0) ++ netif_dbg(pegasus, drv, pegasus->net, "%s failed with %d\n", __func__, ret); ++ ++ return ret; + } + + /* +@@ -145,10 +151,15 @@ static int set_registers(pegasus_t *pegasus, __u16 indx, __u16 size, + static int set_register(pegasus_t *pegasus, __u16 indx, __u8 data) + { + void *buf = &data; ++ int ret; + +- return usb_control_msg_send(pegasus->usb, 0, PEGASUS_REQ_SET_REG, ++ ret = usb_control_msg_send(pegasus->usb, 0, PEGASUS_REQ_SET_REG, + PEGASUS_REQT_WRITE, data, indx, buf, 1, + 1000, GFP_NOIO); ++ if (ret < 0) ++ netif_dbg(pegasus, drv, pegasus->net, "%s failed with %d\n", __func__, ret); ++ ++ return ret; + } + + static int update_eth_regs_async(pegasus_t *pegasus) +@@ -188,10 +199,9 @@ static int update_eth_regs_async(pegasus_t *pegasus) + + static int __mii_op(pegasus_t *p, __u8 phy, __u8 indx, __u16 *regd, __u8 cmd) + { +- int i; +- __u8 data[4] = { phy, 0, 0, indx }; ++ int i, ret; + __le16 regdi; +- int ret = -ETIMEDOUT; ++ __u8 data[4] = { phy, 0, 0, indx }; + + if (cmd & PHY_WRITE) { + __le16 *t = (__le16 *) & data[1]; +@@ -207,12 +217,15 @@ static int __mii_op(pegasus_t *p, __u8 phy, __u8 indx, __u16 *regd, __u8 cmd) + if (data[0] & PHY_DONE) + break; + } +- if (i >= REG_TIMEOUT) ++ if (i >= REG_TIMEOUT) { ++ ret = -ETIMEDOUT; + goto fail; ++ } + if (cmd & PHY_READ) { + ret = get_registers(p, PhyData, 2, ®di); ++ if (ret < 0) ++ goto fail; + *regd = le16_to_cpu(regdi); +- return ret; + } + return 0; + fail: +@@ -235,9 +248,13 @@ static int write_mii_word(pegasus_t *pegasus, __u8 phy, __u8 indx, __u16 *regd) + static int mdio_read(struct net_device *dev, int phy_id, int loc) + { + pegasus_t *pegasus = netdev_priv(dev); ++ int ret; + u16 res; + +- read_mii_word(pegasus, phy_id, loc, &res); ++ ret = read_mii_word(pegasus, phy_id, loc, &res); ++ if (ret < 0) ++ return ret; ++ + return (int)res; + } + +@@ -251,10 +268,9 @@ static void mdio_write(struct net_device *dev, int phy_id, int loc, int val) + + static int read_eprom_word(pegasus_t *pegasus, __u8 index, __u16 *retdata) + { +- int i; +- __u8 tmp = 0; ++ int ret, i; + __le16 retdatai; +- int ret; ++ __u8 tmp = 0; + + set_register(pegasus, EpromCtrl, 0); + set_register(pegasus, EpromOffset, index); +@@ -262,21 +278,25 @@ static int read_eprom_word(pegasus_t *pegasus, __u8 index, __u16 *retdata) + + for (i = 0; i < REG_TIMEOUT; i++) { + ret = get_registers(pegasus, EpromCtrl, 1, &tmp); ++ if (ret < 0) ++ goto fail; + if (tmp & EPROM_DONE) + break; +- if (ret == -ESHUTDOWN) +- goto fail; + } +- if (i >= REG_TIMEOUT) ++ if (i >= REG_TIMEOUT) { ++ ret = -ETIMEDOUT; + goto fail; ++ } + + ret = get_registers(pegasus, EpromData, 2, &retdatai); ++ if (ret < 0) ++ goto fail; + *retdata = le16_to_cpu(retdatai); + return ret; + + fail: +- netif_warn(pegasus, drv, pegasus->net, "%s failed\n", __func__); +- return -ETIMEDOUT; ++ netif_dbg(pegasus, drv, pegasus->net, "%s failed\n", __func__); ++ return ret; + } + + #ifdef PEGASUS_WRITE_EEPROM +@@ -324,10 +344,10 @@ static int write_eprom_word(pegasus_t *pegasus, __u8 index, __u16 data) + return ret; + + fail: +- netif_warn(pegasus, drv, pegasus->net, "%s failed\n", __func__); ++ netif_dbg(pegasus, drv, pegasus->net, "%s failed\n", __func__); + return -ETIMEDOUT; + } +-#endif /* PEGASUS_WRITE_EEPROM */ ++#endif /* PEGASUS_WRITE_EEPROM */ + + static inline int get_node_id(pegasus_t *pegasus, u8 *id) + { +@@ -367,19 +387,21 @@ static void set_ethernet_addr(pegasus_t *pegasus) + return; + err: + eth_hw_addr_random(pegasus->net); +- dev_info(&pegasus->intf->dev, "software assigned MAC address.\n"); ++ netif_dbg(pegasus, drv, pegasus->net, "software assigned MAC address.\n"); + + return; + } + + static inline int reset_mac(pegasus_t *pegasus) + { ++ int ret, i; + __u8 data = 0x8; +- int i; + + set_register(pegasus, EthCtrl1, data); + for (i = 0; i < REG_TIMEOUT; i++) { +- get_registers(pegasus, EthCtrl1, 1, &data); ++ ret = get_registers(pegasus, EthCtrl1, 1, &data); ++ if (ret < 0) ++ goto fail; + if (~data & 0x08) { + if (loopback) + break; +@@ -402,22 +424,29 @@ static inline int reset_mac(pegasus_t *pegasus) + } + if (usb_dev_id[pegasus->dev_index].vendor == VENDOR_ELCON) { + __u16 auxmode; +- read_mii_word(pegasus, 3, 0x1b, &auxmode); ++ ret = read_mii_word(pegasus, 3, 0x1b, &auxmode); ++ if (ret < 0) ++ goto fail; + auxmode |= 4; + write_mii_word(pegasus, 3, 0x1b, &auxmode); + } + + return 0; ++fail: ++ netif_dbg(pegasus, drv, pegasus->net, "%s failed\n", __func__); ++ return ret; + } + + static int enable_net_traffic(struct net_device *dev, struct usb_device *usb) + { +- __u16 linkpart; +- __u8 data[4]; + pegasus_t *pegasus = netdev_priv(dev); + int ret; ++ __u16 linkpart; ++ __u8 data[4]; + +- read_mii_word(pegasus, pegasus->phy, MII_LPA, &linkpart); ++ ret = read_mii_word(pegasus, pegasus->phy, MII_LPA, &linkpart); ++ if (ret < 0) ++ goto fail; + data[0] = 0xc8; /* TX & RX enable, append status, no CRC */ + data[1] = 0; + if (linkpart & (ADVERTISE_100FULL | ADVERTISE_10FULL)) +@@ -435,11 +464,16 @@ static int enable_net_traffic(struct net_device *dev, struct usb_device *usb) + usb_dev_id[pegasus->dev_index].vendor == VENDOR_LINKSYS2 || + usb_dev_id[pegasus->dev_index].vendor == VENDOR_DLINK) { + u16 auxmode; +- read_mii_word(pegasus, 0, 0x1b, &auxmode); ++ ret = read_mii_word(pegasus, 0, 0x1b, &auxmode); ++ if (ret < 0) ++ goto fail; + auxmode |= 4; + write_mii_word(pegasus, 0, 0x1b, &auxmode); + } + ++ return 0; ++fail: ++ netif_dbg(pegasus, drv, pegasus->net, "%s failed\n", __func__); + return ret; + } + +@@ -447,9 +481,9 @@ static void read_bulk_callback(struct urb *urb) + { + pegasus_t *pegasus = urb->context; + struct net_device *net; ++ u8 *buf = urb->transfer_buffer; + int rx_status, count = urb->actual_length; + int status = urb->status; +- u8 *buf = urb->transfer_buffer; + __u16 pkt_len; + + if (!pegasus) +@@ -1004,8 +1038,7 @@ static int pegasus_ioctl(struct net_device *net, struct ifreq *rq, int cmd) + data[0] = pegasus->phy; + fallthrough; + case SIOCDEVPRIVATE + 1: +- read_mii_word(pegasus, data[0], data[1] & 0x1f, &data[3]); +- res = 0; ++ res = read_mii_word(pegasus, data[0], data[1] & 0x1f, &data[3]); + break; + case SIOCDEVPRIVATE + 2: + if (!capable(CAP_NET_ADMIN)) +@@ -1039,22 +1072,25 @@ static void pegasus_set_multicast(struct net_device *net) + + static __u8 mii_phy_probe(pegasus_t *pegasus) + { +- int i; ++ int i, ret; + __u16 tmp; + + for (i = 0; i < 32; i++) { +- read_mii_word(pegasus, i, MII_BMSR, &tmp); ++ ret = read_mii_word(pegasus, i, MII_BMSR, &tmp); ++ if (ret < 0) ++ goto fail; + if (tmp == 0 || tmp == 0xffff || (tmp & BMSR_MEDIA) == 0) + continue; + else + return i; + } +- ++fail: + return 0xff; + } + + static inline void setup_pegasus_II(pegasus_t *pegasus) + { ++ int ret; + __u8 data = 0xa5; + + set_register(pegasus, Reg1d, 0); +@@ -1066,7 +1102,9 @@ static inline void setup_pegasus_II(pegasus_t *pegasus) + set_register(pegasus, Reg7b, 2); + + set_register(pegasus, 0x83, data); +- get_registers(pegasus, 0x83, 1, &data); ++ ret = get_registers(pegasus, 0x83, 1, &data); ++ if (ret < 0) ++ goto fail; + + if (data == 0xa5) + pegasus->chip = 0x8513; +@@ -1081,6 +1119,10 @@ static inline void setup_pegasus_II(pegasus_t *pegasus) + set_register(pegasus, Reg81, 6); + else + set_register(pegasus, Reg81, 2); ++ ++ return; ++fail: ++ netif_dbg(pegasus, drv, pegasus->net, "%s failed\n", __func__); + } + + static void check_carrier(struct work_struct *work) +-- +2.30.2 + diff --git a/queue-5.13/net-xfrm-fix-end-of-loop-tests-for-list_for_each_ent.patch b/queue-5.13/net-xfrm-fix-end-of-loop-tests-for-list_for_each_ent.patch new file mode 100644 index 00000000000..a81368f86ac --- /dev/null +++ b/queue-5.13/net-xfrm-fix-end-of-loop-tests-for-list_for_each_ent.patch @@ -0,0 +1,35 @@ +From f509250353f1adae7db508f87bcef691bad5b928 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 25 Jul 2021 23:23:55 +0530 +Subject: net: xfrm: Fix end of loop tests for list_for_each_entry + +From: Harshvardhan Jha + +[ Upstream commit 480e93e12aa04d857f7cc2e6fcec181c0d690404 ] + +The list_for_each_entry() iterator, "pos" in this code, can never be +NULL so the warning will never be printed. + +Signed-off-by: Harshvardhan Jha +Signed-off-by: Steffen Klassert +Signed-off-by: Sasha Levin +--- + net/xfrm/xfrm_ipcomp.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/net/xfrm/xfrm_ipcomp.c b/net/xfrm/xfrm_ipcomp.c +index 2e8afe078d61..cb40ff0ff28d 100644 +--- a/net/xfrm/xfrm_ipcomp.c ++++ b/net/xfrm/xfrm_ipcomp.c +@@ -241,7 +241,7 @@ static void ipcomp_free_tfms(struct crypto_comp * __percpu *tfms) + break; + } + +- WARN_ON(!pos); ++ WARN_ON(list_entry_is_head(pos, &ipcomp_tfms_list, list)); + + if (--pos->users) + return; +-- +2.30.2 + diff --git a/queue-5.13/perf-x86-fix-out-of-bound-msr-access.patch b/queue-5.13/perf-x86-fix-out-of-bound-msr-access.patch new file mode 100644 index 00000000000..3e29edcc83c --- /dev/null +++ b/queue-5.13/perf-x86-fix-out-of-bound-msr-access.patch @@ -0,0 +1,56 @@ +From 4f76ea735baa6fb80d8f09af20cc5620ef3311c4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 29 Jul 2021 11:14:57 +0200 +Subject: perf/x86: Fix out of bound MSR access + +From: Peter Zijlstra + +[ Upstream commit f4b4b45652578357031fbbef7f7a1b04f6fa2dc3 ] + +On Wed, Jul 28, 2021 at 12:49:43PM -0400, Vince Weaver wrote: +> [32694.087403] unchecked MSR access error: WRMSR to 0x318 (tried to write 0x0000000000000000) at rIP: 0xffffffff8106f854 (native_write_msr+0x4/0x20) +> [32694.101374] Call Trace: +> [32694.103974] perf_clear_dirty_counters+0x86/0x100 + +The problem being that it doesn't filter out all fake counters, in +specific the above (erroneously) tries to use FIXED_BTS. Limit the +fixed counters indexes to the hardware supplied number. + +Reported-by: Vince Weaver +Signed-off-by: Peter Zijlstra (Intel) +Tested-by: Vince Weaver +Tested-by: Like Xu +Link: https://lkml.kernel.org/r/YQJxka3dxgdIdebG@hirez.programming.kicks-ass.net +Signed-off-by: Sasha Levin +--- + arch/x86/events/core.c | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c +index 1eb45139fcc6..3092fbf9dbe4 100644 +--- a/arch/x86/events/core.c ++++ b/arch/x86/events/core.c +@@ -2489,13 +2489,15 @@ void perf_clear_dirty_counters(void) + return; + + for_each_set_bit(i, cpuc->dirty, X86_PMC_IDX_MAX) { +- /* Metrics and fake events don't have corresponding HW counters. */ +- if (is_metric_idx(i) || (i == INTEL_PMC_IDX_FIXED_VLBR)) +- continue; +- else if (i >= INTEL_PMC_IDX_FIXED) ++ if (i >= INTEL_PMC_IDX_FIXED) { ++ /* Metrics and fake events don't have corresponding HW counters. */ ++ if ((i - INTEL_PMC_IDX_FIXED) >= hybrid(cpuc->pmu, num_counters_fixed)) ++ continue; ++ + wrmsrl(MSR_ARCH_PERFMON_FIXED_CTR0 + (i - INTEL_PMC_IDX_FIXED), 0); +- else ++ } else { + wrmsrl(x86_pmu_event_addr(i), 0); ++ } + } + + bitmap_zero(cpuc->dirty, X86_PMC_IDX_MAX); +-- +2.30.2 + diff --git a/queue-5.13/qede-fix-crash-in-rmmod-qede-while-automatic-debug-c.patch b/queue-5.13/qede-fix-crash-in-rmmod-qede-while-automatic-debug-c.patch new file mode 100644 index 00000000000..a476ead550a --- /dev/null +++ b/queue-5.13/qede-fix-crash-in-rmmod-qede-while-automatic-debug-c.patch @@ -0,0 +1,68 @@ +From 724feec50d1fe1633933da359c396c4bc4e66523 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 29 Jul 2021 14:43:06 +0300 +Subject: qede: fix crash in rmmod qede while automatic debug collection + +From: Prabhakar Kushwaha + +[ Upstream commit 1159e25c137422bdc48ee96e3fb014bd942092c6 ] + +A crash has been observed if rmmod is done while automatic debug +collection in progress. It is due to a race condition between +both of them. + +To fix stop the sp_task during unload to avoid running qede_sp_task +even if they are schedule during removal process. + +Signed-off-by: Alok Prasad +Signed-off-by: Shai Malin +Signed-off-by: Ariel Elior +Signed-off-by: Prabhakar Kushwaha +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/qlogic/qede/qede.h | 1 + + drivers/net/ethernet/qlogic/qede/qede_main.c | 8 ++++++++ + 2 files changed, 9 insertions(+) + +diff --git a/drivers/net/ethernet/qlogic/qede/qede.h b/drivers/net/ethernet/qlogic/qede/qede.h +index 2e62a2c4eb63..5630008f38b7 100644 +--- a/drivers/net/ethernet/qlogic/qede/qede.h ++++ b/drivers/net/ethernet/qlogic/qede/qede.h +@@ -501,6 +501,7 @@ struct qede_fastpath { + #define QEDE_SP_HW_ERR 4 + #define QEDE_SP_ARFS_CONFIG 5 + #define QEDE_SP_AER 7 ++#define QEDE_SP_DISABLE 8 + + #ifdef CONFIG_RFS_ACCEL + int qede_rx_flow_steer(struct net_device *dev, const struct sk_buff *skb, +diff --git a/drivers/net/ethernet/qlogic/qede/qede_main.c b/drivers/net/ethernet/qlogic/qede/qede_main.c +index 01ac1e93d27a..7c6064baeba2 100644 +--- a/drivers/net/ethernet/qlogic/qede/qede_main.c ++++ b/drivers/net/ethernet/qlogic/qede/qede_main.c +@@ -1009,6 +1009,13 @@ static void qede_sp_task(struct work_struct *work) + struct qede_dev *edev = container_of(work, struct qede_dev, + sp_task.work); + ++ /* Disable execution of this deferred work once ++ * qede removal is in progress, this stop any future ++ * scheduling of sp_task. ++ */ ++ if (test_bit(QEDE_SP_DISABLE, &edev->sp_flags)) ++ return; ++ + /* The locking scheme depends on the specific flag: + * In case of QEDE_SP_RECOVERY, acquiring the RTNL lock is required to + * ensure that ongoing flows are ended and new ones are not started. +@@ -1300,6 +1307,7 @@ static void __qede_remove(struct pci_dev *pdev, enum qede_remove_mode mode) + qede_rdma_dev_remove(edev, (mode == QEDE_REMOVE_RECOVERY)); + + if (mode != QEDE_REMOVE_RECOVERY) { ++ set_bit(QEDE_SP_DISABLE, &edev->sp_flags); + unregister_netdev(ndev); + + cancel_delayed_work_sync(&edev->sp_task); +-- +2.30.2 + diff --git a/queue-5.13/scsi-core-avoid-printing-an-error-if-target_alloc-re.patch b/queue-5.13/scsi-core-avoid-printing-an-error-if-target_alloc-re.patch new file mode 100644 index 00000000000..6d3c426cf8f --- /dev/null +++ b/queue-5.13/scsi-core-avoid-printing-an-error-if-target_alloc-re.patch @@ -0,0 +1,45 @@ +From cbb43eca61abe059e8b76a9f5f178e426f32a443 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 26 Jul 2021 17:24:02 +0530 +Subject: scsi: core: Avoid printing an error if target_alloc() returns -ENXIO + +From: Sreekanth Reddy + +[ Upstream commit 70edd2e6f652f67d854981fd67f9ad0f1deaea92 ] + +Avoid printing a 'target allocation failed' error if the driver +target_alloc() callback function returns -ENXIO. This return value +indicates that the corresponding H:C:T:L entry is empty. + +Removing this error reduces the scan time if the user issues SCAN_WILD_CARD +scan operation through sysfs parameter on a host with a lot of empty +H:C:T:L entries. + +Avoiding the printk on -ENXIO matches the behavior of the other callback +functions during scanning. + +Link: https://lore.kernel.org/r/20210726115402.1936-1-sreekanth.reddy@broadcom.com +Signed-off-by: Sreekanth Reddy +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/scsi_scan.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c +index 12f54571b83e..f0367115632b 100644 +--- a/drivers/scsi/scsi_scan.c ++++ b/drivers/scsi/scsi_scan.c +@@ -471,7 +471,8 @@ static struct scsi_target *scsi_alloc_target(struct device *parent, + error = shost->hostt->target_alloc(starget); + + if(error) { +- dev_printk(KERN_ERR, dev, "target allocation failed, error %d\n", error); ++ if (error != -ENXIO) ++ dev_err(dev, "target allocation failed, error %d\n", error); + /* don't want scsi_target_reap to do the final + * put because it will be under the host lock */ + scsi_target_destroy(starget); +-- +2.30.2 + diff --git a/queue-5.13/scsi-core-fix-capacity-set-to-zero-after-offlinining.patch b/queue-5.13/scsi-core-fix-capacity-set-to-zero-after-offlinining.patch new file mode 100644 index 00000000000..91f4526da28 --- /dev/null +++ b/queue-5.13/scsi-core-fix-capacity-set-to-zero-after-offlinining.patch @@ -0,0 +1,57 @@ +From 4a44ac8d68f97d0484d3ac3f65859ff47308419e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 27 Jul 2021 11:44:55 +0800 +Subject: scsi: core: Fix capacity set to zero after offlinining device + +From: lijinlin + +[ Upstream commit f0f82e2476f6adb9c7a0135cfab8091456990c99 ] + +After adding physical volumes to a volume group through vgextend, the +kernel will rescan the partitions. This in turn will cause the device +capacity to be queried. + +If the device status is set to offline through sysfs at this time, READ +CAPACITY command will return a result which the host byte is +DID_NO_CONNECT, and the capacity of the device will be set to zero in +read_capacity_error(). After setting device status back to running, the +capacity of the device will remain stuck at zero. + +Fix this issue by rescanning device when the device state changes to +SDEV_RUNNING. + +Link: https://lore.kernel.org/r/20210727034455.1494960-1-lijinlin3@huawei.com +Reviewed-by: Bart Van Assche +Signed-off-by: lijinlin +Signed-off-by: Wu Bo +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/scsi_sysfs.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c +index 32489d25158f..ae9bfc658203 100644 +--- a/drivers/scsi/scsi_sysfs.c ++++ b/drivers/scsi/scsi_sysfs.c +@@ -807,11 +807,14 @@ store_state_field(struct device *dev, struct device_attribute *attr, + mutex_lock(&sdev->state_mutex); + ret = scsi_device_set_state(sdev, state); + /* +- * If the device state changes to SDEV_RUNNING, we need to run +- * the queue to avoid I/O hang. ++ * If the device state changes to SDEV_RUNNING, we need to ++ * rescan the device to revalidate it, and run the queue to ++ * avoid I/O hang. + */ +- if (ret == 0 && state == SDEV_RUNNING) ++ if (ret == 0 && state == SDEV_RUNNING) { ++ scsi_rescan_device(dev); + blk_mq_run_hw_queues(sdev->request_queue, true); ++ } + mutex_unlock(&sdev->state_mutex); + + return ret == 0 ? count : -EINVAL; +-- +2.30.2 + diff --git a/queue-5.13/scsi-megaraid_mm-fix-end-of-loop-tests-for-list_for_.patch b/queue-5.13/scsi-megaraid_mm-fix-end-of-loop-tests-for-list_for_.patch new file mode 100644 index 00000000000..cfdfc81d7dd --- /dev/null +++ b/queue-5.13/scsi-megaraid_mm-fix-end-of-loop-tests-for-list_for_.patch @@ -0,0 +1,93 @@ +From 153e6dbb0098b2213c164b65cfda82149214f1b1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 8 Jul 2021 13:16:42 +0530 +Subject: scsi: megaraid_mm: Fix end of loop tests for list_for_each_entry() + +From: Harshvardhan Jha + +[ Upstream commit 77541f78eadfe9fdb018a7b8b69f0f2af2cf4b82 ] + +The list_for_each_entry() iterator, "adapter" in this code, can never be +NULL. If we exit the loop without finding the correct adapter then +"adapter" points invalid memory that is an offset from the list head. This +will eventually lead to memory corruption and presumably a kernel crash. + +Link: https://lore.kernel.org/r/20210708074642.23599-1-harshvardhan.jha@oracle.com +Acked-by: Sumit Saxena +Signed-off-by: Harshvardhan Jha +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/megaraid/megaraid_mm.c | 21 +++++++++++++++------ + 1 file changed, 15 insertions(+), 6 deletions(-) + +diff --git a/drivers/scsi/megaraid/megaraid_mm.c b/drivers/scsi/megaraid/megaraid_mm.c +index abf7b401f5b9..c509440bd161 100644 +--- a/drivers/scsi/megaraid/megaraid_mm.c ++++ b/drivers/scsi/megaraid/megaraid_mm.c +@@ -238,7 +238,7 @@ mraid_mm_get_adapter(mimd_t __user *umimd, int *rval) + mimd_t mimd; + uint32_t adapno; + int iterator; +- ++ bool is_found; + + if (copy_from_user(&mimd, umimd, sizeof(mimd_t))) { + *rval = -EFAULT; +@@ -254,12 +254,16 @@ mraid_mm_get_adapter(mimd_t __user *umimd, int *rval) + + adapter = NULL; + iterator = 0; ++ is_found = false; + + list_for_each_entry(adapter, &adapters_list_g, list) { +- if (iterator++ == adapno) break; ++ if (iterator++ == adapno) { ++ is_found = true; ++ break; ++ } + } + +- if (!adapter) { ++ if (!is_found) { + *rval = -ENODEV; + return NULL; + } +@@ -725,6 +729,7 @@ ioctl_done(uioc_t *kioc) + uint32_t adapno; + int iterator; + mraid_mmadp_t* adapter; ++ bool is_found; + + /* + * When the kioc returns from driver, make sure it still doesn't +@@ -747,19 +752,23 @@ ioctl_done(uioc_t *kioc) + iterator = 0; + adapter = NULL; + adapno = kioc->adapno; ++ is_found = false; + + con_log(CL_ANN, ( KERN_WARNING "megaraid cmm: completed " + "ioctl that was timedout before\n")); + + list_for_each_entry(adapter, &adapters_list_g, list) { +- if (iterator++ == adapno) break; ++ if (iterator++ == adapno) { ++ is_found = true; ++ break; ++ } + } + + kioc->timedout = 0; + +- if (adapter) { ++ if (is_found) + mraid_mm_dealloc_kioc( adapter, kioc ); +- } ++ + } + else { + wake_up(&wait_q); +-- +2.30.2 + diff --git a/queue-5.13/scsi-pm80xx-fix-tmf-task-completion-race-condition.patch b/queue-5.13/scsi-pm80xx-fix-tmf-task-completion-race-condition.patch new file mode 100644 index 00000000000..c6fa8509ac3 --- /dev/null +++ b/queue-5.13/scsi-pm80xx-fix-tmf-task-completion-race-condition.patch @@ -0,0 +1,96 @@ +From 7a39975e0d900e9365a8da741b9d0245fa480bdb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 7 Jul 2021 11:59:45 -0700 +Subject: scsi: pm80xx: Fix TMF task completion race condition + +From: Igor Pylypiv + +[ Upstream commit d712d3fb484b7fa8d1d57e9ca6f134bb9d8c18b1 ] + +The TMF timeout timer may trigger at the same time when the response from a +controller is being handled. When this happens the SAS task may get freed +before the response processing is finished. + +Fix this by calling complete() only when SAS_TASK_STATE_DONE is not set. + +A similar race condition was fixed in commit b90cd6f2b905 ("scsi: libsas: +fix a race condition when smp task timeout") + +Link: https://lore.kernel.org/r/20210707185945.35559-1-ipylypiv@google.com +Reviewed-by: Vishakha Channapattan +Acked-by: Jack Wang +Signed-off-by: Igor Pylypiv +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/pm8001/pm8001_sas.c | 32 +++++++++++++++----------------- + 1 file changed, 15 insertions(+), 17 deletions(-) + +diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c +index 335cf37e6cb9..2e429e31f1f0 100644 +--- a/drivers/scsi/pm8001/pm8001_sas.c ++++ b/drivers/scsi/pm8001/pm8001_sas.c +@@ -684,8 +684,7 @@ int pm8001_dev_found(struct domain_device *dev) + + void pm8001_task_done(struct sas_task *task) + { +- if (!del_timer(&task->slow_task->timer)) +- return; ++ del_timer(&task->slow_task->timer); + complete(&task->slow_task->completion); + } + +@@ -693,9 +692,14 @@ static void pm8001_tmf_timedout(struct timer_list *t) + { + struct sas_task_slow *slow = from_timer(slow, t, timer); + struct sas_task *task = slow->task; ++ unsigned long flags; + +- task->task_state_flags |= SAS_TASK_STATE_ABORTED; +- complete(&task->slow_task->completion); ++ spin_lock_irqsave(&task->task_state_lock, flags); ++ if (!(task->task_state_flags & SAS_TASK_STATE_DONE)) { ++ task->task_state_flags |= SAS_TASK_STATE_ABORTED; ++ complete(&task->slow_task->completion); ++ } ++ spin_unlock_irqrestore(&task->task_state_lock, flags); + } + + #define PM8001_TASK_TIMEOUT 20 +@@ -748,13 +752,10 @@ static int pm8001_exec_internal_tmf_task(struct domain_device *dev, + } + res = -TMF_RESP_FUNC_FAILED; + /* Even TMF timed out, return direct. */ +- if ((task->task_state_flags & SAS_TASK_STATE_ABORTED)) { +- if (!(task->task_state_flags & SAS_TASK_STATE_DONE)) { +- pm8001_dbg(pm8001_ha, FAIL, +- "TMF task[%x]timeout.\n", +- tmf->tmf); +- goto ex_err; +- } ++ if (task->task_state_flags & SAS_TASK_STATE_ABORTED) { ++ pm8001_dbg(pm8001_ha, FAIL, "TMF task[%x]timeout.\n", ++ tmf->tmf); ++ goto ex_err; + } + + if (task->task_status.resp == SAS_TASK_COMPLETE && +@@ -834,12 +835,9 @@ pm8001_exec_internal_task_abort(struct pm8001_hba_info *pm8001_ha, + wait_for_completion(&task->slow_task->completion); + res = TMF_RESP_FUNC_FAILED; + /* Even TMF timed out, return direct. */ +- if ((task->task_state_flags & SAS_TASK_STATE_ABORTED)) { +- if (!(task->task_state_flags & SAS_TASK_STATE_DONE)) { +- pm8001_dbg(pm8001_ha, FAIL, +- "TMF task timeout.\n"); +- goto ex_err; +- } ++ if (task->task_state_flags & SAS_TASK_STATE_ABORTED) { ++ pm8001_dbg(pm8001_ha, FAIL, "TMF task timeout.\n"); ++ goto ex_err; + } + + if (task->task_status.resp == SAS_TASK_COMPLETE && +-- +2.30.2 + diff --git a/queue-5.13/scsi-scsi_dh_rdac-avoid-crash-during-rdac_bus_attach.patch b/queue-5.13/scsi-scsi_dh_rdac-avoid-crash-during-rdac_bus_attach.patch new file mode 100644 index 00000000000..154a4e1c9df --- /dev/null +++ b/queue-5.13/scsi-scsi_dh_rdac-avoid-crash-during-rdac_bus_attach.patch @@ -0,0 +1,92 @@ +From 6436b8b5f66068c4d7ea4266c1e9b22848e36685 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 13 Jan 2021 14:31:03 +0800 +Subject: scsi: scsi_dh_rdac: Avoid crash during rdac_bus_attach() + +From: Ye Bin + +[ Upstream commit bc546c0c9abb3bb2fb46866b3d1e6ade9695a5f6 ] + +The following BUG_ON() was observed during RDAC scan: + +[595952.944297] kernel BUG at drivers/scsi/device_handler/scsi_dh_rdac.c:427! +[595952.951143] Internal error: Oops - BUG: 0 [#1] SMP +...... +[595953.251065] Call trace: +[595953.259054] check_ownership+0xb0/0x118 +[595953.269794] rdac_bus_attach+0x1f0/0x4b0 +[595953.273787] scsi_dh_handler_attach+0x3c/0xe8 +[595953.278211] scsi_dh_add_device+0xc4/0xe8 +[595953.282291] scsi_sysfs_add_sdev+0x8c/0x2a8 +[595953.286544] scsi_probe_and_add_lun+0x9fc/0xd00 +[595953.291142] __scsi_scan_target+0x598/0x630 +[595953.295395] scsi_scan_target+0x120/0x130 +[595953.299481] fc_user_scan+0x1a0/0x1c0 [scsi_transport_fc] +[595953.304944] store_scan+0xb0/0x108 +[595953.308420] dev_attr_store+0x44/0x60 +[595953.312160] sysfs_kf_write+0x58/0x80 +[595953.315893] kernfs_fop_write+0xe8/0x1f0 +[595953.319888] __vfs_write+0x60/0x190 +[595953.323448] vfs_write+0xac/0x1c0 +[595953.326836] ksys_write+0x74/0xf0 +[595953.330221] __arm64_sys_write+0x24/0x30 + +Code is in check_ownership: + + list_for_each_entry_rcu(tmp, &h->ctlr->dh_list, node) { + /* h->sdev should always be valid */ + BUG_ON(!tmp->sdev); + tmp->sdev->access_state = access_state; + } + + rdac_bus_attach + initialize_controller + list_add_rcu(&h->node, &h->ctlr->dh_list); + h->sdev = sdev; + + rdac_bus_detach + list_del_rcu(&h->node); + h->sdev = NULL; + +Fix the race between rdac_bus_attach() and rdac_bus_detach() where h->sdev +is NULL when processing the RDAC attach. + +Link: https://lore.kernel.org/r/20210113063103.2698953-1-yebin10@huawei.com +Reviewed-by: Bart Van Assche +Signed-off-by: Ye Bin +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/device_handler/scsi_dh_rdac.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/scsi/device_handler/scsi_dh_rdac.c b/drivers/scsi/device_handler/scsi_dh_rdac.c +index 25f6e1ac9e7b..66652ab409cc 100644 +--- a/drivers/scsi/device_handler/scsi_dh_rdac.c ++++ b/drivers/scsi/device_handler/scsi_dh_rdac.c +@@ -453,8 +453,8 @@ static int initialize_controller(struct scsi_device *sdev, + if (!h->ctlr) + err = SCSI_DH_RES_TEMP_UNAVAIL; + else { +- list_add_rcu(&h->node, &h->ctlr->dh_list); + h->sdev = sdev; ++ list_add_rcu(&h->node, &h->ctlr->dh_list); + } + spin_unlock(&list_lock); + err = SCSI_DH_OK; +@@ -778,11 +778,11 @@ static void rdac_bus_detach( struct scsi_device *sdev ) + spin_lock(&list_lock); + if (h->ctlr) { + list_del_rcu(&h->node); +- h->sdev = NULL; + kref_put(&h->ctlr->kref, release_controller); + } + spin_unlock(&list_lock); + sdev->handler_data = NULL; ++ synchronize_rcu(); + kfree(h); + } + +-- +2.30.2 + diff --git a/queue-5.13/series b/queue-5.13/series index c53a56271a3..fa5860946f6 100644 --- a/queue-5.13/series +++ b/queue-5.13/series @@ -2,3 +2,25 @@ mtd-cfi_cmdset_0002-fix-crash-when-erasing-writing-amd-cards.patch io_uring-use-write_once-when-writing-to-sq_flags.patch usb-core-avoid-warnings-for-0-length-descriptor-requ.patch usb-core-fix-incorrect-pipe-calculation-in-do_proc_c.patch +dmaengine-xilinx_dma-fix-read-after-free-bug-when-te.patch +dmaengine-usb-dmac-fix-pm-reference-leak-in-usb_dmac.patch +spi-spi-mux-add-module-info-needed-for-autoloading.patch +net-xfrm-fix-end-of-loop-tests-for-list_for_each_ent.patch +arm-dts-am43x-epos-evm-reduce-i2c0-bus-speed-for-tps.patch +dmaengine-of-dma-router_xlate-to-return-eprobe_defer.patch +scsi-pm80xx-fix-tmf-task-completion-race-condition.patch +scsi-megaraid_mm-fix-end-of-loop-tests-for-list_for_.patch +scsi-scsi_dh_rdac-avoid-crash-during-rdac_bus_attach.patch +scsi-core-avoid-printing-an-error-if-target_alloc-re.patch +scsi-core-fix-capacity-set-to-zero-after-offlinining.patch +drm-amdgpu-fix-the-doorbell-missing-when-in-cgpg-iss.patch +qede-fix-crash-in-rmmod-qede-while-automatic-debug-c.patch +arm-dts-nomadik-fix-up-interrupt-controller-node-nam.patch +arm-ixp4xx-goramo_mlr-depends-on-old-pci-driver.patch +net-usb-pegasus-check-the-return-value-of-get_gerist.patch +net-usb-lan78xx-don-t-modify-phy_device-state-concur.patch +perf-x86-fix-out-of-bound-msr-access.patch +spi-cadence-quadspi-fix-check-condition-for-dtr-ops.patch +drm-amd-display-fix-dynamic-bpp-issue-with-8k30-with.patch +drm-amd-display-workaround-for-hard-hang-on-hpd-on-n.patch +kyber-make-trace_block_rq-call-consistent-with-docum.patch diff --git a/queue-5.13/spi-cadence-quadspi-fix-check-condition-for-dtr-ops.patch b/queue-5.13/spi-cadence-quadspi-fix-check-condition-for-dtr-ops.patch new file mode 100644 index 00000000000..f0de6235ea6 --- /dev/null +++ b/queue-5.13/spi-cadence-quadspi-fix-check-condition-for-dtr-ops.patch @@ -0,0 +1,68 @@ +From dcf46f52ceb10e567e5f3a870542658f7ec497c2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 16 Jul 2021 23:25:03 +0000 +Subject: spi: cadence-quadspi: Fix check condition for DTR ops + +From: Apurva Nandan + +[ Upstream commit 0395be967b067d99494113d78470574e86a02ed4 ] + +buswidth and dtr fields in spi_mem_op are only valid when the +corresponding spi_mem_op phase has a non-zero length. For example, +SPI NAND core doesn't set buswidth when using SPI_MEM_OP_NO_ADDR +phase. + +Fix the dtr checks in set_protocol() and suppports_mem_op() to +ignore empty spi_mem_op phases, as checking for dtr field in +empty phase will result in false negatives. + +Signed-off-by: Apurva Nandan +Link: https://lore.kernel.org/r/20210716232504.182-3-a-nandan@ti.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + drivers/spi/spi-cadence-quadspi.c | 21 ++++++++++++++++++--- + 1 file changed, 18 insertions(+), 3 deletions(-) + +diff --git a/drivers/spi/spi-cadence-quadspi.c b/drivers/spi/spi-cadence-quadspi.c +index d62d69dd72b9..73d4f0a1558d 100644 +--- a/drivers/spi/spi-cadence-quadspi.c ++++ b/drivers/spi/spi-cadence-quadspi.c +@@ -325,7 +325,15 @@ static int cqspi_set_protocol(struct cqspi_flash_pdata *f_pdata, + f_pdata->inst_width = CQSPI_INST_TYPE_SINGLE; + f_pdata->addr_width = CQSPI_INST_TYPE_SINGLE; + f_pdata->data_width = CQSPI_INST_TYPE_SINGLE; +- f_pdata->dtr = op->data.dtr && op->cmd.dtr && op->addr.dtr; ++ ++ /* ++ * For an op to be DTR, cmd phase along with every other non-empty ++ * phase should have dtr field set to 1. If an op phase has zero ++ * nbytes, ignore its dtr field; otherwise, check its dtr field. ++ */ ++ f_pdata->dtr = op->cmd.dtr && ++ (!op->addr.nbytes || op->addr.dtr) && ++ (!op->data.nbytes || op->data.dtr); + + switch (op->data.buswidth) { + case 0: +@@ -1227,8 +1235,15 @@ static bool cqspi_supports_mem_op(struct spi_mem *mem, + { + bool all_true, all_false; + +- all_true = op->cmd.dtr && op->addr.dtr && op->dummy.dtr && +- op->data.dtr; ++ /* ++ * op->dummy.dtr is required for converting nbytes into ncycles. ++ * Also, don't check the dtr field of the op phase having zero nbytes. ++ */ ++ all_true = op->cmd.dtr && ++ (!op->addr.nbytes || op->addr.dtr) && ++ (!op->dummy.nbytes || op->dummy.dtr) && ++ (!op->data.nbytes || op->data.dtr); ++ + all_false = !op->cmd.dtr && !op->addr.dtr && !op->dummy.dtr && + !op->data.dtr; + +-- +2.30.2 + diff --git a/queue-5.13/spi-spi-mux-add-module-info-needed-for-autoloading.patch b/queue-5.13/spi-spi-mux-add-module-info-needed-for-autoloading.patch new file mode 100644 index 00000000000..cad0ddc475e --- /dev/null +++ b/queue-5.13/spi-spi-mux-add-module-info-needed-for-autoloading.patch @@ -0,0 +1,56 @@ +From 7c4d7e9a15fe76757cf8009bbe08476f0ebc7d35 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 21 Jul 2021 11:53:21 +0200 +Subject: spi: spi-mux: Add module info needed for autoloading +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Uwe Kleine-König + +[ Upstream commit 1d5ccab95f06675a269f4cb223a1e3f6d1ebef42 ] + +With the spi device table udev can autoload the spi-mux module in +the presence of an spi-mux device. + +Signed-off-by: Uwe Kleine-König +Link: https://lore.kernel.org/r/20210721095321.2165453-1-u.kleine-koenig@pengutronix.de +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + drivers/spi/spi-mux.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/drivers/spi/spi-mux.c b/drivers/spi/spi-mux.c +index 37dfc6e82804..9708b7827ff7 100644 +--- a/drivers/spi/spi-mux.c ++++ b/drivers/spi/spi-mux.c +@@ -167,10 +167,17 @@ err_put_ctlr: + return ret; + } + ++static const struct spi_device_id spi_mux_id[] = { ++ { "spi-mux" }, ++ { } ++}; ++MODULE_DEVICE_TABLE(spi, spi_mux_id); ++ + static const struct of_device_id spi_mux_of_match[] = { + { .compatible = "spi-mux" }, + { } + }; ++MODULE_DEVICE_TABLE(of, spi_mux_of_match); + + static struct spi_driver spi_mux_driver = { + .probe = spi_mux_probe, +@@ -178,6 +185,7 @@ static struct spi_driver spi_mux_driver = { + .name = "spi-mux", + .of_match_table = spi_mux_of_match, + }, ++ .id_table = spi_mux_id, + }; + + module_spi_driver(spi_mux_driver); +-- +2.30.2 +