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.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,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 81F33C433DB for ; Tue, 2 Feb 2021 11:16:29 +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 29AE064E31 for ; Tue, 2 Feb 2021 11:16:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 29AE064E31 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.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=fxybcTD5piRY0zVEDZV9h7uBBBHcs22+ZbvKdl+wotA=; b=1gHrsNgHPE0tz3y9kVfRm4gUR cV0WPO90QQbBmw56tl6LLagaoqH1kwh3rWqbU2jdfXvifnUNPR+PmQ0XWKyO4OI01KtgnlQB2B4/Y CTMgFRo6Dbi0FYrRaegIislw3yWhFOkjeG6qKb6y3FRcDApFfMunz88APQz+wormCkChOWJlGVfMx a/+AnrXjPfboIiUSmP9ztdvtsfhj2WOzkD3b7S+eV+ES5NhLqGhn/9lH6ltKVv8O5KxcAfU4PJtj9 raxb1DH72LR06Kl+ON/ZsctVJ3w+e6SbsZOv6mQibp26y9p3S2TTJnsQXCpKkDZfeCHDQsDT0hJlc bgq/6djlw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l6teT-0003Y6-Ga; Tue, 02 Feb 2021 11:15:21 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l6teQ-0003Xk-56 for linux-arm-kernel@lists.infradead.org; Tue, 02 Feb 2021 11:15:19 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 893511396; Tue, 2 Feb 2021 03:15:16 -0800 (PST) Received: from C02TD0UTHF1T.local (unknown [10.57.49.77]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DCA623F7D7; Tue, 2 Feb 2021 03:15:14 -0800 (PST) Date: Tue, 2 Feb 2021 11:15:12 +0000 From: Mark Rutland To: Julien Thierry Subject: Re: [RFC PATCH 3/5] arm64: aarch64-insn: Add barrier encodings Message-ID: <20210202111512.GC59049@C02TD0UTHF1T.local> References: <20210120171745.1657762-1-jthierry@redhat.com> <20210120171745.1657762-4-jthierry@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210120171745.1657762-4-jthierry@redhat.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210202_061518_269814_59E93435 X-CRM114-Status: GOOD ( 18.34 ) 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: catalin.marinas@arm.com, broonie@kernel.org, will@kernel.org, linux-kernel@vger.kernel.org, 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 Wed, Jan 20, 2021 at 06:17:43PM +0100, Julien Thierry wrote: > Create necessary functions to encode/decode aarch64 data/instruction > barriers. > > Signed-off-by: Julien Thierry > --- > arch/arm64/include/asm/aarch64-insn.h | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/arch/arm64/include/asm/aarch64-insn.h b/arch/arm64/include/asm/aarch64-insn.h > index 200bee726172..d0fee47bbe6e 100644 > --- a/arch/arm64/include/asm/aarch64-insn.h > +++ b/arch/arm64/include/asm/aarch64-insn.h > @@ -379,6 +379,9 @@ __AARCH64_INSN_FUNCS(eret_auth, 0xFFFFFBFF, 0xD69F0BFF) > __AARCH64_INSN_FUNCS(mrs, 0xFFF00000, 0xD5300000) > __AARCH64_INSN_FUNCS(msr_imm, 0xFFF8F01F, 0xD500401F) > __AARCH64_INSN_FUNCS(msr_reg, 0xFFF00000, 0xD5100000) > +__AARCH64_INSN_FUNCS(dmb, 0xFFFFF0FF, 0xD50330BF) > +__AARCH64_INSN_FUNCS(dsb, 0xFFFFF0FF, 0xD503309F) > +__AARCH64_INSN_FUNCS(isb, 0xFFFFF0FF, 0xD50330DF) These match the encodings in ARM DDI 0487G.a, with a couple of caveats for DSB. Per section C6.2.82 on page C6-1000, when CRm != 0x00, the instruction isn't considered a DSB. I believe per the "barriers" decode table on page C4-289 that here "0x00" is actually a binary string and 'x' is a "don't care" -- I've raised a ticket to get the documentation clarified. I suspect we need to write a function to handle that. There's also a secondary encoding for DSB with FEAT_XS, which we don't currently use but might want to add. > #undef __AARCH64_INSN_FUNCS > > @@ -390,6 +393,12 @@ static inline bool aarch64_insn_is_adr_adrp(u32 insn) > return aarch64_insn_is_adr(insn) || aarch64_insn_is_adrp(insn); > } > > +static inline bool aarch64_insn_is_barrier(u32 insn) > +{ > + return aarch64_insn_is_dmb(insn) || aarch64_insn_is_dsb(insn) || > + aarch64_insn_is_isb(insn); > +} I assume this is meant to match the barriers instruction class, as per the table on page C4-289? That also contains CLREX, SB, SSBB, and PSSBB, and it might be worth adding them at the same time. Thanks, Mark. > enum aarch64_insn_encoding_class aarch64_get_insn_class(u32 insn); > bool aarch64_insn_uses_literal(u32 insn); > bool aarch64_insn_is_branch(u32 insn); > -- > 2.25.4 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel