Message ID | 20200618123342.10693-5-philmd@redhat.com |
---|---|
State | New |
Headers | show |
Series | accel: Allow targets to use Kconfig | expand |
On 6/18/20 2:33 PM, Philippe Mathieu-Daudé wrote: > From: Alex Bennée <alex.bennee@linaro.org> > > As we encode the base architecture in configure.sh, we can emit > the base-arch() function into config-host.mak. > > Signed-off-by: Alex Bennée <alex.bennee@linaro.org> I'm not sure it is implicit by the S-o-b tag following, so: Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> > Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> > --- > configure | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) > > diff --git a/configure b/configure > index ba88fd1824..c0d7fbc30e 100755 > --- a/configure > +++ b/configure > @@ -7927,6 +7927,8 @@ if test "$linux" = "yes" ; then > fi > fi > > +target_to_base_map="" > + > for target in $target_list; do > target_dir="$target" > config_target_mak=$target_dir/config-target.mak > @@ -8155,6 +8157,7 @@ target_arch_name="$(upper $TARGET_ARCH)" > echo "TARGET_$target_arch_name=y" >> $config_target_mak > echo "TARGET_NAME=$target_name" >> $config_target_mak > echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak > +target_to_base_map="$target_dir,$TARGET_BASE_ARCH $target_to_base_map" > if [ "$TARGET_ABI_DIR" = "" ]; then > TARGET_ABI_DIR=$TARGET_ARCH > fi > @@ -8370,6 +8373,22 @@ if test "$ccache_cpp2" = "yes"; then > echo "export CCACHE_CPP2=y" >> $config_host_mak > fi > > +# Export a rule for calculating base arch from target_dir for use by > +# the Kconfig generator > +echo "# Usage: \$(call base-arch, target-dir)" >> $config_host_mak > +echo "# Return the base architecture for a target." >> $config_host_mak > +echo "# e.g \$(call base-arch, aarch64-linux-user) returns 'arm'" >> $config_host_mak > +echo "base-arch = \$(strip \\" >> $config_host_mak > +close_braces="" > +for pairs in $target_to_base_map > +do > + dir="${pairs%%,*}" > + base="${pairs#*,}" > + echo "\$(if \$(findstring $dir,\$1),$base, \\" >> $config_host_mak > + close_braces="$close_braces )" > +done > +echo "$close_braces )" >> $config_host_mak > + > # If we're using a separate build tree, set it up now. > # DIRS are directories which we simply mkdir in the build tree; > # LINKS are things to symlink back into the source tree >
Hi Philippe, Alex, On 6/18/20 2:33 PM, Philippe Mathieu-Daudé wrote: > From: Alex Bennée <alex.bennee@linaro.org> > > As we encode the base architecture in configure.sh, we can emit > the base-arch() function into config-host.mak. > > Signed-off-by: Alex Bennée <alex.bennee@linaro.org> > Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> I found this change a bit strange, but maybe I am missing some context. Would it not be easier to read the information from the config-target.mak files as it is already emitted there? Ciao, Claudio > --- > configure | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) > > diff --git a/configure b/configure > index ba88fd1824..c0d7fbc30e 100755 > --- a/configure > +++ b/configure > @@ -7927,6 +7927,8 @@ if test "$linux" = "yes" ; then > fi > fi > > +target_to_base_map="" > + > for target in $target_list; do > target_dir="$target" > config_target_mak=$target_dir/config-target.mak > @@ -8155,6 +8157,7 @@ target_arch_name="$(upper $TARGET_ARCH)" > echo "TARGET_$target_arch_name=y" >> $config_target_mak > echo "TARGET_NAME=$target_name" >> $config_target_mak > echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak > +target_to_base_map="$target_dir,$TARGET_BASE_ARCH $target_to_base_map" > if [ "$TARGET_ABI_DIR" = "" ]; then > TARGET_ABI_DIR=$TARGET_ARCH > fi > @@ -8370,6 +8373,22 @@ if test "$ccache_cpp2" = "yes"; then > echo "export CCACHE_CPP2=y" >> $config_host_mak > fi > > +# Export a rule for calculating base arch from target_dir for use by > +# the Kconfig generator > +echo "# Usage: \$(call base-arch, target-dir)" >> $config_host_mak > +echo "# Return the base architecture for a target." >> $config_host_mak > +echo "# e.g \$(call base-arch, aarch64-linux-user) returns 'arm'" >> $config_host_mak > +echo "base-arch = \$(strip \\" >> $config_host_mak > +close_braces="" > +for pairs in $target_to_base_map > +do > + dir="${pairs%%,*}" > + base="${pairs#*,}" > + echo "\$(if \$(findstring $dir,\$1),$base, \\" >> $config_host_mak > + close_braces="$close_braces )" > +done > +echo "$close_braces )" >> $config_host_mak > + > # If we're using a separate build tree, set it up now. > # DIRS are directories which we simply mkdir in the build tree; > # LINKS are things to symlink back into the source tree >
On 6/23/20 10:01 AM, Claudio Fontana wrote: > Hi Philippe, Alex, > > On 6/18/20 2:33 PM, Philippe Mathieu-Daudé wrote: >> From: Alex Bennée <alex.bennee@linaro.org> >> >> As we encode the base architecture in configure.sh, we can emit >> the base-arch() function into config-host.mak. >> >> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> >> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> > > I found this change a bit strange, but maybe I am missing some context. This is used in patch 9: "Makefile: Allow target-specific optional Kconfig" https://www.mail-archive.com/qemu-devel@nongnu.org/msg713823.html > > Would it not be easier to read the information from the > config-target.mak files as it is already emitted there? So you are suggesting moving the SUBDIR_DEVICES_MAK creation code to Makefile.target, before until now it is target-agnostic but we are making it target-specific. Yes, it could work... I keep respining this series since the semihosting rework. Frankly I don't remember why it became so complicated, I need to jump into the code again. I guess when Paolo introduced Kconfig, the accelerator configs were almost static, so SUBDIR_DEVICES_MAK was only dependent of host config. The semihosting "device" depends of accelerator and target configs. Maybe the problem is to see minikconf generating device selectors, as kconfig is also used for generic features (such accelerator, not really "device"). > > Ciao, > > Claudio > > >> --- >> configure | 19 +++++++++++++++++++ >> 1 file changed, 19 insertions(+) >> >> diff --git a/configure b/configure >> index ba88fd1824..c0d7fbc30e 100755 >> --- a/configure >> +++ b/configure >> @@ -7927,6 +7927,8 @@ if test "$linux" = "yes" ; then >> fi >> fi >> >> +target_to_base_map="" >> + >> for target in $target_list; do >> target_dir="$target" >> config_target_mak=$target_dir/config-target.mak >> @@ -8155,6 +8157,7 @@ target_arch_name="$(upper $TARGET_ARCH)" >> echo "TARGET_$target_arch_name=y" >> $config_target_mak >> echo "TARGET_NAME=$target_name" >> $config_target_mak >> echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak >> +target_to_base_map="$target_dir,$TARGET_BASE_ARCH $target_to_base_map" >> if [ "$TARGET_ABI_DIR" = "" ]; then >> TARGET_ABI_DIR=$TARGET_ARCH >> fi >> @@ -8370,6 +8373,22 @@ if test "$ccache_cpp2" = "yes"; then >> echo "export CCACHE_CPP2=y" >> $config_host_mak >> fi >> >> +# Export a rule for calculating base arch from target_dir for use by >> +# the Kconfig generator >> +echo "# Usage: \$(call base-arch, target-dir)" >> $config_host_mak >> +echo "# Return the base architecture for a target." >> $config_host_mak >> +echo "# e.g \$(call base-arch, aarch64-linux-user) returns 'arm'" >> $config_host_mak >> +echo "base-arch = \$(strip \\" >> $config_host_mak >> +close_braces="" >> +for pairs in $target_to_base_map >> +do >> + dir="${pairs%%,*}" >> + base="${pairs#*,}" >> + echo "\$(if \$(findstring $dir,\$1),$base, \\" >> $config_host_mak >> + close_braces="$close_braces )" >> +done >> +echo "$close_braces )" >> $config_host_mak >> + >> # If we're using a separate build tree, set it up now. >> # DIRS are directories which we simply mkdir in the build tree; >> # LINKS are things to symlink back into the source tree >> >
On 6/23/20 10:45 AM, Philippe Mathieu-Daudé wrote: > On 6/23/20 10:01 AM, Claudio Fontana wrote: >> Hi Philippe, Alex, >> >> On 6/18/20 2:33 PM, Philippe Mathieu-Daudé wrote: >>> From: Alex Bennée <alex.bennee@linaro.org> >>> >>> As we encode the base architecture in configure.sh, we can emit >>> the base-arch() function into config-host.mak. >>> >>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> >>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> >> >> I found this change a bit strange, but maybe I am missing some context. > > This is used in patch 9: > "Makefile: Allow target-specific optional Kconfig" > https://www.mail-archive.com/qemu-devel@nongnu.org/msg713823.html > >> >> Would it not be easier to read the information from the >> config-target.mak files as it is already emitted there? > > So you are suggesting moving the SUBDIR_DEVICES_MAK creation code > to Makefile.target, before until now it is target-agnostic but we > are making it target-specific. Yes, it could work... > > I keep respining this series since the semihosting rework. Frankly > I don't remember why it became so complicated, I need to jump into > the code again. > > I guess when Paolo introduced Kconfig, the accelerator configs were > almost static, so SUBDIR_DEVICES_MAK was only dependent of host > config. > > The semihosting "device" depends of accelerator and target configs. > > Maybe the problem is to see minikconf generating device selectors, > as kconfig is also used for generic features (such accelerator, > not really "device"). This might be solved easily using Meson... Maybe better wait for it? > >> >>> --- >>> configure | 19 +++++++++++++++++++ >>> 1 file changed, 19 insertions(+) >>> >>> diff --git a/configure b/configure >>> index ba88fd1824..c0d7fbc30e 100755 >>> --- a/configure >>> +++ b/configure >>> @@ -7927,6 +7927,8 @@ if test "$linux" = "yes" ; then >>> fi >>> fi >>> >>> +target_to_base_map="" >>> + >>> for target in $target_list; do >>> target_dir="$target" >>> config_target_mak=$target_dir/config-target.mak >>> @@ -8155,6 +8157,7 @@ target_arch_name="$(upper $TARGET_ARCH)" >>> echo "TARGET_$target_arch_name=y" >> $config_target_mak >>> echo "TARGET_NAME=$target_name" >> $config_target_mak >>> echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak >>> +target_to_base_map="$target_dir,$TARGET_BASE_ARCH $target_to_base_map" >>> if [ "$TARGET_ABI_DIR" = "" ]; then >>> TARGET_ABI_DIR=$TARGET_ARCH >>> fi >>> @@ -8370,6 +8373,22 @@ if test "$ccache_cpp2" = "yes"; then >>> echo "export CCACHE_CPP2=y" >> $config_host_mak >>> fi >>> >>> +# Export a rule for calculating base arch from target_dir for use by >>> +# the Kconfig generator >>> +echo "# Usage: \$(call base-arch, target-dir)" >> $config_host_mak >>> +echo "# Return the base architecture for a target." >> $config_host_mak >>> +echo "# e.g \$(call base-arch, aarch64-linux-user) returns 'arm'" >> $config_host_mak >>> +echo "base-arch = \$(strip \\" >> $config_host_mak >>> +close_braces="" >>> +for pairs in $target_to_base_map >>> +do >>> + dir="${pairs%%,*}" >>> + base="${pairs#*,}" >>> + echo "\$(if \$(findstring $dir,\$1),$base, \\" >> $config_host_mak >>> + close_braces="$close_braces )" >>> +done >>> +echo "$close_braces )" >> $config_host_mak >>> + >>> # If we're using a separate build tree, set it up now. >>> # DIRS are directories which we simply mkdir in the build tree; >>> # LINKS are things to symlink back into the source tree >>> >> >
On 6/23/20 3:17 PM, Philippe Mathieu-Daudé wrote: > On 6/23/20 10:45 AM, Philippe Mathieu-Daudé wrote: >> On 6/23/20 10:01 AM, Claudio Fontana wrote: >>> Hi Philippe, Alex, >>> >>> On 6/18/20 2:33 PM, Philippe Mathieu-Daudé wrote: >>>> From: Alex Bennée <alex.bennee@linaro.org> >>>> >>>> As we encode the base architecture in configure.sh, we can emit >>>> the base-arch() function into config-host.mak. >>>> >>>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> >>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> >>> >>> I found this change a bit strange, but maybe I am missing some context. >> >> This is used in patch 9: >> "Makefile: Allow target-specific optional Kconfig" >> https://www.mail-archive.com/qemu-devel@nongnu.org/msg713823.html >> >>> >>> Would it not be easier to read the information from the >>> config-target.mak files as it is already emitted there? >> >> So you are suggesting moving the SUBDIR_DEVICES_MAK creation code >> to Makefile.target, before until now it is target-agnostic but we >> are making it target-specific. Yes, it could work... >> >> I keep respining this series since the semihosting rework. Frankly >> I don't remember why it became so complicated, I need to jump into >> the code again. >> >> I guess when Paolo introduced Kconfig, the accelerator configs were >> almost static, so SUBDIR_DEVICES_MAK was only dependent of host >> config. >> >> The semihosting "device" depends of accelerator and target configs. >> >> Maybe the problem is to see minikconf generating device selectors, >> as kconfig is also used for generic features (such accelerator, >> not really "device"). I think you are right, some of the features are not devices. Maybe another variable could hold the target-specific features, getting the input from the target makefile? hmm... > > This might be solved easily using Meson... Maybe better wait for it? Not sure about this one, should be possible to solve with makefiles also, but I didn't try; I'll try to set things up to get a better understanding. Ciao, Claudio > >> >>> >>>> --- >>>> configure | 19 +++++++++++++++++++ >>>> 1 file changed, 19 insertions(+) >>>> >>>> diff --git a/configure b/configure >>>> index ba88fd1824..c0d7fbc30e 100755 >>>> --- a/configure >>>> +++ b/configure >>>> @@ -7927,6 +7927,8 @@ if test "$linux" = "yes" ; then >>>> fi >>>> fi >>>> >>>> +target_to_base_map="" >>>> + >>>> for target in $target_list; do >>>> target_dir="$target" >>>> config_target_mak=$target_dir/config-target.mak >>>> @@ -8155,6 +8157,7 @@ target_arch_name="$(upper $TARGET_ARCH)" >>>> echo "TARGET_$target_arch_name=y" >> $config_target_mak >>>> echo "TARGET_NAME=$target_name" >> $config_target_mak >>>> echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak >>>> +target_to_base_map="$target_dir,$TARGET_BASE_ARCH $target_to_base_map" >>>> if [ "$TARGET_ABI_DIR" = "" ]; then >>>> TARGET_ABI_DIR=$TARGET_ARCH >>>> fi >>>> @@ -8370,6 +8373,22 @@ if test "$ccache_cpp2" = "yes"; then >>>> echo "export CCACHE_CPP2=y" >> $config_host_mak >>>> fi >>>> >>>> +# Export a rule for calculating base arch from target_dir for use by >>>> +# the Kconfig generator >>>> +echo "# Usage: \$(call base-arch, target-dir)" >> $config_host_mak >>>> +echo "# Return the base architecture for a target." >> $config_host_mak >>>> +echo "# e.g \$(call base-arch, aarch64-linux-user) returns 'arm'" >> $config_host_mak >>>> +echo "base-arch = \$(strip \\" >> $config_host_mak >>>> +close_braces="" >>>> +for pairs in $target_to_base_map >>>> +do >>>> + dir="${pairs%%,*}" >>>> + base="${pairs#*,}" >>>> + echo "\$(if \$(findstring $dir,\$1),$base, \\" >> $config_host_mak >>>> + close_braces="$close_braces )" >>>> +done >>>> +echo "$close_braces )" >> $config_host_mak >>>> + >>>> # If we're using a separate build tree, set it up now. >>>> # DIRS are directories which we simply mkdir in the build tree; >>>> # LINKS are things to symlink back into the source tree >>>> >>> >> >
diff --git a/configure b/configure index ba88fd1824..c0d7fbc30e 100755 --- a/configure +++ b/configure @@ -7927,6 +7927,8 @@ if test "$linux" = "yes" ; then fi fi +target_to_base_map="" + for target in $target_list; do target_dir="$target" config_target_mak=$target_dir/config-target.mak @@ -8155,6 +8157,7 @@ target_arch_name="$(upper $TARGET_ARCH)" echo "TARGET_$target_arch_name=y" >> $config_target_mak echo "TARGET_NAME=$target_name" >> $config_target_mak echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak +target_to_base_map="$target_dir,$TARGET_BASE_ARCH $target_to_base_map" if [ "$TARGET_ABI_DIR" = "" ]; then TARGET_ABI_DIR=$TARGET_ARCH fi @@ -8370,6 +8373,22 @@ if test "$ccache_cpp2" = "yes"; then echo "export CCACHE_CPP2=y" >> $config_host_mak fi +# Export a rule for calculating base arch from target_dir for use by +# the Kconfig generator +echo "# Usage: \$(call base-arch, target-dir)" >> $config_host_mak +echo "# Return the base architecture for a target." >> $config_host_mak +echo "# e.g \$(call base-arch, aarch64-linux-user) returns 'arm'" >> $config_host_mak +echo "base-arch = \$(strip \\" >> $config_host_mak +close_braces="" +for pairs in $target_to_base_map +do + dir="${pairs%%,*}" + base="${pairs#*,}" + echo "\$(if \$(findstring $dir,\$1),$base, \\" >> $config_host_mak + close_braces="$close_braces )" +done +echo "$close_braces )" >> $config_host_mak + # If we're using a separate build tree, set it up now. # DIRS are directories which we simply mkdir in the build tree; # LINKS are things to symlink back into the source tree