From patchwork Thu Mar 1 12:53:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Shi X-Patchwork-Id: 10251359 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 18154602B5 for ; Thu, 1 Mar 2018 13:25:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 07E771FFFF for ; Thu, 1 Mar 2018 13:25:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EFEF120243; Thu, 1 Mar 2018 13:25:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5A0021FFFF for ; Thu, 1 Mar 2018 13:25:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=0xXS8ca7PVNwzld+1Ud+JWP/QF8J6BEVpKTUA1Zt0xw=; b=EGBJ+MCRvsROXqWTTMzuOX3jgm LGdyiZiTy2dA0oNjr2zc84thbNm1KXBZXz4mcIFZO4r6w5OoZ1d2KF1XjZuKPFjBW8K0DwirmxYYL RoW1/V9gtcUNIR20U3aHK0RLJvdTCitD4nBZ++BFfsy5VyfbnknGjLV8V5+dNi4NcGKm8V3rRTyF+ 0xSOO37pfr+hz2cdBrhm/CWhCzkfXCiJ0PpoBqk4wjOLALXd8mhaou6YSwsjInLazTrIEgr+Gfj06 3/NvmV833iLZSiI+U+8ZE0C9ofRl8B8gkKINQl0YPrF2j5Q4D1qu+GeTU357mKQO26CtDf7mTjHw6 qhcEljCg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1erODG-0007fS-JR; Thu, 01 Mar 2018 13:25:34 +0000 Received: from mail-pl0-x242.google.com ([2607:f8b0:400e:c01::242]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1erNkM-0000J6-Sp for linux-arm-kernel@lists.infradead.org; Thu, 01 Mar 2018 12:55:51 +0000 Received: by mail-pl0-x242.google.com with SMTP id 93-v6so3576894plc.9 for ; Thu, 01 Mar 2018 04:55:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=nelMizWy+r+xl1PA+JMazlupbHfphoojSqCggA1RmD0=; b=e66C1+HXHngXFMiUjstd+ocmupaazHCvdOBrdx7qoT6x8ORTs1kkR6JPnDxe8n0KC+ sESV0oVwuXo3a8YDGftEZzM9SGaGihMBRJce6ENYnaYpcRuqzRNl3gsMz1aY0qXcbqcP NaTqD67Sj3KeLfEDgnHs6SqsFBVSn4cMevd/Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=nelMizWy+r+xl1PA+JMazlupbHfphoojSqCggA1RmD0=; b=Tmpg92iTmMnxg/qE5vYLv9qH+RbjcVPqUfmra+ZSJSFTDixSGXCtWLhVXn2n04cc9m Dh+9StQHdhfXlmkIvQ/+wKgD8D7fVhaCcI6LQVrmfE6J95AiFMBGXnmmc3grzJYl8N4y NMmCmBJs/A1kpcQ1qk4u45mbwceFTiqMJ8U/w83czbMAShk32pD1quBJMCusLy7AAxhf Rh/SJo2xMFLOd4UlGZAF+kxQf2GRt3GFsyksQRygiSlLv7RdwTSQmK+UgMv9I5kfWGFU AWWd9DOuJykzKB+0zTTJpBIhxdflRSVKyIZVRjwmajU5mEovMpd76zi+If5AeCKEXwZn skcA== X-Gm-Message-State: APf1xPAy4+i52Vy/NM627z9ipawJdFsWilZc/keKBQZ2vqnQKsCcxZQM /hLnsKxz7ntgntR5Wpvcw9yKBw== X-Google-Smtp-Source: AG47ELuKD7Llr/XORPs2mfIfUEgrAOTpufWqOtqwZfIVj/m6WYO5W7T84jnmC1IiEFnUd5P3mR2G9w== X-Received: by 2002:a17:902:22f:: with SMTP id 44-v6mr1835471plc.418.1519908931827; Thu, 01 Mar 2018 04:55:31 -0800 (PST) Received: from localhost.localdomain (176.122.172.82.16clouds.com. [176.122.172.82]) by smtp.gmail.com with ESMTPSA id x4sm2289655pfb.46.2018.03.01.04.55.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 01 Mar 2018 04:55:31 -0800 (PST) From: Alex Shi To: Marc Zyngier , Will Deacon , Ard Biesheuvel , Catalin Marinas , stable@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 03/45] arm64: barrier: Add CSDB macros to control data-value prediction Date: Thu, 1 Mar 2018 20:53:40 +0800 Message-Id: <1519908862-11425-4-git-send-email-alex.shi@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519908862-11425-1-git-send-email-alex.shi@linaro.org> References: <1519908862-11425-1-git-send-email-alex.shi@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180301_045544_104109_A2AE4D1E X-CRM114-Status: GOOD ( 12.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alex Shi MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Will Deacon commit 669474e772b9 upstream. For CPUs capable of data value prediction, CSDB waits for any outstanding predictions to architecturally resolve before allowing speculative execution to continue. Provide macros to expose it to the arch code. Reviewed-by: Mark Rutland Signed-off-by: Will Deacon Signed-off-by: Catalin Marinas Signed-off-by: Alex Shi --- arch/arm64/include/asm/assembler.h | 7 +++++++ arch/arm64/include/asm/barrier.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/assembler.h index 851290d..8760300 100644 --- a/arch/arm64/include/asm/assembler.h +++ b/arch/arm64/include/asm/assembler.h @@ -87,6 +87,13 @@ .endm /* + * Value prediction barrier + */ + .macro csdb + hint #20 + .endm + +/* * NOP sequence */ .macro nops, num diff --git a/arch/arm64/include/asm/barrier.h b/arch/arm64/include/asm/barrier.h index 0fe7e43..c68fdc5 100644 --- a/arch/arm64/include/asm/barrier.h +++ b/arch/arm64/include/asm/barrier.h @@ -31,6 +31,8 @@ #define dmb(opt) asm volatile("dmb " #opt : : : "memory") #define dsb(opt) asm volatile("dsb " #opt : : : "memory") +#define csdb() asm volatile("hint #20" : : : "memory") + #define mb() dsb(sy) #define rmb() dsb(ld) #define wmb() dsb(st)