From patchwork Mon Nov 26 08:10:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 151991 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp5345582ljp; Mon, 26 Nov 2018 00:10:29 -0800 (PST) X-Google-Smtp-Source: AFSGD/WWzIFi+IRMpJhAbns0g5bPFNJlmCYFeVhKk5a2sblAjY+EtZ6UIbPQEsjTciBXPd57OzLn X-Received: by 2002:a63:585c:: with SMTP id i28mr23968101pgm.178.1543219829271; Mon, 26 Nov 2018 00:10:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543219829; cv=none; d=google.com; s=arc-20160816; b=YoSCgDXXEyfwaaJcoopIUDa+mnAnBewuHK30ad+LKqFKqGPG/PzLHZAD4k+ZEFVFJV cV9ozl2E0t73xlsqyKrPJ/W5ubQ3lZMNO0aNIPxwL+xXkw4Hf96WmQU9/TzM+RiWqx9K wmltccI74jLKmkOavXOsgE0RJnt8M4tW4gRUX8B/wQE8ce+QtPAinnPJ4h+qfzb0PGNX EJrLrNxGmEOklt8VKaQLvlT34ExiUkjX3DaZmPNIM+F6Tx8YY6Ynq7haLW4oGI7h8dzN EGSauYQSadlvAJ59ptEJAP2wifxSYzTyKW2ceRptzlb5YHnlOmfSmA7k3Yjoqx/jgvfD FDaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=++v3XXRbpVHJuX8RyfyvTaqYBFuAGN2iIxtK4ZIufKQ=; b=wkLkNrEg02LXcOETGyjmEkX51Oc7nwmH4sUiaoKAQYanBsu/NxE+YM4pyHi7eCXP0i Jb0GpJC8QJVnZaoGN6HK2n5Kt117NZAxYZ4ePG55Ie+C3nddSWzyg6AWuKI/Cr16JpYL t4ngOglUqUyeGDtznEc1eykVp+DFnt+03ZuvMqJfmWe9j0zrDpi5mvgMCMBsIOnj4uvv 9NWrgN9zSCjkMuOt1F+UH8TLkBj35atgeK1sFUDJiqc3p1czzZGCnh80DDXADKbkBrry 74rpHvb4gEKPdVMAD5HHWFLvMPp28MJdFSc7muZJ+SwXJVbt5hRZEFR49e9OybbgUWxb qScA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OqCnAYXK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gn22si9906040plb.19.2018.11.26.00.10.28; Mon, 26 Nov 2018 00:10:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OqCnAYXK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726435AbeKZTDq (ORCPT + 32 others); Mon, 26 Nov 2018 14:03:46 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:36950 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726203AbeKZTDp (ORCPT ); Mon, 26 Nov 2018 14:03:45 -0500 Received: by mail-pl1-f194.google.com with SMTP id b5so13505858plr.4 for ; Mon, 26 Nov 2018 00:10:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=++v3XXRbpVHJuX8RyfyvTaqYBFuAGN2iIxtK4ZIufKQ=; b=OqCnAYXKYFFxfcDQdBH/amjiIdW1xiVkdUh5+TDq0nVt9fP81udsrShE6qgoYxrwMp 2xugRb01JUUZscmyv1RXtbtDgFPCAkqtkojuuUFABQCSFiNSFyLJRpx9C5OFaOjXNGTI ll3/aURzt7SHZ90gSqCftbJxZFMeoqR8V9nIQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=++v3XXRbpVHJuX8RyfyvTaqYBFuAGN2iIxtK4ZIufKQ=; b=XPgDaLHrqqebP84oYCJKdGsgtA+EPnHQ0xx5iOAz2PLH3UxaKNNZpb2IjpGQ0y7VR+ rwz4MYkvQAI3MdSPPtNsYdNnCORaR1mCXdrtyy7v7mTtXHS7MMkYZxRioRmWGPJmgb3s Bcr4RbB1CYH5qplZlw2MnNk76c7NRq2iQQnmqh8Llo7wWTWPigEOhxHfCKfhPfoaxY5o N0QWag3UuUhOMGtORSVEQppTug4vT3i8J5wI3vwyhRuJp225y+4dpCFHYeYGtDKRp7MH aFwMqAI68BREwkd2mJu8gkYU2S9oUDgm8T/Q0uGaZuG3XwvGiH0mGP9lXNhji8GQf7N9 7+vQ== X-Gm-Message-State: AA+aEWZ43RwC7vZicf5lyDpS3vlCIWe2L32E3mvHshg4FQsOG+WOinYx hVTlglMwJjGQVAIag8KB0zA8UA== X-Received: by 2002:a17:902:f091:: with SMTP id go17mr27154879plb.235.1543219826521; Mon, 26 Nov 2018 00:10:26 -0800 (PST) Received: from localhost ([122.172.88.116]) by smtp.gmail.com with ESMTPSA id 6sm89302753pfv.30.2018.11.26.00.10.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Nov 2018 00:10:25 -0800 (PST) From: Viresh Kumar To: ulf.hansson@linaro.org, Rafael Wysocki , Kevin Hilman , Len Brown , Pavel Machek Cc: Viresh Kumar , Vincent Guittot , rnayak@codeaurora.org, niklas.cassel@linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 3/5] PM / Domains: Save OPP table pointer in genpd Date: Mon, 26 Nov 2018 13:40:02 +0530 Message-Id: X-Mailer: git-send-email 2.19.1.568.g152ad8e3369a In-Reply-To: References: MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We will need these going forward in hotpath, i.e. from within dev_pm_genpd_set_performance_state(). Lets fetch and save them while the OPP tables are added. Signed-off-by: Viresh Kumar --- drivers/base/power/domain.c | 23 +++++++++++++++++++++-- include/linux/pm_domain.h | 2 ++ 2 files changed, 23 insertions(+), 2 deletions(-) -- 2.19.1.568.g152ad8e3369a diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 8e554e6a82a2..0d928359b880 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -1907,12 +1907,21 @@ int of_genpd_add_provider_simple(struct device_node *np, ret); goto unlock; } + + /* + * Save table for faster processing while setting performance + * state. + */ + genpd->opp_table = dev_pm_opp_get_opp_table(&genpd->dev); + WARN_ON(!genpd->opp_table); } ret = genpd_add_provider(np, genpd_xlate_simple, genpd); if (ret) { - if (genpd->set_performance_state) + if (genpd->set_performance_state) { + dev_pm_opp_put_opp_table(genpd->opp_table); dev_pm_opp_of_remove_table(&genpd->dev); + } goto unlock; } @@ -1965,6 +1974,13 @@ int of_genpd_add_provider_onecell(struct device_node *np, i, ret); goto error; } + + /* + * Save table for faster processing while setting + * performance state. + */ + genpd->opp_table = dev_pm_opp_get_opp_table_indexed(&genpd->dev, i); + WARN_ON(!genpd->opp_table); } genpd->provider = &np->fwnode; @@ -1989,8 +2005,10 @@ int of_genpd_add_provider_onecell(struct device_node *np, genpd->provider = NULL; genpd->has_provider = false; - if (genpd->set_performance_state) + if (genpd->set_performance_state) { + dev_pm_opp_put_opp_table(genpd->opp_table); dev_pm_opp_of_remove_table(&genpd->dev); + } } mutex_unlock(&gpd_list_lock); @@ -2024,6 +2042,7 @@ void of_genpd_del_provider(struct device_node *np) if (!gpd->set_performance_state) continue; + dev_pm_opp_put_opp_table(gpd->opp_table); dev_pm_opp_of_remove_table(&gpd->dev); } } diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h index 642036952553..9ad101362aef 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h @@ -73,6 +73,7 @@ struct genpd_power_state { struct genpd_lock_ops; struct dev_pm_opp; +struct opp_table; struct generic_pm_domain { struct device dev; @@ -94,6 +95,7 @@ struct generic_pm_domain { unsigned int performance_state; /* Aggregated max performance state */ int (*power_off)(struct generic_pm_domain *domain); int (*power_on)(struct generic_pm_domain *domain); + struct opp_table *opp_table; /* OPP table of the genpd */ unsigned int (*opp_to_performance_state)(struct generic_pm_domain *genpd, struct dev_pm_opp *opp); int (*set_performance_state)(struct generic_pm_domain *genpd,