diff mbox series

[2/4] i2c: rcar: optimize cacheline to minimize HW race condition

Message ID 20201223172154.34462-3-wsa+renesas@sang-engineering.com (mailing list archive)
State Accepted
Delegated to: Geert Uytterhoeven
Headers show
Series i2c: rcar: handle Gen2 and Gen3 V3U quirks better | expand

Commit Message

Wolfram Sang Dec. 23, 2020, 5:21 p.m. UTC
'flags' and 'io' are needed first, so they should be at the beginning of
the private struct.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/i2c/busses/i2c-rcar.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Geert Uytterhoeven Dec. 28, 2020, 12:52 p.m. UTC | #1
Hi Wolfram,

On Wed, Dec 23, 2020 at 6:22 PM Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
> 'flags' and 'io' are needed first, so they should be at the beginning of
> the private struct.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

> --- a/drivers/i2c/busses/i2c-rcar.c
> +++ b/drivers/i2c/busses/i2c-rcar.c
> @@ -119,6 +119,7 @@ enum rcar_i2c_type {
>  };
>
>  struct rcar_i2c_priv {
> +       u32 flags;

Note that this adds a hole on 64-bit.

But if this really can make a difference, IMHO it is still broken

>         void __iomem *io;
>         struct i2c_adapter adap;
>         struct i2c_msg *msg;

Gr{oetje,eeting}s,

                        Geert
Wolfram Sang Dec. 28, 2020, 12:55 p.m. UTC | #2
> But if this really can make a difference, IMHO it is still broken

It *is* broken on Gen2, no way around that. We can only minimze the race
best as we can.
Wolfram Sang Jan. 5, 2021, 3:35 p.m. UTC | #3
On Wed, Dec 23, 2020 at 06:21:52PM +0100, Wolfram Sang wrote:
> 'flags' and 'io' are needed first, so they should be at the beginning of
> the private struct.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Applied to for-next, thanks!
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
index 824586d7ee56..ad6630e3cc77 100644
--- a/drivers/i2c/busses/i2c-rcar.c
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -119,6 +119,7 @@  enum rcar_i2c_type {
 };
 
 struct rcar_i2c_priv {
+	u32 flags;
 	void __iomem *io;
 	struct i2c_adapter adap;
 	struct i2c_msg *msg;
@@ -129,7 +130,6 @@  struct rcar_i2c_priv {
 
 	int pos;
 	u32 icccr;
-	u32 flags;
 	u8 recovery_icmcr;	/* protected by adapter lock */
 	enum rcar_i2c_type devtype;
 	struct i2c_client *slave;