Skip to contentSkip to conversation

cache: StarFive: Require a 64-bit system

PATCH Superseded Palmer Dabbelt 2 participants 3 messages Jul 20, 2024 – Jul 22, 2024

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cache: StarFive: Require a 64-bit system

From: Palmer Dabbelt <[email protected]>

This has a bunch of {read,write}q() calls, so it won't work on 32-bit systems. I don't think there's any 32-bit StarFive systems, so for now just require 64-bit.

Fixes cabff60ca77d ("cache: Add StarFive StarLink cache management")
---
 drivers/cache/Kconfig                   | 1 +
 drivers/cache/starfive_starlink_cache.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/cache/Kconfig +1 -0
index 94abd8f632a7..db51386c663a 100644
@@ -18,6 +18,7 @@ config STARFIVE_STARLINK_CACHE
 	bool "StarFive StarLink Cache controller"
 	depends on RISCV
 	depends on ARCH_STARFIVE
+	depends on 64BIT
 	select RISCV_DMA_NONCOHERENT
 	select RISCV_NONSTANDARD_CACHE_OPS
 	help
drivers/cache/starfive_starlink_cache.c +1 -1
index 24c7d078ca22..8ee9569771f8 100644
@@ -19,7 +19,7 @@
 #define STARLINK_CACHE_FLUSH_CTL			0x10
 #define STARLINK_CACHE_ALIGN				0x40
 
-#define STARLINK_CACHE_ADDRESS_RANGE_MASK		GENMASK(39, 0)
+#define STARLINK_CACHE_ADDRESS_RANGE_MASK		GENMASK(39ULL, 0)
 #define STARLINK_CACHE_FLUSH_CTL_MODE_MASK		GENMASK(2, 1)
 #define STARLINK_CACHE_FLUSH_CTL_ENABLE_MASK		BIT(0)
 
Signature · 1 line
2.45.2
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Palmer Dabbelt

From: Palmer Dabbelt <[email protected]>

This has a bunch of {read,write}q() calls, so it won't work on 32-bit systems. I don't think there's any 32-bit StarFive systems, so for now just require 64-bit.

Fixes cabff60ca77d ("cache: Add StarFive StarLink cache management")

if you wanna take it - might be worth being explicit about it causing build issues for rv32 though.

Thanks,
Conor.

Quoted 33 lines
---
 drivers/cache/Kconfig                   | 1 +
 drivers/cache/starfive_starlink_cache.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/cache/Kconfig +1 -0
index 94abd8f632a7..db51386c663a 100644
@@ -18,6 +18,7 @@ config STARFIVE_STARLINK_CACHE
 	bool "StarFive StarLink Cache controller"
 	depends on RISCV
 	depends on ARCH_STARFIVE
+	depends on 64BIT
 	select RISCV_DMA_NONCOHERENT
 	select RISCV_NONSTANDARD_CACHE_OPS
 	help
drivers/cache/starfive_starlink_cache.c +1 -1
index 24c7d078ca22..8ee9569771f8 100644
@@ -19,7 +19,7 @@
 #define STARLINK_CACHE_FLUSH_CTL			0x10
 #define STARLINK_CACHE_ALIGN				0x40
 
-#define STARLINK_CACHE_ADDRESS_RANGE_MASK		GENMASK(39, 0)
+#define STARLINK_CACHE_ADDRESS_RANGE_MASK		GENMASK(39ULL, 0)
 #define STARLINK_CACHE_FLUSH_CTL_MODE_MASK		GENMASK(2, 1)
 #define STARLINK_CACHE_FLUSH_CTL_ENABLE_MASK		BIT(0)
 
Signature · 1 line
2.45.2
maintainer
#2 lore raw
Quoted 39 lines · Conor Dooley
Quoted 8 lines · Palmer Dabbelt

From: Palmer Dabbelt <[email protected]>

This has a bunch of {read,write}q() calls, so it won't work on 32-bit systems. I don't think there's any 32-bit StarFive systems, so for now just require 64-bit.

Fixes cabff60ca77d ("cache: Add StarFive StarLink cache management")

if you wanna take it - might be worth being explicit about it causing build issues for rv32 though.

Quoted 25 lines
---
 drivers/cache/Kconfig                   | 1 +
 drivers/cache/starfive_starlink_cache.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/cache/Kconfig +1 -0
index 94abd8f632a7..db51386c663a 100644
@@ -18,6 +18,7 @@ config STARFIVE_STARLINK_CACHE
 	bool "StarFive StarLink Cache controller"
 	depends on RISCV
 	depends on ARCH_STARFIVE
+	depends on 64BIT
 	select RISCV_DMA_NONCOHERENT
 	select RISCV_NONSTANDARD_CACHE_OPS
 	help
drivers/cache/starfive_starlink_cache.c +0 -0
index 24c7d078ca22..8ee9569771f8 100644
@@ -19,7 +19,7 @@
 #define STARLINK_CACHE_FLUSH_CTL			0x10
 #define STARLINK_CACHE_ALIGN				0x40
 
Quoted 2 lines

drivers/cache/starfive_starlink_cache.c line 22

Quoted 2 lines
drivers/cache/starfive_starlink_cache.c +1 -1
-#define STARLINK_CACHE_ADDRESS_RANGE_MASK		GENMASK(39, 0)
+#define STARLINK_CACHE_ADDRESS_RANGE_MASK		GENMASK(39ULL, 0)

Actually, Emil pointed out on IRC that this looks wrong. Should probably be GENMASK_ULL(39, 0), not GENMASK(39ULL, 0)