On 10/21/2026 3:41 PM, Yonggang Luo wrote: > On Thu, Oct 22, 2026 at 6:02 AM Pierrick Bouvier > <[email protected]> wrote: >> >> On 10/21/2026 2:53 PM, Yonggang Luo wrote: >>> On Thu, Oct 22, 2026 at 2:14 AM Pierrick Bouvier >>> <[email protected]> wrote: >>>> >>>> For now, this function strictly returns false. We'll turn it to true >>>> once heterogeneous emulation in supported. Meanwhile, we can use this to >>>> add various checks and asserts over the codebase as reminders about what >>>> we'll need to modify. >>>> >>>> Reviewed-by: Marc-André Lureau <[email protected]> >>>> Reviewed-by: Anton Johansson <[email protected]> >>>> Suggested-by: Philippe Mathieu-Daudé <[email protected]> >>>> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> >>>> Signed-off-by: Pierrick Bouvier <[email protected]> >>>> --- >>>> include/qemu/target-info.h | 8 ++++++++ >>>> target-info.c | 6 ++++++ >>>> 2 files changed, 14 insertions(+) >>>> >>>> diff --git a/include/qemu/target-info.h b/include/qemu/target-info.h >>>> index 862097c6c63..923c00c917c 100644 >>>> --- a/include/qemu/target-info.h >>>> +++ b/include/qemu/target-info.h >>>> @@ -42,6 +42,14 @@ const char *target_cpu_type(void); >>>> */ >>>> bool target_big_endian(void); >>>> >>>> +/** >>>> + * target_heterogeneous: >>>> + * >>>> + * Returns true if current binary has support for running several target >>>> + * architectures at once (heterogeneous emulation). >>>> + */ >>>> +bool target_heterogeneous(void); >>>> + >>>> /** >>>> * target_base_arm: >>>> * >>>> diff --git a/target-info.c b/target-info.c >>>> index 254530d8ea5..b8a4a7ebf7a 100644 >>>> --- a/target-info.c >>>> +++ b/target-info.c >>>> @@ -42,6 +42,12 @@ bool target_big_endian(void) >>>> return target_endian_mode() == ENDIAN_MODE_BIG; >>>> } >>>> >>>> +bool target_heterogeneous(void) >>>> +{ >>>> + /* For now, we only run a single target at a time */ >>>> + return false; >>>> +} >>> >>> How about place this in stubs/target_heterogeneous.c >>> So when do multi-target tests, we can override it with >>> >>> bool target_heterogeneous(void) >>> { >>> /* For now, we only run a single target at a time */ >>> return true; >>> } >>> >> >> At the moment, even though multiple targets might be supported for the >> same binary, we still run only a single one at a time (same in >> single-binary), so this function will return false until this changes. >> >> Why would we want to override it today? > > Just for less changes in future, this does not mean this patch is not valid, > at least it gives an API that I can use later. > > I did something similar to get the single-binary qemu-system working. > And I named it as target_combined_binary(), I think they can act the > same function. > > https://lore.kernel.org/qemu-devel/[email protected]/ >
For now, I think we can keep the current patch, as there is no need (yet) to have conflicting symbols for target_heterogeneous. Thanks, Pierrick
