Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp363220lqh; Tue, 7 May 2024 01:04:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWB08QKLCV1iWdFUo4SiiqGr2mS8uSeA1Lzoji8iUDYtBiRipEEWzupTK9OGfXHFwmEmamDxUPjqvyyowEtnoKHKeZ7W348CxfTtfJkow== X-Google-Smtp-Source: AGHT+IFngdM9b+IzhJHEIM9iwxiTBLS7hO9F7lKpX2aJsdimvlEbIhrLT5OJBGyKerOZN8k6tHYQ X-Received: by 2002:a17:906:5a72:b0:a59:9c13:9bac with SMTP id my50-20020a1709065a7200b00a599c139bacmr6138708ejc.69.1715069085484; Tue, 07 May 2024 01:04:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715069085; cv=pass; d=google.com; s=arc-20160816; b=ko7U0zYRMNd2UPa/s11COvGj27rGE69AYhT4LdyAzpcjaTdzN7d38H4twGWEDW/pM5 +18EpbVDzSVc2jMJ513iwZIND6dfG4fpNj4NBdzhyf2T/+l7RbmcKzjAURmk+MDr1fCk sb2jvwNoX7E4CfUSPQOVwNWROoloLbJoaNVRL8uPkXUa6GuhDFhfWPnzzWroOqE2stiK XTFIyc/4037dAO84rqF1EwFRvOMt0oLC3P86pkPnaUJgvbaSe4WaDxjqUORUyZcuNxgJ 6+0o2xfsAlhG5BhqmljRDhYWfxrNWLLASzRiwKDNg6QGpYTLb7kpYGyhsNx6K1ZLqj8S zxLA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:organization:references :in-reply-to:message-id:subject:cc:to:from:date:dkim-signature; bh=zsjTpPdQhp8xGYXA1tswPY/6gILWdgf1jxKsPkJpD10=; fh=ZwwCWcXvEZbnsjffrOgaxb2NKROPXWYFb3Z62f/zOS8=; b=UNZxYVEJ5z5Fvf4Qsz78PYWnDJCSHCPVQjAIPhEvYcCozWARkOig/UEhThz6v6AtAp Smi6bpuqsz+zj9p+oHY6Quq7ClQEsw7tXNrE6Dqgy1ayMXgyg8Af+VMM/W85swW6lmg9 Yu5mit5tUI+lckIOddHkoSrrOM8UFvzX1ugkXcjfJVECthaTAPxNTi2aA5XRN5UbdmJh Ka2uV64y0jEs3tBvrUbe60gIf1NtplafcajIWGZJPC4kANxRmtJoRv/WM5c914YhRdgp eRuyAq5GENHekxmzMiax9/TDwaULmHKjvOdW3Z8wm0AcYXGe+xPHSagElmkQXX6In++q nQPw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=DBdTuImE; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-170849-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170849-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id nc38-20020a1709071c2600b00a59d2574f43si1974351ejc.912.2024.05.07.01.04.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 01:04:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-170849-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=DBdTuImE; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-170849-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170849-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 3B37F1F2512C for ; Tue, 7 May 2024 08:04:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DFCBB13C825; Tue, 7 May 2024 08:04:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="DBdTuImE" Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) (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 2948313C81C for ; Tue, 7 May 2024 08:04:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.195 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715069070; cv=none; b=QX1WfQIiQCck0cKAf23TfxDe6LhGXpIZjaXHlv+Ih8aFxrxHh4f2ggB2QbjBUkNC+eovEji3Qyh9VI+HLn98J/PBzAgLHWBkIFzWMmQ0uknm9or0Bm737o8bDCp1SBjhfZQdHetlplYDqeh0h0Z5eVS+/PYXKv3mH9TM+8T+V2w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715069070; c=relaxed/simple; bh=0ykBxAOHnnyFYoBMTLFf57HmlIaOOKJXi3ApXDLq7OI=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=bX9AZvELaE5DpXa48gcI2mJ6Z0/ED6Eg0VapT5Cpzy7hBd23jWwiJjuiDPVNx6A19Yf8EBJIYlw8RHwYEG0biwNnEN8aUNBKmrf0EgWLpZlDEZYm1WV3ZA+qRoVD3zt0qd0WXJTqGNAAwEutPyqyiiRCtxiexSzx+e1BE4uTn6s= 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=DBdTuImE; arc=none smtp.client-ip=217.70.183.195 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 Received: by mail.gandi.net (Postfix) with ESMTPSA id DDC2060002; Tue, 7 May 2024 08:04:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1715069065; 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=zsjTpPdQhp8xGYXA1tswPY/6gILWdgf1jxKsPkJpD10=; b=DBdTuImErvsqqyGScDzRjFP6Ovas2ZBQNaI3ew3vfdC+96+QHodwGpMNmeBcjkuS8qn+cb M2ELFwQoWEKVoK/tD2bfRNBtlzQiOMDxjAXfxkqAmtgdy0isoav5SA+rA8pAgv6dvTg6pS ijCrywnACX7Nyj2c0DG9hZQPLp965b8+JbK9BzdMyYvTOqeHFdKcWSDY4HjXrS0qAvIP69 maeaj3TuseAdMJtr9YGK0D0+aEUBisgJ++0osrV46VsRW776IqCjrRUXu+untSJgFGL/Y0 j6K0ui2o+/kLLdBQ/EabG0R/CeoLbcWzY64vuZCETVXIbRZL48IhC3StsbUXog== Date: Tue, 7 May 2024 10:04:24 +0200 From: Miquel Raynal To: Frank Li Cc: alexandre.belloni@bootlin.com, conor.culhane@silvaco.com, imx@lists.linux.dev, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 3/3] i3c: master: svc: fix invalidate IBI type and miss call client IBI handler Message-ID: <20240507100424.611181f1@xps-13> In-Reply-To: <20240506164009.21375-3-Frank.Li@nxp.com> References: <20240506164009.21375-1-Frank.Li@nxp.com> <20240506164009.21375-3-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: linux-kernel@vger.kernel.org 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 Mon, 6 May 2024 12:40:09 -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 > --- >=20 > Notes: > Change from v1 to v2 > - improve comments. >=20 > drivers/i3c/master/svc-i3c-master.c | 16 +++++++++++++--- > 1 file changed, 13 insertions(+), 3 deletions(-) >=20 > diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc= -i3c-master.c > index 94e4954509558..032fe032ec433 100644 > --- a/drivers/i3c/master/svc-i3c-master.c > +++ b/drivers/i3c/master/svc-i3c-master.c > @@ -415,6 +415,19 @@ static void svc_i3c_master_ibi_work(struct work_stru= ct *work) > int ret; > =20 > mutex_lock(&master->lock); > + /* > + * IBIWON may be set before SVC_I3C_MCTRL_REQUEST_AUTO_IBI, causing > + * readl_relaxed_poll_timeout() to return immediately. Consequently, > + * ibitype will be 0 since it was last updated only after the 8th SCL > + * cycle, leading to missed client IBI handlers. > + * > + * A typical scenario is when IBIWON occurs and bus arbitration is lost > + * at svc_i3c_master_priv_xfers(). > + * > + * Clear SVC_I3C_MINT_IBIWON before sending SVC_I3C_MCTRL_REQUEST_AUTO_= IBI. > + */ Thanks a lot. Reviewed-by: Miquel Raynal Thanks, Miqu=C3=A8l