From: Sasha Levin Date: Fri, 18 Jun 2021 11:47:16 +0000 (-0400) Subject: Fixes for 5.12 X-Git-Tag: v5.4.128~66 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7ec17173855eca87e80d7f966ed6f376ee85bed9;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 5.12 Signed-off-by: Sasha Levin --- diff --git a/queue-5.12/afs-fix-an-is_err-vs-null-check.patch b/queue-5.12/afs-fix-an-is_err-vs-null-check.patch new file mode 100644 index 00000000000..dec87d77a6e --- /dev/null +++ b/queue-5.12/afs-fix-an-is_err-vs-null-check.patch @@ -0,0 +1,41 @@ +From 541a27f2542af0c968039b3053ac778ce194cd6a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 15 Jun 2021 08:39:52 +0100 +Subject: afs: Fix an IS_ERR() vs NULL check + +From: Dan Carpenter + +[ Upstream commit a33d62662d275cee22888fa7760fe09d5b9cd1f9 ] + +The proc_symlink() function returns NULL on error, it doesn't return +error pointers. + +Fixes: 5b86d4ff5dce ("afs: Implement network namespacing") +Signed-off-by: Dan Carpenter +Signed-off-by: David Howells +cc: linux-afs@lists.infradead.org +Link: https://lore.kernel.org/r/YLjMRKX40pTrJvgf@mwanda/ +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + fs/afs/main.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/fs/afs/main.c b/fs/afs/main.c +index b2975256dadb..179004b15566 100644 +--- a/fs/afs/main.c ++++ b/fs/afs/main.c +@@ -203,8 +203,8 @@ static int __init afs_init(void) + goto error_fs; + + afs_proc_symlink = proc_symlink("fs/afs", NULL, "../self/net/afs"); +- if (IS_ERR(afs_proc_symlink)) { +- ret = PTR_ERR(afs_proc_symlink); ++ if (!afs_proc_symlink) { ++ ret = -ENOMEM; + goto error_proc; + } + +-- +2.30.2 + diff --git a/queue-5.12/dmaengine-altera_msgdma-depends-on-has_iomem.patch b/queue-5.12/dmaengine-altera_msgdma-depends-on-has_iomem.patch new file mode 100644 index 00000000000..c2fc0118381 --- /dev/null +++ b/queue-5.12/dmaengine-altera_msgdma-depends-on-has_iomem.patch @@ -0,0 +1,49 @@ +From 691f3a56cc41e41fe645fc7460b33659c910970e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 21 May 2021 19:13:10 -0700 +Subject: dmaengine: ALTERA_MSGDMA depends on HAS_IOMEM + +From: Randy Dunlap + +[ Upstream commit 253697b93c2a1c237d34d3ae326e394aeb0ca7b3 ] + +When CONFIG_HAS_IOMEM is not set/enabled, certain iomap() family +functions [including ioremap(), devm_ioremap(), etc.] are not +available. +Drivers that use these functions should depend on HAS_IOMEM so that +they do not cause build errors. + +Repairs this build error: +s390-linux-ld: drivers/dma/altera-msgdma.o: in function `request_and_map': +altera-msgdma.c:(.text+0x14b0): undefined reference to `devm_ioremap' + +Fixes: a85c6f1b2921 ("dmaengine: Add driver for Altera / Intel mSGDMA IP core") +Signed-off-by: Randy Dunlap +Reported-by: kernel test robot +Cc: Stefan Roese +Cc: Vinod Koul +Cc: dmaengine@vger.kernel.org +Reviewed-by: Stefan Roese +Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de +Link: https://lore.kernel.org/r/20210522021313.16405-2-rdunlap@infradead.org +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/dma/Kconfig | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig +index 0c2827fd8c19..03b1b0334947 100644 +--- a/drivers/dma/Kconfig ++++ b/drivers/dma/Kconfig +@@ -59,6 +59,7 @@ config DMA_OF + #devices + config ALTERA_MSGDMA + tristate "Altera / Intel mSGDMA Engine" ++ depends on HAS_IOMEM + select DMA_ENGINE + help + Enable support for Altera / Intel mSGDMA controller. +-- +2.30.2 + diff --git a/queue-5.12/dmaengine-fsl-dpaa2-qdma-fix-error-return-code-in-tw.patch b/queue-5.12/dmaengine-fsl-dpaa2-qdma-fix-error-return-code-in-tw.patch new file mode 100644 index 00000000000..3ac174134f9 --- /dev/null +++ b/queue-5.12/dmaengine-fsl-dpaa2-qdma-fix-error-return-code-in-tw.patch @@ -0,0 +1,53 @@ +From 228c1585d6db423f2168a402bccbe84f78b94d99 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 8 May 2021 11:00:56 +0800 +Subject: dmaengine: fsl-dpaa2-qdma: Fix error return code in two functions + +From: Zhen Lei + +[ Upstream commit 17866bc6b2ae1c3075c9fe7bcbeb8ea50eb4c3fc ] + +Fix to return a negative error code from the error handling case instead +of 0, as done elsewhere in the function where it is. + +Fixes: 7fdf9b05c73b ("dmaengine: fsl-dpaa2-qdma: Add NXP dpaa2 qDMA controller driver for Layerscape SoCs") +Reported-by: Hulk Robot +Signed-off-by: Zhen Lei +Link: https://lore.kernel.org/r/20210508030056.2027-1-thunder.leizhen@huawei.com +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/dma/fsl-dpaa2-qdma/dpaa2-qdma.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/dma/fsl-dpaa2-qdma/dpaa2-qdma.c b/drivers/dma/fsl-dpaa2-qdma/dpaa2-qdma.c +index 4ec909e0b810..4ae057922ef1 100644 +--- a/drivers/dma/fsl-dpaa2-qdma/dpaa2-qdma.c ++++ b/drivers/dma/fsl-dpaa2-qdma/dpaa2-qdma.c +@@ -332,6 +332,7 @@ static int __cold dpaa2_qdma_setup(struct fsl_mc_device *ls_dev) + } + + if (priv->dpdmai_attr.version.major > DPDMAI_VER_MAJOR) { ++ err = -EINVAL; + dev_err(dev, "DPDMAI major version mismatch\n" + "Found %u.%u, supported version is %u.%u\n", + priv->dpdmai_attr.version.major, +@@ -341,6 +342,7 @@ static int __cold dpaa2_qdma_setup(struct fsl_mc_device *ls_dev) + } + + if (priv->dpdmai_attr.version.minor > DPDMAI_VER_MINOR) { ++ err = -EINVAL; + dev_err(dev, "DPDMAI minor version mismatch\n" + "Found %u.%u, supported version is %u.%u\n", + priv->dpdmai_attr.version.major, +@@ -475,6 +477,7 @@ static int __cold dpaa2_qdma_dpio_setup(struct dpaa2_qdma_priv *priv) + ppriv->store = + dpaa2_io_store_create(DPAA2_QDMA_STORE_SIZE, dev); + if (!ppriv->store) { ++ err = -ENOMEM; + dev_err(dev, "dpaa2_io_store_create() failed\n"); + goto err_store; + } +-- +2.30.2 + diff --git a/queue-5.12/dmaengine-idxd-add-engine-struct-device-missing-bus-.patch b/queue-5.12/dmaengine-idxd-add-engine-struct-device-missing-bus-.patch new file mode 100644 index 00000000000..1a57ba0ac8a --- /dev/null +++ b/queue-5.12/dmaengine-idxd-add-engine-struct-device-missing-bus-.patch @@ -0,0 +1,37 @@ +From 3787e83730f30635c313de256191557766ae5574 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 26 Apr 2021 16:09:19 -0700 +Subject: dmaengine: idxd: add engine 'struct device' missing bus type + assignment + +From: Dave Jiang + +[ Upstream commit 1c4841ccbd2b185587010d6178aac11953f61d4c ] + +engine 'struct device' setup is missing assigning the bus type. Add it to +dsa_bus_type. + +Fixes: 75b911309060 ("dmaengine: idxd: fix engine conf_dev lifetime") +Signed-off-by: Dave Jiang +Link: https://lore.kernel.org/r/161947841562.984844.17505646725993659651.stgit@djiang5-desk3.ch.intel.com +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/dma/idxd/init.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/dma/idxd/init.c b/drivers/dma/idxd/init.c +index 59f2104ffc77..f73677490b6c 100644 +--- a/drivers/dma/idxd/init.c ++++ b/drivers/dma/idxd/init.c +@@ -218,6 +218,7 @@ static int idxd_setup_engines(struct idxd_device *idxd) + engine->idxd = idxd; + device_initialize(&engine->conf_dev); + engine->conf_dev.parent = &idxd->conf_dev; ++ engine->conf_dev.bus = &dsa_bus_type; + engine->conf_dev.type = &idxd_engine_device_type; + rc = dev_set_name(&engine->conf_dev, "engine%d.%d", idxd->id, engine->id); + if (rc < 0) { +-- +2.30.2 + diff --git a/queue-5.12/dmaengine-idxd-add-missing-dsa-driver-unregister.patch b/queue-5.12/dmaengine-idxd-add-missing-dsa-driver-unregister.patch new file mode 100644 index 00000000000..4ad78dc5c56 --- /dev/null +++ b/queue-5.12/dmaengine-idxd-add-missing-dsa-driver-unregister.patch @@ -0,0 +1,36 @@ +From 6aed365f8cd6df534e2139eb4c62df5551154d5e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 26 Apr 2021 16:32:24 -0700 +Subject: dmaengine: idxd: add missing dsa driver unregister + +From: Dave Jiang + +[ Upstream commit 077cdb355b3d8ee0f258856962e6dac06e744401 ] + +The idxd_unregister_driver() has never been called for the idxd driver upon +removal. Add fix to call unregister driver on module removal. + +Fixes: c52ca478233c ("dmaengine: idxd: add configuration component of driver") +Signed-off-by: Dave Jiang +Link: https://lore.kernel.org/r/161947994449.1053102.13189942817915448216.stgit@djiang5-desk3.ch.intel.com +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/dma/idxd/init.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/dma/idxd/init.c b/drivers/dma/idxd/init.c +index f73677490b6c..eb41bb9df0fd 100644 +--- a/drivers/dma/idxd/init.c ++++ b/drivers/dma/idxd/init.c +@@ -719,6 +719,7 @@ module_init(idxd_init_module); + + static void __exit idxd_exit_module(void) + { ++ idxd_unregister_driver(); + pci_unregister_driver(&idxd_pci_driver); + idxd_cdev_remove(); + idxd_unregister_bus_type(); +-- +2.30.2 + diff --git a/queue-5.12/dmaengine-qcom_hidma_mgmt-depends-on-has_iomem.patch b/queue-5.12/dmaengine-qcom_hidma_mgmt-depends-on-has_iomem.patch new file mode 100644 index 00000000000..81dbe83521a --- /dev/null +++ b/queue-5.12/dmaengine-qcom_hidma_mgmt-depends-on-has_iomem.patch @@ -0,0 +1,50 @@ +From 1c0eb0d01ca4230e9f1966b1e8202a644b4720b0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 21 May 2021 19:13:11 -0700 +Subject: dmaengine: QCOM_HIDMA_MGMT depends on HAS_IOMEM + +From: Randy Dunlap + +[ Upstream commit 0cfbb589d67f16fa55b26ae02b69c31b52e344b1 ] + +When CONFIG_HAS_IOMEM is not set/enabled, certain iomap() family +functions [including ioremap(), devm_ioremap(), etc.] are not +available. +Drivers that use these functions should depend on HAS_IOMEM so that +they do not cause build errors. + +Rectifies these build errors: +s390-linux-ld: drivers/dma/qcom/hidma_mgmt.o: in function `hidma_mgmt_probe': +hidma_mgmt.c:(.text+0x780): undefined reference to `devm_ioremap_resource' +s390-linux-ld: drivers/dma/qcom/hidma_mgmt.o: in function `hidma_mgmt_init': +hidma_mgmt.c:(.init.text+0x126): undefined reference to `of_address_to_resource' +s390-linux-ld: hidma_mgmt.c:(.init.text+0x16e): undefined reference to `of_address_to_resource' + +Fixes: 67a2003e0607 ("dmaengine: add Qualcomm Technologies HIDMA channel driver") +Signed-off-by: Randy Dunlap +Reported-by: kernel test robot +Cc: Sinan Kaya +Cc: Vinod Koul +Cc: dmaengine@vger.kernel.org +Link: https://lore.kernel.org/r/20210522021313.16405-3-rdunlap@infradead.org +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/dma/qcom/Kconfig | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/dma/qcom/Kconfig b/drivers/dma/qcom/Kconfig +index 365f94eb3b08..3f926a653bd8 100644 +--- a/drivers/dma/qcom/Kconfig ++++ b/drivers/dma/qcom/Kconfig +@@ -33,6 +33,7 @@ config QCOM_GPI_DMA + + config QCOM_HIDMA_MGMT + tristate "Qualcomm Technologies HIDMA Management support" ++ depends on HAS_IOMEM + select DMA_ENGINE + help + Enable support for the Qualcomm Technologies HIDMA Management. +-- +2.30.2 + diff --git a/queue-5.12/dmaengine-sf_pdma-depends-on-has_iomem.patch b/queue-5.12/dmaengine-sf_pdma-depends-on-has_iomem.patch new file mode 100644 index 00000000000..db36dbd1df3 --- /dev/null +++ b/queue-5.12/dmaengine-sf_pdma-depends-on-has_iomem.patch @@ -0,0 +1,46 @@ +From 2c3d3768430c2c2267a1fc449d102645972e7229 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 21 May 2021 19:13:12 -0700 +Subject: dmaengine: SF_PDMA depends on HAS_IOMEM + +From: Randy Dunlap + +[ Upstream commit 8e2e4f3c58528c6040b5762b666734f8cceba568 ] + +When CONFIG_HAS_IOMEM is not set/enabled, certain iomap() family +functions [including ioremap(), devm_ioremap(), etc.] are not +available. +Drivers that use these functions should depend on HAS_IOMEM so that +they do not cause build errors. + +Mends this build error: +s390-linux-ld: drivers/dma/sf-pdma/sf-pdma.o: in function `sf_pdma_probe': +sf-pdma.c:(.text+0x1668): undefined reference to `devm_ioremap_resource' + +Fixes: 6973886ad58e ("dmaengine: sf-pdma: add platform DMA support for HiFive Unleashed A00") +Signed-off-by: Randy Dunlap +Reported-by: kernel test robot +Cc: Green Wan +Cc: Vinod Koul +Cc: dmaengine@vger.kernel.org +Link: https://lore.kernel.org/r/20210522021313.16405-4-rdunlap@infradead.org +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/dma/sf-pdma/Kconfig | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/dma/sf-pdma/Kconfig b/drivers/dma/sf-pdma/Kconfig +index f8ffa02e279f..ba46a0a15a93 100644 +--- a/drivers/dma/sf-pdma/Kconfig ++++ b/drivers/dma/sf-pdma/Kconfig +@@ -1,5 +1,6 @@ + config SF_PDMA + tristate "Sifive PDMA controller driver" ++ depends on HAS_IOMEM + select DMA_ENGINE + select DMA_VIRTUAL_CHANNELS + help +-- +2.30.2 + diff --git a/queue-5.12/dmaengine-stedma40-add-missing-iounmap-on-error-in-d.patch b/queue-5.12/dmaengine-stedma40-add-missing-iounmap-on-error-in-d.patch new file mode 100644 index 00000000000..09955d6c286 --- /dev/null +++ b/queue-5.12/dmaengine-stedma40-add-missing-iounmap-on-error-in-d.patch @@ -0,0 +1,40 @@ +From 0d93da6580fe01ed215ca132faded7270d5f27d0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 18 May 2021 22:11:08 +0800 +Subject: dmaengine: stedma40: add missing iounmap() on error in d40_probe() + +From: Yang Yingliang + +[ Upstream commit fffdaba402cea79b8d219355487d342ec23f91c6 ] + +Add the missing iounmap() before return from d40_probe() +in the error handling case. + +Fixes: 8d318a50b3d7 ("DMAENGINE: Support for ST-Ericssons DMA40 block v3") +Reported-by: Hulk Robot +Signed-off-by: Yang Yingliang +Reviewed-by: Linus Walleij +Link: https://lore.kernel.org/r/20210518141108.1324127-1-yangyingliang@huawei.com +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/dma/ste_dma40.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c +index 265d7c07b348..e1827393143f 100644 +--- a/drivers/dma/ste_dma40.c ++++ b/drivers/dma/ste_dma40.c +@@ -3675,6 +3675,9 @@ static int __init d40_probe(struct platform_device *pdev) + + kfree(base->lcla_pool.base_unaligned); + ++ if (base->lcpa_base) ++ iounmap(base->lcpa_base); ++ + if (base->phy_lcpa) + release_mem_region(base->phy_lcpa, + base->lcpa_size); +-- +2.30.2 + diff --git a/queue-5.12/dmaengine-xilinx-dpdma-initialize-registers-before-r.patch b/queue-5.12/dmaengine-xilinx-dpdma-initialize-registers-before-r.patch new file mode 100644 index 00000000000..3ef6e0ad3de --- /dev/null +++ b/queue-5.12/dmaengine-xilinx-dpdma-initialize-registers-before-r.patch @@ -0,0 +1,138 @@ +From aca95bd7a872e2f4fff2f7b685150bb25335b1b4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 30 Apr 2021 14:40:41 +0800 +Subject: dmaengine: xilinx: dpdma: initialize registers before request_irq + +From: Quanyang Wang + +[ Upstream commit 538ea65a9fd1194352a41313bff876b74b5d90c5 ] + +In some scenarios (kdump), dpdma hardware irqs has been enabled when +calling request_irq in probe function, and then the dpdma irq handler +xilinx_dpdma_irq_handler is invoked to access xdev->chan[i]. But at +this moment xdev->chan[i] hasn't been initialized. + +We should ensure the dpdma controller to be in a consistent and +clean state before further initialization. So add dpdma_hw_init() +to do this. + +Furthermore, in xilinx_dpdma_disable_irq, disable all interrupts +instead of error interrupts. + +This patch is to fix the kdump kernel crash as below: + +[ 3.696128] Unable to handle kernel NULL pointer dereference at virtual address 000000000000012c +[ 3.696710] xilinx-zynqmp-dpdma fd4c0000.dma-controller: Xilinx DPDMA engine is probed +[ 3.704900] Mem abort info: +[ 3.704902] ESR = 0x96000005 +[ 3.704905] EC = 0x25: DABT (current EL), IL = 32 bits +[ 3.704907] SET = 0, FnV = 0 +[ 3.704912] EA = 0, S1PTW = 0 +[ 3.713800] ahci-ceva fd0c0000.ahci: supply ahci not found, using dummy regulator +[ 3.715585] Data abort info: +[ 3.715587] ISV = 0, ISS = 0x00000005 +[ 3.715589] CM = 0, WnR = 0 +[ 3.715592] [000000000000012c] user address but active_mm is swapper +[ 3.715596] Internal error: Oops: 96000005 [#1] SMP +[ 3.715599] Modules linked in: +[ 3.715608] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.10.0-12170-g60894882155f-dirty #77 +[ 3.723937] Hardware name: ZynqMP ZCU102 Rev1.0 (DT) +[ 3.723942] pstate: 80000085 (Nzcv daIf -PAN -UAO -TCO BTYPE=--) +[ 3.723956] pc : xilinx_dpdma_irq_handler+0x418/0x560 +[ 3.793049] lr : xilinx_dpdma_irq_handler+0x3d8/0x560 +[ 3.798089] sp : ffffffc01186bdf0 +[ 3.801388] x29: ffffffc01186bdf0 x28: ffffffc011836f28 +[ 3.806692] x27: ffffff8023e0ac80 x26: 0000000000000080 +[ 3.811996] x25: 0000000008000408 x24: 0000000000000003 +[ 3.817300] x23: ffffffc01186be70 x22: ffffffc011291740 +[ 3.822604] x21: 0000000000000000 x20: 0000000008000408 +[ 3.827908] x19: 0000000000000000 x18: 0000000000000010 +[ 3.833212] x17: 0000000000000000 x16: 0000000000000000 +[ 3.838516] x15: 0000000000000000 x14: ffffffc011291740 +[ 3.843820] x13: ffffffc02eb4d000 x12: 0000000034d4d91d +[ 3.849124] x11: 0000000000000040 x10: ffffffc0112d2d48 +[ 3.854428] x9 : ffffffc0112d2d40 x8 : ffffff8021c00268 +[ 3.859732] x7 : 0000000000000000 x6 : ffffffc011836000 +[ 3.865036] x5 : 0000000000000003 x4 : 0000000000000000 +[ 3.870340] x3 : 0000000000000001 x2 : 0000000000000000 +[ 3.875644] x1 : 0000000000000000 x0 : 000000000000012c +[ 3.880948] Call trace: +[ 3.883382] xilinx_dpdma_irq_handler+0x418/0x560 +[ 3.888079] __handle_irq_event_percpu+0x5c/0x178 +[ 3.892774] handle_irq_event_percpu+0x34/0x98 +[ 3.897210] handle_irq_event+0x44/0xb8 +[ 3.901030] handle_fasteoi_irq+0xd0/0x190 +[ 3.905117] generic_handle_irq+0x30/0x48 +[ 3.909111] __handle_domain_irq+0x64/0xc0 +[ 3.913192] gic_handle_irq+0x78/0xa0 +[ 3.916846] el1_irq+0xc4/0x180 +[ 3.919982] cpuidle_enter_state+0x134/0x2f8 +[ 3.924243] cpuidle_enter+0x38/0x50 +[ 3.927810] call_cpuidle+0x1c/0x40 +[ 3.931290] do_idle+0x20c/0x270 +[ 3.934502] cpu_startup_entry+0x28/0x58 +[ 3.938410] rest_init+0xbc/0xcc +[ 3.941631] arch_call_rest_init+0x10/0x1c +[ 3.945718] start_kernel+0x51c/0x558 + +Fixes: 7cbb0c63de3f ("dmaengine: xilinx: dpdma: Add the Xilinx DisplayPort DMA engine driver") +Signed-off-by: Quanyang Wang +Link: https://lore.kernel.org/r/20210430064041.4058180-1-quanyang.wang@windriver.com +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/dma/xilinx/xilinx_dpdma.c | 24 +++++++++++++++++++++++- + 1 file changed, 23 insertions(+), 1 deletion(-) + +diff --git a/drivers/dma/xilinx/xilinx_dpdma.c b/drivers/dma/xilinx/xilinx_dpdma.c +index 70b29bd079c9..ff7dfb3fdeb4 100644 +--- a/drivers/dma/xilinx/xilinx_dpdma.c ++++ b/drivers/dma/xilinx/xilinx_dpdma.c +@@ -1459,7 +1459,7 @@ static void xilinx_dpdma_enable_irq(struct xilinx_dpdma_device *xdev) + */ + static void xilinx_dpdma_disable_irq(struct xilinx_dpdma_device *xdev) + { +- dpdma_write(xdev->reg, XILINX_DPDMA_IDS, XILINX_DPDMA_INTR_ERR_ALL); ++ dpdma_write(xdev->reg, XILINX_DPDMA_IDS, XILINX_DPDMA_INTR_ALL); + dpdma_write(xdev->reg, XILINX_DPDMA_EIDS, XILINX_DPDMA_EINTR_ALL); + } + +@@ -1596,6 +1596,26 @@ static struct dma_chan *of_dma_xilinx_xlate(struct of_phandle_args *dma_spec, + return dma_get_slave_channel(&xdev->chan[chan_id]->vchan.chan); + } + ++static void dpdma_hw_init(struct xilinx_dpdma_device *xdev) ++{ ++ unsigned int i; ++ void __iomem *reg; ++ ++ /* Disable all interrupts */ ++ xilinx_dpdma_disable_irq(xdev); ++ ++ /* Stop all channels */ ++ for (i = 0; i < ARRAY_SIZE(xdev->chan); i++) { ++ reg = xdev->reg + XILINX_DPDMA_CH_BASE ++ + XILINX_DPDMA_CH_OFFSET * i; ++ dpdma_clr(reg, XILINX_DPDMA_CH_CNTL, XILINX_DPDMA_CH_CNTL_ENABLE); ++ } ++ ++ /* Clear the interrupt status registers */ ++ dpdma_write(xdev->reg, XILINX_DPDMA_ISR, XILINX_DPDMA_INTR_ALL); ++ dpdma_write(xdev->reg, XILINX_DPDMA_EISR, XILINX_DPDMA_EINTR_ALL); ++} ++ + static int xilinx_dpdma_probe(struct platform_device *pdev) + { + struct xilinx_dpdma_device *xdev; +@@ -1622,6 +1642,8 @@ static int xilinx_dpdma_probe(struct platform_device *pdev) + if (IS_ERR(xdev->reg)) + return PTR_ERR(xdev->reg); + ++ dpdma_hw_init(xdev); ++ + xdev->irq = platform_get_irq(pdev, 0); + if (xdev->irq < 0) { + dev_err(xdev->dev, "failed to get platform irq\n"); +-- +2.30.2 + diff --git a/queue-5.12/mm-memory-failure-make-sure-wait-for-page-writeback-.patch b/queue-5.12/mm-memory-failure-make-sure-wait-for-page-writeback-.patch new file mode 100644 index 00000000000..c045dd17440 --- /dev/null +++ b/queue-5.12/mm-memory-failure-make-sure-wait-for-page-writeback-.patch @@ -0,0 +1,84 @@ +From f301a433c0b0577f4149a3811e217d353d207b68 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 15 Jun 2021 18:23:32 -0700 +Subject: mm/memory-failure: make sure wait for page writeback in + memory_failure + +From: yangerkun + +[ Upstream commit e8675d291ac007e1c636870db880f837a9ea112a ] + +Our syzkaller trigger the "BUG_ON(!list_empty(&inode->i_wb_list))" in +clear_inode: + + kernel BUG at fs/inode.c:519! + Internal error: Oops - BUG: 0 [#1] SMP + Modules linked in: + Process syz-executor.0 (pid: 249, stack limit = 0x00000000a12409d7) + CPU: 1 PID: 249 Comm: syz-executor.0 Not tainted 4.19.95 + Hardware name: linux,dummy-virt (DT) + pstate: 80000005 (Nzcv daif -PAN -UAO) + pc : clear_inode+0x280/0x2a8 + lr : clear_inode+0x280/0x2a8 + Call trace: + clear_inode+0x280/0x2a8 + ext4_clear_inode+0x38/0xe8 + ext4_free_inode+0x130/0xc68 + ext4_evict_inode+0xb20/0xcb8 + evict+0x1a8/0x3c0 + iput+0x344/0x460 + do_unlinkat+0x260/0x410 + __arm64_sys_unlinkat+0x6c/0xc0 + el0_svc_common+0xdc/0x3b0 + el0_svc_handler+0xf8/0x160 + el0_svc+0x10/0x218 + Kernel panic - not syncing: Fatal exception + +A crash dump of this problem show that someone called __munlock_pagevec +to clear page LRU without lock_page: do_mmap -> mmap_region -> do_munmap +-> munlock_vma_pages_range -> __munlock_pagevec. + +As a result memory_failure will call identify_page_state without +wait_on_page_writeback. And after truncate_error_page clear the mapping +of this page. end_page_writeback won't call sb_clear_inode_writeback to +clear inode->i_wb_list. That will trigger BUG_ON in clear_inode! + +Fix it by checking PageWriteback too to help determine should we skip +wait_on_page_writeback. + +Link: https://lkml.kernel.org/r/20210604084705.3729204-1-yangerkun@huawei.com +Fixes: 0bc1f8b0682c ("hwpoison: fix the handling path of the victimized page frame that belong to non-LRU") +Signed-off-by: yangerkun +Acked-by: Naoya Horiguchi +Cc: Jan Kara +Cc: Theodore Ts'o +Cc: Oscar Salvador +Cc: Yu Kuai +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + mm/memory-failure.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/mm/memory-failure.c b/mm/memory-failure.c +index bd3945446d47..fd2c0271502a 100644 +--- a/mm/memory-failure.c ++++ b/mm/memory-failure.c +@@ -1527,7 +1527,12 @@ try_again: + return 0; + } + +- if (!PageTransTail(p) && !PageLRU(p)) ++ /* ++ * __munlock_pagevec may clear a writeback page's LRU flag without ++ * page_lock. We need wait writeback completion for this page or it ++ * may trigger vfs BUG while evict inode. ++ */ ++ if (!PageTransTail(p) && !PageLRU(p) && !PageWriteback(p)) + goto identify_page_state; + + /* +-- +2.30.2 + diff --git a/queue-5.12/series b/queue-5.12/series new file mode 100644 index 00000000000..57acb96efbe --- /dev/null +++ b/queue-5.12/series @@ -0,0 +1,10 @@ +dmaengine-idxd-add-engine-struct-device-missing-bus-.patch +dmaengine-idxd-add-missing-dsa-driver-unregister.patch +dmaengine-fsl-dpaa2-qdma-fix-error-return-code-in-tw.patch +dmaengine-xilinx-dpdma-initialize-registers-before-r.patch +dmaengine-altera_msgdma-depends-on-has_iomem.patch +dmaengine-qcom_hidma_mgmt-depends-on-has_iomem.patch +dmaengine-sf_pdma-depends-on-has_iomem.patch +dmaengine-stedma40-add-missing-iounmap-on-error-in-d.patch +afs-fix-an-is_err-vs-null-check.patch +mm-memory-failure-make-sure-wait-for-page-writeback-.patch