All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/qemu: host-qemu does not support AVX512 CPUs
@ 2026-09-14  9:26 Yegor Yefremov via buildroot
  2026-09-16 18:57 ` Thomas Petazzoni via buildroot
  2026-09-25 14:44 ` Raphaël Mélotte via buildroot
  0 siblings, 2 replies; 5+ messages in thread
From: Yegor Yefremov via buildroot @ 2026-09-14  9:26 UTC (permalink / raw)
  To: buildroot; +Cc: Romain Naour

From: Yegor Yefremov <yegorslists@googlemail.com>

Building gobject-introspection for an x86 CPU variant with AVX512 fails
when g-ir-scanner runs the freshly built target binaries under
qemu-user:

  qemu: uncaught target signal 4 (Illegal instruction) - core dumped

The Qemu TCG engine implements AVX, AVX2, F16C, FMA3 and VAES since Qemu
7.2, but it does not implement the AVX512 instruction set at all [0].
Therefore no -cpu value passed through
BR2_PACKAGE_HOST_QEMU_USER_MODE_ARGS can make such binaries run, and
user-mode emulation is simply not possible for these CPU variants.

Mark those CPUs as unsupported by host-qemu, the same way it is already
done for x86_steamroller and x86_core_avx2. This relies on the existing
BR2_X86_CPU_HAS_AVX512 symbol, so all AVX512 capable variants are
covered, and it disables gobject-introspection and nodejs, which are the
two packages needing host-qemu in user mode.

[0] https://gitlab.com/qemu-project/qemu/-/issues/2878

Fixes:

  https://autobuild.buildroot.org/results/7ed7f9c36dae1ddb965a0f0021db6cd319927b47/

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Assisted-by: Claude:claude-opus-5
---
 package/qemu/Config.in.host | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/package/qemu/Config.in.host b/package/qemu/Config.in.host
index c7dd5876e5..e5379e7224 100644
--- a/package/qemu/Config.in.host
+++ b/package/qemu/Config.in.host
@@ -23,6 +23,10 @@ config BR2_PACKAGE_HOST_QEMU_ARCH_SUPPORTS
 	default y if BR2_xtensa
 	default y if BR2_x86_64
 	depends on !BR2_x86_steamroller && !BR2_x86_core_avx2
+	# The Qemu TCG engine does not implement the AVX512
+	# instruction set, so binaries built for such CPUs cannot be
+	# emulated.
+	depends on !BR2_X86_CPU_HAS_AVX512
 	depends on !BR2_powerpc_620 && !BR2_powerpc_630
 
 config BR2_PACKAGE_HOST_QEMU_SYSTEM_ARCH_SUPPORTS
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Buildroot] [PATCH] package/qemu: host-qemu does not support AVX512 CPUs
  2026-09-14  9:26 [Buildroot] [PATCH] package/qemu: host-qemu does not support AVX512 CPUs Yegor Yefremov via buildroot
@ 2026-09-16 18:57 ` Thomas Petazzoni via buildroot
  2026-09-17  6:56   ` Yegor Yefremov via buildroot
  2026-09-25 14:44 ` Raphaël Mélotte via buildroot
  1 sibling, 1 reply; 5+ messages in thread
From: Thomas Petazzoni via buildroot @ 2026-09-16 18:57 UTC (permalink / raw)
  To: Yegor Yefremov; +Cc: buildroot, Romain Naour

Hello,

Thanks for the patch!

On Mon, Sep 14, 2026 at 11:26:12AM +0200, Yegor Yefremov via buildroot wrote:
> From: Yegor Yefremov <yegorslists@googlemail.com>
> 
> Building gobject-introspection for an x86 CPU variant with AVX512 fails
> when g-ir-scanner runs the freshly built target binaries under
> qemu-user:
> 
>   qemu: uncaught target signal 4 (Illegal instruction) - core dumped
> 
> The Qemu TCG engine implements AVX, AVX2, F16C, FMA3 and VAES since Qemu
> 7.2, but it does not implement the AVX512 instruction set at all [0].
> Therefore no -cpu value passed through
> BR2_PACKAGE_HOST_QEMU_USER_MODE_ARGS can make such binaries run, and
> user-mode emulation is simply not possible for these CPU variants.
> 
> Mark those CPUs as unsupported by host-qemu, the same way it is already
> done for x86_steamroller and x86_core_avx2. This relies on the existing

Does our BR2_x86_core_avx2 exclusion still makes sense?

1. You're mentioning that the TCG engine implements AVX2, so why is
supporting x86_core_avx2 a problem?

2. According to arch/Config.in.x86, BR2_x86_core_avx2 is deprecated
and BR2_x86_haswell should be used instead, which I suppose means they
are equivalent. But we do exclude BR2_x86_core_avx2 but not
BR2_x86_haswell in BR2_PACKAGE_HOST_QEMU_ARCH_SUPPORTS, which doesn't
make much sense.

What do you think?

> BR2_X86_CPU_HAS_AVX512 symbol, so all AVX512 capable variants are
> covered, and it disables gobject-introspection and nodejs, which are the
> two packages needing host-qemu in user mode.
> 
> [0] https://gitlab.com/qemu-project/qemu/-/issues/2878
> 
> Fixes:
> 
>   https://autobuild.buildroot.org/results/7ed7f9c36dae1ddb965a0f0021db6cd319927b47/
> 
> Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
> Assisted-by: Claude:claude-opus-5

Nevertheless, your patch is good by itself, so I've applied it to
master. Thanks!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Buildroot] [PATCH] package/qemu: host-qemu does not support AVX512 CPUs
  2026-09-16 18:57 ` Thomas Petazzoni via buildroot
@ 2026-09-17  6:56   ` Yegor Yefremov via buildroot
  2026-09-17  7:26     ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 5+ messages in thread
From: Yegor Yefremov via buildroot @ 2026-09-17  6:56 UTC (permalink / raw)
  To: Thomas Petazzoni; +Cc: buildroot, Romain Naour

Hi Thomas,

On Wed, Sep 16, 2026 at 8:57 PM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> Hello,
>
> Thanks for the patch!
>
> On Mon, Sep 14, 2026 at 11:26:12AM +0200, Yegor Yefremov via buildroot wrote:
> > From: Yegor Yefremov <yegorslists@googlemail.com>
> >
> > Building gobject-introspection for an x86 CPU variant with AVX512 fails
> > when g-ir-scanner runs the freshly built target binaries under
> > qemu-user:
> >
> >   qemu: uncaught target signal 4 (Illegal instruction) - core dumped
> >
> > The Qemu TCG engine implements AVX, AVX2, F16C, FMA3 and VAES since Qemu
> > 7.2, but it does not implement the AVX512 instruction set at all [0].
> > Therefore no -cpu value passed through
> > BR2_PACKAGE_HOST_QEMU_USER_MODE_ARGS can make such binaries run, and
> > user-mode emulation is simply not possible for these CPU variants.
> >
> > Mark those CPUs as unsupported by host-qemu, the same way it is already
> > done for x86_steamroller and x86_core_avx2. This relies on the existing
>
> Does our BR2_x86_core_avx2 exclusion still makes sense?
>
> 1. You're mentioning that the TCG engine implements AVX2, so why is
> supporting x86_core_avx2 a problem?
>
> 2. According to arch/Config.in.x86, BR2_x86_core_avx2 is deprecated
> and BR2_x86_haswell should be used instead, which I suppose means they
> are equivalent. But we do exclude BR2_x86_core_avx2 but not
> BR2_x86_haswell in BR2_PACKAGE_HOST_QEMU_ARCH_SUPPORTS, which doesn't
> make much sense.
>
> What do you think?

 No, I don't think it does anymore, and I believe it can simply be dropped.

  1. The exclusion comes from commit 1f7efaf89f03 ("package/qemu: do not
  support x86_steamroller or x86_core_avx2", Feb 2020), i.e. from the Qemu
  4.2 era, when TCG had no AVX support at all. Since Qemu 7.2, TCG
  implements AVX, AVX2, F16C, FMA3 and VAES. In Qemu 11.0.0,
  target/i386/cpu.c:

    #define TCG_EXT_FEATURES (... | CPUID_EXT_AVX | CPUID_EXT_F16C | \
              CPUID_EXT_FMA | ...)
    #define TCG_7_0_EBX_FEATURES (... | CPUID_7_0_EBX_BMI1 | \
              CPUID_7_0_EBX_BMI2 | CPUID_7_0_EBX_AVX2 | ...)

  which covers everything -march=core-avx2 can generate.

  2. You are right that core-avx2 and haswell are equivalent: gcc's
  core-avx2 is a deprecated alias for haswell, and "gcc -march=core-avx2
  -Q --help=target" yields exactly the same feature bits as
  -march=haswell. In arch/Config.in.x86 both also select the very same
  BR2_X86_CPU_HAS_* symbols. So excluding one and not the other never
  made much sense. The same applies to broadwell, skylake, zen*,
  x86-64-v3, ..., which all enable AVX2 and were never excluded - and
  they do build fine on the autobuilders, which is another hint that
  AVX2 is not the problem.

  3. The steamroller exclusion, however, is still needed - but it is
  incomplete. steamroller is bdver3, and what TCG cannot emulate there is
  not AVX, but XOP/FMA4/TBM/LWP. Qemu 11.0.0 has:

    #define TCG_EXT3_FEATURES (CPUID_EXT3_LAHF_LM | CPUID_EXT3_SVM | \
              CPUID_EXT3_CR8LEG | CPUID_EXT3_ABM | CPUID_EXT3_SSE4A  | \
              CPUID_EXT3_3DNOWPREFETCH | CPUID_EXT3_KERNEL_FEATURES | \
              CPUID_EXT3_CMP_LEG)

  CPUID_EXT3_XOP, CPUID_EXT3_FMA4, CPUID_EXT3_TBM and CPUID_EXT3_LWP are
  defined in target/i386/cpu.h, but are deliberately not part of that
  mask.

  And the whole Bulldozer family is affected, not only steamroller
  (checked with gcc -march=<variant> -Q --help=target):

    bdver1 (bulldozer):   XOP, FMA4, LWP
    bdver2 (piledriver):  XOP, FMA4, TBM, LWP
    bdver3 (steamroller): XOP, FMA4, TBM, LWP
    bdver4 (excavator):   XOP, FMA4, TBM, LWP (and AVX2)

  So BR2_x86_bulldozer, BR2_x86_piledriver and BR2_x86_excavator ought to
  be excluded as well.

  If you agree, I'll send a follow-up patch that:

   - drops the !BR2_x86_core_avx2 dependency,
   - adds a hidden BR2_X86_CPU_HAS_XOP symbol in arch/Config.in.x86,
     selected by the four bdver variants, and replaces
     !BR2_x86_steamroller with !BR2_X86_CPU_HAS_XOP in
     BR2_PACKAGE_HOST_QEMU_ARCH_SUPPORTS - i.e. the same pattern as the
     existing BR2_X86_CPU_HAS_AVX512 dependency.

  If you'd rather not add a new BR2_X86_CPU_HAS_* symbol for a single
  user, I can just list the four variants explicitly instead.

Yegor

> > BR2_X86_CPU_HAS_AVX512 symbol, so all AVX512 capable variants are
> > covered, and it disables gobject-introspection and nodejs, which are the
> > two packages needing host-qemu in user mode.
> >
> > [0] https://gitlab.com/qemu-project/qemu/-/issues/2878
> >
> > Fixes:
> >
> >   https://autobuild.buildroot.org/results/7ed7f9c36dae1ddb965a0f0021db6cd319927b47/
> >
> > Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
> > Assisted-by: Claude:claude-opus-5
>
> Nevertheless, your patch is good by itself, so I've applied it to
> master. Thanks!
>
> Thomas
> --
> Thomas Petazzoni, co-owner and CEO, Bootlin
> Embedded Linux and Kernel engineering and training
> https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Buildroot] [PATCH] package/qemu: host-qemu does not support AVX512 CPUs
  2026-09-17  6:56   ` Yegor Yefremov via buildroot
@ 2026-09-17  7:26     ` Thomas Petazzoni via buildroot
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Petazzoni via buildroot @ 2026-09-17  7:26 UTC (permalink / raw)
  To: Yegor Yefremov; +Cc: buildroot, Romain Naour

Hello Yegor,

On Thu, Sep 17, 2026 at 08:56:46AM +0200, Yegor Yefremov wrote:

>  No, I don't think it does anymore, and I believe it can simply be dropped.
> 
>   1. The exclusion comes from commit 1f7efaf89f03 ("package/qemu: do not
>   support x86_steamroller or x86_core_avx2", Feb 2020), i.e. from the Qemu
>   4.2 era, when TCG had no AVX support at all. Since Qemu 7.2, TCG
>   implements AVX, AVX2, F16C, FMA3 and VAES. In Qemu 11.0.0,
>   target/i386/cpu.c:
> 
>     #define TCG_EXT_FEATURES (... | CPUID_EXT_AVX | CPUID_EXT_F16C | \
>               CPUID_EXT_FMA | ...)
>     #define TCG_7_0_EBX_FEATURES (... | CPUID_7_0_EBX_BMI1 | \
>               CPUID_7_0_EBX_BMI2 | CPUID_7_0_EBX_AVX2 | ...)
> 
>   which covers everything -march=core-avx2 can generate.

Cool!

>   2. You are right that core-avx2 and haswell are equivalent: gcc's
>   core-avx2 is a deprecated alias for haswell, and "gcc -march=core-avx2
>   -Q --help=target" yields exactly the same feature bits as

TIL about "gcc -march=core-avx2 -Q --help=target", nice!

>   -march=haswell. In arch/Config.in.x86 both also select the very same
>   BR2_X86_CPU_HAS_* symbols. So excluding one and not the other never
>   made much sense. The same applies to broadwell, skylake, zen*,
>   x86-64-v3, ..., which all enable AVX2 and were never excluded - and
>   they do build fine on the autobuilders, which is another hint that
>   AVX2 is not the problem.

ACK.

>   3. The steamroller exclusion, however, is still needed - but it is
>   incomplete. steamroller is bdver3, and what TCG cannot emulate there is
>   not AVX, but XOP/FMA4/TBM/LWP. Qemu 11.0.0 has:
> 
>     #define TCG_EXT3_FEATURES (CPUID_EXT3_LAHF_LM | CPUID_EXT3_SVM | \
>               CPUID_EXT3_CR8LEG | CPUID_EXT3_ABM | CPUID_EXT3_SSE4A  | \
>               CPUID_EXT3_3DNOWPREFETCH | CPUID_EXT3_KERNEL_FEATURES | \
>               CPUID_EXT3_CMP_LEG)
> 
>   CPUID_EXT3_XOP, CPUID_EXT3_FMA4, CPUID_EXT3_TBM and CPUID_EXT3_LWP are
>   defined in target/i386/cpu.h, but are deliberately not part of that
>   mask.
> 
>   And the whole Bulldozer family is affected, not only steamroller
>   (checked with gcc -march=<variant> -Q --help=target):
> 
>     bdver1 (bulldozer):   XOP, FMA4, LWP
>     bdver2 (piledriver):  XOP, FMA4, TBM, LWP
>     bdver3 (steamroller): XOP, FMA4, TBM, LWP
>     bdver4 (excavator):   XOP, FMA4, TBM, LWP (and AVX2)
> 
>   So BR2_x86_bulldozer, BR2_x86_piledriver and BR2_x86_excavator ought to
>   be excluded as well.
> 
>   If you agree, I'll send a follow-up patch that:
> 
>    - drops the !BR2_x86_core_avx2 dependency,
>    - adds a hidden BR2_X86_CPU_HAS_XOP symbol in arch/Config.in.x86,
>      selected by the four bdver variants, and replaces
>      !BR2_x86_steamroller with !BR2_X86_CPU_HAS_XOP in
>      BR2_PACKAGE_HOST_QEMU_ARCH_SUPPORTS - i.e. the same pattern as the
>      existing BR2_X86_CPU_HAS_AVX512 dependency.

This looks perfect!

>   If you'd rather not add a new BR2_X86_CPU_HAS_* symbol for a single
>   user, I can just list the four variants explicitly instead.

I think adding BR2_X86_CPU_HAS_XOP is better, even if it has a single
user. Indeed, it makes it explicit what is the feature that isn't
implemented by Qemu.

Thanks a lot for this very thorough answer!

Best regards,

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Buildroot] [PATCH] package/qemu: host-qemu does not support AVX512 CPUs
  2026-09-14  9:26 [Buildroot] [PATCH] package/qemu: host-qemu does not support AVX512 CPUs Yegor Yefremov via buildroot
  2026-09-16 18:57 ` Thomas Petazzoni via buildroot
@ 2026-09-25 14:44 ` Raphaël Mélotte via buildroot
  1 sibling, 0 replies; 5+ messages in thread
From: Raphaël Mélotte via buildroot @ 2026-09-25 14:44 UTC (permalink / raw)
  To: buildroot, Yegor Yefremov; +Cc: Raphaël Mélotte

In reply of:
> Building gobject-introspection for an x86 CPU variant with AVX512 fails
> when g-ir-scanner runs the freshly built target binaries under
> qemu-user:
> 
>   qemu: uncaught target signal 4 (Illegal instruction) - core dumped
> 
> The Qemu TCG engine implements AVX, AVX2, F16C, FMA3 and VAES since Qemu
> 7.2, but it does not implement the AVX512 instruction set at all [0].
> Therefore no -cpu value passed through
> BR2_PACKAGE_HOST_QEMU_USER_MODE_ARGS can make such binaries run, and
> user-mode emulation is simply not possible for these CPU variants.
> 
> Mark those CPUs as unsupported by host-qemu, the same way it is already
> done for x86_steamroller and x86_core_avx2. This relies on the existing
> BR2_X86_CPU_HAS_AVX512 symbol, so all AVX512 capable variants are
> covered, and it disables gobject-introspection and nodejs, which are the
> two packages needing host-qemu in user mode.
> 
> [0] https://gitlab.com/qemu-project/qemu/-/issues/2878
> 
> Fixes:
> 
>   https://autobuild.buildroot.org/results/7ed7f9c36dae1ddb965a0f0021db6cd319927b47/
> 
> Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
> Assisted-by: Claude:claude-opus-5

Applied to 2025.02.x, 2026.08.x. Thanks

> ---
>  package/qemu/Config.in.host | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/package/qemu/Config.in.host b/package/qemu/Config.in.host
> index c7dd5876e5..e5379e7224 100644
> --- a/package/qemu/Config.in.host
> +++ b/package/qemu/Config.in.host
> @@ -23,6 +23,10 @@ config BR2_PACKAGE_HOST_QEMU_ARCH_SUPPORTS
>  	default y if BR2_xtensa
>  	default y if BR2_x86_64
>  	depends on !BR2_x86_steamroller && !BR2_x86_core_avx2
> +	# The Qemu TCG engine does not implement the AVX512
> +	# instruction set, so binaries built for such CPUs cannot be
> +	# emulated.
> +	depends on !BR2_X86_CPU_HAS_AVX512
>  	depends on !BR2_powerpc_620 && !BR2_powerpc_630
>  
>  config BR2_PACKAGE_HOST_QEMU_SYSTEM_ARCH_SUPPORTS
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-09-25 14:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-14  9:26 [Buildroot] [PATCH] package/qemu: host-qemu does not support AVX512 CPUs Yegor Yefremov via buildroot
2026-09-16 18:57 ` Thomas Petazzoni via buildroot
2026-09-17  6:56   ` Yegor Yefremov via buildroot
2026-09-17  7:26     ` Thomas Petazzoni via buildroot
2026-09-25 14:44 ` Raphaël Mélotte via buildroot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.