Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1754020pxm; Thu, 24 Feb 2022 08:45:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJxroKxcP/CxJCKpgCJ/PPqSDus9Kbd/LxUKEPk32RyOa0XRCK0+TOdDQkvgjV9Dcl3KkKBy X-Received: by 2002:a17:902:bf06:b0:14d:8c72:96c6 with SMTP id bi6-20020a170902bf0600b0014d8c7296c6mr3693627plb.156.1645721125019; Thu, 24 Feb 2022 08:45:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645721125; cv=none; d=google.com; s=arc-20160816; b=VXrdzkSb/UwOoSALEq/wZO25oGiOr0lDjEFF6BxNZf6dK0iKsekamaefFZz4kROIgg FV+44DMWXN2x4jv4mnj685HuPSTL/l5l1y4cb4/kAzUKry+PWTaA3d112ScjutQ+QwBz hS6Cw5E2vX9ez5ZPu2NUGputUh1JqR71gJULOT1+LilQUObOV+PEOZwdFfo0QTofd+Fk kDG2t3yQvGSj93XnRFUWjqiCvpCDueIJtzTYqP4IZ6DQB/sg4W6R+aGE7u6TFHeexR8Q e/tyICis6OyT7V3RTullN0dET7Eol2I7Pa5nP7izriYIE7+rkI5OG6ZT0VrknqwCadcd MNSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=M6/DsYcMdCQ5Jv7h2HtppDAD63hulQRUnEll08wdM0w=; b=pi8IMlkz5RNp3gC+YByWAav/A6MXCU2KI2nS37cbCL0vEAEfvC4Gm7K+8PqWxt2/f4 1qaMa2ww3DFgTbk11xbbtg8XV7W3a22RTdRB+fnuhZQQM0QDUdgP8iFVALvxHGoKGA1r Rsm2ocbHyo18n5zexYQUmRqvdK0AmEk6boJviWxaRqemueioVw05FWnMQ5Qm+33H+Xnu xxayXd9fe2RsikF18LbrQw50OAhsN69q0sOSOq8UxPV84Krr2xzKP0XYrbHj4pS2CbUx EN2apRE61fyj27ca0jWn89vRFzrK3BLuFy5XpgJeWspOJYxtWweYfB4u+taQ9yWi+h4C 444A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MMxNIcwA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id 85si2803564pga.521.2022.02.24.08.45.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Feb 2022 08:45:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MMxNIcwA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A57DB1D06EB; Thu, 24 Feb 2022 08:24:40 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229520AbiBXQRo (ORCPT + 99 others); Thu, 24 Feb 2022 11:17:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229436AbiBXQRn (ORCPT ); Thu, 24 Feb 2022 11:17:43 -0500 Received: from mail-yb1-xb36.google.com (mail-yb1-xb36.google.com [IPv6:2607:f8b0:4864:20::b36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5339434B5 for ; Thu, 24 Feb 2022 08:17:05 -0800 (PST) Received: by mail-yb1-xb36.google.com with SMTP id d21so427281yba.11 for ; Thu, 24 Feb 2022 08:17:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=M6/DsYcMdCQ5Jv7h2HtppDAD63hulQRUnEll08wdM0w=; b=MMxNIcwAG1rEPw9GYtGcc1MbySE+4/aZhxOK9Arfa8JLcnH0cfZ64TEtJey0SODZ7C QBiByPS+i5aydu3vs8H0awLJPCpykYptJU2HmxOfIPQy8vs+fSr3SUJJNxd/KVNH/kNZ gjoFbkx/CDEUSFXXCM5T51pKHiPWXVwYVlaXGo94O4Cmtc1DR+BED9zBq+ATBB0gXAsU 9w8HCZaC1ZZAwHI9UCrFptnAwn1x1krO6meiyDfKd7+rSVqIb0MYvV2xW4o0BAq/KmF8 q69HHptkg51lHY1WR5Ir2y0+/4WIeubhQ74U4NMz+V9vB19oH7Z86WtRP9Ikzr/QZWt6 IMHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=M6/DsYcMdCQ5Jv7h2HtppDAD63hulQRUnEll08wdM0w=; b=l5YP1j2a4Wc3mrK9T9z2P7rC7TJS6+mba3bwaJpb0ymD8sGu9fg4Yq5f+hMKwzNhnC AfCIFTdouQkmtyGC1m9L2jNB8fGvM9ZYZaPYnDJwxwb8exCQt43WwkWA2ZV1ZP7eiOtD CRCyEFwNLXeC0STEn3/OU8KnA9S+R8hjnC5gQOD3zyLb5XbpwNz5OqtteR906eBHpoKs Y2Y7om1BGDLZEcUZ2ePRobtXcTZ9DByMEHbMC96izqhlxs+L+P+y6vIg8/9sUpUjTwXX 3Os0QXz4visYFWVpZTVyuDD+VozCzCFVijmz8JFH/+PRW5MruD63XcYEP2XGl80oTYUH j9Zg== X-Gm-Message-State: AOAM533M8o8Q4miZs2J8g+3il4chiA4noOPJjW2d8Ktkk4wGKOpGErD7 6L3OVdbxy3x2OuUso7KyqRGdxEzwmjPzHvn+teZNDg== X-Received: by 2002:a25:ad9b:0:b0:624:5db2:2084 with SMTP id z27-20020a25ad9b000000b006245db22084mr3073965ybi.132.1645719140249; Thu, 24 Feb 2022 08:12:20 -0800 (PST) MIME-Version: 1.0 References: <20220223135820.2252470-1-anders.roxell@linaro.org> <20220223135820.2252470-2-anders.roxell@linaro.org> <871qzsphfv.fsf@mpe.ellerman.id.au> In-Reply-To: <871qzsphfv.fsf@mpe.ellerman.id.au> From: Anders Roxell Date: Thu, 24 Feb 2022 17:12:09 +0100 Message-ID: Subject: Re: [PATCH 2/3] powerpc: fix build errors To: Michael Ellerman Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Arnd Bergmann Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,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 On Thu, 24 Feb 2022 at 13:39, Michael Ellerman wrote: > > Hi Anders, Hi Michael, > > Thanks for these, just a few comments below ... I will resolve the comments below and resend a v2 shortly. Cheers, Anders > > Anders Roxell writes: > > 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 the 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: > > Co-developed-by: Arnd Bergmann > > Signed-off-by: Arnd Bergmann > > Signed-off-by: Anders Roxell > > --- > > arch/powerpc/include/asm/io.h | 46 +++++++++++++++++++++++----- > > arch/powerpc/include/asm/uaccess.h | 3 ++ > > arch/powerpc/platforms/powernv/rng.c | 6 +++- > > 3 files changed, 46 insertions(+), 9 deletions(-) > > > > diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h > > index beba4979bff9..5ff6dec489f8 100644 > > --- a/arch/powerpc/include/asm/io.h > > +++ b/arch/powerpc/include/asm/io.h > > @@ -359,25 +359,37 @@ static inline void __raw_writeq_be(unsigned long v, volatile void __iomem *addr) > > */ > > static inline void __raw_rm_writeb(u8 val, volatile void __iomem *paddr) > > { > > - __asm__ __volatile__("stbcix %0,0,%1" > > + __asm__ __volatile__(".machine \"push\"\n" > > + ".machine \"power6\"\n" > > + "stbcix %0,0,%1\n" > > + ".machine \"pop\"\n" > > : : "r" (val), "r" (paddr) : "memory"); > > As Segher said it'd be cleaner without the embedded quotes. > > > @@ -441,7 +465,10 @@ static inline unsigned int name(unsigned int port) \ > > unsigned int x; \ > > __asm__ __volatile__( \ > > "sync\n" \ > > + ".machine \"push\"\n" \ > > + ".machine \"power6\"\n" \ > > "0:" op " %0,0,%1\n" \ > > + ".machine \"pop\"\n" \ > > "1: twi 0,%0,0\n" \ > > "2: isync\n" \ > > "3: nop\n" \ > > @@ -465,7 +492,10 @@ static inline void name(unsigned int val, unsigned int port) \ > > { \ > > __asm__ __volatile__( \ > > "sync\n" \ > > + ".machine \"push\"\n" \ > > + ".machine \"power6\"\n" \ > > "0:" op " %0,0,%1\n" \ > > + ".machine \"pop\"\n" \ > > "1: sync\n" \ > > "2:\n" \ > > EX_TABLE(0b, 2b) \ > > It's not visible from the diff, but the above two are __do_in_asm and > __do_out_asm and are inside an ifdef CONFIG_PPC32. > > AFAICS they're only used for: > > __do_in_asm(_rec_inb, "lbzx") > __do_in_asm(_rec_inw, "lhbrx") > __do_in_asm(_rec_inl, "lwbrx") > __do_out_asm(_rec_outb, "stbx") > __do_out_asm(_rec_outw, "sthbrx") > __do_out_asm(_rec_outl, "stwbrx") > > Which are all old instructions, so I don't think we need the machine > power6 for those two macros? > > > diff --git a/arch/powerpc/platforms/powernv/rng.c b/arch/powerpc/platforms/powernv/rng.c > > index b4386714494a..5bf30ef6d928 100644 > > --- a/arch/powerpc/platforms/powernv/rng.c > > +++ b/arch/powerpc/platforms/powernv/rng.c > > @@ -43,7 +43,11 @@ static unsigned long rng_whiten(struct powernv_rng *rng, unsigned long val) > > unsigned long parity; > > > > /* Calculate the parity of the value */ > > - asm ("popcntd %0,%1" : "=r" (parity) : "r" (val)); > > + asm (".machine \"push\"\n" > > + ".machine \"power7\"\n" > > + "popcntd %0,%1\n" > > + ".machine \"pop\"\n" > > + : "=r" (parity) : "r" (val)); > > This was actually present in an older CPU, but it doesn't really matter, > this is fine. > > cheers