On 8/28/2026 10:54 AM, Yonggang Luo wrote:
> can we use both? first is the enum,  then the is_available handler.
>

I don't think it would be good, as we would duplicate information.
I'll send a v3 of current series to implement an alternative (see v2
latest message from Richard).

>          此致
> 礼
> 罗勇刚
> Yours
>     sincerely,
> Yonggang Luo
> 
> Pierrick Bouvier <[email protected]
> <mailto:[email protected]>> 于 2026年8月29日周六 01:10写道:
> 
>     On 8/28/2026 2:51 AM, Yonggang Luo wrote:
>     >
>     >
>     > On Fri, Jul 24, 2026 at 8:11 AM Pierrick Bouvier
>     > <[email protected]
>     <mailto:[email protected]>
>     > <mailto:[email protected]
>     <mailto:[email protected]>>> wrote:
>     >>
>     >> Now that we can link a single-binary with at least two targets (arm,
>     > aarch64),
>     >> we want to make sure that we expose the same set of machines (later
>     > devices and
>     >> cpus) than target binaries. For that, we implemented a static
>     > filtering based on
>     >> target interfaces that each machine will implement to declare which
>     > targets have
>     >> this machine.
>     >>
>     >> However, we discovered that this static filtering is not enough.
>     > Indeed, some
>     >> machines and devices do not depend only on target, and their presence
>     > can depend
>     >> on Kconfig or host/target combination. Thus, our static approach
>     can't
>     > work, and
>     >> we need something more flexible.
>     >>
>     >> This series adds a new TYPE_TARGET_SPECIFIC, that declare a single
>     > function
>     >> bool is_available(void). From there, any machine type (and later
>     > devices and
>     >> cpus) can implement it to override their presence for each target.
>     >> We first replace the existing static mechanism with this, and once
>     > done, we
>     >> cleanup all the old interface. One nice benefit is that we can
>     get rid of
>     >> config/targets/*.c files, which saves duplication.
>     >
>     >
>     >   About target-filtering, we already have 
>     >
>     > enum {
>     >     QEMU_ARCH_ALPHA =       (1UL << SYS_EMU_TARGET_ALPHA),
>     >     QEMU_ARCH_ARM =         (1UL << SYS_EMU_TARGET_ARM) |
>     >                             (1UL << SYS_EMU_TARGET_AARCH64),
>     >     QEMU_ARCH_I386 =        (1UL << SYS_EMU_TARGET_I386) |
>     >                             (1UL << SYS_EMU_TARGET_X86_64),
>     >     QEMU_ARCH_M68K =        (1UL << SYS_EMU_TARGET_M68K),
>     >     QEMU_ARCH_MICROBLAZE =  (1UL << SYS_EMU_TARGET_MICROBLAZE),
>     >     QEMU_ARCH_MIPS =        (1UL << SYS_EMU_TARGET_MIPS) |
>     >                             (1UL << SYS_EMU_TARGET_MIPSEL) |
>     >                             (1UL << SYS_EMU_TARGET_MIPS64) |
>     >                             (1UL << SYS_EMU_TARGET_MIPS64EL),
>     >     QEMU_ARCH_PPC =         (1UL << SYS_EMU_TARGET_PPC) |
>     >                             (1UL << SYS_EMU_TARGET_PPC64),
>     >     QEMU_ARCH_S390X =       (1UL << SYS_EMU_TARGET_S390X),
>     >     QEMU_ARCH_SH4 =         (1UL << SYS_EMU_TARGET_SH4) |
>     >                             (1UL << SYS_EMU_TARGET_SH4EB),
>     >     QEMU_ARCH_SPARC =       (1UL << SYS_EMU_TARGET_SPARC) |
>     >                             (1UL << SYS_EMU_TARGET_SPARC64),
>     >     QEMU_ARCH_XTENSA =      (1UL << SYS_EMU_TARGET_XTENSA) |
>     >                             (1UL << SYS_EMU_TARGET_XTENSAEB),
>     >     QEMU_ARCH_OR1K =        (1UL << SYS_EMU_TARGET_OR1K),
>     >     QEMU_ARCH_TRICORE =     (1UL << SYS_EMU_TARGET_TRICORE),
>     >     QEMU_ARCH_HPPA =        (1UL << SYS_EMU_TARGET_HPPA),
>     >     QEMU_ARCH_RISCV =       (1UL << SYS_EMU_TARGET_RISCV32) |
>     >                             (1UL << SYS_EMU_TARGET_RISCV64),
>     >     QEMU_ARCH_RX =          (1UL << SYS_EMU_TARGET_RX),
>     >     QEMU_ARCH_AVR =         (1UL << SYS_EMU_TARGET_AVR),
>     >     QEMU_ARCH_HEXAGON =     (1UL << SYS_EMU_TARGET_HEXAGON),
>     >     QEMU_ARCH_LOONGARCH =   (1UL << SYS_EMU_TARGET_LOONGARCH64),
>     >     QEMU_ARCH_ALL =         UINT32_MAX,
>     > };
>     >
>     > Can we use this to do target filtering instead? And we can extend this
>     > to maximal uint128_t to support maximal 128 targets in future, so it's
>     > not a burden to use it as a enum
>     >
>     > and for arm or mips we can use QEMU_ARCH_ARM QEMU_ARCH_MIPS  to
>     support
>     > multiple targets in a single integer.
>     >
> 
>     It's not enough, as some types depend on target config, and not only on
>     target itself. That's why this series exist, because I wrongly assumed
>     target would be enough when designing the original filtering, and it
>     proved to be insufficient.
> 
>     Concrete examples here are x-remote and nitro machines.
> 
>     >
>     >
>     > --
>     >          此致
>     > 礼
>     > 罗勇刚
>     > Yours
>     >     sincerely,
>     > Yonggang Luo
> 


Reply via email to