lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Tue, 18 Feb 2020 06:25:27 +0000
From:   Yash Shah <yash.shah@...ive.com>
To:     Palmer Dabbelt <palmerdabbelt@...gle.com>
CC:     "Paul Walmsley ( Sifive)" <paul.walmsley@...ive.com>,
        "aou@...s.berkeley.edu" <aou@...s.berkeley.edu>,
        "allison@...utok.net" <allison@...utok.net>,
        "alexios.zavras@...el.com" <alexios.zavras@...el.com>,
        Greg KH <gregkh@...uxfoundation.org>,
        "tglx@...utronix.de" <tglx@...utronix.de>,
        "bp@...e.de" <bp@...e.de>,
        "anup@...infault.org" <anup@...infault.org>,
        "linux-riscv@...ts.infradead.org" <linux-riscv@...ts.infradead.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Sachin Ghadi <sachin.ghadi@...ive.com>
Subject: RE: [PATCH v4 2/2] riscv: Add support to determine no. of L2 cache
 way enabled

> -----Original Message-----
> From: Palmer Dabbelt <palmerdabbelt@...gle.com>
> Sent: 07 February 2020 23:54
> To: Yash Shah <yash.shah@...ive.com>
> Cc: Paul Walmsley ( Sifive) <paul.walmsley@...ive.com>;
> aou@...s.berkeley.edu; allison@...utok.net; alexios.zavras@...el.com;
> Greg KH <gregkh@...uxfoundation.org>; tglx@...utronix.de; bp@...e.de;
> anup@...infault.org; linux-riscv@...ts.infradead.org; linux-
> kernel@...r.kernel.org; Sachin Ghadi <sachin.ghadi@...ive.com>; Yash Shah
> <yash.shah@...ive.com>
> Subject: Re: [PATCH v4 2/2] riscv: Add support to determine no. of L2 cache
> way enabled
> 
> On Thu, 16 Jan 2020 23:43:38 PST (-0800), yash.shah@...ive.com wrote:
> > In order to determine the number of L2 cache ways enabled at runtime,
> > implement a private attribute ("number_of_ways_enabled"). Reading this
> > attribute returns the number of enabled L2 cache ways at runtime.
> >
> > Using riscv_set_cacheinfo_ops() hook a custom function, that returns
> > this private attribute, to the generic ops structure which is used by
> > cache_get_priv_group() in cacheinfo framework.
> >
> > Signed-off-by: Yash Shah <yash.shah@...ive.com>
> > Reviewed-by: Anup Patel <anup@...infault.org>
> > ---
> >  drivers/soc/sifive/sifive_l2_cache.c | 38
> > ++++++++++++++++++++++++++++++++++++
> >  1 file changed, 38 insertions(+)
> >
> > diff --git a/drivers/soc/sifive/sifive_l2_cache.c
> > b/drivers/soc/sifive/sifive_l2_cache.c
> > index a506939..3fb6404 100644
> > --- a/drivers/soc/sifive/sifive_l2_cache.c
> > +++ b/drivers/soc/sifive/sifive_l2_cache.c
> > @@ -9,6 +9,8 @@
> >  #include <linux/interrupt.h>
> >  #include <linux/of_irq.h>
> >  #include <linux/of_address.h>
> > +#include <linux/device.h>
> > +#include <asm/cacheinfo.h>
> >  #include <soc/sifive/sifive_l2_cache.h>
> >
> >  #define SIFIVE_L2_DIRECCFIX_LOW 0x100 @@ -31,6 +33,7 @@
> >
> >  static void __iomem *l2_base;
> >  static int g_irq[SIFIVE_L2_MAX_ECCINTR];
> > +static struct riscv_cacheinfo_ops l2_cache_ops;
> >
> >  enum {
> >  	DIR_CORR = 0,
> > @@ -107,6 +110,38 @@ int unregister_sifive_l2_error_notifier(struct
> > notifier_block *nb)  }
> > EXPORT_SYMBOL_GPL(unregister_sifive_l2_error_notifier);
> >
> > +static int l2_largest_wayenabled(void) {
> > +	return readl(l2_base + SIFIVE_L2_WAYENABLE); }
> 
> WayEnable is 8 bits.

Ok, will mask out and return the last 8 bits only

Thanks for your comment.

- Yash

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ