From patchwork Mon Nov 5 06:36:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 150140 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2242335ljp; Sun, 4 Nov 2018 22:37:20 -0800 (PST) X-Google-Smtp-Source: AJdET5dH7pDCIQh/x6XJdDMTZJyOwjYfbAJ51HSz3QL4NejIGMCRPzDjy5U3cOCKaqB569qpupad X-Received: by 2002:a62:5285:: with SMTP id g127-v6mr12896800pfb.128.1541399840732; Sun, 04 Nov 2018 22:37:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541399840; cv=none; d=google.com; s=arc-20160816; b=WXCwUpUg1Qw7TIVVqt2rum7Fg3DdFMsVf6Rv8+SeU8zJmolU2hxBpWcPP4Izt7cBOp PfUmG08Ukp6Z8lAU6mdM24xp1KP8CJ7/wFLdLqt3KzemjRj9j1YJOkhVY2Le97XrQCAc G6AgPGr1bspK/o1lG2PVhvIyx7X6Jnv16yMFY0ltPN0Lf1ABw2cBAi7hYQbDrt6m/i2C wP9/MoWdKdxwL/hQ60xy6f3yp4vYZVtrrsgPC41CN4Qe6LcPRLBejdTUgkFrw72CSHIj 7k/y1NmnBjWsNIi5WimLB25mfnOYyO2czrdWOud5O4THnZmmurXPGSDUhPgyTnWotlyk D6lg== 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=wTUjqSF2pLhjBahpW9CEESpYzYSBr5WnF7SmzPTqlutGFeeW0pZNufuvjCKRzRzpOM 1AMI0I/9NtVIqxtHPTrHP9TnpiIDro3cuhjoiUJTkHFvWucCuzTwYTSaGs3a/BXVIY8C h1kXFIQYgJBIpgVJx3RS6T7fQ1nsK7+KuZKCqbbfoTnIxqTnv24Vk51HWkgBY9b+h+/T 9kZpJtAUxYTym5TAYeMr9TxNckTogEzMwodnYpqcjTTPrFR3IRcleHV5Lh78s/jLYsDV 1aCCq5vXXKT10DeTvYF293LrlrHePM/eho3psZtWGGxiaz8FHIuteUnHYrENix2df2yA dG/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bsoKAnUs; 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 bi6-v6si30585614plb.348.2018.11.04.22.37.20; Sun, 04 Nov 2018 22:37:20 -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=bsoKAnUs; 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 S1729448AbeKEPzY (ORCPT + 32 others); Mon, 5 Nov 2018 10:55:24 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:39900 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729398AbeKEPzX (ORCPT ); Mon, 5 Nov 2018 10:55:23 -0500 Received: by mail-pl1-f196.google.com with SMTP id b5-v6so3941888pla.6 for ; Sun, 04 Nov 2018 22:37:17 -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=bsoKAnUs+j9TMTBQiNfz11G8VWYBM+z6/t3fMiHdrKu1VTmHha1XLRO7mN6d0iSqTR UcklcFwRcjxJCN1buo21Thb8oHsVenu+WKDhTHAqg0YXPo3aI5cZMZrqnrSkB/r7fGR9 XjNoSn71TgZ6arMdToxGrwhQSoKRg44gjubtk= 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=m4FA2V2T8HUjj/6E+xBq4jT+FxYsikeuTzd4haqBONxlrlQw/LqPCsRHpkvCr2wdEQ sPsIWqO2TigrDAIatEPDr9P7kN93dFFlSCNp29Xu3UCRXKcKIPlQaIDTEVw8IorGOiTr uxI2wc8dRBAKXcplF1JuMpDYL8FfuTjKvE35+dkZq1952R+qpzhsrTwv6VSAo9bg1jJg OF0MDaintX6ty0ZODeKADNbMuC1kRcT5m4+DtwZy/Ho12Q49VJf6QMyix6upi4E1f1B0 g+qbZI2iTGz7hhvLd5IeUA9ZczvX5ZDZf/Mnp5j2THfxt8byDTN9RHPjeL99sCW/qdir 1CiQ== X-Gm-Message-State: AGRZ1gLBsWALI1RcBhyLQrMfE6EeUJKgPRA5LtY2wkSovowNc6W2xG/2 EHBYCLBCgMrvxv1EUI+8hl/j/w== X-Received: by 2002:a17:902:7c0b:: with SMTP id x11-v6mr20640642pll.60.1541399836850; Sun, 04 Nov 2018 22:37:16 -0800 (PST) Received: from localhost ([171.61.116.174]) by smtp.gmail.com with ESMTPSA id o83-v6sm30019326pfa.90.2018.11.04.22.37.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 04 Nov 2018 22:37:16 -0800 (PST) From: Viresh Kumar To: ulf.hansson@linaro.org, "Rafael J. Wysocki" , Kevin Hilman , Pavel Machek , Len Brown Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Stephen Boyd , Nishanth Menon , niklas.cassel@linaro.org, rnayak@codeaurora.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/4] PM / Domains: Save OPP table pointer in genpd Date: Mon, 5 Nov 2018 12:06:44 +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,