Skip to contentSkip to conversation

configure: Allow user to specify the counter frequency

PATCH In review Oliver Upton 1 participant 2 messages Feb 24, 2022 – Mar 16, 2022 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 configure: Allow user to specify the counter frequency

The default counter frequency on certain models is not actually 24MHz. For example, on the FVP Base RevC model, the default counter frequency is 100MHz, and is user configurable. Users testing against an ARMv8.6 counter (1GHz) also need to override the default value.

Add an optional configuration option which allows users to specify the counter frequency.

---
 Makefile.am  | 1 -
 configure.ac | 8 ++++++++
 2 files changed, 8 insertions(+), 1 deletion(-)
Makefile.am +0 -1
index 08e304a..c71c601 100644
@@ -13,7 +13,6 @@ SCRIPT_DIR	:= $(top_srcdir)/scripts
 PHYS_OFFSET	:= $(shell perl -I $(SCRIPT_DIR) $(SCRIPT_DIR)/findmem.pl $(KERNEL_DTB))
 UART_BASE	:= $(shell perl -I $(SCRIPT_DIR) $(SCRIPT_DIR)/findbase.pl $(KERNEL_DTB) 0 'arm,pl011')
 SYSREGS_BASE	:= $(shell perl -I $(SCRIPT_DIR) $(SCRIPT_DIR)/findbase.pl $(KERNEL_DTB) 0 'arm,vexpress-sysreg' 2> /dev/null)
-COUNTER_FREQ	:= 24000000
 
 CPU_IDS		:= $(shell perl -I $(SCRIPT_DIR) $(SCRIPT_DIR)/findcpuids.pl $(KERNEL_DTB))
 NR_CPUS         := $(shell echo $(CPU_IDS) | tr ',' ' ' | wc -w)
configure.ac +8 -0
index 9e3b722..e7d086a 100644
@@ -118,6 +118,13 @@ AC_ARG_ENABLE([gicv3],
 AM_CONDITIONAL([GICV3], [test "x$USE_GICV3" = "xyes"])
 AS_IF([test "x$USE_GICV3" = "xyes"], [], [USE_GICV3=no])
 
+# Allow a user to set the exposed counter frequency
+C_COUNTER_FREQ=24000000
+AC_ARG_WITH([counter-frequency],
+            AS_HELP_STRING([--with-counter-frequency], [set counter frequency (in Hz)]),
+            [C_COUNTER_FREQ=$withval])
+AC_SUBST([COUNTER_FREQ], [$C_COUNTER_FREQ])
+
 # Ensure that we have all the needed programs
 AC_PROG_CC
 AC_PROG_CPP
@@ -151,4 +158,5 @@ echo "  Xen image                          ${XEN_IMAGE:-NONE}"
 if test "x${XEN_IMAGE}" != "x"; then
 echo "  Xen command line:                  ${XEN_CMDLINE}"
 fi
+echo "  Counter frequency (Hz)             ${COUNTER_FREQ}"
 echo ""
Signature · 7 lines
2.35.1.473.g83b2b277ed-goog


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#1 lore raw
Quoted 53 lines · Oliver Upton

The default counter frequency on certain models is not actually 24MHz. For example, on the FVP Base RevC model, the default counter frequency is 100MHz, and is user configurable. Users testing against an ARMv8.6 counter (1GHz) also need to override the default value.

Add an optional configuration option which allows users to specify the counter frequency.

---
 Makefile.am  | 1 -
 configure.ac | 8 ++++++++
 2 files changed, 8 insertions(+), 1 deletion(-)
Makefile.am +0 -1
index 08e304a..c71c601 100644
@@ -13,7 +13,6 @@ SCRIPT_DIR	:= $(top_srcdir)/scripts
 PHYS_OFFSET	:= $(shell perl -I $(SCRIPT_DIR) $(SCRIPT_DIR)/findmem.pl $(KERNEL_DTB))
 UART_BASE	:= $(shell perl -I $(SCRIPT_DIR) $(SCRIPT_DIR)/findbase.pl $(KERNEL_DTB) 0 'arm,pl011')
 SYSREGS_BASE	:= $(shell perl -I $(SCRIPT_DIR) $(SCRIPT_DIR)/findbase.pl $(KERNEL_DTB) 0 'arm,vexpress-sysreg' 2> /dev/null)
-COUNTER_FREQ	:= 24000000
 
 CPU_IDS		:= $(shell perl -I $(SCRIPT_DIR) $(SCRIPT_DIR)/findcpuids.pl $(KERNEL_DTB))
 NR_CPUS         := $(shell echo $(CPU_IDS) | tr ',' ' ' | wc -w)
configure.ac +8 -0
index 9e3b722..e7d086a 100644
@@ -118,6 +118,13 @@ AC_ARG_ENABLE([gicv3],
 AM_CONDITIONAL([GICV3], [test "x$USE_GICV3" = "xyes"])
 AS_IF([test "x$USE_GICV3" = "xyes"], [], [USE_GICV3=no])
 
+# Allow a user to set the exposed counter frequency
+C_COUNTER_FREQ=24000000
+AC_ARG_WITH([counter-frequency],
+            AS_HELP_STRING([--with-counter-frequency], [set counter frequency (in Hz)]),
+            [C_COUNTER_FREQ=$withval])
+AC_SUBST([COUNTER_FREQ], [$C_COUNTER_FREQ])
+
 # Ensure that we have all the needed programs
 AC_PROG_CC
 AC_PROG_CPP
@@ -151,4 +158,5 @@ echo "  Xen image                          ${XEN_IMAGE:-NONE}"
 if test "x${XEN_IMAGE}" != "x"; then
 echo "  Xen command line:                  ${XEN_CMDLINE}"
 fi
+echo "  Counter frequency (Hz)             ${COUNTER_FREQ}"
 echo ""
Signature · 1 line
2.35.1.473.g83b2b277ed-goog

Friendly ping :)

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