Paolo Bonzini <[email protected]> writes:
> Il gio 4 mag 2023, 10:59 Peter Maydell <[email protected]> ha
> scritto:
>
>> On Thu, 4 May 2023 at 08:33, Paolo Bonzini <[email protected]> wrote:
>> >
>> > On 5/3/23 21:38, Fabiano Rosas wrote:
>> > > When building --without-default-devices, the semihosting code will not
>> > > be available, so check the proper config.
>>
>> I think the changes to the ifdeffery are conceptually
>> fine (only do semihosting if it was configured in), but
>> it sounds like there's a separate problem here.
>> Whether we need semihosting depends on the accelerator (ie
>> "is it TCG or not"), not on what set of devices we're building.
>> So the problem seems to me to be that --without-default-devices
>> is causing the semihosting code not to be built in.
>>
>> > Acked-by: Paolo Bonzini <[email protected]>
>> >
>> > for this change; however, there are two more related issues:
>> >
>> > 1) you still want to leave out the code if !TCG, because KVM is not able
>> > to exit to userspace on semihosting calls as far as I understand
>> >
>> > 2) I am not sure why CONFIG_ARM_COMPATIBLE_SEMIHOSTING=y appears in
>> > config/targets/{arm,riscv32,riscv64}-softmmu/default.mak.
>>
>> Because those are the architectures which have
>> "arm-compatible" semihosting ABIs ?
>>
>
> Yes but is there a reason to do it in configs/ where all the other symbols
> are boards, or was it just overlooked and a "default y" (as I suggested in
> the previous reply) or "imply" is better?
For arm it has been taken out of configs/ and moved into
target/arm/Kconfig:
...
# 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
So I guess we'd need a similar change to what you suggested for ARM_V7M:
config ARM
bool
select ARM_V7M if TCG
select ARM_COMPATIBLE_SEMIHOSTING if TCG