From patchwork Thu Jul 18 23:43:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 13736782 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B00FDC3DA49 for ; Thu, 18 Jul 2024 23:44:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=2G6Wi/ghJW7ne1nL1LZ4kJtoZ1WxIyqIm9N6B8fvRMM=; b=iTTuqVVUGdlaf7+0U/LJyyPmIZ 7tSPLkGL2ZS7BdkDzs9f8ArDjeu0dof8LLXyNAA4lKowAQspUzuM/aCALlKMZyEEX3orUy7WFidY1 EFDWFOMPwsH/QSw+BL3Wpu2PcM09zuwa8RKDsWr+rT1gPV2oGbGdi8DGFubuBreg5wAUktlSSmtED wQX85tTEDrtIHDxo/Aiq92mnm2hZz+/CYTjH+ArIhHA7q8WUvgwjabJmcUNfSMRFM7MSLpkT4Kasd KwuZGHPs4p/ZvLh0KJ9+Diis6w87rjxG0vmbiF++WWLcNsbePlM0RorCGMOYRdKrpvpx7tej7YWri ySGNY7dw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sUamq-00000001190-1rYT; Thu, 18 Jul 2024 23:43:48 +0000 Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sUamU-0000000114A-2zPD for linux-arm-kernel@lists.infradead.org; Thu, 18 Jul 2024 23:43:28 +0000 Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-52ea79e689eso1588114e87.1 for ; Thu, 18 Jul 2024 16:43:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721346204; x=1721951004; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=2G6Wi/ghJW7ne1nL1LZ4kJtoZ1WxIyqIm9N6B8fvRMM=; b=Tf21L8ZTjfa5s4w8KTG8xNHW/Nco93ehAPPmDg0eXDBwQBazNlJFfSdAhdb5nCdu/V iXdQFam9eSCxXk2vMKVFFjGDRk21lpVf/22DYpbQC+YEwDCvY8DacLrAqa8bl2EmA001 zb2BJ3Sr7UN4d9L9hmIpo6hMnSxwqGf7vSIGOG46GAiLoW57uSgry9xef/LCqUoaRGgl iaO4Ka7wE5GyHms+dSoorm2N2f41EigOdSqRKoL+UMz05h7m8cWs/jo02VGbcPFhuGu8 HyqMfRBVOhud9IYqFlJh3dILxImDY214m8bunMALLaC+K1FNEIoYa2keY0lVO0XnMcm8 RGmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721346204; x=1721951004; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=2G6Wi/ghJW7ne1nL1LZ4kJtoZ1WxIyqIm9N6B8fvRMM=; b=jGX6/3msCvyyf4Wj32MBJvX7j6GDC7WtwYKehht+86kzJ8EhtBZHQzPb7hRLB+g92h KqKnX09oJdu3ny6b8Ym3tykidMSV4tYxvvnsqvnMHDBAD+PPnMPp30+0LMIVlMSfGN0u gzRwbgZugcY3gwm8xEMG71qGFwgELfiOHIpiqK4pHEOXUNb2V7Yr6BkbvsIQmrkWrl1M XN/DfVFp0RIv5bBtywqgI0hdulZbs+qh+FwaGEbV0UyqqQNbLnVvHnf79jFHjzyTyin/ BF0U7pOF5OWXyaqlxgrPhsd887h9crziBR6KYxAFuA7VnkUCZDGL1LbfLtieenWJ9lWR ZgzQ== X-Forwarded-Encrypted: i=1; AJvYcCW3q1/MgJSFY6a4Yd+68sNrCRMti89xBBI6kyG6JqD96IxCGvnNANbNjdk7vl4pgxpetTB2ZExrQfjna0vQ6D3sFPchnA3Jg3veEj5hItKJ56aemRg= X-Gm-Message-State: AOJu0YxHLba0eek256xowneWSSrb6VDJdhudI4TuKeImxX9AAzL5m+Pj 2VBhb1WQpkXnYzUVMy2jFNTugNFu2WHMDNBa9LXbj9kGdSz0X58DHoXrl7nck+A= X-Google-Smtp-Source: AGHT+IF+UwNsOHX2ZzNai2nhy5hTeg1HLABZ8GOiwqfPygMYjAAPG1DIHy5+fJSGlK3pIRK+hwampg== X-Received: by 2002:a05:6512:3055:b0:52c:df83:a740 with SMTP id 2adb3069b0e04-52ee53d7630mr5487536e87.30.1721346204544; Thu, 18 Jul 2024 16:43:24 -0700 (PDT) Received: from uffe-tuxpro14.. (h-178-174-189-39.A498.priv.bahnhof.se. [178.174.189.39]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52ef556b4fbsm22491e87.139.2024.07.18.16.43.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jul 2024 16:43:24 -0700 (PDT) From: Ulf Hansson To: Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Bjorn Andersson , Konrad Dybcio , Nikunj Kela , Prasad Sodagudi , Thierry Reding , Jonathan Hunter , Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 0/6] OPP/pmdomain: Assign required_devs for required OPPs through genpd Date: Fri, 19 Jul 2024 01:43:13 +0200 Message-Id: <20240718234319.356451-1-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240718_164326_776146_45B46196 X-CRM114-Status: GOOD ( 15.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Through dev_pm_opp_set_config() the _opp_attach_genpd() allows consumer drivers to hook up a device to its PM domains. Their corresponding virtual devices that are created by genpd during attach, are later being assigned as the required_devs for the corresponding required OPPs. In _opp_attach_genpd() we are also cross-checking whether the attached device's required OPPs really belongs to its PM domain's OPP table - and tries to fix it up if possible. In principle this works fine, but sometimes it's not convenient for consumer drivers to use _opp_attach_genpd(). Especially in the single PM domain case, when a device is usually attached by the bus-level ->probe() callbacks. Moreover, we now have dev_pm_domain_attach|detach_list() that helps consumer drivers to attach their devices to their PM domains. To improve the situation, this series moves genpd to assign the required_devs during device attach in genpd, which makes the cross-check of the OPP table to always get done. Note that, we still need to support the existing users of _opp_attach_genpd(), which makes this series slightly complicated. Once we have migrated those users to dev_pm_domain_attach|detach_list(), we should be able to remove _opp_attach_genpd() altogether. To test this, I have used a QEMU setup, with local PM test-drivers to try to test all various combinations of single/multi power/performance PM domains for a device. Hopefully I have covered it all, but I would certainly appreciate if someone could help to run a slew of tests on some HWs. Kind regards Ulf Hansson Ulf Hansson (6): OPP: Fix support for required OPPs for multiple PM domains OPP: Rework _set_required_devs() to manage a single device per call pmdomain: core: Manage the default required OPP from a separate function OPP/pmdomain: Set the required_dev for a required OPP during genpd attach pmdomain: core: Drop the redundant dev_to_genpd_dev() OPP: Drop redundant code in _link_required_opps() drivers/opp/core.c | 182 ++++++++++++++++++-------------------- drivers/opp/of.c | 39 +------- drivers/opp/opp.h | 4 +- drivers/pmdomain/core.c | 107 +++++++++++++++++----- include/linux/pm_domain.h | 6 -- include/linux/pm_opp.h | 10 ++- 6 files changed, 183 insertions(+), 165 deletions(-)