From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9107C433DF for ; Thu, 27 Aug 2020 20:58:52 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 94CA320737 for ; Thu, 27 Aug 2020 20:58:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="kg4FZPE8"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="aJFr4QsY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 94CA320737 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=0bOP02z7HTVmsHQtQK2ZZ5KUvHwTHqFId1usx+y+cHA=; b=kg4FZPE80eWFSZW4z7pJwrCm/ sXdJDqnSVBtECAus68gPDE+cPVKuZ7ImjtBFp/3KsdGuAxlYOTTgYps2u8tUj4uaw3ECrErglk6Jh 6PWhYnuPyyPrOFl2IAZYCJgton1//7uRWcCoBeNG/qeMf5IXlJx/R0Pr5asOmO4/9G4meycvYxrkj OrGGIczluGjxAqhWHSASZGqe/3yVoaviwv3kTXkF4rt0eknuVIpMajPrkfN/NNnZIsgEB3hp/Z/zh /6A/TOTlFnnbeSmpOwaaTjFGAPRnQuaayauz39Z55aSYdA2ltxDyrquCF22wv40MRBGRqgeT6uZgA 05txvJEBg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kBOxf-0002Xn-9z; Thu, 27 Aug 2020 20:57:31 +0000 Received: from mail-qt1-x843.google.com ([2607:f8b0:4864:20::843]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kBOxc-0002X8-Qq for linux-arm-kernel@lists.infradead.org; Thu, 27 Aug 2020 20:57:29 +0000 Received: by mail-qt1-x843.google.com with SMTP id z2so1742065qtv.12 for ; Thu, 27 Aug 2020 13:57:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=rJfXwaHbG/yykBPHsUHYR3+FIiWYlEcAMtX9/Xzsg+c=; b=aJFr4QsYzFbEMiwLTBIQsnM40LGFQfg+Gsrddv3kW9ogalLiJfj1zhVV75Ea1aU27+ 0GkrmXRvvoPBpF2s/XdCoER+59/2L03CB92Xp+q88xt+wOYEV+cfQoqGsDHHc46KT526 1+q/24ycdtUW49/HRko61JwNbzO9DqJp7vmA0WAj0xjS4DN6xAYh3kdX+qwDXEzQ2807 GmiC6mImtFFMpbo02wdazfTD1BgEn4DMACnVJ1eyB+wukqEv5V2dCl6wYypDKb69PcZu x+7xppHOLWx1PGc2wTq6An1Vigr2HBqEdlUh+rBxWvIt8/RnG0gbt7kAkUgqGinwVHh6 K82g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=rJfXwaHbG/yykBPHsUHYR3+FIiWYlEcAMtX9/Xzsg+c=; b=TVGIxBB+yApuNS8P5n4SztIgQG58u8N0gBHu+SkW0nRzQMBGh6ohYM+jHzRO0GHY+F vPollRLlnjFpxe7hnTB34Aik+ewsuFBVy7qC/C+Yez8O3f6ReGU3e2lpxGIyTzMPPghx TUkmA5YHy1vNFkJ9siRfxfgTH4jIk++Xkbv+mqjPhz9rzxqa0JMOJa+Ygy6FZ+jbqSO0 6yGH+hjKTvn1GXTMWdPQba+eDLKQXxDASBNGPqdcuFaB8TxrZCQaigiHcHADpGdQ079l 4PgfWmHGsmQNsCcu3vMVa6Mc6tWmX6GXmWOrUO0gmozIG2/+ZGemq4QFbacJ12TVSg4U 9iXQ== X-Gm-Message-State: AOAM532d02HNjpkUuFctemBs1fHkKJlIy5qjVdbfA83sorhCFsME90nb vKoXYIFoyVWx40VV1j9rLF0= X-Google-Smtp-Source: ABdhPJyJH5wOx352swjJy+MwtjI8YzjEBzWve1uOF5Z5co/I2zyXjP77V8bsW0YRMtubd1vE4CU2iA== X-Received: by 2002:aed:35b2:: with SMTP id c47mr11445305qte.95.1598561843011; Thu, 27 Aug 2020 13:57:23 -0700 (PDT) Received: from ubuntu-n2-xlarge-x86 ([2604:1380:45d1:2600::1]) by smtp.gmail.com with ESMTPSA id r6sm2742617qtu.93.2020.08.27.13.57.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Aug 2020 13:57:22 -0700 (PDT) Date: Thu, 27 Aug 2020 13:57:20 -0700 From: Nathan Chancellor To: Sami Tolvanen Subject: Re: [PATCH v2] arm64: use a common .arch preamble for inline assembly Message-ID: <20200827205720.GA987541@ubuntu-n2-xlarge-x86> References: <20200805181920.4013059-1-samitolvanen@google.com> <20200827203608.1225689-1-samitolvanen@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200827203608.1225689-1-samitolvanen@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200827_165728_901262_4ED5A24E X-CRM114-Status: GOOD ( 27.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Kees Cook , Zhenyu Ye , Catalin Marinas , Nick Desaulniers , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Marc Zyngier , Will Deacon , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Aug 27, 2020 at 01:36:08PM -0700, Sami Tolvanen wrote: > Commit 7c78f67e9bd9 ("arm64: enable tlbi range instructions") breaks > LLVM's integrated assembler, because -Wa,-march is only passed to > external assemblers and therefore, the new instructions are not enabled > when IAS is used. > > This change adds a common architecture version preamble, which can be > used in inline assembly blocks that contain instructions that require > a newer architecture version, and uses it to fix __TLBI_0 and __TLBI_1 > with ARM64_TLB_RANGE. > > Fixes: 7c78f67e9bd9 ("arm64: enable tlbi range instructions") > Link: https://github.com/ClangBuiltLinux/linux/issues/1106 > Signed-off-by: Sami Tolvanen I have verified that this fixes the build with LLVM_IAS=1. Additionally, I have booted a kernel with this patch on my Raspberry Pi and saw no adverse affects through a compilation workload. Reviewed-by: Nathan Chancellor Tested-by: Nathan Chancellor > --- > Changes in v2: > - Switched to a standard preamble for the architecture version. > > --- > arch/arm64/Makefile | 11 ++++++++--- > arch/arm64/include/asm/compiler.h | 6 ++++++ > arch/arm64/include/asm/tlbflush.h | 6 ++++-- > 3 files changed, 18 insertions(+), 5 deletions(-) > > diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile > index b45f0124cc16..20ab5c9375a5 100644 > --- a/arch/arm64/Makefile > +++ b/arch/arm64/Makefile > @@ -82,8 +82,8 @@ endif > # compiler to generate them and consequently to break the single image contract > # we pass it only to the assembler. This option is utilized only in case of non > # integrated assemblers. > -ifneq ($(CONFIG_AS_HAS_ARMV8_4), y) > -branch-prot-flags-$(CONFIG_AS_HAS_PAC) += -Wa,-march=armv8.3-a > +ifeq ($(CONFIG_AS_HAS_PAC), y) > +asm-arch := armv8.3-a > endif > endif > > @@ -91,7 +91,12 @@ KBUILD_CFLAGS += $(branch-prot-flags-y) > > ifeq ($(CONFIG_AS_HAS_ARMV8_4), y) > # make sure to pass the newest target architecture to -march. > -KBUILD_CFLAGS += -Wa,-march=armv8.4-a > +asm-arch := armv8.4-a > +endif > + > +ifdef asm-arch > +KBUILD_CFLAGS += -Wa,-march=$(asm-arch) \ > + -DARM64_ASM_ARCH='"$(asm-arch)"' > endif > > ifeq ($(CONFIG_SHADOW_CALL_STACK), y) > diff --git a/arch/arm64/include/asm/compiler.h b/arch/arm64/include/asm/compiler.h > index 51a7ce87cdfe..6fb2e6bcc392 100644 > --- a/arch/arm64/include/asm/compiler.h > +++ b/arch/arm64/include/asm/compiler.h > @@ -2,6 +2,12 @@ > #ifndef __ASM_COMPILER_H > #define __ASM_COMPILER_H > > +#ifdef ARM64_ASM_ARCH > +#define ARM64_ASM_PREAMBLE ".arch " ARM64_ASM_ARCH "\n" > +#else > +#define ARM64_ASM_PREAMBLE > +#endif > + > /* > * The EL0/EL1 pointer bits used by a pointer authentication code. > * This is dependent on TBI0/TBI1 being enabled, or bits 63:56 would also apply. > diff --git a/arch/arm64/include/asm/tlbflush.h b/arch/arm64/include/asm/tlbflush.h > index d493174415db..cc3f5a33ff9c 100644 > --- a/arch/arm64/include/asm/tlbflush.h > +++ b/arch/arm64/include/asm/tlbflush.h > @@ -28,14 +28,16 @@ > * not. The macros handles invoking the asm with or without the > * register argument as appropriate. > */ > -#define __TLBI_0(op, arg) asm ("tlbi " #op "\n" \ > +#define __TLBI_0(op, arg) asm (ARM64_ASM_PREAMBLE \ > + "tlbi " #op "\n" \ > ALTERNATIVE("nop\n nop", \ > "dsb ish\n tlbi " #op, \ > ARM64_WORKAROUND_REPEAT_TLBI, \ > CONFIG_ARM64_WORKAROUND_REPEAT_TLBI) \ > : : ) > > -#define __TLBI_1(op, arg) asm ("tlbi " #op ", %0\n" \ > +#define __TLBI_1(op, arg) asm (ARM64_ASM_PREAMBLE \ > + "tlbi " #op ", %0\n" \ > ALTERNATIVE("nop\n nop", \ > "dsb ish\n tlbi " #op ", %0", \ > ARM64_WORKAROUND_REPEAT_TLBI, \ > > base-commit: 15bc20c6af4ceee97a1f90b43c0e386643c071b4 > -- > 2.28.0.297.g1956fa8f8d-goog > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel