From: Jan Glauber <hidden> Date: 2016-11-14 18:51:37
Hi Wolfram,
Since time is running out for 4.9 (or might have already if you're not
going to send another pull request) I'm going for the safe option
to fix the Octeon i2c problems, which is:
1. Reverting the readq_poll_timeout patch since it is broken
2. Apply Patch #2 from Paul
3. Add a small fix for the recovery that makes Paul's patch
work on ThunderX
I'll try to come up with a better solution for 4.10. My plan is to get rid
of the polling-around-interrupt thing completely, but for that we need more
time to make it work on Octeon.
Please consider for 4.9.
thanks,
Jan
------------
Jan Glauber (2):
Revert "i2c: octeon: thunderx: Limit register access retries"
i2c: octeon: thunderx: TWSI software reset in recovery
Paul Burton (1):
i2c: octeon: Fix waiting for operation completion
drivers/i2c/busses/i2c-octeon-core.c | 66 +++++++++++-------------------------
drivers/i2c/busses/i2c-octeon-core.h | 27 ++++++---------
2 files changed, 30 insertions(+), 63 deletions(-)
--
1.9.1
From: Jan Glauber <hidden> Date: 2016-11-14 18:52:23
From: Paul Burton <redacted>
Commit 1bb1ff3e7c74 ("i2c: octeon: Improve performance if interrupt is
early") modified octeon_i2c_wait() & octeon_i2c_hlc_wait() to attempt to
check for a valid bit being clear & if not to sleep for a while then try
again before waiting on a waitqueue which may time out. However it does
so by sleeping within a function called as the condition provided to
wait_event_timeout() which seems to cause strange behaviour, with the
system hanging during boot with the condition being checked constantly &
the timeout not seeming to have any effect.
Fix this by instead checking for the valid bit being clear in the
octeon_i2c(_hlc)_wait() functions & sleeping there if that condition is
not met, then calling the wait_event_timeout with a condition that does
not sleep.
Tested on a Rhino Labs UTM-8 with Octeon CN7130.
Signed-off-by: Paul Burton <redacted>
Signed-off-by: Jan Glauber <redacted>
Cc: David Daney <redacted>
Cc: Jan Glauber <redacted>
[jglauber@cavium.com: removed unused variable]
Cc: Peter Swain <redacted>
Cc: Wolfram Sang <redacted>
Cc: linux-i2c@vger.kernel.org
---
drivers/i2c/busses/i2c-octeon-core.c | 59 +++++++++---------------------------
1 file changed, 15 insertions(+), 44 deletions(-)
@@ -80,8 +61,13 @@ static int octeon_i2c_wait(struct octeon_i2c *i2c)}i2c->int_enable(i2c);-time_left=wait_event_timeout(i2c->queue,octeon_i2c_test_ready(i2c,&first),-i2c->adap.timeout);+time_left=i2c->adap.timeout;+if(!octeon_i2c_test_iflg(i2c)){+usleep_range(I2C_OCTEON_EVENT_WAIT,2*I2C_OCTEON_EVENT_WAIT);+time_left=wait_event_timeout(i2c->queue,+octeon_i2c_test_iflg(i2c),+time_left);+}i2c->int_disable(i2c);if(i2c->broken_irq_check&&!time_left&&
@@ -99,26 +85,8 @@ static int octeon_i2c_wait(struct octeon_i2c *i2c)staticboolocteon_i2c_hlc_test_valid(structocteon_i2c*i2c){-return(__raw_readq(i2c->twsi_base+SW_TWSI(i2c))&SW_TWSI_V)==0;-}--staticboolocteon_i2c_hlc_test_ready(structocteon_i2c*i2c,bool*first)-{/* check if valid bit is cleared */-if(octeon_i2c_hlc_test_valid(i2c))-returntrue;--if(*first){-*first=false;-returnfalse;-}--/*-*IRQhassignaledaneventbutvalidbitisn'tcleared.-*Sleepandretryonce.-*/-usleep_range(I2C_OCTEON_EVENT_WAIT,2*I2C_OCTEON_EVENT_WAIT);-returnocteon_i2c_hlc_test_valid(i2c);+return(__raw_readq(i2c->twsi_base+SW_TWSI(i2c))&SW_TWSI_V)==0;}staticvoidocteon_i2c_hlc_int_clear(structocteon_i2c*i2c)
From: Jan Glauber <hidden> Date: 2016-11-14 18:52:44
I've seen i2c recovery reporting long loops of:
[ 1035.887818] i2c i2c-4: SCL is stuck low, exit recovery
[ 1037.999748] i2c i2c-4: SCL is stuck low, exit recovery
[ 1040.111694] i2c i2c-4: SCL is stuck low, exit recovery
...
Add a TWSI software reset which clears the status and
STA,STP,IFLG in SW_TWSI_EOP_TWSI_CTL.
With this the recovery works fine and above message is not seen.
Signed-off-by: Jan Glauber <redacted>
---
drivers/i2c/busses/i2c-octeon-core.c | 3 +++
1 file changed, 3 insertions(+)
From: Steven J. Hill <hidden> Date: 2016-11-14 19:54:05
On 11/14/2016 12:50 PM, Jan Glauber wrote:
Since time is running out for 4.9 (or might have already if you're not
going to send another pull request) I'm going for the safe option
to fix the Octeon i2c problems, which is:
1. Reverting the readq_poll_timeout patch since it is broken
2. Apply Patch #2 from Paul
3. Add a small fix for the recovery that makes Paul's patch
work on ThunderX
I'll try to come up with a better solution for 4.10. My plan is to get rid
of the polling-around-interrupt thing completely, but for that we need more
time to make it work on Octeon.
Please consider for 4.9.
Hey Jan.
This does not work on Octeon 71xx platforms. I will look at it more
closely tomorrow.
Steve
From: Jan Glauber <hidden> Date: 2016-11-15 13:03:45
On Mon, Nov 14, 2016 at 01:53:40PM -0600, Steven J. Hill wrote:
On 11/14/2016 12:50 PM, Jan Glauber wrote:
quoted
Since time is running out for 4.9 (or might have already if you're not
going to send another pull request) I'm going for the safe option
to fix the Octeon i2c problems, which is:
1. Reverting the readq_poll_timeout patch since it is broken
2. Apply Patch #2 from Paul
3. Add a small fix for the recovery that makes Paul's patch
work on ThunderX
I'll try to come up with a better solution for 4.10. My plan is to get rid
of the polling-around-interrupt thing completely, but for that we need more
time to make it work on Octeon.
Please consider for 4.9.
Hey Jan.
This does not work on Octeon 71xx platforms. I will look at it more
closely tomorrow.
Paul, can you confirm this? It doesn't make sense for me, since patches #1
and #3 are unlikely to break anything... And patch #2 worked for you.
--Jan
From: Paul Burton <hidden> Date: 2016-11-16 10:39:15
Hi Jan,
On Tuesday, 15 November 2016 14:03:15 GMT Jan Glauber wrote:
On Mon, Nov 14, 2016 at 01:53:40PM -0600, Steven J. Hill wrote:
quoted
On 11/14/2016 12:50 PM, Jan Glauber wrote:
quoted
Since time is running out for 4.9 (or might have already if you're not
going to send another pull request) I'm going for the safe option
to fix the Octeon i2c problems, which is:
1. Reverting the readq_poll_timeout patch since it is broken
2. Apply Patch #2 from Paul
3. Add a small fix for the recovery that makes Paul's patch
work on ThunderX
I'll try to come up with a better solution for 4.10. My plan is to get
rid
of the polling-around-interrupt thing completely, but for that we need
more
time to make it work on Octeon.
Please consider for 4.9.
Hey Jan.
This does not work on Octeon 71xx platforms. I will look at it more
closely tomorrow.
Paul, can you confirm this? It doesn't make sense for me, since patches #1
and #3 are unlikely to break anything... And patch #2 worked for you.
For me v4.9-rc5 plus these 3 patches boots fine on a Rhino Labs UTM8 system
which previously hung whilst probing the I2C driver & devices. Feel free to
add:
Tested-by: Paul Burton [off-list ref]
Thanks,
Paul
From: Wolfram Sang <hidden> Date: 2016-11-22 12:01:13
On Mon, Nov 14, 2016 at 01:53:40PM -0600, Steven J. Hill wrote:
On 11/14/2016 12:50 PM, Jan Glauber wrote:
quoted
Since time is running out for 4.9 (or might have already if you're not
going to send another pull request) I'm going for the safe option
to fix the Octeon i2c problems, which is:
1. Reverting the readq_poll_timeout patch since it is broken
2. Apply Patch #2 from Paul
3. Add a small fix for the recovery that makes Paul's patch
work on ThunderX
I'll try to come up with a better solution for 4.10. My plan is to get rid
of the polling-around-interrupt thing completely, but for that we need more
time to make it work on Octeon.
Please consider for 4.9.
Hey Jan.
This does not work on Octeon 71xx platforms. I will look at it more
closely tomorrow.
What's the outcome here? It seems we want a bugfix for 4.9 but this
report keeps me reluctant to apply the series.
From: Jan Glauber <hidden> Date: 2016-11-22 14:56:08
On Tue, Nov 22, 2016 at 01:01:06PM +0100, Wolfram Sang wrote:
On Mon, Nov 14, 2016 at 01:53:40PM -0600, Steven J. Hill wrote:
quoted
On 11/14/2016 12:50 PM, Jan Glauber wrote:
quoted
Since time is running out for 4.9 (or might have already if you're not
going to send another pull request) I'm going for the safe option
to fix the Octeon i2c problems, which is:
1. Reverting the readq_poll_timeout patch since it is broken
2. Apply Patch #2 from Paul
3. Add a small fix for the recovery that makes Paul's patch
work on ThunderX
I'll try to come up with a better solution for 4.10. My plan is to get rid
of the polling-around-interrupt thing completely, but for that we need more
time to make it work on Octeon.
Please consider for 4.9.
Hey Jan.
This does not work on Octeon 71xx platforms. I will look at it more
closely tomorrow.
What's the outcome here? It seems we want a bugfix for 4.9 but this
report keeps me reluctant to apply the series.
Steven, did you have a chance to check which of the patches makes
Octeon 71xx fail?
--Jan
From: Wolfram Sang <hidden> Date: 2016-11-28 14:22:15
quoted
quoted
This does not work on Octeon 71xx platforms. I will look at it more
closely tomorrow.
What's the outcome here? It seems we want a bugfix for 4.9 but this
report keeps me reluctant to apply the series.
Steven, did you have a chance to check which of the patches makes
Octeon 71xx fail?
How do we proceed with this one? Is somebody at Cavium able to contact
Steven internally? I mentioned this on-going regression to Linus and
said an rc8 would help us, but reading LWN it seems we shouldn't count
on it...
From: Steven J. Hill <hidden> Date: 2016-11-28 14:47:50
On 11/28/2016 08:22 AM, Wolfram Sang wrote:
quoted
quoted
quoted
This does not work on Octeon 71xx platforms. I will look at it more
closely tomorrow.
What's the outcome here? It seems we want a bugfix for 4.9 but this
report keeps me reluctant to apply the series.
Steven, did you have a chance to check which of the patches makes
Octeon 71xx fail?
How do we proceed with this one? Is somebody at Cavium able to contact
Steven internally? I mentioned this on-going regression to Linus and
said an rc8 would help us, but reading LWN it seems we shouldn't count
on it...
I will finish the bisecting today and will let you know as soon as
the bug is found.
Steve
From: Jan Glauber <hidden> Date: 2016-11-29 09:19:56
On Mon, Nov 28, 2016 at 03:22:08PM +0100, Wolfram Sang wrote:
quoted
quoted
quoted
This does not work on Octeon 71xx platforms. I will look at it more
closely tomorrow.
What's the outcome here? It seems we want a bugfix for 4.9 but this
report keeps me reluctant to apply the series.
Steven, did you have a chance to check which of the patches makes
Octeon 71xx fail?
How do we proceed with this one? Is somebody at Cavium able to contact
Steven internally? I mentioned this on-going regression to Linus and
said an rc8 would help us, but reading LWN it seems we shouldn't count
on it...
Hi Wolfram,
if possible we should at least revert commit 70121f7f3725. I should get
access to an Octeon 71xx board tomorrow, but I'm afraid we'll miss the
deadline for a well tested fix that works across all machines.
--Jan
From: Steven J. Hill <hidden> Date: 2016-11-29 18:22:54
On 11/29/2016 03:19 AM, Jan Glauber wrote:
if possible we should at least revert commit 70121f7f3725. I should get
access to an Octeon 71xx board tomorrow, but I'm afraid we'll miss the
deadline for a well tested fix that works across all machines.
I second Jan's advice. Please revert the commit and we'll have the
fix for the next release.
From: Wolfram Sang <hidden> Date: 2016-11-29 18:37:14
On Tue, Nov 29, 2016 at 12:22:34PM -0600, Steven J. Hill wrote:
On 11/29/2016 03:19 AM, Jan Glauber wrote:
quoted
if possible we should at least revert commit 70121f7f3725. I should get
access to an Octeon 71xx board tomorrow, but I'm afraid we'll miss the
deadline for a well tested fix that works across all machines.
I second Jan's advice. Please revert the commit and we'll have the
fix for the next release.
Okay, I will pick up patch 1/3 from Jan (the revert) and read your
comment above as an ack. Paul, is your tested-by still valid?
Thanks,
Wolfram
From: Wolfram Sang <hidden> Date: 2016-11-29 19:14:50
On Tue, Nov 29, 2016 at 01:10:30PM -0600, Steven J. Hill wrote:
On 11/29/2016 12:37 PM, Wolfram Sang wrote:
quoted
Okay, I will pick up patch 1/3 from Jan (the revert) and read your
comment above as an ack. Paul, is your tested-by still valid?
Just to be explicitly clear, the patch revert allows I2C on OCTEON
to work again. I apologize if that was not clear.
Partly. It was not clear to me if only patch 1 was enough to get Paul's
system to boot again or if it needed all 3 patches to do that.
Anyway, the revert will be in v4.9 for sure.