Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4552105rdb; Tue, 12 Dec 2023 02:56:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IGp7KOkVlZLxBLBB0JjpPSWgS7p4ySLudFWnnjFw7aAw1bqJLYC6XwRIcjkuZei+aZe4UP6 X-Received: by 2002:a05:6a20:748f:b0:18f:97c:5b87 with SMTP id p15-20020a056a20748f00b0018f097c5b87mr2885672pzd.85.1702378567381; Tue, 12 Dec 2023 02:56:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702378567; cv=none; d=google.com; s=arc-20160816; b=hBDhYPSfUKN2KdlKOcgUzvM44U4M038AwwJRkSWaarnSGxtvCtflpdGGKribuwu5Wf tu5h6BFw4MIF0J9tbskXmFKluneaByWkdl5oRNZ2M8naH6l9jRsne/HQ4AZovOhEHt8A zbfScOfXwIqbEQFpt5pBE2VOOTJZxYO+IiSuc71IsjoTzqumf/OGiS0ZMjXJ7bYtoT13 GzCN0u7nZ8y/m85yNq8NUlF7oPnhF9Nz93q4mFKjRgGH1Iv7IYbkUu1y2M/rlEOj7zwb yX64K5LsRRyHM8ADXQk7quKia5NlcsGZLwZZLI8l/+jjyIUpHQ6/XgYCDUsfY7f3w0vJ ExMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=bScNdgNv6YXsrptwEeKrxreKyYys5leCiEspcf0W9HU=; fh=b5XI/UdZHB0tCWtUM+GUdFc6LaVa/7YT0PZs+d2VxCo=; b=V1ls0qSzJr3FyWpD6s84Df06PyuL06Wfx/fxaLMSnJJwySmlvPywKmXjkm2UAP2iOb KDXzvphEEr45Hkn/2tPsYS67Iebuc+eFtub8FvOufepx2plD6I5OxKDjPTjo0pCy0p9f mwJNNUrjQ3ypD0y5VwDbxoS3dXjNHza/nP2ofFzKDu+GYR0HNUTld7w5g2HkhJO7IFTL D3ZZ5lFWxu53RzIhur0TlUnL+PakHn5tGuUIPUa9clTTtCNeK2BIfUjPVNJUXJNCgltq DQ/EByX8/w6UEPEB9GJy8DqAYN38I5RvFbyf6qA63xACRbjsFPk2lpf8G92VvQGmvvPy 8FBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yCMaqZg7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id y18-20020a1709027c9200b001d04b44859esi7477164pll.269.2023.12.12.02.56.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 02:56:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yCMaqZg7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 50A9A8098FD5; Tue, 12 Dec 2023 02:56:04 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231899AbjLLKzP (ORCPT + 99 others); Tue, 12 Dec 2023 05:55:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231866AbjLLKzO (ORCPT ); Tue, 12 Dec 2023 05:55:14 -0500 Received: from mail-ot1-x329.google.com (mail-ot1-x329.google.com [IPv6:2607:f8b0:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 905FCE3 for ; Tue, 12 Dec 2023 02:55:18 -0800 (PST) Received: by mail-ot1-x329.google.com with SMTP id 46e09a7af769-6d9ac148ca3so3858247a34.0 for ; Tue, 12 Dec 2023 02:55:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1702378518; x=1702983318; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=bScNdgNv6YXsrptwEeKrxreKyYys5leCiEspcf0W9HU=; b=yCMaqZg78GCKiv2BiZNz2c7bXBRqLsOYPZNlkjoqOioKUQ3xcz9WeudsSFWLPX+xRu nAipTBPnig0dtXG0PdLhxd9FkY3yxB8YahGpgAECeh0jvM72JAXdKaBckp0rmVAN8LzZ m0WewqCld+IMb824Quf0QYQdTO5VUZdv5IzzqQ5LgJ8v+74OKmdfXclCJPA8xU0W9vA3 cjenGuFZ7QRUKwnYnLRMyx8HZsMGHz+35Qd/n2aldZfFXuD4a/RqowVirvTRA00ANubH Ictsg/BF+C5u0kmMX2EWZmSlR66T4Ihd+BcoJDFaMWum3NHw5/cWNLasDeCvz+U3t/DV lAmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702378518; x=1702983318; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=bScNdgNv6YXsrptwEeKrxreKyYys5leCiEspcf0W9HU=; b=wQK7UTAN/zwjqz1vIkk2TMfBUnJG8FDyaDSBi8hRFQK40LpBdF6qvWhDt5jK7u2JLX 6p0f1dkJYOMA0++3G7PE4Vur5xoElfBh4RMKi83yCSM7VjoqfiCzOHjQOhRb56Babku/ UjtOiL5/FOhoYmPv1GgYCI57QiDmbHbhkzpUrSsCInqiHW0pNb9/sGvculyBH7jyzbLm O0eSR+N5+UhTmxs3GyQFFc94+ZP0nYoeFl1PVZVMY5/3fZCCuEROeg+AAb3Eriy0utIe N4WEZwglZhRpOM74H5/04PyKjEHv7D4IIeo9T0cN+f+ahc6GTVoQ2TlfC+Vum3dlx6V9 pE/Q== X-Gm-Message-State: AOJu0YxopQSFnbp7/RmQs7gegv+2Y+Zn2+516y5QIoGEz9hjijSlMFjx 5ee5gwiG3ySOAt48dRXNiPB+dKaHXAMhtnmEvvE= X-Received: by 2002:a05:6830:344c:b0:6d9:da4b:4dd0 with SMTP id b12-20020a056830344c00b006d9da4b4dd0mr5628197otu.0.1702378517877; Tue, 12 Dec 2023 02:55:17 -0800 (PST) Received: from localhost ([122.172.82.6]) by smtp.gmail.com with ESMTPSA id du6-20020a056a002b4600b006ce97bd5d04sm8139985pfb.140.2023.12.12.02.55.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 02:55:17 -0800 (PST) Date: Tue, 12 Dec 2023 16:25:15 +0530 From: Viresh Kumar To: "xiaowu.ding" Cc: Tushar.Khandelwal@arm.com, jassisinghbrar@gmail.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mailbox: arm_mhuv2: Fix a bug for mhuv2_sender_interrupt Message-ID: <20231212105515.hldboytb5ibpqaia@vireshk-i7> References: <20231212093147.773-1-xiaowu.ding@jaguarmicro.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231212093147.773-1-xiaowu.ding@jaguarmicro.com> X-Spam-Status: No, score=4.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLACK autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: **** X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 12 Dec 2023 02:56:04 -0800 (PST) On 12-12-23, 17:31, xiaowu.ding wrote: > From: "Xiaowu.ding" > > Message Handling Unit version is v2.1. > > When arm_mhuv2 working with the data protocol transfer mode. > We have split one mhu into two channels, and every channel > include four channel windows, the two channels share > one gic spi interrupt. > > There is a problem with the sending scenario. > > The first channel will take up 0-3 channel windows, and the second > channel take up 4-7 channel windows. When the first channel send the > data, and the receiver will clear all the four channels status. > Although we only enabled the interrupt on the last channel window with > register CH_INT_EN,the register CHCOMB_INT_ST0 will be 0xf, not be 0x8. > Currently we just clear the last channel windows int status with the > data proctol mode.So after that,the CHCOMB_INT_ST0 status will be 0x7, > not be the 0x0. > > Then the second channel send the data, the receiver read the > data, clear all the four channel windows status, trigger the sender > interrupt. But currently the CHCOMB_INT_ST0 register will be 0xf7, > get_irq_chan_comb function will always return the first channel. > > So this patch clear all channel windows int status to avoid this interrupt > confusion. > Fixes: 5a6338cce9f4 ("mailbox: arm_mhuv2: Add driver") > Signed-off-by: Xiaowu.ding > --- > drivers/mailbox/arm_mhuv2.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/mailbox/arm_mhuv2.c b/drivers/mailbox/arm_mhuv2.c > index c1ef5016f..9191c5b69 100644 > --- a/drivers/mailbox/arm_mhuv2.c > +++ b/drivers/mailbox/arm_mhuv2.c > @@ -542,7 +542,7 @@ static irqreturn_t mhuv2_sender_interrupt(int irq, void *data) > struct mhuv2_mbox_chan_priv *priv; > struct mbox_chan *chan; > unsigned long flags; > - int i, found = 0; > + int i, j, found = 0; Please reuse the variable 'i' here. > u32 stat; > > chan = get_irq_chan_comb(mhu, mhu->send->chcomb_int_st); > @@ -553,7 +553,8 @@ static irqreturn_t mhuv2_sender_interrupt(int irq, void *data) > priv = chan->con_priv; > > if (!IS_PROTOCOL_DOORBELL(priv)) { > - writel_relaxed(1, &mhu->send->ch_wn[priv->ch_wn_idx + priv->windows - 1].int_clr); I vaguely remember that only the last bit was required to be set to clear interrupt for all the channels but I must be wrong, now that you are reporting a bug here :) > + for (j = 0; j < priv->windows; j++) > + writel_relaxed(1, &mhu->send->ch_wn[priv->ch_wn_idx + j].int_clr); > > if (chan->cl) { > mbox_chan_txdone(chan, 0); -- viresh