2022-09-08 15:35:59

by Zong Li

[permalink] [raw]
Subject: [PATCH v3 0/6] Use composable cache instead of L2 cache

Since composable cache may be L3 cache if private L2 cache exists, we
should use its original name "composable cache" to prevent confusion.

This patchset contains the modification which is related to ccache, such
as DT binding and EDAC driver.

The DT binding is based on top of Conor's patch, it has got ready for
merging, and it looks that it would be taken into the next few 6.0-rc
version. If there is any change, the next version of this series will be
posted as well.
https://lore.kernel.org/linux-riscv/[email protected]/

Ben Dooks (2):
soc: sifive: ccache: reduce printing on init
soc: sifive: ccache: use pr_fmt() to remove CCACHE: prefixes

Zong Li (4):
dt-bindings: sifive-ccache: change Sifive L2 cache to Composable cache
soc: sifive: ccache: rename SiFive L2 cache to Composable cache.
soc: sifive: ccache: determine the cache level from dts
soc: sifive: ccache: define the macro for the register shifts

...five-l2-cache.yaml => sifive,ccache0.yaml} | 28 ++-
drivers/edac/Kconfig | 2 +-
drivers/edac/sifive_edac.c | 12 +-
drivers/soc/sifive/Kconfig | 6 +-
drivers/soc/sifive/Makefile | 2 +-
.../{sifive_l2_cache.c => sifive_ccache.c} | 200 ++++++++++--------
.../{sifive_l2_cache.h => sifive_ccache.h} | 16 +-
7 files changed, 151 insertions(+), 115 deletions(-)
rename Documentation/devicetree/bindings/riscv/{sifive-l2-cache.yaml => sifive,ccache0.yaml} (83%)
rename drivers/soc/sifive/{sifive_l2_cache.c => sifive_ccache.c} (31%)
rename include/soc/sifive/{sifive_l2_cache.h => sifive_ccache.h} (12%)

--
2.17.1


2022-09-08 15:43:35

by Zong Li

[permalink] [raw]
Subject: [PATCH v3 5/6] soc: sifive: ccache: use pr_fmt() to remove CCACHE: prefixes

From: Ben Dooks <[email protected]>

Use the pr_fmt() macro to prefix all the output with "CCACHE:"
to avoid having to write it out each time, or make a large diff
when the next change comes along.

Signed-off-by: Ben Dooks <[email protected]>
Signed-off-by: Zong Li <[email protected]>
Reviewed-by: Conor Dooley <[email protected]>
---
drivers/soc/sifive/sifive_ccache.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/soc/sifive/sifive_ccache.c b/drivers/soc/sifive/sifive_ccache.c
index 58d14f11a63a..b3929c4d6d5b 100644
--- a/drivers/soc/sifive/sifive_ccache.c
+++ b/drivers/soc/sifive/sifive_ccache.c
@@ -5,6 +5,9 @@
* Copyright (C) 2018-2022 SiFive, Inc.
*
*/
+
+#define pr_fmt(fmt) "CCACHE: " fmt
+
#include <linux/debugfs.h>
#include <linux/interrupt.h>
#include <linux/of_irq.h>
@@ -85,13 +88,13 @@ static void ccache_config_read(void)

cfg = readl(ccache_base + SIFIVE_CCACHE_CONFIG);

- pr_info("CCACHE: %u banks, %u ways, sets/bank=%llu, bytes/block=%llu\n",
+ pr_info("%u banks, %u ways, sets/bank=%llu, bytes/block=%llu\n",
(cfg & 0xff), (cfg >> 8) & 0xff,
BIT_ULL((cfg >> 16) & 0xff),
BIT_ULL((cfg >> 24) & 0xff));

cfg = readl(ccache_base + SIFIVE_CCACHE_WAYENABLE);
- pr_info("CCACHE: Index of the largest way enabled: %u\n", cfg);
+ pr_info("Index of the largest way enabled: %u\n", cfg);
}

static const struct of_device_id sifive_ccache_ids[] = {
@@ -155,7 +158,7 @@ static irqreturn_t ccache_int_handler(int irq, void *device)
if (irq == g_irq[DIR_CORR]) {
add_h = readl(ccache_base + SIFIVE_CCACHE_DIRECCFIX_HIGH);
add_l = readl(ccache_base + SIFIVE_CCACHE_DIRECCFIX_LOW);
- pr_err("CCACHE: DirError @ 0x%08X.%08X\n", add_h, add_l);
+ pr_err("DirError @ 0x%08X.%08X\n", add_h, add_l);
/* Reading this register clears the DirError interrupt sig */
readl(ccache_base + SIFIVE_CCACHE_DIRECCFIX_COUNT);
atomic_notifier_call_chain(&ccache_err_chain,
@@ -175,7 +178,7 @@ static irqreturn_t ccache_int_handler(int irq, void *device)
if (irq == g_irq[DATA_CORR]) {
add_h = readl(ccache_base + SIFIVE_CCACHE_DATECCFIX_HIGH);
add_l = readl(ccache_base + SIFIVE_CCACHE_DATECCFIX_LOW);
- pr_err("CCACHE: DataError @ 0x%08X.%08X\n", add_h, add_l);
+ pr_err("DataError @ 0x%08X.%08X\n", add_h, add_l);
/* Reading this register clears the DataError interrupt sig */
readl(ccache_base + SIFIVE_CCACHE_DATECCFIX_COUNT);
atomic_notifier_call_chain(&ccache_err_chain,
@@ -185,7 +188,7 @@ static irqreturn_t ccache_int_handler(int irq, void *device)
if (irq == g_irq[DATA_UNCORR]) {
add_h = readl(ccache_base + SIFIVE_CCACHE_DATECCFAIL_HIGH);
add_l = readl(ccache_base + SIFIVE_CCACHE_DATECCFAIL_LOW);
- pr_err("CCACHE: DataFail @ 0x%08X.%08X\n", add_h, add_l);
+ pr_err("DataFail @ 0x%08X.%08X\n", add_h, add_l);
/* Reading this register clears the DataFail interrupt sig */
readl(ccache_base + SIFIVE_CCACHE_DATECCFAIL_COUNT);
atomic_notifier_call_chain(&ccache_err_chain,
@@ -227,7 +230,7 @@ static int __init sifive_ccache_init(void)
rc = request_irq(g_irq[i], ccache_int_handler, 0, "ccache_ecc",
NULL);
if (rc) {
- pr_err("CCACHE: Could not request IRQ %d\n", g_irq[i]);
+ pr_err("Could not request IRQ %d\n", g_irq[i]);
return rc;
}
}
--
2.17.1

2022-09-08 19:05:42

by Conor Dooley

[permalink] [raw]
Subject: Re: [PATCH v3 5/6] soc: sifive: ccache: use pr_fmt() to remove CCACHE: prefixes

On 08/09/2022 15:44, Zong Li wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> From: Ben Dooks <[email protected]>
>
> Use the pr_fmt() macro to prefix all the output with "CCACHE:"
> to avoid having to write it out each time, or make a large diff
> when the next change comes along.
>
> Signed-off-by: Ben Dooks <[email protected]>
> Signed-off-by: Zong Li <[email protected]>
> Reviewed-by: Conor Dooley <[email protected]>

btw, I think Ben missed a print - a pr_err() in init().

> ---
> drivers/soc/sifive/sifive_ccache.c | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/soc/sifive/sifive_ccache.c b/drivers/soc/sifive/sifive_ccache.c
> index 58d14f11a63a..b3929c4d6d5b 100644
> --- a/drivers/soc/sifive/sifive_ccache.c
> +++ b/drivers/soc/sifive/sifive_ccache.c
> @@ -5,6 +5,9 @@
> * Copyright (C) 2018-2022 SiFive, Inc.
> *
> */
> +
> +#define pr_fmt(fmt) "CCACHE: " fmt
> +
> #include <linux/debugfs.h>
> #include <linux/interrupt.h>
> #include <linux/of_irq.h>
> @@ -85,13 +88,13 @@ static void ccache_config_read(void)
>
> cfg = readl(ccache_base + SIFIVE_CCACHE_CONFIG);
>
> - pr_info("CCACHE: %u banks, %u ways, sets/bank=%llu, bytes/block=%llu\n",
> + pr_info("%u banks, %u ways, sets/bank=%llu, bytes/block=%llu\n",
> (cfg & 0xff), (cfg >> 8) & 0xff,
> BIT_ULL((cfg >> 16) & 0xff),
> BIT_ULL((cfg >> 24) & 0xff));
>
> cfg = readl(ccache_base + SIFIVE_CCACHE_WAYENABLE);
> - pr_info("CCACHE: Index of the largest way enabled: %u\n", cfg);
> + pr_info("Index of the largest way enabled: %u\n", cfg);
> }
>
> static const struct of_device_id sifive_ccache_ids[] = {
> @@ -155,7 +158,7 @@ static irqreturn_t ccache_int_handler(int irq, void *device)
> if (irq == g_irq[DIR_CORR]) {
> add_h = readl(ccache_base + SIFIVE_CCACHE_DIRECCFIX_HIGH);
> add_l = readl(ccache_base + SIFIVE_CCACHE_DIRECCFIX_LOW);
> - pr_err("CCACHE: DirError @ 0x%08X.%08X\n", add_h, add_l);
> + pr_err("DirError @ 0x%08X.%08X\n", add_h, add_l);
> /* Reading this register clears the DirError interrupt sig */
> readl(ccache_base + SIFIVE_CCACHE_DIRECCFIX_COUNT);
> atomic_notifier_call_chain(&ccache_err_chain,
> @@ -175,7 +178,7 @@ static irqreturn_t ccache_int_handler(int irq, void *device)
> if (irq == g_irq[DATA_CORR]) {
> add_h = readl(ccache_base + SIFIVE_CCACHE_DATECCFIX_HIGH);
> add_l = readl(ccache_base + SIFIVE_CCACHE_DATECCFIX_LOW);
> - pr_err("CCACHE: DataError @ 0x%08X.%08X\n", add_h, add_l);
> + pr_err("DataError @ 0x%08X.%08X\n", add_h, add_l);
> /* Reading this register clears the DataError interrupt sig */
> readl(ccache_base + SIFIVE_CCACHE_DATECCFIX_COUNT);
> atomic_notifier_call_chain(&ccache_err_chain,
> @@ -185,7 +188,7 @@ static irqreturn_t ccache_int_handler(int irq, void *device)
> if (irq == g_irq[DATA_UNCORR]) {
> add_h = readl(ccache_base + SIFIVE_CCACHE_DATECCFAIL_HIGH);
> add_l = readl(ccache_base + SIFIVE_CCACHE_DATECCFAIL_LOW);
> - pr_err("CCACHE: DataFail @ 0x%08X.%08X\n", add_h, add_l);
> + pr_err("DataFail @ 0x%08X.%08X\n", add_h, add_l);
> /* Reading this register clears the DataFail interrupt sig */
> readl(ccache_base + SIFIVE_CCACHE_DATECCFAIL_COUNT);
> atomic_notifier_call_chain(&ccache_err_chain,
> @@ -227,7 +230,7 @@ static int __init sifive_ccache_init(void)
> rc = request_irq(g_irq[i], ccache_int_handler, 0, "ccache_ecc",
> NULL);
> if (rc) {
> - pr_err("CCACHE: Could not request IRQ %d\n", g_irq[i]);
> + pr_err("Could not request IRQ %d\n", g_irq[i]);
> return rc;
> }
> }
> --
> 2.17.1
>

2022-09-12 07:17:50

by Zong Li

[permalink] [raw]
Subject: Re: [PATCH v3 5/6] soc: sifive: ccache: use pr_fmt() to remove CCACHE: prefixes

On Fri, Sep 9, 2022 at 2:40 AM <[email protected]> wrote:
>
> On 08/09/2022 15:44, Zong Li wrote:
> > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> >
> > From: Ben Dooks <[email protected]>
> >
> > Use the pr_fmt() macro to prefix all the output with "CCACHE:"
> > to avoid having to write it out each time, or make a large diff
> > when the next change comes along.
> >
> > Signed-off-by: Ben Dooks <[email protected]>
> > Signed-off-by: Zong Li <[email protected]>
> > Reviewed-by: Conor Dooley <[email protected]>
>
> btw, I think Ben missed a print - a pr_err() in init().
>

I got that one, I will fix it in v4

> > ---
> > drivers/soc/sifive/sifive_ccache.c | 15 +++++++++------
> > 1 file changed, 9 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/soc/sifive/sifive_ccache.c b/drivers/soc/sifive/sifive_ccache.c
> > index 58d14f11a63a..b3929c4d6d5b 100644
> > --- a/drivers/soc/sifive/sifive_ccache.c
> > +++ b/drivers/soc/sifive/sifive_ccache.c
> > @@ -5,6 +5,9 @@
> > * Copyright (C) 2018-2022 SiFive, Inc.
> > *
> > */
> > +
> > +#define pr_fmt(fmt) "CCACHE: " fmt
> > +
> > #include <linux/debugfs.h>
> > #include <linux/interrupt.h>
> > #include <linux/of_irq.h>
> > @@ -85,13 +88,13 @@ static void ccache_config_read(void)
> >
> > cfg = readl(ccache_base + SIFIVE_CCACHE_CONFIG);
> >
> > - pr_info("CCACHE: %u banks, %u ways, sets/bank=%llu, bytes/block=%llu\n",
> > + pr_info("%u banks, %u ways, sets/bank=%llu, bytes/block=%llu\n",
> > (cfg & 0xff), (cfg >> 8) & 0xff,
> > BIT_ULL((cfg >> 16) & 0xff),
> > BIT_ULL((cfg >> 24) & 0xff));
> >
> > cfg = readl(ccache_base + SIFIVE_CCACHE_WAYENABLE);
> > - pr_info("CCACHE: Index of the largest way enabled: %u\n", cfg);
> > + pr_info("Index of the largest way enabled: %u\n", cfg);
> > }
> >
> > static const struct of_device_id sifive_ccache_ids[] = {
> > @@ -155,7 +158,7 @@ static irqreturn_t ccache_int_handler(int irq, void *device)
> > if (irq == g_irq[DIR_CORR]) {
> > add_h = readl(ccache_base + SIFIVE_CCACHE_DIRECCFIX_HIGH);
> > add_l = readl(ccache_base + SIFIVE_CCACHE_DIRECCFIX_LOW);
> > - pr_err("CCACHE: DirError @ 0x%08X.%08X\n", add_h, add_l);
> > + pr_err("DirError @ 0x%08X.%08X\n", add_h, add_l);
> > /* Reading this register clears the DirError interrupt sig */
> > readl(ccache_base + SIFIVE_CCACHE_DIRECCFIX_COUNT);
> > atomic_notifier_call_chain(&ccache_err_chain,
> > @@ -175,7 +178,7 @@ static irqreturn_t ccache_int_handler(int irq, void *device)
> > if (irq == g_irq[DATA_CORR]) {
> > add_h = readl(ccache_base + SIFIVE_CCACHE_DATECCFIX_HIGH);
> > add_l = readl(ccache_base + SIFIVE_CCACHE_DATECCFIX_LOW);
> > - pr_err("CCACHE: DataError @ 0x%08X.%08X\n", add_h, add_l);
> > + pr_err("DataError @ 0x%08X.%08X\n", add_h, add_l);
> > /* Reading this register clears the DataError interrupt sig */
> > readl(ccache_base + SIFIVE_CCACHE_DATECCFIX_COUNT);
> > atomic_notifier_call_chain(&ccache_err_chain,
> > @@ -185,7 +188,7 @@ static irqreturn_t ccache_int_handler(int irq, void *device)
> > if (irq == g_irq[DATA_UNCORR]) {
> > add_h = readl(ccache_base + SIFIVE_CCACHE_DATECCFAIL_HIGH);
> > add_l = readl(ccache_base + SIFIVE_CCACHE_DATECCFAIL_LOW);
> > - pr_err("CCACHE: DataFail @ 0x%08X.%08X\n", add_h, add_l);
> > + pr_err("DataFail @ 0x%08X.%08X\n", add_h, add_l);
> > /* Reading this register clears the DataFail interrupt sig */
> > readl(ccache_base + SIFIVE_CCACHE_DATECCFAIL_COUNT);
> > atomic_notifier_call_chain(&ccache_err_chain,
> > @@ -227,7 +230,7 @@ static int __init sifive_ccache_init(void)
> > rc = request_irq(g_irq[i], ccache_int_handler, 0, "ccache_ecc",
> > NULL);
> > if (rc) {
> > - pr_err("CCACHE: Could not request IRQ %d\n", g_irq[i]);
> > + pr_err("Could not request IRQ %d\n", g_irq[i]);
> > return rc;
> > }
> > }
> > --
> > 2.17.1
> >
>