diff mbox series

[aarch64,boot-wrapper,6/6] configure: Autodetect GICv3

Message ID 20210510120726.5242-7-andre.przywara@arm.com (mailing list archive)
State New, archived
Headers show
Series Various (build system) fixes | expand

Commit Message

Andre Przywara May 10, 2021, 12:07 p.m. UTC
Currently the user has to specify the GIC architecture version (v2 or
v3) on the ./configure command line, even though this is actually
redundant information, since the DTB can carry only one GIC type.

Unconditionally query for the two GIC compatible strings in the provided
DTB, then choose the GIC type automatically depending on which string is
found.

This saves the user from specifying the GIC type on the configure
command line, and avoids errors when the wrong type was accidentally
named.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---
 Makefile.am  | 21 ++++++++-------------
 configure.ac |  8 --------
 2 files changed, 8 insertions(+), 21 deletions(-)
diff mbox series

Patch

diff --git a/Makefile.am b/Makefile.am
index b8c0a49..9b3c0ad 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -58,19 +58,14 @@  PSCI_NODE	:=
 CPU_NODES	:=
 endif
 
-if GICV3
-GIC_DIST_BASE	:= $(shell perl -I $(top_srcdir) $(top_srcdir)/findbase.pl $(KERNEL_DTB) 0 'arm,gic-v3')
-GIC_RDIST_BASE	:= $(shell perl -I $(top_srcdir) $(top_srcdir)/findbase.pl $(KERNEL_DTB) 1 'arm,gic-v3')
-DEFINES		+= -DGIC_DIST_BASE=$(GIC_DIST_BASE)
-DEFINES		+= -DGIC_RDIST_BASE=$(GIC_RDIST_BASE)
-GIC		:= gic-v3.o
-else
-GIC_DIST_BASE	:= $(shell perl -I $(top_srcdir) $(top_srcdir)/findbase.pl $(KERNEL_DTB) 0 'arm,cortex-a15-gic')
-GIC_CPU_BASE	:= $(shell perl -I $(top_srcdir) $(top_srcdir)/findbase.pl $(KERNEL_DTB) 1 'arm,cortex-a15-gic')
-DEFINES		+= -DGIC_CPU_BASE=$(GIC_CPU_BASE)
-DEFINES		+= -DGIC_DIST_BASE=$(GIC_DIST_BASE)
-GIC		:= gic.o
-endif
+GICV3_DIST_BASE	:= $(shell perl -I $(top_srcdir) $(top_srcdir)/findbase.pl $(KERNEL_DTB) 0 'arm,gic-v3' 2> /dev/null)
+GIC_RDIST_BASE	:= $(shell perl -I $(top_srcdir) $(top_srcdir)/findbase.pl $(KERNEL_DTB) 1 'arm,gic-v3' 2> /dev/null)
+GICV2_DIST_BASE	:= $(shell perl -I $(top_srcdir) $(top_srcdir)/findbase.pl $(KERNEL_DTB) 0 'arm,cortex-a15-gic' 2> /dev/null)
+GIC_CPU_BASE	:= $(shell perl -I $(top_srcdir) $(top_srcdir)/findbase.pl $(KERNEL_DTB) 1 'arm,cortex-a15-gic' 2> /dev/null)
+DEFINES		+= $(if $(GICV3_DIST_BASE), -DGIC_DIST_BASE=$(GICV3_DIST_BASE), -DGIC_DIST_BASE=$(GICV2_DIST_BASE))
+DEFINES		+= $(if $(GIC_RDIST_BASE), -DGIC_RDIST_BASE=$(GIC_RDIST_BASE), )
+DEFINES		+= $(if $(GIC_CPU_BASE), -DGIC_CPU_BASE=$(GIC_CPU_BASE), )
+GIC		:= $(if $(GICV3_DIST_BASE), gic-v3.o, gic.o)
 
 if KERNEL_32
 MBOX_OFFSET	:= 0x7ff8
diff --git a/configure.ac b/configure.ac
index 9e3b722..ed3e094 100644
--- a/configure.ac
+++ b/configure.ac
@@ -111,13 +111,6 @@  AC_ARG_WITH([xen-cmdline],
 	[X_CMDLINE=$withval])
 AC_SUBST([XEN_CMDLINE], [$X_CMDLINE])
 
-# Allow a user to pass --enable-gicv3
-AC_ARG_ENABLE([gicv3],
-	AS_HELP_STRING([--enable-gicv3], [enable GICv3 instead of GICv2]),
-	[USE_GICV3=$enableval])
-AM_CONDITIONAL([GICV3], [test "x$USE_GICV3" = "xyes"])
-AS_IF([test "x$USE_GICV3" = "xyes"], [], [USE_GICV3=no])
-
 # Ensure that we have all the needed programs
 AC_PROG_CC
 AC_PROG_CPP
@@ -144,7 +137,6 @@  echo "  Device tree blob:                  ${KERN_DTB}"
 echo "  Linux kernel command line:         ${CMDLINE}"
 echo "  Embedded initrd:                   ${FILESYSTEM:-NONE}"
 echo "  Use PSCI?                          ${USE_PSCI}"
-echo "  Use GICv3?                         ${USE_GICV3}"
 echo "  Boot-wrapper execution state:      AArch${BOOTWRAPPER_ES}"
 echo "  Kernel execution state:            AArch${KERNEL_ES}"
 echo "  Xen image                          ${XEN_IMAGE:-NONE}"