Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1557507

Re: [PATCH 1/2][UPDATE] of: base: add support to get the number of cache levels

From Sudeep Holla <sudeep.holla@arm.com>
Newsgroups linux.kernel
Subject Re: [PATCH 1/2][UPDATE] of: base: add support to get the number of cache levels
Date 2017-01-12 16:30 +0100
Message-ID <sYPu9-5B2-11@gated-at.bofh.it> (permalink)
References <sY369-N3-5@gated-at.bofh.it> <sY3pw-1at-25@gated-at.bofh.it> <sYNC2-4tG-21@gated-at.bofh.it>
Organization ARM

Show all headers | View raw



On 12/01/17 13:24, Rob Herring wrote:
> On Tue, Jan 10, 2017 at 6:00 AM, Sudeep Holla <sudeep.holla@arm.com> wrote:
>> It is useful to have helper function just to get the number of cache
>> levels for a given logical cpu. This patch adds the support for the
>> same.
>>
>> It will be used on ARM64 platform where the device tree provides the
>> information for the additional non-architected/transparent/external
>> last level caches that are not integrated with the processors.
>>
>> Cc: Rob Herring <robh+dt@kernel.org>
>> Cc: Mark Rutland <mark.rutland@arm.com>
>> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
>> ---
>>  drivers/of/base.c  | 23 +++++++++++++++++++++++
>>  include/linux/of.h |  1 +
>>  2 files changed, 24 insertions(+)
>>

[...]

>> +int of_count_cache_levels(unsigned int cpu)
>> +{
>> +       int level = 0;
>> +       struct device_node *np = of_cpu_device_node_get(cpu);
>> +
>> +       while (np) {
>> +               level++;
> 
> This will return 1 if you have a cpu node and no cache nodes. Are you
> assuming the cpu has a cache?
> 

Ah right, that's completely wrong assumption.

> Perhaps you should just find the last level cache node and then just
> read "cache-level".
> 

Yes, sounds better. I will update accordingly. Thanks for the suggestion.

-- 
Regards,
Sudeep

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] of: base: add support to get the number of cache levels Sudeep Holla <sudeep.holla@arm.com> - 2017-01-10 12:50 +0100
  [PATCH 2/2] arm64: cacheinfo: add support to override cache levels via device tree Sudeep Holla <sudeep.holla@arm.com> - 2017-01-10 12:50 +0100
  Re: [PATCH 1/2] of: base: add support to get the number of cache  levels Sudeep Holla <sudeep.holla@arm.com> - 2017-01-10 13:00 +0100
  [PATCH 1/2][UPDATE] of: base: add support to get the number of cache levels Sudeep Holla <sudeep.holla@arm.com> - 2017-01-10 13:10 +0100
    Re: [PATCH 1/2][UPDATE] of: base: add support to get the number of  cache levels Rob Herring <robh+dt@kernel.org> - 2017-01-12 14:30 +0100
      Re: [PATCH 1/2][UPDATE] of: base: add support to get the number of  cache levels Sudeep Holla <sudeep.holla@arm.com> - 2017-01-12 16:30 +0100

csiph-web