From 20b579bac5a0b0177c7a40dc7520369dbb332efb Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 24 Dec 2022 23:28:19 -0500 Subject: [PATCH] sim: smp: make option available again At some point we want this to work, but it's not easy to test if the configure option isn't available. Restore it, but keep the default off. --- sim/Makefile.in | 1 + sim/aclocal.m4 | 1 + sim/config.h.in | 3 +++ sim/configure | 32 ++++++++++++++++++++++++++++++-- sim/configure.ac | 1 + sim/m4/sim_ac_option_smp.m4 | 18 ++++++++++++------ 6 files changed, 48 insertions(+), 8 deletions(-) diff --git a/sim/Makefile.in b/sim/Makefile.in index 7cd86b5b492..0693572987e 100644 --- a/sim/Makefile.in +++ b/sim/Makefile.in @@ -241,6 +241,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \ $(top_srcdir)/m4/sim_ac_option_profile.m4 \ $(top_srcdir)/m4/sim_ac_option_reserved_bits.m4 \ $(top_srcdir)/m4/sim_ac_option_scache.m4 \ + $(top_srcdir)/m4/sim_ac_option_smp.m4 \ $(top_srcdir)/m4/sim_ac_option_stdio.m4 \ $(top_srcdir)/m4/sim_ac_option_trace.m4 \ $(top_srcdir)/m4/sim_ac_option_warnings.m4 \ diff --git a/sim/aclocal.m4 b/sim/aclocal.m4 index f220c82af75..d7db9e46b58 100644 --- a/sim/aclocal.m4 +++ b/sim/aclocal.m4 @@ -1188,6 +1188,7 @@ m4_include([m4/sim_ac_option_inline.m4]) m4_include([m4/sim_ac_option_profile.m4]) m4_include([m4/sim_ac_option_reserved_bits.m4]) m4_include([m4/sim_ac_option_scache.m4]) +m4_include([m4/sim_ac_option_smp.m4]) m4_include([m4/sim_ac_option_stdio.m4]) m4_include([m4/sim_ac_option_trace.m4]) m4_include([m4/sim_ac_option_warnings.m4]) diff --git a/sim/config.h.in b/sim/config.h.in index 71f17fb926b..fc4f3988d5a 100644 --- a/sim/config.h.in +++ b/sim/config.h.in @@ -468,6 +468,9 @@ /* Sim cache szie */ #undef WITH_SCACHE +/* Sim SMP settings */ +#undef WITH_SMP + /* How to route I/O */ #undef WITH_STDIO diff --git a/sim/configure b/sim/configure index 3a57189d610..6329dfd6797 100755 --- a/sim/configure +++ b/sim/configure @@ -1004,6 +1004,7 @@ enable_sim_inline enable_sim_profile enable_sim_reserved_bits enable_sim_scache +enable_sim_smp enable_sim_stdio enable_sim_trace enable_werror @@ -1780,6 +1781,8 @@ Optional Features: instruction --enable-sim-scache=size Specify simulator execution cache size + --enable-sim-smp=n Specify number of processors to configure for + (default 1) --enable-sim-stdio Specify whether to use stdio for console input/output --enable-sim-trace=opts Enable tracing of simulated programs @@ -12442,7 +12445,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12445 "configure" +#line 12448 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12548,7 +12551,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12551 "configure" +#line 12554 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -16080,6 +16083,31 @@ _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: $sim_scache" >&5 $as_echo "$sim_scache" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking number of sim cpus to support" >&5 +$as_echo_n "checking number of sim cpus to support... " >&6; } +default_sim_smp="0" +sim_smp="$default_sim_smp" +# Check whether --enable-sim-smp was given. +if test "${enable_sim_smp+set}" = set; then : + enableval=$enable_sim_smp; case "${enableval}" in + yes) sim_smp="5";; + no) sim_smp="0";; + *) sim_smp="$enableval";; +esac +fi +sim_igen_smp="-N ${sim_smp}" +if test "x$sim_smp" = x0; then : + +else + +cat >>confdefs.h <<_ACEOF +#define WITH_SMP $sim_smp +_ACEOF + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $sim_smp" >&5 +$as_echo "$sim_smp" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sim stdio debug behavior" >&5 $as_echo_n "checking for sim stdio debug behavior... " >&6; } sim_stdio="0" diff --git a/sim/configure.ac b/sim/configure.ac index bfcd9e59d10..af7e6e752ca 100644 --- a/sim/configure.ac +++ b/sim/configure.ac @@ -180,6 +180,7 @@ SIM_AC_OPTION_INLINE SIM_AC_OPTION_PROFILE SIM_AC_OPTION_RESERVED_BITS SIM_AC_OPTION_SCACHE +SIM_AC_OPTION_SMP SIM_AC_OPTION_STDIO SIM_AC_OPTION_TRACE SIM_AC_OPTION_WARNINGS diff --git a/sim/m4/sim_ac_option_smp.m4 b/sim/m4/sim_ac_option_smp.m4 index b59d7e6e760..5c2b35f9d84 100644 --- a/sim/m4/sim_ac_option_smp.m4 +++ b/sim/m4/sim_ac_option_smp.m4 @@ -12,20 +12,26 @@ dnl GNU General Public License for more details. dnl dnl You should have received a copy of the GNU General Public License dnl along with this program. If not, see . -AC_DEFUN([SIM_AC_OPTION_SMP], -[ +AC_DEFUN([SIM_AC_OPTION_SMP], [dnl AC_MSG_CHECKING([number of sim cpus to support]) -default_sim_smp="ifelse([$1],,5,[$1])" -sim_smp="$default_sim_smp"" +dnl TODO: We should increase the default to use smp at some point. When we do, +dnl the ppc/configure sim-smp option should be merged. See the WITH_SMP check +dnl below for more cleanups too. +default_sim_smp="0" +sim_smp="$default_sim_smp" AC_ARG_ENABLE(sim-smp, [AS_HELP_STRING([--enable-sim-smp=n], - [Specify number of processors to configure for (default ${default_sim_smp})])], + [Specify number of processors to configure for (default 1)])], [case "${enableval}" in yes) sim_smp="5";; no) sim_smp="0";; *) sim_smp="$enableval";; esac])dnl sim_igen_smp="-N ${sim_smp}" -AC_DEFINE_UNQUOTED([WITH_SMP], [$sim_smp], [Sim SMP settings]) +dnl NB: The ppc code uses a diff default because its smp works. That is why +dnl we don't unconditionally enable WITH_SMP here. Once we unify ppc, we can +dnl make this unconditional. +AS_VAR_IF([sim_smp], [0], [], [dnl + AC_DEFINE_UNQUOTED([WITH_SMP], [$sim_smp], [Sim SMP settings])]) AC_MSG_RESULT($sim_smp) ]) -- 2.30.2