Received: by 2002:a19:f614:0:0:0:0:0 with SMTP id x20csp56393lfe; Fri, 15 Apr 2022 19:16:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRzlaVWwsivEynCR+egsVxdY493y0wUAge9THfSvyZzk+qyooXKjXJVt09Z1bXNmP/zw0Z X-Received: by 2002:a05:6a00:814:b0:505:9fad:4252 with SMTP id m20-20020a056a00081400b005059fad4252mr1830405pfk.54.1650075417768; Fri, 15 Apr 2022 19:16:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650075417; cv=none; d=google.com; s=arc-20160816; b=lwQPcAqDqkSV9hFcb94BR6XpemTSbU7DSGUD64QMX8CR/zF6YvChaIcKjyOUvPas/u 9pO5V6mNWyDcaiZvwdBj88fLZ2VUtRUx01uvsMxH2/BQL2Qd/meFndTYGD0fSvlLLkTe zfu8c9TiuFmEAjQmiwqMcw/EcN3kkS4FpYmBHQHFhu1HuVIDsHBUjZpQFW/S8hqvDYhX tENHbvQVvURA4p8RFjuz2p14A/rATPDYusvYS3Mzk/RLEPo1e84VLbUrBB/9sc+7Weus 9sVQQbVcOM3Y1gOvbx/kTCFAubIikdAq3UvRxZFVpRx2PuzoQHUbTxUw9DG2rcIaYamI 5OYg== 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=QaKn0dZLos8B9a4E5TK4m9/P6ppwz5VOu2dg9wvE15A=; b=qyTZfx93iiYTJBBFvbI1jitw2dTMtHLmeWY6tiaYexyJtOdDqLfkwVdrZyQrTfgamJ YUHV2bOr5HkqomVU5WpnVbbu0j2BpoMBVAi2IFjuQlgtmVu0hjCA9oQFOrkqj0yR3Vps EauC2o+yiX91niQGfyrijyxLOVgVWxAw5sFJthpNeWCSTiiNWO8IivYD3hO2G3kY62y8 g3NNMNMYKOhRzvGXSLSTVyKrf7xcKcy2j/GfTM8/nE6OVwfi8h7XUNzxDihmWzq/lmDu 8VoSA8Qi/8LH+qtqsxAaz2yHsIFiSpR5kc1t4bHmAc2bnkahYfxTbyqJizaWQunjG3h6 UiEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nEbPtih9; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id m11-20020a170902f64b00b00153b2d1649dsi2807000plg.165.2022.04.15.19.16.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 19:16:57 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nEbPtih9; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 894EC21FC51; Fri, 15 Apr 2022 18:32:35 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244696AbiDNNqC (ORCPT + 99 others); Thu, 14 Apr 2022 09:46:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343568AbiDNN3h (ORCPT ); Thu, 14 Apr 2022 09:29:37 -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 1ADC3939B9; Thu, 14 Apr 2022 06:24:41 -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 AB46260C14; Thu, 14 Apr 2022 13:24:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF218C385A1; Thu, 14 Apr 2022 13:24:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649942680; bh=PpkgBRZ/wUWFEO+eFhFoU+2vbu24ZrSNp069ndb+tcs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nEbPtih9w8+Q5UzlLibjA+Ssu+Pa3yakejrKkQKlrCfbPSpegyoyPtNtcAvFTm3di +Pa4DXDCwvJnpLfUMjP7LZbEH44xaRDxsvHyfC3ZJ1GZg4QXKLwzy2BDlieWVI9fir gqtUgjRLGzrFS4FXH24MHNZ0w8lcSX/ThLw3xEPU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Anders Roxell , Segher Boessenkool , Michael Ellerman Subject: [PATCH 4.19 222/338] powerpc: Fix build errors with newer binutils Date: Thu, 14 Apr 2022 15:12:05 +0200 Message-Id: <20220414110845.212281132@linuxfoundation.org> X-Mailer: git-send-email 2.35.2 In-Reply-To: <20220414110838.883074566@linuxfoundation.org> References: <20220414110838.883074566@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=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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: Anders Roxell commit 8667d0d64dd1f84fd41b5897fd87fa9113ae05e3 upstream. Building tinyconfig with gcc (Debian 11.2.0-16) and assembler (Debian 2.37.90.20220207) the following build error shows up: {standard input}: Assembler messages: {standard input}:1190: Error: unrecognized opcode: `stbcix' {standard input}:1433: Error: unrecognized opcode: `lwzcix' {standard input}:1453: Error: unrecognized opcode: `stbcix' {standard input}:1460: Error: unrecognized opcode: `stwcix' {standard input}:1596: Error: unrecognized opcode: `stbcix' ... Rework to add assembler directives [1] around the instruction. Going through them one by one shows that the changes should be safe. Like __get_user_atomic_128_aligned() is only called in p9_hmi_special_emu(), which according to the name is specific to power9. And __raw_rm_read*() are only called in things that are powernv or book3s_hv specific. [1] https://sourceware.org/binutils/docs/as/PowerPC_002dPseudo.html#PowerPC_002dPseudo Cc: stable@vger.kernel.org Co-developed-by: Arnd Bergmann Signed-off-by: Arnd Bergmann Signed-off-by: Anders Roxell Reviewed-by: Segher Boessenkool [mpe: Make commit subject more descriptive] Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220224162215.3406642-2-anders.roxell@linaro.org Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/include/asm/io.h | 40 ++++++++++++++++++++++++++++------- arch/powerpc/include/asm/uaccess.h | 3 ++ arch/powerpc/platforms/powernv/rng.c | 6 ++++- 3 files changed, 40 insertions(+), 9 deletions(-) --- a/arch/powerpc/include/asm/io.h +++ b/arch/powerpc/include/asm/io.h @@ -372,25 +372,37 @@ static inline void __raw_writeq_be(unsig */ static inline void __raw_rm_writeb(u8 val, volatile void __iomem *paddr) { - __asm__ __volatile__("stbcix %0,0,%1" + __asm__ __volatile__(".machine push; \ + .machine power6; \ + stbcix %0,0,%1; \ + .machine pop;" : : "r" (val), "r" (paddr) : "memory"); } static inline void __raw_rm_writew(u16 val, volatile void __iomem *paddr) { - __asm__ __volatile__("sthcix %0,0,%1" + __asm__ __volatile__(".machine push; \ + .machine power6; \ + sthcix %0,0,%1; \ + .machine pop;" : : "r" (val), "r" (paddr) : "memory"); } static inline void __raw_rm_writel(u32 val, volatile void __iomem *paddr) { - __asm__ __volatile__("stwcix %0,0,%1" + __asm__ __volatile__(".machine push; \ + .machine power6; \ + stwcix %0,0,%1; \ + .machine pop;" : : "r" (val), "r" (paddr) : "memory"); } static inline void __raw_rm_writeq(u64 val, volatile void __iomem *paddr) { - __asm__ __volatile__("stdcix %0,0,%1" + __asm__ __volatile__(".machine push; \ + .machine power6; \ + stdcix %0,0,%1; \ + .machine pop;" : : "r" (val), "r" (paddr) : "memory"); } @@ -402,7 +414,10 @@ static inline void __raw_rm_writeq_be(u6 static inline u8 __raw_rm_readb(volatile void __iomem *paddr) { u8 ret; - __asm__ __volatile__("lbzcix %0,0, %1" + __asm__ __volatile__(".machine push; \ + .machine power6; \ + lbzcix %0,0, %1; \ + .machine pop;" : "=r" (ret) : "r" (paddr) : "memory"); return ret; } @@ -410,7 +425,10 @@ static inline u8 __raw_rm_readb(volatile static inline u16 __raw_rm_readw(volatile void __iomem *paddr) { u16 ret; - __asm__ __volatile__("lhzcix %0,0, %1" + __asm__ __volatile__(".machine push; \ + .machine power6; \ + lhzcix %0,0, %1; \ + .machine pop;" : "=r" (ret) : "r" (paddr) : "memory"); return ret; } @@ -418,7 +436,10 @@ static inline u16 __raw_rm_readw(volatil static inline u32 __raw_rm_readl(volatile void __iomem *paddr) { u32 ret; - __asm__ __volatile__("lwzcix %0,0, %1" + __asm__ __volatile__(".machine push; \ + .machine power6; \ + lwzcix %0,0, %1; \ + .machine pop;" : "=r" (ret) : "r" (paddr) : "memory"); return ret; } @@ -426,7 +447,10 @@ static inline u32 __raw_rm_readl(volatil static inline u64 __raw_rm_readq(volatile void __iomem *paddr) { u64 ret; - __asm__ __volatile__("ldcix %0,0, %1" + __asm__ __volatile__(".machine push; \ + .machine power6; \ + ldcix %0,0, %1; \ + .machine pop;" : "=r" (ret) : "r" (paddr) : "memory"); return ret; } --- a/arch/powerpc/include/asm/uaccess.h +++ b/arch/powerpc/include/asm/uaccess.h @@ -217,8 +217,11 @@ extern long __get_user_bad(void); */ #define __get_user_atomic_128_aligned(kaddr, uaddr, err) \ __asm__ __volatile__( \ + ".machine push\n" \ + ".machine altivec\n" \ "1: lvx 0,0,%1 # get user\n" \ " stvx 0,0,%2 # put kernel\n" \ + ".machine pop\n" \ "2:\n" \ ".section .fixup,\"ax\"\n" \ "3: li %0,%3\n" \ --- a/arch/powerpc/platforms/powernv/rng.c +++ b/arch/powerpc/platforms/powernv/rng.c @@ -47,7 +47,11 @@ static unsigned long rng_whiten(struct p unsigned long parity; /* Calculate the parity of the value */ - asm ("popcntd %0,%1" : "=r" (parity) : "r" (val)); + asm (".machine push; \ + .machine power7; \ + popcntd %0,%1; \ + .machine pop;" + : "=r" (parity) : "r" (val)); /* xor our value with the previous mask */ val ^= rng->mask;