linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Valentin Schneider <valentin.schneider@arm.com>
To: Jiaxun Yang <jiaxun.yang@flygoat.com>
Cc: linux-mips@vger.kernel.org,
	"Thomas Bogendoerfer" <tsbogend@alpha.franken.de>,
	"Huacai Chen" <chenhc@lemote.com>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Ingo Molnar" <mingo@redhat.com>,
	"Arnaldo Carvalho de Melo" <acme@kernel.org>,
	"Mark Rutland" <mark.rutland@arm.com>,
	"Alexander Shishkin" <alexander.shishkin@linux.intel.com>,
	"Jiri Olsa" <jolsa@redhat.com>,
	"Namhyung Kim" <namhyung@kernel.org>,
	"Florian Fainelli" <f.fainelli@gmail.com>,
	"Robert Richter" <rric@kernel.org>,
	"Sudeep Holla" <sudeep.holla@arm.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Jason Cooper" <jason@lakedaemon.net>,
	"Marc Zyngier" <maz@kernel.org>,
	"Paul Burton" <paulburton@kernel.org>,
	"Allison Randal" <allison@lohutok.net>,
	"Enrico Weigelt" <info@metux.net>,
	"Kate Stewart" <kstewart@linuxfoundation.org>,
	"Vladimir Kondratiev" <vladimir.kondratiev@intel.com>,
	"Paul Cercueil" <paul@crapouillou.net>,
	"Zhou Yanjie" <zhouyanjie@zoho.com>,
	"周琰杰 (Zhou Yanjie)" <zhouyanjie@wanyeetech.com>,
	"YunQiang Su" <syq@debian.org>, "Arnd Bergmann" <arnd@arndb.de>,
	"Serge Semin" <fancer.lancer@gmail.com>,
	"Matt Redfearn" <matt.redfearn@mips.com>,
	"Steve Winslow" <swinslow@gmail.com>,
	"Alexios Zavras" <alexios.zavras@intel.com>,
	"Richard Fontana" <rfontana@redhat.com>,
	"afzal mohammed" <afzal.mohd.ma@gmail.com>,
	"Peter Xu" <peterx@redhat.com>,
	"Mike Rapoport" <rppt@linux.ibm.com>,
	"Oleksij Rempel" <linux@rempel-privat.de>,
	"Kamal Dasu" <kdasu.kdev@gmail.com>,
	linux-kernel@vger.kernel.org,
	bcm-kernel-feedback-list@broadcom.com,
	oprofile-list@lists.sf.net,
	"Dietmar Eggemann" <dietmar.eggemann@arm.com>
Subject: Re: [PATCH 03/12] arch_topology: Make it avilable for MIPS
Date: Wed, 08 Apr 2020 19:23:04 +0100	[thread overview]
Message-ID: <jhjr1wxj0qf.mognet@arm.com> (raw)
In-Reply-To: <20200408113505.2528103-4-jiaxun.yang@flygoat.com>


(+ Dietmar)

On 08/04/20 12:34, Jiaxun Yang wrote:
> @@ -275,7 +224,64 @@ static void parsing_done_workfn(struct work_struct *work)
>  core_initcall(free_raw_capacity);
>  #endif
>
> -#if defined(CONFIG_ARM64) || defined(CONFIG_RISCV)
> +#if defined(CONFIG_OF) && !defined(CONFIG_ARM)
> +#if defined(CONFIG_COMMON_CLK)
> +bool __init topology_parse_cpu_capacity(struct device_node *cpu_node, int cpu)

We actually use this for arm:

  arch/arm/kernel/topology.o: In function `init_cpu_topology':
  topology.c:(.init.text+0xc8): undefined reference to `topology_parse_cpu_capacity'

So that doesn't work. TBH I'd be quite happy to see the ifdef(ARCH) go away
entirely; it's shame that arm is using some of those names already. I think
some of that is due to the CPU efficiency faff, if we can't get rid of it /
align those then perhaps the next best thing is to make some of those
definitions __weak.

> +{
> +	struct clk *cpu_clk;
> +	static bool cap_parsing_failed;
> +	int ret;
> +	u32 cpu_capacity;
> +
> +	if (cap_parsing_failed)
> +		return false;
> +
> +	ret = of_property_read_u32(cpu_node, "capacity-dmips-mhz",
> +				   &cpu_capacity);
> +	if (!ret) {
> +		if (!raw_capacity) {
> +			raw_capacity = kcalloc(num_possible_cpus(),
> +					       sizeof(*raw_capacity),
> +					       GFP_KERNEL);
> +			if (!raw_capacity) {
> +				cap_parsing_failed = true;
> +				return false;
> +			}
> +		}
> +		raw_capacity[cpu] = cpu_capacity;
> +		pr_debug("cpu_capacity: %pOF cpu_capacity=%u (raw)\n",
> +			cpu_node, raw_capacity[cpu]);
> +
> +		/*
> +		 * Update freq_factor for calculating early boot cpu capacities.
> +		 * For non-clk CPU DVFS mechanism, there's no way to get the
> +		 * frequency value now, assuming they are running at the same
> +		 * frequency (by keeping the initial freq_factor value).
> +		 */
> +		cpu_clk = of_clk_get(cpu_node, 0);
> +		if (!PTR_ERR_OR_ZERO(cpu_clk)) {
> +			per_cpu(freq_factor, cpu) =
> +				clk_get_rate(cpu_clk) / 1000;
> +			clk_put(cpu_clk);
> +		}
> +	} else {
> +		if (raw_capacity) {
> +			pr_err("cpu_capacity: missing %pOF raw capacity\n",
> +				cpu_node);
> +			pr_err("cpu_capacity: partial information: fallback to 1024 for all CPUs\n");
> +		}
> +		cap_parsing_failed = true;
> +		free_raw_capacity();
> +	}
> +
> +	return !ret;
> +}
> +#else
> +bool __init topology_parse_cpu_capacity(struct device_node *cpu_node, int cpu)
> +{
> +		return false;
> +}
> +#endif /* CONFIG_COMMON_CLK */
>  /*
>   * This function returns the logic cpu number of the node.
>   * There are basically three kinds of return values:

  reply	other threads:[~2020-04-08 18:23 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-08 11:34 [PATCH 00/12] MIPS: Topology & DeviceTree CPU rework Jiaxun Yang
2020-04-08 11:34 ` [PATCH 01/12] MIPS: setup: Drop prefill_possible_map Jiaxun Yang
2020-04-08 11:34 ` [PATCH 02/12] MIPS: prom: Add helper to parse CPU node in dt Jiaxun Yang
2020-04-08 11:34 ` [PATCH 03/12] arch_topology: Make it avilable for MIPS Jiaxun Yang
2020-04-08 18:23   ` Valentin Schneider [this message]
2020-04-09  0:54   ` kbuild test robot
2020-04-09 10:13   ` Sudeep Holla
2020-04-08 11:34 ` [PATCH 04/12] arch_topology: Reset all cpus in reset_cpu_topology Jiaxun Yang
2020-04-08 18:23   ` Valentin Schneider
2020-04-09 10:19   ` Sudeep Holla
2020-04-08 11:34 ` [PATCH 05/12] MIPS: Switch to arch_topology Jiaxun Yang
2020-04-08 23:36   ` kbuild test robot
2020-04-09 10:31   ` Sudeep Holla
     [not found]     ` <C2794910-48A0-4472-953A-13F40BA39423@flygoat.com>
2020-04-09 10:58       ` Sudeep Holla
2020-04-09 11:07         ` Jiaxun Yang
2020-04-09 12:53           ` Sudeep Holla
2020-04-09 13:14             ` Jiaxun Yang
2020-04-09 12:23         ` Jiaxun Yang
2020-04-08 12:59 ` [PATCH 06/12] MIPS: Kernel: Switch to new topology interface Jiaxun Yang
2020-04-08 12:59 ` [PATCH 07/12] MIPS: CPS & MT: " Jiaxun Yang
2020-04-08 12:59 ` [PATCH 08/12] irqchip: mips-cpu: " Jiaxun Yang
2020-04-08 12:59 ` [PATCH 09/12] MIPS: bmips: " Jiaxun Yang
2020-04-08 12:59 ` [PATCH 10/12] MIPS: nlm: " Jiaxun Yang
2020-04-08 12:59 ` [PATCH 11/12] MIPS: Loongson64: " Jiaxun Yang
2020-04-08 12:59 ` [PATCH 12/12] MIPS: ip27: Fix includes Jiaxun Yang
2020-04-09  9:19   ` Mike Rapoport
2020-04-09  9:38     ` Jiaxun Yang
2020-04-09 10:07       ` Mike Rapoport

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jhjr1wxj0qf.mognet@arm.com \
    --to=valentin.schneider@arm.com \
    --cc=acme@kernel.org \
    --cc=afzal.mohd.ma@gmail.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=alexios.zavras@intel.com \
    --cc=allison@lohutok.net \
    --cc=arnd@arndb.de \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=chenhc@lemote.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=f.fainelli@gmail.com \
    --cc=fancer.lancer@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=info@metux.net \
    --cc=jason@lakedaemon.net \
    --cc=jiaxun.yang@flygoat.com \
    --cc=jolsa@redhat.com \
    --cc=kdasu.kdev@gmail.com \
    --cc=kstewart@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux@rempel-privat.de \
    --cc=mark.rutland@arm.com \
    --cc=matt.redfearn@mips.com \
    --cc=maz@kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=oprofile-list@lists.sf.net \
    --cc=paul@crapouillou.net \
    --cc=paulburton@kernel.org \
    --cc=peterx@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rafael@kernel.org \
    --cc=rfontana@redhat.com \
    --cc=rppt@linux.ibm.com \
    --cc=rric@kernel.org \
    --cc=sudeep.holla@arm.com \
    --cc=swinslow@gmail.com \
    --cc=syq@debian.org \
    --cc=tglx@linutronix.de \
    --cc=tsbogend@alpha.franken.de \
    --cc=vladimir.kondratiev@intel.com \
    --cc=zhouyanjie@wanyeetech.com \
    --cc=zhouyanjie@zoho.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).