From nobody Tue Jul 02 08:06:19 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WCwTm4m4qz5PhW5; Tue, 02 Jul 2024 08:06:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WCwTm084Qz4J5Q; Tue, 2 Jul 2024 08:06:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1719907580; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Kvokx6jfzP8gPOG+g6sOhejPssgbp0MQBNbjfwBJWeo=; b=u2qldLuq79ppfeufAqpQka/HP8Zwmtx9b7JKyaAZ5QYVHeClc6qxoh78geS8MLnSXXV7Ut pmcEaHBcTIZ9mh6fxBlTs6IFUUyXca+0cc4W2Be0tAjew03F5UtqtnAu/aqc3NvUX+kzIp kR+P+6ci6qS/YZox1ArDkGJBKkBS9w7RFzBJopBwNozBrmDoMmvaHFsF7ENzUC4NHvTpnC ogCiCxqui/ZT5jvKjPEWN8TcQjhPBmYDHmVPbR2kTpp1PZ90K+M/BtM13pRwOkSAuLm3Nn 3S08R+y/UgQXS1gNoq2U1gwP4agchEKIOQp37vrBd2nG36lefUal9WBbhciapg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1719907580; a=rsa-sha256; cv=none; b=wHaX3+njCD8zZyyPr23iW6qnL0+rpOBLQ6boQN0COUr/11XvFK4Cub+u+/hiHqcalzDrGN luE30Dp+GOpat0pyMzahvZgcCsWvNdsyg4h8jZo/kzPP3FxOXl8QvQKnPo6ljbBpLs9fTw rNyETxAv9bdLqHX9rMbsuHFunGkszHnxDlpNFRfergqhtp5WPOJqXpzfGqSVjpvRzucv/i eUV/MC/x6RwVHbjv7mUcqNyAvaoioyTF9S5S7yUI/uTHpYUWPnUu+Gy2ab8zM6uiw0GHdv IdLWxwRdTErVcQtB6sXU5KwxVQJQrzQD3T0X+wjBTZO64+KLB7d62fulz0nmVA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1719907580; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Kvokx6jfzP8gPOG+g6sOhejPssgbp0MQBNbjfwBJWeo=; b=Xk36wrbEfJGkaZa5Of323yORZAwvRTL1y5zzN/eVO5YpQk5qhgsvXxbV4MYLeHt6MGao+6 v2DjczIvZrEj3iLdjzoXSD5ZOpKYd+KGumAte7VH3tMs8abk1bPeLqG8h0oYsf2NoQwaGz 67AOFIc8kxU2Gg2KCAaYBC4SqYJmQ/woPEtRi1Uian+vA4eLuDp0oXIVCrMMvhOujjdYX+ Upx7H1iYqMUxBPj59/KQ9nW8pozUjNxiMZZHkTzgeJComsd7jRpu85YfwP7lQxOZNeunZk WC1FCDiBKmSFRp/8AXkJuh5GSudnyNbI9SC5PDQMDlOMgrED97YRkZEKBCPtWg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4WCwTl6mrhzgQm; Tue, 2 Jul 2024 08:06:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 46286JkT083002; Tue, 2 Jul 2024 08:06:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46286JmR082998; Tue, 2 Jul 2024 08:06:19 GMT (envelope-from git) Date: Tue, 2 Jul 2024 08:06:19 GMT Message-Id: <202407020806.46286JmR082998@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 2f8f10bee95f - stable/13 - cxgbe(4): New knob to limit driver to the specified types of doorbells. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2f8f10bee95f59267cbacb393c4205d539409af5 Auto-Submitted: auto-generated The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=2f8f10bee95f59267cbacb393c4205d539409af5 commit 2f8f10bee95f59267cbacb393c4205d539409af5 Author: Navdeep Parhar AuthorDate: 2024-06-13 17:22:03 +0000 Commit: Kristof Provost CommitDate: 2024-07-02 07:45:54 +0000 cxgbe(4): New knob to limit driver to the specified types of doorbells. hw.cxgbe.doorbells_allowed="0xf" The adapter's doorbells bitmap is clipped to the value specified in the tunable, which is meant for debug and workarounds only. There is no change in default behavior. MFC after: 1 week Sponsored by: Chelsio Communications (cherry picked from commit ba95b4aea78909bca972239afcbd51538c4b37c1) --- sys/dev/cxgbe/adapter.h | 1 + sys/dev/cxgbe/t4_main.c | 21 +++++++++++++++++++++ sys/dev/cxgbe/t4_vf.c | 4 ++++ 3 files changed, 26 insertions(+) diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index f6e58dc976c1..706bdf1b9f8b 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -1303,6 +1303,7 @@ void t4_add_adapter(struct adapter *); int t4_detach_common(device_t); int t4_map_bars_0_and_4(struct adapter *); int t4_map_bar_2(struct adapter *); +int t4_adj_doorbells(struct adapter *); int t4_setup_intr_handlers(struct adapter *); void t4_sysctls(struct adapter *); int begin_synchronized_op(struct adapter *, struct vi_info *, int, char *); diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index d8653813f8a9..a47b4609e8f1 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -605,6 +605,11 @@ static int t5_write_combine = 0; SYSCTL_INT(_hw_cxl, OID_AUTO, write_combine, CTLFLAG_RDTUN, &t5_write_combine, 0, "Use WC instead of UC for BAR2"); +/* From t4_sysctls: doorbells = {"\20\1UDB\2WCWR\3UDBWC\4KDB"} */ +static int t4_doorbells_allowed = 0xf; +SYSCTL_INT(_hw_cxgbe, OID_AUTO, doorbells_allowed, CTLFLAG_RDTUN, + &t4_doorbells_allowed, 0, "Limit tx queues to these doorbells"); + static int t4_num_vis = 1; SYSCTL_INT(_hw_cxgbe, OID_AUTO, num_vis, CTLFLAG_RDTUN, &t4_num_vis, 0, "Number of VIs per port"); @@ -1351,6 +1356,10 @@ t4_attach(device_t dev) if (rc != 0) goto done; /* error message displayed already */ + rc = t4_adj_doorbells(sc); + if (rc != 0) + goto done; /* error message displayed already */ + rc = t4_create_dma_tag(sc); if (rc != 0) goto done; /* error message displayed already */ @@ -3827,6 +3836,18 @@ t4_map_bar_2(struct adapter *sc) return (0); } +int +t4_adj_doorbells(struct adapter *sc) +{ + if ((sc->doorbells & t4_doorbells_allowed) != 0) { + sc->doorbells &= t4_doorbells_allowed; + return (0); + } + CH_ERR(sc, "No usable doorbell (available = 0x%x, allowed = 0x%x).\n", + sc->doorbells, t4_doorbells_allowed); + return (EINVAL); +} + struct memwin_init { uint32_t base; uint32_t aperture; diff --git a/sys/dev/cxgbe/t4_vf.c b/sys/dev/cxgbe/t4_vf.c index 31faa9969dd6..d22937ef2bbd 100644 --- a/sys/dev/cxgbe/t4_vf.c +++ b/sys/dev/cxgbe/t4_vf.c @@ -589,6 +589,10 @@ t4vf_attach(device_t dev) if (rc != 0) goto done; /* error message displayed already */ + rc = t4_adj_doorbells(sc); + if (rc != 0) + goto done; /* error message displayed already */ + rc = t4_create_dma_tag(sc); if (rc != 0) goto done; /* error message displayed already */