[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <da400d3e-a357-1ae8-cb92-728cc4974b67@kalrayinc.com>
Date: Tue, 19 Sep 2023 14:38:22 +0200
From: Yann Sionneau <ysionneau@...rayinc.com>
To: Wolfram Sang <wsa@...nel.org>,
Catalin Marinas <catalin.marinas@....com>,
Jan Bottorff <janb@...amperecomputing.com>,
Serge Semin <fancer.lancer@...il.com>,
Yann Sionneau <yann@...nneau.net>,
Will Deacon <will@...nel.org>,
Jarkko Nikula <jarkko.nikula@...ux.intel.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Mika Westerberg <mika.westerberg@...ux.intel.com>,
Jan Dabros <jsd@...ihalf.com>,
Andi Shyti <andi.shyti@...nel.org>,
Philipp Zabel <p.zabel@...gutronix.de>,
linux-i2c@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] i2c: designware: Fix corrupted memory seen in the
ISR
Hi,
On 9/19/23 12:19, Wolfram Sang wrote:
>> I also agree that a wmb() in the i2c driver is not the more elegant fix.
>> For similar reasons, we hid barriers in the write*() macros, drivers
>> need to stay architecture-agnostic as much as possible.
> Exactly my thinking. I wanted to read this patch discussion later this
> week. But from glimpsing at it so far, I already wondered why there
> isn't a memory barrier in the final accessor to the register.
The regmap accessors used by the designware driver end up calling
writel_relaxed() and readl_relaxed() :
https://elixir.bootlin.com/linux/v6.6-rc2/source/drivers/i2c/busses/i2c-designware-common.c#L71
Those usually end up just being volatile accesses, making some kind of
compiler barrier preventing the memory mapped register accesses to be
moved/removed/merged.
I kind of think it's OK. It starts not being OK when you want some
ordering between those and some memory accesses in DDR like the problem
discussed here.
In those cases I would say the smp_* barriers are what we are supposed
to use, isn't it?
Regards,
--
Yann
Powered by blists - more mailing lists