mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alireza Sanaee <alireza.sanaee@huawei.com>
To: Rob Herring <robh@kernel.org>
Cc: <mark.rutland@arm.com>, <devicetree@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <jonathan.cameron@huawei.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<shameerali.kolothum.thodi@huawei.com>, <zhao1.liu@intel.com>,
	<yangyicong@hisilicon.com>, <rrendec@redhat.com>,
	<catalin.marinas@arm.com>
Subject: Re: [RFC PATCH v1 1/1] base/of/cacheinfo: support l1 entry in dt
Date: Tue, 28 Jan 2025 11:48:11 +0000	[thread overview]
Message-ID: <20250128114811.00007685.alireza.sanaee@huawei.com> (raw)
In-Reply-To: <CAL_JsqKFjQeaoGn5PRn1=P49mag-Kyik7EwtsOU8fcdvYhPcOA@mail.gmail.com>

On Mon, 27 Jan 2025 10:24:13 -0600
Rob Herring <robh@kernel.org> wrote:

> On Fri, Jan 24, 2025 at 9:20 AM Alireza Sanaee
> <alireza.sanaee@huawei.com> wrote:
> >
> > This commit simply assumes that CPU node entries may point to a
> > cache node that basically act as a l1-cache and there are some CPU
> > nodes without describing any caches but a next-level-cache property
> > that points to l1-cache.  
> 
> This commit message needs some work. Read documentation on writing
> commit messages.

Hi Rob,

Thanks for the feedback.

I am going to update this text to give more background.

> 
> Why/when does describing L1 cache in the cpu nodes not work? That is
> the assumption in the bindings. If we're changing that, there may need
> to be a binding/spec change.

Yes, I will have to send a patch regarding the spec too. Will send a
patch as well.

My plan is to first send a new revision and then send the updates
related to the spec, and then hopefully we can converge there.

Thanks,
Alireza
> 
> >
> > Signed-off-by: Alireza Sanaee <alireza.sanaee@huawei.com>
> > ---
> >  drivers/base/cacheinfo.c | 54
> > +++++++++++++++++++++++++++------------- 1 file changed, 37
> > insertions(+), 17 deletions(-)
> >
> > diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c
> > index cf0d455209d7..d119228fc392 100644
> > --- a/drivers/base/cacheinfo.c
> > +++ b/drivers/base/cacheinfo.c
> > @@ -83,7 +83,31 @@ bool last_level_cache_is_shared(unsigned int
> > cpu_x, unsigned int cpu_y)
> >
> >  #ifdef CONFIG_OF
> >
> > -static bool of_check_cache_nodes(struct device_node *np);
> > +static bool of_check_cache_node(struct device_node *np) {
> > +       if (of_property_present(np, "cache-size")   ||
> > +           of_property_present(np, "i-cache-size") ||
> > +           of_property_present(np, "d-cache-size") ||
> > +           of_property_present(np, "cache-unified"))
> > +               return true;
> > +       return false;
> > +}
> > +
> > +static bool of_check_cache_nodes(struct device_node *np)
> > +{
> > +       if (of_property_present(np, "cache-size")   ||
> > +           of_property_present(np, "i-cache-size") ||
> > +           of_property_present(np, "d-cache-size") ||
> > +           of_property_present(np, "cache-unified"))  
> 
> This is the same code as of_check_cache_node(), use it.
> 
> > +               return true;
> > +
> > +       struct device_node *next __free(device_node) =
> > of_find_next_cache_node(np);
> > +       if (next) {
> > +               return true;
> > +       }
> > +
> > +       return false;
> > +}
> > +
> >
> >  /* OF properties to query for a given cache type */
> >  struct cache_type_info {
> > @@ -218,11 +242,23 @@ static int cache_setup_of_node(unsigned int
> > cpu) while (index < cache_leaves(cpu)) {
> >                 this_leaf = per_cpu_cacheinfo_idx(cpu, index);
> >                 if (this_leaf->level != 1) {
> > +                       /* Always go one level down for level > 1 */
> >                         struct device_node *prev
> > __free(device_node) = np; np = of_find_next_cache_node(np);
> >                         if (!np)
> >                                 break;
> > +               } else {
> > +                       /* For level 1, check compatibility */
> > +                       if (!of_device_is_compatible(np, "cache") &&
> > +                           !of_check_cache_node(np)) {
> > +                               struct device_node *prev
> > __free(device_node) = np;
> > +                               np = of_find_next_cache_node(np);
> > +                               if (!np)
> > +                                       break;
> > +                               continue; /* Skip to next index
> > without processing */
> > +                       }
> >                 }
> > +
> >                 cache_of_set_props(this_leaf, np);
> >                 this_leaf->fw_token = np;
> >                 index++;
> > @@ -234,22 +270,6 @@ static int cache_setup_of_node(unsigned int
> > cpu) return 0;
> >  }
> >
> > -static bool of_check_cache_nodes(struct device_node *np)
> > -{
> > -       if (of_property_present(np, "cache-size")   ||
> > -           of_property_present(np, "i-cache-size") ||
> > -           of_property_present(np, "d-cache-size") ||
> > -           of_property_present(np, "cache-unified"))
> > -               return true;
> > -
> > -       struct device_node *next __free(device_node) =
> > of_find_next_cache_node(np);
> > -       if (next) {
> > -               return true;
> > -       }
> > -
> > -       return false;
> > -}
> > -
> >  static int of_count_cache_leaves(struct device_node *np)
> >  {
> >         unsigned int leaves = 0;
> > --
> > 2.34.1
> >  
> 


      reply	other threads:[~2025-01-28 11:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-24 15:20 [RFC PATCH v1 0/1] base/of/cacheinfo: support l1-cache " Alireza Sanaee
2025-01-24 15:20 ` [RFC PATCH v1 1/1] base/of/cacheinfo: support l1 " Alireza Sanaee
2025-01-27 12:11   ` Jonathan Cameron
2025-01-28 11:44     ` Alireza Sanaee
2025-01-27 16:24   ` Rob Herring
2025-01-28 11:48     ` Alireza Sanaee [this message]

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=20250128114811.00007685.alireza.sanaee@huawei.com \
    --to=alireza.sanaee@huawei.com \
    --cc=catalin.marinas@arm.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jonathan.cameron@huawei.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=robh@kernel.org \
    --cc=rrendec@redhat.com \
    --cc=shameerali.kolothum.thodi@huawei.com \
    --cc=yangyicong@hisilicon.com \
    --cc=zhao1.liu@intel.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

all inboxes | Powered by JetHome®