From patchwork Mon Nov 13 14:45:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 118792 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp1879616qgn; Mon, 13 Nov 2017 06:47:10 -0800 (PST) X-Google-Smtp-Source: AGs4zMZk0Bl6FcOrM/tgnOQGDRZCJvm7M1lZRPrLgveA7aW3KTlu0uOCtBunXNZpNIMpKgcCW+s9 X-Received: by 10.99.44.214 with SMTP id s205mr8785028pgs.80.1510584430070; Mon, 13 Nov 2017 06:47:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510584430; cv=none; d=google.com; s=arc-20160816; b=j2xdPV+3FsCsxp8nUWAPEi8xmVgyffbawBf7/71O5grUV8+lltp0NNX9gW7HUjcBsb gtPkafanYMDA6+tF6j1NSbhoLh9tNkLL9/VoECF/39VRSHstyw5AGf7BjoghOaz6OQTV BxRAFd4H2f/SvAYmwPSgwZQ4E6dGy9TLhZdwvLOHEbyns1VBKtuuHW7aumUWNuaY1rNS xi/fZnEoezdAOH+4ZmhCgFIsPzImwxCnxsMNWyU9GvsNt8PLfNRxFAtX/6Dfg61hYl9d 1NeTRKyCAOp6C0TgCcRR3k/uUmMpvyUFb4l8PGEAMKwmNoUkpJYxsUFnwFwtcyiDUGha oL/A== 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:arc-authentication-results; bh=D/N81+KkCpr2M0ms01U1Xo1V/jFRIMyg8K0D5wDmeQk=; b=KixE7Hf6rxZVF+Q+4wisc0d4384YnVNAr0d8XYNKlpugd/EywD3ca5XwQ5o0nl+0k1 XyTxda6Q9c9d1tz5j8RvFZXp5xjChrJP2Q0TYsuoWk4HxaBupFsRinJlGjsV4iCd7G8Q e9nQu9fW+r51plhPDYcVlDH70XYSrEm6cesrWs+FfRoWpcS4xinbZh/798kEGMYYDxjh F8rNxaXKV7BpPZ/C+XPBOzH2suYWVwyi/X/npSaFbD4bmiGakUx2BCFC1H3zaBbfTzWW fJ//nB8sOdAFOUy3iGyUXE4pu1LmiOg09dXd6EY74yW1A7fEJbzR/4qpBTCdHjaJ9iZP 4H0Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e191si13487424pgc.788.2017.11.13.06.47.09; Mon, 13 Nov 2017 06:47:10 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753262AbdKMOrH (ORCPT + 27 others); Mon, 13 Nov 2017 09:47:07 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:47320 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752769AbdKMOrE (ORCPT ); Mon, 13 Nov 2017 09:47:04 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 09B571435; Mon, 13 Nov 2017 06:47:04 -0800 (PST) Received: from sugar.kfn.arm.com (unknown [10.45.48.133]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6A8B33F318; Mon, 13 Nov 2017 06:47:02 -0800 (PST) From: Gilad Ben-Yossef To: Greg Kroah-Hartman Cc: Ofir Drang , linux-crypto@vger.kernel.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH 08/24] staging: ccree: make mem barrier per request Date: Mon, 13 Nov 2017 14:45:36 +0000 Message-Id: <1510584358-29473-9-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510584358-29473-1-git-send-email-gilad@benyossef.com> References: <1510584358-29473-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The driver was issuing a write memory barrier per each HW descriptor written but these descriptors are written in groups and we really only need one per group. White at it, document memory barrier reason. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_request_mgr.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c index e23c656..f5041f7 100644 --- a/drivers/staging/ccree/ssi_request_mgr.c +++ b/drivers/staging/ccree/ssi_request_mgr.c @@ -172,7 +172,6 @@ static inline void enqueue_seq( writel_relaxed(seq[i].word[2], (cc_base + CC_REG(DSCRPTR_QUEUE_WORD0))); writel_relaxed(seq[i].word[3], (cc_base + CC_REG(DSCRPTR_QUEUE_WORD0))); writel_relaxed(seq[i].word[4], (cc_base + CC_REG(DSCRPTR_QUEUE_WORD0))); - wmb(); writel_relaxed(seq[i].word[5], (cc_base + CC_REG(DSCRPTR_QUEUE_WORD0))); #ifdef DX_DUMP_DESCS dev_dbg(dev, "desc[%02d]: 0x%08X 0x%08X 0x%08X 0x%08X 0x%08X 0x%08X\n", @@ -359,6 +358,12 @@ int send_request( #ifdef FLUSH_CACHE_ALL flush_cache_all(); #endif + /* + * We are about to push command to the HW via the command registers + * that may refernece hsot memory. We need to issue a memory barrier + * to make sure there are no outstnading memory writes + */ + wmb(); /* STAT_PHASE_4: Push sequence */ enqueue_seq(cc_base, iv_seq, iv_seq_len); @@ -417,6 +422,12 @@ int send_request_init( set_queue_last_ind(&desc[(len - 1)]); + /* + * We are about to push command to the HW via the command registers + * that may refernece hsot memory. We need to issue a memory barrier + * to make sure there are no outstnading memory writes + */ + wmb(); enqueue_seq(cc_base, desc, len); /* Update the free slots in HW queue */