Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp6557574rwl; Tue, 4 Apr 2023 14:58:15 -0700 (PDT) X-Google-Smtp-Source: AKy350YFSwB7NIDLLsrtTAQLPnFg+I6N3zKNw8rHLMzJhLReoMaTjpfD9AgcmpILf7v9QlCYFl+7 X-Received: by 2002:a17:907:77d0:b0:8b2:7564:dfd5 with SMTP id kz16-20020a17090777d000b008b27564dfd5mr774698ejc.60.1680645495067; Tue, 04 Apr 2023 14:58:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680645495; cv=none; d=google.com; s=arc-20160816; b=enT/k/yAOfNPIn6aw8w1XiEY51mzeibgnth8lbMQVxVUA9hzN1uvcTj1Rt3IxxGmWo Nic0QdVcRH1W1NUUaU7MwU9sx/tGi7CK9/ILAQLjvbh15JiStd3Qaxkj0653avAbauRX laxmB4BY8e6davMiQQZBSo8/b3I/B4/Myw0c4e6/WnarFJG2fShwVKCpedBCETSnU8kL /C2PpzN6xuoj9BL9oxqJRiZOyNNd80bbp+xXzM4CfIXHIp/eKxpGbQYdhjc8UsaQEPHx zHhdiREMTOE/KVsbJz1RCaEA8zrEcyIGPy6NDYZvOMWENp47l58dRUdcYDPIs2GmpnU0 xFew== 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=tfbWBgwr6XbTXDa8RMCpQkFrLbEpjMzxYl/6T4aByhQ=; b=rwBjH9VOTAbhR1a/ylVMorx88SGbtvUhO5TPgVyldKZ1GG6EGnxOvQUcAmawctDS1k D+I3GtRMhGvPJVJeQWGEtwxT0mTAFliHYHiat7iRNA5mTrxUinoQOEtql+5QPNvQbkjf cjgjYunjjBiTKdLlJ4ZK2qaTsvzKrCrSQEh7L1wcpqSyG/EotQGiG9xlitEQT9/Z/niO zFMlBQjyMRlN0zmPGNhUHNnYuAKOkDwbXg55wReTT2Scwwf4K2O3qprBykt9v+X82xJN vGtL/L0o69OEZFECXDGqvYoh7R8F4/QgrPWpFOwStg4A9TntnVuzFaKTKkx7M1X+8yJT BVXw== 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 tx27-20020a1709078e9b00b00948aad62e55si4902740ejc.1028.2023.04.04.14.57.50; Tue, 04 Apr 2023 14:58:15 -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 S236599AbjDDV40 (ORCPT + 99 others); Tue, 4 Apr 2023 17:56:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236600AbjDDV4S (ORCPT ); Tue, 4 Apr 2023 17:56:18 -0400 Received: from angie.orcam.me.uk (angie.orcam.me.uk [IPv6:2001:4190:8020::34]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A67195256; Tue, 4 Apr 2023 14:56:10 -0700 (PDT) Received: by angie.orcam.me.uk (Postfix, from userid 500) id EC2989200BC; Tue, 4 Apr 2023 23:56:09 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id E422492009D; Tue, 4 Apr 2023 22:56:09 +0100 (BST) Date: Tue, 4 Apr 2023 22:56:09 +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 v7 3/7] 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=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 --- 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 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);