From patchwork Thu Sep 24 12:11:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Rybchenko X-Patchwork-Id: 78683 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3DF1FA04B1; Thu, 24 Sep 2020 14:13:42 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id F0B5B1DE28; Thu, 24 Sep 2020 14:13:02 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id A56561DE03 for ; Thu, 24 Sep 2020 14:12:52 +0200 (CEST) Received: from mx1-us1.ppe-hosted.com (unknown [10.7.65.60]) by dispatch1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id 286B460084 for ; Thu, 24 Sep 2020 12:12:52 +0000 (UTC) Received: from us4-mdac16-46.ut7.mdlocal (unknown [10.7.66.13]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id 273BB2009A for ; Thu, 24 Sep 2020 12:12:52 +0000 (UTC) X-Virus-Scanned: Proofpoint Essentials engine Received: from mx1-us1.ppe-hosted.com (unknown [10.7.65.175]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 94E9E1C0053 for ; Thu, 24 Sep 2020 12:12:51 +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 4CC3B70006D for ; Thu, 24 Sep 2020 12:12:51 +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; Thu, 24 Sep 2020 13:12:46 +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; Thu, 24 Sep 2020 13:12:46 +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 08OCCkbH025878 for ; Thu, 24 Sep 2020 13:12:46 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 12C301613AB for ; Thu, 24 Sep 2020 13:12:46 +0100 (BST) From: Andrew Rybchenko To: Date: Thu, 24 Sep 2020 13:11:42 +0100 Message-ID: <1600949555-28043-8-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1600949555-28043-1-git-send-email-arybchenko@solarflare.com> References: <1600764594-14752-1-git-send-email-arybchenko@solarflare.com> <1600949555-28043-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.6.1012-25674.003 X-TM-AS-Result: No-7.886700-8.000000-10 X-TMASE-MatchedRID: 9ZfeEmZY6RH/xPKSgLvkLbzgL/eLACDEaeMaKzvXUpljLp8Cm8vwF7KB pljvKsfOfGzuoVn0Vs6PQi9XuOWoOC4MnFER4ZGiIf0TE1VduNsSUsfu0Jv3SvmeJRfwluYGm35 0w8/mtjl9nXBYBc7+9RLUZu/IHKwxHvtWdNrtrGoUnHnr/GbaT1WiBZGwRpH+2YOMBqtP/AFLFl bCyJ/C+ecxpG+880GgUyPx0ZosLZ9UwnXZllYh+r5k9lVEXoZaVFeUPAjsd8Yed11F9IsKFIaic YvSM3syozoW+JKZpxKwK143TKjuAgTsy5Ctk/ajSHCU59h5KrEdLjiwtocA8nQWhLVqLFM1sx9U DlVfYMZnHQJ2jUDp74Ay6p60ZV62fJ5/bZ6npdiyO81X3yak81gQYXZLQLSd28j/as3Groc1ZtN BlUZ4dD1QIRh+j2bVN9QaJL5xdy1+3BndfXUhXQ== X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--7.886700-8.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.6.1012-25674.003 X-MDID: 1600949572-JVYlq94Dv0-3 Subject: [dpdk-dev] [PATCH v3 07/60] common/sfc_efx/base: use EF10 MCDI methods for Riverhead 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" MCDI on Riverhead is very close to the EF10 and there is no point to duplicate the code. Signed-off-by: Andrew Rybchenko Reviewed-by: Andy Moreton --- drivers/common/sfc_efx/base/ef10_mcdi.c | 46 ++++++++++++++++++++----- drivers/common/sfc_efx/base/efx.h | 8 ++--- drivers/common/sfc_efx/base/efx_impl.h | 4 +-- drivers/common/sfc_efx/base/efx_mcdi.c | 21 +++++++++++ 4 files changed, 65 insertions(+), 14 deletions(-) diff --git a/drivers/common/sfc_efx/base/ef10_mcdi.c b/drivers/common/sfc_efx/base/ef10_mcdi.c index 9e8a0c1f69..727f14826e 100644 --- a/drivers/common/sfc_efx/base/ef10_mcdi.c +++ b/drivers/common/sfc_efx/base/ef10_mcdi.c @@ -8,7 +8,7 @@ #include "efx_impl.h" -#if EFX_OPTS_EF10() +#if EFSYS_OPT_RIVERHEAD || EFX_OPTS_EF10() #if EFSYS_OPT_MCDI @@ -27,7 +27,7 @@ ef10_mcdi_init( efx_dword_t dword; efx_rc_t rc; - EFSYS_ASSERT(EFX_FAMILY_IS_EF10(enp)); + EFSYS_ASSERT(EFX_FAMILY_IS_EF100(enp) || EFX_FAMILY_IS_EF10(enp)); EFSYS_ASSERT(enp->en_features & EFX_FEATURE_MCDI_DMA); /* @@ -53,7 +53,16 @@ ef10_mcdi_init( goto fail2; } EFX_POPULATE_DWORD_1(dword, EFX_DWORD_0, 1); - EFX_BAR_WRITED(enp, ER_DZ_MC_DB_HWRD_REG, &dword, B_FALSE); + 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); + break; +#endif /* EFSYS_OPT_RIVERHEAD */ + default: + EFX_BAR_WRITED(enp, ER_DZ_MC_DB_HWRD_REG, &dword, B_FALSE); + break; + } /* Save initial MC reboot status */ (void) ef10_mcdi_poll_reboot(enp); @@ -133,7 +142,7 @@ ef10_mcdi_send_request( efx_dword_t dword; unsigned int pos; - EFSYS_ASSERT(EFX_FAMILY_IS_EF10(enp)); + EFSYS_ASSERT(EFX_FAMILY_IS_EF100(enp) || EFX_FAMILY_IS_EF10(enp)); /* Write the header */ for (pos = 0; pos < hdr_len; pos += sizeof (efx_dword_t)) { @@ -154,11 +163,29 @@ ef10_mcdi_send_request( /* Ring the doorbell to post the command DMA address to the MC */ EFX_POPULATE_DWORD_1(dword, EFX_DWORD_0, EFSYS_MEM_ADDR(esmp) >> 32); - EFX_BAR_WRITED(enp, ER_DZ_MC_DB_LWRD_REG, &dword, B_FALSE); + 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); + break; +#endif /* EFSYS_OPT_RIVERHEAD */ + default: + EFX_BAR_WRITED(enp, ER_DZ_MC_DB_LWRD_REG, &dword, B_FALSE); + break; + } EFX_POPULATE_DWORD_1(dword, EFX_DWORD_0, EFSYS_MEM_ADDR(esmp) & 0xffffffff); - EFX_BAR_WRITED(enp, ER_DZ_MC_DB_HWRD_REG, &dword, B_FALSE); + 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); + break; +#endif /* EFSYS_OPT_RIVERHEAD */ + default: + EFX_BAR_WRITED(enp, ER_DZ_MC_DB_HWRD_REG, &dword, B_FALSE); + break; + } } __checkReturn boolean_t @@ -210,6 +237,9 @@ 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); new_status = dword.ed_u32[0]; @@ -255,7 +285,7 @@ ef10_mcdi_feature_supported( uint32_t privilege_mask = encp->enc_privilege_mask; efx_rc_t rc; - EFSYS_ASSERT(EFX_FAMILY_IS_EF10(enp)); + EFSYS_ASSERT(EFX_FAMILY_IS_EF100(enp) || EFX_FAMILY_IS_EF10(enp)); /* * Use privilege mask state at MCDI attach. @@ -316,4 +346,4 @@ ef10_mcdi_feature_supported( #endif /* EFSYS_OPT_MCDI */ -#endif /* EFX_OPTS_EF10() */ +#endif /* EFSYS_OPT_RIVERHEAD || EFX_OPTS_EF10() */ diff --git a/drivers/common/sfc_efx/base/efx.h b/drivers/common/sfc_efx/base/efx.h index 2082efe023..c7fe814ca0 100644 --- a/drivers/common/sfc_efx/base/efx.h +++ b/drivers/common/sfc_efx/base/efx.h @@ -243,8 +243,8 @@ efx_nic_check_pcie_link_speed( #if EFSYS_OPT_MCDI -#if EFX_OPTS_EF10() -/* EF10 architecture NICs require MCDIv2 commands */ +#if EFSYS_OPT_RIVERHEAD || EFX_OPTS_EF10() +/* EF10 architecture and Riverhead NICs require MCDIv2 commands */ #define WITH_MCDI_V2 1 #endif @@ -1438,11 +1438,11 @@ typedef struct efx_nic_cfg_s { #if EFSYS_OPT_BIST uint32_t enc_bist_mask; #endif /* EFSYS_OPT_BIST */ -#if EFX_OPTS_EF10() +#if EFSYS_OPT_RIVERHEAD || EFX_OPTS_EF10() uint32_t enc_pf; uint32_t enc_vf; uint32_t enc_privilege_mask; -#endif /* EFX_OPTS_EF10() */ +#endif /* EFSYS_OPT_RIVERHEAD || EFX_OPTS_EF10() */ boolean_t enc_bug26807_workaround; boolean_t enc_bug35388_workaround; boolean_t enc_bug41750_workaround; diff --git a/drivers/common/sfc_efx/base/efx_impl.h b/drivers/common/sfc_efx/base/efx_impl.h index f891172086..c7edeaa000 100644 --- a/drivers/common/sfc_efx/base/efx_impl.h +++ b/drivers/common/sfc_efx/base/efx_impl.h @@ -37,9 +37,9 @@ #include "medford2_impl.h" #endif /* EFSYS_OPT_MEDFORD2 */ -#if EFX_OPTS_EF10() +#if EFSYS_OPT_RIVERHEAD || EFX_OPTS_EF10() #include "ef10_impl.h" -#endif /* EFX_OPTS_EF10() */ +#endif /* EFSYS_OPT_RIVERHEAD || EFX_OPTS_EF10() */ #ifdef __cplusplus extern "C" { diff --git a/drivers/common/sfc_efx/base/efx_mcdi.c b/drivers/common/sfc_efx/base/efx_mcdi.c index 8cd651f529..dec3a170a7 100644 --- a/drivers/common/sfc_efx/base/efx_mcdi.c +++ b/drivers/common/sfc_efx/base/efx_mcdi.c @@ -60,6 +60,21 @@ static const efx_mcdi_ops_t __efx_mcdi_ef10_ops = { #endif /* EFX_OPTS_EF10() */ +#if EFSYS_OPT_RIVERHEAD + +static const efx_mcdi_ops_t __efx_mcdi_rhead_ops = { + ef10_mcdi_init, /* emco_init */ + ef10_mcdi_send_request, /* emco_send_request */ + ef10_mcdi_poll_reboot, /* emco_poll_reboot */ + ef10_mcdi_poll_response, /* emco_poll_response */ + ef10_mcdi_read_response, /* emco_read_response */ + ef10_mcdi_fini, /* emco_fini */ + ef10_mcdi_feature_supported, /* emco_feature_supported */ + ef10_mcdi_get_timeout, /* emco_get_timeout */ +}; + +#endif /* EFSYS_OPT_RIVERHEAD */ + __checkReturn efx_rc_t @@ -98,6 +113,12 @@ efx_mcdi_init( break; #endif /* EFSYS_OPT_MEDFORD2 */ +#if EFSYS_OPT_RIVERHEAD + case EFX_FAMILY_RIVERHEAD: + emcop = &__efx_mcdi_rhead_ops; + break; +#endif /* EFSYS_OPT_RIVERHEAD */ + default: EFSYS_ASSERT(0); rc = ENOTSUP;