Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp3152702pxb; Mon, 18 Apr 2022 17:25:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzn6BUPZPN4iceTZvIrd+/GyhvQFfeFAQSsD1DIHc6C2OTFJFc5wa6SuITlNDB+b9wGxqZ5 X-Received: by 2002:a17:907:7e95:b0:6e8:968c:8ecd with SMTP id qb21-20020a1709077e9500b006e8968c8ecdmr11689990ejc.187.1650327932074; Mon, 18 Apr 2022 17:25:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650327932; cv=none; d=google.com; s=arc-20160816; b=Rqag2CdWc4YSuWlEXkMVcy5VHdVJOeKGr4ykkZtcsAWNYJPSn6s59Fp0RGKIqlBweZ bhB1W5DFfTl9ZjnVAFUd/8qz93lbUzcf7LpzZpnK+tHw+hOh0HzAWnh2F/2W8cMGHqqN lhsSEhU+Jhw8+YvrCRzS4APxwwMJHSZ5owdTxo/B1E1skyqldPkS/EpUC5eq/enRBaod amarEId5TVgWewkV+l8T4+NS1nFjBNT61RKV8RWxHJQFWozvbT4D2t3glVIEneDETVR6 G9+KfVD9X5qrc6Rr+Mq+8rVsXQAZjXwpqGaLqBQoe5wHo5ZseUjnTwV+h6YkQEqWfkKb 42Zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SLlHqwPYnQ/RJanaiJMb7cf5w6zbYoA3Rc0BB7M/3bI=; b=osKRBDm0jEKafGBE+Ky/hXF6dG+S8dGDI+18S9PJ+DmuHog9bS8OHtop/j0oMNiZUW CdOd0n0WgrTjQLG9lc8PzTPRvOAw9+9MbUvtRDws6Tae6KOqKBU/Su7zbOYuIGw9uAdi rn1JMKJOafq6YAuoqISxx+Y/uYBzeV+5Gx2g9P6hS6DuxtDOKCaoEiInwiOitoZ1J1nb 9Uc9dx8MMPYaZFC9zMSkCGRjf26izor3h4Ip0KkrTw+bPoRlweya9VrSen+nsZE++haV NWPO05f6+lFxq9Zwqm5WZ/vsgbkDJmtRVxRv3z+Nn5X8TnhWNKAajZgublWdKbnUVetF RFQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="IKev81Q/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w11-20020a1709060a0b00b006e83e2c436bsi7036427ejf.191.2022.04.18.17.25.08; Mon, 18 Apr 2022 17:25:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="IKev81Q/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242551AbiDRNJN (ORCPT + 99 others); Mon, 18 Apr 2022 09:09:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240680AbiDRM5m (ORCPT ); Mon, 18 Apr 2022 08:57:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D8861EACF; Mon, 18 Apr 2022 05:38:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 683AB60FB6; Mon, 18 Apr 2022 12:38:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77C17C385A7; Mon, 18 Apr 2022 12:38:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650285484; bh=umetmjBoZN3k5LTEYhounpHhZT/+4J5l6xef5aPbhLE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IKev81Q//bLR1SaxmtPHGyuLgAOtXfy/InAKu6BvpZ6Fi+ybwRoAF90Hu84ggMffF Z/y2dkOZJhmu7GrV2jGHuUBskP3j/4jJohzXi9AUGRZsM4IdiSekXFdaHdAEVMgCmK SukoE9U4zYSYrW9229ohme0IKRuBr1OhEYoWRDk4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sudeep Holla , Mario Limonciello , "Rafael J. Wysocki" Subject: [PATCH 5.10 005/105] ACPI: processor idle: Check for architectural support for LPI Date: Mon, 18 Apr 2022 14:12:07 +0200 Message-Id: <20220418121145.500350849@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121145.140991388@linuxfoundation.org> References: <20220418121145.140991388@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mario Limonciello commit eb087f305919ee8169ad65665610313e74260463 upstream. 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. Reviewed-by: Sudeep Holla Signed-off-by: Mario Limonciello Signed-off-by: Rafael J. Wysocki Signed-off-by: Greg Kroah-Hartman --- drivers/acpi/processor_idle.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -1080,6 +1080,11 @@ static int flatten_lpi_states(struct acp 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; @@ -1088,6 +1093,11 @@ static int acpi_processor_get_lpi_info(s struct acpi_device *d = NULL; struct acpi_lpi_states_array info[2], *tmp, *prev, *curr; + /* make sure our architecture has support */ + ret = acpi_processor_ffh_lpi_probe(pr->id); + if (ret == -EOPNOTSUPP) + return ret; + if (!osc_pc_lpi_support_confirmed) return -EOPNOTSUPP; @@ -1139,11 +1149,6 @@ static int acpi_processor_get_lpi_info(s 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;