Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1756479rwd; Fri, 9 Jun 2023 01:27:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4rg5TFR2I4k4ZHEXZgc2in/kP7YOyAdB+if/cIf+yt8xGtV+2pGB4vec3pD4t67yL3c17E X-Received: by 2002:a05:6a21:680d:b0:102:f6f2:c962 with SMTP id wr13-20020a056a21680d00b00102f6f2c962mr382920pzb.54.1686299268916; Fri, 09 Jun 2023 01:27:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686299268; cv=none; d=google.com; s=arc-20160816; b=iN1NGSx/nhBCohlUr7l6O8E9/5WvqjupJtChHsyHtFYSK2/DIfWhaT3tyCcaVEPgtO ssJUNUS7XVIEByLaPyb0ka+FUjjovLxGQr3T31wMWlS3jjp+vDOeeR9A8/6FC0OWAwxt /GjO23jtEn55GAVShYuYz9k0PVSrISOopBlx3aySW0/galHm8Tbj8eLbbgeELpax0Wst 03LoQdHMRj7W66bxsboMPoQVBtBgYi5pnb60/N/FIaUiFWCPsDXlIbrnuxSId6EcRCK9 yG0O/2z4vPzlrvCE9aBLCM4VryeUwLO5kDtT0NFUGpsuAuIHiZkZYVKvM7nJXO0+m9ip dmqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=cbdGpWw3wXdv/9CgkohTPhBO6pQU5IR9oYOzbdI3a4k=; b=lgJ9gNgVsAsucH/5+nd0jgNko/J8y/F6vgvpydwdPTOzxySTNIKRfXuRl2s0Gavj4D PFK89WR8SwZR7/WH/CD53a6VzanwQEw8pjqO4rbxBhNFWHWRoOw4NyCrGCpqiD6uiAvM xWp2aP9tsWP1Cq6LgiiwCUUMh4BPmSrJ7Kv5nZjySvoFzllKiMcUtVYtgZgBABs7JW8s puR5k+rtu8Bqdvwo4toe1ifgBj1wSCcD9mqzWMYpkuwrJwRidEm76B0NAcTOoRKegQDH xZxy1jN/YosEpGo83q56ouKXjESPAlYLl63boPnmDU49pHdnstCsyML/6br1s6LXNC1T MeqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=bzrgUYyl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lm7-20020a170903298700b001add2ba445asi2451318plb.259.2023.06.09.01.27.37; Fri, 09 Jun 2023 01:27:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=bzrgUYyl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239180AbjFIISA (ORCPT + 99 others); Fri, 9 Jun 2023 04:18:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240209AbjFIIRj (ORCPT ); Fri, 9 Jun 2023 04:17:39 -0400 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::226]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C1062D7E; Fri, 9 Jun 2023 01:17:04 -0700 (PDT) X-GND-Sasl: kory.maincent@bootlin.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1686298622; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cbdGpWw3wXdv/9CgkohTPhBO6pQU5IR9oYOzbdI3a4k=; b=bzrgUYylr8ZtCiQyYtetbY2fhyi9ysaaQcJRlN3RwRAYJ5Y0c14hgXD4wDSnUbYWsdAb1M DScTGRCZRAssYgubd3SDvABJZqioqEnT/hLLZfiOYIb9fVNTOcbiCzPiAgKfFsJhx7Ph55 18SJjNJ1W4PcIG2731dJdADTR+xkVvEQuF92TgVSbBtCWsERQmtYaClaBM0Au6Br4f0pzL 4giHBAWZM1mENfq9U9FrKJJDk03a01NuXzbaPC9WJstpBXL/dizlu5Qv9CKIu5XJqmuLZ0 sXXM22WKm49dGOzvw5jpNvxu/8QOpvrwMIBFqwxuZ4DCVGV34EYWevylajlPXA== X-GND-Sasl: kory.maincent@bootlin.com X-GND-Sasl: kory.maincent@bootlin.com X-GND-Sasl: kory.maincent@bootlin.com X-GND-Sasl: kory.maincent@bootlin.com X-GND-Sasl: kory.maincent@bootlin.com X-GND-Sasl: kory.maincent@bootlin.com X-GND-Sasl: kory.maincent@bootlin.com X-GND-Sasl: kory.maincent@bootlin.com X-GND-Sasl: kory.maincent@bootlin.com X-GND-Sasl: kory.maincent@bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 0F319C000A; Fri, 9 Jun 2023 08:17:00 +0000 (UTC) From: =?UTF-8?q?K=C3=B6ry=20Maincent?= To: Cai Huoqing , Manivannan Sadhasivam , Serge Semin , Vinod Koul , Gustavo Pimentel , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Thomas Petazzoni , Gustavo Pimentel , Herve Codina , Kory Maincent Subject: [PATCH 5/9] dmaengine: dw-edma: HDMA: Fix possible race condition in remote setup Date: Fri, 9 Jun 2023 10:16:50 +0200 Message-Id: <20230609081654.330857-6-kory.maincent@bootlin.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230609081654.330857-1-kory.maincent@bootlin.com> References: <20230609081654.330857-1-kory.maincent@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-GND-Spam-Score: 300 X-GND-Status: SPAM X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kory Maincent When writing the linked list elements and pointer the control need to be written at the end. If the control is written and the SAR and DAR not stored we could face a race condition. Fixes: e74c39573d35 ("dmaengine: dw-edma: Add support for native HDMA") Signed-off-by: Kory Maincent --- This patch is fixing a commit which is only in dmaengine tree and not merged mainline. --- drivers/dma/dw-edma/dw-hdma-v0-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/dma/dw-edma/dw-hdma-v0-core.c b/drivers/dma/dw-edma/dw-hdma-v0-core.c index 0b77ddbe91b5..f28e1671a753 100644 --- a/drivers/dma/dw-edma/dw-hdma-v0-core.c +++ b/drivers/dma/dw-edma/dw-hdma-v0-core.c @@ -162,10 +162,10 @@ static void dw_hdma_v0_write_ll_data(struct dw_edma_chunk *chunk, int i, } else { struct dw_hdma_v0_lli __iomem *lli = chunk->ll_region.vaddr.io + ofs; - writel(control, &lli->control); writel(size, &lli->transfer_size); writeq(sar, &lli->sar.reg); writeq(dar, &lli->dar.reg); + writel(control, &lli->control); } } @@ -182,8 +182,8 @@ static void dw_hdma_v0_write_ll_link(struct dw_edma_chunk *chunk, } else { struct dw_hdma_v0_llp __iomem *llp = chunk->ll_region.vaddr.io + ofs; - writel(control, &llp->control); writeq(pointer, &llp->llp.reg); + writel(control, &llp->control); } } -- 2.25.1