Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4584989rwd; Sun, 11 Jun 2023 10:21:48 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5jk0INIvqCanpUYVYljYGaFX45duLswInBdZriIiWuCqZcMAXksmOdyHsgXK7lGCVG/YBc X-Received: by 2002:a17:907:3f20:b0:978:82fd:758b with SMTP id hq32-20020a1709073f2000b0097882fd758bmr6984076ejc.29.1686504108023; Sun, 11 Jun 2023 10:21:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686504108; cv=none; d=google.com; s=arc-20160816; b=pdkz3Rk1kziMT5NoU8cZa2JxMHe6JslSpCkBDFYg9IdDgCvvv5d0WbBoFzLcwWlKte 21Fx9/27dRDeZPE/niXqA1PLlpdwIsUx+y2rcegVoUWsgD68lx+/bVsFIvSB0Z+2hUa0 B/goQDcgT2jYzwSJ6PyIyVjTYc1UHByIDmBP1+LzVvClvjmbM+bGpCtLTfo1i+2FqtX+ 2FoW/iqp9uXo3RnKAhTEJqkkHs6xdp7Wu9sEoHfzav8bQWukmHNOdUhzyikeSv/lKXR6 YA8vvcn/ca5XOa0gqJFRcm9eKZJgwncsG//2fo8+X0WFHzPdVLsTsuSsxjFpZxYnDptZ qSLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date; bh=GTQgYOq1NCjYALleIk2DxLTpwSUi5p+ZwBiUC1Rpc4U=; b=Xa+A17d+GRtYzJ+abxJMfQao1MWpr7ULUl99rU4AQloK1MR6Ah5eF1otya4qJWx9R1 w9ArDBdtlNZn6711X43Qo0ZPleWlT72RH9t9LUS1b8EtPKwb7occhQDGIXluxrGFxO0b HxCOfQRSHzB0bqTz1ur5Em5qIZ8QV5uDuCHNmLFEe8s/blub35+5+I+zhkgRZPm0+eBJ EdhQXIzw/1/7w6qgwBDMlpNt3S316ZVFpBDDG2Mso1gek1HZPc00VALBERJflONLRa7B 8UQKWA8xHSDel8ELRGGgYdkAhw+Acippr4ep626KUTU8P2IT5Ab0UaeKSnePdyH0Ql/9 vnkQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y14-20020a17090614ce00b0095317ae767esi4059227ejc.46.2023.06.11.10.21.23; Sun, 11 Jun 2023 10:21:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231355AbjFKRTk (ORCPT + 99 others); Sun, 11 Jun 2023 13:19:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231451AbjFKRTi (ORCPT ); Sun, 11 Jun 2023 13:19:38 -0400 Received: from angie.orcam.me.uk (angie.orcam.me.uk [78.133.224.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A93B5E7D for ; Sun, 11 Jun 2023 10:19:28 -0700 (PDT) Received: by angie.orcam.me.uk (Postfix, from userid 500) id C29129200BF; Sun, 11 Jun 2023 19:19:27 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id C025E9200BB; Sun, 11 Jun 2023 18:19:27 +0100 (BST) Date: Sun, 11 Jun 2023 18:19:27 +0100 (BST) From: "Maciej W. Rozycki" To: Bjorn Helgaas , Mahesh J Salgaonkar , Oliver O'Halloran , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Saeed Mahameed , Leon Romanovsky , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni cc: Alex Williamson , Lukas Wunner , Mika Westerberg , Stefan Roese , Jim Wilson , David Abdurachmanov , =?UTF-8?Q?Pali_Roh=C3=A1r?= , linux-pci@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-rdma@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v9 04/14] PCI: Initialize `link_active_reporting' earlier In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Determine whether Data Link Layer Link Active Reporting is available ahead of calling any fixups so that the cached value can be used there and later on. Signed-off-by: Maciej W. Rozycki --- No change from v8. Changes from v7: - Reorder from 3/7. Changes from v6: - Regenerate against 6.3-rc5. New change in v6. --- drivers/pci/probe.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) linux-pcie-link-active-reporting-early.diff Index: linux-macro/drivers/pci/probe.c =================================================================== --- linux-macro.orig/drivers/pci/probe.c +++ linux-macro/drivers/pci/probe.c @@ -820,7 +820,6 @@ static void pci_set_bus_speed(struct pci pcie_capability_read_dword(bridge, PCI_EXP_LNKCAP, &linkcap); bus->max_bus_speed = pcie_link_speed[linkcap & PCI_EXP_LNKCAP_SLS]; - bridge->link_active_reporting = !!(linkcap & PCI_EXP_LNKCAP_DLLLARC); pcie_capability_read_word(bridge, PCI_EXP_LNKSTA, &linksta); pcie_update_link_speed(bus, linksta); @@ -1829,6 +1828,7 @@ int pci_setup_device(struct pci_dev *dev int err, pos = 0; struct pci_bus_region region; struct resource *res; + u32 linkcap; hdr_type = pci_hdr_type(dev); @@ -1876,6 +1876,10 @@ int pci_setup_device(struct pci_dev *dev /* "Unknown power state" */ dev->current_state = PCI_UNKNOWN; + /* Set it early to make it available to fixups, etc. */ + pcie_capability_read_dword(dev, PCI_EXP_LNKCAP, &linkcap); + dev->link_active_reporting = !!(linkcap & PCI_EXP_LNKCAP_DLLLARC); + /* Early fixups, before probing the BARs */ pci_fixup_device(pci_fixup_early, dev);