From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D342C04AB6 for ; Fri, 31 May 2019 20:14:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EFA8426E22 for ; Fri, 31 May 2019 20:14:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="O35kPx5r" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727413AbfEaUOD (ORCPT ); Fri, 31 May 2019 16:14:03 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:34946 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727287AbfEaUOD (ORCPT ); Fri, 31 May 2019 16:14:03 -0400 Received: by mail-wr1-f65.google.com with SMTP id m3so7296442wrv.2 for ; Fri, 31 May 2019 13:14:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:references:from:openpgp:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=1veSzmme9xy9EDCdaXF+fOGjs1JaVIDVHse9u2t5kHE=; b=O35kPx5r6zUN5pUBRFbzTq/dtlhn75KVRNgPXWArXjSD34YvThVRP0uYM0/vep8/35 9FuvwrJaHehlrkKn3Tn2fw188nhb6N5u+Zh8r+ZTz1LTe/8k0+JhRMTLqPs6sA+SVKjY ivvf2oGkpRJL5Oo7tH72JhEVwpX8TQ7M3PXoIaMksVVko6MvoP3pD0NCSstFZ/EREaq1 jzTQ7qd9u3oQEiqj8MMtvdAarpdEetYEIDbEwkxuA7c/Nif7InjwDIEiL6oMBlJdxtIQ CiirPxzWjuzVHkootO5kD/oMGVcDbRCPsG5dePAhW59AFRq4ZZuseimCM9h4nbiCcVs0 bbUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=1veSzmme9xy9EDCdaXF+fOGjs1JaVIDVHse9u2t5kHE=; b=ks/uEssh1QJJfTxITBswL3x46QRVsVzCNlgekiHhfJS6GhuoDMDhjwdrjaEzEMJgnU 8oGNmtIBecvj3UyEtx1g5ta20PE0lsvQQeWfZkJGncE2hEgbcvWpvfwmSrcUjIJHlapM jPu7NRm6X4AofUW1xysanPHMZe/UBtPsE7nn7mmQ+DyRmP0FHZVCOWtXGKodTF3yGl5P pHH7c2LMmzg7Ts8UaDkLe62qqMK0wxCozyvQOx53/6R8Wy+LZxRr6vFegaDWSIT3m3iX ExDD5ehMVx1dJWFSMSS1J3Cn0xQnKpKi40kQRfRQNMFpV14ErOaiZYtnTXTp9HhsaMsO TVIQ== X-Gm-Message-State: APjAAAWeZ1WnWOHNCvFbyJaDYyR4wjTqKmMNPw1jpPf4R5jZ8v1gxvak YlS70H0WcHkO+NDLvRNOYoqYdA== X-Google-Smtp-Source: APXvYqyo/wcntUU4TyrfMaNmdty93gvojoM5MPib/xTT60WDBlXHYcpR8O12fXaOdaF+8JPLQYUJHA== X-Received: by 2002:adf:dc04:: with SMTP id t4mr8215909wri.126.1559333640803; Fri, 31 May 2019 13:14:00 -0700 (PDT) Received: from [192.168.43.165] ([37.168.13.193]) by smtp.googlemail.com with ESMTPSA id s7sm5819335wmc.2.2019.05.31.13.13.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 31 May 2019 13:14:00 -0700 (PDT) Subject: Re: [PATCH v5 2/3] thermal: cpu_cooling: Make the power-related code depend on IPA To: Quentin Perret , edubezval@gmail.com, rui.zhang@intel.com, javi.merino@kernel.org, viresh.kumar@linaro.org, amit.kachhap@gmail.com, rjw@rjwysocki.net, will.deacon@arm.com, catalin.marinas@arm.com, dietmar.eggemann@arm.com, ionela.voinescu@arm.com, mka@chromium.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org References: <20190530092038.12020-1-quentin.perret@arm.com> <20190530092038.12020-3-quentin.perret@arm.com> From: Daniel Lezcano Openpgp: preference=signencrypt Autocrypt: addr=daniel.lezcano@linaro.org; prefer-encrypt=mutual; keydata= mQINBFv/yykBEADDdW8RZu7iZILSf3zxq5y8YdaeyZjI/MaqgnvG/c3WjFaunoTMspeusiFE sXvtg3ehTOoyD0oFjKkHaia1Zpa1m/gnNdT/WvTveLfGA1gH+yGes2Sr53Ht8hWYZFYMZc8V 2pbSKh8wepq4g8r5YI1XUy9YbcTdj5mVrTklyGWA49NOeJz2QbfytMT3DJmk40LqwK6CCSU0 9Ed8n0a+vevmQoRZJEd3Y1qXn2XHys0F6OHCC+VLENqNNZXdZE9E+b3FFW0lk49oLTzLRNIq 0wHeR1H54RffhLQAor2+4kSSu8mW5qB0n5Eb/zXJZZ/bRiXmT8kNg85UdYhvf03ZAsp3qxcr xMfMsC7m3+ADOtW90rNNLZnRvjhsYNrGIKH8Ub0UKXFXibHbafSuq7RqyRQzt01Ud8CAtq+w P9EftUysLtovGpLSpGDO5zQ++4ZGVygdYFr318aGDqCljKAKZ9hYgRimPBToDedho1S1uE6F 6YiBFnI3ry9+/KUnEP6L8Sfezwy7fp2JUNkUr41QF76nz43tl7oersrLxHzj2dYfWUAZWXva wW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Fr/pxH5CbYJDk0 tYUhisTESeesbvWSPO5uNqqy1dAFw+dqRcF5gXIh3NKX0gqiAA87NM7nL5ym/CNpJ7z7nRC8 qePOXubgouxumi5RQs1+crBmCDa/AyJHKdG2mqCt9fx5EPbDpw6Zzx7hgURh4ikHoS7/tLjK iqWjuat8/HWc01yEd8rtkGuUcMqbCi1XhcAmkaOnX8FYscMRoyyMrWClRZEQRokqZIj79+PR adkDXtr4MeL8BaB7Ij2oyRVjXUwhFQNKi5Z5Rve0a3zvGkkqw8Mz20BOksjSWjAF6g9byukl CUVjC03PdMSufNLK06x5hPc/c4tFR4J9cLrV+XxdCX7r0zGos9SzTPGNuIk1LK++S3EJhLFj 4eoWtNhMWc1uiTf9ENza0ntqH9XBWEQ6IA1gubCniGG+Xg== Message-ID: <1980a46c-3aaf-2b39-1154-fa2abcfdab50@linaro.org> Date: Fri, 31 May 2019 22:13:55 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190530092038.12020-3-quentin.perret@arm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org On 30/05/2019 11:20, Quentin Perret wrote: > The core CPU cooling infrastructure has power-related functions > that have only one client: IPA. Since there can be no user of those > functions if IPA is not compiled in, make sure to guard them with > checks on CONFIG_THERMAL_GOV_POWER_ALLOCATOR to not waste space > unnecessarily. > > Suggested-by: Daniel Lezcano > Signed-off-by: Quentin Perret Acked-by: Daniel Lezcano Thanks! -- Daniel > --- > drivers/thermal/cpu_cooling.c | 214 +++++++++++++++++----------------- > 1 file changed, 104 insertions(+), 110 deletions(-) > > diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c > index 4c5db59a619b..498f59ab64b2 100644 > --- a/drivers/thermal/cpu_cooling.c > +++ b/drivers/thermal/cpu_cooling.c > @@ -46,7 +46,9 @@ > */ > struct freq_table { > u32 frequency; > +#ifdef CONFIG_THERMAL_GOV_POWER_ALLOCATOR > u32 power; > +#endif > }; > > /** > @@ -96,28 +98,6 @@ static DEFINE_IDA(cpufreq_ida); > static DEFINE_MUTEX(cooling_list_lock); > static LIST_HEAD(cpufreq_cdev_list); > > -/* Below code defines functions to be used for cpufreq as cooling device */ > - > -/** > - * get_level: Find the level for a particular frequency > - * @cpufreq_cdev: cpufreq_cdev for which the property is required > - * @freq: Frequency > - * > - * Return: level corresponding to the frequency. > - */ > -static unsigned long get_level(struct cpufreq_cooling_device *cpufreq_cdev, > - unsigned int freq) > -{ > - struct freq_table *freq_table = cpufreq_cdev->freq_table; > - unsigned long level; > - > - for (level = 1; level <= cpufreq_cdev->max_level; level++) > - if (freq > freq_table[level].frequency) > - break; > - > - return level - 1; > -} > - > /** > * cpufreq_thermal_notifier - notifier callback for cpufreq policy change. > * @nb: struct notifier_block * with callback info. > @@ -171,6 +151,27 @@ static int cpufreq_thermal_notifier(struct notifier_block *nb, > return NOTIFY_OK; > } > > +#ifdef CONFIG_THERMAL_GOV_POWER_ALLOCATOR > +/** > + * get_level: Find the level for a particular frequency > + * @cpufreq_cdev: cpufreq_cdev for which the property is required > + * @freq: Frequency > + * > + * Return: level corresponding to the frequency. > + */ > +static unsigned long get_level(struct cpufreq_cooling_device *cpufreq_cdev, > + unsigned int freq) > +{ > + struct freq_table *freq_table = cpufreq_cdev->freq_table; > + unsigned long level; > + > + for (level = 1; level <= cpufreq_cdev->max_level; level++) > + if (freq > freq_table[level].frequency) > + break; > + > + return level - 1; > +} > + > /** > * update_freq_table() - Update the freq table with power numbers > * @cpufreq_cdev: the cpufreq cooling device in which to update the table > @@ -319,80 +320,6 @@ static u32 get_dynamic_power(struct cpufreq_cooling_device *cpufreq_cdev, > return (raw_cpu_power * cpufreq_cdev->last_load) / 100; > } > > -/* cpufreq cooling device callback functions are defined below */ > - > -/** > - * cpufreq_get_max_state - callback function to get the max cooling state. > - * @cdev: thermal cooling device pointer. > - * @state: fill this variable with the max cooling state. > - * > - * Callback for the thermal cooling device to return the cpufreq > - * max cooling state. > - * > - * Return: 0 on success, an error code otherwise. > - */ > -static int cpufreq_get_max_state(struct thermal_cooling_device *cdev, > - unsigned long *state) > -{ > - struct cpufreq_cooling_device *cpufreq_cdev = cdev->devdata; > - > - *state = cpufreq_cdev->max_level; > - return 0; > -} > - > -/** > - * cpufreq_get_cur_state - callback function to get the current cooling state. > - * @cdev: thermal cooling device pointer. > - * @state: fill this variable with the current cooling state. > - * > - * Callback for the thermal cooling device to return the cpufreq > - * current cooling state. > - * > - * Return: 0 on success, an error code otherwise. > - */ > -static int cpufreq_get_cur_state(struct thermal_cooling_device *cdev, > - unsigned long *state) > -{ > - struct cpufreq_cooling_device *cpufreq_cdev = cdev->devdata; > - > - *state = cpufreq_cdev->cpufreq_state; > - > - return 0; > -} > - > -/** > - * cpufreq_set_cur_state - callback function to set the current cooling state. > - * @cdev: thermal cooling device pointer. > - * @state: set this variable to the current cooling state. > - * > - * Callback for the thermal cooling device to change the cpufreq > - * current cooling state. > - * > - * Return: 0 on success, an error code otherwise. > - */ > -static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev, > - unsigned long state) > -{ > - struct cpufreq_cooling_device *cpufreq_cdev = cdev->devdata; > - unsigned int clip_freq; > - > - /* Request state should be less than max_level */ > - if (WARN_ON(state > cpufreq_cdev->max_level)) > - return -EINVAL; > - > - /* Check if the old cooling action is same as new cooling action */ > - if (cpufreq_cdev->cpufreq_state == state) > - return 0; > - > - clip_freq = cpufreq_cdev->freq_table[state].frequency; > - cpufreq_cdev->cpufreq_state = state; > - cpufreq_cdev->clipped_freq = clip_freq; > - > - cpufreq_update_policy(cpufreq_cdev->policy->cpu); > - > - return 0; > -} > - > /** > * cpufreq_get_requested_power() - get the current power > * @cdev: &thermal_cooling_device pointer > @@ -536,22 +463,88 @@ static int cpufreq_power2state(struct thermal_cooling_device *cdev, > power); > return 0; > } > +#endif /* CONFIG_THERMAL_GOV_POWER_ALLOCATOR */ > + > +/* cpufreq cooling device callback functions are defined below */ > + > +/** > + * cpufreq_get_max_state - callback function to get the max cooling state. > + * @cdev: thermal cooling device pointer. > + * @state: fill this variable with the max cooling state. > + * > + * Callback for the thermal cooling device to return the cpufreq > + * max cooling state. > + * > + * Return: 0 on success, an error code otherwise. > + */ > +static int cpufreq_get_max_state(struct thermal_cooling_device *cdev, > + unsigned long *state) > +{ > + struct cpufreq_cooling_device *cpufreq_cdev = cdev->devdata; > + > + *state = cpufreq_cdev->max_level; > + return 0; > +} > + > +/** > + * cpufreq_get_cur_state - callback function to get the current cooling state. > + * @cdev: thermal cooling device pointer. > + * @state: fill this variable with the current cooling state. > + * > + * Callback for the thermal cooling device to return the cpufreq > + * current cooling state. > + * > + * Return: 0 on success, an error code otherwise. > + */ > +static int cpufreq_get_cur_state(struct thermal_cooling_device *cdev, > + unsigned long *state) > +{ > + struct cpufreq_cooling_device *cpufreq_cdev = cdev->devdata; > + > + *state = cpufreq_cdev->cpufreq_state; > + > + return 0; > +} > + > +/** > + * cpufreq_set_cur_state - callback function to set the current cooling state. > + * @cdev: thermal cooling device pointer. > + * @state: set this variable to the current cooling state. > + * > + * Callback for the thermal cooling device to change the cpufreq > + * current cooling state. > + * > + * Return: 0 on success, an error code otherwise. > + */ > +static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev, > + unsigned long state) > +{ > + struct cpufreq_cooling_device *cpufreq_cdev = cdev->devdata; > + unsigned int clip_freq; > + > + /* Request state should be less than max_level */ > + if (WARN_ON(state > cpufreq_cdev->max_level)) > + return -EINVAL; > + > + /* Check if the old cooling action is same as new cooling action */ > + if (cpufreq_cdev->cpufreq_state == state) > + return 0; > + > + clip_freq = cpufreq_cdev->freq_table[state].frequency; > + cpufreq_cdev->cpufreq_state = state; > + cpufreq_cdev->clipped_freq = clip_freq; > + > + cpufreq_update_policy(cpufreq_cdev->policy->cpu); > + > + return 0; > +} > > /* Bind cpufreq callbacks to thermal cooling device ops */ > > static struct thermal_cooling_device_ops cpufreq_cooling_ops = { > - .get_max_state = cpufreq_get_max_state, > - .get_cur_state = cpufreq_get_cur_state, > - .set_cur_state = cpufreq_set_cur_state, > -}; > - > -static struct thermal_cooling_device_ops cpufreq_power_cooling_ops = { > .get_max_state = cpufreq_get_max_state, > .get_cur_state = cpufreq_get_cur_state, > .set_cur_state = cpufreq_set_cur_state, > - .get_requested_power = cpufreq_get_requested_power, > - .state2power = cpufreq_state2power, > - .power2state = cpufreq_power2state, > }; > > /* Notifier for cpufreq policy change */ > @@ -659,18 +652,19 @@ __cpufreq_cooling_register(struct device_node *np, > pr_debug("%s: freq:%u KHz\n", __func__, freq); > } > > + cooling_ops = &cpufreq_cooling_ops; > +#ifdef CONFIG_THERMAL_GOV_POWER_ALLOCATOR > if (capacitance) { > ret = update_freq_table(cpufreq_cdev, capacitance); > if (ret) { > cdev = ERR_PTR(ret); > goto remove_ida; > } > - > - cooling_ops = &cpufreq_power_cooling_ops; > - } else { > - cooling_ops = &cpufreq_cooling_ops; > + cooling_ops->get_requested_power = cpufreq_get_requested_power; > + cooling_ops->state2power = cpufreq_state2power; > + cooling_ops->power2state = cpufreq_power2state; > } > - > +#endif > cdev = thermal_of_cooling_device_register(np, dev_name, cpufreq_cdev, > cooling_ops); > if (IS_ERR(cdev)) > -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog