Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70D44C6FD1D for ; Tue, 14 Mar 2023 12:48:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232296AbjCNMsw (ORCPT ); Tue, 14 Mar 2023 08:48:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232300AbjCNMr6 (ORCPT ); Tue, 14 Mar 2023 08:47:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76F71A3368; Tue, 14 Mar 2023 05:45:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5B3D961772; Tue, 14 Mar 2023 12:43:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB2CCC4339E; Tue, 14 Mar 2023 12:43:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678797811; bh=buCx7DgLLXAZXSLEG++4s4YjHOZteRL7W9HfjOAGJsk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qJsgroaGddIJwbYi/duyk+8SpC2fiYur/T/VT/vfVg/K4Lp6vNxzmfazqskqfAs9z fdlbMcCQLJljn841ddvEwxoBzBMHulLHnejggq6qzMD9voyFyeGw8LKUgMzBRYFtzr 4QfqsfYNXWrRIHBFXs+nAQNz5diuRBOffGFeQSsBQNXHlyMojIKgvxPl+mEk6I5Uhm p9ebHB5GznhSN8kX2Kmz0QhO+8XCFf2lMK/0sEtpQvmuENZzObMbOVqr+8A33ZRYNf kLI+t+YA61X6TuwLX+zkBMC+0O8XE73CnPWS4JMGZvcmje1Czohuayfy21MqvRsD4Z ZY2BiXwDERMyg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: David Gow , =?UTF-8?q?Sergio=20Gonz=C3=A1lez=20Collado?= , Richard Weinberger , Sasha Levin , tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org Subject: [PATCH AUTOSEL 6.1 04/13] rust: arch/um: Disable FP/SIMD instruction to match x86 Date: Tue, 14 Mar 2023 08:43:16 -0400 Message-Id: <20230314124325.470931-4-sashal@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230314124325.470931-1-sashal@kernel.org> References: <20230314124325.470931-1-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: David Gow [ Upstream commit 8849818679478933dd1d9718741f4daa3f4e8b86 ] The kernel disables all SSE and similar FP/SIMD instructions on x86-based architectures (partly because we shouldn't be using floats in the kernel, and partly to avoid the need for stack alignment, see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53383 ) UML does not do the same thing, which isn't in itself a problem, but does add to the list of differences between UML and "normal" x86 builds. In addition, there was a crash bug with LLVM < 15 / rustc < 1.65 when building with SSE, so disabling it fixes rust builds with earlier compiler versions, see: https://github.com/Rust-for-Linux/linux/pull/881 Signed-off-by: David Gow Reviewed-by: Sergio González Collado Signed-off-by: Richard Weinberger Signed-off-by: Sasha Levin --- arch/x86/Makefile.um | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/x86/Makefile.um b/arch/x86/Makefile.um index b3c1ae084180d..d2e95d1d4db77 100644 --- a/arch/x86/Makefile.um +++ b/arch/x86/Makefile.um @@ -1,6 +1,12 @@ # SPDX-License-Identifier: GPL-2.0 core-y += arch/x86/crypto/ +# +# Disable SSE and other FP/SIMD instructions to match normal x86 +# +KBUILD_CFLAGS += -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx +KBUILD_RUSTFLAGS += -Ctarget-feature=-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-avx,-avx2 + ifeq ($(CONFIG_X86_32),y) START := 0x8048000 -- 2.39.2