From patchwork Fri Feb 25 03:12:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 547631 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 882ACC433FE for ; Fri, 25 Feb 2022 03:16:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237009AbiBYDQu (ORCPT ); Thu, 24 Feb 2022 22:16:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237007AbiBYDQt (ORCPT ); Thu, 24 Feb 2022 22:16:49 -0500 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2078.outbound.protection.outlook.com [40.107.244.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81C1E1B762B for ; Thu, 24 Feb 2022 19:16:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kXTL5w0iIvXcjeQ+duL/uJO0MNdsCGNtAaP5nRSYtNZKzlCoo0EJln6gmFZoV5tZklH4RAEMzsbFPVIWGsKxW7NHXy9WFcv9bmQG0o+MrXKmAkAs1/lLc932cI88snUSZ9N9QL7agqdBkyLI0Ddx87wPXRjHvYDKfoMY0viw4JKmN9XQRmM9C8Rg1TCfHg5d4XndtBE7wosYQnGJREmkHmhmCWXL4T3/H2QRzpc8f5sHCbVn3anEquTQDOzZTKtYx8Veth5vpg5t5CYMnAOUB+aXgxF/tmdXHRWM4zMJVv/DccWtIZ2wGaliDiTNpuYz/b5SJUvUwmf6oCUgQ2uGpg== 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=usRxm1psKlCW2pLnE89AELlc78b02sx22mNjgIKawAw=; b=WVID+us/ruHMV85TAElS7tXIBalJLqMdkNMpLs4cILYga6ev8SYSzZGfHwGP4Y37D8tEityvh3+gEl4j3H9+biBkfijskqlq0WfTz1IilfjS136RWs70SlVIEujGckTSALlm0G0YLGveBzZDL7Z2jUHHnJuMv+wNzc+K7sEDNm74d+KYZaMxL737u/ZnV04UBciSYTtR8fQy7P2EctpTr+b8SFKW/Y6NgNnvVtOuoKja9GZaaYK6GfkjJgOWoe3VlADPaFW/9LpedYVEjfz/IwcExTVgh8o1eyzD4wt6aMAqfGMV87+SbAryaeHKdhUHdBmj7uH4mau/XrBJv3ZzOA== 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=usRxm1psKlCW2pLnE89AELlc78b02sx22mNjgIKawAw=; b=u+asl9qewJOCaSLU0oek7dxdYnoiEJNRBAuOQWAy7jAmWqtZLzdnr/bIENYd/suNIiNK9EaZirR7d7FcJdmz/DVZD+CMSNkdgYLpXyTARlwnb4kuOut7F3m3UEO1Qq5JsD314tTsV2xVMAX4Xy7TlkYFLZ6KQ9D7r7hpUERWQmo= Received: from DM6PR07CA0096.namprd07.prod.outlook.com (2603:10b6:5:337::29) by DM6PR12MB3146.namprd12.prod.outlook.com (2603:10b6:5:11b::13) 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 03:16:16 +0000 Received: from DM6NAM11FT051.eop-nam11.prod.protection.outlook.com (2603:10b6:5:337:cafe::c1) by DM6PR07CA0096.outlook.office365.com (2603:10b6:5:337::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.21 via Frontend Transport; Fri, 25 Feb 2022 03:16:16 +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 DM6NAM11FT051.mail.protection.outlook.com (10.13.172.243) 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 03:16:16 +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 21:16:13 -0600 From: Mario Limonciello To: "Rafael J . Wysocki" , CC: , Mario Limonciello Subject: [PATCH 1/2] PSCI: cpuidle: Move the `has_lpi` check to the beginning of the function Date: Thu, 24 Feb 2022 21:12:54 -0600 Message-ID: <20220225031255.3647599-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220225031255.3647599-1-mario.limonciello@amd.com> References: <20220225031255.3647599-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: 19277486-605e-41df-63c9-08d9f80d2f61 X-MS-TrafficTypeDiagnostic: DM6PR12MB3146: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: ds3CpDX+3bgKr7gad11GhEnd4HGkmSYKx7Q5BxuP0pcu4B+C1P2Tst7FtMnRywb27v7JCMjyQYCNfJdQq1TorwAqsLuy2y9fHCQot7X2RAHfZUESDl+7PjF4mJipMZhGEOEmNLNfI2VbSGfpcCiPV+aIqmmPFQaqJl3dtJ9TChP8g+RaFcUGBGN6px4OFYxIODiSSDtxGxRFI65OIUEY1sTB9q9TpsjB9z4D0eiRnvsckyd5bjRLeWNlpKLpYhNvZqjHmg+2XCm4cUEQUafHlkAPtNDJD3vHCeWehuTMM0BpxBgkALCfVGaWZABrIf4aG7fJG74ZOjzxAU3v3CrQOTPBpE5cn0++mLXM84BcPeKPmwsqVDIrtISWu8oVEx6xCgyLNy6loHNUI5ivGyImu9MaSKW8dFcI7dmtAsb7OQF4OrTlv3bTIcSo8H5BZx66LNtp4bfQ3EuSESSZVVvbcoWa8bv+6GqlcqeBSEJozuR+XMf0vsbruLDkO5/wnaqWASi51fyw0c/wg1yn+DsG5iDbdbaKF8uLapS+EYfTXYl6Xu+JtwEjX+Knwi1Ti10xod2/Jkf+XFo3FlTudCXW9xjCG0jp9v33CHs748YX0C3D0ApZz4JKKmsk8FlwMkKXq1dIJT77grhwE8x0EEc241qye8S8QE2cFIHy3tWKKn4veFZANYu1sv/Xg1dxBIS1ZJurptwESBc+JVDVxHQQQdPhJOK+KP2JkVMrX41Ept0= 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)(70586007)(47076005)(1076003)(2616005)(16526019)(8676002)(4326008)(70206006)(83380400001)(26005)(110136005)(54906003)(336012)(6666004)(426003)(186003)(2906002)(40460700003)(36756003)(36860700001)(5660300002)(44832011)(508600001)(86362001)(316002)(8936002)(81166007)(356005)(82310400004)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Feb 2022 03:16:16.1873 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 19277486-605e-41df-63c9-08d9f80d2f61 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: DM6NAM11FT051.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3146 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Currently the first thing checked is whether the PCSI cpu_suspend function has been initialized. Another change will be overloading `acpi_processor_ffh_lpi_probe` and calling it sooner. So make the `has_lpi` check the first thing checked to prepare for that change. Signed-off-by: Mario Limonciello --- arch/arm64/kernel/cpuidle.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm64/kernel/cpuidle.c b/arch/arm64/kernel/cpuidle.c index 03991eeff643..3006f4324808 100644 --- a/arch/arm64/kernel/cpuidle.c +++ b/arch/arm64/kernel/cpuidle.c @@ -54,6 +54,9 @@ static int psci_acpi_cpu_init_idle(unsigned int cpu) struct acpi_lpi_state *lpi; struct acpi_processor *pr = per_cpu(processors, cpu); + if (unlikely(!pr || !pr->flags.has_lpi)) + return -EINVAL; + /* * If the PSCI cpu_suspend function hook has not been initialized * idle states must not be enabled, so bail out @@ -61,9 +64,6 @@ static int psci_acpi_cpu_init_idle(unsigned int cpu) if (!psci_ops.cpu_suspend) return -EOPNOTSUPP; - if (unlikely(!pr || !pr->flags.has_lpi)) - return -EINVAL; - count = pr->power.count - 1; if (count <= 0) return -ENODEV; From patchwork Fri Feb 25 03:12:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 545934 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 8EDB6C433FE for ; Fri, 25 Feb 2022 03:16:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229805AbiBYDQx (ORCPT ); Thu, 24 Feb 2022 22:16:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237011AbiBYDQu (ORCPT ); Thu, 24 Feb 2022 22:16:50 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2088.outbound.protection.outlook.com [40.107.93.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01B611B762B for ; Thu, 24 Feb 2022 19:16:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EkJ4vnwEa68lmpL1QZ5RtO1tZ1JyBD4FpVdhr9F3sR4fEhZvnA7Vm8TDLHPfOxC4Hrhy0OyfpXJ5mWKWxdjcZ0zx8HXfWKyJGPGgnQAhchKR1eRi+PgbsZMoUmf9F8/alw5f4fUatqi0QR1dvYbt3hjQxWNDie2S6bt6sM09bmUKz2oT+9a2cwOl7jqbKWwxtx2ak88BAEOxuKGXEQK257+T4R8dLTvgVYYLCwKlJQuqpEvMM8KOOjz8nH6FyKtRLvqxqKwEWbmvio1E4nJJmmkkPGSdjLm+ui6/YglZ6yDemYVFB3O2wFtI1F1jLkqb2m5KAdNb2EmQ1E3E5rJrGg== 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=FWuTR1UVYaf0lVNY3KJdtO/oL2LsxbNj9vuPH/3JVOM=; b=bRdpEXPgep0lJeyoPhKNmxJlwkKyWojbTVJxbTXgRhDoVwzaJK7imQY2CjwVAROdtPtQWvGg5jP+stZUYKSdoJ8dySpBZ9MBFvB503D6nVQPfzJXM5UWdY8TYqsTkHfej4Wv5YxHNjZKvigsQjWuw863BZOCQTuZL4sDbADZGNDldx/2DwLJEi1y92Qe0pb2hgpNlDrCqxYEzy5mCsUHdfYXxk+z9mZZ9CLk12DY3Yop+Ew2vXlyFZ/i1nZCdiW3FnUA9rVvoAYBgrp8BbGLYK3x5XLQ7KvN70Sm69tqWwp+i8eCGHfP3u7E02QXfxqS/6vHk12oxFaXt92gjrqWFQ== 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=FWuTR1UVYaf0lVNY3KJdtO/oL2LsxbNj9vuPH/3JVOM=; b=n0fyxP03pKuSb4803hQujoB3l14SOdhYbA21G689+/Uq/uYotZZlN9UGvm/5dt5Ir/ofo4eBQJMMEC8wpSbNtRm+1olhemsidStsftLo3j05p0qOHe3+JGFQK1+l1Q09fFtYbE5ii+4Hq6vE3j0C40/dW46epV+aiKp75JRzgKU= Received: from DM6PR07CA0078.namprd07.prod.outlook.com (2603:10b6:5:337::11) by BL0PR12MB2435.namprd12.prod.outlook.com (2603:10b6:207:48::17) 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 03:16:17 +0000 Received: from DM6NAM11FT051.eop-nam11.prod.protection.outlook.com (2603:10b6:5:337:cafe::eb) by DM6PR07CA0078.outlook.office365.com (2603:10b6:5:337::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.22 via Frontend Transport; Fri, 25 Feb 2022 03:16:17 +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 DM6NAM11FT051.mail.protection.outlook.com (10.13.172.243) 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 03:16:16 +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 21:16:13 -0600 From: Mario Limonciello To: "Rafael J . Wysocki" , CC: , Mario Limonciello Subject: [PATCH 2/2] ACPI: processor idle: Check for architectural support for LPI Date: Thu, 24 Feb 2022 21:12:55 -0600 Message-ID: <20220225031255.3647599-3-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220225031255.3647599-1-mario.limonciello@amd.com> References: <20220225031255.3647599-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: 61402018-c336-4381-d28f-08d9f80d2fd3 X-MS-TrafficTypeDiagnostic: BL0PR12MB2435: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: PZa5ed9V+fdx199Rqv3irp2Q+HBqfMLtLhxtMRbn55m8bSp8MAOR5qvSUEdTXIRtB1OuMqilJkayDoa4+t+UhkNFllP8Oij4mLZzHciqT9XU0GvJ9jmU7nDUKx4NJXsP3NgTxq7nGVHdee/Ezv5esGrCSZQ0/8szQ2YLZzXFnK7IomrybBP64neFiJWr+WdnHUZsROon8OFPHvWLCKhdPKvm/h9lASavuZpYbJDOQvrohKX4zjQ21vtW/On6E4m4M0SA/W9Ol2iurO82yRgbYNZmNCMjYPvktKQEPukCmYQa9Uk7L4jetRWyQCsI4+bG+jT/neoZTJykaPNzRTAA1Auhy2yzS0EhCknOYCvVavRQ1yrssDHo3CJqbmmcQDNngBLgpBf1X8QZB75QnQiYlkReB1g5x6yYbT3PEKo6Z3DBjP1tChaHzixCWqqKWVQhYN4As36UKvm2K2trKJ7RZRhWxhIFGi9RR+CADLYDgH5WUjjdwT9ZDn/rcV/WHqojJGcERIDMPPYOFPp+GsI5nKu7k2F5iy4SMGPgGAloXYSWQnslSrr+tH2P702qmYKPP+BxGJAJ/hU2m6isS+xZfUx+wPdOcLDHgJSDWdoj36RNCixK6ocfQO4e5X2eWVzdkpLOEmdIjMzMJa9WwUOxan/W4d2aB5rGKmw/frEhF87ZasgEH1JFOmoPCt/yyNAHYkc7xx7vieVawQJwtTnMkg== 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)(8676002)(5660300002)(356005)(36756003)(44832011)(316002)(8936002)(40460700003)(4326008)(70586007)(110136005)(54906003)(2906002)(70206006)(36860700001)(508600001)(6666004)(81166007)(16526019)(82310400004)(426003)(83380400001)(26005)(186003)(1076003)(336012)(86362001)(2616005)(47076005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Feb 2022 03:16:16.9372 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 61402018-c336-4381-d28f-08d9f80d2fd3 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: DM6NAM11FT051.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR12MB2435 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org When `osc_pc_lpi_support_confirmed` is set through `_OSC` and `_LPI` is populated then the cpuidle driver assumes that LPI is fully functional. However currently the kernel only provides architectural support for LPI on ARM. This leads to high power consumption on X86 platforms that otherwise try to enable LPI. So probe whether or not LPI support is implemented before enabling LPI in the kernel. This is done by overloading `acpi_processor_ffh_lpi_probe` to check whether it returns `-EOPNOTSUPP`. It also means that all future implementations of `acpi_processor_ffh_lpi_probe` will need to follow these semantics as well. Signed-off-by: Mario Limonciello Reviewed-by: Sudeep Holla --- drivers/acpi/processor_idle.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index f8e9fa82cb9b..0092fd479527 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -1080,6 +1080,11 @@ static int flatten_lpi_states(struct acpi_processor *pr, return 0; } +int __weak acpi_processor_ffh_lpi_probe(unsigned int cpu) +{ + return -EOPNOTSUPP; +} + static int acpi_processor_get_lpi_info(struct acpi_processor *pr) { int ret, i; @@ -1094,6 +1099,11 @@ static int acpi_processor_get_lpi_info(struct acpi_processor *pr) if (!acpi_has_method(handle, "_LPI")) return -EINVAL; + /* make sure our architecture has support */ + ret = acpi_processor_ffh_lpi_probe(pr->id); + if (ret == -EOPNOTSUPP) + return ret; + flat_state_cnt = 0; prev = &info[0]; curr = &info[1]; @@ -1139,11 +1149,6 @@ static int acpi_processor_get_lpi_info(struct acpi_processor *pr) return 0; } -int __weak acpi_processor_ffh_lpi_probe(unsigned int cpu) -{ - return -ENODEV; -} - int __weak acpi_processor_ffh_lpi_enter(struct acpi_lpi_state *lpi) { return -ENODEV;