Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1402217pxj; Fri, 21 May 2021 13:22:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz4atoFeIIULSixDJO3Nu1vQDSWnrKkT6EcrkvPo+tzFB2c9CJ3Q26QGhyFR9oPYWTwdQsh X-Received: by 2002:a05:6e02:1a04:: with SMTP id s4mr641835ild.125.1621628559263; Fri, 21 May 2021 13:22:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621628559; cv=none; d=google.com; s=arc-20160816; b=IJmte/f7e3+BKXgn1gErtIn+KUaRqyOr/lvqHaC+JukKz2DWNltwlYdr8H9NoidyfJ 3p7z50XWqVZgNpiShFGTS1HdD5an3WyaFjPe8yyhvP3oCdeQaCPIE1ELpK6IxeAcUAH7 Q+GXm8qPW9Sd7i1NTIbda2IPS+uD7wb8Ps3bLLH9FnN8rgKVQb7m3dzK82bowVv0HQjU caDsqP7rtuc/V4Td3OzDII1qqFKneCzY6znDpsWctB31REEcIFw9sts2B76XqaBEKt+f iAiDnX+aaFJGvAdD1s7MmH7z1XoD1iHlWAv05NlCoFWLWeudXnWnq0MjOfGKwzqBnBIT Xxjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=gF8qQqW7E/MUIQI1EEFA7V59WVpCH9NnjL8E3qnhq9g=; b=aSuur3AoKLR7juKUeKXhVcdn/wOwaD1hRcOytep/rmSGQwjwiMt5fGc5lFwI7dUwqo LzwnlhyWU47bJPwhMKJuGB0E9B13fa3DNwcp6w7J3ybyOQ3YGrD1kWEogM5XjFwTjh5J JHakuFh2/zTf7AdnBTjsPVuQ1Ws+20u3KHuzmVdgr3c07R/sj9D7hmDLsKy4ykfdNee6 hvLycsQukbmdTG6Rw5o5eOjRAfAVpnzFRwSrdKfdQWsv9bBXS0iZEZiDziQFffijDBfj cwRonV9GxyKhWoXpFvrCmYDVw8wOtq+HwiPe96qRKcWqMXjEPh1wZHX/wBwE0kP9mPSt LUWQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t2si6754409ilg.26.2021.05.21.13.22.26; Fri, 21 May 2021 13:22:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237839AbhEUQ4T (ORCPT + 99 others); Fri, 21 May 2021 12:56:19 -0400 Received: from foss.arm.com ([217.140.110.172]:51574 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237822AbhEUQ4S (ORCPT ); Fri, 21 May 2021 12:56:18 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 43AB3150C; Fri, 21 May 2021 09:54:54 -0700 (PDT) Received: from e120877-lin.cambridge.arm.com (e120877-lin.cambridge.arm.com [10.1.194.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id E61CD3F73D; Fri, 21 May 2021 09:54:52 -0700 (PDT) From: Vincent Donnefort To: peterz@infradead.org, rjw@rjwysocki.net, viresh.kumar@linaro.org, vincent.guittot@linaro.org, qperret@google.com Cc: linux-kernel@vger.kernel.org, ionela.voinescu@arm.com, lukasz.luba@arm.com, dietmar.eggemann@arm.com, Vincent Donnefort Subject: [PATCH v2 2/3] PM / EM: Extend em_perf_domain with a flag field Date: Fri, 21 May 2021 17:54:23 +0100 Message-Id: <1621616064-340235-3-git-send-email-vincent.donnefort@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1621616064-340235-1-git-send-email-vincent.donnefort@arm.com> References: <1621616064-340235-1-git-send-email-vincent.donnefort@arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Merge the current "milliwatts" option into a "flag" field. This intends to prepare the extension of this structure for inefficient states support in the Energy Model. Signed-off-by: Vincent Donnefort diff --git a/include/linux/energy_model.h b/include/linux/energy_model.h index 757fc60..9be7bde 100644 --- a/include/linux/energy_model.h +++ b/include/linux/energy_model.h @@ -28,8 +28,7 @@ struct em_perf_state { * em_perf_domain - Performance domain * @table: List of performance states, in ascending order * @nr_perf_states: Number of performance states - * @milliwatts: Flag indicating the power values are in milli-Watts - * or some other scale. + * @flags: See "em_perf_domain flags" * @cpus: Cpumask covering the CPUs of the domain. It's here * for performance reasons to avoid potential cache * misses during energy calculations in the scheduler @@ -44,10 +43,18 @@ struct em_perf_state { struct em_perf_domain { struct em_perf_state *table; int nr_perf_states; - int milliwatts; + int flags; unsigned long cpus[]; }; +/* + * em_perf_domain flags: + * + * EM_PERF_DOMAIN_MILLIWATTS: The power values are in milli-Watts or some + * other scale. + */ +#define EM_PERF_DOMAIN_MILLIWATTS BIT(0) + #define em_span_cpus(em) (to_cpumask((em)->cpus)) #ifdef CONFIG_ENERGY_MODEL diff --git a/kernel/power/energy_model.c b/kernel/power/energy_model.c index c4871a8..638581c 100644 --- a/kernel/power/energy_model.c +++ b/kernel/power/energy_model.c @@ -55,7 +55,8 @@ DEFINE_SHOW_ATTRIBUTE(em_debug_cpus); static int em_debug_units_show(struct seq_file *s, void *unused) { struct em_perf_domain *pd = s->private; - char *units = pd->milliwatts ? "milliWatts" : "bogoWatts"; + char *units = (pd->flags & EM_PERF_DOMAIN_MILLIWATTS) ? + "milliWatts" : "bogoWatts"; seq_printf(s, "%s\n", units); @@ -341,7 +342,8 @@ int em_dev_register_perf_domain(struct device *dev, unsigned int nr_states, if (ret) goto unlock; - dev->em_pd->milliwatts = milliwatts; + if (milliwatts) + dev->em_pd->flags |= EM_PERF_DOMAIN_MILLIWATTS; em_debug_create_pd(dev); dev_info(dev, "EM: created perf domain\n"); -- 2.7.4