diff mbox series

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

Message ID 20220224044947.980030-1-oupton@google.com (mailing list archive)
State New, archived
Headers show
Series [boot-wrapper] configure: Allow user to specify the counter frequency | expand

Commit Message

Oliver Upton Feb. 24, 2022, 4:49 a.m. UTC
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@google.com>
---
 Makefile.am  | 1 -
 configure.ac | 8 ++++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

Comments

Oliver Upton March 16, 2022, 4:56 a.m. UTC | #1
On Thu, Feb 24, 2022 at 04:49:47AM +0000, Oliver Upton wrote:
> 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@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
> 

Friendly ping :)
diff mbox series

Patch

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 ""