From patchwork Thu Jan 11 15:03:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 10158127 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 12D94601A1 for ; Thu, 11 Jan 2018 15:03:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F2E3428701 for ; Thu, 11 Jan 2018 15:03:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E549C2883A; Thu, 11 Jan 2018 15:03:57 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 24F6728701 for ; Thu, 11 Jan 2018 15:03:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933231AbeAKPD4 (ORCPT ); Thu, 11 Jan 2018 10:03:56 -0500 Received: from mail-bl2nam02on0042.outbound.protection.outlook.com ([104.47.38.42]:49036 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932684AbeAKPDy (ORCPT ); Thu, 11 Jan 2018 10:03:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=uJ8EuM382W/p14e31sSB1MYN33Qv5LiG1HaV3fsMcvA=; b=mZoT933ax6kW4AhnPg6fCfRzzhjpcsXinIMwXBH4OC9cJhu5AW2VutjlZpXFu+wGlue+b80M2z5eG6fgT5s8zl6gNpciGvegPK6BiMdAgYOL7238Fbmz6NOU7blKCtiujltwcbUvIkjLybFHw+Hlx4ySm92i81+8OWj8B3Z6Dro= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yazen.Ghannam@amd.com; Received: from yaz-diesel.amd.com (165.204.78.1) by CY4PR12MB1911.namprd12.prod.outlook.com (10.175.82.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.407.7; Thu, 11 Jan 2018 15:03:51 +0000 From: Yazen Ghannam To: linux-acpi@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, rjw@rjwysocki.net, lenb@kernel.org, bhelgaas@google.com, bp@suse.de, Yazen Ghannam Subject: [PATCH] PCI/ACPI: Disable AER when _OSC control bit is clear. Date: Thu, 11 Jan 2018 09:03:16 -0600 Message-Id: <20180111150316.19951-1-Yazen.Ghannam@amd.com> X-Mailer: git-send-email 2.14.1 MIME-Version: 1.0 X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: DM5PR07CA0031.namprd07.prod.outlook.com (10.168.109.17) To CY4PR12MB1911.namprd12.prod.outlook.com (10.175.82.12) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 774f9a80-a25d-480a-f71b-08d5590486e6 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(48565401081)(2017052603307)(7153060)(7193020); SRVR:CY4PR12MB1911; X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1911; 3:SMVBQG1NNFIdRUN0ZPzABAKmnhgxiqcbkyn1sXFRYklSo4LdMX2WoknGfrh1LuB0gVKKBCeywFcHZWfx1l8TY3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rn1wmgB/vdvfg9n39fJOdL4ptQtontytPFUbqTRwTIl9I0lWRdbxL059S3Owy7FTxuHr3myk9RO3XgPg5FAI4aJlsF+J3rmUOMiqYwM801sDhabp05E9r0/uW3U1osThm2D5IY/FFpfO4F2FyanXMM4crP3W5bY1JR/wmlb0/SbBeXtmMiaLaKxSxt0zpaTOywSqlul7Ji1G1HMdNJj21c3RC6mpX6T94+Mc+HdRgQr4vrL6hI9WNNQa8; 4:iMgB1dQBCiuDqNya9HvxzuD75AXewW+JGq7otg6dswIcbZMVAZn8lHfJN37fsGV1aiiuPilRtCUaiHjEIlHoh3etJHIDmN62m7EUKvF66uu1exBvhVbKB7cVgfCqFQELWumkWq/laIzsGIHmL0N6RrDGqXaFA8lCTMX4IZZ1PWm2Vs5qnsXhOGVG6Bb4briexIEnc551ti1x2kOAc+vhMxqpN54l8/7Hz8EsooECNIYng23CX2iREwxPY2vihWaS6Fn80lMIRDytizsFXJ9gbavloGVekiWc9UB9ps8RqYuKGsNCD+NOmY0IY4E+k39y X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231023)(944501075)(10201501046)(3002001)(6055026)(6041268)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123564045)(6072148)(201708071742011); SRVR:CY4PR12MB1911; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:CY4PR12MB1911; X-Forefront-PRVS: 0549E6FD50 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(396003)(376002)(346002)(39380400002)(366004)(199004)(189003)(5660300001)(53936002)(2361001)(2351001)(105586002)(16526018)(106356001)(2906002)(1076002)(6916009)(8676002)(6666003)(3846002)(6116002)(16586007)(72206003)(53416004)(316002)(478600001)(47776003)(305945005)(50466002)(68736007)(48376002)(7696005)(81156014)(386003)(81166006)(59450400001)(66066001)(6486002)(52116002)(51416003)(7736002)(50226002)(8936002)(4326008)(36756003)(97736004)(25786009)(86362001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR12MB1911; H:yaz-diesel.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR12MB1911; 23:JSu8iFhjacNEivjY74nkmVQoQUO+n7M8bmQYp+4aS?= =?us-ascii?Q?yxZifMrkoJT1haE2hKN5UIlEaFjZ9sXqHha8gTfGbjtYlHXYVmkyga0S2FkK?= =?us-ascii?Q?lz5zzFSVrRtkFxHvwhj0RGPSEpVHYg3Acb7h3cOyUZLpyHsHsgYp35w++oa/?= =?us-ascii?Q?Mk9PG194ciCY/1oLoaVgwSB3W5rUh8URNL3yI1EspFoQszwReJeMolHy6CsD?= =?us-ascii?Q?rid1tjjpAuuB1J9AXPswd3M/KpolvaN3OUuJ0841uxpn5/oA+RXij3aqstAp?= =?us-ascii?Q?yonGzQWHM919ELweCovrPK/IHdiklYnh8ehVfvVZBCC+1gYT9Ylue9QY7Sml?= =?us-ascii?Q?F2HYNTVWtzZRK1xtCpH7uF3gllmvQvGK4pJvRNZhhasXBHD1wmok2HUKRxpD?= =?us-ascii?Q?14S1RsaprxVtsmYo9A6gYngTySLnofDvEBG39rZbCJfUkOZ3Je9wC02Ym53a?= =?us-ascii?Q?899fg4BKw9z4xnkSD3SneD0f0jrEjWaFHskmT2rQ7s4pNjiK2283MW2voAqZ?= =?us-ascii?Q?cyJQlSbDNg8WzLPcYtkJKHt/HTKLUSAUFdfvCKzMrYjvK41Bov+n/RZ8w5Lf?= =?us-ascii?Q?ZfbSQu2ke/Ad39r/lZz1WiyYPwyaBdPklEixg82eeS2PxbX6mz7SgyQcL2b1?= =?us-ascii?Q?VxCjriFqK8fw2tQVpP6C/9iHS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qv7q7Jf3lLcypuV8WaA7CSaxxct9STuvEE9m57tueZLDCvYzMpRcPF2TJLUjzZNW2f4E4fTrIC43ZIHxW1tA/Ipbh36MhLOgYZ4/18P6CBXA=; 24:p2Dxwi9Cd2oBtpDRcE9N8QKioGvuotedy0VsjNp4Pn1cDx6PrAh+IG2ljwX9JavTJJvXXhkEfT7ucfmxRib5loxrjW6OIrAwOvFuMREhcyk=; 7:+Y1goH6PDXrPg0s20GC7YobF6SmieDaQw/Yo/uxQLZiAA1PBjmSwtF9VC9D8xOXG0NWx40CHnmElyhpXodnEiiSXon1BaEfhufFcMxT+4WsKGvkANlcfg8pBKd7y9xTPMZRrmjp5qoned+C7+AK+8fF7rdJjxdKcTprYLyeTomiTcSsRIbTX2GTYD2WQsTD0cGlg/Qwqz4qpcnDhGoR58arVaAksoXJ4yujFh3Qyoddy0Vz4F5giAH0OrSFy0YB9 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1911; 20:4QR/jp4LOyFCRDMnIdNkJ8+GgiU3Z4LWG9gFoxvmERS/VyHRZMwuxP/uo7Uf5EKzz18dHZkMDcnU+aSBBFBps3VH1ZwtYEbFfbVwWqKM0xBReO94DulQLPrV0Qt2OZ1lInKkhjJ2j0sO/Pa9jir5JjCZtO+H4kb+DGwp4tCGQIYaqBbPAs0Yg/KVMSulMl8IkaUPFSV4Wib34nbCYD9i2Dvi8i5kecIX8Nkbx6WYvTHd3UFSg0EPCtkdsluzvtDK X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jan 2018 15:03:51.6442 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 774f9a80-a25d-480a-f71b-08d5590486e6 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1911 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Yazen Ghannam Currently, aer_service_init() checks if AER is available and that Firmware First handling is not enabled. The _OSC request for AER is not taken into account when deciding to enable AER in Linux. We should check that the _OSC control for AER is set. If it's not then AER should be disabled. The _OSC control for AER is not requested when APEI Firmware First is used, so the same condition applies. Mark AER as disabled if the _OSC request was not made or accepted. Remove redunant check for aer_acpi_firmware_first() when calling aer_service_init(), since this is check is already included when checking the _OSC control. Signed-off-by: Yazen Ghannam --- drivers/acpi/pci_root.c | 3 +++ drivers/pci/pcie/aer/aerdrv.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 6fc204a52493..19a625ed8de9 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c @@ -512,6 +512,9 @@ static void negotiate_os_control(struct acpi_pci_root *root, int *no_aspm) */ *no_aspm = 1; } + + if (!(requested & control & OSC_PCI_EXPRESS_AER_CONTROL)) + pci_no_aer(); } static int acpi_pci_root_add(struct acpi_device *device, diff --git a/drivers/pci/pcie/aer/aerdrv.c b/drivers/pci/pcie/aer/aerdrv.c index 6ff5f5b4f5e6..39bb059777d0 100644 --- a/drivers/pci/pcie/aer/aerdrv.c +++ b/drivers/pci/pcie/aer/aerdrv.c @@ -374,7 +374,7 @@ static void aer_error_resume(struct pci_dev *dev) */ static int __init aer_service_init(void) { - if (!pci_aer_available() || aer_acpi_firmware_first()) + if (!pci_aer_available()) return -ENXIO; return pcie_port_service_register(&aerdriver); }