Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp977054rwe; Thu, 25 Aug 2022 12:46:44 -0700 (PDT) X-Google-Smtp-Source: AA6agR5IXH3AJlSehq6jSK+kOtnC9a4tF70c4iZ470ClOAH3HCA70y6DLR7D+7a6i8gywBNfGVUe X-Received: by 2002:aa7:c946:0:b0:43d:3038:1381 with SMTP id h6-20020aa7c946000000b0043d30381381mr4401642edt.354.1661456804339; Thu, 25 Aug 2022 12:46:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661456804; cv=none; d=google.com; s=arc-20160816; b=vYIFmpFIq6Qs+8GoaoRT4HBaqOMhZmCl/rP3LD6gLVvKiJzQwmM4BJ4CFn6axu6y+r CI6EWaNv7nKIdy6GGHFFS9qp85uhnzd5XsB6PUt6q2A3LuQSdt0QIuMNvx6Dg1Y7nveV o1R5K9rm5OqdRRx5c6AEZ569KysjKl9fCXJc+cZ1FsM+UpcdKRgUenCjpDtgCtMssG8y 3OjE4VHABrzO+q2jRWWFf79Aes7+8XCfrxGCGKEvHCRchisMiu6K4axQOZWhjKCrOmhr P7mFysahkJSs9oQmkouFatjrrQ0wMlLJuTz5qZU0jzhXKVLksAIkQMIu4GkM3q56i3Ms 1PuA== 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 :message-id:date:subject:cc:to:from; bh=emNLsAAS4ZN9BdwqHPUETrL8RJsp8sCHpMk3laaLw6s=; b=eDX2/KyGJKF/Il2b0Jyxi3Y9bJuN+c95t/r/UrhwDjO7VIasHFswFvlrg6XtxZkL7p NBVwtEvJ4Q1Q8YulJGjKt5enb1ju6puQIEkzd6PEp2rxpdV+WXTOB8G8rFYoBVYYaIoy 5iuc84exnVtthYlfb0FxhR2H+u3AIEtg1a9sGkHdlUVE7IuA43djnQ35Z9AWIuTk5H+J 8Gfy5vblnh/3nm7lGr+ZZFeRjUlYkqZfBYIwCh0a4wn+L/PY7HUth+pc+ZTU94nWGGdy ujRsPemBI0s85nkQRexyckotxRutQ1Q/bz9yfFnBU7xvyf8GQeYW6eeVHZcRkp0j02Nt qrwQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kl4-20020a170907994400b00730ba32de19si66138ejc.117.2022.08.25.12.46.18; Thu, 25 Aug 2022 12:46:44 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237844AbiHYSrh (ORCPT + 99 others); Thu, 25 Aug 2022 14:47:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241805AbiHYSrd (ORCPT ); Thu, 25 Aug 2022 14:47:33 -0400 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55A194B0FF; Thu, 25 Aug 2022 11:47:31 -0700 (PDT) Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_relay_lmtp) via UNIX with SMTP (IdeaSmtpServer 5.0.0) id db5842b370c445d2; Thu, 25 Aug 2022 20:47:30 +0200 Received: from kreacher.localnet (unknown [213.134.169.168]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by v370.home.net.pl (Postfix) with ESMTPSA id 8BB1366D1DA; Thu, 25 Aug 2022 20:47:29 +0200 (CEST) From: "Rafael J. Wysocki" To: Damien Le Moal Cc: linux-ide@vger.kernel.org, Linux ACPI , LKML , Mario Limonciello Subject: [PATCH v3] ata: ahci: Do not check ACPI_FADT_LOW_POWER_S0 Date: Thu, 25 Aug 2022 20:47:28 +0200 Message-ID: <12054041.O9o76ZdvQC@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-CLIENT-IP: 213.134.169.168 X-CLIENT-HOSTNAME: 213.134.169.168 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvfedrvdejfedguddvkecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpeffffffkefgheehffelteeiveeffeevhfelteejvddvieejjeelvdeiheeuveeuffenucfkphepvddufedrudefgedrudeiledrudeikeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvudefrddufeegrdduieelrdduieekpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeehpdhrtghpthhtohepuggrmhhivghnrdhlvghmohgrlhesohhpvghnshhouhhrtggvrdifuggtrdgtohhmpdhrtghpthhtoheplhhinhhugidqihguvgesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdgrtghpihesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghr nhgvlhdrohhrghdprhgtphhtthhopehmrghrihhordhlihhmohhntghivghllhhosegrmhgurdgtohhm X-DCC--Metrics: v370.home.net.pl 1024; Body=5 Fuz1=5 Fuz2=5 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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: Rafael J. Wysocki The ACPI_FADT_LOW_POWER_S0 flag merely means that it is better to use low-power S0 idle on the given platform than S3 (provided that the latter is supported) and it doesn't preclude using either of them (which of them will be used depends on the choices made by user space). For this reason, there is no benefit from checking that flag in ahci_update_initial_lpm_policy(). First off, it cannot be a bug to do S3 with policy set to either ATA_LPM_MIN_POWER_WITH_PARTIAL or ATA_LPM_MIN_POWER, because S3 can be used on systems with ACPI_FADT_LOW_POWER_S0 set and it must work if really supported, so the ACPI_FADT_LOW_POWER_S0 check is not needed to protect the S3-capable systems from failing. Second, suspend-to-idle can be carried out on a system with ACPI_FADT_LOW_POWER_S0 unset and it is expected to work, so if setting policy to either ATA_LPM_MIN_POWER_WITH_PARTIAL or ATA_LPM_MIN_POWER is needed to handle that case correctly, it should be done regardless of the ACPI_FADT_LOW_POWER_S0 value. Accordingly, replace the ACPI_FADT_LOW_POWER_S0 check in ahci_update_initial_lpm_policy() with pm_suspend_default_s2idle() which is more general and also takes the user's preference into account and drop the CONFIG_ACPI #ifdef around it that is not necessary any more. Signed-off-by: Rafael J. Wysocki --- v2 -> v3: * Use pm_suspend_default_s2idle() instead of the check being dropped. * Update the changelog. v1 -> v2: * Adjust subject (Damien). * Drop #ifdef CONFIG_ACPI that is not necessary any more (Mario). * Update the changelog. --- drivers/ata/ahci.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) Index: linux-pm/drivers/ata/ahci.c =================================================================== --- linux-pm.orig/drivers/ata/ahci.c +++ linux-pm/drivers/ata/ahci.c @@ -1609,15 +1609,12 @@ static void ahci_update_initial_lpm_poli goto update_policy; } -#ifdef CONFIG_ACPI - if (policy > ATA_LPM_MED_POWER && - (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)) { + if (policy > ATA_LPM_MED_POWER && pm_suspend_default_s2idle()) { if (hpriv->cap & HOST_CAP_PART) policy = ATA_LPM_MIN_POWER_WITH_PARTIAL; else if (hpriv->cap & HOST_CAP_SSC) policy = ATA_LPM_MIN_POWER; } -#endif update_policy: if (policy >= ATA_LPM_UNKNOWN && policy <= ATA_LPM_MIN_POWER)