From patchwork Wed Oct 9 08:07:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongxing Zhu X-Patchwork-Id: 175599 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp428701ill; Wed, 9 Oct 2019 01:09:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqwd9PmmceAr091fHJ++CbvpuPZ3COwcsCb+XZUImYemVq+haejOnGuO+vn3zKcr2Ev2b4Rm X-Received: by 2002:a50:cc43:: with SMTP id n3mr1778163edi.287.1570608589207; Wed, 09 Oct 2019 01:09:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570608589; cv=none; d=google.com; s=arc-20160816; b=L/dBuQqdsForTxRDsxL93Y/6qc7YEFDPyWEyso+ikafKJQeceWdVx9kXHAlBxsPSK3 nzpfsy19qVg0iR15kGZL2DvMJwB+S+qEVMarpeTqDAH+ySrNuTBr9qFbCl7E/U5ywGNt RGVsN7Eevt4DftQuXP9A+yzVtu3etmNysru6rk6IadBQMYjt65yE8bi19WvIVy5CBwFH lYXLt2DIJnQdxNUSTwu+vk63BtFtjsM0M5nbS1RPVVMeQkt6qcP2gQS/hr4m0mOKD5Q9 5su+ez/7LWqA8P9YflO1XYi9kBJYP9bwIjA3h6gRHLO3xNDdUCEcJmHBSJx9bBCwVmsc h2eQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=nzPNeB5KoLOa6strIWwAnBg3zTjeReR/yOb27Ge5bXI=; b=RCIElgYm4Rla+B7ja+xwhDcYxvvpdIOKY7UB/JiB+swgKeYvwGbiz67lDVdqMumjl3 CQXdyuIgFYFaxZkMCZppGxDpyF+DGB+qNvrUdOc0nWuAk15ELT6MwcwuNKX32rUUzD7O bC36Xn+Z4TGfgCxkOE5sPten7NayEAXpje0UhOi+dQVSkFkdD/BuFaxJdu//S8Y+BSiL DqLjiNV91jNrUGMvJD2r89fqKn0FOtf8N4ygmq2BKYaUlQ2HXIe336DsWUFVJ2ipVMEu jbt8Msywo0C4V2Nxa5CDG6gfxg8saiA9Ne4dCkPBcjzfvHELV870ivxWBObf5K5zYC6l 3xYw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b31si1030627ede.12.2019.10.09.01.09.49; Wed, 09 Oct 2019 01:09:49 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730215AbfJIIJq (ORCPT + 26 others); Wed, 9 Oct 2019 04:09:46 -0400 Received: from inva021.nxp.com ([92.121.34.21]:57852 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730047AbfJIIJo (ORCPT ); Wed, 9 Oct 2019 04:09:44 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 19C21200392; Wed, 9 Oct 2019 10:09:42 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 13F4420036C; Wed, 9 Oct 2019 10:09:38 +0200 (CEST) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id D4610402EC; Wed, 9 Oct 2019 16:09:32 +0800 (SGT) From: Richard Zhu To: jassisinghbrar@gmail.com, o.rempel@pengutronix.de, daniel.baluta@nxp.com, aisheng.dong@nxp.com Cc: linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Richard Zhu Subject: [PATCH v6 1/4] mailbox: imx: Fix Tx doorbell shutdown path Date: Wed, 9 Oct 2019 16:07:18 +0800 Message-Id: <1570608441-29651-2-git-send-email-hongxing.zhu@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1570608441-29651-1-git-send-email-hongxing.zhu@nxp.com> References: <1570608441-29651-1-git-send-email-hongxing.zhu@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Daniel Baluta Tx doorbell is handled by txdb_tasklet and doesn't have an associated IRQ. Anyhow, imx_mu_shutdown ignores this and tries to free an IRQ that wasn't requested for Tx DB resulting in the following warning: [ 1.967644] Trying to free already-free IRQ 26 [ 1.972108] WARNING: CPU: 2 PID: 157 at kernel/irq/manage.c:1708 __free_irq+0xc0/0x358 [ 1.980024] Modules linked in: [ 1.983088] CPU: 2 PID: 157 Comm: kworker/2:1 Tainted: G [ 1.993524] Hardware name: Freescale i.MX8QXP MEK (DT) [ 1.998668] Workqueue: events deferred_probe_work_func [ 2.003812] pstate: 60000085 (nZCv daIf -PAN -UAO) [ 2.008607] pc : __free_irq+0xc0/0x358 [ 2.012364] lr : __free_irq+0xc0/0x358 [ 2.016111] sp : ffff00001179b7e0 [ 2.019422] x29: ffff00001179b7e0 x28: 0000000000000018 [ 2.024736] x27: ffff000011233000 x26: 0000000000000004 [ 2.030053] x25: 000000000000001a x24: ffff80083bec74d4 [ 2.035369] x23: 0000000000000000 x22: ffff80083bec7588 [ 2.040686] x21: ffff80083b1fe8d8 x20: ffff80083bec7400 [ 2.046003] x19: 0000000000000000 x18: ffffffffffffffff [ 2.051320] x17: 0000000000000000 x16: 0000000000000000 [ 2.056637] x15: ffff0000111296c8 x14: ffff00009179b517 [ 2.061953] x13: ffff00001179b525 x12: ffff000011142000 [ 2.067270] x11: ffff000011129f20 x10: ffff0000105da970 [ 2.072587] x9 : 00000000ffffffd0 x8 : 0000000000000194 [ 2.077903] x7 : 612065657266206f x6 : ffff0000111e7b09 [ 2.083220] x5 : 0000000000000003 x4 : 0000000000000000 [ 2.088537] x3 : 0000000000000000 x2 : 00000000ffffffff [ 2.093854] x1 : 28b70f0a2b60a500 x0 : 0000000000000000 [ 2.099173] Call trace: [ 2.101618] __free_irq+0xc0/0x358 [ 2.105021] free_irq+0x38/0x98 [ 2.108170] imx_mu_shutdown+0x90/0xb0 [ 2.111921] mbox_free_channel.part.2+0x24/0xb8 [ 2.116453] mbox_free_channel+0x18/0x28 This bug is present from the beginning of times. Cc: Oleksij Rempel Signed-off-by: Daniel Baluta Signed-off-by: Richard Zhu Reviewed-by: Dong Aisheng --- drivers/mailbox/imx-mailbox.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/mailbox/imx-mailbox.c b/drivers/mailbox/imx-mailbox.c index 9f74dee..957c10c 100644 --- a/drivers/mailbox/imx-mailbox.c +++ b/drivers/mailbox/imx-mailbox.c @@ -214,8 +214,10 @@ static void imx_mu_shutdown(struct mbox_chan *chan) struct imx_mu_priv *priv = to_imx_mu_priv(chan->mbox); struct imx_mu_con_priv *cp = chan->con_priv; - if (cp->type == IMX_MU_TYPE_TXDB) + if (cp->type == IMX_MU_TYPE_TXDB) { tasklet_kill(&cp->txdb_tasklet); + return; + } imx_mu_xcr_rmw(priv, 0, IMX_MU_xCR_TIEn(cp->idx) | IMX_MU_xCR_RIEn(cp->idx) | IMX_MU_xCR_GIEn(cp->idx)); From patchwork Wed Oct 9 08:07:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongxing Zhu X-Patchwork-Id: 175600 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp428725ill; Wed, 9 Oct 2019 01:09:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqy5KLMax/J0jd9fxNrhu0EAu5o5jyi+TE+ahyNcbty+952VWP8HIpNQD6bBTzUMVsHjTuxt X-Received: by 2002:a17:906:d29a:: with SMTP id ay26mr1588679ejb.21.1570608590610; Wed, 09 Oct 2019 01:09:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570608590; cv=none; d=google.com; s=arc-20160816; b=i9n6WRzDIlXNWHY0DHwI/e1aRdu2hIz+KXlo5iYBHhHPj1HSm7l2T0PzRtC5tcVsTo oYIXcmzOKOv/LLPY+UlGT4IZVp5LxaQcYRyD29H7Cg+bKludFM5px2Z+KjGIVE/yaaIF ANe77DwfGKdaHAt8Ue8kjk+SQfSd7pHXvSuo8GOxVVgtReqdOluUKnbnSjYqMv8FTl9t Skm4d0o2nQMnhbHzlD7m1GHpJnsB19BQFQBC6P89mfGSXUV1uOg7F8vt7DeVC4Cw5rDf f4LhFjAXjo3DmS9fvokat+EaLur3XDyRD4rOBOk6tnXOJT8WdbxFAfGIxM09g9aSQPtq 6glg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=UrDrVapL7N3ELwnBx94eNfFIdw8+eiJ6DJadYpONjn4=; b=f7WF3G1BOz4kkuCLf/nvcHnr/xSc0WNFTuCWykeghvUsfNhKOtOxIuljB2hY+HNJ5A LZ/3/RHSap9gqLv2QlLckeHTdDkoJTqqQ3268tSSZcSOAEeMkKtG3vvFsZGrgYr7v7JH bpZjsZqJyitnyfPYojYVA+G8VkiWnGle2eRP0iN9mv5OL3Em++jMVG8YscSkpomwLGoj yky4qpfG3IWw8FOxQT9Pl1xe4T6CSIXuJ5AVR7/6nFzn9zDKIqoDbOnj9T8jQbWUUPoO q4FPR4lU0G8fIjttToWH8vctf24NFfTHJhvP3jZ5gNcCep+G+/8exNPB8/67xH+b4eGU QhkQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b31si1030627ede.12.2019.10.09.01.09.50; Wed, 09 Oct 2019 01:09:50 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730324AbfJIIJt (ORCPT + 26 others); Wed, 9 Oct 2019 04:09:49 -0400 Received: from inva020.nxp.com ([92.121.34.13]:53878 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730212AbfJIIJr (ORCPT ); Wed, 9 Oct 2019 04:09:47 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id AFACE1A039D; Wed, 9 Oct 2019 10:09:45 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id A951F1A0382; Wed, 9 Oct 2019 10:09:41 +0200 (CEST) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id B4232402FF; Wed, 9 Oct 2019 16:09:33 +0800 (SGT) From: Richard Zhu To: jassisinghbrar@gmail.com, o.rempel@pengutronix.de, daniel.baluta@nxp.com, aisheng.dong@nxp.com Cc: linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Richard Zhu Subject: [PATCH v6 2/4] mailbox: imx: Clear the right interrupts at shutdown Date: Wed, 9 Oct 2019 16:07:19 +0800 Message-Id: <1570608441-29651-3-git-send-email-hongxing.zhu@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1570608441-29651-1-git-send-email-hongxing.zhu@nxp.com> References: <1570608441-29651-1-git-send-email-hongxing.zhu@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Daniel Baluta Make sure to only clear enabled interrupts keeping count of the connection type. Suggested-by: Oleksij Rempel Signed-off-by: Daniel Baluta Signed-off-by: Richard Zhu Reviewed-by: Dong Aisheng --- drivers/mailbox/imx-mailbox.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/drivers/mailbox/imx-mailbox.c b/drivers/mailbox/imx-mailbox.c index 957c10c..afe625e 100644 --- a/drivers/mailbox/imx-mailbox.c +++ b/drivers/mailbox/imx-mailbox.c @@ -219,8 +219,19 @@ static void imx_mu_shutdown(struct mbox_chan *chan) return; } - imx_mu_xcr_rmw(priv, 0, IMX_MU_xCR_TIEn(cp->idx) | - IMX_MU_xCR_RIEn(cp->idx) | IMX_MU_xCR_GIEn(cp->idx)); + switch (cp->type) { + case IMX_MU_TYPE_TX: + imx_mu_xcr_rmw(priv, 0, IMX_MU_xCR_TIEn(cp->idx)); + break; + case IMX_MU_TYPE_RX: + imx_mu_xcr_rmw(priv, 0, IMX_MU_xCR_RIEn(cp->idx)); + break; + case IMX_MU_TYPE_RXDB: + imx_mu_xcr_rmw(priv, 0, IMX_MU_xCR_GIEn(cp->idx)); + break; + default: + break; + } free_irq(priv->irq, chan); }