[RFC PATCH v2 4/5] driver: hwpf: Add Kconfig/Makefile to build hardware prefetch driver
From: Kohei Tarumizu
Date: Thu Nov 04 2021 - 01:29:32 EST
This adds kconfig/Makefile to build hardware prefetch driver for
A64FX and Intel support. This also add MAINTAINERS entry.
Note that this is the first time to add A64FX specific driver,
this adds A64FX entry in Kconfig.platforms of arm64 Kconfig.
Signed-off-by: Kohei Tarumizu <tarumizu.kohei@xxxxxxxxxxx>
---
MAINTAINERS | 7 +++++++
arch/arm64/Kconfig.platforms | 6 ++++++
arch/x86/Kconfig | 12 ++++++++++++
drivers/Kconfig | 2 ++
drivers/Makefile | 1 +
drivers/hwpf/Kconfig | 24 ++++++++++++++++++++++++
drivers/hwpf/Makefile | 9 +++++++++
7 files changed, 61 insertions(+)
create mode 100644 drivers/hwpf/Kconfig
create mode 100644 drivers/hwpf/Makefile
diff --git a/MAINTAINERS b/MAINTAINERS
index f26920f0f..29ad0e613 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1588,6 +1588,13 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc.git
F: arch/arm/mach-*/
F: arch/arm/plat-*/
+HARDWARE PREFETCH DRIVERS
+M: Kohei Tarumizu <tarumizu.kohei@xxxxxxxxxxx>
+L: linux-arm-kernel@xxxxxxxxxxxxxxxxxxx (moderated for non-subscribers)
+S: Maintained
+F: drivers/hwpf/
+F: include/linux/hwpf.h
+
ARM/ACTIONS SEMI ARCHITECTURE
M: Andreas Färber <afaerber@xxxxxxx>
M: Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxx>
diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms
index b0ce18d4c..8ecbcd0b7 100644
--- a/arch/arm64/Kconfig.platforms
+++ b/arch/arm64/Kconfig.platforms
@@ -20,6 +20,12 @@ config ARCH_SUNXI
help
This enables support for Allwinner sunxi based SoCs like the A64.
+config ARCH_A64FX
+ bool "Fujitsu A64FX Platforms"
+ select ARCH_HAS_HARDWARE_PREFETCH
+ help
+ This enables support for Fujitsu A64FX SoC family.
+
config ARCH_ALPINE
bool "Annapurna Labs Alpine platform"
select ALPINE_MSI if PCI
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index d9830e7e1..d60ec8eb7 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1356,6 +1356,18 @@ config X86_CPUID
with major 203 and minors 0 to 31 for /dev/cpu/0/cpuid to
/dev/cpu/31/cpuid.
+config INTEL_HARDWARE_PREFETCH
+ tristate "Intel Hardware Prefetch support"
+ select ARCH_HAS_HARDWARE_PREFETCH
+ select HARDWARE_PREFETCH
+ depends on X86_64
+ help
+ This option enables a Hardware Prefetch sysfs interface.
+ This requires an Intel processor that has MSR about Hardware Prefetch.
+
+ See Documentation/ABI/testing/sysfs-devices-system-cpu for more
+ information.
+
choice
prompt "High Memory Support"
default HIGHMEM4G
diff --git a/drivers/Kconfig b/drivers/Kconfig
index 0d399ddaa..c46702569 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -236,4 +236,6 @@ source "drivers/interconnect/Kconfig"
source "drivers/counter/Kconfig"
source "drivers/most/Kconfig"
+
+source "drivers/hwpf/Kconfig"
endmenu
diff --git a/drivers/Makefile b/drivers/Makefile
index be5d40ae1..8cb2e42f6 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -188,3 +188,4 @@ obj-$(CONFIG_GNSS) += gnss/
obj-$(CONFIG_INTERCONNECT) += interconnect/
obj-$(CONFIG_COUNTER) += counter/
obj-$(CONFIG_MOST) += most/
+obj-$(CONFIG_HARDWARE_PREFETCH) += hwpf/
diff --git a/drivers/hwpf/Kconfig b/drivers/hwpf/Kconfig
new file mode 100644
index 000000000..e011fa6e0
--- /dev/null
+++ b/drivers/hwpf/Kconfig
@@ -0,0 +1,24 @@
+config ARCH_HAS_HARDWARE_PREFETCH
+ bool
+
+menuconfig HARDWARE_PREFETCH
+ bool "Hardware Prefetch Control"
+ depends on ARCH_HAS_HARDWARE_PREFETCH
+ default y
+ help
+ Hardware Prefetch Control Driver
+
+ This driver allows you to control the Hardware Prefetch mechanism.
+ If the hardware supports the mechanism, it provides a sysfs interface
+ for changing the feature's enablement, prefetch distance and strongness.
+
+if HARDWARE_PREFETCH
+
+config A64FX_HARDWARE_PREFETCH
+ tristate "A64FX Hardware Prefetch support"
+ depends on ARCH_A64FX
+ default m
+ help
+ This adds Hardware Prefetch driver support for A64FX SOCs.
+
+endif
diff --git a/drivers/hwpf/Makefile b/drivers/hwpf/Makefile
new file mode 100644
index 000000000..6790eb2d2
--- /dev/null
+++ b/drivers/hwpf/Makefile
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: GPL-2.0
+# Hardware prefetch core driver
+obj-$(CONFIG_HARDWARE_PREFETCH) += hwpf.o
+
+# FUJITSU SoC driver
+obj-$(CONFIG_A64FX_HARDWARE_PREFETCH) += fujitsu_hwpf.o
+
+# Intel SoC driver
+obj-$(CONFIG_INTEL_HARDWARE_PREFETCH) += intel_hwpf.o
--
2.27.0