Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1462699rwl; Fri, 24 Mar 2023 10:49:20 -0700 (PDT) X-Google-Smtp-Source: AKy350Y5iGqbV2MtgaMBvy886UvLv7rQP9k5+SCvurv4260Ku255b2k4c3slY/xI1vsiP8ULNlYM X-Received: by 2002:a17:903:2291:b0:1a0:549d:3996 with SMTP id b17-20020a170903229100b001a0549d3996mr3654917plh.25.1679680160398; Fri, 24 Mar 2023 10:49:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679680160; cv=none; d=google.com; s=arc-20160816; b=wkonRZ3nBGmyePGGjhMb1FAUEanXF2OhdESxA/6IckihfCBqW6KtETL5hrD5T3TDhH d9ZAx58QbLqIDGwS241AZNX6lFocz5pHM5Nq0GlxanCk6CEBtYwrn5Z43Y4s+Xruewuu bHZFFH0oclBElrgoaGoeiwnE9pkTcTIzxzqkRnoDazEbxEbpqHBvprv+XSnoWdc981F8 4Btd0/ThLye9GPf3STLrQE0HMiO3niKpWKVZl3WF+lC1WCUWkxin7YS9mipbJPgH6t+4 100lOwfsgp2Ec5k0QjIWTuVQTC7MeKGBIv+Cqv7qyRAAdaUMATQuRrwzFNQRlJzwTY2Y uqhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xfcro882otU9jgc0oI8iBxCajulNUCQMvAsdjN3RA+A=; b=eZaoG8nEbmqXz0MkSWwWqoz0k5GSaN6JbDgEXTyDMIBqqre71lvW/QFp5CiR58ONz1 FKXn8IR9WX6G77kk5ogFQFqki3yU0jc53/wh4qhCPopWCgRMv3owHQkA/GeKUfQceMeO VPa2l11R/bEjzlzAoNZ3DQyrcVgYu9ue2JTih2bWKeLS5A0Sc8vaiFOrld/0UAbTHfww J5kJpqVq/Ye99d6LPAWwRBUeLkIpa/rH7qD6aXitYbERlCAHOUjrP4sfWfcqMDi+BrN5 tOAE3Js6m2TY3Gis6iT8pA0bjPSeWv/8kzk1MnPf2dAN3umO8CvnbOSwyDSAAog97v+E zitQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=em+fBYVP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 20-20020a170902e9d400b0019f2cd99ddfsi21143533plk.380.2023.03.24.10.49.08; Fri, 24 Mar 2023 10:49:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=em+fBYVP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232008AbjCXRrj (ORCPT + 99 others); Fri, 24 Mar 2023 13:47:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231740AbjCXRr1 (ORCPT ); Fri, 24 Mar 2023 13:47:27 -0400 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0C751A493; Fri, 24 Mar 2023 10:47:23 -0700 (PDT) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32OH2r7X001150; Fri, 24 Mar 2023 10:47:15 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=xfcro882otU9jgc0oI8iBxCajulNUCQMvAsdjN3RA+A=; b=em+fBYVPzFqTNR6pCrA1jwb2cSyshUv4zGqgr5tdSV0kkEIYQr67GZUcSzz/b14KhlXA Mh5benxF6e7ZjSwCxdd2KZNacTcRZ4ZEymTvTixYYAd7VR1CAe7TYdciX33vDh3Z8ANt qd6TacfKeKf6hKbFR+p776RS5vqFQ6RrJZODpulFyr6pMAlunQee6sDI8TAb8pvSkxud C1Wtha0P/+vRxQfho2iYAPV+KPzivMqCi1g5ehfMtaEX2FYnYJSOX8hX5iumDh/JRDJ/ UivD08sSQJsu2BSEXQpFCrgvsWiVpUc2cRSpo35dnZXNv+dbJ7XXvq70fmcvEzC/J7oF nA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3pgxmfkdp2-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 24 Mar 2023 10:47:15 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 24 Mar 2023 10:47:13 -0700 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.42 via Frontend Transport; Fri, 24 Mar 2023 10:47:13 -0700 Received: from sburla-PowerEdge-T630.sclab.marvell.com (unknown [10.106.27.217]) by maili.marvell.com (Postfix) with ESMTP id 7C7EB3F7067; Fri, 24 Mar 2023 10:47:13 -0700 (PDT) From: Veerasenareddy Burru To: , , , , CC: , Veerasenareddy Burru , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Subject: [PATCH net-next v5 3/8] octeon_ep: control mailbox for multiple PFs Date: Fri, 24 Mar 2023 10:46:58 -0700 Message-ID: <20230324174704.9752-4-vburru@marvell.com> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20230324174704.9752-1-vburru@marvell.com> References: <20230324174704.9752-1-vburru@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: Safqy3egmBpVRJDFpFhXYTk4uVs9qE5S X-Proofpoint-ORIG-GUID: Safqy3egmBpVRJDFpFhXYTk4uVs9qE5S X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-24_11,2023-03-24_01,2023-02-09_01 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add control mailbox support for multiple PFs. Update control mbox base address calculation based on PF function link. Signed-off-by: Veerasenareddy Burru Signed-off-by: Abhijit Ayarekar --- v4 -> v5: * no change v3 -> v4: * resovled review comments https://lore.kernel.org/all/Y+vJkPO1UZPDSFT2@boxer/ - fixed rct violation. v2 -> v3: * no change v1 -> v2: * no change .../ethernet/marvell/octeon_ep/octep_cn9k_pf.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_cn9k_pf.c b/drivers/net/ethernet/marvell/octeon_ep/octep_cn9k_pf.c index adc2279bc66d..e2503c9bc8a1 100644 --- a/drivers/net/ethernet/marvell/octeon_ep/octep_cn9k_pf.c +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_cn9k_pf.c @@ -13,6 +13,9 @@ #include "octep_main.h" #include "octep_regs_cn9k_pf.h" +#define CTRL_MBOX_MAX_PF 128 +#define CTRL_MBOX_SZ ((size_t)(0x400000 / CTRL_MBOX_MAX_PF)) + /* Names of Hardware non-queue generic interrupts */ static char *cn93_non_ioq_msix_names[] = { "epf_ire_rint", @@ -198,7 +201,9 @@ static void octep_init_config_cn93_pf(struct octep_device *oct) { struct octep_config *conf = oct->conf; struct pci_dev *pdev = oct->pdev; + u8 link = 0; u64 val; + int pos; /* Read ring configuration: * PF ring count, number of VFs and rings per VF supported @@ -234,7 +239,16 @@ static void octep_init_config_cn93_pf(struct octep_device *oct) conf->msix_cfg.ioq_msix = conf->pf_ring_cfg.active_io_rings; conf->msix_cfg.non_ioq_msix_names = cn93_non_ioq_msix_names; - conf->ctrl_mbox_cfg.barmem_addr = (void __iomem *)oct->mmio[2].hw_addr + (0x400000ull * 7); + pos = pci_find_ext_capability(oct->pdev, PCI_EXT_CAP_ID_SRIOV); + if (pos) { + pci_read_config_byte(oct->pdev, + pos + PCI_SRIOV_FUNC_LINK, + &link); + link = PCI_DEVFN(PCI_SLOT(oct->pdev->devfn), link); + } + conf->ctrl_mbox_cfg.barmem_addr = (void __iomem *)oct->mmio[2].hw_addr + + (0x400000ull * 7) + + (link * CTRL_MBOX_SZ); } /* Setup registers for a hardware Tx Queue */ -- 2.36.0