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: 130183 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp2760466edc; Thu, 1 Mar 2018 04:55:39 -0800 (PST) X-Google-Smtp-Source: AG47ELvgjvmNidzZmifrJ9IR/DncX+pB0kCgKEWdXKrw/U88XYeKoKd9r1FkbgCl0kCjW1R5Yahb X-Received: by 10.99.96.66 with SMTP id u63mr1508497pgb.49.1519908939605; Thu, 01 Mar 2018 04:55:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519908939; cv=none; d=google.com; s=arc-20160816; b=nNs4wDDNTEmjocRDTqYd8wMHYB9dnoh9OwePKBqFl6FEsXRwF6lOeagob2T4DVm8OT yYqzcagu4KsrnXp4bhBiQaBCMnA4+3W+Px3dp3j38I1RJirjy7rRR/El8Y4ypCh6U3kR idcBnmCHllOMnhtZl5VvVUrv1kqv2Z7aJkp5A538XQ0Kb3qGaxfEUHc3eri6JrjytO8E 7tumSp01QEon36sFGcj7Ky9Ck+bHsxvioOjK9loZP3lZbfXTJFn1jEFadNmt/R24lgmi wfaCKN4za6B/Qbw2bQSvQ+TULAf3YFNqL9YaYnXQbBjmDf9eSmYJT77L8B6MzlEmw3YU ZfWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=nelMizWy+r+xl1PA+JMazlupbHfphoojSqCggA1RmD0=; b=y7qFhCG2mLhU9k1mGSv5J8zZ0oZvYM+MkcE8QJSpBo0og7nkPeMrdwKp1hJQ3siE5M KXrcVx4v5ey+malZlRWei3G0atBPImgY6po1ZbucMslAu2cpjrmx//R5VHsF7fg9ix8V siR5ZYbXrcWwDB2n9V2+1H6Tm0svLAdHbfA5R/o0mJxQkj+ARIbs2Y0WpFcXRmYZaQR6 xVix4LES8ZCML0hzDPhPHh44FTOapfAscCWyr/Ku2npPPi9vhpqXv4sq/Ilz+UMQRmOA i98V8bRZOGG64PgV0F7Gw9dKtmjXGe32+PUSIfItrzySHQRMGq82q1AqqFurkOvuDbz8 wiOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e66C1+HX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c10si2454231pgf.230.2018.03.01.04.55.39; Thu, 01 Mar 2018 04:55:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e66C1+HX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030631AbeCAMzg (ORCPT + 28 others); Thu, 1 Mar 2018 07:55:36 -0500 Received: from mail-pl0-f67.google.com ([209.85.160.67]:43043 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030618AbeCAMzc (ORCPT ); Thu, 1 Mar 2018 07:55:32 -0500 Received: by mail-pl0-f67.google.com with SMTP id f23-v6so3581571plr.10 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=IuMuVG6XpYp2u6cu4xRkb/zMslSO3L28BueN0iy5hyVcwreY/R8Wm9WyeyNW40VfG9 vM3A7MqXq8NcNPf4lRDrjrHLxDaLX8CrxeX0h5hO0v5btX3ryjpcvVkNsOvMCYM0/v3+ SD6sVQTrD92uPwnk/jomO6G/wsyFxvvGPx4iNaj0hv1a7dXnpDg9I13fDkwKVORBEN3P GmRkwF2QBzTo3QQsQMGIMF0f5rVDohjAFvuMlCO2CChPTjhtYxEhLDo0KhuIaGvCpgVR X/yuQPrYWCRLsA9zlk6eDb+NF/cgsMreY6DrYCzn3nyVzfMMryDUXf/4KZKk4j/gm3nL 964g== X-Gm-Message-State: APf1xPCNq19vIzAQiyEzRjvwQim3pobJD1sNFYvBK2NQNcAQmBG2bdNC w4FopmUGSBLefKV3h7z0srhM4w== 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 Cc: Alex Shi 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(+) -- 2.7.4 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)