[boot-wrapper PATCH] configure: Allow user to specify the counter frequency

Oliver Upton oupton at google.com
Wed Feb 23 20:49:47 PST 2022


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.

Signed-off-by: Oliver Upton <oupton at google.com>
---
 Makefile.am  | 1 -
 configure.ac | 8 ++++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index 08e304a..c71c601 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -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)
diff --git a/configure.ac b/configure.ac
index 9e3b722..e7d086a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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 ""
-- 
2.35.1.473.g83b2b277ed-goog




More information about the linux-arm-kernel mailing list