* [PATCH 0/2] i2c: testunit: regression fixes
@ 2024-06-27 11:14 Wolfram Sang
2024-06-27 11:14 ` [PATCH 1/2] i2c: testunit: don't erase registers after STOP Wolfram Sang
2024-06-27 11:14 ` [PATCH 2/2] i2c: testunit: discard write requests while old command is running Wolfram Sang
0 siblings, 2 replies; 7+ messages in thread
From: Wolfram Sang @ 2024-06-27 11:14 UTC (permalink / raw)
To: linux-renesas-soc; +Cc: Wolfram Sang, linux-i2c, linux-kernel
My bad, when adding SMBUS_PROC_CALL support to the testunit, I didn't
check the old commands :( Consequently, two regressions were introduced
which get fixed by this series.
Wolfram Sang (2):
i2c: testunit: don't erase registers after STOP
i2c: testunit: discard write requests while old command is running
drivers/i2c/i2c-slave-testunit.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
--
2.43.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] i2c: testunit: don't erase registers after STOP
2024-06-27 11:14 [PATCH 0/2] i2c: testunit: regression fixes Wolfram Sang
@ 2024-06-27 11:14 ` Wolfram Sang
2024-06-27 15:15 ` Andi Shyti
2024-06-28 18:40 ` Wolfram Sang
2024-06-27 11:14 ` [PATCH 2/2] i2c: testunit: discard write requests while old command is running Wolfram Sang
1 sibling, 2 replies; 7+ messages in thread
From: Wolfram Sang @ 2024-06-27 11:14 UTC (permalink / raw)
To: linux-renesas-soc; +Cc: Wolfram Sang, linux-i2c, linux-kernel
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 <wsa+renesas@sang-engineering.com>
---
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 a49642bbae4b..a5dcbc3c2c14 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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] i2c: testunit: discard write requests while old command is running
2024-06-27 11:14 [PATCH 0/2] i2c: testunit: regression fixes Wolfram Sang
2024-06-27 11:14 ` [PATCH 1/2] i2c: testunit: don't erase registers after STOP Wolfram Sang
@ 2024-06-27 11:14 ` Wolfram Sang
2024-06-27 15:21 ` Andi Shyti
2024-06-28 18:42 ` Wolfram Sang
1 sibling, 2 replies; 7+ messages in thread
From: Wolfram Sang @ 2024-06-27 11:14 UTC (permalink / raw)
To: linux-renesas-soc; +Cc: Wolfram Sang, linux-i2c, linux-kernel
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 <wsa+renesas@sang-engineering.com>
---
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 a5dcbc3c2c14..ca43e98cae1b 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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] i2c: testunit: don't erase registers after STOP
2024-06-27 11:14 ` [PATCH 1/2] i2c: testunit: don't erase registers after STOP Wolfram Sang
@ 2024-06-27 15:15 ` Andi Shyti
2024-06-28 18:40 ` Wolfram Sang
1 sibling, 0 replies; 7+ messages in thread
From: Andi Shyti @ 2024-06-27 15:15 UTC (permalink / raw)
To: Wolfram Sang; +Cc: linux-renesas-soc, linux-i2c, linux-kernel
On Thu, Jun 27, 2024 at 01:14:47PM GMT, Wolfram Sang wrote:
> 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 <wsa+renesas@sang-engineering.com>
Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
Thanks,
Andi
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] i2c: testunit: discard write requests while old command is running
2024-06-27 11:14 ` [PATCH 2/2] i2c: testunit: discard write requests while old command is running Wolfram Sang
@ 2024-06-27 15:21 ` Andi Shyti
2024-06-28 18:42 ` Wolfram Sang
1 sibling, 0 replies; 7+ messages in thread
From: Andi Shyti @ 2024-06-27 15:21 UTC (permalink / raw)
To: Wolfram Sang; +Cc: linux-renesas-soc, linux-i2c, linux-kernel
Hi Wolfram,
On Thu, Jun 27, 2024 at 01:14:48PM GMT, Wolfram Sang wrote:
> 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 <wsa+renesas@sang-engineering.com>
Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
Thanks,
Andi
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] i2c: testunit: don't erase registers after STOP
2024-06-27 11:14 ` [PATCH 1/2] i2c: testunit: don't erase registers after STOP Wolfram Sang
2024-06-27 15:15 ` Andi Shyti
@ 2024-06-28 18:40 ` Wolfram Sang
1 sibling, 0 replies; 7+ messages in thread
From: Wolfram Sang @ 2024-06-28 18:40 UTC (permalink / raw)
To: linux-renesas-soc; +Cc: linux-i2c, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 547 bytes --]
On Thu, Jun 27, 2024 at 01:14:47PM +0200, Wolfram Sang wrote:
> 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 <wsa+renesas@sang-engineering.com>
Applied to for-current, thanks!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] i2c: testunit: discard write requests while old command is running
2024-06-27 11:14 ` [PATCH 2/2] i2c: testunit: discard write requests while old command is running Wolfram Sang
2024-06-27 15:21 ` Andi Shyti
@ 2024-06-28 18:42 ` Wolfram Sang
1 sibling, 0 replies; 7+ messages in thread
From: Wolfram Sang @ 2024-06-28 18:42 UTC (permalink / raw)
To: linux-renesas-soc; +Cc: linux-i2c, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 454 bytes --]
On Thu, Jun 27, 2024 at 01:14:48PM +0200, Wolfram Sang wrote:
> 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 <wsa+renesas@sang-engineering.com>
Applied to for-current, thanks!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-06-28 18:42 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-27 11:14 [PATCH 0/2] i2c: testunit: regression fixes Wolfram Sang
2024-06-27 11:14 ` [PATCH 1/2] i2c: testunit: don't erase registers after STOP Wolfram Sang
2024-06-27 15:15 ` Andi Shyti
2024-06-28 18:40 ` Wolfram Sang
2024-06-27 11:14 ` [PATCH 2/2] i2c: testunit: discard write requests while old command is running Wolfram Sang
2024-06-27 15:21 ` Andi Shyti
2024-06-28 18:42 ` Wolfram Sang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).