From patchwork Mon Jan 15 16:20:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 10164719 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 38BB4602C2 for ; Mon, 15 Jan 2018 16:20:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2675F28999 for ; Mon, 15 Jan 2018 16:20:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 195C6289E6; Mon, 15 Jan 2018 16:20:30 +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 DA8262899E for ; Mon, 15 Jan 2018 16:20:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934339AbeAOQU1 (ORCPT ); Mon, 15 Jan 2018 11:20:27 -0500 Received: from mail-bn3nam01on0043.outbound.protection.outlook.com ([104.47.33.43]:48544 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933523AbeAOQU0 (ORCPT ); Mon, 15 Jan 2018 11:20:26 -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=yqI2L8Oq5MvXWjTxjWNBDvtVDrwqUIq/TM393ZIPBQA=; b=0We+/M15CmVV1IGJsAfCY7dwXT3zDYQNREChxAqzpCcnxHJh5ZfvxxbjSWOKOwHoI0kJYYPKTCUDOl24rAS+LPUCRdk7xUVTYbJiDGFrEbQnxS59OdA5OQiMKZ8beT7FZ2zXj2zVStFdKMWRzGGv6DQuHROtDy1pz2kj8hWnPzQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yazen.Ghannam@amd.com; Received: from yaz-diesel.amd.com (165.204.78.1) by DM5PR12MB1916.namprd12.prod.outlook.com (10.175.88.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.407.7; Mon, 15 Jan 2018 16:20:23 +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 v2] PCI/ACPI: Disable AER when _OSC control bit is clear. Date: Mon, 15 Jan 2018 10:20:06 -0600 Message-Id: <20180115162006.45553-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: CY4PR03CA0106.namprd03.prod.outlook.com (10.171.242.175) To DM5PR12MB1916.namprd12.prod.outlook.com (10.175.88.148) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: c9d8537a-29ff-4ecf-1bfc-08d55c33e17f X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:DM5PR12MB1916; X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB1916; 3:gRTax8C7u8B84X9H6vCtdMaj5UFSy5Vcd2/+h94ynTrb25palSx8K2m0VRqT2vz2NejDkHHQ54vOcp9txIznkCk+d9us1h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SolU+ZaSDatepr1TW43xALZyfBmlFIRgylF48egS3JJI4n8a1p01zo+N1dgTik/32T/tOB04nKwQ937GRae5xd9ocFb9+NojXDKKqlFwsTOrwIBPhZ8wGNI0DvwQjIShs01QPKh7TzKEWnfd78tTMeEjUNL+5BXvTfze9p/EP8MNs/gJXSzNKyCHEKn4HMnvvsIIZaetzkO2DP8jJQ9bWLtWhnxDIvYnb9FIZDfooWit5np7d9RkpfyqDuyxtYGWMwz; 4:6olW/t40oPA9/zZyo67gr/VGCGj3ugtrsRLpl5Izw97w+a9ggmp6UJNFw3A198vQiGWBHS0QUakqYvA0mwnxsvpFiv33h8dKytlp7ks2T97KsfNNtTZl3Q3v8LOdnhCY9U0VCp3ftrkLWWCMjYfeMeZO2X6rF0iaEj+vRSMFvgRFQuc1GwchVW/KCjy3x0qQwVLgxfcieqgTrPG+xf/NxnQP/cUZrvV9xfYguFJuAC6BXZEkbviifPSfFcPvHGN0B65BngZ5TCoayXhPMVC8PWB4Dk8TezA69JqZ6Y2kWZoJeJqztd81BFGaLa46lUBQOfolILGIfFUgwG9vf/T/fg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(42068640409301); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(10201501046)(3231023)(944501161)(3002001)(93006095)(93001095)(6055026)(6041268)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:DM5PR12MB1916; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:DM5PR12MB1916; X-Forefront-PRVS: 0553CBB77A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(376002)(366004)(39860400002)(39380400002)(346002)(199004)(189003)(386003)(305945005)(7736002)(59450400001)(5660300001)(106356001)(2361001)(6916009)(25786009)(51416003)(7696005)(4326008)(52116002)(6666003)(53416004)(1076002)(53936002)(36756003)(16526018)(47776003)(66066001)(478600001)(105586002)(81156014)(81166006)(6116002)(2906002)(86362001)(316002)(3846002)(6306002)(8676002)(50466002)(966005)(48376002)(8936002)(2351001)(16586007)(97736004)(6486002)(72206003)(68736007)(50226002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR12MB1916; 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; DM5PR12MB1916; 23:7KaSfx6hUWkcL2WGTUIDxh5c5nM1N2edOQKXSGQuC?= =?us-ascii?Q?d84hMrjhzk9GbOpYHL/8Est9JyqsE8XzLh7OU/vDe1EoR+0XrFsUs/EqOdju?= =?us-ascii?Q?tstUgs+OgB2HDegg9Dbm8X/Rv6FACPYvH3R8NWo77TuOQpmcWKpIGsyY31P2?= =?us-ascii?Q?lFxvpzcdEp7Yj/tZp6NJIvNzDBQSQdyH8/FxGAEwmdDZ2o6r19FQVOtsdqpg?= =?us-ascii?Q?TWdGf+uT/h2Lgw7lqCMZiRUKS/fsFLd92NZdmmjPw2/h3CFyIkd26aMbHN8a?= =?us-ascii?Q?bgW4t11tB0OyyxPwkLYs440ejrTf6clVJmUnGZfzTM01NOO4NR4dPJ7xUMBr?= =?us-ascii?Q?Zpmr0OqpYuALhC8mAxrDKPXx68W675GlnKwXMG7OYkiAdYJb/hel56uAjoAp?= =?us-ascii?Q?xrUdlYX2Xg4rqimJ0TaZkOZZo9o12HZ2ZSeI2AnXlyxi8AyL/mwimfNQUmrD?= =?us-ascii?Q?C/gIphXytK8mtH3Uoqe7hIZ2DLpqMIaXZBIbHdDwuw5oAtlkt+WzAgAbeCjx?= =?us-ascii?Q?LkmywwqXxifhGuVjc4Mhk0I/62yEXez8kxkgp0GjGweJLtBA5efAjeQzyj/F?= =?us-ascii?Q?GG6ojVOhNw7SUhJIJU5fqb2v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Wwdjul/BadBdnUvybnehCZzTE=; 5:jDCukuPasW9rBmRF3nQtf/xwNTA2glzhEKJNQnRiRo+LBDUGb1bcybphxTxz5B8ZoD7XjoLRvbvDu4RSs2McaurRZjPglP7BJaCwQxgc2t9HftFworg70p1Q1RP82H9eLTtEJNwwUHJSqyArHXtxpYzEV7Lywy99Xrx+msBrIIQ=; 24:8tOeLUNXViXeLPfmAqIY7cbhBjn72ULp92Bv/vomcXLCpTTjC2mtgJUAa6LEbxudS8BsnLTYBjJayCVHDcLyWupydGhEHeoUPqwFc2+jS4s=; 7:STIDpVYro6RCj7QNSYQX+NHlmzCjYzD3yUVzu5uCHj18aWJd0IWaNfmvUWLDwfreu9YJS5KSQJUmh/1fNU7qBFaa6mlfyzX6SHLDcxL5SiuvbBv3WKBe2XkB0423OMUytxbkZ9hojC16PPTJWUGQjx/nQNde7OoY6pLVVg6bCx7wjqEROfOQir3niOpvdPxtCpWvj3QjjfDi4xgM3noJsU+Qh/aJsOJyCkmhBLgU/AmZTAnzXt8LqgxYHqlJdLZG SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB1916; 20:WvIA2acfOka24zr6SGz7JNnKQVHEiWE7L1M9XqC6emtsLAj4jw5X3CAJyfyAHLGWXqZWJ/73/9p0rmtR0zM9VH9Sxv9s7pDMQ5tDzUUc0+Ki1ZHqxvw0wB9kNmJnpMmjswA6OZkgJ0gmE9w3qvv+EBaIs6FkmSTYWv3+fkgL7Vgw9wloa/Z9AQnxVsEWMMAU29y5dorheaqg0fXJsNzgPt0H4egGON0OMPgAYmWgPQp8+C+NyO19K6TcziU0+APS X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jan 2018 16:20:23.1428 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c9d8537a-29ff-4ecf-1bfc-08d55c33e17f X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1916 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. From ACPI 6.2 Section 6.2.11.3, "If any bits in the Control Field are returned cleared (masked to zero) by the _OSC control method, the respective feature is designated unsupported by the platform and must not be enabled by the OS." The OS and the Platform should agree that the OS can have control of AER otherwise we should disable AER in the OS. Mark AER as disabled if the _OSC request was not made or accepted. This covers two cases where the OS and Platform disagree: 1) The OS requests AER control and Platform denies the request. 2) The OS does not request AER control but the Platform returns the AER control bit set, possibly due to a Firmware bug. The _OSC control for AER is not requested when APEI Firmware First is used, so the same condition applies from case 2 above. Remove redundant check for aer_acpi_firmware_first() when calling aer_service_init(), since this check is already included when checking the _OSC control. Signed-off-by: Yazen Ghannam --- Link: https://lkml.kernel.org/r/20180111150316.19951-1-Yazen.Ghannam@amd.com v1->v2: * Expand commit message. * Add Spec reference to commit message. * Fix spelling error in commit message. * Add comment for 3-way bitwise AND. drivers/acpi/pci_root.c | 7 +++++++ drivers/pci/pcie/aer/aerdrv.c | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 6fc204a52493..ab0192fd24c7 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c @@ -512,6 +512,13 @@ static void negotiate_os_control(struct acpi_pci_root *root, int *no_aspm) */ *no_aspm = 1; } + + /* + * We can use a 3-way bitwise AND to check that the AER control bit is + * both requested by the OS and granted by the Platform. + */ + 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); }