Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1861612rda; Tue, 24 Oct 2023 05:51:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFee4ELvobC64Pyb1/MehN5mBxhfFBX28DwbWRk04PhgzycckUvh7b83PEa6KDcW7a2unS4 X-Received: by 2002:a05:6871:a411:b0:1e9:c252:4853 with SMTP id vz17-20020a056871a41100b001e9c2524853mr11747529oab.5.1698151859917; Tue, 24 Oct 2023 05:50:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698151859; cv=none; d=google.com; s=arc-20160816; b=wRDU8CW69L1BZGD+9Lotj3oSt/9+6kQorb2Du69PoMT9yVxngjep4mC02hSkMCnEH8 81xS1VS4eQR+EbptcmgoWNZVcPu2sk+MbyiKNXJbYG86p+uHF06bdEZyFV8+SEB9I54m SxIMkXlknuLrBFt/+GDRt+BdQI7LcmwZqY8nWCC1vvOG2v9OrVAReuWX4UqxGRvywq4k 2VtjQvw0TTJ1g60GFfb/1olzj0pPmAZkEDXTACYAhyZl7RtvuWmkwrMzSxF5/1AwT/+g WYUY/IPC74e5MieiR//vQGebXT6CWRgFLVrjaoP3TJHHOlAovRpPjDz2Kcz70aR1ExhI moXw== 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=drfWjB6Z+XkamCb0RZVbD4fvzQ6BkCWkgYR2SPLQjDQ=; fh=uaRe7RB33YkOPCjLwrgEBUv5LhFbPA+BuDTmgAcEcng=; b=vVOXfal8+LyBtYJB1o+1Rx+a1pK8MAnHJnhtdYyp2PVAwtSn642KpYmtbyhVUD3ztL HrkKL+P4pbGBBINJaK9SD0WJjeVerfbynQcYmZZoxErzHzfnbA32+kMleVNqS01m/gOL Qm3jXBSPqyH6p7Y+U79j1tBUZ9oSEawlxsjiNreoAKeUZ8clH9QKH9WwPSizNF3X5sPX peQJxog8He3G8VmNPS57soTDVhQDOpvlHtCiVX/9VhFp3d/mBPsA3x7ddNfl/My4hl4Z LESY4ZFHjlum6ZqzvrnhnZ8FQLutt5TybGqDikSzicuFX6IQ4VO6u4K2/yGIGmDTdnl2 h9PA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HBszIJEj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id a21-20020a63e855000000b005859aa3da1esi8708383pgk.492.2023.10.24.05.50.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 05:50:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HBszIJEj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id 1FA318090EB9; Tue, 24 Oct 2023 05:50:40 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234384AbjJXMuO (ORCPT + 99 others); Tue, 24 Oct 2023 08:50:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234390AbjJXMuM (ORCPT ); Tue, 24 Oct 2023 08:50:12 -0400 Received: from mail-yw1-x1129.google.com (mail-yw1-x1129.google.com [IPv6:2607:f8b0:4864:20::1129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B12C3123 for ; Tue, 24 Oct 2023 05:50:08 -0700 (PDT) Received: by mail-yw1-x1129.google.com with SMTP id 00721157ae682-5a7af45084eso42847667b3.0 for ; Tue, 24 Oct 2023 05:50:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698151808; x=1698756608; 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=drfWjB6Z+XkamCb0RZVbD4fvzQ6BkCWkgYR2SPLQjDQ=; b=HBszIJEjk1A4xHOEl31Ftpw3M74iAcPoDvlg1joH27lysuT+u6/oRSsfwP8BbqGlTi 0ZaHn5pwFJJ9WRGbQuiCUMSkKH1QyALpj8l+IyVSkSqZKclyEFki1BZbpiWZMXKgH5Rn ezhXTKE1DesgDiXhA5dSC83H91HxHA6quA8E/JclciNLDNZ3VCoCub/NKw9NQTGfUVIF lIe5KWZC4ccoBBiZansLoP01AaCHsBsruV+hmyc9Yc1Wso5XV40GWhywUHsnJ5EFzgvI 7z92i0kY3Yo7Ij4/f+sHnDGVdajC8CRYNK2j+lmcV/LComgsJS76Ozr/jr+PLeHr6Mf8 +4vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698151808; x=1698756608; 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=drfWjB6Z+XkamCb0RZVbD4fvzQ6BkCWkgYR2SPLQjDQ=; b=Burv/mq+Q6LdKEsS6WGpcRxrEiOwzgjx/zrJhLH5tYyoTQFGIIk8y1IwQIdehsqSfy CvDVzvM7XjuycdvQXLvmTWQffR5fixdIONe0HHQHX+x/iCzmmyxDwGQNGM4cpQYOvfJc 9hXztC16UNKf9WKrT6dSEX44vX+hzDO8gJmH2WJ8UdPPp8vEL8lEWez40I+p7bJ5S3xu wYDm8sVyY7e8Emrbef7amQkJ3YxGOH4SWII62uzKcMQvjrxgR36D4j2U/SPcrlcH7SOz pp/7NFA7Q3w0lp6rwMKZohRtpPnvxIuIq3eeQGJUPZdqexbeYJNRI3elwJyyQesDWlc4 VRew== X-Gm-Message-State: AOJu0YwM4g2zvfEIiLKZdvKtlmNVRa13d80V6HMuWGf0uWvxqbU3cp6o /qNIsBZM5x8Q2yDDCNkZ/3y7das4eIythGyw1YOtsQ== X-Received: by 2002:a0d:dac1:0:b0:598:7836:aac1 with SMTP id c184-20020a0ddac1000000b005987836aac1mr10268798ywe.49.1698151807846; Tue, 24 Oct 2023 05:50:07 -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: Tue, 24 Oct 2023 14:49:32 +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 agentk.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 (agentk.vger.email [0.0.0.0]); Tue, 24 Oct 2023 05:50:42 -0700 (PDT) On Tue, 24 Oct 2023 at 14:03, Stephan Gerhold wrote: > > On Thu, Oct 19, 2023 at 01:26:19PM +0200, Ulf Hansson wrote: > > 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. > > > > Unfortunately this does not work correctly. When I use > device_set_awake_path() it does set dev->power.wakeup_path = true. > However, this flag is cleared again in device_prepare() when entering > suspend. To me it looks a bit like wakeup_path is not supposed to be set > directly by drivers? Before and after your commit 8512220c5782 ("PM / > core: Assign the wakeup_path status flag in __device_prepare()") it > seems to be internally bound to device_may_wakeup(). > > It works if I make device_may_wakeup() return true, with > > device_set_wakeup_capable(dev, true); > device_wakeup_enable(dev); > > but that also allows *disabling* the wakeup from sysfs which doesn't > really make sense for the CPU. > > Any ideas? The device_set_awake_path() should be called from a system suspend callback. So you need to add that callback for the cpufreq driver. Sorry, if that wasn't clear. Kind regards Uffe