From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6D8AB1420B9 for ; Mon, 6 May 2024 08:59:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714985986; cv=none; b=RwzL4jbPMHzfQESmbBQWZlyFaoQVcb5ltwcLlBa5ujE+UKsR6NpAwNdg+IcqC45JFTuRrWqZHSgabepdYVAUSKRlUxvjtIpQO1QZkqzRNWJgOiatEBVH/AaOOReqo00cmG8wcqQE7u7Qh8/Vy6hSaaOEyglVdKeBmRAz8AbzPBE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714985986; c=relaxed/simple; bh=zI9aKrE6NiMa73k6e2lcD5sd2ANI0ztCC+XSoAVmyY0=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gK+rrsv2D8ii6ooYuC7ftnZKK7S2iBDWFrwqrs6AngIgrQNLTJankTlO+WWiAiUbc5yt1sDRs2xxE4tGR32NSdaHfMVQ+beuaBV9/XmpuB+PFiOhXoIXQAJxPb+4q3ybFr1iozyeGl5f5K/S51SYZitThgnHp47Z1PeBRJ9sxA4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=PDKE8Egb; arc=none smtp.client-ip=217.70.183.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="PDKE8Egb" Received: by mail.gandi.net (Postfix) with ESMTPSA id 119A61BF204; Mon, 6 May 2024 08:59:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1714985981; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xLoumWwq12QqlpvmyZ6oFlX+y9BSSofQN7u2jFCOtaU=; b=PDKE8EgbLksMFP97qVMtx6poecdit3R82OTJQweQ2bJqnbujyZk+/pcORyzyP1UUWMRlbq 05Y1ZDNkYGMsz5OUnU+ODdIo4ZCDxwIvOZZ778OwJHHC3vfiVftnyUm7wEcZ81yRR8eIxe mPlvhQPNe7r+xTt0d2y/uO0G/Thdl77yA4J1GouPLtIFG5qxszkA9/GPXxlXEFWEofqGiT Uaa3D/EXUhelQLkNKZP/rDPmbyGtb+WL07+yLSVKMxlVC7U9silYUf+4CGTESXUnueIT6u W0CXbThvRLGP48xY4/qXuGTZ7Ro7vbqSKPF+oZBiqpHGMageYRumhGNp960MPQ== Date: Mon, 6 May 2024 10:59:40 +0200 From: Miquel Raynal To: Frank Li Cc: Conor Culhane , Alexandre Belloni , linux-i3c@lists.infradead.org (moderated list:SILVACO I3C DUAL-ROLE MASTER), linux-kernel@vger.kernel.org (open list), imx@lists.linux.dev Subject: Re: [PATCH 2/2] i3c: master: svc: fix invalidate IBI type and miss call client IBI handler Message-ID: <20240506105940.5d8d2308@xps-13> In-Reply-To: <20240424190030.857632-2-Frank.Li@nxp.com> References: <20240424190030.857632-1-Frank.Li@nxp.com> <20240424190030.857632-2-Frank.Li@nxp.com> Organization: Bootlin X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-GND-Sasl: miquel.raynal@bootlin.com Hi Frank, Frank.Li@nxp.com wrote on Wed, 24 Apr 2024 15:00:30 -0400: > In an In-Band Interrupt (IBI) handle, the code logic is as follows: >=20 > 1: writel(SVC_I3C_MCTRL_REQUEST_AUTO_IBI | SVC_I3C_MCTRL_IBIRESP_AUTO, > master->regs + SVC_I3C_MCTRL); >=20 > 2: ret =3D readl_relaxed_poll_timeout(master->regs + SVC_I3C_MSTATUS, val, > SVC_I3C_MSTATUS_IBIWON(val), 0, 1000); > ... > 3: ibitype =3D SVC_I3C_MSTATUS_IBITYPE(status); > ibiaddr =3D SVC_I3C_MSTATUS_IBIADDR(status); >=20 > SVC_I3C_MSTATUS_IBIWON may be set before step 1. Thus, step 2 will return > immediately, and the I3C controller has not sent out the 9th SCL yet. > Consequently, ibitype and ibiaddr are 0, resulting in an unknown IBI type > occurrence and missing call I3C client driver's IBI handler. >=20 > A typical case is that SVC_I3C_MSTATUS_IBIWON is set when an IBI occurs > during the controller send start frame in svc_i3c_master_xfer(). >=20 > Clear SVC_I3C_MSTATUS_IBIWON before issue SVC_I3C_MCTRL_REQUEST_AUTO_IBI > to fix this issue. >=20 > Cc: stable@vger.kernel.org > Fixes: 5e5e3c92e748 ("i3c: master: svc: fix wrong data return when IBI ha= ppen during start frame") > Signed-off-by: Frank Li > --- > drivers/i3c/master/svc-i3c-master.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) >=20 > diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc= -i3c-master.c > index a2298ab460a37..3bfe8e694f840 100644 > --- a/drivers/i3c/master/svc-i3c-master.c > +++ b/drivers/i3c/master/svc-i3c-master.c > @@ -415,6 +415,9 @@ static void svc_i3c_master_ibi_work(struct work_struc= t *work) > int ret; > =20 > mutex_lock(&master->lock); > + /* Clear the interrupt status */ Could you improve the comment to explain why this is needed here? Otherwise seems okay, but I don't have any strong feelings here. > + writel(SVC_I3C_MINT_IBIWON, master->regs + SVC_I3C_MSTATUS); > + > /* Acknowledge the incoming interrupt with the AUTOIBI mechanism */ > writel(SVC_I3C_MCTRL_REQUEST_AUTO_IBI | > SVC_I3C_MCTRL_IBIRESP_AUTO, > @@ -429,9 +432,6 @@ static void svc_i3c_master_ibi_work(struct work_struc= t *work) > goto reenable_ibis; > } > =20 > - /* Clear the interrupt status */ > - writel(SVC_I3C_MINT_IBIWON, master->regs + SVC_I3C_MSTATUS); > - > status =3D readl(master->regs + SVC_I3C_MSTATUS); > ibitype =3D SVC_I3C_MSTATUS_IBITYPE(status); > ibiaddr =3D SVC_I3C_MSTATUS_IBIADDR(status); Thanks, Miqu=C3=A8l