Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2034417rdb; Tue, 3 Oct 2023 08:22:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGKlO6+TvVWLgVZEI1vmT9TFXn36Zl7EuCwxNlvImIkNJ062qnpzZ5O/UwggeVaOTvtFJ/y X-Received: by 2002:a05:6a21:329f:b0:13a:dd47:c31a with SMTP id yt31-20020a056a21329f00b0013add47c31amr4402021pzb.20.1696346539974; Tue, 03 Oct 2023 08:22:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696346539; cv=none; d=google.com; s=arc-20160816; b=DMINzoxrBbmXs2sZaGM74Ilf4A+x4sp06bsl0GNqyZ4/2trrOK8Qb8od4jBoISu+zM ObIx6omgmwjvRdZmOowZyoR93f3jh8zlu5PQQ6tYkpZSmVroNQwHRF1HV7B3Wwd4a9rc nTn8HQPoHLHuBi+OzGaWvfl4u3AYRf5VlegK94tOe6MJDbNJ+BNN7rGbqcwsFaq2mhzN wa7w8UeEgFpeCwgxBhmP/hsaRzGMa/ztJQ/+LR/wDOUsJK8UNYG7VEFo3K3WRSE5Q7wD lE3i6W+w8RpjACLrlOarH5hJUvZRtQ++XAZ88WOwacwL+f7nbm9DjwPojDL+w4nFbGbh m23A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=6W20St9AUDpDFBNyugoMYR8+Qn4dlil3atLZEE5i40k=; fh=Kgtip4zV1Z0hikPyXit1EknyYDvvf4K7CuIvHM/WMp8=; b=nPwYYKRPc/Gs2DUbC/66icFy0A3JGUv5+jUArEi5srZ/KQxAWLtpiBauOsTX8qrPX7 F2X+D5niV+w0hKUlSVpwi85ZFkGyrrptSLmT+ZQ/REXHv+1FZdqPe3IT3nKsFSCs6PzC u9MOkf2jjlaTk6gUwnwaIo605yNxMcIlTu23Y8R4B7yRKh7/br61KXlcFTS0IDvI5vGJ uzOHBw7cg1XcJdQvcMpH/LDGsy1Hl3z4S+F2OIPmC9JuDUmHkYZM3pQPBjMmxZUTMCDL pyzAart31PET//zz4/hs/g8YBjPh5505bUI+EW+U+6vNwTcYmoflzNruCGnRLEhaWE1v nlQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Ua8+QRV3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id v185-20020a6389c2000000b00578f1ab2287si1634946pgd.354.2023.10.03.08.22.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 08:22:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Ua8+QRV3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 353D580A8BA9; Tue, 3 Oct 2023 08:20:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231700AbjJCPUe (ORCPT + 99 others); Tue, 3 Oct 2023 11:20:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231545AbjJCPUc (ORCPT ); Tue, 3 Oct 2023 11:20:32 -0400 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9E35C6; Tue, 3 Oct 2023 08:20:29 -0700 (PDT) Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-50573e85ee0so1247974e87.3; Tue, 03 Oct 2023 08:20:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696346428; x=1696951228; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=6W20St9AUDpDFBNyugoMYR8+Qn4dlil3atLZEE5i40k=; b=Ua8+QRV3sZ99sRKlKC25DSkqwE23CHq+Eos3vQ8Ae08CB9YS7O6/ttrGAP3+/EA1wN XcrWIVxlzK6PntT06foDf8ZsO04PEdST1lIoowKqDngsEg6q78y51ZyT1jvZX3BrRx7I 2Mb+TkjlqOIdxF4sHEYR/dsRspQsW/H/eHoZwHwyfphtYzWWixsIdVvoeRkJJ4ImgCbt yGbSlm9I5yygyAfnA7b05DhaLUkvtYHdbRzYltqcxq3KazZXXW8Dm/q2qoGMvLNO8sXX 6c7bFat0cVHL9Dx/+75B8i+amoIjh5Y976/A9nEhQ9g/YbNUUjwpJO42ccyeM0SrGAjK 9kXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696346428; x=1696951228; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=6W20St9AUDpDFBNyugoMYR8+Qn4dlil3atLZEE5i40k=; b=Y5nOnUKbUtyDgdeNORhs3VNIFqkpWd5ZSEpUW7VEzy0wunOiSDbGxHKG6EvpSi9SuT i4NfaNsuBC5Rec0JUt+mjwxScAX6iwbGJtbL/njzXBNCxSYI8i+PBxxZQDGpRvmygrPr qlWttRS5a1mvdWBRlpuyHvec9n+DSksNlHP/jnSkISlhcVsNXEN+fyfFQPDAEslkzYgj c4o571f+AtghwkaXuCNngVGRq0fxsra8zmLwXXJ/DbIKLzKrJvLGS942XKc3zER4dywm DqMuVrUhUBZl+Y7D2PReTjDqrASDMpAibuRf1b1yiR23tF4fa3VdAJIiGPxrbP9Fba5+ MT/w== X-Gm-Message-State: AOJu0YyZBt8nh5EF+VNAsdiBo9Vg2CO4lX2pbuUvZMdVm9m0A6ESFWUr AGL7Hv8pEyDvITPpI6ueEI4= X-Received: by 2002:a05:6512:10cd:b0:503:5d8:da33 with SMTP id k13-20020a05651210cd00b0050305d8da33mr14322552lfg.20.1696346427546; Tue, 03 Oct 2023 08:20:27 -0700 (PDT) Received: from mobilestation ([178.176.56.174]) by smtp.gmail.com with ESMTPSA id u25-20020ac248b9000000b0050318721b62sm223813lfg.6.2023.10.03.08.20.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 08:20:27 -0700 (PDT) Date: Tue, 3 Oct 2023 18:20:23 +0300 From: Serge Semin To: =?utf-8?B?S8O2cnk=?= Maincent Cc: Cai Huoqing , Manivannan Sadhasivam , Vinod Koul , Gustavo Pimentel , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, Thomas Petazzoni , Herve Codina Subject: Re: [PATCH v2 4/5] dmaengine: dw-edma: HDMA: Add sync read before starting the DMA transfer in remote setup Message-ID: <2yh3lus7qqhvewva6dr4p2g7azbgov4ls57xvzefbrw24h2t7m@cbx26pwj73zn> References: <20231003121542.3139696-1-kory.maincent@bootlin.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20231003121542.3139696-1-kory.maincent@bootlin.com> X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 03 Oct 2023 08:20:47 -0700 (PDT) On Tue, Oct 03, 2023 at 02:15:42PM +0200, K?ry Maincent wrote: > From: Kory Maincent > > The Linked list element and pointer are not stored in the same memory as > the HDMA controller register. If the doorbell register is toggled before > the full write of the linked list a race condition error can appears. > In remote setup we can only use a readl to the memory to assured the full > write has occurred. > > Fixes: e74c39573d35 ("dmaengine: dw-edma: Add support for native HDMA") > Signed-off-by: Kory Maincent > --- > > Changes in v2: > - Move the sync read in a function. > - Add commments Note you need to resubmit the entire series if any of its part has changed. So please add these patches to your patchset (in place of the 4/5 and 5/5 patches I commented) and resend it as v3. -Serge(y) > --- > drivers/dma/dw-edma/dw-hdma-v0-core.c | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) > > diff --git a/drivers/dma/dw-edma/dw-hdma-v0-core.c b/drivers/dma/dw-edma/dw-hdma-v0-core.c > index 0cce1880cfdc..9109dd6c2e76 100644 > --- a/drivers/dma/dw-edma/dw-hdma-v0-core.c > +++ b/drivers/dma/dw-edma/dw-hdma-v0-core.c > @@ -221,6 +221,20 @@ static void dw_hdma_v0_core_write_chunk(struct dw_edma_chunk *chunk) > dw_hdma_v0_write_ll_link(chunk, i, control, chunk->ll_region.paddr); > } > > +static void dw_hdma_v0_sync_ll_data(struct dw_edma_chunk *chunk) > +{ > + /* > + * In case of remote HDMA engine setup, the DW PCIe RP/EP internals > + * configuration registers and Application memory are normally accessed > + * over different buses. Ensure LL-data reaches the memory before the > + * doorbell register is toggled by issuing the dummy-read from the remote > + * LL memory in a hope that the posted MRd TLP will return only after the > + * last MWr TLP is completed > + */ > + if (!(chunk->chan->dw->chip->flags & DW_EDMA_CHIP_LOCAL)) > + readl(chunk->ll_region.vaddr.io); > +} > + > static void dw_hdma_v0_core_start(struct dw_edma_chunk *chunk, bool first) > { > struct dw_edma_chan *chan = chunk->chan; > @@ -251,6 +265,9 @@ static void dw_hdma_v0_core_start(struct dw_edma_chunk *chunk, bool first) > /* Set consumer cycle */ > SET_CH_32(dw, chan->dir, chan->id, cycle_sync, > HDMA_V0_CONSUMER_CYCLE_STAT | HDMA_V0_CONSUMER_CYCLE_BIT); > + > + dw_hdma_v0_sync_ll_data(chunk); > + > /* Doorbell */ > SET_CH_32(dw, chan->dir, chan->id, doorbell, HDMA_V0_DOORBELL_START); > } > -- > 2.25.1 >