Received: by 2002:a05:7412:8d1c:b0:fa:4c10:6cad with SMTP id bj28csp209788rdb; Tue, 16 Jan 2024 22:23:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IG/cRHvrj0/vq0aJYfs7mtYZpviaHT3MJB38mWCfA0ceJrFjSHLPfff/nYtntEux7zjaYa+ X-Received: by 2002:a17:902:eccf:b0:1d5:b797:fdc with SMTP id a15-20020a170902eccf00b001d5b7970fdcmr4098395plh.131.1705472624904; Tue, 16 Jan 2024 22:23:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705472624; cv=pass; d=google.com; s=arc-20160816; b=iBWakczawU2TMNSSBjMZxstJm7L4N8zcRdhUz4Gf3/uvYcejeMmQjiaT3e8iU5k09U FFqjfD/DMdf/ack/RwMJR6yg3jF3yqYmYCtvN4gdRlrQudLWizPyiHo9EjB9aCOKYTd4 GgWq46bUX+8Av5P4ntsmYr4P2Y1q9OEm95VMCp8Vk4+41cL9JZDMHftbx0+3QOEqNDeU vnKgS4DsYgcL8+NoeQFw7nzeW0EhIsv8Nd8oZ13vsgNsUjEBVd4k4jt9iVezKXKWgeUs Uz6SGZwQDlm7nfGSfJoBhaB43Ksa7Z+ukyXCyKNXSoXidSkOw41VK5Rnc+UpFsjRU6uc 4tIw== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=VjLXAwL33gDx/5/BzSqYEdBdLVkV4tNSMniS7zSywuI=; fh=e5iw0ukL31u6fMn+hZYiSOp4yisu2h+6CljD+X3bH78=; b=CyYuTMZSb5Uhuy4ASUXEJ/ZuPI2MIVxLLQ/gKhH5Pyhy5eYoJ/84w4lCwJosd8nxLF 2Kpr8hLbbvmv8tDOFQTCXLbhKM3oo7znn/y2frzaPyNbvqaijbusCo2E8BXvbYlmG36M vtNO15OU2JZ6XUGUNbQUWGtRGiuYIy30SNUZLqRScK6TWBTyAt/qtmBT+Jg0puTCKugx 2+b8/Y5sB28U07r0opdwBW+FcIYhDgOzgWVentpM4qBdGB1qtmCgG03ZuND0hZFZBu1f MKERDGSGftb2l2BrLmTgF5mROgf1eqXKYdBxeosi+R64kXhXb2+LkjXAk9jXeHazCgR/ G6Xw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=BCbHnMm1; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-28557-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28557-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id iy7-20020a170903130700b001cfe02fa89esi12731096plb.117.2024.01.16.22.23.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 22:23:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-28557-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=BCbHnMm1; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-28557-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28557-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 08768B23C74 for ; Wed, 17 Jan 2024 06:23:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 649568F47; Wed, 17 Jan 2024 06:23:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="BCbHnMm1" Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) (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 3445D28FC; Wed, 17 Jan 2024 06:23:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.148.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705472608; cv=none; b=FoLkzFl0gQxNShaGL+Gyzc1uAS/zkMoJoSfpbtPTq7KpJh1JV4ZTtS3lxE8gW0anD1kO4Ww3wv7LivvssaW1FFtLI08kjhfUlDlT+CtiAF+kxmtrebUUn1jQk6ctoIOuYP1JPdby/DiPDGtilktXilpYixUsWKChWeRsl8VMAgA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705472608; c=relaxed/simple; bh=YmgAmQESRGyO7hObIG4VdMuhpU1Rmm5n8BlSEhK+Ci0=; h=Received:DKIM-Signature:Received:Received:Received:Received:From: To:CC:Subject:Date:Message-ID:X-Mailer:MIME-Version: Content-Transfer-Encoding:Content-Type:X-Proofpoint-GUID: X-Proofpoint-ORIG-GUID:X-Proofpoint-Virus-Version; b=fGh6V9v0qtafcOhVWZAjiJPLUQTcquJgXazybkmgo+eUSs28u/bhljSaG/BX9Kej+yA+tHJO9VGlK87q3BdFZlvA4BhZaj1HqMVQjnKrNf39tkhB5E67KUeS1l7kixeNUTIScqtbqawzjEVTVuMkJk1XqsolLkJ4NTguKsW62WY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com; spf=pass smtp.mailfrom=marvell.com; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b=BCbHnMm1; arc=none smtp.client-ip=67.231.148.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=marvell.com Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 40GI9O2R002942; Tue, 16 Jan 2024 22:23:15 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding:content-type; s=pfpt0220; bh=VjLXAwL3 3gDx/5/BzSqYEdBdLVkV4tNSMniS7zSywuI=; b=BCbHnMm1caokDrn29icWtAcD ZvqvHUzs5RUy+dUbOGFvXd6zTEgBl5pCXinu0R7yE6qO9cOBjQo3ZWM9rRZDzOq8 KHMaGF+TyZFO1Ru8wvU3HKD7SjIypd8s7ysSTX9oFU88aklCM5x3b0i9r/o8kofJ 0xpNl4M0oDsnHL3tt8pP6efYVpSw8STLkNgVimkMOCJaM1Qp9dNmWtmt97V6ePb/ mqoOrvugzdfa8aK8zZxWIfvq95K72rj0F1iF1l2EyyjT4CVRLknsjA6vZ/23yx3y D1praCRRcIpv8FEarZmWPJYEmhhYMhK5Ro61xtcambSwFQjoxRlwSmrrXG7oYA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3vnxu1jd6g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 16 Jan 2024 22:23:14 -0800 (PST) Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 16 Jan 2024 22:23:13 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 16 Jan 2024 22:23:13 -0800 Received: from localhost.localdomain (unknown [10.111.135.16]) by maili.marvell.com (Postfix) with ESMTP id A6A803F7044; Tue, 16 Jan 2024 22:23:12 -0800 (PST) From: Jenishkumar Maheshbhai Patel To: , , , , , , , CC: Jenishkumar Maheshbhai Patel Subject: [net v2 PATCH 1/1] net: mvpp2: clear BM pool before initialization Date: Tue, 16 Jan 2024 22:23:10 -0800 Message-ID: <20240117062310.2030408-1-jpatel2@marvell.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: j9pVR1av0e7_aP6TpQx_f3QT-tsmk5w3 X-Proofpoint-ORIG-GUID: j9pVR1av0e7_aP6TpQx_f3QT-tsmk5w3 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-17_02,2024-01-16_01,2023-05-22_02 Register value persist after booting the kernel using kexec which results in kernel panic. Thus clear the BM pool registers before initialisation to fix the issue. Fixes: 3f518509dedc ("ethernet: Add new driver for Marvell Armada 375 network unit") Signed-off-by: Jenishkumar Maheshbhai Patel --- v1-v2: -Move comments outside the loop -remove unrequired brances. .../net/ethernet/marvell/mvpp2/mvpp2_main.c | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c index 820b1fabe297..49d9960f9ce8 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c @@ -614,12 +614,37 @@ static void mvpp23_bm_set_8pool_mode(struct mvpp2 *priv) mvpp2_write(priv, MVPP22_BM_POOL_BASE_ADDR_HIGH_REG, val); } +/* Cleanup pool before actual initialization in the OS */ +static void mvpp2_bm_pool_cleanup(struct mvpp2 *priv, int pool_id) +{ + u32 val; + int i; + /* Drain the BM from all possible residues left by firmware */ + for (i = 0; i < MVPP2_BM_POOL_SIZE_MAX; i++) + mvpp2_read(priv, MVPP2_BM_PHY_ALLOC_REG(pool_id)); + /* Stop the BM pool */ + val = mvpp2_read(priv, MVPP2_BM_POOL_CTRL_REG(pool_id)); + val |= MVPP2_BM_STOP_MASK; + mvpp2_write(priv, MVPP2_BM_POOL_CTRL_REG(pool_id), val); + /* Mask BM all interrupts */ + mvpp2_write(priv, MVPP2_BM_INTR_MASK_REG(pool_id), 0); + /* Clear BM cause register */ + mvpp2_write(priv, MVPP2_BM_INTR_CAUSE_REG(pool_id), 0); +} + static int mvpp2_bm_init(struct device *dev, struct mvpp2 *priv) { enum dma_data_direction dma_dir = DMA_FROM_DEVICE; int i, err, poolnum = MVPP2_BM_POOLS_NUM; struct mvpp2_port *port; + if (priv->percpu_pools) + poolnum = mvpp2_get_nrxqs(priv) * 2; + + /* Clean up the pool state in case it contains stale state */ + for (i = 0; i < poolnum; i++) + mvpp2_bm_pool_cleanup(priv, i); + if (priv->percpu_pools) { for (i = 0; i < priv->port_count; i++) { port = priv->port_list[i]; -- 2.25.1