From patchwork Mon Feb 28 18:14:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 546731 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EDB21C43217 for ; Mon, 28 Feb 2022 18:33:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235860AbiB1Sds (ORCPT ); Mon, 28 Feb 2022 13:33:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241047AbiB1SdB (ORCPT ); Mon, 28 Feb 2022 13:33:01 -0500 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2054.outbound.protection.outlook.com [40.107.220.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40D656370 for ; Mon, 28 Feb 2022 10:17:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=I3h4jOXGhW2v/ouc6R9LfPym+hfGSdCivnCO/FHDLuuL5jkXD2qf6glv4fDL8zS1Ayj6zRh/rNMK7byvUhpzbNpeAZI8+Lb+MnzzywejRRJ8DVMX2DMSJ8jJni0VBFEOT0IjPt1y0qN0VJ23LZRDzTpDmjQoaYe9Cu268lbNvpeE3aihDGXv3d63Kn7PcMY+9F1ExkkmoQHmTs4wyvV5RAmbupc0PIG+gZy6FpyA8hWKJ5DdC4wyK2O6gmMj+v19POdP7Aa7CfEecTrtGBRZeuTxWlnZ73n4/leP4daAY7eBb1HwNl82gaejfER65eCSOqeWmKAtaTkQM5uZ9rsjBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1viixYNsfeXcW4s8FAbBh3TKd7FXZx4YwLk6BOOh+9U=; b=gN6v8hg8e6e5fPZ5tfiTCAdDCOFz4oTEeAr+iAJU50mlSdOJO+CCuOBkwBLPeEfEG/bYdT5GkSGoCYGZOyRNjPwc/GKR1ImmDsUIQmRnSStNUwJ8iRKKXKtLMrsWNtCLimWAROtW/+GytqzRFCX4pxlXWUMBmS/whc6976+NlnV+7y7fKLWnqKg+55IiT3tNofV9NRWoaz04Hp7OduB5jHwO43SmY2gTScvKr8jp1YJjT8iTS1Q4xm/HkL+g8hQCtfwo9TDGe8TXOkoltAUkHCMU9QGUPbOHKCO21o/MsnDjTlAIvgjTZVrsepQzQs0yFzPN4hSAlIK6szigRmOaNQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=rjwysocki.net smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1viixYNsfeXcW4s8FAbBh3TKd7FXZx4YwLk6BOOh+9U=; b=dO+wom/b/YfbWx8G/cUGVJi1Y/7I3F1tHI2YCjPMwuPn3FTMB3uAq8Ycs7/AApXohU7mWyfdIsRHjjeQFSew4MMy2pIjjVk18IhzU6hba42Y75+Y2sG5953xruTy1xUbAa73Cjj1qTPJvOoNLE/sZYWXkJXKgNeT/LsLoWCzbao= Received: from BN9PR03CA0534.namprd03.prod.outlook.com (2603:10b6:408:131::29) by BN6PR12MB1410.namprd12.prod.outlook.com (2603:10b6:404:18::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.22; Mon, 28 Feb 2022 18:17:08 +0000 Received: from BN8NAM11FT016.eop-nam11.prod.protection.outlook.com (2603:10b6:408:131:cafe::a4) by BN9PR03CA0534.outlook.office365.com (2603:10b6:408:131::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.24 via Frontend Transport; Mon, 28 Feb 2022 18:17:08 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT016.mail.protection.outlook.com (10.13.176.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5017.22 via Frontend Transport; Mon, 28 Feb 2022 18:17:08 +0000 Received: from localhost.localdomain (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.18; Mon, 28 Feb 2022 12:17:06 -0600 From: Mario Limonciello To: "Rafael J . Wysocki" , CC: Mika Westerberg , , , , , "Mario Limonciello" Subject: [PATCH v3 1/3] ACPI: APEI: Adjust for acpi_run_osc logic changes Date: Mon, 28 Feb 2022 12:14:44 -0600 Message-ID: <20220228181446.1975420-1-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ea6c68ab-5603-4814-7a4d-08d9fae6882b X-MS-TrafficTypeDiagnostic: BN6PR12MB1410:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MB2+gFpXbVMrO+yor73txxaOQLdOHl3gaF8Z51cn94r/9xm/aj9mdTBJYXflLeimviqNRPPPRSTrWkQ9DiVIQSlvB6cuFTk7q6sAfGcLxv0zX+l3VEuTjQ5fczbrWMerny64fUnu9snHQLSbR38wjcDuftaMDI/SpI3t9s4ZkCCTvduzZp4PJdTn1wd96GbnTWbnpYPVIT2wK9DfEbtwZAruD1H//xaazQla8ts+3iZ6uVzV8UncJvYavWDpd0e7QHLJ479orJF1AszCcA3OGkg7TD4qjeAWyvJ9v41tfRWB4ZHcw0t5sWyHOFIgao6xe840FQmmJNUVZqoQXynuiOCjg46b1FlT9F2rj3sVj50KcflIV6P2I8Nm/zhGl/JQM2bfDX57P5zCOFYwVsJFdBtfwaGBYw6gCz4EplGwlRYHuFe0/P6iJ4niEiG88pgcZ/VOuU0cFpWCDPo2NjOdx1fX1RauCLW28349d6bbuinmV7RI86euu5Le8O6msQHJwbiwQDadF+FvV39M2VRdqefElgq0c0gKreInHon5/I1JjKnl5/HZXlMGuAF3d82sqluCZxw9LzQwSpotfJUYKansUmwWPYYaa6PltKw8KDmG9Fpj0UPzOWMYcHkIg1TNa5j72PoWw7qjmdwYa+gDLWUjx3j0Z/loylMLobppBYmufxeGq6brsJp61V4mC04f8N2V+pOBMR2gtO3P9cyk3Q== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230001)(4636009)(46966006)(36840700001)(40470700004)(1076003)(36860700001)(26005)(186003)(336012)(426003)(8936002)(5660300002)(44832011)(16526019)(2616005)(47076005)(81166007)(356005)(83380400001)(70586007)(508600001)(6666004)(110136005)(82310400004)(316002)(54906003)(8676002)(86362001)(4326008)(70206006)(2906002)(36756003)(40460700003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Feb 2022 18:17:08.2827 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ea6c68ab-5603-4814-7a4d-08d9fae6882b X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT016.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1410 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org As this function calls the OSC with the OSC_QUERY_ENABLE set in OSC_QUERY_DWORD, ensure that it continues to operate the same if the function has returned AE_SUPPORT. Reviewed-by: Mika Westerberg Signed-off-by: Mario Limonciello --- Changes from v2->v3: * Add Mika's tag drivers/acpi/apei/apei-base.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/acpi/apei/apei-base.c b/drivers/acpi/apei/apei-base.c index c7fdb12c3310..f7d1aa687fd9 100644 --- a/drivers/acpi/apei/apei-base.c +++ b/drivers/acpi/apei/apei-base.c @@ -780,6 +780,7 @@ int apei_osc_setup(void) { static u8 whea_uuid_str[] = "ed855e0c-6c90-47bf-a62a-26de0fc5ad5c"; acpi_handle handle; + acpi_status status; u32 capbuf[3]; struct acpi_osc_context context = { .uuid_str = whea_uuid_str, @@ -792,12 +793,12 @@ int apei_osc_setup(void) capbuf[OSC_SUPPORT_DWORD] = 1; capbuf[OSC_CONTROL_DWORD] = 0; - if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &handle)) - || ACPI_FAILURE(acpi_run_osc(handle, &context))) + if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &handle))) return -EIO; - else { - kfree(context.ret.pointer); - return 0; - } + status = acpi_run_osc(handle, &context); + if (status != AE_SUPPORT && status != AE_OK) + return -EIO; + kfree(context.ret.pointer); + return 0; } EXPORT_SYMBOL_GPL(apei_osc_setup); From patchwork Mon Feb 28 18:14:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 546730 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00E32C433FE for ; Mon, 28 Feb 2022 18:33:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235061AbiB1Sdt (ORCPT ); Mon, 28 Feb 2022 13:33:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241051AbiB1SdB (ORCPT ); Mon, 28 Feb 2022 13:33:01 -0500 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2063.outbound.protection.outlook.com [40.107.92.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0602263E2 for ; Mon, 28 Feb 2022 10:17:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hgSxRXC74tBlKaaxbv5e5aDKUY3GOsr5bQ679aYOkZJzEz2wpFiEViXLPajIUQw33Y6c8XJrME048DQr0fuSTigQes7RYG/gSGv/udLIZXISH1LHHEEuqGLVGUKyP0xxHvYa7fs9lCg80q43rmwddPcC3r8kiL80zs9Pc6DiLWoYV627Hv0K6PWhCUVJ5kQTWMDuT9jaHfpMauk/VBX6Oxh4/zuLROyhsztOwwQ5Xt0QpVk2TXP3yExI/zIuebtC0/BCIWCb4TBPkBXiPRk6IiiMAhAYH5NvtOtEnxjduu9VdamTwRDJkWH27dTH5FUo9bNFLkDeSIv1MiaYSgALjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=DhSR6MCafjDaE9YhERaYdlPSYamQLRLVchwIxEk2CuE=; b=V2Mx+ACbskteZdeMpUUMmZ3rb5UmgZieuJTUcfaefwsXTCX070cNiNBnohMg1Q9RXgjKaaC2/+bdPdJXC6qRE4YQS4AFHWEVvpJ0JselUzjUxEQEP4FH+HbneDUeXqRbRDBXuVEWy4eZdTDdfNPxZjK9HeYbSpoIohpeFEQmRSsN/ZsKItGjPO1yy1ypCkL9gs9fkkDOlIpB2GOFitIPY3862oIyL+ma0LKLWs5D/gskcOsn50KxyoZ3wxuWpEP5RPxl6Zf1G1IBXixzlD5m2vuFnnwLW2JT3iOS7kiAjoNvl6GirUrBmHwU1M+4b0NfVe0OQzFhLqbcoO1yXC8q3g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=rjwysocki.net smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DhSR6MCafjDaE9YhERaYdlPSYamQLRLVchwIxEk2CuE=; b=vG7V12vDq3Hw0OzdA7wOP8jIG23H33KAAtt4+OUfJuuvHZgSB48ACfKdYEjKxcVMeAAUFhC/09Kda0S0BLnQA4gSoDukcLRdEMmw2lpX7PJ9zl8vf0iiJWQMmseb5YwzuzwFJKGFKQBKLwFwqkMffoRNU1cwlReWr9YiZVeDINg= Received: from BN9PR03CA0536.namprd03.prod.outlook.com (2603:10b6:408:131::31) by SN1PR12MB2559.namprd12.prod.outlook.com (2603:10b6:802:29::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.23; Mon, 28 Feb 2022 18:17:09 +0000 Received: from BN8NAM11FT016.eop-nam11.prod.protection.outlook.com (2603:10b6:408:131:cafe::1) by BN9PR03CA0536.outlook.office365.com (2603:10b6:408:131::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.23 via Frontend Transport; Mon, 28 Feb 2022 18:17:08 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT016.mail.protection.outlook.com (10.13.176.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5017.22 via Frontend Transport; Mon, 28 Feb 2022 18:17:08 +0000 Received: from localhost.localdomain (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.18; Mon, 28 Feb 2022 12:17:07 -0600 From: Mario Limonciello To: "Rafael J . Wysocki" , CC: Mika Westerberg , , , , , "Mario Limonciello" Subject: [PATCH v3 2/3] ACPI: bus: Allow negotiating OSC capabilities Date: Mon, 28 Feb 2022 12:14:45 -0600 Message-ID: <20220228181446.1975420-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220228181446.1975420-1-mario.limonciello@amd.com> References: <20220228181446.1975420-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9d957138-1fdb-46e4-d8be-08d9fae6886b X-MS-TrafficTypeDiagnostic: SN1PR12MB2559:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: j0Y1RMmfWf8p5JkQGCJMT5GHwnhMkGRWm8v5WIu1GrUMMO3QwEUsNR2Vuy8Cb8o2SPtd/NJmWUmTbT5c9U9hF8QeVuY6+i9SOkyT2KbErKxi7eYGopZlNNLHqTWlxIcaeb2SrMJ5Ix24R79HsodUK2wAJZ1SaeGj901MImgVDsVJSUFrmdHyak/OsKy+kOxpPERe0OwkBAGpBbAfBK/wRu24TBxecOjPryP0zU+LRLo5ZYEWNMV9AmUS5O9qo9oGJNoaeGtYKkbXqgXVae1yXmn+svMvYaGQ4zD9EaNzy50SQEMlMWk2UpV2lLahaPRhVugFGK2pHehPlwt1tdYYwco76XIsukFPYNcoUQkEJgAZz26A/g7oUZy21YM6W+ZFzDFuXjnk/K2jv1g4grnKZqzrDCX24EiRVuDJNZT9+BxT6LF3yNwnLWE+BYRIuk6/G0rtfxhLQsNuP9Qgfisga5E5RR3Dgi7htPMUgfgDpIsVl77jp4Cz1DcipcUjVAGJhXr06DTvLpbqEkBXvzOba0H1fpV9IcZRpXlxM8tg84429/UHbRzBl/dcMAyo02zMBKLxElaxzXRG7DzLlQ712M0r5xIyQtHZMSBIo9BYyDNp/uAk0AMceWDXFGnPIeDI6wv69Gi3f8c6eUgNDogHgNcb3NQaGHkGOfMTqOrJjDY0zQBfbC6gVL3axLLTSG9pNT2bCwO5908SbNdrQdzoog== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230001)(4636009)(46966006)(40470700004)(36840700001)(2906002)(8676002)(110136005)(4326008)(70586007)(70206006)(508600001)(8936002)(5660300002)(6666004)(2616005)(1076003)(36756003)(54906003)(316002)(44832011)(81166007)(16526019)(336012)(186003)(47076005)(426003)(36860700001)(83380400001)(26005)(82310400004)(86362001)(40460700003)(356005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Feb 2022 18:17:08.7202 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9d957138-1fdb-46e4-d8be-08d9fae6886b X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT016.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB2559 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Currently when capabilities have been masked by firmware during a negotiation with OSC_QUERY_ENABLE set they're silently ignored by the caller. If the caller calls `acpi_run_osc` again without query set and the same capabilities, then they instead get a failure possibly leading to downstream problems. So instead when query is set return AE_SUPPORT which callers can then use for determining that capabilities were masked. Signed-off-by: Mario Limonciello --- Changes from v2->v3: * Add kernel doc for the acpi_run_osc function * Correct a logic error drivers/acpi/bus.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 07f604832fd6..81647591ec27 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -184,6 +184,18 @@ static void acpi_print_osc_error(acpi_handle handle, pr_debug("\n"); } +/** + * acpi_run_osc - Evaluate the _OSC method for a given ACPI handle + * @handle: ACPI handle containing _OSC to evaluate + * @context: A structure specifying UUID, revision, and buffer for data + * + * Used for negotiating with firmware the capabilities that will be used + * by the OSPM. Although the return type is acpi_status, the ACPI_SUCCESS + * macro can not be used to determine whether to free the buffer of + * returned data. + * + * The buffer must be freed when this function returns AE_OK or AE_SUCCESS. + */ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context) { acpi_status status; @@ -243,16 +255,19 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context) acpi_print_osc_error(handle, context, "_OSC invalid revision"); if (errors & OSC_CAPABILITIES_MASK_ERROR) { + acpi_print_osc_error(handle, context, "_OSC capabilities masked"); if (((u32 *)context->cap.pointer)[OSC_QUERY_DWORD] - & OSC_QUERY_ENABLE) - goto out_success; - status = AE_SUPPORT; - goto out_kfree; + & OSC_QUERY_ENABLE) { + status = AE_SUPPORT; + goto out_masked; + } } status = AE_ERROR; goto out_kfree; } -out_success: + + status = AE_OK; +out_masked: context->ret.length = out_obj->buffer.length; context->ret.pointer = kmemdup(out_obj->buffer.pointer, context->ret.length, GFP_KERNEL); @@ -260,7 +275,6 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context) status = AE_NO_MEMORY; goto out_kfree; } - status = AE_OK; out_kfree: kfree(output.pointer); From patchwork Mon Feb 28 18:14:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 547622 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3474CC4332F for ; Mon, 28 Feb 2022 18:33:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234371AbiB1Sdr (ORCPT ); Mon, 28 Feb 2022 13:33:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241057AbiB1SdC (ORCPT ); Mon, 28 Feb 2022 13:33:02 -0500 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam07on2057.outbound.protection.outlook.com [40.107.95.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCD1563F1 for ; Mon, 28 Feb 2022 10:17:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=I7PntFQQT6bGLkbPFhe015UA2A9E53g/rbmFsbqEeGS0sywsSh0zTl8IaISQXyHrcvPehf2fBefHXuccu2g8Jzj4gyEPJb4Cj0lMuSW/eMx45Yqs3jHl4NKZkMOgXkvkX1JHFEHIeI6qrkx5rL/inKPAs02F6cCpp8bQGRSSYjvE7PugRASBzgzpIkwenW6eyHCnPb7kYaNMUWJ66JOYl6hlw1QD8WV2+HiRQF1pjuDOu1Eebga3uFosEcFxAQdQyrKpdpMFM6NZNJ9nDoQfE49kUP2bdMJDnyZh8sVraVYsgS3CMQu3PEXr70YbHYUF/X6+lPJBycWwFyCpp49igQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=PBesWYYmUYYZHELlWJnEDrwMQIVJsJyf+5vLt+beZx0=; b=mMO5Q9gJxhqQWJOJ+GKSgaA8eS1g4LU3uy/KhwpZlIsIAD2g+Gu7wrqi2oFb5abKhcfLsd9Puu8mBBXDvLIkpFuZWFQecB1gJpozCjFKkQsQ2YmxNWi25AsqhZEQzFImCj25tQYqUt38d8VBU8lNa3NlPEQzfqWle5uGevSWeQIsq4XPj/wm5vWsSe/t4xdcacSKqT70aWsk+JQYWeCn5xHOkLWVhIaS1u713l0a/7gagiLTq0gfV8pheMbYXvvpX2QCRTTuXUKNgS08lJ+XNUjgXoCUuAiMp73Kym/eDIl9tLH01hGR8Y0wENS8pmz5Ab5g4fQzakVPT10cqTNF+A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=rjwysocki.net smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PBesWYYmUYYZHELlWJnEDrwMQIVJsJyf+5vLt+beZx0=; b=pyChwr/O+bbdITrWgjDHIkvqvtfPJV2K3v/KQb7YoMr3y9Q0dI5SyYUytgzd++sRZlAMWmwXprzM4TM38OpReJT140dKLG7ajvC1OJY2uqjMmTl6ykqZKtR8LXRXj0MZjGrqGRMIveDjuUMdSzlDan0zaGLk4m8WkZh3WR5gN2Y= Received: from BN9PR03CA0515.namprd03.prod.outlook.com (2603:10b6:408:131::10) by BY5PR12MB3937.namprd12.prod.outlook.com (2603:10b6:a03:194::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.23; Mon, 28 Feb 2022 18:17:10 +0000 Received: from BN8NAM11FT016.eop-nam11.prod.protection.outlook.com (2603:10b6:408:131:cafe::52) by BN9PR03CA0515.outlook.office365.com (2603:10b6:408:131::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.21 via Frontend Transport; Mon, 28 Feb 2022 18:17:10 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT016.mail.protection.outlook.com (10.13.176.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5017.22 via Frontend Transport; Mon, 28 Feb 2022 18:17:09 +0000 Received: from localhost.localdomain (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.18; Mon, 28 Feb 2022 12:17:07 -0600 From: Mario Limonciello To: "Rafael J . Wysocki" , CC: Mika Westerberg , , , , , "Mario Limonciello" Subject: [PATCH v3 3/3] ACPI: bus: For platform OSC negotiate capabilities Date: Mon, 28 Feb 2022 12:14:46 -0600 Message-ID: <20220228181446.1975420-3-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220228181446.1975420-1-mario.limonciello@amd.com> References: <20220228181446.1975420-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ee99bb92-87e5-4e43-45ca-08d9fae688fd X-MS-TrafficTypeDiagnostic: BY5PR12MB3937:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ++uJ4gCUslVy/VK3sNnJAyb5SwmV9TzaFkWG9wUrxJ688LWaBEAvwJGCem2lQC6anCtaVKjmm8F3ajXa6i5TV5E6l8T59cODRBAQ7CNfnjYJalngQ3pi7BFZHQpPtqaxwrk/4x+Xd7gjzvj9QeLMh3Gb/SGMmCrT/i9x/g2lFqTWt7lbcfUeuFk5sqfnr3kAH49R0w1E8nY7sS95I9K5e1wVRuk8rIcDq1FYsODQK+qrvGoLcRKabDkGRFSouR3ri0xwlYxKAin2f6lyV3tFWuzn9FPjuaHgby7CO2sQGA2IAOhrHxVQktUCw1Sv0J0sBcosm0OqyVxMtwvuJUk2N8gvCEq2r2HFfscDDPJjODkTMYjAXjRU+l0q2gcXCYikN0Tgyr243tXhmWjEbG8irsm8JtBHca4ay7iqiUs6wSrk063N5MY6zgi0Gn0msREDa/2of2oq0fRP8nq4s2MqeQuhnQigoaWnU9oOVe2P3lxHxv8vu1DjW2FS1OHubXqlEE2Vf5RWB6iKAR7suwpNMU2OTo0kkgS+o1WJsdxKFKiScl49I6B7H0mgrEyNSjKikhKomros1G7jsRIKUEcBoUsayFK/BtffVg+yiePQA1AhrATjczgmAGHSrH49Oa+zsvZKUSRUachvh76jpSUzjm/Kh5yKv5iMg+w+i8RqBsNhT2GIcgyeJXShTLXf8OTcHF/pL4K15xanki+qgxzzaw== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230001)(4636009)(36840700001)(46966006)(40470700004)(36860700001)(47076005)(36756003)(54906003)(110136005)(40460700003)(316002)(508600001)(83380400001)(2906002)(356005)(44832011)(86362001)(70586007)(336012)(426003)(8676002)(70206006)(4326008)(82310400004)(16526019)(186003)(6666004)(5660300002)(26005)(1076003)(8936002)(2616005)(81166007)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Feb 2022 18:17:09.6732 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ee99bb92-87e5-4e43-45ca-08d9fae688fd X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT016.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB3937 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org According to the ACPI 6.4 spec: It is strongly recommended that the OS evaluate _OSC with the Query Support Flag set until _OSC returns the Capabilities Masked bit clear, to negotiate the set of features to be granted to the OS for native support; a platform may require a specific combination of features to be supported natively by an OS before granting native control of a given feature. After negotiation with the query flag set, the OS should evaluate without it so that any negotiated values can be made effective to hardware. Currently the code sends the exact same values in both executions of the _OSC and this leads to some problems on some AMD platforms in certain configurations. The following notable capabilities are set by OSPM when query is enabled: * OSC_SB_PR3_SUPPORT * OSC_SB_PCLPI_SUPPORT * OSC_SB_NATIVE_USB4_SUPPORT The first call to the platform OSC returns back a masked capabilities error because the firmware did not acknowledge OSC_SB_PCLPI_SUPPORT but it acknolwedged the others. The second call to the platform _OSC without the query flag set then fails because the OSPM still sent the exact same values. This leads to not acknowledging OSC_SB_NATIVE_USB4_SUPPORT and later USB4 PCIe tunnels can't be authorized. This problem was first introduced by commit 159d8c274fd9 ("ACPI: Pass the same capabilities to the _OSC regardless of the query flag") which subtly adjusted the behavior from 719e1f5 ("ACPI: Execute platform _OSC also with query bit clear"). The _OSC was called exactly 2 times: * Once to query and request from firmware * Once to commit to firmware without query To fix this problem, continue to call the _OSC until the firmware has indicated that capabilities are no longer masked or after an arbitrary number of negotiation attempts. Furthermore, to avoid the problem that commit 159d8c274fd9 ("ACPI: Pass the same capabilities to the _OSC regardless of the query flag") introduced, explicitly mark support for CPC and CPPCv2 even if they were masked by the series of query calls due to table loading order on some systems. Fixes: 159d8c274fd9 ("ACPI: Pass the same capabilities to the _OSC regardless of the query flag") Signed-off-by: Mario Limonciello --- Changes from v2->v3: * Fix up commit message typos * Fix up comments for capitalization and punctuation drivers/acpi/bus.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 81647591ec27..be5a20913eaa 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -308,6 +308,8 @@ static void acpi_bus_osc_negotiate_platform_control(void) .cap.pointer = capbuf, }; acpi_handle handle; + acpi_status status; + int i; capbuf[OSC_QUERY_DWORD] = OSC_QUERY_ENABLE; capbuf[OSC_SUPPORT_DWORD] = OSC_SB_PR3_SUPPORT; /* _PR3 is in use */ @@ -343,10 +345,34 @@ static void acpi_bus_osc_negotiate_platform_control(void) if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &handle))) return; - if (ACPI_FAILURE(acpi_run_osc(handle, &context))) + /* + * Check if bits were masked, we need to negotiate + * prevent potential endless loop by limited number of + * negotiation cycles. + */ + for (i = 0; i < 5; i++) { + status = acpi_run_osc(handle, &context); + if (ACPI_SUCCESS(status) || status == AE_SUPPORT) { + capbuf_ret = context.ret.pointer; + capbuf[OSC_SUPPORT_DWORD] = capbuf_ret[OSC_SUPPORT_DWORD]; + kfree(context.ret.pointer); + } + if (status != AE_SUPPORT) + break; + } + if (ACPI_FAILURE(status)) return; - kfree(context.ret.pointer); + /* + * Avoid problems with BIOS dynamically loading tables by indicating + * support for CPPC even if it was masked. + */ +#ifdef CONFIG_X86 + if (boot_cpu_has(X86_FEATURE_HWP)) { + capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_CPC_SUPPORT; + capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_CPCV2_SUPPORT; + } +#endif /* Now run _OSC again with query flag clear */ capbuf[OSC_QUERY_DWORD] = 0;