Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4301268ybg; Mon, 21 Oct 2019 06:59:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqyG03LN45TvZ9MwS2AYWbdrzKjf+bvQu3Oj2a8C/5vsbeP6jLa0YMP+TALzHzUGCtjEZ7u0 X-Received: by 2002:a17:906:1342:: with SMTP id x2mr22004162ejb.304.1571666379979; Mon, 21 Oct 2019 06:59:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571666379; cv=none; d=google.com; s=arc-20160816; b=g2KfqhYNdiUa/7eLzeWR32MlYWTjf+OMFz7FD9LCbbNiSPTG8EeEkgGMB6H03KNNX2 i+8JXcubKIG9VXZxF6gD3sTn3shbZYHh7PUZobYSopKYCm1L0XOEUlBdcyrUAvx4EQvd LCh3wzkhdLHtNm3lfbA2IiHaUqK+nUJ6Rg9bS00Z/dvvnm/ZjfWlcgr2Zv/bt8hZzjuM b1CoR6+sw/Z5MN+DH6LbdRJUkbxUnlQh3QPmvfZE2OFNajNiG7+02mzINvneCS44BTxR JvhKULUcRi2TXuKTw1tA5yzLp/0W+H35YXN2HxtD6KTU07Vtu9niVsGfkksJqvqnfzmN me6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=6oGx9qK8Dep0nh8rfvSCUPJlZc3ILxiaJhj7BlxPaec=; b=ygo0VrZ/vNAWrsA3XKEAnn5Gg23jdPw9Z0EVHGh8i9TPvLIxau5ToWrnmvnXZzw0hX oxcEa7TVzRJR4AgYA9UhTk11/H41C46uwhN7RD+QUFWCmEI3EmfpmdAZ1za3s/dGA2xt bStH3vnqZbOV/FB8sfSxo1w78TQ6Cxp0xSgK4yh5cUlEGmJKf8NY7hZLbp5m7NKAM+IH Vxud/qKyqNP4OWqIuko14e15NuHD7qaS6M5OCGgjFOWjMJ1M7jcaivWZyVj1sF17pBl7 FwAXgp2fP15+cLcAlXRy9o2Rs7NELXIT5HVk8sCUAJB4hsdHpoA0989KmemMAW2FqAau I9sg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c25si1076412ejm.241.2019.10.21.06.59.16; Mon, 21 Oct 2019 06:59:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729123AbfJUN7N (ORCPT + 99 others); Mon, 21 Oct 2019 09:59:13 -0400 Received: from sauhun.de ([88.99.104.3]:47850 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728551AbfJUN7M (ORCPT ); Mon, 21 Oct 2019 09:59:12 -0400 Received: from localhost (p54B33572.dip0.t-ipconnect.de [84.179.53.114]) by pokefinder.org (Postfix) with ESMTPSA id C76372C0076; Mon, 21 Oct 2019 15:59:10 +0200 (CEST) Date: Mon, 21 Oct 2019 15:59:10 +0200 From: Wolfram Sang To: Fabrice Gasnier Cc: pierre-yves.mordret@st.com, alain.volmat@st.com, alexandre.torgue@st.com, linux-i2c@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] i2c: i2c-stm32f7: fix a race in slave mode with arbitration loss irq Message-ID: <20191021135910.GA26782@ninjato> References: <1569919869-3218-1-git-send-email-fabrice.gasnier@st.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="+HP7ph2BbKc20aGI" Content-Disposition: inline In-Reply-To: <1569919869-3218-1-git-send-email-fabrice.gasnier@st.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --+HP7ph2BbKc20aGI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Oct 01, 2019 at 10:51:09AM +0200, Fabrice Gasnier wrote: > When in slave mode, an arbitration loss (ARLO) may be detected before the > slave had a chance to detect the stop condition (STOPF in ISR). > This is seen when two master + slave adapters switch their roles. It > provokes the i2c bus to be stuck, busy as SCL line is stretched. > - the I2C_SLAVE_STOP event is never generated due to STOPF flag is set but > don't generate an irq (race with ARLO irq, STOPIE is masked). STOPF flag > remains set until next master xfer (e.g. when STOPIE irq get unmasked). > In this case, completion is generated too early: immediately upon new > transfer request (then it doesn't send all data). > - Some data get stuck in TXDR register. As a consequence, the controller > stretches the SCL line: the bus gets busy until a future master transfer > triggers the bus busy / recovery mechanism (this can take time... and > may never happen at all) >=20 > So choice is to let the STOPF being detected by the slave isr handler, > to properly handle this stop condition. E.g. don't mask IRQs in error > handler, when the slave is running. >=20 > Fixes: 60d609f30de2 ("i2c: i2c-stm32f7: Add slave support") >=20 > Signed-off-by: Fabrice Gasnier Applied to for-current, thanks! --+HP7ph2BbKc20aGI Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEOZGx6rniZ1Gk92RdFA3kzBSgKbYFAl2tuaoACgkQFA3kzBSg KbY98A/+L5w+rU+ZlnLyPHs8O2CoyNVWD0XjDnXAYbAwpuCKQBjMjaTmom8/ucQM JU86jNaLS9KM3yL8bhXnPiuXit/DXnq484npH49uK+GTVFK7pnVNu/QhBuLJzXPO xvO4glb1xpFoNHAA7o16T4EQvK5YfZFmdxcbqPVxNfNOyxIHxwBkb5ZQHQwdVNvq 8izptQqmRWwm6DUQj5Cnbd3DOghf73SBMarADbzZOIJn2yIKNInWJTw18WY+sj8T ayrS0KbcITMSbiArT5on/5Vwv0tM5uPYKilQPUR81YDSpZTidmXRblR04h5MS3or j41iqKTldQ1xCBG/V9Z1unE4d3CWtBzGQD55UlBlzkvlV+kFsN8EjkW2Ow4HCIG9 Xn1NbcBvhidymJe94yGgu+YhUVmj5web+EjqLwZoodofg4fxZXRDWHYE8WMUdB9R aYv6JERZJq0TSdr1kfGa2lB1FCzMAvtlyH+nnRQsskYHoVWgco5j/VSHfxnQog8+ O3Doke9VfMtAyOyYmKdogBD5jeO/iZJGLjE/LVC/jnPYVNI0psVD5ifeT1WZprqU 5JnzBK5JVMZxFrP20nT6ZBdGWFi9YygUHF7tichu6LAk+lCZddE9g9rHghVwMlwN /RjlN9Ada2ceFOp3MzL2R4WORf1WZgAPSjrU2Tpz7CRuy0K4r3M= =Kfp4 -----END PGP SIGNATURE----- --+HP7ph2BbKc20aGI--