lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240506105940.5d8d2308@xps-13>
Date: Mon, 6 May 2024 10:59:40 +0200
From: Miquel Raynal <miquel.raynal@...tlin.com>
To: Frank Li <Frank.Li@....com>
Cc: Conor Culhane <conor.culhane@...vaco.com>, Alexandre Belloni
 <alexandre.belloni@...tlin.com>, linux-i3c@...ts.infradead.org (moderated
 list:SILVACO I3C DUAL-ROLE MASTER), linux-kernel@...r.kernel.org (open
 list), imx@...ts.linux.dev
Subject: Re: [PATCH 2/2] i3c: master: svc: fix invalidate IBI type and miss
 call client IBI handler

Hi Frank,

Frank.Li@....com wrote on Wed, 24 Apr 2024 15:00:30 -0400:

> In an In-Band Interrupt (IBI) handle, the code logic is as follows:
> 
> 1: writel(SVC_I3C_MCTRL_REQUEST_AUTO_IBI | SVC_I3C_MCTRL_IBIRESP_AUTO,
> 	  master->regs + SVC_I3C_MCTRL);
> 
> 2: ret = readl_relaxed_poll_timeout(master->regs + SVC_I3C_MSTATUS, val,
>                                     SVC_I3C_MSTATUS_IBIWON(val), 0, 1000);
> 	...
> 3: ibitype = SVC_I3C_MSTATUS_IBITYPE(status);
>    ibiaddr = SVC_I3C_MSTATUS_IBIADDR(status);
> 
> 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.
> 
> 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().
> 
> Clear SVC_I3C_MSTATUS_IBIWON before issue SVC_I3C_MCTRL_REQUEST_AUTO_IBI
> to fix this issue.
> 
> Cc: stable@...r.kernel.org
> Fixes: 5e5e3c92e748 ("i3c: master: svc: fix wrong data return when IBI happen during start frame")
> Signed-off-by: Frank Li <Frank.Li@....com>
> ---
>  drivers/i3c/master/svc-i3c-master.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> 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_struct *work)
>  	int ret;
>  
>  	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_struct *work)
>  		goto reenable_ibis;
>  	}
>  
> -	/* Clear the interrupt status */
> -	writel(SVC_I3C_MINT_IBIWON, master->regs + SVC_I3C_MSTATUS);
> -
>  	status = readl(master->regs + SVC_I3C_MSTATUS);
>  	ibitype = SVC_I3C_MSTATUS_IBITYPE(status);
>  	ibiaddr = SVC_I3C_MSTATUS_IBIADDR(status);

Thanks,
Miquèl

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ