[U-Boot] [PATCH 2/4] x86: Ensure no instruction sets of MMX/SSE are generated in 64-bit build

Bin Meng bmeng.cn at gmail.com
Fri Oct 12 02:12:06 UTC 2018


Hi Heinrich,

On Fri, Oct 12, 2018 at 2:04 AM Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>
> On 10/11/2018 03:53 AM, Bin Meng wrote:
> > With the '-march=core2' fix, it seems that we have some luck that
> > the 64-bit U-Boot boots again. However if we examine the disassembly
> > codes there are still SSE instructions elsewhere which means passing
> > cpu type to GCC is not enough to prevent it from generating these
> > instructions. A simple test case is doing a 'bootefi selftest' from
> > the U-Boot shell and it leads to a reset too.
>
> I can confirm that an unexpected reset patch occurs without the patch.
>

I think you mean "bootefi selftest" reset, right?

> >
> > The 'bootefi selftest' reset is even seen with the image created by
> > the relative older GCC 5.4.0, the one shipped by Ubuntu 16.04.
> >
> > To make sure no MMX/SSE instruction sets are generated, tell GCC not
> > to do this. Note AVX is out of the question as CORE2 is old enough
> > to support AVX yet.
> >
> > Signed-off-by: Bin Meng <bmeng.cn at gmail.com>
> > ---
> >
> >  arch/x86/config.mk | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/arch/x86/config.mk b/arch/x86/config.mk
> > index 576501e..8151e47 100644
> > --- a/arch/x86/config.mk
> > +++ b/arch/x86/config.mk
> > @@ -24,6 +24,7 @@ ifeq ($(IS_32BIT),y)
> >  PLATFORM_CPPFLAGS += -march=i386 -m32
> >  else
> >  PLATFORM_CPPFLAGS += $(if $(CONFIG_SPL_BUILD),,-fpic) -fno-common -march=core2 -m64
> > +PLATFORM_CPPFLAGS += -mno-mmx -mno-sse
>
> According to https://wiki.osdev.org/SSE SSE has to be initialized.
> Otherwise SSE instructions lead to an undefined instruction exception.
> Is it this initialization that we lack? If this is your motivation
> please, state it in the commit message.
>

Yes, it's intentional. U-Boot as a bootloader does not want to handle
these advanced SIMD stuff.

> I think this patch could be squashed with the prior one.

They are different thing, although they solved similar reset. The
first patch is adding the -march=core2 which is the counterpart of
-march=i386 for 32-bit U-Boot. This patch is to disable MMX/SSE
completely which I think deserve a separate patch.

Regards,
Bin


More information about the U-Boot mailing list