From patchwork Mon Feb 26 08:19:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Shi X-Patchwork-Id: 10241401 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 20184602DC for ; Mon, 26 Feb 2018 08:22:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 05F5129AA7 for ; Mon, 26 Feb 2018 08:22:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EE7BF29AFD; Mon, 26 Feb 2018 08:22:27 +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 950A429AA7 for ; Mon, 26 Feb 2018 08:22:26 +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:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=M+nfy8cn7XsbyEn7DEffnDgZc42vPW2klPeaMeJa63Y=; b=dPBLYEFVB/iXOr vFzeFwjq0Ck+VXIFM7BwnxK53Q9x1R7f4inTDgcN0klZa7lIgC91bawe35Qzmr8QqC410ITC/zJhY g07ic79OgeVGxe8FsQlDM698cfH9He7RvPUQhGiXEMCpB//8K8/zChs9L9xqR7hTz5RnYeijQUtYn 4Vpwvo2aJAsO+Qcw/WFmDu1hN+1F3onjnJQsE8LE4pmPRlP8eenKpOkZ+49zgzHko7wLhUXYS4Vtm UjMh++G0Qw14Bl/7lJmWTppO4LtYbU6sp+GgW8A2SNyETKwXA9s0G8G3N7RqCsvQgpksPJJDgpxic pMpIp0fgUAbXbNrGNxzg==; 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 1eqE36-0000fX-Cz; Mon, 26 Feb 2018 08:22:16 +0000 Received: from mail-pg0-x241.google.com ([2607:f8b0:400e:c05::241]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eqE2U-0000F8-CE for linux-arm-kernel@lists.infradead.org; Mon, 26 Feb 2018 08:21:43 +0000 Received: by mail-pg0-x241.google.com with SMTP id w17so5907145pgv.6 for ; Mon, 26 Feb 2018 00:21:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=5jc9doNqehmWExc3XoeNI1qQ6N7FZfbJliUkP3bf70M=; b=KoMrLdBO5Qvlzer3bGL6wb3OjGdlnUFwBVM2ez8j7L/6ESku7wqpYdcGQuqw9We4Ce ez9+4SLG3bOA+nwgwLrHIgxYaNuGW8orqigbhAuVJ5LeRHV63c4YF5AxJIGlakLPSfwo MzPzkBM5mi/ffzU+X0863/50ZPYaCiNJks25E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=5jc9doNqehmWExc3XoeNI1qQ6N7FZfbJliUkP3bf70M=; b=HvDrqSX3W20ZtzwTndtHOq6IXqO2FkSSboKaKs7+GxBZIOTPLTziojkKp/T/ceEpWx 3ny4TDlphH5eXVRLEwhnZeuQz1YGfMlout6xhCO68x9C0WRz6Jk46awphnD6gNcYlzM5 25HFojLzj2bZurOVmDXk1KUdU/F0wJ1qFmrSGrWgzY9GrG9HGrV4731O7JQQgDAtfDU3 5/YBC8eLrpV7W0Br2tByqWcR+23LeNguT4ljQWW1kqd3zpdjFA7jJPhtshx856n4es3e Xp5U82BDTUrNOwa0iO/DYdkmOrUVDEdBrvkUv3gyGRxvVEElgkbeue3XWGQgahcgzwFO 8TJQ== X-Gm-Message-State: APf1xPCPn4D7YYsQwcR0r5p0Xl9T93L2Z089sAlKHlaQ6VR7YRU6W+ld +qxQY8LuBbKW3EhwlqXwc8VsvA== X-Google-Smtp-Source: AH8x225B51oXuwk6vZ099Vq5O/ubenMS+Eu4pPYS3bGu0x32d3UhNlP3EJ25dl2otJBuezKpkDt6QQ== X-Received: by 10.98.226.16 with SMTP id a16mr9691686pfi.157.1519633286699; Mon, 26 Feb 2018 00:21:26 -0800 (PST) Received: from localhost.localdomain (176.122.172.82.16clouds.com. [176.122.172.82]) by smtp.gmail.com with ESMTPSA id o86sm1422706pfi.87.2018.02.26.00.21.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 26 Feb 2018 00:21:26 -0800 (PST) From: Alex Shi To: Marc Zyngier , Will Deacon , Ard Biesheuvel , Catalin Marinas , stable@vger.kernel.org, linux-arm-kernel@lists.infradead.org (moderated list:ARM64 PORT (AARCH64 ARCHITECTURE)), linux-kernel@vger.kernel.org (open list) Subject: [PATCH 03/52] arm64: barrier: Add CSDB macros to control data-value prediction Date: Mon, 26 Feb 2018 16:19:37 +0800 Message-Id: <1519633227-29832-4-git-send-email-alex.shi@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519633227-29832-1-git-send-email-alex.shi@linaro.org> References: <1519633227-29832-1-git-send-email-alex.shi@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180226_002138_829019_0FCCE1BA X-CRM114-Status: GOOD ( 11.44 ) 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: , 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 Conflicts: arch/arm64/include/asm/assembler.h no psb_csync in arch/arm64/include/asm/barrier.h --- 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)