Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1127451ybh; Mon, 13 Jul 2020 10:00:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLYwuIim2XvAiju25N6sdoABMB/dcFb6yw4SGUWu/BGC4AO8iN9TbL6dvPbT8Xbnmv6T4S X-Received: by 2002:a17:906:c201:: with SMTP id d1mr676685ejz.40.1594659613169; Mon, 13 Jul 2020 10:00:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594659613; cv=none; d=google.com; s=arc-20160816; b=mlnoRqlpT1JlSE7i981gWqPBG8BJkzSCVm76yopxHcXUHpXvi+TZ51pnDwXkyUA6oq 79hgi5hktZD2yu3NzIXTI8I6+q9z5l3C7VSDyT/MmjqZtpIK76JePE2hibqV4Xg1Ga0P mlsB4DDi5y18OopFKwu3TuXkX2JFktYLP9nJJgEk7b2BTlDWFnkwmqjUF15tP4nV6zYh hrOMaLEM9VL4c50LUeOqEX0UrzWReRcy9ixXr6O+aqTGxls2agvKEK4tfZg7f78p1ZDP 3jwkdpXnc3JLDbmacPSx1Jykn1FRM6loe9CzgLUQ6JRXSqxafpkRbKsC1rDItmWL+CiC krEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=226Kpx4l2HN/iKYlRTNvgTw9/2IcGqys5JSjHE5t6Ig=; b=An/4EQAXUqGeUSdhkyTdIFDZg6jZikizHVqvXYPo0qynwYJKN1HlLMOfKVzNWZpoPu 4es1YFo8TkosOOjadqnfz5PfqpApNKhOgCtmWbc4IK5RTLrZWH6al3g8lptynoDVKAUu NqssE1lBezSdAhxRt7a4tqYNUdUQVTrrU9Q1o2RLoZdZrzmhdD9608/l4QKvQPD7xAjx FX5rmnRHED+NnC16eEmFTS2CrgKbkjirvFqYZGSHIwuO3mkXBh0suOFAEF78NAohNkkQ djiSWkiMg3goKdyBHIx64V7+f6u3dnJ/P7AhH93BcMSnIbyFt0y/Obbn0Ji1Lh2ttlIC 0y1A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g16si9121143edu.513.2020.07.13.09.59.50; Mon, 13 Jul 2020 10:00:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730356AbgGMQ7L (ORCPT + 99 others); Mon, 13 Jul 2020 12:59:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:44146 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730185AbgGMQ7K (ORCPT ); Mon, 13 Jul 2020 12:59:10 -0400 Received: from gaia (unknown [95.146.230.158]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1AA4B20738; Mon, 13 Jul 2020 16:59:06 +0000 (UTC) Date: Mon, 13 Jul 2020 17:59:04 +0100 From: Catalin Marinas To: Zhenyu Ye Cc: maz@kernel.org, steven.price@arm.com, guohanjun@huawei.com, will@kernel.org, olof@lixom.net, suzuki.poulose@arm.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, zhangshaokun@hisilicon.com, prime.zeng@hisilicon.com, linux-arch@vger.kernel.org, kuhn.chenqun@huawei.com, xiexiangyou@huawei.com, linux-mm@kvack.org, arm@kernel.org Subject: Re: [PATCH v2 0/2] arm64: tlb: add support for TLBI RANGE instructions Message-ID: <20200713165903.GD15829@gaia> References: <20200710094420.517-1-yezhenyu2@huawei.com> <159440712962.27784.4664678472466095995.b4-ty@arm.com> <20200713122123.GC15829@gaia> <2edcf1ce-38d4-82b2-e500-51f742cae357@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2edcf1ce-38d4-82b2-e500-51f742cae357@huawei.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 13, 2020 at 08:41:31PM +0800, Zhenyu Ye wrote: > On 2020/7/13 20:21, Catalin Marinas wrote: > > On Fri, Jul 10, 2020 at 08:11:19PM +0100, Catalin Marinas wrote: > >> On Fri, 10 Jul 2020 17:44:18 +0800, Zhenyu Ye wrote: > >>> NOTICE: this series are based on the arm64 for-next/tlbi branch: > >>> git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/tlbi > >>> > >>> -- > >>> ARMv8.4-TLBI provides TLBI invalidation instruction that apply to a > >>> range of input addresses. This series add support for this feature. > >>> > >>> [...] > >> > >> Applied to arm64 (for-next/tlbi), thanks! > >> > >> [1/2] arm64: tlb: Detect the ARMv8.4 TLBI RANGE feature > >> https://git.kernel.org/arm64/c/a2fd755f77ff > >> [2/2] arm64: tlb: Use the TLBI RANGE feature in arm64 > >> https://git.kernel.org/arm64/c/db34a081d273 > > > > I'm dropping these two patches from for-next/tlbi and for-next/core. > > They need a check on whether binutils supports the new "tlbi rva*" > > instructions, otherwise the build mail fail. > > > > I kept the latest incarnation of these patches on devel/tlbi-range for > > reference. > > Should we add a check for the binutils version? Just like: > > diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig > index fad573883e89..d5fb6567e0d2 100644 > --- a/arch/arm64/Kconfig > +++ b/arch/arm64/Kconfig > @@ -1300,6 +1300,20 @@ config ARM64_AMU_EXTN > correctly reflect reality. Most commonly, the value read will be 0, > indicating that the counter is not enabled. > > +config ARM64_TLBI_RANGE > + bool "Enable support for tlbi range feature" > + default y > + depends on AS_HAS_TLBI_RANGE > + help > + ARMv8.4-TLBI provides TLBI invalidation instruction that apply to a > + range of input addresses. > + > + The feature introduces new assembly instructions, and they were > + support when binutils >= 2.30. It looks like 2.30. I tracked it down to this commit: https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=793a194839bc8add71fdc7429c58b10f0667a6f6;hp=1a7ed57c840dcb0401f1a67c6763a89f7d2686d2 > +config AS_HAS_TLBI_RANGE > + def_bool $(as-option, -Wa$(comma)-march=armv8.4-a) > + > endmenu The problem is that we don't pass -Wa,-march=armv8.4-a to gas. AFAICT, we only set an 8.3 for PAC but I'm not sure how passing two such options goes. I'm slightly surprised that my toolchains (and yours) did not complain about these instructions. Looking at the binutils code, I think it should have complained if -march=armv8.4-a wasn't passed but works fine. I thought gas doesn't enable the maximum arch feature by default. An alternative would be to check for a specific instruction (untested): def_bool $(as-instr,tlbi rvae1is, x0) but we need to figure out whether gas not requiring -march=armv8.4-a is a bug (which may be fixed) or that gas accepts all TLBI instructions. A safer bet may be to simply encode the instructions by hand: #define SYS_TLBI_RVAE1IS(Rt) \ __emit_inst(0xd5000000 | sys_insn(1, 0, 8, 2, 1) | ((Rt) & 0x1f)) #define SYS_TLBI_RVALE1IS(Rt) \ __emit_inst(0xd5000000 | sys_insn(1, 0, 8, 2, 5) | ((Rt) & 0x1f)) (please check that they are correct) -- Catalin