From patchwork Tue Jul 5 18:29:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 587452 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 68E26C43334 for ; Tue, 5 Jul 2022 18:29:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229579AbiGES3d (ORCPT ); Tue, 5 Jul 2022 14:29:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229554AbiGES3c (ORCPT ); Tue, 5 Jul 2022 14:29:32 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2049.outbound.protection.outlook.com [40.107.223.49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E2B510CD; Tue, 5 Jul 2022 11:29:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aFo5uqSzAjf3Q1rv1FHbM2+YxR27i4vjBTF5vzRYVQJ0OGkBH7t9yK5KKODQDIvNY0IuuMbRzMGpkcEh1WXZZy1KSgMmn123tgoeHUNbfouq4zHunRpMNkAADpzNMbp28OIeUKVvzZYlhzzhcQNR149xwlKxCInb2Bx9wEhi/ttxgZleHCBp9/LB3fFFIopx2cF2KOLq2gLud2k64mrVrrygS7/WEmUD9k8A4EWi1GlTuizFtcR+zJtaZIffOb3j7q6VWB5I1xguWP86R5QOnFGFR/FklD84Li5flF1FgaDPHpUhgvqI2IchTyQASRZlZAQ/39ydLVk6oJ+j8yjlkw== 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=8yVoil6hz1AbHVk8SjUMBI8nvLplcx2/lZ0ASje0NMA=; b=gFGlf05Pdi8EK7arpeXINzm+eAEXTbIEqw/Or18msY39HZSIdj/wobJywR3zIi1lRQveaOlx8qBBZQhx9uLl1q8d3V9q2y287Y4PGsFBUp7GJQPQgheZjIRJ/Q7NDJv0oBwUo5/MWeOhyAcYK5uegD8ix65OM+1iYGUqSflEmYs6FTGNqq862GzY6jfMNBYx464rsuaDeAXUAm67bIHqzNOHdfwM1LVO9jwrqN8YIP4vfQeVvfB/Se04A6u83H+qWcaAbkya7FyR23YvZbZNNG+RRbO7S/1hvqLsce1I1t/X0o/mHFjXvxkKqTpgIn5JWyYhccC9oMXhHicgaS+FPw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org 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=8yVoil6hz1AbHVk8SjUMBI8nvLplcx2/lZ0ASje0NMA=; b=Dw5MRWd+Lk/dhu5WU5dq5aEM7Asa0YbeNH3PGFZu7wjdwQPsOjqAFD7tHbuyldTWPfTC6c5dHSTUkc6UpzGZ+avtkRBAXBX65emUoBdT62Z96OCK5p69kJ8dUJwnilPlfckxvKMbbQULy4fYGvstSNhB4bpJGF7lAgSR7wZ0vbk= Received: from BN0PR04CA0197.namprd04.prod.outlook.com (2603:10b6:408:e9::22) by SA1PR12MB5659.namprd12.prod.outlook.com (2603:10b6:806:236::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.21; Tue, 5 Jul 2022 18:29:29 +0000 Received: from BN8NAM11FT018.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e9:cafe::27) by BN0PR04CA0197.outlook.office365.com (2603:10b6:408:e9::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.15 via Frontend Transport; Tue, 5 Jul 2022 18:29:29 +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; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT018.mail.protection.outlook.com (10.13.176.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5395.14 via Frontend Transport; Tue, 5 Jul 2022 18:29:28 +0000 Received: from AUS-LX-MLIMONCI.amd.com (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.28; Tue, 5 Jul 2022 13:29:26 -0500 From: Mario Limonciello To: , "Rafael J. Wysocki" , "Len Brown" , Mika Westerberg , Huang Rui CC: CUI Hao , , , , , , Subject: [PATCH v4 1/2] ACPI: CPPC: Only probe for _CPC if CPPC v2 is acked Date: Tue, 5 Jul 2022 13:29:14 -0500 Message-ID: <20220705182915.11663-1-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2e30cefb-fc84-48c1-b6fa-08da5eb44c13 X-MS-TrafficTypeDiagnostic: SA1PR12MB5659:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: b3uhX9yhrzwpiLuxFbhUE2ViM29T5zj3JX26dS3q0/6ueoi6RMWr7O/fsUYofrU9wyGhH3BiHikvms+SUwohc0E13MuHHqKoqidOy1UF0pdKFOW43ARrVgRdvAvSME9JhIDSasrJq3S/J2A61BBSzUU2SvlvjfhHgAFHhqQtW9YgvXjNaVGdrD332l4LAhi2blUUvuCSKwxKrO9+3j+Z/B0EZis2IpkbLUSmSOd5ob5dId5PgLy2QdTLHIyHt8pSWeCUQWpyFSh+4xsVTGdmSgrhdoNsLyheLNlVKqOsfpeE80pqgvK8rTf/qG2olcbCBXbHJaIWlOf66Y50JOqWHL8DAE+Hy2Yh6g9vVmWs6AjeTSmBL+b+lZ9EBovk/LVspBNeQOIuqyyjsJULRK/pUlw2ZVe/MRef+kXx9d0pIxASwV0JbCBP9tQ+HeIR1mTRP48K54XRS2rVFjuU9wBX9u6yGcw14no0rDlkTkHlzjhAMYFyC1WQ7m4e1k/TgM9EVrZBNlKg+tTvj+GVPDSu5nbtjnb82uU8xISTpiPysx3Hzq165FsfZaqfsZYfR4c+PnGPytb3ohXPZWwwrJg+qgOCx2fUlEbgbkvzd211YMifmlpCFJBoGUlFOUBDJf8PZLcGqubAPRpSvfm2uHYc80yype11hQbSbzQDKnbMIwJW4eTe4RuUwIr39C9ERL9QCJH0iTZDGIql8ihmH1eLDZoeCYhUIfhGvpqxQks9epXwvXgp49dL8z6+a8jcV2+sKT1zWONs47t8F2yvmGWG8T7pMFCfZuA9VOPgzDY7MhiaeObd9t5bMTDu+kRW2hDJiNJZaHYylzXC4kRH/fYsvfbUdKohXCeLWd+ZmRtmqmGNSs2SKjm7MtCSNfsjqv8VAOdUZUOHNOIWI3vtI0UadJ7A0jBdixXYomCCZuYrHRrZ7KqYUB7zBtTmR/cSnzeuWnJgEmFyPxPVvNZheGyHWA== 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:(13230016)(4636009)(396003)(346002)(376002)(39860400002)(136003)(40470700004)(36840700001)(46966006)(316002)(82310400005)(110136005)(54906003)(6636002)(36860700001)(40460700003)(336012)(426003)(47076005)(83380400001)(36756003)(26005)(34020700004)(16526019)(186003)(2616005)(86362001)(2906002)(5660300002)(7416002)(44832011)(81166007)(1076003)(7696005)(70206006)(8676002)(4326008)(70586007)(6666004)(478600001)(966005)(41300700001)(82740400003)(40480700001)(356005)(8936002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jul 2022 18:29:28.7956 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2e30cefb-fc84-48c1-b6fa-08da5eb44c13 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: BN8NAM11FT018.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB5659 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Previously the kernel used to ignore whether the firmware masked CPPC or CPPCv2 and would just pretend that it worked. When support for the USB4 bit in _OSC was introduced from commit 9e1f561afb ("ACPI: Execute platform _OSC also with query bit clear") the kernel began to look at the return when the query bit was clear. This caused regressions that were misdiagnosed and attempted to be solved as part of commit 2ca8e6285250 ("Revert "ACPI: Pass the same capabilities to the _OSC regardless of the query flag""). This caused a different regression where non-Intel systems weren't able to negotiate _OSC properly. This was reverted in commit 2ca8e6285250 ("Revert "ACPI: Pass the same capabilities to the _OSC regardless of the query flag"") and attempted to be fixed by commit c42fa24b4475 ("ACPI: bus: Avoid using CPPC if not supported by firmware") but the regression still returned. These systems with the regression only load support for CPPC from an SSDT dynamically when _OSC reports CPPC v2. Avoid the problem by not letting CPPC satisfy the requirement in `acpi_cppc_processor_probe`. Reported-by: CUI Hao Reported-by: maxim.novozhilov@gmail.com Reported-by: lethe.tree@protonmail.com Reported-by: garystephenwright@gmail.com Reported-by: galaxyking0419@gmail.com Fixes: c42fa24b4475 ("ACPI: bus: Avoid using CPPC if not supported by firmware") Fixes: 2ca8e6285250 ("Revert "ACPI Pass the same capabilities to the _OSC regardless of the query flag"") Link: https://bugzilla.kernel.org/show_bug.cgi?id=213023 Link: https://bugzilla.redhat.com/show_bug.cgi?id=2075387 Reviewed-by: Mika Westerberg Tested-by: CUI Hao Signed-off-by: Mario Limonciello --- v3->v4: * Pick up tags drivers/acpi/bus.c | 11 +++++------ drivers/acpi/cppc_acpi.c | 4 +++- include/linux/acpi.h | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 86fa61a21826c..e2db1bdd9dd25 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -298,7 +298,7 @@ EXPORT_SYMBOL_GPL(osc_cpc_flexible_adr_space_confirmed); bool osc_sb_native_usb4_support_confirmed; EXPORT_SYMBOL_GPL(osc_sb_native_usb4_support_confirmed); -bool osc_sb_cppc_not_supported; +bool osc_sb_cppc2_support_acked; static u8 sb_uuid_str[] = "0811B06E-4A27-44F9-8D60-3CBBC22E7B48"; static void acpi_bus_osc_negotiate_platform_control(void) @@ -358,11 +358,6 @@ static void acpi_bus_osc_negotiate_platform_control(void) return; } -#ifdef CONFIG_ACPI_CPPC_LIB - osc_sb_cppc_not_supported = !(capbuf_ret[OSC_SUPPORT_DWORD] & - (OSC_SB_CPC_SUPPORT | OSC_SB_CPCV2_SUPPORT)); -#endif - /* * Now run _OSC again with query flag clear and with the caps * supported by both the OS and the platform. @@ -376,6 +371,10 @@ static void acpi_bus_osc_negotiate_platform_control(void) capbuf_ret = context.ret.pointer; if (context.ret.length > OSC_SUPPORT_DWORD) { +#ifdef CONFIG_ACPI_CPPC_LIB + osc_sb_cppc2_support_acked = capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_CPCV2_SUPPORT; +#endif + osc_sb_apei_support_acked = capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_APEI_SUPPORT; osc_pc_lpi_support_confirmed = diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c index 903528f7e187e..d64facbda0fb7 100644 --- a/drivers/acpi/cppc_acpi.c +++ b/drivers/acpi/cppc_acpi.c @@ -684,8 +684,10 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr) acpi_status status; int ret = -ENODATA; - if (osc_sb_cppc_not_supported) + if (!osc_sb_cppc2_support_acked) { + pr_debug("CPPC v2 _OSC not acked\n"); return -ENODEV; + } /* Parse the ACPI _CPC table for this CPU. */ status = acpi_evaluate_object_typed(handle, "_CPC", NULL, &output, diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 4f82a5bc6d987..44975c1bbe12f 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -584,7 +584,7 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context); extern bool osc_sb_apei_support_acked; extern bool osc_pc_lpi_support_confirmed; extern bool osc_sb_native_usb4_support_confirmed; -extern bool osc_sb_cppc_not_supported; +extern bool osc_sb_cppc2_support_acked; extern bool osc_cpc_flexible_adr_space_confirmed; /* USB4 Capabilities */ From patchwork Tue Jul 5 18:29:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 588908 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 43BF9C433EF for ; Tue, 5 Jul 2022 18:29:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230050AbiGES3j (ORCPT ); Tue, 5 Jul 2022 14:29:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230119AbiGES3f (ORCPT ); Tue, 5 Jul 2022 14:29:35 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E01F210CD; Tue, 5 Jul 2022 11:29:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cNQbK6UDCnjcS+jDvsdxldwSJKzrzUOsJ3b2UNzsmmVF4OdPdIG3sQxSwLq6dBtHnjrsQu19fnanMwiDH0lnoqPFIs3prIoHwK5c7aUinS1YwKVEKqpmPdtceZEMOGm1JVri3Ry2SLU/4zY5U7rbgd7Unet+Kkdoq+KXup0oDstRlcZAwPU+GhYcXwFrKbTC6NcSFQDgdHoS5qr8dlyI7zaHieIimyZSfhEXmC77o3mmPJXtv15Ef3PE1eq1W2NMIaQzpvump4nkg0N00l9V/aora8jkMkslo7QJ5vMuzIyCy0HZQhs5Gr8Ic53mRl+OgNU33sk+UqaLc9tMhYX30g== 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=1+BI1+9U2uxb11Ha4XRUgadKW5czpJNwX3qo+bOJKwE=; b=HDCBKYD22Kro842EspowF1kSoBjuVjEPQmPqo1fIEH5HX1nX4yrzKT9ZoGBsOz9yjwEm/cvkLv45/wr6DZGf1p2MuGcqR3p+Fs7teXXAr3knYtXue8q3ECfJbuowXcbnaW9eOqUphXs59MWPmv00SCwtk5pk9+oMnsqMApwV+mDTE0VOjmXav3NXVpuxK/lDB+sgYeuhtXQLSue3PH5JhprEYR61d7ZwxgbZa5V6bITLHegrObMijX9P+qcqyMfI8aqYg6JFn1sYjgWneEofMWZn8vp3VRwOjMTokYK6NtoyiIFqfGbI/pgE1FpmONWbnoxU20ANZvGpYS7psfbu3g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org 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=1+BI1+9U2uxb11Ha4XRUgadKW5czpJNwX3qo+bOJKwE=; b=2x+Yqq7Dc7NSrAiVt+z5nZlBYm9MLv0bQZDbXbF23LiMJqC596fXoioqsYcSUVIEqaKtySIMVCmsJ320f/xZ1jPm5PclfoJOuzzdIkK57yN/zkVX4NmJ+gZ2woMmfdJfXxbUdLfGOgJQCq60o469C0+jJUJiz2RvD6pvR/aHu7s= Received: from BN0PR04CA0191.namprd04.prod.outlook.com (2603:10b6:408:e9::16) by MW2PR12MB2442.namprd12.prod.outlook.com (2603:10b6:907:4::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.15; Tue, 5 Jul 2022 18:29:30 +0000 Received: from BN8NAM11FT018.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e9:cafe::97) by BN0PR04CA0191.outlook.office365.com (2603:10b6:408:e9::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.14 via Frontend Transport; Tue, 5 Jul 2022 18:29:30 +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; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT018.mail.protection.outlook.com (10.13.176.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5395.14 via Frontend Transport; Tue, 5 Jul 2022 18:29:30 +0000 Received: from AUS-LX-MLIMONCI.amd.com (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.28; Tue, 5 Jul 2022 13:29:28 -0500 From: Mario Limonciello To: , "Rafael J. Wysocki" , "Len Brown" , Pavel Machek , Robert Moore , Pierre Gondois , "Sudeep Holla" CC: Perry Yuan , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , , "H. Peter Anvin" , , , , Subject: [PATCH v4 2/2] ACPI: CPPC: Don't require _OSC if X86_FEATURE_CPPC is supported Date: Tue, 5 Jul 2022 13:29:15 -0500 Message-ID: <20220705182915.11663-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220705182915.11663-1-mario.limonciello@amd.com> References: <20220705182915.11663-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b9f072e7-b717-4feb-6c69-08da5eb44d10 X-MS-TrafficTypeDiagnostic: MW2PR12MB2442:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xFqlybkspjqX6k/KbMjYSxxFQy/rxc08l5iYam9cl54ctzRESN4+N+G5PrjhOMiPXQ0bQG/jhgM46gQXJmJKjqJJG7lzqVRU7urkRiZtl32qultQp/9EEu8utQS+uJ5TBXhRuvOfcSukZwrCWX+MIVf42i+jwFTQHmngqGDRx8FNefX6gu0DO3zHp3wKtSB4OUa0KIHBxUML5v+AWLptgJsLnVG3sQ5Caw//ex4BsfGgVqY8ztzMzrEYwZED7cMh0K8FYM7/DcTaIcZ4hSQd9WmCCY4t333i15ty5W96eDrsLFPzrXNU1XP9JZO6xQPyxCJEAYIlVFNbZJAZvdK8yc+qDAHP1Bah5kEHsQfMFZKUh2n77FyFGbNTvgApcNY62pfn9ltQfokcF0DCqfhBPxWjW7eOptg/ww76F2SiirS69a3w8RjNEXAT+YJ2XfCH1NRSOfmxgcrzJrjwASvyEOedgvf4RgGQ7Oj2rlT38ZVfQzns8u+QrcQ8XNxQqUzVQswgwgsuhXDHruUsaIm5vqOSQCp6mlAy1JMit9MfQIbBKabdTJyBAIkFqTAkmuyRMYFNaZK4ta4RxqP6qpTc2uLwOavRxbTvvbtjLawpexZtVNGmeIdwgRm8+XXTpKdtgmIj/6fD0i2b61zuGrrCW3ojOlOimkokPusu+FXIh9LqPdp4PPJrL1wQ1MlBYXC0cwEudW3GasIqTWx26n9BCbhMKMGO/CYXotoXr9n3Szh+l2b+NnIMyrWZtt/I8UPCgUXyhZMKwc0Bb4GMKgLtofBzJAdpQ458jDO2nPO9qsIcC9h4dvmzO17To8CvwTgf1MXNK3a3+ZoPhIlGT6OAZjzCXFzU1e3nnhfv4PQdx+X+x8IM8iDA48ejamafIeBG 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:(13230016)(4636009)(376002)(396003)(136003)(39860400002)(346002)(46966006)(36840700001)(40470700004)(1076003)(8936002)(86362001)(478600001)(82310400005)(44832011)(356005)(70206006)(70586007)(4326008)(8676002)(36860700001)(82740400003)(34020700004)(5660300002)(40480700001)(2616005)(7416002)(40460700003)(26005)(81166007)(186003)(16526019)(316002)(36756003)(47076005)(7696005)(54906003)(2906002)(336012)(426003)(41300700001)(83380400001)(6666004)(110136005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jul 2022 18:29:30.5455 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b9f072e7-b717-4feb-6c69-08da5eb44d10 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: BN8NAM11FT018.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR12MB2442 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org commit 72f2ecb7ece7 ("ACPI: bus: Set CPPC _OSC bits for all and when CPPC_LIB is supported") added support for claiming to support CPPC in _OSC on non-Intel platforms. This unfortunately caused a regression on a vartiety of AMD platforms in the field because a number of AMD platforms don't set the `_OSC` bit 5 or 6 to indicate CPPC or CPPC v2 support. As these AMD platforms already claim CPPC support via a dedicated MSR from `X86_FEATURE_CPPC`, use this enable this feature rather than requiring the `_OSC` on platforms with a dedicated MSR. If there is additional breakage on the shared memory designs also missing this _OSC, additional follow up changes may be needed. Fixes: 72f2ecb7ece7 ("Set CPPC _OSC bits for all and when CPPC_LIB is supported") Reported-by: Perry Yuan Signed-off-by: Mario Limonciello --- v3->v4 * Explicitly check for AMD before using X86_FEATURE_CPPC v2->v3 * Rebase on top of solution for _CPC regression on some Intel systemss * Refactor to avoid #ifdef CONFIG_X86 arch/x86/kernel/acpi/cppc.c | 10 ++++++++++ drivers/acpi/cppc_acpi.c | 16 +++++++++++++++- include/acpi/cppc_acpi.h | 1 + 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/acpi/cppc.c b/arch/x86/kernel/acpi/cppc.c index 8b8cbf22461a4..734b96454896b 100644 --- a/arch/x86/kernel/acpi/cppc.c +++ b/arch/x86/kernel/acpi/cppc.c @@ -11,6 +11,16 @@ /* Refer to drivers/acpi/cppc_acpi.c for the description of functions */ +bool cpc_supported_by_cpu(void) +{ + switch (boot_cpu_data.x86_vendor) { + case X86_VENDOR_AMD: + case X86_VENDOR_HYGON: + return boot_cpu_has(X86_FEATURE_CPPC); + } + return false; +} + bool cpc_ffh_supported(void) { return true; diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c index d64facbda0fb7..6ff1901d7d436 100644 --- a/drivers/acpi/cppc_acpi.c +++ b/drivers/acpi/cppc_acpi.c @@ -577,6 +577,19 @@ bool __weak cpc_ffh_supported(void) return false; } +/** + * cpc_supported_by_cpu() - check if CPPC is supported by CPU + * + * Check if the architectural support for CPPC is present even + * if the _OSC hasn't prescribed it + * + * Return: true for supported, false for not supported + */ +bool __weak cpc_supported_by_cpu(void) +{ + return false; +} + /** * pcc_data_alloc() - Allocate the pcc_data memory for pcc subspace * @@ -686,7 +699,8 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr) if (!osc_sb_cppc2_support_acked) { pr_debug("CPPC v2 _OSC not acked\n"); - return -ENODEV; + if (!cpc_supported_by_cpu()) + return -ENODEV; } /* Parse the ACPI _CPC table for this CPU. */ diff --git a/include/acpi/cppc_acpi.h b/include/acpi/cppc_acpi.h index c6108581d97dc..d389bab54241d 100644 --- a/include/acpi/cppc_acpi.h +++ b/include/acpi/cppc_acpi.h @@ -145,6 +145,7 @@ extern bool cppc_allow_fast_switch(void); extern int acpi_get_psd_map(unsigned int cpu, struct cppc_cpudata *cpu_data); extern unsigned int cppc_get_transition_latency(int cpu); extern bool cpc_ffh_supported(void); +extern bool cpc_supported_by_cpu(void); extern int cpc_read_ffh(int cpunum, struct cpc_reg *reg, u64 *val); extern int cpc_write_ffh(int cpunum, struct cpc_reg *reg, u64 val); #else /* !CONFIG_ACPI_CPPC_LIB */