Skip to contentSkip to conversation

Add StarFive's JH8100 StarLink Cache Controller

PATCH Superseded Joshua Yeong 3 participants 14 messages Apr 24, 2024

Subsystems (3)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover Add StarFive's JH8100 StarLink Cache Controller

StarFive's JH8100 StarLink Cache Controller flush/invalidates cache using non- conventional RISC-V Zicbom extension instructions. This driver provides the cache handling on StarFive RISC-V SoC.

Changes in v3:
- Fix code syntax
- Link to v2: https://lore.kernel.org/all/[email protected]/

Changes in v2:
- Change patch title from 'Add StarFive's StarLink-500 Cache Controller'
- Remove StarFive alternative from errata framework
- Fixes warning from https://lore.kernel.org/oe-kbuild-all/[email protected]/
- Flush completion through atomic timeout function
- Link to v1: https://lore.kernel.org/lkml/[email protected]/

Joshua Yeong (2):
cache: Add StarFive StarLink cache management for StarFive JH8100
dt-bindings: cache: Add docs for StarFive Starlink cache controller

 .../cache/starfive,jh8100-starlink-cache.yaml |  66 +++++++++
 drivers/cache/Kconfig                         |   9 ++
 drivers/cache/Makefile                        |   5 +-
 drivers/cache/starfive_starlink_cache.c       | 135 ++++++++++++++++++
 4 files changed, 213 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/cache/starfive,jh8100-starlink-cache.yaml
 create mode 100644 drivers/cache/starfive_starlink_cache.c
Signature · 7 lines
2.25.1


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
#1 lore raw

PATCH v3 1/2 cache: Add StarFive StarLink cache management for StarFive JH8100

Add StarFive Starlink cache management driver for
JH8100 SoC. This driver enables RISC-V
non-standard cache operation on JH8100 that does
not support Zicbom extension instructions.

---
 drivers/cache/Kconfig                   |   9 ++
 drivers/cache/Makefile                  |   5 +-
 drivers/cache/starfive_starlink_cache.c | 135 ++++++++++++++++++++++++
 3 files changed, 147 insertions(+), 2 deletions(-)
 create mode 100644 drivers/cache/starfive_starlink_cache.c
drivers/cache/Kconfig +9 -0
index 9345ce4976d7..9181cd391f53 100644
@@ -14,4 +14,13 @@ config SIFIVE_CCACHE
 	help
 	  Support for the composable cache controller on SiFive platforms.
 
+config STARFIVE_STARLINK_CACHE
+	bool "StarFive StarLink Cache controller"
+	depends on RISCV
+	depends on ARCH_STARFIVE
+	select RISCV_DMA_NONCOHERENT
+	select RISCV_NONSTANDARD_CACHE_OPS
+	help
+	  Support for the StarLink cache controller on StarFive platforms.
+
 endmenu
drivers/cache/Makefile +3 -2
index 7657cff3bd6c..55c5e851034d 100644
@@ -1,4 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0
 
-obj-$(CONFIG_AX45MP_L2_CACHE)	+= ax45mp_cache.o
-obj-$(CONFIG_SIFIVE_CCACHE)	+= sifive_ccache.o
+obj-$(CONFIG_AX45MP_L2_CACHE)		+= ax45mp_cache.o
+obj-$(CONFIG_SIFIVE_CCACHE)		+= sifive_ccache.o
+obj-$(CONFIG_STARFIVE_STARLINK_CACHE)	+= starfive_starlink_cache.o
drivers/cache/starfive_starlink_cache.c new file +135 -0

135 lines not on this page · raw message

Signature · 7 lines
2.25.1


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
#2 lore raw

Re: [PATCH v3 1/2] cache: Add StarFive StarLink cache management for StarFive JH8100

Quoted 19 lines · Joshua Yeong

Add StarFive Starlink cache management driver for
JH8100 SoC. This driver enables RISC-V
non-standard cache operation on JH8100 that does
not support Zicbom extension instructions.

---
 drivers/cache/Kconfig                   |   9 ++
 drivers/cache/Makefile                  |   5 +-
 drivers/cache/starfive_starlink_cache.c | 135 ++++++++++++++++++++++++
 3 files changed, 147 insertions(+), 2 deletions(-)
 create mode 100644 drivers/cache/starfive_starlink_cache.c
drivers/cache/Kconfig +0 -0
index 9345ce4976d7..9181cd391f53 100644
@@ -14,4 +14,13 @@ config SIFIVE_CCACHE
 	help

drivers/cache/Kconfig config SIFIVE_CCACHE · line 24

Quoted 10 lines
drivers/cache/Kconfig +8 -0
 	  Support for the composable cache controller on SiFive platforms.
 
+config STARFIVE_STARLINK_CACHE
+	bool "StarFive StarLink Cache controller"
+	depends on RISCV
+	depends on ARCH_STARFIVE
+	select RISCV_DMA_NONCOHERENT
+	select RISCV_NONSTANDARD_CACHE_OPS
+	help
+	  Support for the StarLink cache controller on StarFive platforms.

This is a bit misleading. The JH71x0s don't have this. It's only on the JH8100 so far, and hopefully later SoCs will just implement RISC-V standards for this. So maybe something like

"Support for the StarLink cache controller on the StarFive JH8100 SoC."

Quoted 46 lines
drivers/cache/Kconfig +1 -0
+
 endmenu
drivers/cache/Makefile +3 -2
index 7657cff3bd6c..55c5e851034d 100644
@@ -1,4 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0
 
-obj-$(CONFIG_AX45MP_L2_CACHE)	+= ax45mp_cache.o
-obj-$(CONFIG_SIFIVE_CCACHE)	+= sifive_ccache.o
+obj-$(CONFIG_AX45MP_L2_CACHE)		+= ax45mp_cache.o
+obj-$(CONFIG_SIFIVE_CCACHE)		+= sifive_ccache.o
+obj-$(CONFIG_STARFIVE_STARLINK_CACHE)	+= starfive_starlink_cache.o
drivers/cache/starfive_starlink_cache.c new file +26 -0
new file mode 100644
index 000000000000..2f1fa6a923ee
@@ -0,0 +1,135 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Cache Management Operations for StarFive's Starlink cache controller
+ *
+ * Copyright (C) 2024 Shanghai StarFive Technology Co., Ltd.
+ *
+ * Author: Joshua Yeong <[email protected]>
+ */
+
+#include <linux/bitfield.h>
+#include <linux/cacheflush.h>
+#include <linux/iopoll.h>
+#include <linux/of_address.h>
+
+#include <asm/dma-noncoherent.h>
+
+#define STARLINK_CACHE_FLUSH_START_ADDR			0x0
+#define STARLINK_CACHE_FLUSH_END_ADDR			0x8
+#define STARLINK_CACHE_FLUSH_CTL			0x10
+#define STARLINK_CACHE_ALIGN				0x40
+
+#define STARLINK_CACHE_ADDRESS_RANGE_MASK		GENMASK(39, 0)
+#define STARLINK_CACHE_FLUSH_CTL_MODE_MASK		GENMASK(2, 1)
+#define STARLINK_CACHE_FLUSH_CTL_ENABLE_MASK		BIT(0)
+
+#define STARLINK_CACHE_FLUSH_CTL_CLEAN_INVALIDATE	0

drivers/cache/starfive_starlink_cache.c line 36

Quoted 10 lines
drivers/cache/starfive_starlink_cache.c new file +10 -0
+#define STARLINK_CACHE_FLUSH_CTL_MAKE_INVALIDATE	1
+#define STARLINK_CACHE_FLUSH_CTL_CLEAN_SHARED		2
+#define STARLINK_CACHE_FLUSH_POLL_DELAY_US		1
+#define STARLINK_CACHE_FLUSH_TIMEOUT_US			5000000
+
+struct starlink_cache_priv {
+	void __iomem *base_addr;
+};
+
+static struct starlink_cache_priv starlink_cache_priv;

This could just be

static void __iomem *starlink_cache_base;

Quoted 65 lines
drivers/cache/starfive_starlink_cache.c new file +65 -0
+
+static void starlink_cache_flush_complete(void)
+{
+	volatile void __iomem *ctl = starlink_cache_priv.base_addr +
+				     STARLINK_CACHE_FLUSH_CTL;
+	u64 v;
+	int ret;
+
+	ret = readq_poll_timeout_atomic(ctl, v, !(v & STARLINK_CACHE_FLUSH_CTL_ENABLE_MASK),
+					STARLINK_CACHE_FLUSH_POLL_DELAY_US,
+					STARLINK_CACHE_FLUSH_TIMEOUT_US);
+	if (ret)
+		WARN(1, "StarFive Starlink cache flush operation timeout\n");
+}
+
+static void starlink_cache_dma_cache_wback(phys_addr_t paddr, unsigned long size)
+{
+	writeq(FIELD_PREP(STARLINK_CACHE_ADDRESS_RANGE_MASK, paddr),
+	       starlink_cache_priv.base_addr + STARLINK_CACHE_FLUSH_START_ADDR);
+	writeq(FIELD_PREP(STARLINK_CACHE_ADDRESS_RANGE_MASK, paddr + size),
+	       starlink_cache_priv.base_addr + STARLINK_CACHE_FLUSH_END_ADDR);
+
+	mb();
+	writeq(FIELD_PREP(STARLINK_CACHE_FLUSH_CTL_MODE_MASK,
+			  STARLINK_CACHE_FLUSH_CTL_CLEAN_SHARED),
+	       starlink_cache_priv.base_addr + STARLINK_CACHE_FLUSH_CTL);
+
+	starlink_cache_flush_complete();
+}
+
+static void starlink_cache_dma_cache_invalidate(phys_addr_t paddr, unsigned long size)
+{
+	writeq(FIELD_PREP(STARLINK_CACHE_ADDRESS_RANGE_MASK, paddr),
+	       starlink_cache_priv.base_addr + STARLINK_CACHE_FLUSH_START_ADDR);
+	writeq(FIELD_PREP(STARLINK_CACHE_ADDRESS_RANGE_MASK, paddr + size),
+	       starlink_cache_priv.base_addr + STARLINK_CACHE_FLUSH_END_ADDR);
+
+	mb();
+	writeq(FIELD_PREP(STARLINK_CACHE_FLUSH_CTL_MODE_MASK,
+			  STARLINK_CACHE_FLUSH_CTL_MAKE_INVALIDATE),
+	       starlink_cache_priv.base_addr + STARLINK_CACHE_FLUSH_CTL);
+
+	starlink_cache_flush_complete();
+}
+
+static void starlink_cache_dma_cache_wback_inv(phys_addr_t paddr, unsigned long size)
+{
+	writeq(FIELD_PREP(STARLINK_CACHE_ADDRESS_RANGE_MASK, paddr),
+	       starlink_cache_priv.base_addr + STARLINK_CACHE_FLUSH_START_ADDR);
+	writeq(FIELD_PREP(STARLINK_CACHE_ADDRESS_RANGE_MASK, paddr + size),
+	       starlink_cache_priv.base_addr + STARLINK_CACHE_FLUSH_END_ADDR);
+
+	mb();
+	writeq(FIELD_PREP(STARLINK_CACHE_FLUSH_CTL_MODE_MASK,
+			  STARLINK_CACHE_FLUSH_CTL_CLEAN_INVALIDATE),
+	       starlink_cache_priv.base_addr + STARLINK_CACHE_FLUSH_CTL);
+
+	starlink_cache_flush_complete();
+}
+
+static const struct riscv_nonstd_cache_ops starlink_cache_ops = {
+	.wback = &starlink_cache_dma_cache_wback,
+	.inv = &starlink_cache_dma_cache_invalidate,
+	.wback_inv = &starlink_cache_dma_cache_wback_inv,
+};

drivers/cache/starfive_starlink_cache.c line 111

Quoted 10 lines
drivers/cache/starfive_starlink_cache.c new file +10 -0
+
+static const struct of_device_id starlink_cache_ids[] = {
+	{ .compatible = "starfive,jh8100-starlink-cache" },
+	{ /* sentinel */ }
+};
+
+static int __init starlink_cache_init(void)
+{
+	struct device_node *np;
+	u32 block_size = 0;

You return early if of_property_read_u32() fails, so this doesn't need to be initialized.

Quoted 14 lines
drivers/cache/starfive_starlink_cache.c new file +14 -0
+	int ret;
+
+	np = of_find_matching_node(NULL, starlink_cache_ids);
+	if (!of_device_is_available(np))
+		return -ENODEV;
+
+	ret = of_property_read_u32(np, "cache-block-size", &block_size);
+	if (ret)
+		return ret;
+
+	if (block_size % STARLINK_CACHE_ALIGN)
+		return -EINVAL;
+
+	starlink_cache_priv.base_addr = of_iomap(np, 0);

drivers/cache/starfive_starlink_cache.c line 135

Quoted 10 lines
drivers/cache/starfive_starlink_cache.c new file +10 -0
+	if (!starlink_cache_priv.base_addr)
+		return -ENOMEM;
+
+	riscv_cbom_block_size = block_size;
+	riscv_noncoherent_supported();
+	riscv_noncoherent_register_cache_ops(&starlink_cache_ops);
+
+	return 0;
+}
+early_initcall(starlink_cache_init);

The sifive driver gets away with arch_initcall() here. Any particular reason you need this earlier?

Quoted 8 lines

--
2.25.1

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

#3 lore raw

RE: [PATCH v3 1/2] cache: Add StarFive StarLink cache management for StarFive JH8100

Quoted 35 lines · Emil Renner Berthing
Quoted 19 lines · Joshua Yeong

Add StarFive Starlink cache management driver for
JH8100 SoC. This driver enables RISC-V non-standard cache operation on JH8100 that does not support Zicbom extension instructions.

---
 drivers/cache/Kconfig                   |   9 ++
 drivers/cache/Makefile                  |   5 +-
 drivers/cache/starfive_starlink_cache.c | 135
++++++++++++++++++++++++
 3 files changed, 147 insertions(+), 2 deletions(-)  create mode

100644 drivers/cache/starfive_starlink_cache.c

drivers/cache/Kconfig index renamed from drivers/cache/Kconfig +0 -0

9345ce4976d7..9181cd391f53 100644

drivers/cache/Kconfig +0 -0
@@ -14,4 +14,13 @@ config SIFIVE_CCACHE
 	help

drivers/cache/Kconfig config SIFIVE_CCACHE · line 24

Quoted 10 lines
drivers/cache/Kconfig +8 -0
 	  Support for the composable cache controller on SiFive platforms.
 
+config STARFIVE_STARLINK_CACHE
+	bool "StarFive StarLink Cache controller"
+	depends on RISCV
+	depends on ARCH_STARFIVE
+	select RISCV_DMA_NONCOHERENT
+	select RISCV_NONSTANDARD_CACHE_OPS
+	help
+	  Support for the StarLink cache controller on StarFive platforms.

This is a bit misleading. The JH71x0s don't have this. It's only on the JH8100 so far, and hopefully later SoCs will just implement RISC-V standards for this. So maybe something like

Quoted 2 lines

"Support for the StarLink cache controller on the StarFive JH8100 SoC."

Hi Emil,

The StarLink-500 cache controller is not designed exclusively for JH8100 SoC. While it is true that it currently exists on the StarFive platform, CPU/SoC that does not come with Zicbom extensions supported would need to rely on this cache drive to do cache management operations. I think we don’t need to mentioned 'JH8100 SoC' here.

Quoted 177 lines
Quoted 33 lines
drivers/cache/Kconfig +1 -0
+
 endmenu
drivers/cache/Makefile index renamed from drivers/cache/Makefile +0 -0

7657cff3bd6c..55c5e851034d 100644

drivers/cache/Makefile +3 -2
@@ -1,4 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0
 
-obj-$(CONFIG_AX45MP_L2_CACHE)	+= ax45mp_cache.o
-obj-$(CONFIG_SIFIVE_CCACHE)	+= sifive_ccache.o
+obj-$(CONFIG_AX45MP_L2_CACHE)		+= ax45mp_cache.o
+obj-$(CONFIG_SIFIVE_CCACHE)		+= sifive_ccache.o
+obj-$(CONFIG_STARFIVE_STARLINK_CACHE)	+= starfive_starlink_cache.o
drivers/cache/starfive_starlink_cache.c new file +12 -0
new file mode 100644
index 000000000000..2f1fa6a923ee
@@ -0,0 +1,135 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Cache Management Operations for StarFive's Starlink cache
+controller
+ *
+ * Copyright (C) 2024 Shanghai StarFive Technology Co., Ltd.
+ *
+ * Author: Joshua Yeong <[email protected]>  */
+
+#include <linux/bitfield.h>
+#include <linux/cacheflush.h>
+#include <linux/iopoll.h>

drivers/cache/starfive_starlink_cache.c line 22

Quoted 10 lines
drivers/cache/starfive_starlink_cache.c new file +10 -0
+#include <linux/of_address.h>
+
+#include <asm/dma-noncoherent.h>
+
+#define STARLINK_CACHE_FLUSH_START_ADDR			0x0
+#define STARLINK_CACHE_FLUSH_END_ADDR			0x8
+#define STARLINK_CACHE_FLUSH_CTL			0x10
+#define STARLINK_CACHE_ALIGN				0x40
+
+#define STARLINK_CACHE_ADDRESS_RANGE_MASK
	GENMASK(39, 0)

drivers/cache/starfive_starlink_cache.c line 23

Quoted 1 line
drivers/cache/starfive_starlink_cache.c new file +1 -0
+#define STARLINK_CACHE_FLUSH_CTL_MODE_MASK
	GENMASK(2, 1)

drivers/cache/starfive_starlink_cache.c

Quoted 7 lines
drivers/cache/starfive_starlink_cache.c new file +7 -0
+#define STARLINK_CACHE_FLUSH_CTL_ENABLE_MASK		BIT(0)
+
+#define STARLINK_CACHE_FLUSH_CTL_CLEAN_INVALIDATE	0
+#define STARLINK_CACHE_FLUSH_CTL_MAKE_INVALIDATE	1
+#define STARLINK_CACHE_FLUSH_CTL_CLEAN_SHARED		2
+#define STARLINK_CACHE_FLUSH_POLL_DELAY_US		1
+#define STARLINK_CACHE_FLUSH_TIMEOUT_US
	5000000

drivers/cache/starfive_starlink_cache.c line 36

Quoted 6 lines
drivers/cache/starfive_starlink_cache.c new file +6 -0
+
+struct starlink_cache_priv {
+	void __iomem *base_addr;
+};
+
+static struct starlink_cache_priv starlink_cache_priv;

This could just be

static void __iomem *starlink_cache_base;

drivers/cache/starfive_starlink_cache.c

Quoted 9 lines
drivers/cache/starfive_starlink_cache.c new file +9 -0
+
+static void starlink_cache_flush_complete(void)
+{
+	volatile void __iomem *ctl = starlink_cache_priv.base_addr +
+				     STARLINK_CACHE_FLUSH_CTL;
+	u64 v;
+	int ret;
+
+	ret = readq_poll_timeout_atomic(ctl, v, !(v &

STARLINK_CACHE_FLUSH_CTL_ENABLE_MASK),

drivers/cache/starfive_starlink_cache.c line 46

Quoted 1 line
drivers/cache/starfive_starlink_cache.c new file +1 -0
+

STARLINK_CACHE_FLUSH_POLL_DELAY_US,

drivers/cache/starfive_starlink_cache.c line 47

Quoted 1 line
drivers/cache/starfive_starlink_cache.c new file +1 -0
+
	STARLINK_CACHE_FLUSH_TIMEOUT_US);

drivers/cache/starfive_starlink_cache.c line 49

Quoted 2 lines
drivers/cache/starfive_starlink_cache.c new file +2 -0
+	if (ret)
+		WARN(1, "StarFive Starlink cache flush operation

timeout\n"); }

drivers/cache/starfive_starlink_cache.c line 53

Quoted 4 lines
drivers/cache/starfive_starlink_cache.c new file +4 -0
+
+static void starlink_cache_dma_cache_wback(phys_addr_t paddr,
+unsigned long size) {
+	writeq(FIELD_PREP(STARLINK_CACHE_ADDRESS_RANGE_MASK,

paddr),

drivers/cache/starfive_starlink_cache.c line 54

Quoted 1 line
drivers/cache/starfive_starlink_cache.c new file +1 -0
+	       starlink_cache_priv.base_addr +

STARLINK_CACHE_FLUSH_START_ADDR);

drivers/cache/starfive_starlink_cache.c line 55

Quoted 1 line
drivers/cache/starfive_starlink_cache.c new file +1 -0
+	writeq(FIELD_PREP(STARLINK_CACHE_ADDRESS_RANGE_MASK,

paddr + size),

Quoted 4 lines
drivers/cache/starfive_starlink_cache.c new file +4 -0
+	       starlink_cache_priv.base_addr +
+STARLINK_CACHE_FLUSH_END_ADDR);
+
+	mb();

drivers/cache/starfive_starlink_cache.c

Quoted 10 lines
drivers/cache/starfive_starlink_cache.c new file +10 -0
+	writeq(FIELD_PREP(STARLINK_CACHE_FLUSH_CTL_MODE_MASK,
+			  STARLINK_CACHE_FLUSH_CTL_CLEAN_SHARED),
+	       starlink_cache_priv.base_addr + STARLINK_CACHE_FLUSH_CTL);
+
+	starlink_cache_flush_complete();
+}
+
+static void starlink_cache_dma_cache_invalidate(phys_addr_t paddr,
+unsigned long size) {
+	writeq(FIELD_PREP(STARLINK_CACHE_ADDRESS_RANGE_MASK,

paddr),

drivers/cache/starfive_starlink_cache.c line 70

Quoted 1 line
drivers/cache/starfive_starlink_cache.c new file +1 -0
+	       starlink_cache_priv.base_addr +

STARLINK_CACHE_FLUSH_START_ADDR);

drivers/cache/starfive_starlink_cache.c line 71

Quoted 1 line
drivers/cache/starfive_starlink_cache.c new file +1 -0
+	writeq(FIELD_PREP(STARLINK_CACHE_ADDRESS_RANGE_MASK,

paddr + size),

Quoted 4 lines
drivers/cache/starfive_starlink_cache.c new file +4 -0
+	       starlink_cache_priv.base_addr +
+STARLINK_CACHE_FLUSH_END_ADDR);
+
+	mb();

drivers/cache/starfive_starlink_cache.c

Quoted 10 lines
drivers/cache/starfive_starlink_cache.c new file +10 -0
+	writeq(FIELD_PREP(STARLINK_CACHE_FLUSH_CTL_MODE_MASK,
+			  STARLINK_CACHE_FLUSH_CTL_MAKE_INVALIDATE),
+	       starlink_cache_priv.base_addr + STARLINK_CACHE_FLUSH_CTL);
+
+	starlink_cache_flush_complete();
+}
+
+static void starlink_cache_dma_cache_wback_inv(phys_addr_t paddr,
+unsigned long size) {
+	writeq(FIELD_PREP(STARLINK_CACHE_ADDRESS_RANGE_MASK,

paddr),

drivers/cache/starfive_starlink_cache.c line 86

Quoted 1 line
drivers/cache/starfive_starlink_cache.c new file +1 -0
+	       starlink_cache_priv.base_addr +

STARLINK_CACHE_FLUSH_START_ADDR);

drivers/cache/starfive_starlink_cache.c line 87

Quoted 1 line
drivers/cache/starfive_starlink_cache.c new file +1 -0
+	writeq(FIELD_PREP(STARLINK_CACHE_ADDRESS_RANGE_MASK,

paddr + size),

Quoted 15 lines
drivers/cache/starfive_starlink_cache.c new file +15 -0
+	       starlink_cache_priv.base_addr +
+STARLINK_CACHE_FLUSH_END_ADDR);
+
+	mb();
+	writeq(FIELD_PREP(STARLINK_CACHE_FLUSH_CTL_MODE_MASK,
+			  STARLINK_CACHE_FLUSH_CTL_CLEAN_INVALIDATE),
+	       starlink_cache_priv.base_addr + STARLINK_CACHE_FLUSH_CTL);
+
+	starlink_cache_flush_complete();
+}
+
+static const struct riscv_nonstd_cache_ops starlink_cache_ops = {
+	.wback = &starlink_cache_dma_cache_wback,
+	.inv = &starlink_cache_dma_cache_invalidate,
+	.wback_inv = &starlink_cache_dma_cache_wback_inv,

drivers/cache/starfive_starlink_cache.c line 111

Quoted 10 lines
drivers/cache/starfive_starlink_cache.c new file +10 -0
+};
+
+static const struct of_device_id starlink_cache_ids[] = {
+	{ .compatible = "starfive,jh8100-starlink-cache" },
+	{ /* sentinel */ }
+};
+
+static int __init starlink_cache_init(void) {
+	struct device_node *np;
+	u32 block_size = 0;

You return early if of_property_read_u32() fails, so this doesn't need to be initialized.

Quoted 19 lines
drivers/cache/starfive_starlink_cache.c new file +19 -0
+	int ret;
+
+	np = of_find_matching_node(NULL, starlink_cache_ids);
+	if (!of_device_is_available(np))
+		return -ENODEV;
+
+	ret = of_property_read_u32(np, "cache-block-size", &block_size);
+	if (ret)
+		return ret;
+
+	if (block_size % STARLINK_CACHE_ALIGN)
+		return -EINVAL;
+
+	starlink_cache_priv.base_addr = of_iomap(np, 0);
+	if (!starlink_cache_priv.base_addr)
+		return -ENOMEM;
+
+	riscv_cbom_block_size = block_size;
+	riscv_noncoherent_supported();
Quoted 8 lines

drivers/cache/starfive_starlink_cache.c line 135

Quoted 5 lines
drivers/cache/starfive_starlink_cache.c new file +5 -0
+	riscv_noncoherent_register_cache_ops(&starlink_cache_ops);
+
+	return 0;
+}
+early_initcall(starlink_cache_init);

The sifive driver gets away with arch_initcall() here. Any particular reason you need this earlier?

I will change it to arch_initcall(). Appreciate for the comments.

Thank you.

Regards,
Joshua

Quoted 9 lines
Quoted 9 lines

--
2.25.1

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

#4 lore raw

RE: [PATCH v3 1/2] cache: Add StarFive StarLink cache management for StarFive JH8100

Quoted 39 lines · Joshua Yeong
Quoted 35 lines · Emil Renner Berthing
Quoted 19 lines · Joshua Yeong

Add StarFive Starlink cache management driver for
JH8100 SoC. This driver enables RISC-V non-standard cache operation on JH8100 that does not support Zicbom extension instructions.

---
 drivers/cache/Kconfig                   |   9 ++
 drivers/cache/Makefile                  |   5 +-
 drivers/cache/starfive_starlink_cache.c | 135
++++++++++++++++++++++++
 3 files changed, 147 insertions(+), 2 deletions(-)  create mode

100644 drivers/cache/starfive_starlink_cache.c

drivers/cache/Kconfig index renamed from drivers/cache/Kconfig +0 -0

9345ce4976d7..9181cd391f53 100644

drivers/cache/Kconfig +0 -0
@@ -14,4 +14,13 @@ config SIFIVE_CCACHE
 	help

drivers/cache/Kconfig config SIFIVE_CCACHE · line 24

Quoted 10 lines
drivers/cache/Kconfig +8 -0
 	  Support for the composable cache controller on SiFive platforms.
 
+config STARFIVE_STARLINK_CACHE
+	bool "StarFive StarLink Cache controller"
+	depends on RISCV
+	depends on ARCH_STARFIVE
+	select RISCV_DMA_NONCOHERENT
+	select RISCV_NONSTANDARD_CACHE_OPS
+	help
+	  Support for the StarLink cache controller on StarFive platforms.

This is a bit misleading. The JH71x0s don't have this. It's only on the JH8100 so far, and hopefully later SoCs will just implement RISC-V standards for this. So maybe something like

Quoted 2 lines

"Support for the StarLink cache controller on the StarFive JH8100 SoC."

Quoted 7 lines

Hi Emil,

The StarLink-500 cache controller is not designed exclusively for JH8100 SoC. While it is true that it currently exists on the StarFive platform, CPU/SoC that does not come with Zicbom extensions supported would need to rely on this cache drive to do cache management operations. I think we don’t need to mentioned 'JH8100 SoC' here.

Wait, in the previous mail you said that future designs will implement Zicbom and not need this work-around, but here you're talking about other SoCs that do need it. So which is it?

#5 lore raw

RE: [PATCH v3 1/2] cache: Add StarFive StarLink cache management for StarFive JH8100

Quoted 50 lines · Emil Renner Berthing
Quoted 24 lines · Joshua Yeong
Quoted 23 lines · Emil Renner Berthing
Quoted 22 lines · Joshua Yeong

Add StarFive Starlink cache management driver for JH8100 SoC. This driver enables RISC-V non-standard cache operation on
JH8100 that does not support Zicbom extension instructions.

---
 drivers/cache/Kconfig                   |   9 ++
 drivers/cache/Makefile                  |   5 +-
 drivers/cache/starfive_starlink_cache.c | 135
++++++++++++++++++++++++
 3 files changed, 147 insertions(+), 2 deletions(-)  create mode

100644 drivers/cache/starfive_starlink_cache.c

drivers/cache/Kconfig index renamed from drivers/cache/Kconfig +0 -0

9345ce4976d7..9181cd391f53 100644

drivers/cache/Kconfig +0 -0
@@ -14,4 +14,13 @@ config SIFIVE_CCACHE
 	help
 	  Support for the composable cache controller on SiFive platforms.
 
Quoted 11 lines
Quoted 11 lines

drivers/cache/Kconfig config SIFIVE_CCACHE · line 24

Quoted 8 lines
drivers/cache/Kconfig +8 -0
+config STARFIVE_STARLINK_CACHE
+	bool "StarFive StarLink Cache controller"
+	depends on RISCV
+	depends on ARCH_STARFIVE
+	select RISCV_DMA_NONCOHERENT
+	select RISCV_NONSTANDARD_CACHE_OPS
+	help
+	  Support for the StarLink cache controller on StarFive platforms.

This is a bit misleading. The JH71x0s don't have this. It's only on the JH8100 so far, and hopefully later SoCs will just implement RISC-V

standards for this.

Quoted 5 lines
Quoted 4 lines

So maybe something like

"Support for the StarLink cache controller on the StarFive JH8100 SoC."

Quoted 7 lines

Hi Emil,

The StarLink-500 cache controller is not designed exclusively for JH8100 SoC. While it is true that it currently exists on the StarFive platform, CPU/SoC that does not come with Zicbom extensions supported would need to rely on this cache drive to do cache management operations. I think we don’t need to mentioned 'JH8100 SoC' here.

Quoted 3 lines

Wait, in the previous mail you said that future designs will implement Zicbom and not need this work-around, but here you're talking about other SoCs that do need it. So which is it?

If you visit the company website and look for StarLink-500, you will find that it is a standalone IP that the company is selling as an interconnect. Anyone who integrates StarLink without Zicbom extensions may utilize the cache management operation from this IP.

#6 lore raw

RE: [PATCH v3 1/2] cache: Add StarFive StarLink cache management for StarFive JH8100

Quoted 53 lines · Joshua Yeong
Quoted 50 lines · Emil Renner Berthing
Quoted 24 lines · Joshua Yeong
Quoted 23 lines · Emil Renner Berthing
Quoted 22 lines · Joshua Yeong

Add StarFive Starlink cache management driver for JH8100 SoC. This driver enables RISC-V non-standard cache operation on
JH8100 that does not support Zicbom extension instructions.

---
 drivers/cache/Kconfig                   |   9 ++
 drivers/cache/Makefile                  |   5 +-
 drivers/cache/starfive_starlink_cache.c | 135
++++++++++++++++++++++++
 3 files changed, 147 insertions(+), 2 deletions(-)  create mode

100644 drivers/cache/starfive_starlink_cache.c

drivers/cache/Kconfig index renamed from drivers/cache/Kconfig +0 -0

9345ce4976d7..9181cd391f53 100644

drivers/cache/Kconfig +0 -0
@@ -14,4 +14,13 @@ config SIFIVE_CCACHE
 	help
 	  Support for the composable cache controller on SiFive platforms.
 
Quoted 11 lines
Quoted 11 lines

drivers/cache/Kconfig config SIFIVE_CCACHE · line 24

Quoted 8 lines
drivers/cache/Kconfig +8 -0
+config STARFIVE_STARLINK_CACHE
+	bool "StarFive StarLink Cache controller"
+	depends on RISCV
+	depends on ARCH_STARFIVE
+	select RISCV_DMA_NONCOHERENT
+	select RISCV_NONSTANDARD_CACHE_OPS
+	help
+	  Support for the StarLink cache controller on StarFive platforms.

This is a bit misleading. The JH71x0s don't have this. It's only on the JH8100 so far, and hopefully later SoCs will just implement RISC-V

standards for this.

Quoted 12 lines
Quoted 4 lines

So maybe something like

"Support for the StarLink cache controller on the StarFive JH8100 SoC."

Hi Emil,

The StarLink-500 cache controller is not designed exclusively for JH8100 SoC. While it is true that it currently exists on the StarFive platform, CPU/SoC that does not come with Zicbom extensions supported would need to rely on this cache drive to do cache management operations. I think we don’t need to mentioned 'JH8100 SoC' here.

Quoted 8 lines
Quoted 3 lines

Wait, in the previous mail you said that future designs will implement Zicbom and not need this work-around, but here you're talking about other SoCs that do need it. So which is it?

If you visit the company website and look for StarLink-500, you will find that it is a standalone IP that the company is selling as an interconnect. Anyone who integrates StarLink without Zicbom extensions may utilize the cache management operation from this IP.

So then the "on StarFive platforms" part is wrong? Or will this always go together with the Dubhe cores?

Quoted 5 lines

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

#7 lore raw

RE: [PATCH v3 1/2] cache: Add StarFive StarLink cache management for StarFive JH8100

Quoted 65 lines · Emil Renner Berthing
Quoted 21 lines · Joshua Yeong
Quoted 18 lines · Emil Renner Berthing
Quoted 17 lines · Joshua Yeong
Quoted 16 lines · Emil Renner Berthing
Quoted 15 lines · Joshua Yeong

Add StarFive Starlink cache management driver for JH8100 SoC. This driver enables RISC-V non-standard cache operation on
JH8100 that does not support Zicbom extension instructions.

---
 drivers/cache/Kconfig                   |   9 ++
 drivers/cache/Makefile                  |   5 +-
 drivers/cache/starfive_starlink_cache.c | 135
++++++++++++++++++++++++
 3 files changed, 147 insertions(+), 2 deletions(-)  create

mode
100644 drivers/cache/starfive_starlink_cache.c

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/cache/Kconfig config SIFIVE_CCACHE · line 15

Quoted 8 lines
drivers/cache/Kconfig +0 -0

index
9345ce4976d7..9181cd391f53 100644

drivers/cache/Kconfig +0 -0
@@ -14,4 +14,13 @@ config SIFIVE_CCACHE
 	help
 	  Support for the composable cache controller on SiFive

platforms.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

drivers/cache/Kconfig config SIFIVE_CCACHE

Quoted 9 lines
drivers/cache/Kconfig +8 -0
+config STARFIVE_STARLINK_CACHE
+	bool "StarFive StarLink Cache controller"
+	depends on RISCV
+	depends on ARCH_STARFIVE
+	select RISCV_DMA_NONCOHERENT
+	select RISCV_NONSTANDARD_CACHE_OPS
+	help
+	  Support for the StarLink cache controller on StarFive

platforms.

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines

This is a bit misleading. The JH71x0s don't have this. It's only on the JH8100 so far, and hopefully later SoCs will just implement RISC-V

standards for this.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

So maybe something like

"Support for the StarLink cache controller on the StarFive JH8100 SoC."

Hi Emil,

The StarLink-500 cache controller is not designed exclusively for JH8100

SoC.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

While it is true that it currently exists on the StarFive platform, CPU/SoC that does not come with Zicbom extensions supported would need to rely on this cache drive to do cache management operations. I think we don’t need to mentioned 'JH8100

SoC' here.

Quoted 5 lines
Quoted 4 lines

Wait, in the previous mail you said that future designs will implement Zicbom and not need this work-around, but here you're talking about other SoCs that do need it. So which is it?

Quoted 7 lines
Quoted 4 lines

If you visit the company website and look for StarLink-500, you will find that it is a standalone IP that the company is selling as an interconnect. Anyone who integrates StarLink without Zicbom extensions may utilize the cache management operation from this IP.

So then the "on StarFive platforms" part is wrong? Or will this always go together with the Dubhe cores?

It would be 'on StarFive platform' without 'JH8100 SoC' that you suggested. StarFive's newer cores that will have Zicbom extensions supported. Those CPU core will not need to have this cache controller enabled.

Quoted 6 lines
Quoted 6 lines

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

#8 lore raw

RE: [PATCH v3 1/2] cache: Add StarFive StarLink cache management for StarFive JH8100

Quoted 71 lines · Joshua Yeong
Quoted 70 lines · Emil Renner Berthing
Quoted 21 lines · Joshua Yeong
Quoted 18 lines · Emil Renner Berthing
Quoted 17 lines · Joshua Yeong
Quoted 16 lines · Emil Renner Berthing
Quoted 15 lines · Joshua Yeong

Add StarFive Starlink cache management driver for JH8100 SoC. This driver enables RISC-V non-standard cache operation on
JH8100 that does not support Zicbom extension instructions.

---
 drivers/cache/Kconfig                   |   9 ++
 drivers/cache/Makefile                  |   5 +-
 drivers/cache/starfive_starlink_cache.c | 135
++++++++++++++++++++++++
 3 files changed, 147 insertions(+), 2 deletions(-)  create

mode
100644 drivers/cache/starfive_starlink_cache.c

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/cache/Kconfig config SIFIVE_CCACHE · line 15

Quoted 8 lines
drivers/cache/Kconfig +0 -0

index
9345ce4976d7..9181cd391f53 100644

drivers/cache/Kconfig +0 -0
@@ -14,4 +14,13 @@ config SIFIVE_CCACHE
 	help
 	  Support for the composable cache controller on SiFive

platforms.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

drivers/cache/Kconfig config SIFIVE_CCACHE · line 23

Quoted 9 lines
drivers/cache/Kconfig +8 -0
+config STARFIVE_STARLINK_CACHE
+	bool "StarFive StarLink Cache controller"
+	depends on RISCV
+	depends on ARCH_STARFIVE
+	select RISCV_DMA_NONCOHERENT
+	select RISCV_NONSTANDARD_CACHE_OPS
+	help
+	  Support for the StarLink cache controller on StarFive

platforms.

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines

This is a bit misleading. The JH71x0s don't have this. It's only on the JH8100 so far, and hopefully later SoCs will just implement RISC-V

standards for this.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

So maybe something like

"Support for the StarLink cache controller on the StarFive JH8100 SoC."

Hi Emil,

The StarLink-500 cache controller is not designed exclusively for JH8100

SoC.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

While it is true that it currently exists on the StarFive platform, CPU/SoC that does not come with Zicbom extensions supported would need to rely on this cache drive to do cache management operations. I think we don’t need to mentioned 'JH8100

SoC' here.

Quoted 9 lines
Quoted 4 lines

Wait, in the previous mail you said that future designs will implement Zicbom and not need this work-around, but here you're talking about other SoCs that do need it. So which is it?

If you visit the company website and look for StarLink-500, you will find that it is a standalone IP that the company is selling as an interconnect. Anyone who integrates StarLink without Zicbom extensions may utilize the cache management operation from this IP.

Quoted 6 lines
Quoted 2 lines

So then the "on StarFive platforms" part is wrong? Or will this always go together with the Dubhe cores?

It would be 'on StarFive platform' without 'JH8100 SoC' that you suggested. StarFive's newer cores that will have Zicbom extensions supported. Those CPU core will not need to have this cache controller enabled.

No, what I meant was that if you're selling the "StarLink-500" IP to other SoC manufacturors then it will not be restricted to StarFive platforms. So then "Support for the StarLink cache controller _on StarFive platforms_" is no longer true, right?

/Emil

#9 lore raw

RE: [PATCH v3 1/2] cache: Add StarFive StarLink cache management for StarFive JH8100

Quoted 79 lines · Emil Renner Berthing
Quoted 44 lines · Joshua Yeong
Quoted 43 lines · Emil Renner Berthing
Quoted 22 lines · Joshua Yeong
Quoted 19 lines · Emil Renner Berthing
Quoted 18 lines · Joshua Yeong
Quoted 17 lines · Emil Renner Berthing
Quoted 16 lines · Joshua Yeong

Add StarFive Starlink cache management driver for JH8100 SoC. This driver enables RISC-V non-standard cache operation on
JH8100 that does not support Zicbom extension instructions.

Signed-off-by: Joshua Yeong
<[email protected]>

---
 drivers/cache/Kconfig                   |   9 ++
 drivers/cache/Makefile                  |   5 +-
 drivers/cache/starfive_starlink_cache.c | 135
++++++++++++++++++++++++
 3 files changed, 147 insertions(+), 2 deletions(-)

create mode
100644 drivers/cache/starfive_starlink_cache.c

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/cache/Kconfig config SIFIVE_CCACHE · line 15

Quoted 8 lines
drivers/cache/Kconfig +0 -0

index
9345ce4976d7..9181cd391f53 100644

drivers/cache/Kconfig +0 -0
@@ -14,4 +14,13 @@ config SIFIVE_CCACHE
 	help
 	  Support for the composable cache controller on SiFive

platforms.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

drivers/cache/Kconfig config SIFIVE_CCACHE · line 23

Quoted 9 lines
drivers/cache/Kconfig +8 -0
+config STARFIVE_STARLINK_CACHE
+	bool "StarFive StarLink Cache controller"
+	depends on RISCV
+	depends on ARCH_STARFIVE
+	select RISCV_DMA_NONCOHERENT
+	select RISCV_NONSTANDARD_CACHE_OPS
+	help
+	  Support for the StarLink cache controller on StarFive

platforms.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

This is a bit misleading. The JH71x0s don't have this. It's only on the JH8100 so far, and hopefully later SoCs will just implement RISC-V

standards for this.

Quoted 3 lines
Quoted 3 lines

So maybe something like

"Support for the StarLink cache controller on the StarFive JH8100

SoC."

Quoted 26 lines
Quoted 25 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 1 line

Hi Emil,

The StarLink-500 cache controller is not designed exclusively for JH8100

SoC.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

While it is true that it currently exists on the StarFive platform, CPU/SoC that does not come with Zicbom extensions supported would need to rely on this cache drive to do cache management operations. I think we don’t need to mentioned 'JH8100

SoC' here.

Quoted 9 lines
Quoted 4 lines

Wait, in the previous mail you said that future designs will implement Zicbom and not need this work-around, but here you're talking about other SoCs that do need it. So which is it?

If you visit the company website and look for StarLink-500, you will find that it is a standalone IP that the company is selling as an interconnect. Anyone who integrates StarLink without Zicbom extensions may utilize the cache management operation from this IP.

So then the "on StarFive platforms" part is wrong? Or will this always go together with the Dubhe cores?

Quoted 8 lines
Quoted 3 lines

It would be 'on StarFive platform' without 'JH8100 SoC' that you suggested. StarFive's newer cores that will have Zicbom extensions supported. Those CPU core will not need to have this cache controller enabled.

No, what I meant was that if you're selling the "StarLink-500" IP to other SoC manufacturors then it will not be restricted to StarFive platforms. So then "Support for the StarLink cache controller _on StarFive platforms_" is no longer true, right?

Yes, you are right on this. AFAIK JH8100 integrates StarLink-500 and which is why we need this cache controller driver, I do not know who/what else products that might use this IP.

Quoted 2 lines

/Emil

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

#10 lore raw

PATCH v3 2/2 dt-bindings: cache: Add docs for StarFive Starlink cache controller

In reply to Joshua Yeong

Add DT binding documentation used by StarFive's
JH8100 SoC Starlink cache controller.

---
 .../cache/starfive,jh8100-starlink-cache.yaml | 66 +++++++++++++++++++
 1 file changed, 66 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/cache/starfive,jh8100-starlink-cache.yaml
Documentation/devicetree/bindings/cache/starfive,jh8100-starlink-cache.yaml new file +66 -0
new file mode 100644
index 000000000000..6d61098e388b
@@ -0,0 +1,66 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/cache/starfive,jh8100-starlink-cache.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: StarFive StarLink Cache Controller
+
+maintainers:
+  - Joshua Yeong <[email protected]>
+
+description:
+  StarFive's StarLink Cache Controller manages the L3 cache shared between
+  clusters of CPU cores. The cache driver enables RISC-V non-standard cache
+  management as an alternative to instructions in the RISC-V Zicbom extension.
+
+allOf:
+  - $ref: /schemas/cache-controller.yaml#
+
+# We need a select here so we don't match all nodes with 'cache'
+select:
+  properties:
+    compatible:
+      contains:
+        enum:
+          - starfive,jh8100-starlink-cache
+
+  required:
+    - compatible
+
+properties:
+  compatible:
+    items:
+      - const: starfive,jh8100-starlink-cache
+      - const: cache
+
+  reg:
+    maxItems: 1
+
+unevaluatedProperties: false
+
+required:
+  - compatible
+  - reg
+  - cache-block-size
+  - cache-level
+  - cache-sets
+  - cache-size
+  - cache-unified
+
+examples:
+  - |
+      soc {
+        #address-cells = <2>;
+        #size-cells = <2>;
+
+        cache-controller@15000000 {
+          compatible = "starfive,jh8100-starlink-cache", "cache";
+          reg = <0x0 0x15000000 0x0 0x278>;
+          cache-block-size = <64>;
+          cache-level = <3>;
+          cache-sets = <8192>;
+          cache-size = <0x400000>;
+          cache-unified;
+        };
+      };
Signature · 1 line
2.25.1
maintainer Reviewed-by on v3 2/2
#11 lore raw

Re: [PATCH v3 2/2] dt-bindings: cache: Add docs for StarFive Starlink cache controller

Quoted 9 lines · Joshua Yeong

Add DT binding documentation used by StarFive's
JH8100 SoC Starlink cache controller.

---
 .../cache/starfive,jh8100-starlink-cache.yaml | 66 +++++++++++++++++++
 1 file changed, 66 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/cache/starfive,jh8100-starlink-cache.yaml
#12 lore raw
In reply to Joshua Yeong
Quoted 3 lines · Joshua Yeong

StarFive's JH8100 StarLink Cache Controller flush/invalidates cache using non- conventional RISC-V Zicbom extension instructions. This driver provides the cache handling on StarFive RISC-V SoC.

Hi Joshua,

As far as I know you didn't tape out the JH8100 yet, and you seem to have replaced the SiFive cache controller with your own implementation. Can you exlain a bit more about why you didn't implement the perfectly good Zicbom standard instead of adding yet another non-standard work-around like this?

/Emil

Quoted 32 lines

Changes in v3:
- Fix code syntax
- Link to v2: https://lore.kernel.org/all/[email protected]/

Changes in v2:
- Change patch title from 'Add StarFive's StarLink-500 Cache Controller'
- Remove StarFive alternative from errata framework
- Fixes warning from https://lore.kernel.org/oe-kbuild-all/[email protected]/
- Flush completion through atomic timeout function
- Link to v1: https://lore.kernel.org/lkml/[email protected]/

Joshua Yeong (2):
cache: Add StarFive StarLink cache management for StarFive JH8100
dt-bindings: cache: Add docs for StarFive Starlink cache controller

 .../cache/starfive,jh8100-starlink-cache.yaml |  66 +++++++++
 drivers/cache/Kconfig                         |   9 ++
 drivers/cache/Makefile                        |   5 +-
 drivers/cache/starfive_starlink_cache.c       | 135 ++++++++++++++++++
 4 files changed, 213 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/cache/starfive,jh8100-starlink-cache.yaml
 create mode 100644 drivers/cache/starfive_starlink_cache.c

--
2.25.1

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

#13 lore raw

Emil Renner Berthing :

Quoted 5 lines
Quoted 3 lines · Joshua Yeong

StarFive's JH8100 StarLink Cache Controller flush/invalidates cache using non- conventional RISC-V Zicbom extension instructions. This driver provides the cache handling on StarFive RISC-V SoC.

Quoted 8 lines

Hi Joshua,

As far as I know you didn't tape out the JH8100 yet, and you seem to have replaced the SiFive cache controller with your own implementation. Can you exlain a bit more about why you didn't implement the perfectly good Zicbom standard instead of adding yet another non-standard work-around like this?

/Emil

Hi Emil,

I agree that the Zicbom standard is an important extension and future- designed SoC should have this. In the V1 patch, I mentioned that the CPU core used in JH8100 is matured, but unfortunately, it did not support the Zicbom extension. JH8100 integrates 'Starlink-500' IP (more information homepage), an in-house designed interconnect between peripherals and CPU to handle cache management operations.

Regards,
Joshua

Quoted 17 lines
Quoted 5 lines

Changes in v3:
- Fix code syntax
- Link to v2:
https://lore.kernel.org/all/20240423072639.143450-1-

joshua.yeong@starf

Quoted 11 lines

ivetech.com/

Changes in v2:
- Change patch title from 'Add StarFive's StarLink-500 Cache Controller'
- Remove StarFive alternative from errata framework
- Fixes warning from
https://lore.kernel.org/oe-kbuild-all/202403151625.boKDjHGr-lkp@intel.
com/
- Flush completion through atomic timeout function
- Link to v1:
https://lore.kernel.org/lkml/20240314061205.26143-1-

Quoted 24 lines

joshua.yeong@starf

Quoted 23 lines

ivetech.com/

Joshua Yeong (2):
cache: Add StarFive StarLink cache management for StarFive JH8100
dt-bindings: cache: Add docs for StarFive Starlink cache controller

 .../cache/starfive,jh8100-starlink-cache.yaml |  66 +++++++++
 drivers/cache/Kconfig                         |   9 ++
 drivers/cache/Makefile                        |   5 +-
 drivers/cache/starfive_starlink_cache.c       | 135 ++++++++++++++++++
 4 files changed, 213 insertions(+), 2 deletions(-)  create mode

100644 Documentation/devicetree/bindings/cache/starfive,jh8100-starlink-cache .yaml create mode 100644 drivers/cache/starfive_starlink_cache.c

--
2.25.1

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv