From patchwork Fri Feb 5 19:29:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 377440 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB3DFC433E0 for ; Fri, 5 Feb 2021 19:34:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7673164F9B for ; Fri, 5 Feb 2021 19:34:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229638AbhBERva (ORCPT ); Fri, 5 Feb 2021 12:51:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233616AbhBERtB (ORCPT ); Fri, 5 Feb 2021 12:49:01 -0500 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 454B2C06178B; Fri, 5 Feb 2021 11:30:45 -0800 (PST) Received: by mail-wm1-x330.google.com with SMTP id t142so4727695wmt.1; Fri, 05 Feb 2021 11:30:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=wxlenn/Tv/yLURp6IteuVrvWieBU43C0FAD9g2/etSo=; b=Z1hOhXliAerhhhmmqbssJjtibOWCfZ9z8qgzR5E/2L6Mn9BHJPyVYpv1p2Nw+PH1U/ odlmfMnijZ1WuMlFHNGFbTwRDHY9hERIbHHdmqCuO/sRrTIWF+uW+se2WyB9zu+IxEHW Y0tA6kMied/QFO2y0l8c2j2dDixpHNqlYh7I1puxvxtzevifafZ6YrKL2whZh7e3fWEK 7+y6wRjbN6CGsw1OaazesGCyKc6zIVXAK+2zMtr8RR1w0WDuK+jVbDmO2hono0BiQhnF F8tbl/oEmFoR2Rd0G/dBXt5P+HUuxQcTZwMjGgQFlHc5zjxAY2Up0Abgh5NMfT9TXsCN oIuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=wxlenn/Tv/yLURp6IteuVrvWieBU43C0FAD9g2/etSo=; b=pszfv9MRkBf2xqXGxQenqNu/X8w1g8nfaImbFcbNys2hatFK1H4tRSt3V2xA0emCNh JOmgjOYwhvPA9XfJcHKeFiqA9zh3mdMsiyf298CcfVZ+4U3kRwRvcBBkWbga6a+JnaWO plTCyam+uunfQPTZ9SEB+wsD++K1Mus99d9Bx2vZ8+33JuC9Z/FyQs3fJXMtGNs/Px8y flojuJEzvmz1fwkL7aLaJE/e4kYkg0Qx6TD1rjztyWWM+ZjYRjkfFnre/oqaiGJcPKza eirHWthS8EHE+Hrr2SEWiLBAeIdwrgi8FiFltAvPTI8B7OHXBxVz5lAG/EGMOrXByySB s74w== X-Gm-Message-State: AOAM5314KzzqsHCQqo0MSK0TgP34KY1BO9uEKoYqWuynkiURtw00Z5zP BcIEYc62A77/i91sqA2sD7pKYeyhERBJHQ== X-Google-Smtp-Source: ABdhPJzncY0EuSqGZ6rXLfzFOF8pRlKs6s9GECJoG3UMdAsGMPzG9SYt3+lm37zFmYsPeJE0fSulrg== X-Received: by 2002:a7b:cf33:: with SMTP id m19mr4848954wmg.53.1612553443819; Fri, 05 Feb 2021 11:30:43 -0800 (PST) Received: from ?IPv6:2003:ea:8f1f:ad00:11de:46a1:319f:d28? (p200300ea8f1fad0011de46a1319f0d28.dip0.t-ipconnect.de. [2003:ea:8f1f:ad00:11de:46a1:319f:d28]) by smtp.googlemail.com with ESMTPSA id u10sm9206451wmj.40.2021.02.05.11.30.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 05 Feb 2021 11:30:43 -0800 (PST) Subject: [PATCH resend net-next v2 2/3] PCI/VPD: Change Chelsio T4 quirk to provide access to full virtual address space From: Heiner Kallweit To: Raju Rangoju , Jakub Kicinski , David Miller , Bjorn Helgaas Cc: "linux-pci@vger.kernel.org" , "netdev@vger.kernel.org" References: <6658af1a-88fc-1389-0126-77201b4af2b3@gmail.com> Message-ID: <6bf6319f-acaa-c114-d10b-cb9b7d469968@gmail.com> Date: Fri, 5 Feb 2021 20:29:45 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: <6658af1a-88fc-1389-0126-77201b4af2b3@gmail.com> Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org cxgb4 uses the full VPD address space for accessing its EEPROM (with some mapping, see t4_eeprom_ptov()). In cudbg_collect_vpd_data() it sets the VPD len to 32K (PCI_VPD_MAX_SIZE), and then back to 2K (CUDBG_VPD_PF_SIZE). Having official (structured) and inofficial (unstructured) VPD data violates the PCI spec, let's set VPD len according to all data that can be accessed via PCI VPD access, no matter of its structure. Signed-off-by: Heiner Kallweit --- drivers/pci/vpd.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/pci/vpd.c b/drivers/pci/vpd.c index 7915d10f9..06a7954d0 100644 --- a/drivers/pci/vpd.c +++ b/drivers/pci/vpd.c @@ -633,9 +633,8 @@ static void quirk_chelsio_extend_vpd(struct pci_dev *dev) /* * If this is a T3-based adapter, there's a 1KB VPD area at offset * 0xc00 which contains the preferred VPD values. If this is a T4 or - * later based adapter, the special VPD is at offset 0x400 for the - * Physical Functions (the SR-IOV Virtual Functions have no VPD - * Capabilities). The PCI VPD Access core routines will normally + * later based adapter, provide access to the full virtual EEPROM + * address space. The PCI VPD Access core routines will normally * compute the size of the VPD by parsing the VPD Data Structure at * offset 0x000. This will result in silent failures when attempting * to accesses these other VPD areas which are beyond those computed @@ -644,7 +643,7 @@ static void quirk_chelsio_extend_vpd(struct pci_dev *dev) if (chip == 0x0 && prod >= 0x20) pci_set_vpd_size(dev, 8192); else if (chip >= 0x4 && func < 0x8) - pci_set_vpd_size(dev, 2048); + pci_set_vpd_size(dev, PCI_VPD_MAX_SIZE); } DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, PCI_ANY_ID, From patchwork Fri Feb 5 19:30:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 377439 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 622B4C433E6 for ; Fri, 5 Feb 2021 19:36:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 236C064F9B for ; Fri, 5 Feb 2021 19:36:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233597AbhBERxH (ORCPT ); Fri, 5 Feb 2021 12:53:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233390AbhBERtF (ORCPT ); Fri, 5 Feb 2021 12:49:05 -0500 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA38FC06178C; Fri, 5 Feb 2021 11:30:48 -0800 (PST) Received: by mail-wr1-x432.google.com with SMTP id v15so8947588wrx.4; Fri, 05 Feb 2021 11:30:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=XrFiGb4s98X8FFWeanrSHmTuST16C6ouipnGlKmt0Hk=; b=bgHYb32YstYIHcrPptYiIA4Y0YMRkTcRTvt8VvsBpGi/fJgrvP927ZBv+p2ga3j3Nq GjQawqle76fC+iM8D+PlmcjXFdvQTMIeCzWNhdX242tWt5KHwwZzJQ5/+QXfqtDWx6/V 0rRaCUvWzZ8G5C5gXL6lgydPSjzC2DLfDMBq0bOR3o2PB2B3TVQxd7lP7K/+uzsxFUGd hWvnQAQDrZXRcMNe+nHknuRIpC48u/llBf254ef2ZQyBj4l3nHhWMw31IAMRvsfLoxpe GX5TgLqKK37hNgy1H2MR1DHLUdxiav7OpRrV7AU+ZBG4mWyR0PUdBvyw+wwsf5oyuiMo Y79w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=XrFiGb4s98X8FFWeanrSHmTuST16C6ouipnGlKmt0Hk=; b=li+R+1ZNP4NWFdyDhplsBY9z/Pq4zmO5kAeQ138LJdQIJ7dIvywfEyozrY35zKVTBZ QkE+nUvneWKrwpkFkLIOzJkl74U5bQhTpplWBdZ4MCkjVXiBMw4NRQ1pialCk4tmD7s4 fdN6fQ+ojScEFFUsYg8SM1jmV1P3UJApEOQNQJ5YPXvoEAttEpNg+ZB5tcJ7NS0x5f/v VdWXk+Xif1iXSz0IRyEWiJ3D/bMragYvCUhAUXjW6inr4tXiD/mxw/TxwIYo5cFOai4r eeH9zul0kJcaehFJaWtr1nF23i/7g2fX4oVw14Y1bPw+GE9CKpWtUYkoeglsiGM49QmV fNvQ== X-Gm-Message-State: AOAM5321w4U8S/7RC+iX4fzfwCwTf8y/B/VLFBFGuMO3cyRDml5kjYcQ tNkRqhHiJxXCa2cPZw8q6fmkPZr1AstFGg== X-Google-Smtp-Source: ABdhPJxjpv7UVXJixjrpqYanv+ZmjNv5tgtJlrQQXXti5YUIdcqf10okJetJTeoYLucFqvspOfZVkA== X-Received: by 2002:a5d:4204:: with SMTP id n4mr6860605wrq.196.1612553447331; Fri, 05 Feb 2021 11:30:47 -0800 (PST) Received: from ?IPv6:2003:ea:8f1f:ad00:11de:46a1:319f:d28? (p200300ea8f1fad0011de46a1319f0d28.dip0.t-ipconnect.de. [2003:ea:8f1f:ad00:11de:46a1:319f:d28]) by smtp.googlemail.com with ESMTPSA id d3sm13854121wrp.79.2021.02.05.11.30.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 05 Feb 2021 11:30:46 -0800 (PST) Subject: [PATCH resend net-next v2 3/3] cxgb4: remove changing VPD len From: Heiner Kallweit To: Raju Rangoju , Jakub Kicinski , David Miller , Bjorn Helgaas Cc: "linux-pci@vger.kernel.org" , "netdev@vger.kernel.org" References: <6658af1a-88fc-1389-0126-77201b4af2b3@gmail.com> Message-ID: <782626be-d8e8-e7a6-849f-552941d3f924@gmail.com> Date: Fri, 5 Feb 2021 20:30:30 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: <6658af1a-88fc-1389-0126-77201b4af2b3@gmail.com> Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Now that the PCI VPD for Chelsio devices from T4 has been changed and VPD len is set to PCI_VPD_MAX_SIZE (32K), we don't have to change the VPD len any longer. Signed-off-by: Heiner Kallweit --- .../net/ethernet/chelsio/cxgb4/cudbg_entity.h | 1 - .../net/ethernet/chelsio/cxgb4/cudbg_lib.c | 21 ++++--------------- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/drivers/net/ethernet/chelsio/cxgb4/cudbg_entity.h b/drivers/net/ethernet/chelsio/cxgb4/cudbg_entity.h index 876f90e57..02ccb610a 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cudbg_entity.h +++ b/drivers/net/ethernet/chelsio/cxgb4/cudbg_entity.h @@ -220,7 +220,6 @@ struct cudbg_mps_tcam { u8 reserved[2]; }; -#define CUDBG_VPD_PF_SIZE 0x800 #define CUDBG_SCFG_VER_ADDR 0x06 #define CUDBG_SCFG_VER_LEN 4 #define CUDBG_VPD_VER_ADDR 0x18c7 diff --git a/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c b/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c index 75474f810..addac5518 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c @@ -2689,7 +2689,7 @@ int cudbg_collect_vpd_data(struct cudbg_init *pdbg_init, u32 scfg_vers, vpd_vers, fw_vers; struct cudbg_vpd_data *vpd_data; struct vpd_params vpd = { 0 }; - int rc, ret; + int rc; rc = t4_get_raw_vpd_params(padap, &vpd); if (rc) @@ -2699,24 +2699,11 @@ int cudbg_collect_vpd_data(struct cudbg_init *pdbg_init, if (rc) return rc; - /* Serial Configuration Version is located beyond the PF's vpd size. - * Temporarily give access to entire EEPROM to get it. - */ - rc = pci_set_vpd_size(padap->pdev, EEPROMVSIZE); - if (rc < 0) - return rc; - - ret = cudbg_read_vpd_reg(padap, CUDBG_SCFG_VER_ADDR, CUDBG_SCFG_VER_LEN, - &scfg_vers); - - /* Restore back to original PF's vpd size */ - rc = pci_set_vpd_size(padap->pdev, CUDBG_VPD_PF_SIZE); - if (rc < 0) + rc = cudbg_read_vpd_reg(padap, CUDBG_SCFG_VER_ADDR, CUDBG_SCFG_VER_LEN, + &scfg_vers); + if (rc) return rc; - if (ret) - return ret; - rc = cudbg_read_vpd_reg(padap, CUDBG_VPD_VER_ADDR, CUDBG_VPD_VER_LEN, vpd_str); if (rc)