Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp235602imn; Wed, 3 Aug 2022 01:30:36 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vsNRaR5c7Wm4sRe+hpj3/eolGA5gey6UQ5iN29xMICrUoHAsN553AsRHoUEmOQi9KOVY4i X-Received: by 2002:a05:6402:5418:b0:435:5a48:daa9 with SMTP id ev24-20020a056402541800b004355a48daa9mr24791342edb.304.1659515435955; Wed, 03 Aug 2022 01:30:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659515435; cv=none; d=google.com; s=arc-20160816; b=xMhtME4+u4eduuvbYYHWM6F5R1CxXAYQ6snowCekRsJG+EudjDEUHTf4m5bJri6q/h +jd2hOcWgOQJ2mxEC33m5QNlifvlAzwjX5I5t0V0M37k+Nk/jW1KFzoaAxJTJp2qGz2u BCttIdyZRw7wFfyqv/O0uszsfRIGca9Hqo8rK54TEups+Qn1pLhSp/4f1k7b1HUIMp3x 27AAqda0iDl842vvEBGQm/DPhdvXBO6bGR/4KWpBhO3QttHDAWK78B5iQX3SDj7CXOZA HaE/cBeuJV2dnfjeoY8kMpT34iw2NYWs+t+HdhEoHlFTxJu3lY/WLsJrbk4k/xYghRwF osgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :content-language:references:cc:to:subject:from:user-agent :mime-version:date:message-id; bh=W9OXZbZFM2eeqzTKTIgKnWHDGnN3c5OzwKybTYM0pAA=; b=Dh/eIre11G/8ddCxgH34b8zDJ7biD7oQaD1odbqEvoR2flsUvsvEB19Fp5B3q/LT0R 6e+HciUruptT/kT+dvSkqTsFJy/kzOO3O7HW0V6UHbBMqZEWtQ1UVHZDrF3lZ5EPmsVk kaffy6q745W9z0Iw+8v3DW71iwGIA02bCsSpLIV2I1K/HUfgKNBf6nu56wjdyxrlvJIa B/NENk0KMZe5RFb2OTkYb/AUUg81tp6xN6b14aV2Lyat4Tgd0IcxvgsYKq71eX0YFY9K qR0kIk8/08bBaE/RcCkYM3/ZjRaHOaVoVeHZI5yPsA1zl/9jx8q0K5QMa1qPMqaSZhkw UcBg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rn9-20020a170906d92900b0070ed5373a2csi12878767ejb.298.2022.08.03.01.30.07; Wed, 03 Aug 2022 01:30:35 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232739AbiHCIQc (ORCPT + 99 others); Wed, 3 Aug 2022 04:16:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237388AbiHCIQX (ORCPT ); Wed, 3 Aug 2022 04:16:23 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CF3A65C1 for ; Wed, 3 Aug 2022 01:16:21 -0700 (PDT) Received: from ptz.office.stw.pengutronix.de ([2a0a:edc0:0:900:1d::77] helo=[127.0.0.1]) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1oJ9Xy-0000MF-BC; Wed, 03 Aug 2022 10:16:06 +0200 Message-ID: Date: Wed, 3 Aug 2022 10:16:03 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 From: Ahmad Fatoum Subject: Re: [PATCH] tty: serial: imx: initialize peripheral_config/peripheral_size for sdma config To: Sherry Sun , gregkh@linuxfoundation.org, jirislaby@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, linux-imx@nxp.com References: <20220803065737.14752-1-sherry.sun@nxp.com> Content-Language: en-US In-Reply-To: <20220803065737.14752-1-sherry.sun@nxp.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 2a0a:edc0:0:900:1d::77 X-SA-Exim-Mail-From: a.fatoum@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS 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 Hello Sherry, On 03.08.22 08:57, Sherry Sun wrote: > Since commit 824a0a02cd74 ("dmaengine: imx-sdma: Add multi fifo support") > adds the use of dma_slave_config->peripheral_config/peripheral_size to > sdma driver, the client drivers like uart need to initialize the > peripheral_config/peripheral_size for sdma, otherwise, the random value > of local variable slave_config may cause unexpected peripheral_config > and make sdma mess up. > If this a fix, please add a Fixes: tag. I am not sure it is though, see below. > Signed-off-by: Sherry Sun > --- > drivers/tty/serial/imx.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c > index 522445a8f666..bb8c2a712e94 100644 > --- a/drivers/tty/serial/imx.c > +++ b/drivers/tty/serial/imx.c > @@ -1320,6 +1320,8 @@ static int imx_uart_dma_init(struct imx_port *sport) This function starts with struct dma_slave_config slave_config = {}; > slave_config.src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE; > /* one byte less than the watermark level to enable the aging timer */ > slave_config.src_maxburst = RXTL_DMA - 1; > + slave_config.peripheral_config = NULL; > + slave_config.peripheral_size = 0; So these are already zero-initialized. > ret = dmaengine_slave_config(sport->dma_chan_rx, &slave_config); > if (ret) { > dev_err(dev, "error in RX dma configuration.\n"); > @@ -1346,6 +1348,8 @@ static int imx_uart_dma_init(struct imx_port *sport) > slave_config.dst_addr = sport->port.mapbase + URTX0; > slave_config.dst_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE; > slave_config.dst_maxburst = TXTL_DMA; > + slave_config.peripheral_config = NULL; > + slave_config.peripheral_size = 0; Not sure if this is required. If preceding dmaengine_slave_config() indeed makes clearing necessary, you should note that in the commit message. Cheers, Ahmad > ret = dmaengine_slave_config(sport->dma_chan_tx, &slave_config); > if (ret) { > dev_err(dev, "error in TX dma configuration."); -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |