Skip to content

Commit 1a5a2cb

Browse files
Merge patch series "Use composable cache instead of L2 cache"
Zong Li <[email protected]> says: 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. * b4-shazam-merge: riscv: Add cache information in AUX vector soc: sifive: ccache: define the macro for the register shifts soc: sifive: ccache: use pr_fmt() to remove CCACHE: prefixes soc: sifive: ccache: reduce printing on init soc: sifive: ccache: determine the cache level from dts soc: sifive: ccache: Rename SiFive L2 cache to Composable cache. dt-bindings: sifive-ccache: change Sifive L2 cache to Composable cache Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
2 parents 6224db7 + da29dbc commit 1a5a2cb

File tree

11 files changed

+312
-270
lines changed

11 files changed

+312
-270
lines changed

Documentation/devicetree/bindings/riscv/sifive-l2-cache.yaml renamed to Documentation/devicetree/bindings/riscv/sifive,ccache0.yaml

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
# Copyright (C) 2020 SiFive, Inc.
33
%YAML 1.2
44
---
5-
$id: http://devicetree.org/schemas/riscv/sifive-l2-cache.yaml#
5+
$id: http://devicetree.org/schemas/riscv/sifive,ccache0.yaml#
66
$schema: http://devicetree.org/meta-schemas/core.yaml#
77

8-
title: SiFive L2 Cache Controller
8+
title: SiFive Composable Cache Controller
99

1010
maintainers:
1111
- Sagar Kadam <[email protected]>
1212
- Paul Walmsley <[email protected]>
1313

1414
description:
15-
The SiFive Level 2 Cache Controller is used to provide access to fast copies
16-
of memory for masters in a Core Complex. The Level 2 Cache Controller also
15+
The SiFive Composable Cache Controller is used to provide access to fast copies
16+
of memory for masters in a Core Complex. The Composable Cache Controller also
1717
acts as directory-based coherency manager.
1818
All the properties in ePAPR/DeviceTree specification applies for this platform.
1919

@@ -22,6 +22,7 @@ select:
2222
compatible:
2323
contains:
2424
enum:
25+
- sifive,ccache0
2526
- sifive,fu540-c000-ccache
2627
- sifive,fu740-c000-ccache
2728

@@ -33,6 +34,7 @@ properties:
3334
oneOf:
3435
- items:
3536
- enum:
37+
- sifive,ccache0
3638
- sifive,fu540-c000-ccache
3739
- sifive,fu740-c000-ccache
3840
- const: cache
@@ -45,7 +47,7 @@ properties:
4547
const: 64
4648

4749
cache-level:
48-
const: 2
50+
enum: [2, 3]
4951

5052
cache-sets:
5153
enum: [1024, 2048]
@@ -115,6 +117,22 @@ allOf:
115117
cache-sets:
116118
const: 1024
117119

120+
- if:
121+
properties:
122+
compatible:
123+
contains:
124+
const: sifive,ccache0
125+
126+
then:
127+
properties:
128+
cache-level:
129+
enum: [2, 3]
130+
131+
else:
132+
properties:
133+
cache-level:
134+
const: 2
135+
118136
additionalProperties: false
119137

120138
required:

arch/riscv/include/asm/elf.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ do { \
9999
get_cache_size(2, CACHE_TYPE_UNIFIED)); \
100100
NEW_AUX_ENT(AT_L2_CACHEGEOMETRY, \
101101
get_cache_geometry(2, CACHE_TYPE_UNIFIED)); \
102+
NEW_AUX_ENT(AT_L3_CACHESIZE, \
103+
get_cache_size(3, CACHE_TYPE_UNIFIED)); \
104+
NEW_AUX_ENT(AT_L3_CACHEGEOMETRY, \
105+
get_cache_geometry(3, CACHE_TYPE_UNIFIED)); \
102106
} while (0)
103107
#define ARCH_HAS_SETUP_ADDITIONAL_PAGES
104108
struct linux_binprm;

arch/riscv/include/uapi/asm/auxvec.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@
3030
#define AT_L1D_CACHEGEOMETRY 43
3131
#define AT_L2_CACHESIZE 44
3232
#define AT_L2_CACHEGEOMETRY 45
33+
#define AT_L3_CACHESIZE 46
34+
#define AT_L3_CACHEGEOMETRY 47
3335

3436
/* entries in ARCH_DLINFO */
35-
#define AT_VECTOR_SIZE_ARCH 7
37+
#define AT_VECTOR_SIZE_ARCH 9
3638

3739
#endif /* _UAPI_ASM_RISCV_AUXVEC_H */

drivers/edac/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ config EDAC_ALTERA_SDMMC
473473

474474
config EDAC_SIFIVE
475475
bool "Sifive platform EDAC driver"
476-
depends on EDAC=y && SIFIVE_L2
476+
depends on EDAC=y && SIFIVE_CCACHE
477477
help
478478
Support for error detection and correction on the SiFive SoCs.
479479

drivers/edac/sifive_edac.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
/*
33
* SiFive Platform EDAC Driver
44
*
5-
* Copyright (C) 2018-2019 SiFive, Inc.
5+
* Copyright (C) 2018-2022 SiFive, Inc.
66
*
77
* This driver is partially based on octeon_edac-pc.c
88
*
99
*/
1010
#include <linux/edac.h>
1111
#include <linux/platform_device.h>
1212
#include "edac_module.h"
13-
#include <soc/sifive/sifive_l2_cache.h>
13+
#include <soc/sifive/sifive_ccache.h>
1414

1515
#define DRVNAME "sifive_edac"
1616

@@ -32,9 +32,9 @@ int ecc_err_event(struct notifier_block *this, unsigned long event, void *ptr)
3232

3333
p = container_of(this, struct sifive_edac_priv, notifier);
3434

35-
if (event == SIFIVE_L2_ERR_TYPE_UE)
35+
if (event == SIFIVE_CCACHE_ERR_TYPE_UE)
3636
edac_device_handle_ue(p->dci, 0, 0, msg);
37-
else if (event == SIFIVE_L2_ERR_TYPE_CE)
37+
else if (event == SIFIVE_CCACHE_ERR_TYPE_CE)
3838
edac_device_handle_ce(p->dci, 0, 0, msg);
3939

4040
return NOTIFY_OK;
@@ -67,7 +67,7 @@ static int ecc_register(struct platform_device *pdev)
6767
goto err;
6868
}
6969

70-
register_sifive_l2_error_notifier(&p->notifier);
70+
register_sifive_ccache_error_notifier(&p->notifier);
7171

7272
return 0;
7373

@@ -81,7 +81,7 @@ static int ecc_unregister(struct platform_device *pdev)
8181
{
8282
struct sifive_edac_priv *p = platform_get_drvdata(pdev);
8383

84-
unregister_sifive_l2_error_notifier(&p->notifier);
84+
unregister_sifive_ccache_error_notifier(&p->notifier);
8585
edac_device_del_device(&pdev->dev);
8686
edac_device_free_ctl_info(p->dci);
8787

drivers/soc/sifive/Kconfig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
if SOC_SIFIVE
44

5-
config SIFIVE_L2
6-
bool "Sifive L2 Cache controller"
5+
config SIFIVE_CCACHE
6+
bool "Sifive Composable Cache controller"
77
help
8-
Support for the L2 cache controller on SiFive platforms.
8+
Support for the composable cache controller on SiFive platforms.
99

1010
endif

drivers/soc/sifive/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# SPDX-License-Identifier: GPL-2.0
22

3-
obj-$(CONFIG_SIFIVE_L2) += sifive_l2_cache.o
3+
obj-$(CONFIG_SIFIVE_CCACHE) += sifive_ccache.o

0 commit comments

Comments
 (0)