From mboxrd@z Thu Jan 1 00:00:00 1970 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=-16.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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 B1548C433E6 for ; Tue, 26 Jan 2021 05:41:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 69B032223D for ; Tue, 26 Jan 2021 05:41:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728630AbhAZFl2 (ORCPT ); Tue, 26 Jan 2021 00:41:28 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:35782 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731783AbhAYTXW (ORCPT ); Mon, 25 Jan 2021 14:23:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611602515; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=UT03s/I31YRDKMUtBXKP7GcN0aALUMC3UXcsyLIGnNY=; b=E+xvLT+2Gr4mr/Uj5DpEE4+hRlJu2hnbJebzGcdt8BuV6Z3UTGQMU9sYjkdZz+7M4xuFut ZOIKlb5lO49Y91lt5s/Q38E4ZWWwPL9zCyxmtm+pfpziwD3lY1zz/v/YJ1hnh/xy4VSuHN sE/gtUrwk4zRmI5sQ9Ksz8Eh78Tj3uU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-516-LvIX0ORjO2Oefu_NzbeS2w-1; Mon, 25 Jan 2021 14:21:54 -0500 X-MC-Unique: LvIX0ORjO2Oefu_NzbeS2w-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0752010054FF; Mon, 25 Jan 2021 19:21:53 +0000 (UTC) Received: from prarit.bos.redhat.com (prarit-guest.7a2m.lab.eng.bos.redhat.com [10.16.222.26]) by smtp.corp.redhat.com (Postfix) with ESMTP id 66AE95D9DB; Mon, 25 Jan 2021 19:21:52 +0000 (UTC) From: Prarit Bhargava To: linux-pci@vger.kernel.org Cc: Prarit Bhargava , Myron Stowe , Jonathan Corbet , Bjorn Helgaas , linux-doc@vger.kernel.org Subject: [PATCH] pci-driver: Add driver load messages Date: Mon, 25 Jan 2021 14:21:46 -0500 Message-Id: <20210125192146.1102523-1-prarit@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org There are two situations where driver load messages are helpful. 1) Some drivers silently load on devices and debugging driver or system failures in these cases is difficult. While some drivers (networking for example) may not completely initialize when the PCI driver probe() function has returned, it is still useful to have some idea of driver completion. 2) Storage and Network device vendors have relatively short lives for some of their hardware. Some devices may continue to function but are problematic due to out-of-date firmware or other issues. Maintaining a database of the hardware is out-of-the-question in the kernel as it would require constant updating. Outputting a message in the log would allow different OSes to determine if the problem hardware was truly supported or not. Add optional driver load messages from the PCI core that indicates which driver was loaded, on which slot, and on which device. Signed-off-by: Prarit Bhargava Cc: Myron Stowe Cc: Jonathan Corbet Cc: Bjorn Helgaas Cc: linux-doc@vger.kernel.org --- Documentation/admin-guide/kernel-parameters.txt | 2 ++ drivers/pci/pci-driver.c | 14 +++++++++++++- drivers/pci/pci.c | 2 ++ drivers/pci/pci.h | 1 + 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 23f209c8c19a..32ecee6a4ef0 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -3793,6 +3793,8 @@ nomio [S390] Do not use MIO instructions. norid [S390] ignore the RID field and force use of one PCI domain per PCI function + driver_load_messages + Output driver load status messages. pcie_aspm= [PCIE] Forcibly enable or disable PCIe Active State Power Management. diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 8b587fc97f7b..35d5b6973578 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c @@ -23,6 +23,8 @@ #include "pci.h" #include "pcie/portdrv.h" +bool driver_load_messages; + struct pci_dynid { struct list_head node; struct pci_device_id id; @@ -305,10 +307,20 @@ static long local_pci_probe(void *_ddi) */ pm_runtime_get_sync(dev); pci_dev->driver = pci_drv; + if (driver_load_messages) + pci_info(pci_dev, "loading on device [%0x:%0x]\n", + pci_dev->vendor, pci_dev->device); rc = pci_drv->probe(pci_dev, ddi->id); - if (!rc) + if (!rc) { + if (driver_load_messages) + pci_info(pci_dev, "loaded on device [%0x:%0x]\n", + pci_dev->vendor, pci_dev->device); return rc; + } if (rc < 0) { + if (driver_load_messages) + pci_info(pci_dev, "failed (%d) on device [%0x:%0x]\n", + rc, pci_dev->vendor, pci_dev->device); pci_dev->driver = NULL; pm_runtime_put_sync(dev); return rc; diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index e578d34095e9..c64b3b6e1e8d 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -6547,6 +6547,8 @@ static int __init pci_setup(char *str) pci_add_flags(PCI_SCAN_ALL_PCIE_DEVS); } else if (!strncmp(str, "disable_acs_redir=", 18)) { disable_acs_redir_param = str + 18; + } else if (!strncmp(str, "driver_load_messages", 24)) { + driver_load_messages = true; } else { pr_err("PCI: Unknown option `%s'\n", str); } diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index f86cae9aa1f4..db1218e188ac 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -690,4 +690,5 @@ static inline int pci_acpi_program_hp_params(struct pci_dev *dev) extern const struct attribute_group aspm_ctrl_attr_group; #endif +extern bool driver_load_messages; #endif /* DRIVERS_PCI_H */ -- 2.29.2