linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: linux-i2c@vger.kernel.org
Cc: Marek Vasut <marex@denx.de>,
	Michal Simek <michal.simek@xilinx.com>,
	Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>,
	Wolfram Sang <wsa@kernel.org>
Subject: [PATCH v2 0/6] i2c: xiic: Fix broken locking
Date: Mon, 23 Aug 2021 23:41:39 +0200	[thread overview]
Message-ID: <20210823214145.295104-1-marex@denx.de> (raw)

Booting ZynqMP with XIIC I2C driver shows multitude of race conditions
in the XIIC driver. This is because locking is completely missing from
the driver, and there are odd corner cases where the hardware behaves
strangely.

Most of these races could be triggered easily when booting on SMP
machines, like the ZynqMP which has up to 4 cores. It is sufficient
for the interrupt handler to run on another core than xiic_start_xfer
and the driver fails completely.

This does not add support for long transfers, this only fixes the
driver to be usable at all instead of being completely broken.

The V2 fixes a few remaining details which cropped up in deployment
over the last year or so, so I believe the result should be reasonably
well tested.

Marek Vasut (6):
  i2c: xiic: Fix broken locking on tx_msg
  i2c: xiic: Drop broken interrupt handler
  i2c: xiic: Defer xiic_wakeup() and __xiic_start_xfer() in
    xiic_process()
  i2c: xiic: Switch from waitqueue to completion
  i2c: xiic: Only ever transfer single message
  i2c: xiic: Fix RX IRQ busy check

 drivers/i2c/busses/i2c-xiic.c | 161 +++++++++++++++-------------------
 1 file changed, 69 insertions(+), 92 deletions(-)

Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Cc: Wolfram Sang <wsa@kernel.org>

-- 
2.32.0


             reply	other threads:[~2021-08-23 21:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-23 21:41 Marek Vasut [this message]
2021-08-23 21:41 ` [PATCH v2 1/6] i2c: xiic: Fix broken locking on tx_msg Marek Vasut
2021-08-23 21:41 ` [PATCH v2 2/6] i2c: xiic: Drop broken interrupt handler Marek Vasut
2021-08-23 21:41 ` [PATCH v2 3/6] i2c: xiic: Defer xiic_wakeup() and __xiic_start_xfer() in xiic_process() Marek Vasut
2021-08-23 21:41 ` [PATCH v2 4/6] i2c: xiic: Switch from waitqueue to completion Marek Vasut
2021-08-23 21:41 ` [PATCH v2 5/6] i2c: xiic: Only ever transfer single message Marek Vasut
2021-08-23 21:41 ` [PATCH v2 6/6] i2c: xiic: Fix RX IRQ busy check Marek Vasut
2021-08-24  6:58 ` [PATCH v2 0/6] i2c: xiic: Fix broken locking Michal Simek
2021-08-27  8:31   ` Raviteja Narayanam
2021-08-27  8:34     ` Michal Simek
2021-09-14 10:29 ` Wolfram Sang
2021-09-14 11:54   ` Michal Simek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210823214145.295104-1-marex@denx.de \
    --to=marex@denx.de \
    --cc=linux-i2c@vger.kernel.org \
    --cc=michal.simek@xilinx.com \
    --cc=shubhrajyoti.datta@xilinx.com \
    --cc=wsa@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).