From patchwork Fri Mar 1 11:03:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hariprasad Kelam X-Patchwork-Id: 208773 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2097:b0:108:e6aa:91d0 with SMTP id gs23csp998697dyb; Fri, 1 Mar 2024 03:03:55 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVMQ1xeAFkxBps7tifgjlN0R9oon15QXuKRTMyrzVqqCMePNBR2yWqJAcNEk/3W1pYvV5eCPgLRxA/Zd96NzfSTYE5WEg== X-Google-Smtp-Source: AGHT+IFbU5J3Cjy4wpUy9hxjk63nULRU4k9PE3r6VAvwZmOp0aQgolIx+tRw+frOCszNw5hQNVqK X-Received: by 2002:ac8:5d01:0:b0:42e:63b5:61f8 with SMTP id f1-20020ac85d01000000b0042e63b561f8mr1457208qtx.17.1709291035238; Fri, 01 Mar 2024 03:03:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709291035; cv=pass; d=google.com; s=arc-20160816; b=w57y6Y7g2yJvxhhfXwot+429NzhIv7TA6+NwIkzdofu5FjGvjG0MPrrsYpYV4z28pA CpJSKJeeMP84PJP4rkz+M7lS6E7yQuJxecC232V1kwJsK4SIgiuHNWL2KEPz6b3A8sjc DvVv9NbIQOsFhndvlkSPp9AUhVWRMfbWjJeHV/SNAPYZY0Cslf/HjidZiwahlT8p4WWD oF5zH5Eg59fzdlBcVQh4K92xxIOGdLpx3T2uSNk0eTmfsxvp94IeolQcagBVH2kGhEFg FqlgODHU/5UGka8uktasyHjgsg+rdYTRho/vax4ycJbO9hXTJNLnIJH3ae0a3a6kM/H3 YXjg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:subject:cc:to:from:dkim-signature; bh=69b8YalajgMm+7NNElTefL9mv/sranlkLmD27HQxiW4=; fh=+k3MSxe8bGu7+vpCqCHH3WWBYVLMuN2nEavX9/ZyOOI=; b=q68MaMPuKn3FrE/GafDaOwd2fazbPcyVMUp2Q/UAMOOceSz99uRhGskU7OMYYFjNXV FV9MqCjdjN6DOyNYHsvsPliFVlXWVIicBzlAwmIUb1Eg2bxZB6pfMo5Lq+a1kC/0Oo7J wrnZZE/0B7axv/jS7iUfJRx7Kfbfb4bDGXzOsM8SUvvHXByqdBlGfWetMi6o6nLxT0QY CON6PTKWLW68nn3iN7+QCGRoSFwpGuIAGuoCRYAFK08t7GZUL7JSegUwWwCyoF+8yfxr b3k+aaBvbftsSgnJHAvpgJx85eSaZcygp7DCiHreOP3WwcxVJXr17TQnSDmB2vkhmAi7 sE/Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=JafJCWpQ; 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-88294-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88294-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id m16-20020a05622a055000b0042e6bd670basi3523793qtx.562.2024.03.01.03.03.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 03:03:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88294-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=JafJCWpQ; 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-88294-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88294-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 099781C22474 for ; Fri, 1 Mar 2024 11:03:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2C1426CDA5; Fri, 1 Mar 2024 11:03:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="JafJCWpQ" 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 0F0026AF86; Fri, 1 Mar 2024 11:03:35 +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=1709291017; cv=none; b=Ew4XzU0ckHfYbDO5p7wole6/EekAL1JArQGUxypce/tIq+lGrXGIrMzMaoEODPuIH+VznvT+YOhC3FoIhiu3IslIIpB3AE3NuId1Hy1zFCwMCw64aegKvPamwAZQiCGLLZFj48NdZfHiDAU3Nf4LeU+K31l80S6fFF4CKIYpR7A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709291017; c=relaxed/simple; bh=yiKp1zRHreL2bNW7ALQAcQFLBqkQH1Gdy5hcNVchko0=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=J5zNa6t8HbfTOWf9fq/R185JkfuMB4ZhxfNeovDEh3MBZgLZMRO3KKiAYa8TGWkLMRZgFFsZcwWttvx3xZ+NsF3vVmILvxy2LQ/GJ+DSHjEU8gyLg3Njhyzv9qT5EVvyloHXMzxx/y91KlZsOd6OFVe94IHglrH1sf/Fx7/Zp0g= 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=JafJCWpQ; 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 4219mhrk013735; Fri, 1 Mar 2024 03:03:23 -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-type; s= pfpt0220; bh=69b8YalajgMm+7NNElTefL9mv/sranlkLmD27HQxiW4=; b=Jaf JCWpQHVEEUPkJCHYgcJ8+CIxgNgNl9a6Pvai0nD+SMmKiCDeiHen+l9s1HcEhgDY 93kcbCDKQrSk413q2IVjDfNo88o4zJs0S4hG1ZHcunIu8fUPLRyj9GjTCOX00vao Udc9/eNMvEW6ZmyagN8slZuNwFB6Lih+Neefd5Ii2Gk6rJbdnAYb2eGXubJ7fYjz L1q6riZJW5uTXAmfFb2Qc/uBbALdZqyi/gyxSMwlgQ/Rk0hqYGcnwUHg+F9XmLpI R4HH4KpFt61URYzwH0d3xQMIxQms2z6Otn4rrq9S76zNVELimZOXrDrtYoK01/Ac U5WMLhqnn7c9kBPetlA== Received: from dc5-exch05.marvell.com ([199.233.59.128]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3wkcq586jx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 01 Mar 2024 03:03:22 -0800 (PST) Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.1258.12; Fri, 1 Mar 2024 03:03:22 -0800 Received: from DC5-EXCH05.marvell.com (10.69.176.209) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Fri, 1 Mar 2024 03:03:19 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server id 15.2.1258.12 via Frontend Transport; Fri, 1 Mar 2024 03:03:19 -0800 Received: from hyd1soter3.marvell.com (unknown [10.29.37.12]) by maili.marvell.com (Postfix) with ESMTP id A99D93F70BA; Fri, 1 Mar 2024 03:03:15 -0800 (PST) From: Hariprasad Kelam To: , CC: , , , , , , , , , , Subject: [net-next] Octeontx2-af: Fix an issue in firmware shared data reserved space Date: Fri, 1 Mar 2024 16:33:14 +0530 Message-ID: <20240301110314.29800-1-hkelam@marvell.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-GUID: A5x86uW0VDTqloCxKJOamJrdgwXO7Xmj X-Proofpoint-ORIG-GUID: A5x86uW0VDTqloCxKJOamJrdgwXO7Xmj X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-01_08,2024-03-01_01,2023-05-22_02 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792321556465048096 X-GMAIL-MSGID: 1792321556465048096 The last patch which added support to extend the firmware shared data to add channel data information has introduced a bug due to the reserved space not adjusted accordingly. This patch fixes the issue and also adds BUILD_BUG to avoid this regression error. Fixes: 997814491cee ("Octeontx2-af: Fetch MAC channel info from firmware") Signed-off-by: Hariprasad Kelam --- drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 2 ++ drivers/net/ethernet/marvell/octeontx2/af/rvu.h | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c index edd12d09dc89..07d4859de53a 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c @@ -817,6 +817,8 @@ static int rvu_fwdata_init(struct rvu *rvu) err = cgx_get_fwdata_base(&fwdbase); if (err) goto fail; + + BUILD_BUG_ON(offsetof(struct rvu_fwdata, cgx_fw_data) > FWDATA_CGX_LMAC_OFFSET); rvu->fwdata = ioremap_wc(fwdbase, sizeof(struct rvu_fwdata)); if (!rvu->fwdata) goto fail; diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu.h b/drivers/net/ethernet/marvell/octeontx2/af/rvu.h index de8eba902276..f390525a6217 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu.h +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu.h @@ -469,11 +469,12 @@ struct rvu_fwdata { u32 ptp_ext_clk_rate; u32 ptp_ext_tstamp; struct channel_fwdata channel_data; -#define FWDATA_RESERVED_MEM 1014 +#define FWDATA_RESERVED_MEM 958 u64 reserved[FWDATA_RESERVED_MEM]; #define CGX_MAX 9 #define CGX_LMACS_MAX 4 #define CGX_LMACS_USX 8 +#define FWDATA_CGX_LMAC_OFFSET 10536 union { struct cgx_lmac_fwdata_s cgx_fw_data[CGX_MAX][CGX_LMACS_MAX];