From b2209c0499e8b0a9a0b08490d76d51d7ccb5dba6 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 7 Oct 2024 11:33:00 +0200 Subject: [PATCH] 5.10-stable patches added patches: firmware-tegra-bpmp-drop-unused-mbox_client_to_bpmp.patch i2c-qcom-geni-use-irqf_no_autoen-flag-in-request_irq.patch i2c-stm32f7-do-not-prepare-unprepare-clock-during-runtime-suspend-resume.patch i2c-xiic-wait-for-tx-empty-to-avoid-missed-tx-naks.patch spi-bcm63xx-fix-module-autoloading.patch --- ...bpmp-drop-unused-mbox_client_to_bpmp.patch | 37 +++++++++ ...e-irqf_no_autoen-flag-in-request_irq.patch | 43 +++++++++++ ...-clock-during-runtime-suspend-resume.patch | 58 ++++++++++++++ ...for-tx-empty-to-avoid-missed-tx-naks.patch | 75 +++++++++++++++++++ ...-fix-charge_reserved_hugetlb.sh-test.patch | 11 +-- queue-5.10/series | 5 ++ .../spi-bcm63xx-fix-module-autoloading.patch | 33 ++++++++ 7 files changed, 253 insertions(+), 9 deletions(-) create mode 100644 queue-5.10/firmware-tegra-bpmp-drop-unused-mbox_client_to_bpmp.patch create mode 100644 queue-5.10/i2c-qcom-geni-use-irqf_no_autoen-flag-in-request_irq.patch create mode 100644 queue-5.10/i2c-stm32f7-do-not-prepare-unprepare-clock-during-runtime-suspend-resume.patch create mode 100644 queue-5.10/i2c-xiic-wait-for-tx-empty-to-avoid-missed-tx-naks.patch create mode 100644 queue-5.10/spi-bcm63xx-fix-module-autoloading.patch diff --git a/queue-5.10/firmware-tegra-bpmp-drop-unused-mbox_client_to_bpmp.patch b/queue-5.10/firmware-tegra-bpmp-drop-unused-mbox_client_to_bpmp.patch new file mode 100644 index 00000000000..f7f6963121c --- /dev/null +++ b/queue-5.10/firmware-tegra-bpmp-drop-unused-mbox_client_to_bpmp.patch @@ -0,0 +1,37 @@ +From 9c3a62c20f7fb00294a4237e287254456ba8a48b Mon Sep 17 00:00:00 2001 +From: Krzysztof Kozlowski +Date: Fri, 16 Aug 2024 15:57:21 +0200 +Subject: firmware: tegra: bpmp: Drop unused mbox_client_to_bpmp() + +From: Krzysztof Kozlowski + +commit 9c3a62c20f7fb00294a4237e287254456ba8a48b upstream. + +mbox_client_to_bpmp() is not used, W=1 builds: + + drivers/firmware/tegra/bpmp.c:28:1: error: unused function 'mbox_client_to_bpmp' [-Werror,-Wunused-function] + +Fixes: cdfa358b248e ("firmware: tegra: Refactor BPMP driver") +Cc: stable@vger.kernel.org +Signed-off-by: Krzysztof Kozlowski +Signed-off-by: Thierry Reding +Signed-off-by: Greg Kroah-Hartman +--- + drivers/firmware/tegra/bpmp.c | 6 ------ + 1 file changed, 6 deletions(-) + +--- a/drivers/firmware/tegra/bpmp.c ++++ b/drivers/firmware/tegra/bpmp.c +@@ -25,12 +25,6 @@ + #define MSG_RING BIT(1) + #define TAG_SZ 32 + +-static inline struct tegra_bpmp * +-mbox_client_to_bpmp(struct mbox_client *client) +-{ +- return container_of(client, struct tegra_bpmp, mbox.client); +-} +- + static inline const struct tegra_bpmp_ops * + channel_to_ops(struct tegra_bpmp_channel *channel) + { diff --git a/queue-5.10/i2c-qcom-geni-use-irqf_no_autoen-flag-in-request_irq.patch b/queue-5.10/i2c-qcom-geni-use-irqf_no_autoen-flag-in-request_irq.patch new file mode 100644 index 00000000000..300054bf779 --- /dev/null +++ b/queue-5.10/i2c-qcom-geni-use-irqf_no_autoen-flag-in-request_irq.patch @@ -0,0 +1,43 @@ +From e2c85d85a05f16af2223fcc0195ff50a7938b372 Mon Sep 17 00:00:00 2001 +From: Jinjie Ruan +Date: Thu, 12 Sep 2024 11:34:59 +0800 +Subject: i2c: qcom-geni: Use IRQF_NO_AUTOEN flag in request_irq() + +From: Jinjie Ruan + +commit e2c85d85a05f16af2223fcc0195ff50a7938b372 upstream. + +disable_irq() after request_irq() still has a time gap in which +interrupts can come. request_irq() with IRQF_NO_AUTOEN flag will +disable IRQ auto-enable when request IRQ. + +Fixes: 37692de5d523 ("i2c: i2c-qcom-geni: Add bus driver for the Qualcomm GENI I2C controller") +Signed-off-by: Jinjie Ruan +Cc: # v4.19+ +Acked-by: Mukesh Kumar Savaliya +Reviewed-by: Vladimir Zapolskiy +Signed-off-by: Andi Shyti +Signed-off-by: Greg Kroah-Hartman +--- + drivers/i2c/busses/i2c-qcom-geni.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +--- a/drivers/i2c/busses/i2c-qcom-geni.c ++++ b/drivers/i2c/busses/i2c-qcom-geni.c +@@ -569,15 +569,13 @@ static int geni_i2c_probe(struct platfor + init_completion(&gi2c->done); + spin_lock_init(&gi2c->lock); + platform_set_drvdata(pdev, gi2c); +- ret = devm_request_irq(dev, gi2c->irq, geni_i2c_irq, 0, ++ ret = devm_request_irq(dev, gi2c->irq, geni_i2c_irq, IRQF_NO_AUTOEN, + dev_name(dev), gi2c); + if (ret) { + dev_err(dev, "Request_irq failed:%d: err:%d\n", + gi2c->irq, ret); + return ret; + } +- /* Disable the interrupt so that the system can enter low-power mode */ +- disable_irq(gi2c->irq); + i2c_set_adapdata(&gi2c->adap, gi2c); + gi2c->adap.dev.parent = dev; + gi2c->adap.dev.of_node = dev->of_node; diff --git a/queue-5.10/i2c-stm32f7-do-not-prepare-unprepare-clock-during-runtime-suspend-resume.patch b/queue-5.10/i2c-stm32f7-do-not-prepare-unprepare-clock-during-runtime-suspend-resume.patch new file mode 100644 index 00000000000..3f0819e65cb --- /dev/null +++ b/queue-5.10/i2c-stm32f7-do-not-prepare-unprepare-clock-during-runtime-suspend-resume.patch @@ -0,0 +1,58 @@ +From 048bbbdbf85e5e00258dfb12f5e368f908801d7b Mon Sep 17 00:00:00 2001 +From: Marek Vasut +Date: Mon, 30 Sep 2024 21:27:41 +0200 +Subject: i2c: stm32f7: Do not prepare/unprepare clock during runtime suspend/resume + +From: Marek Vasut + +commit 048bbbdbf85e5e00258dfb12f5e368f908801d7b upstream. + +In case there is any sort of clock controller attached to this I2C bus +controller, for example Versaclock or even an AIC32x4 I2C codec, then +an I2C transfer triggered from the clock controller clk_ops .prepare +callback may trigger a deadlock on drivers/clk/clk.c prepare_lock mutex. + +This is because the clock controller first grabs the prepare_lock mutex +and then performs the prepare operation, including its I2C access. The +I2C access resumes this I2C bus controller via .runtime_resume callback, +which calls clk_prepare_enable(), which attempts to grab the prepare_lock +mutex again and deadlocks. + +Since the clock are already prepared since probe() and unprepared in +remove(), use simple clk_enable()/clk_disable() calls to enable and +disable the clock on runtime suspend and resume, to avoid hitting the +prepare_lock mutex. + +Acked-by: Alain Volmat +Signed-off-by: Marek Vasut +Fixes: 4e7bca6fc07b ("i2c: i2c-stm32f7: add PM Runtime support") +Cc: # v5.0+ +Signed-off-by: Andi Shyti +Signed-off-by: Greg Kroah-Hartman +--- + drivers/i2c/busses/i2c-stm32f7.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/i2c/busses/i2c-stm32f7.c ++++ b/drivers/i2c/busses/i2c-stm32f7.c +@@ -2278,7 +2278,7 @@ static int __maybe_unused stm32f7_i2c_ru + struct stm32f7_i2c_dev *i2c_dev = dev_get_drvdata(dev); + + if (!stm32f7_i2c_is_slave_registered(i2c_dev)) +- clk_disable_unprepare(i2c_dev->clk); ++ clk_disable(i2c_dev->clk); + + return 0; + } +@@ -2289,9 +2289,9 @@ static int __maybe_unused stm32f7_i2c_ru + int ret; + + if (!stm32f7_i2c_is_slave_registered(i2c_dev)) { +- ret = clk_prepare_enable(i2c_dev->clk); ++ ret = clk_enable(i2c_dev->clk); + if (ret) { +- dev_err(dev, "failed to prepare_enable clock\n"); ++ dev_err(dev, "failed to enable clock\n"); + return ret; + } + } diff --git a/queue-5.10/i2c-xiic-wait-for-tx-empty-to-avoid-missed-tx-naks.patch b/queue-5.10/i2c-xiic-wait-for-tx-empty-to-avoid-missed-tx-naks.patch new file mode 100644 index 00000000000..64bc176ec98 --- /dev/null +++ b/queue-5.10/i2c-xiic-wait-for-tx-empty-to-avoid-missed-tx-naks.patch @@ -0,0 +1,75 @@ +From 521da1e9225450bd323db5fa5bca942b1dc485b7 Mon Sep 17 00:00:00 2001 +From: Robert Hancock +Date: Tue, 21 Nov 2023 18:11:16 +0000 +Subject: i2c: xiic: Wait for TX empty to avoid missed TX NAKs + +From: Robert Hancock + +commit 521da1e9225450bd323db5fa5bca942b1dc485b7 upstream. + +Frequently an I2C write will be followed by a read, such as a register +address write followed by a read of the register value. In this driver, +when the TX FIFO half empty interrupt was raised and it was determined +that there was enough space in the TX FIFO to send the following read +command, it would do so without waiting for the TX FIFO to actually +empty. + +Unfortunately it appears that in some cases this can result in a NAK +that was raised by the target device on the write, such as due to an +unsupported register address, being ignored and the subsequent read +being done anyway. This can potentially put the I2C bus into an +invalid state and/or result in invalid read data being processed. + +To avoid this, once a message has been fully written to the TX FIFO, +wait for the TX FIFO empty interrupt before moving on to the next +message, to ensure NAKs are handled properly. + +Fixes: e1d5b6598cdc ("i2c: Add support for Xilinx XPS IIC Bus Interface") +Signed-off-by: Robert Hancock +Cc: # v2.6.34+ +Reviewed-by: Manikanta Guntupalli +Acked-by: Michal Simek +Signed-off-by: Andi Shyti +Signed-off-by: Greg Kroah-Hartman +--- + drivers/i2c/busses/i2c-xiic.c | 19 +++++++++---------- + 1 file changed, 9 insertions(+), 10 deletions(-) + +--- a/drivers/i2c/busses/i2c-xiic.c ++++ b/drivers/i2c/busses/i2c-xiic.c +@@ -494,14 +494,17 @@ static irqreturn_t xiic_process(int irq, + goto out; + } + +- xiic_fill_tx_fifo(i2c); +- +- /* current message sent and there is space in the fifo */ +- if (!xiic_tx_space(i2c) && xiic_tx_fifo_space(i2c) >= 2) { ++ if (xiic_tx_space(i2c)) { ++ xiic_fill_tx_fifo(i2c); ++ } else { ++ /* current message fully written */ + dev_dbg(i2c->adap.dev.parent, + "%s end of message sent, nmsgs: %d\n", + __func__, i2c->nmsgs); +- if (i2c->nmsgs > 1) { ++ /* Don't move onto the next message until the TX FIFO empties, ++ * to ensure that a NAK is not missed. ++ */ ++ if (i2c->nmsgs > 1 && (pend & XIIC_INTR_TX_EMPTY_MASK)) { + i2c->nmsgs--; + i2c->tx_msg++; + xfer_more = 1; +@@ -512,11 +515,7 @@ static irqreturn_t xiic_process(int irq, + "%s Got TX IRQ but no more to do...\n", + __func__); + } +- } else if (!xiic_tx_space(i2c) && (i2c->nmsgs == 1)) +- /* current frame is sent and is last, +- * make sure to disable tx half +- */ +- xiic_irq_dis(i2c, XIIC_INTR_TX_HALF_MASK); ++ } + } + out: + dev_dbg(i2c->adap.dev.parent, "%s clr: 0x%x\n", __func__, clr); diff --git a/queue-5.10/selftests-mm-fix-charge_reserved_hugetlb.sh-test.patch b/queue-5.10/selftests-mm-fix-charge_reserved_hugetlb.sh-test.patch index 4b3042c36f9..5d55681fbbb 100644 --- a/queue-5.10/selftests-mm-fix-charge_reserved_hugetlb.sh-test.patch +++ b/queue-5.10/selftests-mm-fix-charge_reserved_hugetlb.sh-test.patch @@ -53,12 +53,10 @@ Cc: Muchun Song Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin --- - .../selftests/vm/charge_reserved_hugetlb.sh | 2 +- - .../testing/selftests/vm/write_to_hugetlbfs.c | 21 +++++++++++-------- + tools/testing/selftests/vm/charge_reserved_hugetlb.sh | 2 - + tools/testing/selftests/vm/write_to_hugetlbfs.c | 21 ++++++++++-------- 2 files changed, 13 insertions(+), 10 deletions(-) -diff --git a/tools/testing/selftests/vm/charge_reserved_hugetlb.sh b/tools/testing/selftests/vm/charge_reserved_hugetlb.sh -index d0107f8ae6213..28192ec98498f 100644 --- a/tools/testing/selftests/vm/charge_reserved_hugetlb.sh +++ b/tools/testing/selftests/vm/charge_reserved_hugetlb.sh @@ -249,7 +249,7 @@ function cleanup_hugetlb_memory() { @@ -70,8 +68,6 @@ index d0107f8ae6213..28192ec98498f 100644 wait_for_hugetlb_memory_to_get_depleted $cgroup fi set -e -diff --git a/tools/testing/selftests/vm/write_to_hugetlbfs.c b/tools/testing/selftests/vm/write_to_hugetlbfs.c -index 6a2caba19ee1d..1289d311efd70 100644 --- a/tools/testing/selftests/vm/write_to_hugetlbfs.c +++ b/tools/testing/selftests/vm/write_to_hugetlbfs.c @@ -28,7 +28,7 @@ enum method { @@ -118,6 +114,3 @@ index 6a2caba19ee1d..1289d311efd70 100644 break; default: --- -2.43.0 - diff --git a/queue-5.10/series b/queue-5.10/series index 99083db7b5e..d7d0c36722a 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -368,3 +368,8 @@ spi-s3c64xx-fix-timeout-counters-in-flush_fifo.patch selftests-breakpoints-use-remaining-time-to-check-if.patch selftests-vdso-fix-vdso-symbols-lookup-for-powerpc64.patch selftests-mm-fix-charge_reserved_hugetlb.sh-test.patch +i2c-stm32f7-do-not-prepare-unprepare-clock-during-runtime-suspend-resume.patch +i2c-qcom-geni-use-irqf_no_autoen-flag-in-request_irq.patch +i2c-xiic-wait-for-tx-empty-to-avoid-missed-tx-naks.patch +firmware-tegra-bpmp-drop-unused-mbox_client_to_bpmp.patch +spi-bcm63xx-fix-module-autoloading.patch diff --git a/queue-5.10/spi-bcm63xx-fix-module-autoloading.patch b/queue-5.10/spi-bcm63xx-fix-module-autoloading.patch new file mode 100644 index 00000000000..b9faa57ab8a --- /dev/null +++ b/queue-5.10/spi-bcm63xx-fix-module-autoloading.patch @@ -0,0 +1,33 @@ +From 909f34f2462a99bf876f64c5c61c653213e32fce Mon Sep 17 00:00:00 2001 +From: Jinjie Ruan +Date: Mon, 19 Aug 2024 20:33:48 +0800 +Subject: spi: bcm63xx: Fix module autoloading + +From: Jinjie Ruan + +commit 909f34f2462a99bf876f64c5c61c653213e32fce upstream. + +Add MODULE_DEVICE_TABLE(), so modules could be properly autoloaded +based on the alias from platform_device_id table. + +Fixes: 44d8fb30941d ("spi/bcm63xx: move register definitions into the driver") +Cc: stable@vger.kernel.org +Signed-off-by: Jinjie Ruan +Reviewed-by: Jonas Gorski +Link: https://patch.msgid.link/20240819123349.4020472-2-ruanjinjie@huawei.com +Signed-off-by: Mark Brown +Signed-off-by: Greg Kroah-Hartman +--- + drivers/spi/spi-bcm63xx.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/spi/spi-bcm63xx.c ++++ b/drivers/spi/spi-bcm63xx.c +@@ -476,6 +476,7 @@ static const struct platform_device_id b + { + }, + }; ++MODULE_DEVICE_TABLE(platform, bcm63xx_spi_dev_match); + + static const struct of_device_id bcm63xx_spi_of_match[] = { + { .compatible = "brcm,bcm6348-spi", .data = &bcm6348_spi_reg_offsets }, -- 2.47.3