Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp694304pxb; Tue, 5 Apr 2022 19:05:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzihsF2Sx1/q6Pv0bDzn0k7Z4t7RYJx5Dhdy0UT4wlBm1zdqXLAHyl/gaNHYkOKPBf2gPcM X-Received: by 2002:a17:902:9887:b0:151:6e1c:7082 with SMTP id s7-20020a170902988700b001516e1c7082mr6271918plp.162.1649210591794; Tue, 05 Apr 2022 19:03:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649210591; cv=none; d=google.com; s=arc-20160816; b=rc9jKyHYPp4C3PVk441mHNSxTFOGzMz0Y9xU3HwQtpGr9XaExHYNAjarBi6C6h6teo HMDYvjN8knMPNWYjiJwJ3UTV80Btk56H1/JkUAqFaezCu9MJ6JrN/J5EJwoUdZJUCFaq cguAHNWTkUudhCslsNJ8Xkj6jToqxDCFKuWfhv4kd0pPjUBRhRDSfXoInxUQZyGlENzs OMSIgHhcGUFjC4mjA/BPECleS0dvfmRHZbBMAGWeRtpyz3dScxPu3U2YgeupuDrwIEho kyFWYgG2xdy1MYiCCAUhjfgko3FUSxbq2+2dpgXdVxuPTpjrsszKJc+0qdOMrl2TppUj rkaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RYKn33NSQhubeqvUDbC64imPUT0y0QpFWVd9VJGTHyg=; b=igsPErr9itGudPawJVukszgAHdDLWLHeGcV4Oh7p9SSEWYUpubmuKUAat8oak9KJ8V mLWc1eIT3avqscYA7c91/R9ipiev4bGMc0dNLDrVWDqUuZXZAL4lnPqa2C0MVK5+pYQ/ bYJ14SVhe9Pw9P+mv2hFxJV0IZDx3bt0rjTh8HEXY1P3V4cIAOSHEOQQ5KSg0BhcBRD6 iWFz8usTPq+r1fgVeoaHTihtNgkDXKNMx9ydqfri+YNL0Ba3Bq2/QciGtTI2pomwmZkA 6CMuqR6k2ALK6NOA8MrV9DmYS6U12XWaN6MbHUXxjJjM8wR3mu7gsLdPo3SEkJGfq4js uRgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CyYKOOKk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b24-20020a6567d8000000b003816043ee30si15040375pgs.37.2022.04.05.19.02.54; Tue, 05 Apr 2022 19:03:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CyYKOOKk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344687AbiDEKkH (ORCPT + 99 others); Tue, 5 Apr 2022 06:40:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237773AbiDEISV (ORCPT ); Tue, 5 Apr 2022 04:18:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48F076B51E; Tue, 5 Apr 2022 01:07:25 -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 ams.source.kernel.org (Postfix) with ESMTPS id 74CDAB81B18; Tue, 5 Apr 2022 08:07:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD3D3C385A0; Tue, 5 Apr 2022 08:07:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649146044; bh=ucmCANjRxqz3ymRl9tSEhzejQITlUJCx3JCjZlQx8PA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CyYKOOKkG7tgASDz84lkBeQIs0jXjIssd+1muRQKPB016NGktedYBH0I4ZChGKdQ3 MQTgIN0t2SIWAjdpi37HkKWvt9NC3jl9wI1ExUCzCDFRXPDE6UDK/QAnW78L5tdCnh Yw5PL1kZ2v2X9XNFoCOxWmGvJ6l0o9Xhl231znxI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Ellerman , Sasha Levin Subject: [PATCH 5.17 0621/1126] powerpc/Makefile: Dont pass -mcpu=powerpc64 when building 32-bit Date: Tue, 5 Apr 2022 09:22:48 +0200 Message-Id: <20220405070425.863287573@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070407.513532867@linuxfoundation.org> References: <20220405070407.513532867@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michael Ellerman [ Upstream commit 2863dd2db23e0407f6c50b8ba5c0e55abef894f1 ] When CONFIG_GENERIC_CPU=y (true for all our defconfigs) we pass -mcpu=powerpc64 to the compiler, even when we're building a 32-bit kernel. This happens because we have an ifdef CONFIG_PPC_BOOK3S_64/else block in the Makefile that was written before 32-bit supported GENERIC_CPU. Prior to that the else block only applied to 64-bit Book3E. The GCC man page says -mcpu=powerpc64 "[specifies] a pure ... 64-bit big endian PowerPC ... architecture machine [type], with an appropriate, generic processor model assumed for scheduling purposes." It's unclear how that interacts with -m32, which we are also passing, although obviously -m32 is taking precedence in some sense, as the 32-bit kernel only contains 32-bit instructions. This was noticed by inspection, not via any bug reports, but it does affect code generation. Comparing before/after code generation, there are some changes to instruction scheduling, and the after case (with -mcpu=powerpc64 removed) the compiler seems more keen to use r8. Fix it by making the else case only apply to Book3E 64, which excludes 32-bit. Fixes: 0e00a8c9fd92 ("powerpc: Allow CPU selection also on PPC32") Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220215112858.304779-1-mpe@ellerman.id.au Signed-off-by: Sasha Levin --- arch/powerpc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile index 5f16ac1583c5..887efa31f60a 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile @@ -171,7 +171,7 @@ else CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power7,$(call cc-option,-mtune=power5)) CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mcpu=power5,-mcpu=power4) endif -else +else ifdef CONFIG_PPC_BOOK3E_64 CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=powerpc64 endif -- 2.34.1