<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-stable.git/drivers/i2c, branch v6.7</title>
<subtitle>Linux kernel stable tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/'/>
<entry>
<title>i2c: core: Fix atomic xfer check for non-preempt config</title>
<updated>2024-01-06T13:10:10+00:00</updated>
<author>
<name>Benjamin Bara</name>
<email>benjamin.bara@skidata.com</email>
</author>
<published>2024-01-04T08:17:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=a3368e1186e3ce8e38f78cbca019622095b1f331'/>
<id>a3368e1186e3ce8e38f78cbca019622095b1f331</id>
<content type='text'>
Since commit aa49c90894d0 ("i2c: core: Run atomic i2c xfer when
!preemptible"), the whole reboot/power off sequence on non-preempt kernels
is using atomic i2c xfer, as !preemptible() always results to 1.

During device_shutdown(), the i2c might be used a lot and not all busses
have implemented an atomic xfer handler. This results in a lot of
avoidable noise, like:

[   12.687169] No atomic I2C transfer handler for 'i2c-0'
[   12.692313] WARNING: CPU: 6 PID: 275 at drivers/i2c/i2c-core.h:40 i2c_smbus_xfer+0x100/0x118
...

Fix this by allowing non-atomic xfer when the interrupts are enabled, as
it was before.

Link: https://lore.kernel.org/r/20231222230106.73f030a5@yea
Link: https://lore.kernel.org/r/20240102150350.3180741-1-mwalle@kernel.org
Link: https://lore.kernel.org/linux-i2c/13271b9b-4132-46ef-abf8-2c311967bb46@mailbox.org/
Fixes: aa49c90894d0 ("i2c: core: Run atomic i2c xfer when !preemptible")
Cc: stable@vger.kernel.org # v5.2+
Signed-off-by: Benjamin Bara &lt;benjamin.bara@skidata.com&gt;
Tested-by: Michael Walle &lt;mwalle@kernel.org&gt;
Tested-by: Tor Vic &lt;torvic9@mailbox.org&gt;
[wsa: removed a comment which needs more work, code is ok]
Signed-off-by: Wolfram Sang &lt;wsa@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Since commit aa49c90894d0 ("i2c: core: Run atomic i2c xfer when
!preemptible"), the whole reboot/power off sequence on non-preempt kernels
is using atomic i2c xfer, as !preemptible() always results to 1.

During device_shutdown(), the i2c might be used a lot and not all busses
have implemented an atomic xfer handler. This results in a lot of
avoidable noise, like:

[   12.687169] No atomic I2C transfer handler for 'i2c-0'
[   12.692313] WARNING: CPU: 6 PID: 275 at drivers/i2c/i2c-core.h:40 i2c_smbus_xfer+0x100/0x118
...

Fix this by allowing non-atomic xfer when the interrupts are enabled, as
it was before.

Link: https://lore.kernel.org/r/20231222230106.73f030a5@yea
Link: https://lore.kernel.org/r/20240102150350.3180741-1-mwalle@kernel.org
Link: https://lore.kernel.org/linux-i2c/13271b9b-4132-46ef-abf8-2c311967bb46@mailbox.org/
Fixes: aa49c90894d0 ("i2c: core: Run atomic i2c xfer when !preemptible")
Cc: stable@vger.kernel.org # v5.2+
Signed-off-by: Benjamin Bara &lt;benjamin.bara@skidata.com&gt;
Tested-by: Michael Walle &lt;mwalle@kernel.org&gt;
Tested-by: Tor Vic &lt;torvic9@mailbox.org&gt;
[wsa: removed a comment which needs more work, code is ok]
Signed-off-by: Wolfram Sang &lt;wsa@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>i2c: aspeed: Handle the coalesced stop conditions with the start conditions.</title>
<updated>2023-12-19T20:54:57+00:00</updated>
<author>
<name>Quan Nguyen</name>
<email>quan@os.amperecomputing.com</email>
</author>
<published>2023-12-11T10:22:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=b4cc1cbba5195a4dd497cf2f8f09e7807977d543'/>
<id>b4cc1cbba5195a4dd497cf2f8f09e7807977d543</id>
<content type='text'>
Some masters may drive the transfers with low enough latency between
the nak/stop phase of the current command and the start/address phase
of the following command that the interrupts are coalesced by the
time we process them.
Handle the stop conditions before processing SLAVE_MATCH to fix the
complaints that sometimes occur below.

"aspeed-i2c-bus 1e78a040.i2c-bus: irq handled != irq. Expected
0x00000086, but was 0x00000084"

Fixes: f9eb91350bb2 ("i2c: aspeed: added slave support for Aspeed I2C driver")
Signed-off-by: Quan Nguyen &lt;quan@os.amperecomputing.com&gt;
Reviewed-by: Andrew Jeffery &lt;andrew@codeconstruct.com.au&gt;
Reviewed-by: Andi Shyti &lt;andi.shyti@kernel.org&gt;
Signed-off-by: Wolfram Sang &lt;wsa@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Some masters may drive the transfers with low enough latency between
the nak/stop phase of the current command and the start/address phase
of the following command that the interrupts are coalesced by the
time we process them.
Handle the stop conditions before processing SLAVE_MATCH to fix the
complaints that sometimes occur below.

"aspeed-i2c-bus 1e78a040.i2c-bus: irq handled != irq. Expected
0x00000086, but was 0x00000084"

Fixes: f9eb91350bb2 ("i2c: aspeed: added slave support for Aspeed I2C driver")
Signed-off-by: Quan Nguyen &lt;quan@os.amperecomputing.com&gt;
Reviewed-by: Andrew Jeffery &lt;andrew@codeconstruct.com.au&gt;
Reviewed-by: Andi Shyti &lt;andi.shyti@kernel.org&gt;
Signed-off-by: Wolfram Sang &lt;wsa@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>i2c: rk3x: fix potential spinlock recursion on poll</title>
<updated>2023-12-19T17:23:01+00:00</updated>
<author>
<name>Jensen Huang</name>
<email>jensenhuang@friendlyarm.com</email>
</author>
<published>2023-12-07T08:21:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=19cde9c92b8d3b7ee555d0da3bcb0232d3a784f4'/>
<id>19cde9c92b8d3b7ee555d0da3bcb0232d3a784f4</id>
<content type='text'>
Possible deadlock scenario (on reboot):
rk3x_i2c_xfer_common(polling)
    -&gt; rk3x_i2c_wait_xfer_poll()
        -&gt; rk3x_i2c_irq(0, i2c);
            --&gt; spin_lock(&amp;i2c-&gt;lock);
            ...
        &lt;rk3x i2c interrupt&gt;
        -&gt; rk3x_i2c_irq(0, i2c);
            --&gt; spin_lock(&amp;i2c-&gt;lock); (deadlock here)

Store the IRQ number and disable/enable it around the polling transfer.
This patch has been tested on NanoPC-T4.

Signed-off-by: Jensen Huang &lt;jensenhuang@friendlyarm.com&gt;
Reviewed-by: Heiko Stuebner &lt;heiko@sntech.de&gt;
Reviewed-by: Andi Shyti &lt;andi.shyti@kernel.org&gt;
Signed-off-by: Wolfram Sang &lt;wsa@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Possible deadlock scenario (on reboot):
rk3x_i2c_xfer_common(polling)
    -&gt; rk3x_i2c_wait_xfer_poll()
        -&gt; rk3x_i2c_irq(0, i2c);
            --&gt; spin_lock(&amp;i2c-&gt;lock);
            ...
        &lt;rk3x i2c interrupt&gt;
        -&gt; rk3x_i2c_irq(0, i2c);
            --&gt; spin_lock(&amp;i2c-&gt;lock); (deadlock here)

Store the IRQ number and disable/enable it around the polling transfer.
This patch has been tested on NanoPC-T4.

Signed-off-by: Jensen Huang &lt;jensenhuang@friendlyarm.com&gt;
Reviewed-by: Heiko Stuebner &lt;heiko@sntech.de&gt;
Reviewed-by: Andi Shyti &lt;andi.shyti@kernel.org&gt;
Signed-off-by: Wolfram Sang &lt;wsa@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>i2c: qcom-geni: fix missing clk_disable_unprepare() and geni_se_resources_off()</title>
<updated>2023-12-19T17:14:17+00:00</updated>
<author>
<name>Yang Yingliang</name>
<email>yangyingliang@huawei.com</email>
</author>
<published>2023-11-30T01:43:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=043465b66506e8c647cdd38a2db1f2ee0f369a1b'/>
<id>043465b66506e8c647cdd38a2db1f2ee0f369a1b</id>
<content type='text'>
Add missing clk_disable_unprepare() and geni_se_resources_off() in the error
path in geni_i2c_probe().

Fixes: 14d02fbadb5d ("i2c: qcom-geni: add desc struct to prepare support for I2C Master Hub variant")
Signed-off-by: Yang Yingliang &lt;yangyingliang@huawei.com&gt;
Reviewed-by: Andi Shyti &lt;andi.shyti@kernel.org&gt;
Signed-off-by: Wolfram Sang &lt;wsa@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add missing clk_disable_unprepare() and geni_se_resources_off() in the error
path in geni_i2c_probe().

Fixes: 14d02fbadb5d ("i2c: qcom-geni: add desc struct to prepare support for I2C Master Hub variant")
Signed-off-by: Yang Yingliang &lt;yangyingliang@huawei.com&gt;
Reviewed-by: Andi Shyti &lt;andi.shyti@kernel.org&gt;
Signed-off-by: Wolfram Sang &lt;wsa@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>i2c: ocores: Move system PM hooks to the NOIRQ phase</title>
<updated>2023-11-13T17:43:42+00:00</updated>
<author>
<name>Samuel Holland</name>
<email>samuel.holland@sifive.com</email>
</author>
<published>2023-11-13T02:32:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=382561d16854a747e6df71034da08d20d6013dfe'/>
<id>382561d16854a747e6df71034da08d20d6013dfe</id>
<content type='text'>
When an I2C device contains a wake IRQ subordinate to a regmap-irq chip,
the regmap-irq code must be able to perform I2C transactions during
suspend_device_irqs() and resume_device_irqs(). Therefore, the bus must
be suspended/resumed during the NOIRQ phase.

Signed-off-by: Samuel Holland &lt;samuel.holland@sifive.com&gt;
Acked-by: Peter Korsgaard &lt;peter@korsgaard.com&gt;
Reviewed-by: Andi Shyti &lt;andi.shyti@kernel.org&gt;
Signed-off-by: Wolfram Sang &lt;wsa@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When an I2C device contains a wake IRQ subordinate to a regmap-irq chip,
the regmap-irq code must be able to perform I2C transactions during
suspend_device_irqs() and resume_device_irqs(). Therefore, the bus must
be suspended/resumed during the NOIRQ phase.

Signed-off-by: Samuel Holland &lt;samuel.holland@sifive.com&gt;
Acked-by: Peter Korsgaard &lt;peter@korsgaard.com&gt;
Reviewed-by: Andi Shyti &lt;andi.shyti@kernel.org&gt;
Signed-off-by: Wolfram Sang &lt;wsa@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>i2c: designware: Fix corrupted memory seen in the ISR</title>
<updated>2023-11-13T09:51:14+00:00</updated>
<author>
<name>Jan Bottorff</name>
<email>janb@os.amperecomputing.com</email>
</author>
<published>2023-11-09T03:19:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=f726eaa787e9f9bc858c902d18a09af6bcbfcdaf'/>
<id>f726eaa787e9f9bc858c902d18a09af6bcbfcdaf</id>
<content type='text'>
When running on a many core ARM64 server, errors were
happening in the ISR that looked like corrupted memory. These
corruptions would fix themselves if small delays were inserted
in the ISR. Errors reported by the driver included "i2c_designware
APMC0D0F:00: i2c_dw_xfer_msg: invalid target address" and
"i2c_designware APMC0D0F:00:controller timed out" during
in-band IPMI SSIF stress tests.

The problem was determined to be memory writes in the driver were not
becoming visible to all cores when execution rapidly shifted between
cores, like when a register write immediately triggers an ISR.
Processors with weak memory ordering, like ARM64, make no
guarantees about the order normal memory writes become globally
visible, unless barrier instructions are used to control ordering.

To solve this, regmap accessor functions configured by this driver
were changed to use non-relaxed forms of the low-level register
access functions, which include a barrier on platforms that require
it. This assures memory writes before a controller register access are
visible to all cores. The community concluded defaulting to correct
operation outweighed defaulting to the small performance gains from
using relaxed access functions. Being a low speed device added weight to
this choice of default register access behavior.

Signed-off-by: Jan Bottorff &lt;janb@os.amperecomputing.com&gt;
Acked-by: Jarkko Nikula &lt;jarkko.nikula@linux.intel.com&gt;
Tested-by: Serge Semin &lt;fancer.lancer@gmail.com&gt;
Reviewed-by: Serge Semin &lt;fancer.lancer@gmail.com&gt;
Signed-off-by: Wolfram Sang &lt;wsa@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When running on a many core ARM64 server, errors were
happening in the ISR that looked like corrupted memory. These
corruptions would fix themselves if small delays were inserted
in the ISR. Errors reported by the driver included "i2c_designware
APMC0D0F:00: i2c_dw_xfer_msg: invalid target address" and
"i2c_designware APMC0D0F:00:controller timed out" during
in-band IPMI SSIF stress tests.

The problem was determined to be memory writes in the driver were not
becoming visible to all cores when execution rapidly shifted between
cores, like when a register write immediately triggers an ISR.
Processors with weak memory ordering, like ARM64, make no
guarantees about the order normal memory writes become globally
visible, unless barrier instructions are used to control ordering.

To solve this, regmap accessor functions configured by this driver
were changed to use non-relaxed forms of the low-level register
access functions, which include a barrier on platforms that require
it. This assures memory writes before a controller register access are
visible to all cores. The community concluded defaulting to correct
operation outweighed defaulting to the small performance gains from
using relaxed access functions. Being a low speed device added weight to
this choice of default register access behavior.

Signed-off-by: Jan Bottorff &lt;janb@os.amperecomputing.com&gt;
Acked-by: Jarkko Nikula &lt;jarkko.nikula@linux.intel.com&gt;
Tested-by: Serge Semin &lt;fancer.lancer@gmail.com&gt;
Reviewed-by: Serge Semin &lt;fancer.lancer@gmail.com&gt;
Signed-off-by: Wolfram Sang &lt;wsa@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "i2c: pxa: move to generic GPIO recovery"</title>
<updated>2023-11-13T01:52:29+00:00</updated>
<author>
<name>Robert Marko</name>
<email>robert.marko@sartura.hr</email>
</author>
<published>2023-11-10T09:30:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=7b211c7671212cad0b83603c674838c7e824d845'/>
<id>7b211c7671212cad0b83603c674838c7e824d845</id>
<content type='text'>
This reverts commit 0b01392c18b9993a584f36ace1d61118772ad0ca.

Conversion of PXA to generic I2C recovery, makes the I2C bus completely
lock up if recovery pinctrl is present in the DT and I2C recovery is
enabled.

So, until the generic I2C recovery can also work with PXA lets revert
to have working I2C and I2C recovery again.

Signed-off-by: Robert Marko &lt;robert.marko@sartura.hr&gt;
Cc: stable@vger.kernel.org # 5.11+
Acked-by: Andi Shyti &lt;andi.shyti@kernel.org&gt;
Acked-by: Russell King (Oracle) &lt;rmk+kernel@armlinux.org.uk&gt;
Acked-by: Linus Walleij &lt;linus.walleij@linaro.org&gt;
Signed-off-by: Wolfram Sang &lt;wsa@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reverts commit 0b01392c18b9993a584f36ace1d61118772ad0ca.

Conversion of PXA to generic I2C recovery, makes the I2C bus completely
lock up if recovery pinctrl is present in the DT and I2C recovery is
enabled.

So, until the generic I2C recovery can also work with PXA lets revert
to have working I2C and I2C recovery again.

Signed-off-by: Robert Marko &lt;robert.marko@sartura.hr&gt;
Cc: stable@vger.kernel.org # 5.11+
Acked-by: Andi Shyti &lt;andi.shyti@kernel.org&gt;
Acked-by: Russell King (Oracle) &lt;rmk+kernel@armlinux.org.uk&gt;
Acked-by: Linus Walleij &lt;linus.walleij@linaro.org&gt;
Signed-off-by: Wolfram Sang &lt;wsa@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>i2c: cp2615: Fix 'assignment to __be16' warning</title>
<updated>2023-11-08T09:27:17+00:00</updated>
<author>
<name>Bence Csókás</name>
<email>bence98@sch.bme.hu</email>
</author>
<published>2023-10-30T17:19:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=bdba49cbba41f0bea54fc93529bbef4d6ceaa3cd'/>
<id>bdba49cbba41f0bea54fc93529bbef4d6ceaa3cd</id>
<content type='text'>
While the preamble field _is_ technically big-endian, its value is always 0x2A2A,
which is the same in either endianness. However, to avoid generating a warning,
we should still call `htons()` explicitly.

Signed-off-by: Bence Csókás &lt;bence98@sch.bme.hu&gt;
Signed-off-by: Wolfram Sang &lt;wsa@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
While the preamble field _is_ technically big-endian, its value is always 0x2A2A,
which is the same in either endianness. However, to avoid generating a warning,
we should still call `htons()` explicitly.

Signed-off-by: Bence Csókás &lt;bence98@sch.bme.hu&gt;
Signed-off-by: Wolfram Sang &lt;wsa@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>i2c: dev: copy userspace array safely</title>
<updated>2023-11-08T09:26:27+00:00</updated>
<author>
<name>Philipp Stanner</name>
<email>pstanner@redhat.com</email>
</author>
<published>2023-11-02T19:26:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=cc9c54232f04aef3a5d7f64a0ece7df00f1aaa3d'/>
<id>cc9c54232f04aef3a5d7f64a0ece7df00f1aaa3d</id>
<content type='text'>
i2c-dev.c utilizes memdup_user() to copy a userspace array. This is done
without an overflow check.

Use the new wrapper memdup_array_user() to copy the array more safely.

Suggested-by: Dave Airlie &lt;airlied@redhat.com&gt;
Signed-off-by: Philipp Stanner &lt;pstanner@redhat.com&gt;
Signed-off-by: Wolfram Sang &lt;wsa@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
i2c-dev.c utilizes memdup_user() to copy a userspace array. This is done
without an overflow check.

Use the new wrapper memdup_array_user() to copy the array more safely.

Suggested-by: Dave Airlie &lt;airlied@redhat.com&gt;
Signed-off-by: Philipp Stanner &lt;pstanner@redhat.com&gt;
Signed-off-by: Wolfram Sang &lt;wsa@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>i2c: designware: Disable TX_EMPTY irq while waiting for block length byte</title>
<updated>2023-11-08T09:19:48+00:00</updated>
<author>
<name>Tam Nguyen</name>
<email>tamnguyenchi@os.amperecomputing.com</email>
</author>
<published>2023-11-02T03:30:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=e8183fa10c25c7b3c20670bf2b430ddcc1ee03c0'/>
<id>e8183fa10c25c7b3c20670bf2b430ddcc1ee03c0</id>
<content type='text'>
During SMBus block data read process, we have seen high interrupt rate
because of TX_EMPTY irq status while waiting for block length byte (the
first data byte after the address phase). The interrupt handler does not
do anything because the internal state is kept as STATUS_WRITE_IN_PROGRESS.
Hence, we should disable TX_EMPTY IRQ until I2C DesignWare receives
first data byte from I2C device, then re-enable it to resume SMBus
transaction.

It takes 0.789 ms for host to receive data length from slave.
Without the patch, i2c_dw_isr() is called 99 times by TX_EMPTY interrupt.
And it is none after applying the patch.

Cc: stable@vger.kernel.org
Co-developed-by: Chuong Tran &lt;chuong@os.amperecomputing.com&gt;
Signed-off-by: Chuong Tran &lt;chuong@os.amperecomputing.com&gt;
Signed-off-by: Tam Nguyen &lt;tamnguyenchi@os.amperecomputing.com&gt;
Acked-by: Jarkko Nikula &lt;jarkko.nikula@linux.intel.com&gt;
Reviewed-by: Serge Semin &lt;fancer.lancer@gmail.com&gt;
Signed-off-by: Wolfram Sang &lt;wsa@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
During SMBus block data read process, we have seen high interrupt rate
because of TX_EMPTY irq status while waiting for block length byte (the
first data byte after the address phase). The interrupt handler does not
do anything because the internal state is kept as STATUS_WRITE_IN_PROGRESS.
Hence, we should disable TX_EMPTY IRQ until I2C DesignWare receives
first data byte from I2C device, then re-enable it to resume SMBus
transaction.

It takes 0.789 ms for host to receive data length from slave.
Without the patch, i2c_dw_isr() is called 99 times by TX_EMPTY interrupt.
And it is none after applying the patch.

Cc: stable@vger.kernel.org
Co-developed-by: Chuong Tran &lt;chuong@os.amperecomputing.com&gt;
Signed-off-by: Chuong Tran &lt;chuong@os.amperecomputing.com&gt;
Signed-off-by: Tam Nguyen &lt;tamnguyenchi@os.amperecomputing.com&gt;
Acked-by: Jarkko Nikula &lt;jarkko.nikula@linux.intel.com&gt;
Reviewed-by: Serge Semin &lt;fancer.lancer@gmail.com&gt;
Signed-off-by: Wolfram Sang &lt;wsa@kernel.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
