Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp277131rdb; Thu, 19 Oct 2023 04:27:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG0Gkt3Hg2H7lyPIeAKd6WjXErurR4dGpI0TIqiihY1Z1e+4nzS5ZpFgrBDbIc3Y2IosJr1 X-Received: by 2002:a05:6359:618d:b0:164:c794:df81 with SMTP id sb13-20020a056359618d00b00164c794df81mr1492382rwb.8.1697714834883; Thu, 19 Oct 2023 04:27:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697714834; cv=none; d=google.com; s=arc-20160816; b=X9Ad9YLqBh+HDzc6dQiJRNML7RN7xCdqmZJK7Om7gSNXL0Pb3s7w4H4+PKCGBc0c6V cFowxjjb6qmYuuUo4mw/vVYhibo7IP3majOQA1zZrx7b2S6iUwsEuGoYYzJh43jyooGv MtLb1pZHcy/bM29Bxt9L2AiFOt2uI7mg6tMnlF6YDe4xF6zEOIwYaNPzqWDOaA9p0634 DO2jWgyn20yaBWboLaaHw91aqz1AjUATFQq9UFdpfQvXg/4eFHbEGlzccjRJwVHJMB+8 T1BhhO/zrg+l5gA4ZOiqoDHlY/bCQ6EojtrtnI/CxwEfu9QPB1GHgMlRMV7ApmyfriW0 scHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=PUrrcj+/ipouo/XR5RIgfw8wVuJ5J+7IILf/FghVZXQ=; fh=uaRe7RB33YkOPCjLwrgEBUv5LhFbPA+BuDTmgAcEcng=; b=dLcr+xLOjlaQbtTVq0tWUXc43FUVjEzRztMCPTjK1HHiXifQgJCDUJWJbqlIhhNWdE 5jWnulAUcCG4CdeCPjmqFjdQCxutQGdwEAteUw60PgdEPlQiuxpReEs3TYpFLGpheCf+ qlYxe7yfYbo/sAzVzLj00wpZoKsUYCfcMJ7ADFR6PSpPHa4EvHmGgPEdBlSWoGM+72GQ ScH2uJNTX99uilcP/+GgjXpOFNY3w+swR0bYkO6ZJJKu5kuUKgJb0n9teuCeoX2B/9fE wK9vfpFuVNV+TPfl5PIy0uOiwtWPiImxmx1OLyISxPRziAeIV8J6SEUfXScwHaR6g1ee +yBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=L9f38YWU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id x5-20020a626305000000b006bc3f09ea03si2499359pfb.301.2023.10.19.04.27.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 04:27:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=L9f38YWU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 596D18098EAA; Thu, 19 Oct 2023 04:27:12 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345324AbjJSL1A (ORCPT + 99 others); Thu, 19 Oct 2023 07:27:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345346AbjJSL07 (ORCPT ); Thu, 19 Oct 2023 07:26:59 -0400 Received: from mail-yb1-xb35.google.com (mail-yb1-xb35.google.com [IPv6:2607:f8b0:4864:20::b35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D055612F for ; Thu, 19 Oct 2023 04:26:56 -0700 (PDT) Received: by mail-yb1-xb35.google.com with SMTP id 3f1490d57ef6-d9a3d737d66so8340479276.2 for ; Thu, 19 Oct 2023 04:26:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697714816; x=1698319616; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=PUrrcj+/ipouo/XR5RIgfw8wVuJ5J+7IILf/FghVZXQ=; b=L9f38YWU39ice32PN6Gk6IneWrA7GTaQko/2pMcAvyIFSspRayFYidiSyXxz2TvxN2 WN+AT23DvUuAmVfiqxO5t7JJvOjTG45teXEl1i17H6KohaXZ2J3HaEv4C1ZzxyqS7CSF XDCY/nfkOClC2h/6Idw1icUqG5+fRg1yqlGOJjZgDiNHGJkLpOXPyvs8sHnJj5rhox1B BIvDcp+Iy3H/Ax05TllbFrTpBmXIJ/lSJOP4Ebbl8eBdcc+w0f4Mwwh0bcjBz9O7taiH WJ9OTdif9c/a0MKh1izip+0iJM2a1P6I0Ba36ezCz5zfbM2xput761mY9GEDuN0WUnMr c5jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697714816; x=1698319616; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=PUrrcj+/ipouo/XR5RIgfw8wVuJ5J+7IILf/FghVZXQ=; b=TJ9id/EbbXl48KsQxOc1pgy7pC3Q8Y/c0gofh1D9UAP9G+NqR/n/kxgCV+XvQNeDnu 3JlIF9FH2dxh8Y2afVhp/CcPOwNxmaYJn1tgs0QJdWpWBQTwkulolKewd/eaPs7lEhzW meoxP/OqfLVlkr9ry3uPP/6bC2b8kmd2IkIHMndaM+l0kQRsGZjpiE3qRETY3fP2jj2W 4jn+iu1i6pkPXJNFOvqTrHxOEVMmr6NHVOiqw4eOY3xmEt/NViHPKiZu+njKwKg788W7 pokJSmbLrBruHXJqRkHVVqm4/px91vxE/YTXHXUgCgQ7T/NV1LrQZN8IOKWbkd75+eN1 YFvA== X-Gm-Message-State: AOJu0YxnidCGlcdoddEDJidQS0yzMlohsTfQrDVfk+dzU6SSD4DZwjN9 Rs09k5cWqwklix887PtqNTow7fXqWIdYgrYMiCZxMw== X-Received: by 2002:a25:ae99:0:b0:d9a:fc8e:7c05 with SMTP id b25-20020a25ae99000000b00d9afc8e7c05mr1859738ybj.45.1697714816028; Thu, 19 Oct 2023 04:26:56 -0700 (PDT) MIME-Version: 1.0 References: <20231018-msm8909-cpufreq-v2-0-0962df95f654@kernkonzept.com> <20231018-msm8909-cpufreq-v2-2-0962df95f654@kernkonzept.com> In-Reply-To: From: Ulf Hansson Date: Thu, 19 Oct 2023 13:26:19 +0200 Message-ID: Subject: Re: [PATCH v2 2/3] cpufreq: qcom-nvmem: Enable virtual power domain devices To: Stephan Gerhold Cc: Viresh Kumar , Andy Gross , Bjorn Andersson , Konrad Dybcio , Ilia Lin , "Rafael J. Wysocki" , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Stephan Gerhold , stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Thu, 19 Oct 2023 04:27:12 -0700 (PDT) On Thu, 19 Oct 2023 at 12:24, Ulf Hansson wrote: > > On Wed, 18 Oct 2023 at 10:06, Stephan Gerhold > wrote: > > > > The genpd core caches performance state votes from devices that are > > runtime suspended as of commit 3c5a272202c2 ("PM: domains: Improve > > runtime PM performance state handling"). They get applied once the > > device becomes active again. > > > > To attach the power domains needed by qcom-cpufreq-nvmem the OPP core > > calls genpd_dev_pm_attach_by_id(). This results in "virtual" dummy > > devices that use runtime PM only to control the enable and performance > > state for the attached power domain. > > > > However, at the moment nothing ever resumes the virtual devices created > > for qcom-cpufreq-nvmem. They remain permanently runtime suspended. This > > means that performance state votes made during cpufreq scaling get > > always cached and never applied to the hardware. > > > > Fix this by enabling the devices after attaching them and use > > dev_pm_syscore_device() to ensure the power domains also stay on when > > going to suspend. Since it supplies the CPU we can never turn it off > > from Linux. There are other mechanisms to turn it off when needed, > > usually in the RPM firmware (RPMPD) or the cpuidle path (CPR genpd). > > I believe we discussed using dev_pm_syscore_device() for the previous > version. It's not intended to be used for things like the above. > > Moreover, I was under the impression that it wasn't really needed. In > fact, I would think that this actually breaks things for system > suspend/resume, as in this case the cpr driver's genpd > ->power_on|off() callbacks are no longer getting called due this, > which means that the cpr state machine isn't going to be restored > properly. Or did I get this wrong? BTW, if you really need something like the above, the proper way to do it would instead be to call device_set_awake_path() for the device. This informs genpd that the device needs to stay powered-on during system suspend (assuming that GENPD_FLAG_ACTIVE_WAKEUP has been set for it), hence it will keep the corresponding PM domain powered-on too. [...] Kind regards Uffe