Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4833769rdb; Tue, 12 Dec 2023 10:26:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IH8TaSWsRrCGLnqScoS/0gaSK9Xl6ZEVY1w2/nVa8ez4Yn8CEES6ehP7Wpnyrg84M+IoYAz X-Received: by 2002:a05:6359:5c2a:b0:170:1ab2:221b with SMTP id pu42-20020a0563595c2a00b001701ab2221bmr4213665rwb.58.1702405582870; Tue, 12 Dec 2023 10:26:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702405582; cv=none; d=google.com; s=arc-20160816; b=srw1RZ0vpliZ84jKWumgMwnHnTc2yFInGSdZVRsV629S56rQfcgFnZvuKOvZQlWvXj Rvc7pL4BbaRzlFHEH3Xqt87bALsVkm1WrSWeCG8ji+ohIJrzeDCsbqtwqVeCuTNU5i4p jO4r99e//e0NvCJI/0M9VoPSWw3AcHvLDB8msDDNr39n5GhPFM+UzdtZL1ocq7WDprNx eKl4T389O9DPPTqPBX1Zb1ls6x/VDdpjTko6w1gLjxIzumQp/X1RxJK4mnIp/i+bXWLA 56bJl9b6tCVVTN2AHTWdIiLmMRLH9bMFIXiqmg0EBUJrklnmzi/lo0pjdgokJpZPGU56 EZHQ== 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:references:in-reply-to:subject:cc:to:from; bh=6M9JVGhLSfmb8yDGCMzqSgfVynZLt/iGRTDJ5sw/QUw=; fh=n9KzoazXESe2LNGk1922uNIFFRASa0uXzZmmZowXAvM=; b=Ss3Sy6ALYO8xVT+crEWoVpOYvMnfwjUhSYHP6FOFnumdeOVAQa63LD8gr8QPqzMwtm lnxU7j+1gUwkytdxxUTOnSO97ffVmFgQZqNvjpuGH5SEMarb5oBJVvgaF2zZzVaPnAHv fnU5L7+p8HvFNk0/FCOg5/8kF9FBfDenaV9KUaVXGacJs/1/RLDv5ljgbXWtFmi1Kdpd m9G8+c0jMDEOYdzHvFk/vslRUmD2CufoykK4dXrjICZGLEEXG3tSurVqYFSM1x4zNAVW HvsjP7WX/2gs48BRdwpdiK9YIeu8leNLgeiy2d05S+TKqnjU4RXikDwTeSkPVGtU57HA 1ZaQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id by12-20020a056a02058c00b005c66c2d0a5csi8438857pgb.484.2023.12.12.10.26.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 10:26:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id E47F68051141; Tue, 12 Dec 2023 10:26:19 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232907AbjLLS0F convert rfc822-to-8bit (ORCPT + 99 others); Tue, 12 Dec 2023 13:26:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232546AbjLLS0D (ORCPT ); Tue, 12 Dec 2023 13:26:03 -0500 Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21AA8CE for ; Tue, 12 Dec 2023 10:26:07 -0800 (PST) Received: by mail-pg1-f177.google.com with SMTP id 41be03b00d2f7-5c6734e0c22so3055420a12.0 for ; Tue, 12 Dec 2023 10:26:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702405566; x=1703010366; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9lX++N5VCWclr3d1h9X3xvVDF9stHF9vZ8hPgWWAfgI=; b=HvPC32mnb+MdbR4UEP1U5fnWQsNgvDpbH8YjQao5KPNh0pDT2Xt/OAU6nSmBcuhTp6 zX9Td4eaawg72dUGYUKHDx0abaQWgNReYP4M/qB7ULaZb5XCWFlAdeLwjcUmiks9yG+x wMIUOrkpCZJHPxhhYfRBWpJFmSd/HyPGibYxIUTiib904sS6p+NWwh2c75XqQjDAVOtl uxcsd81EC/iAmFdSASU5xl5SNx58VVj/7WQl+W6suOSxU/Mkld75dUkRuCA7UcPCMCx1 OoNijlXwB6Xb/iFoppwInW0sjg+Eubbj0c69pRw1r0y+ESsYpYl5hQxz0g6b9gin5OfW CdBQ== X-Gm-Message-State: AOJu0YwxdY3QRds8uLK15syt5/pAlvRzAfiRwH+Th1ozAlqp1Qv0sdEh 9QVlFW6ZgQrCaSZGT60P3S/wIA== X-Received: by 2002:a17:90a:f30e:b0:286:a2a3:1e4f with SMTP id ca14-20020a17090af30e00b00286a2a31e4fmr3120316pjb.64.1702405566516; Tue, 12 Dec 2023 10:26:06 -0800 (PST) Received: from localhost (75-172-121-199.tukw.qwest.net. [75.172.121.199]) by smtp.gmail.com with ESMTPSA id q30-20020a17090a17a100b0028ac663af16sm1585825pja.23.2023.12.12.10.26.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 10:26:05 -0800 (PST) From: Kevin Hilman To: =?utf-8?Q?Th=C3=A9o?= Lebrun , Roger Quadros , Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Peter Chen , Pawel Laszczak , Nishanth Menon , Vignesh Raghavendra , Tero Kristo , "Vardhan, Vibhore" Cc: linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, =?utf-8?Q?Gr=C3=A9gory?= Clement , Thomas Petazzoni Subject: Re: [PATCH 3/6] usb: cdns3-ti: add suspend/resume procedures for J7200 In-Reply-To: References: <20231113-j7200-usb-suspend-v1-0-ad1ee714835c@bootlin.com> <20231113-j7200-usb-suspend-v1-3-ad1ee714835c@bootlin.com> <5080372b-1f48-4cbc-a6c4-8689c28983cb@kernel.org> <3e00b2ad-b58f-4b09-9230-683c58d3bb92@kernel.org> <7h34wxfmwn.fsf@baylibre.com> <7hil5odtwl.fsf@baylibre.com> Date: Tue, 12 Dec 2023 10:26:05 -0800 Message-ID: <7h7cljcm6a.fsf@baylibre.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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, 12 Dec 2023 10:26:20 -0800 (PST) Théo Lebrun writes: > Hello, > > On Sun Nov 26, 2023 at 11:36 PM CET, Kevin Hilman wrote: >> Théo Lebrun writes: >> > On Wed Nov 22, 2023 at 11:23 PM CET, Kevin Hilman wrote: >> >> Théo Lebrun writes: >> >> The point is to signal to the power domain the device is in that it can >> >> power on/off. These IP blocks are (re)used on many different SoCs, so >> >> the driver should not make any assumptions about what power domain it is >> >> in (if any.) >> > >> > On my platform, when the device is attached to the PD it gets turned on. >> > That feels logical to me: if a driver is not RPM aware it "just works". >> >> It "just works"... until the domain gets turned off. >> >> > Are there platforms where RPM must get enabled for the attached >> > power-domains to be turned on? >> >> Yes, but but more importantly, there are platforms where RPM must get >> enabled for the power domain to *stay* on. For example, the power >> domain might get turned on due to devices probing etc, but as soon as >> all the RPM-enabled drivers drop their refcount, the domain will turn >> off. If there is a device in that domain with a non-RPM enabled driver, >> that device will be powered off anc cause a crash. > > OK, that makes sense, thanks for taking the time to explain. This topic > makes me see two things that I feel are close to being bugs. I'd be > curious to get your view on both. TL;DR; they are features, not bugs. ;) > - If a device does not use RPM but its children do, it might get its > associated power-domain turned off. That forces every single driver > that want to stay alive to enable & increment RPM. > > What I naively expect: a genpd with a device attached to it that is > not using RPM should mean that it should not be powered off at > runtime_suspend. Benefit: no RPM calls in drivers that do not use > it, and the behavior is that the genpd associated stays alive "as > expected". Your expectation makes sense, but unfortunately, that's not how RPM was designed. Also remember that we don't really want specific device drivers to know which PM domain they are in, or whether they are in a PM domain at all. The same IP block can be integrated in different ways across different SoCs, even within the same SoC family, and we want the device driver to just work. For that to work well, any driver that might be in any PM domain should add RPM calls. > - If a device uses RPM & has a refcount strictly positive, its > associated power-domain gets turned off either way at suspend_noirq. > That feels non-intuitive as well. > > What I naively expect: check for RPM refcounts of attached devices > when doing suspend_noirq of power-domains. Benefit: control of what > power-domains do from attached devices is done through the RPM API. I agree that this is non-intuitive from an RPM PoV, but remember that RPM was added on top of existing system-wide suspend support. And from a system-wide suspend PoV, it might be non-intuitive that a driver thinks it should be active (non-zero refcount) when user just requested a system-wide suspend. Traditionally, when a user requests a system-wide suspend, they expect the whole system to shut down. On real SoCs in real products, power management is not so black and white, and I fully understand that, and personally, I'm definitely open to not forcing RPM-active devices off in suspend, but that would require changes to core code, and remove some assumptions of core code that would need to be validated/tested. Kevin