From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2ABB9A04E1; Tue, 22 Sep 2020 10:57:51 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0AAA41DBA4; Tue, 22 Sep 2020 10:51:20 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.164]) by dpdk.org (Postfix) with ESMTP id 6DE861D710 for ; Tue, 22 Sep 2020 10:50:22 +0200 (CEST) Received: from mx1-us1.ppe-hosted.com (unknown [10.110.50.137]) by dispatch1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id EAB3220054 for ; Tue, 22 Sep 2020 08:50:21 +0000 (UTC) Received: from us4-mdac16-40.at1.mdlocal (unknown [10.110.51.55]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id E911C6009B for ; Tue, 22 Sep 2020 08:50:21 +0000 (UTC) X-Virus-Scanned: Proofpoint Essentials engine Received: from mx1-us1.ppe-hosted.com (unknown [10.110.50.12]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 9160E22004D for ; Tue, 22 Sep 2020 08:50:21 +0000 (UTC) Received: from webmail.solarflare.com (uk.solarflare.com [193.34.186.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 5A63140051 for ; Tue, 22 Sep 2020 08:50:21 +0000 (UTC) Received: from ukex01.SolarFlarecom.com (10.17.10.4) by ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 22 Sep 2020 09:50:11 +0100 Received: from opal.uk.solarflarecom.com (10.17.10.1) by ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 22 Sep 2020 09:50:11 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (ukv-loginhost.uk.solarflarecom.com [10.17.10.39]) by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id 08M8oBcN004780; Tue, 22 Sep 2020 09:50:11 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 673EC1613A9; Tue, 22 Sep 2020 09:50:11 +0100 (BST) From: Andrew Rybchenko To: CC: Igor Romanov Date: Tue, 22 Sep 2020 09:49:37 +0100 Message-ID: <1600764594-14752-44-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1600764594-14752-1-git-send-email-arybchenko@solarflare.com> References: <1600764594-14752-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.6.1012-25674.003 X-TM-AS-Result: No-11.629600-8.000000-10 X-TMASE-MatchedRID: 4vv40XEOjZbqxxOtz59fBKiUivh0j2PvOyBTDrxRCti8rUtbtWe8+hPD uMJK1DSu/SwzVfmaVyhA08Pbjdhi2aX7JaGNhSXtnFVnNmvv47tLXPA26IG0hN9RlPzeVuQQiT4 kZOz5KBOodXi+cHENhcF7vJPwNnevDHo0pZoqAoJlpwNsTvdlKeqhuTPUDQDtVlKhKARgvkIHHS QUALkucwY51sUbcr9ZnwOVQcNBSLk5cAShGM5e08nUT+eskUQPS6mvV++TKmkINBjyESk9WdNm9 UP0X0/ol3kp0HYAUbXDnHvB74PWHCscSLtLQpT540jcxy3aXNrcVi8qZmJWcwpCjqVELlwVhnOL yflyxrNiTthHcHcV802vTymnH9dmlhtpzhf3gmf4KPASpfWnuStny2U8KNxMmyiLZetSf8mfop0 ytGwvXiq2rl3dzGQ1lQnj927IBamzI3c2aPZYXXUtWFMJBpC+HMZuRl60YlfcUEFRiMfmLA== X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--11.629600-8.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.6.1012-25674.003 X-MDID: 1600764622-MLOWCri0XbjU Subject: [dpdk-dev] [PATCH 43/60] common/sfc_efx/base: add function control window concept X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Igor Romanov Function control window can be located at a different offset than other windows on Riverhead. Meaning that the drivers must handle accesses to the function control window differently in case of EF100. Add accessor macros for function control window and change EFX NIC create API to facilitate that accessors. Signed-off-by: Igor Romanov Signed-off-by: Andrew Rybchenko Reviewed-by: Andy Moreton --- drivers/common/sfc_efx/base/ef10_mcdi.c | 21 ++++++++----- drivers/common/sfc_efx/base/efx.h | 1 + drivers/common/sfc_efx/base/efx_impl.h | 39 +++++++++++++++++++++++++ drivers/common/sfc_efx/base/efx_nic.c | 9 ++++++ drivers/common/sfc_efx/base/rhead_ev.c | 2 +- drivers/common/sfc_efx/base/rhead_nic.c | 2 +- drivers/net/sfc/sfc.c | 3 +- 7 files changed, 67 insertions(+), 10 deletions(-) diff --git a/drivers/common/sfc_efx/base/ef10_mcdi.c b/drivers/common/sfc_efx/base/ef10_mcdi.c index 727f14826e..b324ec825b 100644 --- a/drivers/common/sfc_efx/base/ef10_mcdi.c +++ b/drivers/common/sfc_efx/base/ef10_mcdi.c @@ -56,7 +56,7 @@ ef10_mcdi_init( switch (enp->en_family) { #if EFSYS_OPT_RIVERHEAD case EFX_FAMILY_RIVERHEAD: - EFX_BAR_WRITED(enp, ER_GZ_MC_DB_HWRD_REG, &dword, B_FALSE); + EFX_BAR_FCW_WRITED(enp, ER_GZ_MC_DB_HWRD_REG, &dword); break; #endif /* EFSYS_OPT_RIVERHEAD */ default: @@ -166,7 +166,7 @@ ef10_mcdi_send_request( switch (enp->en_family) { #if EFSYS_OPT_RIVERHEAD case EFX_FAMILY_RIVERHEAD: - EFX_BAR_WRITED(enp, ER_GZ_MC_DB_LWRD_REG, &dword, B_FALSE); + EFX_BAR_FCW_WRITED(enp, ER_GZ_MC_DB_LWRD_REG, &dword); break; #endif /* EFSYS_OPT_RIVERHEAD */ default: @@ -179,7 +179,7 @@ ef10_mcdi_send_request( switch (enp->en_family) { #if EFSYS_OPT_RIVERHEAD case EFX_FAMILY_RIVERHEAD: - EFX_BAR_WRITED(enp, ER_GZ_MC_DB_HWRD_REG, &dword, B_FALSE); + EFX_BAR_FCW_WRITED(enp, ER_GZ_MC_DB_HWRD_REG, &dword); break; #endif /* EFSYS_OPT_RIVERHEAD */ default: @@ -237,11 +237,18 @@ ef10_mcdi_poll_reboot( old_status = emip->emi_mc_reboot_status; - EFX_STATIC_ASSERT(ER_DZ_BIU_MC_SFT_STATUS_REG_OFST == - ER_GZ_MC_SFT_STATUS_OFST); - /* Update MC reboot status word */ - EFX_BAR_TBL_READD(enp, ER_DZ_BIU_MC_SFT_STATUS_REG, 0, &dword, B_FALSE); + switch (enp->en_family) { +#if EFSYS_OPT_RIVERHEAD + case EFX_FAMILY_RIVERHEAD: + EFX_BAR_FCW_READD(enp, ER_GZ_MC_SFT_STATUS, &dword); + break; +#endif /* EFSYS_OPT_RIVERHEAD */ + default: + EFX_BAR_READD(enp, ER_DZ_BIU_MC_SFT_STATUS_REG, + &dword, B_FALSE); + break; + } new_status = dword.ed_u32[0]; /* MC has rebooted if the value has changed */ diff --git a/drivers/common/sfc_efx/base/efx.h b/drivers/common/sfc_efx/base/efx.h index 3f5cf619e5..0d4f5e5e70 100644 --- a/drivers/common/sfc_efx/base/efx.h +++ b/drivers/common/sfc_efx/base/efx.h @@ -150,6 +150,7 @@ efx_nic_create( __in efx_family_t family, __in efsys_identifier_t *esip, __in efsys_bar_t *esbp, + __in uint32_t fcw_offset, __in efsys_lock_t *eslp, __deref_out efx_nic_t **enpp); diff --git a/drivers/common/sfc_efx/base/efx_impl.h b/drivers/common/sfc_efx/base/efx_impl.h index fc0a654f80..b1457f361a 100644 --- a/drivers/common/sfc_efx/base/efx_impl.h +++ b/drivers/common/sfc_efx/base/efx_impl.h @@ -846,6 +846,7 @@ struct efx_nic_s { int ena_vi_base; int ena_vi_count; int ena_vi_shift; + uint32_t ena_fcw_base; #if EFSYS_OPT_VPD caddr_t ena_svpd; size_t ena_svpd_length; @@ -1114,6 +1115,9 @@ struct efx_txq_s { * Code used on EF10 *must* use EFX_BAR_VI_*() macros for per-VI registers, * to ensure the correct runtime VI window size is used on Medford2. * + * Code used on EF100 *must* use EFX_BAR_FCW_* macros for function control + * window registers, to ensure the correct starting offset is used. + * * Siena-only code may continue using EFX_BAR_TBL_*() macros for VI registers. */ @@ -1218,6 +1222,41 @@ struct efx_txq_s { _NOTE(CONSTANTCONDITION) \ } while (B_FALSE) +/* + * Accessors for memory BAR function control window registers. + * + * The function control window is located at an offset which can be + * non-zero in case of Riverhead. + */ + +#if EFSYS_OPT_RIVERHEAD + +#define EFX_BAR_FCW_READD(_enp, _reg, _edp) \ + do { \ + EFX_CHECK_REG((_enp), (_reg)); \ + EFSYS_BAR_READD((_enp)->en_esbp, _reg ## _OFST + \ + (_enp)->en_arch.ef10.ena_fcw_base, \ + (_edp), B_FALSE); \ + EFSYS_PROBE3(efx_bar_fcw_readd, const char *, #_reg, \ + uint32_t, _reg ## _OFST, \ + uint32_t, (_edp)->ed_u32[0]); \ + _NOTE(CONSTANTCONDITION) \ + } while (B_FALSE) + +#define EFX_BAR_FCW_WRITED(_enp, _reg, _edp) \ + do { \ + EFX_CHECK_REG((_enp), (_reg)); \ + EFSYS_PROBE3(efx_bar_fcw_writed, const char *, #_reg, \ + uint32_t, _reg ## _OFST, \ + uint32_t, (_edp)->ed_u32[0]); \ + EFSYS_BAR_WRITED((_enp)->en_esbp, _reg ## _OFST + \ + (_enp)->en_arch.ef10.ena_fcw_base, \ + (_edp), B_FALSE); \ + _NOTE(CONSTANTCONDITION) \ + } while (B_FALSE) + +#endif /* EFSYS_OPT_RIVERHEAD */ + /* * Accessors for memory BAR per-VI registers. * diff --git a/drivers/common/sfc_efx/base/efx_nic.c b/drivers/common/sfc_efx/base/efx_nic.c index 465e2c7a36..3dc287a095 100644 --- a/drivers/common/sfc_efx/base/efx_nic.c +++ b/drivers/common/sfc_efx/base/efx_nic.c @@ -215,6 +215,7 @@ efx_nic_create( __in efx_family_t family, __in efsys_identifier_t *esip, __in efsys_bar_t *esbp, + __in uint32_t fcw_offset, __in efsys_lock_t *eslp, __deref_out efx_nic_t **enpp) { @@ -316,6 +317,7 @@ efx_nic_create( EFX_FEATURE_MCDI | EFX_FEATURE_MAC_HEADER_FILTERS | EFX_FEATURE_MCDI_DMA; + enp->en_arch.ef10.ena_fcw_base = fcw_offset; break; #endif /* EFSYS_OPT_RIVERHEAD */ @@ -324,6 +326,11 @@ efx_nic_create( goto fail2; } + if ((family != EFX_FAMILY_RIVERHEAD) && (fcw_offset != 0)) { + rc = EINVAL; + goto fail3; + } + enp->en_family = family; enp->en_esip = esip; enp->en_esbp = esbp; @@ -333,6 +340,8 @@ efx_nic_create( return (0); +fail3: + EFSYS_PROBE(fail3); fail2: EFSYS_PROBE(fail2); diff --git a/drivers/common/sfc_efx/base/rhead_ev.c b/drivers/common/sfc_efx/base/rhead_ev.c index 48998ccf65..9b2e758f53 100644 --- a/drivers/common/sfc_efx/base/rhead_ev.c +++ b/drivers/common/sfc_efx/base/rhead_ev.c @@ -133,7 +133,7 @@ rhead_ev_qprime( EFX_POPULATE_DWORD_2(dword, ERF_GZ_EVQ_ID, eep->ee_index, ERF_GZ_IDX, rptr); /* EVQ_INT_PRIME lives function control window only on Riverhead */ - EFX_BAR_WRITED(enp, ER_GZ_EVQ_INT_PRIME, &dword, B_FALSE); + EFX_BAR_FCW_WRITED(enp, ER_GZ_EVQ_INT_PRIME, &dword); return (0); } diff --git a/drivers/common/sfc_efx/base/rhead_nic.c b/drivers/common/sfc_efx/base/rhead_nic.c index 7fb28eae31..a773a43bcc 100644 --- a/drivers/common/sfc_efx/base/rhead_nic.c +++ b/drivers/common/sfc_efx/base/rhead_nic.c @@ -456,7 +456,7 @@ rhead_nic_hw_unavailable( if (enp->en_reset_flags & EFX_RESET_HW_UNAVAIL) return (B_TRUE); - EFX_BAR_READD(enp, ER_GZ_MC_SFT_STATUS, &dword, B_FALSE); + EFX_BAR_FCW_READD(enp, ER_GZ_MC_SFT_STATUS, &dword); if (EFX_DWORD_FIELD(dword, EFX_DWORD_0) == 0xffffffff) goto unavail; diff --git a/drivers/net/sfc/sfc.c b/drivers/net/sfc/sfc.c index 03ea5dc128..4be65c15dc 100644 --- a/drivers/net/sfc/sfc.c +++ b/drivers/net/sfc/sfc.c @@ -1046,7 +1046,8 @@ sfc_probe(struct sfc_adapter *sa) sfc_log_init(sa, "create nic"); rte_spinlock_init(&sa->nic_lock); rc = efx_nic_create(sa->family, (efsys_identifier_t *)sa, - &sa->mem_bar, &sa->nic_lock, &enp); + &sa->mem_bar, 0, + &sa->nic_lock, &enp); if (rc != 0) goto fail_nic_create; sa->nic = enp; -- 2.17.1