From patchwork Fri Feb 25 05:52:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 547629 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 1C60EC433F5 for ; Fri, 25 Feb 2022 05:55:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237315AbiBYFzk (ORCPT ); Fri, 25 Feb 2022 00:55:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237662AbiBYFzh (ORCPT ); Fri, 25 Feb 2022 00:55:37 -0500 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2053.outbound.protection.outlook.com [40.107.237.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 525E41E503E for ; Thu, 24 Feb 2022 21:55:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OsWKraWgHRpQbbwKgOOIZxV9kWLs8tBX9jn9pkD16K8sjmOHYNmJBMuG7ObHJzNWRf1PDT6EGmf+sbKTRQnQWIOh7tXK5Xl1BKzB9/6Gv3W1TUJsd73Gs7Vn/+XnqNTZPyHMkd6aG1udOOG2ZqtS7sg2Xq56V8E7g4x5jY2cWaeLF6wBSjIY/hiBqicuxPzFDXx2hEHX+9wL9ej0iTatu1GnSooU0a6U19oIIVuwSk6mCoRNmezeVo3kybDdGSwa0BiAuentvpHdX1H3/+UfyExTMHfhWtbJ9ITWi59aN1GdvoCBOG4mBjaC28RiUDuVFLuFyAZuP5Akmtu9PhDQZA== 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=9OBDk2CixDDxle2CMpNWbhGD7JENbGtfR8HptFzWZfw=; b=CrXYKBz89FCPh8/da1tNztisrJx0DKsTrDj7E3qaBHplqaDEKK+l2wb4OLrZQwWbh/dSC7RESSG0jHQ9vs+Q49f3lzN0oleEQc72HXHuLjVcNzFOH8lMbS7zsHUNaC6gZHGp8U/uIo9dUJY/tFhIywZPxypK+c2K/ZJSjhJxNRPwxqh7vTy/2GPkcl/zMeWri0GQh3WKdgATGyx4NYbAT0r6M+yfSA3t492OaNF5472XNYBDUu79UyIKlGysjT2v4dy08nopyfsgzXS1vqVsVzpnlAb29cLn1NZZ2KH5OhghkeZVVogan2FKYSdJzypjP0eFGd2NtEHqh6nvjJYNIQ== 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=9OBDk2CixDDxle2CMpNWbhGD7JENbGtfR8HptFzWZfw=; b=aMQ9rge+bjDZvrvPBN6mx4SJEtM5d1b6ejJS4H7RrlawRf8sleZqc+KuNcOZagcE0NVtbfhgYyXRaFY7SvwyK0sgAfsOskRX4B1MiB/iP9fYdZ5hERcLMA1TdrfSCqm2GlAeyuwH2AIxdLkcitoLDIvTks0OsKuCGk2VuOsMjdI= Received: from DM5PR18CA0090.namprd18.prod.outlook.com (2603:10b6:3:3::28) by DM6PR12MB4863.namprd12.prod.outlook.com (2603:10b6:5:1b9::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.22; Fri, 25 Feb 2022 05:54:54 +0000 Received: from DM6NAM11FT024.eop-nam11.prod.protection.outlook.com (2603:10b6:3:3:cafe::57) by DM5PR18CA0090.outlook.office365.com (2603:10b6:3:3::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.25 via Frontend Transport; Fri, 25 Feb 2022 05:54:54 +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 DM6NAM11FT024.mail.protection.outlook.com (10.13.172.159) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5017.22 via Frontend Transport; Fri, 25 Feb 2022 05:54:53 +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; Thu, 24 Feb 2022 23:54:52 -0600 From: Mario Limonciello To: "Rafael J . Wysocki" , CC: Mika Westerberg , , , , , "Mario Limonciello" Subject: [PATCH v2 1/3] ACPI: APEI: Adjust for acpi_run_osc logic changes Date: Thu, 24 Feb 2022 23:52:22 -0600 Message-ID: <20220225055224.190669-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: 4e63818c-a354-4d3e-0da8-08d9f8235853 X-MS-TrafficTypeDiagnostic: DM6PR12MB4863: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: wGoSXdPnUAU7SbGl+F6qEZZlUvbL+rqQ+f4k3t7aU+semW+CtKiS1z+gOUVkpeZW8kM4NxzpoZNVtnvkdH1hPv54p44/hzy3BEAKEfEsF9KBTm3TXra7RtLgiHcThhHqjNy/x4F3vZ9FP1gZ861fN6OaoVL+fdayCeoiHtYV0zRY54TuvtJnq0599Ar6qdoDdnSwS5IAnpfgLLjnkm1YgWTctMtx3J2SE0erAl4cOhjtIm7gz1G4mJMk7G5e9DDFB+oCxvBT8CT6slgufO4PFQ4Eeb6v+99yBpQkEzugWU9GbMoOzZwtGU3FwrK6Oqd8pxBARWRmzekpc+JaQs0D7RteiV9xfVAMKBkA+eyeloSfdvItHLuyRSdDCf3KgfAa1lKtuvZzUdoaiG2fUqMDBJ/vQ/DplRbzILZJGRPLq0Qgui1OiryPuFdP0gFhkI73asy79ypS1m2RJKT+7dMAauH1W9ZgpdFdL++yxBVdZGRBSXqGz8d0XusNyj7UZM/RyQl7Zc3BORSvdzm4t4BpRLFV0jdcO0mpWWrH9q64wGUo+aKH9ViGVVrKhCTJ8f0jxbwg4QiMc3p/1AhknI9b73AXYH46adyOoVhvDW8h7LjhN3fnQSddcV0FSZ9uhK0QWfmZwitOkcPXUEZ0THGXf9bSGNsD6CVWpFPZWJ3m/yrQxJpIo/mnSRKet0ZVrNjeTt8YY/TDOgTxUEm2Uoy3LA== 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)(8936002)(316002)(508600001)(6666004)(2616005)(1076003)(82310400004)(5660300002)(86362001)(70586007)(70206006)(54906003)(110136005)(81166007)(26005)(186003)(356005)(336012)(4326008)(83380400001)(36756003)(16526019)(36860700001)(47076005)(40460700003)(8676002)(2906002)(44832011)(426003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Feb 2022 05:54:53.7924 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4e63818c-a354-4d3e-0da8-08d9f8235853 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: DM6NAM11FT024.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4863 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. Signed-off-by: Mario Limonciello --- 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 Fri Feb 25 05:52:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 547630 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 B4D1EC433EF for ; Fri, 25 Feb 2022 05:55:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237311AbiBYFzd (ORCPT ); Fri, 25 Feb 2022 00:55:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232221AbiBYFzc (ORCPT ); Fri, 25 Feb 2022 00:55:32 -0500 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam08on2044.outbound.protection.outlook.com [40.107.102.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62E541E503E for ; Thu, 24 Feb 2022 21:55:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=h6LYksktbRT3SRe04MNNg6b0uy5BWT2Qp/EDJ5u2tkVEMY+zod0YUDRQZ+J9vioyiLRNfep5QRcAZBFLOFpqHlmXnrbRdiL6Za5dylEAbOAbuWY7428Mj6oEPhmQQahxfxQDhU+AuBYyagMydfcO1zudsGuBA/bNmxwutH3VLK5Ai76LHFDeY+DBSLdztugsp8ShzfDSajZrE4lt+F5ku2aeWUu/qYgIfKno8HwGVFPMaOmXm6/WK5xnlZNzbLJSgDzvnmNRz51rxGO3kgjpBjHaz5zfLJtNmzybGSMIgvpIiCTnad55gRmJt1OV66Wdwz5C3qcnW7xuHA+3bmdABg== 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=aNG2JKMGuoBq65ORMwgFZ5BvB7pV2aaxZrwKdR3zEGw=; b=ZWQghx9PJ1e4l3CpHMO8EW2MN4V+tisecVBnvzJ/SpRwAEWB7JKYHEHiiCsbMUBMvho1A/nUW3g9ygZrlLZE5SQHwrrlLkqfcbWoszGCtoG0HducW1UK3YP1iq8lVhFnWCtr3EcBMnHBR/M/4u/dqhInVUWlLTM2fOveF6JV9QTznZqsO/XL6G8PUtvcrf9eSLfPunKN7xs0RtOo9MDPeMrIAyHEBCKkCUu6GeYfT5LwPSP+aDKoa4h7phIx97pbukP5z8u1RSlg8shMVsEbhGt+esIJ0BO5qFcQUZ1sd1vREYaPhU75Rgk7IIOkRN/qznGu87uPO0Qfk0lxQNuCjA== 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=aNG2JKMGuoBq65ORMwgFZ5BvB7pV2aaxZrwKdR3zEGw=; b=unjCj3dKanSaa4AhlgekmaLzuhw50VYO8IH9IeWRi3RVXIfd4aifpPhKiGYuOLHrD6RHBpmKsN+MhpCrm31sF7+BHbxq9agbBugLR4x15dXq6JmbOmHPd0TA8LuhEK7pgCF41QoHdVs58p+lRM1Y6MsXgdbWZxCca06G2g6jRro= Received: from DM5PR18CA0085.namprd18.prod.outlook.com (2603:10b6:3:3::23) by PH7PR12MB5997.namprd12.prod.outlook.com (2603:10b6:510:1d9::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.21; Fri, 25 Feb 2022 05:54:57 +0000 Received: from DM6NAM11FT024.eop-nam11.prod.protection.outlook.com (2603:10b6:3:3:cafe::38) by DM5PR18CA0085.outlook.office365.com (2603:10b6:3:3::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.26 via Frontend Transport; Fri, 25 Feb 2022 05:54:57 +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 DM6NAM11FT024.mail.protection.outlook.com (10.13.172.159) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5017.22 via Frontend Transport; Fri, 25 Feb 2022 05:54:57 +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; Thu, 24 Feb 2022 23:54:53 -0600 From: Mario Limonciello To: "Rafael J . Wysocki" , CC: Mika Westerberg , , , , , "Mario Limonciello" Subject: [PATCH v2 2/3] ACPI: bus: Allow negotiating OSC capabilities Date: Thu, 24 Feb 2022 23:52:23 -0600 Message-ID: <20220225055224.190669-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220225055224.190669-1-mario.limonciello@amd.com> References: <20220225055224.190669-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: 604f8db3-f2e0-46f1-d1fd-08d9f8235a47 X-MS-TrafficTypeDiagnostic: PH7PR12MB5997: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: J1w41Ts0kxgtWuo1G1WKXvCy7C0I8/EthUQRkm4WWnE1VI8nXyqLX9OqpLjCO17v+hcUBxBxG4cSixbEvuVxePw0g2odai4+53NS7dDA9b5VkpMtCrLNXy4AmV6HZlyAoi58TlvkCzhwvVar2lM7xzP+jSb5bazVvnnrwSc3O4ulw20L5YQdX7UIKHysc2YQ+9HD49BuFYdrcnX6PAQUo0ofCdpEkIUxhyn/viPQlGg2pCHXQ5M3EPGRa0LjCkX0DgRP5xa68xwixW0FpRoOBVQc4zMEdeWdVpWsLY4+rj05zTv1/ffyrL8xMxCsh4ZlhhM3jA2Q3wX90d6Jo2pLsG64+jYW5l+OGW8XVn9sd2tR4CzYBRmPts6xBBZyV0RqY8lgdJxb0+WaE2LWTSVEZNA50MAafL0ISkjmGlspA+5N52wXquRyee17UwQTWcwCQrpn7ly/ACmFcz3Y7HqgoQtjzArvdnfUBuNgj8utcHBSbLRhHt75VfEsC8rjWQHo22zCLCttA8hPoDcerFvsrpxb6E7D3IX7eZlq1LZE7CztsVZ24qw3W3OLFghheIgdIK4NmUSNAFcRkZhjEcQ7+0LY3DTx6m3l90yh9WXCJP3ZPSFvVFL3dI8i1p6zunGr8P6hebDVOGmaU/LfY2dYVKzVg6h9h3OcVIrt84ljFEvow3DGhizo7ROeZSszH3G4FyUGQgs34MpJuiIRXOR7Pg== 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)(40470700004)(36840700001)(46966006)(36860700001)(4326008)(8936002)(82310400004)(86362001)(5660300002)(54906003)(44832011)(316002)(508600001)(110136005)(81166007)(356005)(40460700003)(6666004)(16526019)(8676002)(26005)(2616005)(426003)(186003)(70586007)(336012)(1076003)(83380400001)(2906002)(47076005)(36756003)(70206006)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Feb 2022 05:54:57.0742 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 604f8db3-f2e0-46f1-d1fd-08d9f8235a47 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: DM6NAM11FT024.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5997 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 --- drivers/acpi/bus.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 07f604832fd6..f0f9e0934c10 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -243,16 +243,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); From patchwork Fri Feb 25 05:52:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 545933 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 07799C433F5 for ; Fri, 25 Feb 2022 05:55:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232221AbiBYFzd (ORCPT ); Fri, 25 Feb 2022 00:55:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233912AbiBYFzc (ORCPT ); Fri, 25 Feb 2022 00:55:32 -0500 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2043.outbound.protection.outlook.com [40.107.244.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4199B1E6952 for ; Thu, 24 Feb 2022 21:55:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=imk/hoNvpDMiOjKTKsi46+A8psMwzhN2M8/Ua8YTjAOpYWe1YZhQ0HfrNJzsSW35XeHmqFmAnCFFg3sCK4svz1GAe10bNO6nLirlRcS05vRrxYxuaGjIffSTf2C7uWLDcaWDf+hO0JuFpAARt7UWUZwn2Z2XCjMLt9kWp5e4eUiLGcvMU2CxIgtMmiQbBkQmKKbrNoHu5k1ykAQFNg1sX/cKIAyh4cTkzGbQ5dXLaTy69A5XeZgCKHtH4GhSRFa4+dzdQSFUjl91jVjTDg/b7hs3+jqB3GMnMllp7h2/0JESOAkXGPt8UJlEPJ+kI86HdjMxn5YdkEbacgnGZtH8ng== 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=frZvKWmaoTF0EVYxxU6RmdMb4B+USrX3720BxL3BKEg=; b=GqJ3bic+0lYxMBZJr58WblIxoNLFS/1tCHslHVkXGblCnvjBQx+dkjCY5YgnU27VqXRyfypP7H/QiQxJ2Tnv4kQVP8JuDLVQywuaT7NuzmTmK7gJeUZ+6k2ylut/D7ga+3G9XrOb990ulYmti+DerBBPUZn3XJkYHPNzYWxDBHuqAki3xb4bknrYjUe3eJu2fPBYpjs513cJk9iDl7iTxFje8Y3NUs+bMCQ9Hgkxcb5zjdNhwTP4jflbJi+qw2m4PM83wJMxa1a+4M54T0U17RAisRpQGmxTBRZKEoiA6Xj3pKxNM+VTxhdBTCb2MH8eubFokY7MOBDJ9l7Tb3PsMw== 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=frZvKWmaoTF0EVYxxU6RmdMb4B+USrX3720BxL3BKEg=; b=2VCzAX/YcbWt/99T4r7Uj/MRtMPA7zUwOz07uu9jRVOq1zeNvtjuK/tjvMJVI6yFDuy3TstvRKI7Uv4i9NQLN8hcrvpvh70+fVFoBnpKlD8Uy5RHLwv2n/UTcl8eQoTX4mlGKIgif4YlFHIYk+4U5wl5vQsu8nhqxSex5R8qwLk= Received: from DM5PR18CA0090.namprd18.prod.outlook.com (2603:10b6:3:3::28) by PH7PR12MB5686.namprd12.prod.outlook.com (2603:10b6:510:13d::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.22; Fri, 25 Feb 2022 05:54:59 +0000 Received: from DM6NAM11FT024.eop-nam11.prod.protection.outlook.com (2603:10b6:3:3:cafe::ca) by DM5PR18CA0090.outlook.office365.com (2603:10b6:3:3::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.25 via Frontend Transport; Fri, 25 Feb 2022 05:54:58 +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 DM6NAM11FT024.mail.protection.outlook.com (10.13.172.159) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5017.22 via Frontend Transport; Fri, 25 Feb 2022 05:54:58 +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; Thu, 24 Feb 2022 23:54:53 -0600 From: Mario Limonciello To: "Rafael J . Wysocki" , CC: Mika Westerberg , , , , , "Mario Limonciello" Subject: [PATCH v2 3/3] ACPI: bus: For platform OSC negotiate capabilities Date: Thu, 24 Feb 2022 23:52:24 -0600 Message-ID: <20220225055224.190669-3-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220225055224.190669-1-mario.limonciello@amd.com> References: <20220225055224.190669-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: 9d62c59b-568c-45a2-0165-08d9f8235afd X-MS-TrafficTypeDiagnostic: PH7PR12MB5686: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: u3LVBCu2eEu7tBTjAPL43bBL0QuVWR/d5CPNTRn6KrcWOp4HcLOA4XaAvPhB2Chd+F+d5BhyhWZZE/XTLoZlcrrD3wr33Ix3KRFhNPJK4WCHxpQV8jUTk83fp0m3iCvWk/VP3ZldXSI1cFZsZwc3vQXRxmf5wravbXho+/amm1aeFZ6s8Wi0kxsFJ7OTLBbYKN/4PoB9V+4QCGL+W5RwbeJ99DBgAU4UtbPqb732p/2BI/Deq7DQURjUpqeuauZwVImimmhb/9OCtO8PS4wWjSSBThFnwpbZgCLoH8kxCxJzac2UYy3k2lI2s4sUcFSs9ZMat3nmljzPyl3Jkd4heRTtnu2mmYnC9MgdYVRgJ361egHgtk4R02ZW17P1DAGVSQtT7fkpEBfqM2QJxOmG/dKPetwgOtEgTb1NpDfN+pLYjI3Do8PYM/5xrySRRJ17XUmO6rwj+fTNadewY/biwkfgkArJwNhHLs+bbcUoDOFvQr1gmb3johAqb5+uj2jhfEaR7ziAd09WUU/ispO2p4MzCxz2S6ulOt3NbENxetIBPjp2igp31F0O5KImeUSpSdH8SmHOfgnULzObAq+y7DPN71yPlqjaQTSFiF0dYbF9GpYR7XE0hqRwzXuL8K31+sa8hZCWqLEyYV9Rv9pUy8pt9+tICP/AJGURPInXG9eUbMBvcFR12RpqEwDa0T7jeqipb4SOxWxA8wWnHL46qw== 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)(1076003)(82310400004)(356005)(40460700003)(6666004)(508600001)(110136005)(54906003)(2616005)(316002)(16526019)(26005)(186003)(86362001)(81166007)(2906002)(8936002)(70206006)(8676002)(70586007)(426003)(44832011)(47076005)(36756003)(336012)(36860700001)(5660300002)(4326008)(83380400001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Feb 2022 05:54:58.2772 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9d62c59b-568c-45a2-0165-08d9f8235afd 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: DM6NAM11FT024.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5686 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 acknolwedge 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 v1->v2: * Fix a NULL pointer dereference caught by 0day CI 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 f0f9e0934c10..489cc4f6b6e6 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -297,6 +297,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 */ @@ -332,10 +334,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;