From patchwork Tue Jan 26 22:03:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 12048529 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=-19.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 81634C433E0 for ; Tue, 26 Jan 2021 22:52:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3629120679 for ; Tue, 26 Jan 2021 22:52:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730452AbhAZWuh (ORCPT ); Tue, 26 Jan 2021 17:50:37 -0500 Received: from mail.kernel.org ([198.145.29.99]:50268 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728016AbhAZWEB (ORCPT ); Tue, 26 Jan 2021 17:04:01 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id D1A412065C; Tue, 26 Jan 2021 22:03:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611698601; bh=ovcXG3DFzOy85KTaQDZ9xpuTy4A99qEQJncrjnnWKTk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b9qvpJ9jYcvD63TvVaiZ6Ttwww765wIZ10dDlS3nDUDSklPBjUlS+/pquqQEdj+2k 95MEBqpBggCzV/W6b2ObaLohz+yx68SMHFa3cxYjVoNBcD22KECZeWUm2GjHvZPwC2 h7IZVzZXGuJXeLHWcmhWMIG5htWLq2WiLmkmQLIq8Utf+7RqIrnXeP4WVVqsNXxljr qa7CDDbhTutChy+9QOlkaga+mjO9UYc75oSNxm4o7C6O9ETdS9p3BrWGf+0GWXrR8Z XEklnETzK9Mj0LihpSECOfcji6psjlJfQwQCu6Nxfw0NJy9Vn/Tl7ypC0iEcrNXDY5 hUWhfSY7XarcQ== From: Bjorn Helgaas To: "Rafael J . Wysocki" , Len Brown Cc: Sinan Kaya , Yicong Yang , Sean V Kelley , linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, Bjorn Helgaas Subject: [PATCH 1/3] PCI/ACPI: Make acpi_pci_osc_control_set() static Date: Tue, 26 Jan 2021 16:03:09 -0600 Message-Id: <20210126220311.2925565-2-helgaas@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210126220311.2925565-1-helgaas@kernel.org> References: <20210126220311.2925565-1-helgaas@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org From: Bjorn Helgaas acpi_pci_osc_control_set() is only called from pci_root.c, so stop exporting it and make it static. Signed-off-by: Bjorn Helgaas --- drivers/acpi/pci_root.c | 3 +-- include/linux/acpi.h | 3 --- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index ff7882afeb29..51dec352b8b8 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c @@ -353,7 +353,7 @@ EXPORT_SYMBOL_GPL(acpi_get_pci_dev); * _OSC bits the BIOS has granted control of, but its contents are meaningless * on failure. **/ -acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 *mask, u32 req) +static acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 *mask, u32 req) { struct acpi_pci_root *root; acpi_status status = AE_OK; @@ -406,7 +406,6 @@ acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 *mask, u32 req) mutex_unlock(&osc_lock); return status; } -EXPORT_SYMBOL(acpi_pci_osc_control_set); static void negotiate_os_control(struct acpi_pci_root *root, int *no_aspm, bool is_pcie) diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 053bf05fb1f7..4703daafcce9 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -581,9 +581,6 @@ extern bool osc_pc_lpi_support_confirmed; #define ACPI_GSB_ACCESS_ATTRIB_RAW_BYTES 0x0000000E #define ACPI_GSB_ACCESS_ATTRIB_RAW_PROCESS 0x0000000F -extern acpi_status acpi_pci_osc_control_set(acpi_handle handle, - u32 *mask, u32 req); - /* Enable _OST when all relevant hotplug operations are enabled */ #if defined(CONFIG_ACPI_HOTPLUG_CPU) && \ defined(CONFIG_ACPI_HOTPLUG_MEMORY) && \ From patchwork Tue Jan 26 22:03:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 12050053 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=-19.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 ECABAC433E6 for ; Wed, 27 Jan 2021 12:54:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AA8DF2079A for ; Wed, 27 Jan 2021 12:54:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S313954AbhAZWuu (ORCPT ); Tue, 26 Jan 2021 17:50:50 -0500 Received: from mail.kernel.org ([198.145.29.99]:50294 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728020AbhAZWED (ORCPT ); Tue, 26 Jan 2021 17:04:03 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id E555C2065D; Tue, 26 Jan 2021 22:03:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611698603; bh=ukVXr56Kpyp29Mw5X6LFTAW7cVKyG+Whv7HoIHY331U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sad9mA4v5dJF+h/1PUktAX2JhNckulBr38HgYgdsi62MslBvICLvDrs3KX8bO6iFh UoEtHtDsW7vUMXdoUuf1zMSd1IejjsCaNIw2P7uzmtq1v9lKGZZd+RmjkCfUEBxH7x 02F0DdKwe+9Gj8R4Hhv0SVIfzHyjbuNqfnnVR1D6Lg0g9Bar7QePDFZKWIox7e3Eeg hPiJmUnMKilTlzDcUylFJ6+7Bo0OziIRhsOSXcRVIWTCd0iX/AFnW74wbXD0Xw7lh/ NCnjf3uE26C4zeofQQHw/tdZ5nqe2Z/HDfV9LyPuJwL2ofcVQu413HcqRtwXgBJWlz fzSahv/sLem2A== From: Bjorn Helgaas To: "Rafael J . Wysocki" , Len Brown Cc: Sinan Kaya , Yicong Yang , Sean V Kelley , linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, Bjorn Helgaas Subject: [PATCH 2/3] PCI/ACPI: Remove unnecessary osc_lock Date: Tue, 26 Jan 2021 16:03:10 -0600 Message-Id: <20210126220311.2925565-3-helgaas@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210126220311.2925565-1-helgaas@kernel.org> References: <20210126220311.2925565-1-helgaas@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org From: Bjorn Helgaas 9778c14b4ca2 ("ACPI/PCI: Fix possible race condition on _OSC evaluation") added locking around _OSC calls to protect the acpi_osc_data_list that stored the results. 63f10f0f6df4 ("PCI/ACPI: move _OSC code to pci_root.c") moved the results from acpi_osc_data_list to the struct acpi_pci_root, where it no longer needs locking, but did not remove the lock. Remove the unnecessary locking around _OSC calls. Signed-off-by: Bjorn Helgaas --- drivers/acpi/pci_root.c | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 51dec352b8b8..a001f8f56b4b 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c @@ -56,8 +56,6 @@ static struct acpi_scan_handler pci_root_handler = { }, }; -static DEFINE_MUTEX(osc_lock); - /** * acpi_is_root_bridge - determine whether an ACPI CA node is a PCI root bridge * @handle: the ACPI CA node in question. @@ -223,12 +221,7 @@ static acpi_status acpi_pci_query_osc(struct acpi_pci_root *root, static acpi_status acpi_pci_osc_support(struct acpi_pci_root *root, u32 flags) { - acpi_status status; - - mutex_lock(&osc_lock); - status = acpi_pci_query_osc(root, flags, NULL); - mutex_unlock(&osc_lock); - return status; + return acpi_pci_query_osc(root, flags, NULL); } struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle) @@ -356,7 +349,7 @@ EXPORT_SYMBOL_GPL(acpi_get_pci_dev); static acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 *mask, u32 req) { struct acpi_pci_root *root; - acpi_status status = AE_OK; + acpi_status status; u32 ctrl, capbuf[3]; if (!mask) @@ -370,18 +363,16 @@ static acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 *mask, u32 r if (!root) return AE_NOT_EXIST; - mutex_lock(&osc_lock); - *mask = ctrl | root->osc_control_set; /* No need to evaluate _OSC if the control was already granted. */ if ((root->osc_control_set & ctrl) == ctrl) - goto out; + return AE_OK; /* Need to check the available controls bits before requesting them. */ while (*mask) { status = acpi_pci_query_osc(root, root->osc_support_set, mask); if (ACPI_FAILURE(status)) - goto out; + return status; if (ctrl == *mask) break; decode_osc_control(root, "platform does not support", @@ -392,19 +383,18 @@ static acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 *mask, u32 r if ((ctrl & req) != req) { decode_osc_control(root, "not requesting control; platform does not support", req & ~(ctrl)); - status = AE_SUPPORT; - goto out; + return AE_SUPPORT; } capbuf[OSC_QUERY_DWORD] = 0; capbuf[OSC_SUPPORT_DWORD] = root->osc_support_set; capbuf[OSC_CONTROL_DWORD] = ctrl; status = acpi_pci_run_osc(handle, capbuf, mask); - if (ACPI_SUCCESS(status)) - root->osc_control_set = *mask; -out: - mutex_unlock(&osc_lock); - return status; + if (ACPI_FAILURE(status)) + return status; + + root->osc_control_set = *mask; + return AE_OK; } static void negotiate_os_control(struct acpi_pci_root *root, int *no_aspm, From patchwork Tue Jan 26 22:03:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 12050051 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=-19.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 A74B5C433DB for ; Wed, 27 Jan 2021 12:52:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 487A320771 for ; Wed, 27 Jan 2021 12:52:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S313958AbhAZWu5 (ORCPT ); Tue, 26 Jan 2021 17:50:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:50318 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728023AbhAZWEF (ORCPT ); Tue, 26 Jan 2021 17:04:05 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id C2DDA2065E; Tue, 26 Jan 2021 22:03:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611698605; bh=UkV1SPQrNIZuXnp8OvX6KFw+Sn4o0k96KuF4kwb4yrQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ae6T1QlI77cXfhemfTp5BOwOIwubfsJI7wsL3V8MPJV9jMN3iOXgyVDC9iuQaqTIY KodjHSrP9F6AeE5Q981XYdLC/Lowd/uA6qGvxHEb7J900UZ6PWz3zVQxn0qeoCcIZB t46ENDuw/TqxwYatROw+mT+KW7P/K9siVIOWZr9FajKFGcXqBorczE9+rabfFcNIb1 bjWkAjW5xck/UIsycK9i0b1eht53SK7Z2JvHYsJGiqkLmYTslOoYiTRqeof++fLbHH d8sm612NtkqfYK5b8MoMz1FRyr4NMg7Q+NoEBu3JsdT0LZxkSNx3Ca3YHtrHUucD4H 84RlXbKjKmIow== From: Bjorn Helgaas To: "Rafael J . Wysocki" , Len Brown Cc: Sinan Kaya , Yicong Yang , Sean V Kelley , linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, Bjorn Helgaas Subject: [PATCH 3/3] PCI/ACPI: Clarify message about _OSC failure Date: Tue, 26 Jan 2021 16:03:11 -0600 Message-Id: <20210126220311.2925565-4-helgaas@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210126220311.2925565-1-helgaas@kernel.org> References: <20210126220311.2925565-1-helgaas@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org From: Bjorn Helgaas This message: acpi PNP0A08:02: _OSC failed (AE_NOT_FOUND); disabling ASPM is alarming and slightly misleading. Per the PCI Firmware Spec, r3.2, sec 4.5.1, _OSC is required for PCIe hierarchies. If _OSC is absent or fails, the OS must not attempt to use any of the features defined for _OSC. That includes native hotplug, native PME, AER, and other things as well as ASPM. Rephrase the message to: acpi PNP0A08:02: _OSC: platform retains control of PCIe features (AE_NOT_FOUND) Previous discussion at https://lore.kernel.org/r/20200602223618.GA845676@bjorn-Precision-5520/ Signed-off-by: Bjorn Helgaas Reviewed-by: Sinan Kaya Cc: Yicong Yang --- drivers/acpi/pci_root.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index a001f8f56b4b..6950a35a5ac7 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c @@ -441,9 +441,8 @@ static void negotiate_os_control(struct acpi_pci_root *root, int *no_aspm, if ((status == AE_NOT_FOUND) && !is_pcie) return; - dev_info(&device->dev, "_OSC failed (%s)%s\n", - acpi_format_exception(status), - pcie_aspm_support_enabled() ? "; disabling ASPM" : ""); + dev_info(&device->dev, "_OSC: platform retains control of PCIe features (%s)\n", + acpi_format_exception(status)); return; } @@ -499,7 +498,7 @@ static void negotiate_os_control(struct acpi_pci_root *root, int *no_aspm, } else { decode_osc_control(root, "OS requested", requested); decode_osc_control(root, "platform willing to grant", control); - dev_info(&device->dev, "_OSC failed (%s); disabling ASPM\n", + dev_info(&device->dev, "_OSC: platform retains control of PCIe features (%s)\n", acpi_format_exception(status)); /*