From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B6DA2A0524 for ; Fri, 5 Feb 2021 12:39:35 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A919C4067B; Fri, 5 Feb 2021 12:39:35 +0100 (CET) Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) by mails.dpdk.org (Postfix) with ESMTP id 70B3F4067B for ; Fri, 5 Feb 2021 12:39:33 +0100 (CET) Received: by mail-wr1-f49.google.com with SMTP id p15so7291871wrq.8 for ; Fri, 05 Feb 2021 03:39:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Wtsh/W+u2lalOCQTQQjpe3KjWO7M9sgfjrh+jFlnLbc=; b=uhzTXsCa6IiokacFxHeqqzYfYoijxS8Noo0x8hNGWoxZujyxHveuTDQj5f9CPfL1EV WkXYPAETX6CaKgcZ3w2QmVcpyNTSIkf34v/vS2voXJWbV5XGjVNXY1vQnvomgevxVVZi yvObXa5Y3/2QhThTW7vGQ7q7JoQoPsR2c9EvNR7SJe4tS/bjLZxRx3mKQK2qmnJ53z79 /sSIGFflOEGE95O77GopfUkKP2FqawEgYTWYlN3SKC2avnREtVmjzK1uklWXjsKGzuKF 7VTl4jYxXhfRcCznGDjNEQ3Z8KXTC07IRAvt3jUz4jyBhzWrhVXLT0XzCWSKpysiIGu3 ESQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Wtsh/W+u2lalOCQTQQjpe3KjWO7M9sgfjrh+jFlnLbc=; b=RDa+NDJ9JUACCpRq1UXZCfW64aX0xLs7dlon8IpG1/f7ibBk282PxS27tbykXf2+JE 5fFOpuO/PmYa+k+TjmRUX1Wz8F6NvRsScy4YWqEqfo/N/PQkgoMMFlSXS4+CaDqWSl5V 0Gi8FSMXvpOWvfiCayAqDI2+yMeqwPnJPE2mUOqI9mE58Dsw7Zb5hO5DLVI4D+S66p3Q b8tBzdPcQnwdo6IBk3sTTNa3IceV8FlrUjVZEtPNYW1MWhjjOIS+RfmnlXLSKQOgeyBX jyPEUhkP+CRBFPziZCCGdpW02KE9rm5JciRSnms2mkaxgXeT5JIPtlHcxVA5MnEAbx1H nSPg== X-Gm-Message-State: AOAM532e1we/Qeq5jjPZzsiwde6psy5yCSRNV+tRzGbaoXcMLJXMqP5t Odl6HpXeHMCMhekNrDE+NOuvbbHoOYjUGUa+ X-Google-Smtp-Source: ABdhPJwKFo1ZbRpg6eWqf/iUbOFw5dsfaNFu0WEXf/aFarSxt5l8iJQBJOfPNFuyk7xmx4CL0WiuAQ== X-Received: by 2002:adf:dc88:: with SMTP id r8mr4578359wrj.401.1612525173246; Fri, 05 Feb 2021 03:39:33 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id n193sm8646956wmb.0.2021.02.05.03.39.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Feb 2021 03:39:32 -0800 (PST) From: luca.boccassi@gmail.com To: Heinrich Kuhn Cc: Simon Horman , Louis Peens , dpdk stable Date: Fri, 5 Feb 2021 11:19:13 +0000 Message-Id: <20210205111920.1272063-267-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210205111920.1272063-1-luca.boccassi@gmail.com> References: <20210205111920.1272063-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/nfp: read chip model from PluDevice register' has been queued to stable release 20.11.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 20.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/07/21. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/deedace7635457819b2c51369282f307d971ab4f Thanks. Luca Boccassi --- >From deedace7635457819b2c51369282f307d971ab4f Mon Sep 17 00:00:00 2001 From: Heinrich Kuhn Date: Mon, 25 Jan 2021 17:25:44 +0200 Subject: [PATCH] net/nfp: read chip model from PluDevice register [ upstream commit c0a8b0247533ccae77af853600e58565ad94b0aa ] For newer smartNIC NVRAM versions the chip model should be read from the PluDevice register as it provides the authoritative chip model/revision. This method of reading the chip model is backwards compatible with legacy NVRAM versions too. Since the model number is purely used for reporting purposes, follow the hardware team convention of subtracting 0x10 from the PluDevice register to obtain the chip model/revision number. Fixes: c7e9729da6b5 ("net/nfp: support CPP") Signed-off-by: Heinrich Kuhn Signed-off-by: Simon Horman Reviewed-by: Louis Peens --- drivers/net/nfp/nfpcore/nfp_cpp.h | 2 +- drivers/net/nfp/nfpcore/nfp_cppcore.c | 49 ++++++++++++--------------- 2 files changed, 23 insertions(+), 28 deletions(-) diff --git a/drivers/net/nfp/nfpcore/nfp_cpp.h b/drivers/net/nfp/nfpcore/nfp_cpp.h index 1427954c17..08d656da14 100644 --- a/drivers/net/nfp/nfpcore/nfp_cpp.h +++ b/drivers/net/nfp/nfpcore/nfp_cpp.h @@ -170,7 +170,7 @@ void *nfp_cpp_priv(struct nfp_cpp *cpp); */ void *nfp_cpp_area_priv(struct nfp_cpp_area *cpp_area); -uint32_t __nfp_cpp_model_autodetect(struct nfp_cpp *cpp); +uint32_t __nfp_cpp_model_autodetect(struct nfp_cpp *cpp, uint32_t *model); /* * NFP CPP core interface for CPP clients. diff --git a/drivers/net/nfp/nfpcore/nfp_cppcore.c b/drivers/net/nfp/nfpcore/nfp_cppcore.c index dec4a8b6d1..6d629430d4 100644 --- a/drivers/net/nfp/nfpcore/nfp_cppcore.c +++ b/drivers/net/nfp/nfpcore/nfp_cppcore.c @@ -22,8 +22,9 @@ #define NFP_PL_DEVICE_ID 0x00000004 #define NFP_PL_DEVICE_ID_MASK 0xff - -#define NFP6000_ARM_GCSR_SOFTMODEL0 0x00400144 +#define NFP_PL_DEVICE_PART_MASK 0xffff0000 +#define NFP_PL_DEVICE_MODEL_MASK (NFP_PL_DEVICE_PART_MASK | \ + NFP_PL_DEVICE_ID_MASK) void nfp_cpp_priv_set(struct nfp_cpp *cpp, void *priv) @@ -46,13 +47,18 @@ nfp_cpp_model_set(struct nfp_cpp *cpp, uint32_t model) uint32_t nfp_cpp_model(struct nfp_cpp *cpp) { + int err; + uint32_t model; + if (!cpp) return NFP_CPP_MODEL_INVALID; - if (cpp->model == 0) - cpp->model = __nfp_cpp_model_autodetect(cpp); + err = __nfp_cpp_model_autodetect(cpp, &model); - return cpp->model; + if (err < 0) + return err; + + return model; } void @@ -389,9 +395,6 @@ nfp_xpb_to_cpp(struct nfp_cpp *cpp, uint32_t *xpb_addr) uint32_t xpb; int island; - if (!NFP_CPP_MODEL_IS_6000(cpp->model)) - return 0; - xpb = NFP_CPP_ID(14, NFP_CPP_ACTION_RW, 0); /* @@ -796,29 +799,21 @@ nfp_cpp_area_fill(struct nfp_cpp_area *area, unsigned long offset, * as those are model-specific */ uint32_t -__nfp_cpp_model_autodetect(struct nfp_cpp *cpp) +__nfp_cpp_model_autodetect(struct nfp_cpp *cpp, uint32_t *model) { - uint32_t arm_id = NFP_CPP_ID(NFP_CPP_TARGET_ARM, 0, 0); - uint32_t model = 0; + uint32_t reg; + int err; - if (nfp_cpp_readl(cpp, arm_id, NFP6000_ARM_GCSR_SOFTMODEL0, &model)) - return 0; + err = nfp_xpb_readl(cpp, NFP_XPB_DEVICE(1, 1, 16) + NFP_PL_DEVICE_ID, + ®); + if (err < 0) + return err; - if (NFP_CPP_MODEL_IS_6000(model)) { - uint32_t tmp; + *model = reg & NFP_PL_DEVICE_MODEL_MASK; + if (*model & NFP_PL_DEVICE_ID_MASK) + *model -= 0x10; - nfp_cpp_model_set(cpp, model); - - /* The PL's PluDeviceID revision code is authoratative */ - model &= ~0xff; - if (nfp_xpb_readl(cpp, NFP_XPB_DEVICE(1, 1, 16) + - NFP_PL_DEVICE_ID, &tmp)) - return 0; - - model |= (NFP_PL_DEVICE_ID_MASK & tmp) - 0x10; - } - - return model; + return 0; } /* -- 2.29.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-02-05 11:18:40.974539078 +0000 +++ 0267-net-nfp-read-chip-model-from-PluDevice-register.patch 2021-02-05 11:18:29.346701392 +0000 @@ -1 +1 @@ -From c0a8b0247533ccae77af853600e58565ad94b0aa Mon Sep 17 00:00:00 2001 +From deedace7635457819b2c51369282f307d971ab4f Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit c0a8b0247533ccae77af853600e58565ad94b0aa ] + @@ -16 +17,0 @@ -Cc: stable@dpdk.org @@ -27 +28 @@ -index 78f7b8ca2f..720d3989e6 100644 +index 1427954c17..08d656da14 100644 @@ -40 +41 @@ -index 848c452eab..f91049383e 100644 +index dec4a8b6d1..6d629430d4 100644