From patchwork Tue Oct 25 12:34:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 10730 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp978986wru; Tue, 25 Oct 2022 05:35:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7QOSL2NQhBaD9Rel31O5QMvyvUqPM1Q93lv4Hb7Gajbtwn2oKKIIkqe3RQYmyjt/kTeDm2 X-Received: by 2002:a17:90b:1b0b:b0:20d:7c31:e75d with SMTP id nu11-20020a17090b1b0b00b0020d7c31e75dmr43315575pjb.101.1666701348340; Tue, 25 Oct 2022 05:35:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666701348; cv=none; d=google.com; s=arc-20160816; b=vIXRm/YKhOszMHBMa+IJjtYKZ2MBIq8BrUPfboOpYGxYUIB65RsJYTbMP6fqzoCDMj GFkZ0s9h4tl9v6DwfniWlTw4l/eKuLFknd+hfhSpLwtNkvFJ88xuaHBOPLyO27s07VOE 7vx2Un/whDLNXDHvLwsAdOgD6jEgQq4c/UG2AK1S1+mzzII60I1551A/flapLLRAGop5 AS8Gk9J8284jdWShpLIi7vyhNrCJjmvRgVn3E/07//rDMWHk7+vSnvEgM0mm8ar3a/Xx PEcIFHwHvx3SFFSoFrC6bYBPoxBnv1KfRzOx9VzbYOROJBoDU/eT0hcnSW5jxhdwYGvB xZjw== 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=zTefL/O/eDGgRrrfH2rWXmnYYhO8HP29QBdKV3O55UI=; b=ynwTNQJ9hoFjp0MjGC/s5WSYIG+jkawC5aupjtn9FKB9IdJ8HqpYKmlFEnG7eLl1/x 0umk6tvWF+6Q/0zokijS2rnsTopS7AlteNKJ9UaOX+Gw7RE+16KIWXtUmwc0vkKKN2eb RhSzNX2/hcX5T93A5UYrpx+3U2zS4Xa+u3xD9wry6mBaUFkLRVv2R4bunlEchOQeIi6l OwTwNUx0V6FvvRgzn7VS+IS1vN3W66cpMpnohONSGKOXQYUFGWTgnVhvEV5JocwAYvXx 82L7b8S4d4kpL7izs7P84vmhowGUx2IrazJfc7+tIwlOHQwiOJqv9TTR5ppzaZs0BMkV D3Jw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y3-20020a62ce03000000b0056bf7935ac1si3027162pfg.145.2022.10.25.05.35.34; Tue, 25 Oct 2022 05:35:48 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231774AbiJYMem (ORCPT + 99 others); Tue, 25 Oct 2022 08:34:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230469AbiJYMek (ORCPT ); Tue, 25 Oct 2022 08:34:40 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E4F99923D4; Tue, 25 Oct 2022 05:34:37 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id F15A0D6E; Tue, 25 Oct 2022 05:34:43 -0700 (PDT) Received: from usa.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 7F8683F7B4; Tue, 25 Oct 2022 05:34:36 -0700 (PDT) From: Sudeep Holla To: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Sudeep Holla , Amit Pundir , Bjorn Andersson , Andy Gross , Dmitry Baryshkov , "Rafael J. Wysocki" , Ulf Hansson Subject: [PATCH] PM: domains: Fix handling of unavailable/disabled idle states Date: Tue, 25 Oct 2022 13:34:32 +0100 Message-Id: <20221025123432.1227269-1-sudeep.holla@arm.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747663032931768545?= X-GMAIL-MSGID: =?utf-8?q?1747663032931768545?= Platforms can provide the information about the availability of each idle states via status flag. Platforms may have to disable one or more idle states for various reasons like broken firmware or other unmet dependencies. Fix handling of such unavailable/disabled idle states by ignoring them while parsing the states. Cc: "Rafael J. Wysocki" Cc: Ulf Hansson Fixes: a3381e3a65cb ("PM / domains: Fix up domain-idle-states OF parsing") Signed-off-by: Sudeep Holla Reviewed-by: Ulf Hansson --- drivers/base/power/domain.c | 4 ++++ 1 file changed, 4 insertions(+) Hi Ulf, As you already know, this change alone doesn't fix the issue reported here[1]. It also needs the fixes you have posted [2]. Regards, Sudeep [1] https://lore.kernel.org/all/20221018145348.4051809-1-amit.pundir@linaro.org [2] https://lore.kernel.org/all/20221021151013.148457-1-ulf.hansson@linaro.org -- 2.38.1 diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index ead135c7044c..6471b559230e 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -2952,6 +2952,10 @@ static int genpd_iterate_idle_states(struct device_node *dn, np = it.node; if (!of_match_node(idle_state_match, np)) continue; + + if (!of_device_is_available(np)) + continue; + if (states) { ret = genpd_parse_state(&states[i], np); if (ret) {