From 09ab41cc7fc51a4f6b3694843ea12aa0ebba1517 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Mon, 1 Jul 2024 09:16:32 -0400 Subject: [PATCH] Fixes for 5.15 Signed-off-by: Sasha Levin --- ...card-write-requests-while-old-comman.patch | 38 +++++++++++++++++++ ...nit-don-t-erase-registers-after-stop.patch | 38 +++++++++++++++++++ queue-5.15/series | 2 + 3 files changed, 78 insertions(+) create mode 100644 queue-5.15/i2c-testunit-discard-write-requests-while-old-comman.patch create mode 100644 queue-5.15/i2c-testunit-don-t-erase-registers-after-stop.patch diff --git a/queue-5.15/i2c-testunit-discard-write-requests-while-old-comman.patch b/queue-5.15/i2c-testunit-discard-write-requests-while-old-comman.patch new file mode 100644 index 00000000000..2a1a7a0ae9f --- /dev/null +++ b/queue-5.15/i2c-testunit-discard-write-requests-while-old-comman.patch @@ -0,0 +1,38 @@ +From 87bcae8ca8b89f984c6b204597cb1859714af395 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 27 Jun 2024 13:14:48 +0200 +Subject: i2c: testunit: discard write requests while old command is running + +From: Wolfram Sang + +[ Upstream commit c116deafd1a5cc1e9739099eb32114e90623209c ] + +When clearing registers on new write requests was added, the protection +for currently running commands was missed leading to concurrent access +to the testunit registers. Check the flag beforehand. + +Fixes: b39ab96aa894 ("i2c: testunit: add support for block process calls") +Signed-off-by: Wolfram Sang +Reviewed-by: Andi Shyti +Signed-off-by: Sasha Levin +--- + drivers/i2c/i2c-slave-testunit.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/i2c/i2c-slave-testunit.c b/drivers/i2c/i2c-slave-testunit.c +index 1beae30c418b8..cd0d87b089fec 100644 +--- a/drivers/i2c/i2c-slave-testunit.c ++++ b/drivers/i2c/i2c-slave-testunit.c +@@ -121,6 +121,9 @@ static int i2c_slave_testunit_slave_cb(struct i2c_client *client, + break; + + case I2C_SLAVE_WRITE_REQUESTED: ++ if (test_bit(TU_FLAG_IN_PROCESS, &tu->flags)) ++ return -EBUSY; ++ + memset(tu->regs, 0, TU_NUM_REGS); + tu->reg_idx = 0; + break; +-- +2.43.0 + diff --git a/queue-5.15/i2c-testunit-don-t-erase-registers-after-stop.patch b/queue-5.15/i2c-testunit-don-t-erase-registers-after-stop.patch new file mode 100644 index 00000000000..f1bacdfba59 --- /dev/null +++ b/queue-5.15/i2c-testunit-don-t-erase-registers-after-stop.patch @@ -0,0 +1,38 @@ +From f4c4d2a20b8764a05bf2a25639148b27771f6f6e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 27 Jun 2024 13:14:47 +0200 +Subject: i2c: testunit: don't erase registers after STOP + +From: Wolfram Sang + +[ Upstream commit c422b6a630240f706063e0ecbb894aa8491b1fa1 ] + +STOP fallsthrough to WRITE_REQUESTED but this became problematic when +clearing the testunit registers was added to the latter. Actually, there +is no reason to clear the testunit state after STOP. Doing it when a new +WRITE_REQUESTED arrives is enough. So, no need to fallthrough, at all. + +Fixes: b39ab96aa894 ("i2c: testunit: add support for block process calls") +Signed-off-by: Wolfram Sang +Reviewed-by: Andi Shyti +Signed-off-by: Sasha Levin +--- + drivers/i2c/i2c-slave-testunit.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/i2c/i2c-slave-testunit.c b/drivers/i2c/i2c-slave-testunit.c +index 56dae08dfd489..1beae30c418b8 100644 +--- a/drivers/i2c/i2c-slave-testunit.c ++++ b/drivers/i2c/i2c-slave-testunit.c +@@ -118,7 +118,7 @@ static int i2c_slave_testunit_slave_cb(struct i2c_client *client, + queue_delayed_work(system_long_wq, &tu->worker, + msecs_to_jiffies(10 * tu->regs[TU_REG_DELAY])); + } +- fallthrough; ++ break; + + case I2C_SLAVE_WRITE_REQUESTED: + memset(tu->regs, 0, TU_NUM_REGS); +-- +2.43.0 + diff --git a/queue-5.15/series b/queue-5.15/series index fc6cd9b32ab..17e2b1bcff7 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -338,3 +338,5 @@ ocfs2-fix-dio-failure-due-to-insufficient-transaction-credits.patch mmc-sdhci-pci-convert-pcibios_-return-codes-to-errnos.patch mmc-sdhci-do-not-invert-write-protect-twice.patch mmc-sdhci-do-not-lock-spinlock-around-mmc_gpio_get_ro.patch +i2c-testunit-don-t-erase-registers-after-stop.patch +i2c-testunit-discard-write-requests-while-old-comman.patch -- 2.47.3