Skip to contentSkip to conversation

riscv: move sifive_l2_cache.c to drivers/misc

PATCH In review Christoph Hellwig 4 participants 6 messages Aug 7, 2019 – Aug 8, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 riscv: move sifive_l2_cache.c to drivers/misc

The sifive_l2_cache.c is in no way related to RISC-V architecture memory management. It is a little stub driver working around the fact that the EDAC maintainers prefer their drivers to be structured in a certain way that doesn't fit the SiFive SOCs.

Move the file to drivers/misc and only build it when the EDAC_SIFIVE config option is selected.

Fixes a967a289f169 ("RISC-V: sifive_l2_cache: Add L2 cache controller driver for SiFive SoCs")
---
 arch/riscv/mm/Makefile                            | 1 -
 drivers/misc/Makefile                             | 1 +
 {arch/riscv/mm => drivers/misc}/sifive_l2_cache.c | 0
 3 files changed, 1 insertion(+), 1 deletion(-)
 rename {arch/riscv/mm => drivers/misc}/sifive_l2_cache.c (100%)
arch/riscv/mm/Makefile +0 -1
index 74055e1d6f21..d2101d0741d4 100644
@@ -11,6 +11,5 @@ obj-y += extable.o
 obj-y += ioremap.o
 obj-y += cacheflush.o
 obj-y += context.o
-obj-y += sifive_l2_cache.o
 
 obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
drivers/misc/Makefile +1 -0
index abd8ae249746..886d48301e8e 100644
@@ -59,3 +59,4 @@ obj-y				+= cardreader/
 obj-$(CONFIG_PVPANIC)   	+= pvpanic.o
 obj-$(CONFIG_HABANA_AI)		+= habanalabs/
 obj-$(CONFIG_XILINX_SDFEC)	+= xilinx_sdfec.o
+obj-$(CONFIG_EDAC_SIFIVE)	+= sifive_l2_cache.o
drivers/misc/sifive_l2_cache.c renamed from arch/riscv/mm/sifive_l2_cache.c +0 -0
similarity index 100%
rename from arch/riscv/mm/sifive_l2_cache.c
rename to drivers/misc/sifive_l2_cache.c
Signature · 1 line
2.20.1
maintainer
#1 lore raw
Quoted 8 lines · Christoph Hellwig

The sifive_l2_cache.c is in no way related to RISC-V architecture memory management. It is a little stub driver working around the fact that the EDAC maintainers prefer their drivers to be structured in a certain way that doesn't fit the SiFive SOCs.

Move the file to drivers/misc and only build it when the EDAC_SIFIVE config option is selected.

Quoted 8 lines
Fixes a967a289f169 ("RISC-V: sifive_l2_cache: Add L2 cache controller driver for SiFive SoCs")
---
 arch/riscv/mm/Makefile                            | 1 -
 drivers/misc/Makefile                             | 1 +
 {arch/riscv/mm => drivers/misc}/sifive_l2_cache.c | 0
 3 files changed, 1 insertion(+), 1 deletion(-)
 rename {arch/riscv/mm => drivers/misc}/sifive_l2_cache.c (100%)

Why isn't this in drivers/edac/ ?
why is this a misc driver? Seems like it should sit next to the edac stuff.

thanks,

greg k-h

#2 lore raw
Quoted 9 lines · Greg KH
Quoted 8 lines
Fixes a967a289f169 ("RISC-V: sifive_l2_cache: Add L2 cache controller driver for SiFive SoCs")
---
 arch/riscv/mm/Makefile                            | 1 -
 drivers/misc/Makefile                             | 1 +
 {arch/riscv/mm => drivers/misc}/sifive_l2_cache.c | 0
 3 files changed, 1 insertion(+), 1 deletion(-)
 rename {arch/riscv/mm => drivers/misc}/sifive_l2_cache.c (100%)
Quoted 3 lines

Why isn't this in drivers/edac/ ?
why is this a misc driver? Seems like it should sit next to the edac stuff.

No idea. EDAC maintainers, would you object to taking what is currently in arch/riscv/mm//sifive_l2_cache.c to drivers/edac/ ?

#3 lore raw
Quoted 10 lines · Christoph Hellwig
Quoted 9 lines · Greg KH
Quoted 8 lines
Fixes a967a289f169 ("RISC-V: sifive_l2_cache: Add L2 cache controller driver for SiFive SoCs")
---
 arch/riscv/mm/Makefile                            | 1 -
 drivers/misc/Makefile                             | 1 +
 {arch/riscv/mm => drivers/misc}/sifive_l2_cache.c | 0
 3 files changed, 1 insertion(+), 1 deletion(-)
 rename {arch/riscv/mm => drivers/misc}/sifive_l2_cache.c (100%)
Quoted 6 lines
Quoted 3 lines

Why isn't this in drivers/edac/ ?
why is this a misc driver? Seems like it should sit next to the edac stuff.

No idea. EDAC maintainers, would you object to taking what is currently in arch/riscv/mm//sifive_l2_cache.c to drivers/edac/ ?

If this driver is moved out of arch/riscv/mm, it should ideally go into some sort of common L2 cache controller driver directory, along with other L2 cache controller drivers like arch/arm/mm/*l2c*.

Like many L2 cache controllers, this controller also supports cache flushing operations and SoC-specific way operations. We just don't use those on RISC-V - yet.

- Paul

#4 lore raw
Quoted 19 lines · Paul Walmsley
Quoted 10 lines · Christoph Hellwig
Quoted 9 lines · Greg KH
Quoted 8 lines
Fixes a967a289f169 ("RISC-V: sifive_l2_cache: Add L2 cache controller driver for SiFive SoCs")
---
 arch/riscv/mm/Makefile                            | 1 -
 drivers/misc/Makefile                             | 1 +
 {arch/riscv/mm => drivers/misc}/sifive_l2_cache.c | 0
 3 files changed, 1 insertion(+), 1 deletion(-)
 rename {arch/riscv/mm => drivers/misc}/sifive_l2_cache.c (100%)
Quoted 6 lines
Quoted 3 lines

Why isn't this in drivers/edac/ ?
why is this a misc driver? Seems like it should sit next to the edac stuff.

No idea. EDAC maintainers, would you object to taking what is currently in arch/riscv/mm//sifive_l2_cache.c to drivers/edac/ ?

Quoted 7 lines

If this driver is moved out of arch/riscv/mm, it should ideally go into some sort of common L2 cache controller driver directory, along with other L2 cache controller drivers like arch/arm/mm/*l2c*.

Like many L2 cache controllers, this controller also supports cache flushing operations and SoC-specific way operations. We just don't use those on RISC-V - yet.

Well, another reason to not have it under arch/riscv/ as it is a SOC specific driver, which we all have somewhere else, just like arm64 and new arm ports do. And especially not unconditionally built.

maintainer
#5 lore raw
Quoted 23 lines · Christoph Hellwig
Quoted 22 lines · Paul Walmsley
Quoted 10 lines · Christoph Hellwig
Quoted 9 lines · Greg KH
Quoted 8 lines
Fixes a967a289f169 ("RISC-V: sifive_l2_cache: Add L2 cache controller driver for SiFive SoCs")
---
 arch/riscv/mm/Makefile                            | 1 -
 drivers/misc/Makefile                             | 1 +
 {arch/riscv/mm => drivers/misc}/sifive_l2_cache.c | 0
 3 files changed, 1 insertion(+), 1 deletion(-)
 rename {arch/riscv/mm => drivers/misc}/sifive_l2_cache.c (100%)
Quoted 6 lines
Quoted 3 lines

Why isn't this in drivers/edac/ ?
why is this a misc driver? Seems like it should sit next to the edac stuff.

No idea. EDAC maintainers, would you object to taking what is currently in arch/riscv/mm//sifive_l2_cache.c to drivers/edac/ ?

If this driver is moved out of arch/riscv/mm, it should ideally go into some sort of common L2 cache controller driver directory, along with other L2 cache controller drivers like arch/arm/mm/*l2c*.

Quoted 7 lines
Quoted 3 lines

Like many L2 cache controllers, this controller also supports cache flushing operations and SoC-specific way operations. We just don't use those on RISC-V - yet.

Well, another reason to not have it under arch/riscv/ as it is a SOC specific driver, which we all have somewhere else, just like arm64 and new arm ports do. And especially not unconditionally built.

soc specific drivers that don't have their own subsystem can go into drivers/soc/$VENDOR/.

For this driver, I would also think that the edac subsystem is the best fit. Right now, the driver is split in two halves: there is drivers/edac/sifive_edac.c and arch/riscv/mm/sifive_l2_cache.c, with neither of those working without the other.

Moving both into a single file would seem to allow simplifying it as a proper 'platform_driver', which the drivers/edac side today is not (it just registers a platform device in its module_init call).

Arnd