From patchwork Thu Jun 21 16:47:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 10480201 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9C66C602CB for ; Thu, 21 Jun 2018 16:47:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8C7DF2910C for ; Thu, 21 Jun 2018 16:47:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 80A2729125; Thu, 21 Jun 2018 16:47:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F33D02910C for ; Thu, 21 Jun 2018 16:47:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933392AbeFUQrl (ORCPT ); Thu, 21 Jun 2018 12:47:41 -0400 Received: from foss.arm.com ([217.140.101.70]:52430 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933391AbeFUQrl (ORCPT ); Thu, 21 Jun 2018 12:47:41 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9C1571435; Thu, 21 Jun 2018 09:47:40 -0700 (PDT) Received: from approximate.cambridge.arm.com (approximate.cambridge.arm.com [10.1.206.75]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8DA8F3F5BC; Thu, 21 Jun 2018 09:47:39 -0700 (PDT) From: Marc Zyngier To: Bjorn Helgaas , Mika Westerberg Cc: Lorenzo Pieralisi , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] PCI: shpchp: Fix probing logic inversion Date: Thu, 21 Jun 2018 17:47:15 +0100 Message-Id: <20180621164715.28160-1-marc.zyngier@arm.com> X-Mailer: git-send-email 2.17.1 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Until recently, shpc_probe() would bail out pretty early in the absence of the SHPC capability. A logic change in the way the driver now checks that capability makes it go and probe the firmware anyway, with ugly consequences if the system is not ACPI based (my arm64 ThunderX is DT driven, and explodes in a spectacular way after getting a NULL root bridge from the non-existent ACPI tables...). Take this opportunity to move the call to shpchp_is_native() back into shpc_probe(), making it clear that a non-ACPI system is not expected to use this driver. Fixes: 90cc0c3cc709 ("PCI: shpchp: Add shpchp_is_native()") Signed-off-by: Marc Zyngier --- drivers/pci/hotplug/acpi_pcihp.c | 3 --- drivers/pci/hotplug/shpchp_core.c | 3 ++- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/pci/hotplug/acpi_pcihp.c b/drivers/pci/hotplug/acpi_pcihp.c index 3979f89b250a..b57f29753a08 100644 --- a/drivers/pci/hotplug/acpi_pcihp.c +++ b/drivers/pci/hotplug/acpi_pcihp.c @@ -83,9 +83,6 @@ int acpi_get_hp_hw_control_from_firmware(struct pci_dev *pdev) * OSHP within the scope of the hotplug controller and its parents, * up to the host bridge under which this controller exists. */ - if (shpchp_is_native(pdev)) - return 0; - /* If _OSC exists, we should not evaluate OSHP */ host = pci_find_host_bridge(pdev->bus); root = acpi_pci_find_root(ACPI_HANDLE(&host->dev)); diff --git a/drivers/pci/hotplug/shpchp_core.c b/drivers/pci/hotplug/shpchp_core.c index e91be287f292..8902fe18a636 100644 --- a/drivers/pci/hotplug/shpchp_core.c +++ b/drivers/pci/hotplug/shpchp_core.c @@ -275,7 +275,8 @@ static int shpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) int rc; struct controller *ctrl; - if (acpi_get_hp_hw_control_from_firmware(pdev)) + if (!shpchp_is_native(pdev) || + acpi_get_hp_hw_control_from_firmware(pdev)) return -ENODEV; ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL);