From patchwork Mon May 15 05:04:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 9726071 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 61D3E60380 for ; Mon, 15 May 2017 05:06:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5815D28953 for ; Mon, 15 May 2017 05:06:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4CA5828956; Mon, 15 May 2017 05:06:16 +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 [65.50.211.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 CCD6E28953 for ; Mon, 15 May 2017 05:06:15 +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=YvJKWgoDSIwe+rowP6y2MdLqq84a33TWuajOuD4+ZBo=; b=u4FFz4IAPuF7rDQ6Xy8KpMcVkb SoGAu3RU4QZ1z1KB5VFZEHPMSBFO7Aj+xq1OCm6fWxB0uRSIdd/Aw8Rd/NxQX+kHzJ9G4xJFmQ5w9 H6RpJPq8Jfh0BqekFZkVxrNGhPCYuaDWyKN5rgRoMoXjMlLV6YEkLTZBKCGWzR6+m4mb1O3Ze7273 8aykUfBrwXkpaJIPuYoQW8ffo8FzYS17Q4a1tUx+qp3dFv8Oc0IZAJy1aAughoYE/1+JP7lKF2KZE wOvOQ6F9INzONOJJhCW4phsvCq2y0QtPcTg9plD//EGTyXNHXa7mbZQIhMUw1dbpFM2+WS4KpyJv0 98AawQ0g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dA8D1-0002Dl-2e; Mon, 15 May 2017 05:06:15 +0000 Received: from mail-pf0-x229.google.com ([2607:f8b0:400e:c00::229]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dA8Cf-0001bF-Lt for linux-arm-kernel@lists.infradead.org; Mon, 15 May 2017 05:05:57 +0000 Received: by mail-pf0-x229.google.com with SMTP id 9so16945847pfj.1 for ; Sun, 14 May 2017 22:05:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xaLcYNcv+4Nk0xNhR+n6jyYOTT+mRQ1bx2VxjuVHw5M=; b=VP+nRBu40zLQrTw4MpJ2Sp0KRZK+kNc3FsKQHZPluQuUEzWp5IMtwtwLU1Uf38ta3l +yfDlmIWU2BATdZeWNbYPZYUSL8doXr5llCC0SW1OjSFogUpxDi7aSZzrxACJX2XZpuV BZIBwfzJgSHQYzmAHjtpWDPHC/fHgdq2Lcsag= 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=xaLcYNcv+4Nk0xNhR+n6jyYOTT+mRQ1bx2VxjuVHw5M=; b=fepsRdGEqgRjHfJdoSJRajl5oa1z4OmKb+aLAbx6k0S1dP2AmnYSGvLVGZBYFckvOn Jaa4iQ8gILeBCg9fmSx6pBLipIfERfx0iZCP1+vk5Y/FqivdKOmAsE5Tk5mAG0m4mvM+ Y0jyiEEN5wZTJcWoqiJlkyWf3bcut3/O358YeQI/gnXggZ1+Mw2E+o5jHqlijNLEN/iN KeuExno4TIHPkW4Wg/sKxab6j96WaLpD4+Pf52U64nG2WZjp+6K/EaqmTh0ENe5sAQKM ZANoYIXa5fqz+qUJPrVPqbkVbXOMFyTY4xE/wpGFLlUWNk75SKu8NkqPU5+piWkTfNCw dleg== X-Gm-Message-State: AODbwcCxKGWEqdecKu3jJKLJLxIT9ujwqtuWHHQQqMA0+yzVvPmc+v4w WbUu9b92ujv5noZr X-Received: by 10.99.168.75 with SMTP id i11mr2230505pgp.228.1494824732213; Sun, 14 May 2017 22:05:32 -0700 (PDT) Received: from anup-HP-Compaq-8100-Elite-CMT-PC.dhcp.avagotech.net ([192.19.237.250]) by smtp.gmail.com with ESMTPSA id q28sm16623363pgc.0.2017.05.14.22.05.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 14 May 2017 22:05:31 -0700 (PDT) From: Anup Patel To: Vinod Koul , Rob Herring , Mark Rutland , Herbert Xu , "David S . Miller" , Jassi Brar Subject: [PATCH v8 2/4] async_tx: Fix DMA_PREP_FENCE usage in do_async_gen_syndrome() Date: Mon, 15 May 2017 10:34:53 +0530 Message-Id: <1494824695-21797-3-git-send-email-anup.patel@broadcom.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1494824695-21797-1-git-send-email-anup.patel@broadcom.com> References: <1494824695-21797-1-git-send-email-anup.patel@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170514_220553_847214_7A6537AE X-CRM114-Status: GOOD ( 12.58 ) 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: devicetree@vger.kernel.org, Anup Patel , Scott Branden , Jon Mason , Ray Jui , linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, linux-crypto@vger.kernel.org, Rob Rice , dmaengine@vger.kernel.org, Dan Williams , linux-arm-kernel@lists.infradead.org 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 The DMA_PREP_FENCE is to be used when preparing Tx descriptor if output of Tx descriptor is to be used by next/dependent Tx descriptor. The DMA_PREP_FENSE will not be set correctly in do_async_gen_syndrome() when calling dma->device_prep_dma_pq() under following conditions: 1. ASYNC_TX_FENCE not set in submit->flags 2. DMA_PREP_FENCE not set in dma_flags 3. src_cnt (= (disks - 2)) is greater than dma_maxpq(dma, dma_flags) This patch fixes DMA_PREP_FENCE usage in do_async_gen_syndrome() taking inspiration from do_async_xor() implementation. Signed-off-by: Anup Patel Reviewed-by: Ray Jui Reviewed-by: Scott Branden Acked-by: Dan Williams --- crypto/async_tx/async_pq.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/crypto/async_tx/async_pq.c b/crypto/async_tx/async_pq.c index f83de99..56bd612 100644 --- a/crypto/async_tx/async_pq.c +++ b/crypto/async_tx/async_pq.c @@ -62,9 +62,6 @@ do_async_gen_syndrome(struct dma_chan *chan, dma_addr_t dma_dest[2]; int src_off = 0; - if (submit->flags & ASYNC_TX_FENCE) - dma_flags |= DMA_PREP_FENCE; - while (src_cnt > 0) { submit->flags = flags_orig; pq_src_cnt = min(src_cnt, dma_maxpq(dma, dma_flags)); @@ -83,6 +80,8 @@ do_async_gen_syndrome(struct dma_chan *chan, if (cb_fn_orig) dma_flags |= DMA_PREP_INTERRUPT; } + if (submit->flags & ASYNC_TX_FENCE) + dma_flags |= DMA_PREP_FENCE; /* Drivers force forward progress in case they can not provide * a descriptor