[RFC PATCH v4 14/15] arm/Kconfig: Always select SEMIHOSTING when TCG is present

Fabiano Rosas posted 15 patches 3 years ago
There is a newer version of this series
[RFC PATCH v4 14/15] arm/Kconfig: Always select SEMIHOSTING when TCG is present
Posted by Fabiano Rosas 3 years ago
We are about to enable the build without TCG, so CONFIG_SEMIHOSTING
and CONFIG_ARM_COMPATIBLE_SEMIHOSTING cannot be unconditionally set in
default.mak anymore. So reflect the change in a Kconfig.

Instead of using semihosting/Kconfig, use a target-specific file, so
that the change doesn't affect other architectures which might
implement semihosting in a way compatible with KVM.

The selection from ARM_v7M needs to be removed to avoid a cycle during
parsing.

Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
The linux-user build does not use Kconfig. Is it worth it to add
support to it? There's just the semihosting config so far.
---
 configs/devices/arm-softmmu/default.mak | 2 --
 hw/arm/Kconfig                          | 1 -
 target/arm/Kconfig                      | 7 +++++++
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/configs/devices/arm-softmmu/default.mak b/configs/devices/arm-softmmu/default.mak
index 1b49a7830c..cb3e5aea65 100644
--- a/configs/devices/arm-softmmu/default.mak
+++ b/configs/devices/arm-softmmu/default.mak
@@ -40,6 +40,4 @@ CONFIG_MICROBIT=y
 CONFIG_FSL_IMX25=y
 CONFIG_FSL_IMX7=y
 CONFIG_FSL_IMX6UL=y
-CONFIG_SEMIHOSTING=y
-CONFIG_ARM_COMPATIBLE_SEMIHOSTING=y
 CONFIG_ALLWINNER_H3=y
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
index 19d6b9d95f..e0da8841db 100644
--- a/hw/arm/Kconfig
+++ b/hw/arm/Kconfig
@@ -316,7 +316,6 @@ config ARM_V7M
     # currently v7M must be included in a TCG build due to translate.c
     default y if TCG && (ARM || AARCH64)
     select PTIMER
-    select ARM_COMPATIBLE_SEMIHOSTING
 
 config ALLWINNER_A10
     bool
diff --git a/target/arm/Kconfig b/target/arm/Kconfig
index 3f3394a22b..39f05b6420 100644
--- a/target/arm/Kconfig
+++ b/target/arm/Kconfig
@@ -4,3 +4,10 @@ config ARM
 config AARCH64
     bool
     select ARM
+
+# This config exists just so we can make SEMIHOSTING default when TCG
+# is selected without also changing it for other architectures.
+config ARM_SEMIHOSTING
+    bool
+    default y if TCG && ARM
+    select ARM_COMPATIBLE_SEMIHOSTING
-- 
2.35.3
Re: [RFC PATCH v4 14/15] arm/Kconfig: Always select SEMIHOSTING when TCG is present
Posted by Richard Henderson 3 years ago
On 1/19/23 03:54, Fabiano Rosas wrote:
> We are about to enable the build without TCG, so CONFIG_SEMIHOSTING
> and CONFIG_ARM_COMPATIBLE_SEMIHOSTING cannot be unconditionally set in
> default.mak anymore. So reflect the change in a Kconfig.
> 
> Instead of using semihosting/Kconfig, use a target-specific file, so
> that the change doesn't affect other architectures which might
> implement semihosting in a way compatible with KVM.
> 
> The selection from ARM_v7M needs to be removed to avoid a cycle during
> parsing.
> 
> Signed-off-by: Fabiano Rosas<farosas@suse.de>

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

> The linux-user build does not use Kconfig. Is it worth it to add
> support to it? There's just the semihosting config so far.

Probably not.


r~
Re: [RFC PATCH v4 14/15] arm/Kconfig: Always select SEMIHOSTING when TCG is present
Posted by Philippe Mathieu-Daudé 3 years ago
On 19/1/23 19:50, Richard Henderson wrote:
> On 1/19/23 03:54, Fabiano Rosas wrote:
>> We are about to enable the build without TCG, so CONFIG_SEMIHOSTING
>> and CONFIG_ARM_COMPATIBLE_SEMIHOSTING cannot be unconditionally set in
>> default.mak anymore. So reflect the change in a Kconfig.
>>
>> Instead of using semihosting/Kconfig, use a target-specific file, so
>> that the change doesn't affect other architectures which might
>> implement semihosting in a way compatible with KVM.
>>
>> The selection from ARM_v7M needs to be removed to avoid a cycle during
>> parsing.
>>
>> Signed-off-by: Fabiano Rosas<farosas@suse.de>
> 
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> 
>> The linux-user build does not use Kconfig. Is it worth it to add
>> support to it? There's just the semihosting config so far.
> 
> Probably not.

I hit this limitation last week trying to restrict libdecnumber to
powerpc targets.

Fabiano, do you see how this can be done easily?
Re: [RFC PATCH v4 14/15] arm/Kconfig: Always select SEMIHOSTING when TCG is present
Posted by Fabiano Rosas 3 years ago
Philippe Mathieu-Daudé <philmd@linaro.org> writes:

> On 19/1/23 19:50, Richard Henderson wrote:
>> On 1/19/23 03:54, Fabiano Rosas wrote:
>>> We are about to enable the build without TCG, so CONFIG_SEMIHOSTING
>>> and CONFIG_ARM_COMPATIBLE_SEMIHOSTING cannot be unconditionally set in
>>> default.mak anymore. So reflect the change in a Kconfig.
>>>
>>> Instead of using semihosting/Kconfig, use a target-specific file, so
>>> that the change doesn't affect other architectures which might
>>> implement semihosting in a way compatible with KVM.
>>>
>>> The selection from ARM_v7M needs to be removed to avoid a cycle during
>>> parsing.
>>>
>>> Signed-off-by: Fabiano Rosas<farosas@suse.de>
>> 
>> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
>> 
>>> The linux-user build does not use Kconfig. Is it worth it to add
>>> support to it? There's just the semihosting config so far.
>> 
>> Probably not.
>
> I hit this limitation last week trying to restrict libdecnumber to
> powerpc targets.
>
> Fabiano, do you see how this can be done easily?

If you grep for Kconfig in the top level meson.build, that code there
could be adapted to also include linux-user targets.

I did some experimenting and I could generate linux-user.mak files with
all the configs from the existing Kconfigs. It would be a matter of
adding the proper CONFIG_SOFTMMU, CONFIG_LINUX_USER options to separate
the two and then hooking up the .mak files with the rest of the
build. That last part I'm not sure how to do.