Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp6004577rwi; Tue, 18 Oct 2022 07:03:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4XChKKnqQ00umQXgJ6laBbj8nzdInMdOUgLM5JTRhb1nudunbTY6OhYYQ1UQBEREqPSQfc X-Received: by 2002:a17:907:1c01:b0:78d:eb6e:3807 with SMTP id nc1-20020a1709071c0100b0078deb6e3807mr2529564ejc.481.1666101801044; Tue, 18 Oct 2022 07:03:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1666101801; cv=pass; d=google.com; s=arc-20160816; b=fyjPkuEm4FasbH9b6GGDoVi/0JxwBw96NykXWnwgpyjK1aAI8wKhNJyK6NIn1J1iai R5X1a4GalSeqzZFgB/k4LzkTxdbKMEumug91KnEDJlgob8ZL+/X1dZlT6fSiIlX0ZgLU IXow+ESsThvoXdk/xel5CQU7yHy9ohVR46OGH2RsDt31nLV+EpOqTLTB/BLMFofe8V8P GfWka9MyM8gwIQZBT4SQ59Iax4LG2EmdzdOHUJ7zfpgs6Q12tismG6ewbfMEWMaPBbFM vocsB/OjV/VlYK93f5HUauboquAQinI0meG0X0bf0hNptivlserkyK0jQoGZbyvG2B4/ xxtw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:to:content-language:subject:user-agent :date:message-id:dkim-signature; bh=8x+/DrsDzZlrY6ElNbdNmsKQfbN+FxFZi1SdQpc++Lo=; b=C0Fzvz/tlQlOHZr1Xl5cc0gTzic1P+mDt/IAA6EiKpKWdG02JQ4CaaDQqNQUHU7g/8 zK0pzoZfCs+68QNGxoYhCx5F4gIMFdOWMq22BDfrhz37I+ZQuOgDDZyQGghMp0x9yfZY eNgSVwO7QIVAXuLwcMnftxUDWw73p4c0FXxazM3M/BokSEWzyUGzNulvQKa35u9FyF7M VUmzKlPZiCATx6UMq3Y+Ja41YWLhqM7bG/HxVwWGvqbA6rxo81M3uO+756KgvP2nlIVe OMfd9AIZxGo4f/jp0g3lefpyIcE//opFvX9az61xf86XYow2W9OjlPQkRjO3f2BaRMFJ eUyQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b="quuA/OfK"; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r5-20020aa7cfc5000000b0044ec8b62ee3si10514752edy.120.2022.10.18.07.02.38; Tue, 18 Oct 2022 07:03:21 -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=@Nvidia.com header.s=selector2 header.b="quuA/OfK"; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230355AbiJRNTJ (ORCPT + 99 others); Tue, 18 Oct 2022 09:19:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230348AbiJRNS7 (ORCPT ); Tue, 18 Oct 2022 09:18:59 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2083.outbound.protection.outlook.com [40.107.94.83]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DBCFC787E; Tue, 18 Oct 2022 06:18:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RHc705cu/17BG9LoljACLdctslky+9LHWIgUIf1Kmp1LdBkYecqN0bN/6ingcablxexeK569y1/9pCGikZmXZlLSUsNP2JJpUKyToffL+ufDgIhvWWjwvDRk83twRDafEFtg6UGor40+h1zltz9TCRKKfVbDqdFR/hy9GY53JBcEQd+qCd5sV9MANHI4+OWxNlcTF/fHmv6tJGAvmPYuuwpN2x5jawQiuYgSNR3mMNvklBUgVzBnUk1/F+9YphvbJay9vvTsDPOO+wDijfT2ny4ljULqFbyEYd0nvDiib7B+Gk3IiNIoWRNwDd/+npAn9dYshVGnDPx6XeA7b16jIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8x+/DrsDzZlrY6ElNbdNmsKQfbN+FxFZi1SdQpc++Lo=; b=e4Z4yrWLDTsFh4nhudNeNGj6lrW0ZaGiaZwh5/X1CacbIjK53SWymatn0EnXuo0lv4bOaH5vp2qG5+m4vjuWGbIvOvVyOVUMYcbBzuIy4a9V4aVeYmHFosyu7eg58C/lHsxDwqokAoUYZjHc3bhKRxM0FyfS1lIUX0Fz1QAWpDTri77NAGV0zRUYuXn4m6VTUg5RZHzHr8dxdb/+zG4AtCGeVYVCymjULcoQyWUeym/imKyGWgyG/5hZDtouzlfwlo8UJv3spUmfApqt1BgkOHJw38ysw2h0BLDSRZl0nlS6Djj5MI9SKXSZaIeG9PlJl2kUEfa8syrigwXWYTa6BA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8x+/DrsDzZlrY6ElNbdNmsKQfbN+FxFZi1SdQpc++Lo=; b=quuA/OfKjg8cXg7LgXcYVDOk+1NFsef7Ml+6Aw/3I4VwWkMdlPYept3XxpKR86POmZ4wtMCMxTsgRAPysL8u7SJx7v4yt/B1qsQ5riGGlR1KbEjvD18ipJfqrOf0J4FkNS76VgfKXaUNdh4IQZF20r4+YO9u158rTV4dlveBpIhr3l2PDCRiFZvAUoYMxqwC5vPNpMkFyGicNmASh4ukvMLqgq0qrH6G7XJM7C9G7NI43z121vy3B5HZG3MEcPVAgrYT8TQBS8OU5O12BcRSbCsVIs9e3oRnwWsUHQFoNIfwO5uKauBg60TdQBHQYdBtQIw1vqPhYYx96QPig6dJmg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from CO6PR12MB5444.namprd12.prod.outlook.com (2603:10b6:5:35e::8) by MW3PR12MB4537.namprd12.prod.outlook.com (2603:10b6:303:5b::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.32; Tue, 18 Oct 2022 13:18:56 +0000 Received: from CO6PR12MB5444.namprd12.prod.outlook.com ([fe80::c0e5:f111:3e59:7c66]) by CO6PR12MB5444.namprd12.prod.outlook.com ([fe80::c0e5:f111:3e59:7c66%5]) with mapi id 15.20.5723.033; Tue, 18 Oct 2022 13:18:56 +0000 Message-ID: <5935afbd-ec39-21f8-1585-57a932261271@nvidia.com> Date: Tue, 18 Oct 2022 14:18:49 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [PATCH] serial: tegra: read DMA status before terminating Content-Language: en-US To: Kartik , ldewangan@nvidia.com, gregkh@linuxfoundation.org, jirislaby@kernel.org, thierry.reding@gmail.com, swarren@nvidia.com, akhilrajeev@nvidia.com, linux-serial@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org References: <1666074311-12764-1-git-send-email-kkartik@nvidia.com> From: Jon Hunter In-Reply-To: <1666074311-12764-1-git-send-email-kkartik@nvidia.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P123CA0036.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:151::23) To CO6PR12MB5444.namprd12.prod.outlook.com (2603:10b6:5:35e::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO6PR12MB5444:EE_|MW3PR12MB4537:EE_ X-MS-Office365-Filtering-Correlation-Id: 1d850f56-2a67-4c6b-9ffe-08dab10b4f3c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WuTm9bLMDbolm4CFvrWXOxwsEZyxc6k9G2y2pciHoZB/ChOuNV3okqkiYdN2m4NiayY1wdj7E0VY0OwN2ScmRLGNUBasujgnATlTDq5XInD/dOuoKTALyHeP41j3+Q54avhlsUXzrY/h5bVtSb6hkpkmnrRoAFHhlUAOYo7Q8FyP3IvAIIyhK2uGmUxHGKNkVTErIu3aV4kR+SWxte/M9XGSXk5SFcv4bBhHif3uNYl2lFBSuU+nL2NIlIsHYUvWcV6nGxXN/7ebHVg3cS0Frov7t/GLyWI81kt7dfTeBqGJQd0IkWntg+AjQNKX98g64+cC3bT0WQKPeQ07mPMg5ssk0t/TimCj68WSBZVdNCDMl5ZEnJpWAVu4zcc7YRCihpKQG42dBU52rsA6z9IaZAVdY9BVQBTBL/FsZ130UxAI0aY10YzNQzeQXN/9Alwl6oCXvrt+zUewN68KWzKNtSBJIViDZv/YrPm7MTyBpYWGGvSvVst4MI/9JcOY7FiYtc6SIwyGsB3Y+bdQ3YxQDEnYbadTuu5tNYU4H5Atpkqds4UK7xNFW715Ah19G3D01OO66mXeyEQevx/Kw0bYCCfHtRdRSCKOK+6p34tIust8hTYgpgYHHKw+6af5LpNT0lUAKT1JtVizLGDJHDHXeDdcSo4H0H57tAM8cm/SEvwjTIYvrts6VRtZIy5nZtZ7XdWUnjEUHsC0DaoxrEgkZdMOkDs5qYO+CGlEmK0XIxMvgZR8H12MivJLPT2ePmT12j5eVnxN5WockBzkGelOkUAhj24S8p7yzHY1mqMCL9s4brxNzB7C53b9dvbjTFC+ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CO6PR12MB5444.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(366004)(396003)(346002)(39860400002)(376002)(136003)(451199015)(83380400001)(921005)(36756003)(86362001)(31696002)(38100700002)(6666004)(66556008)(316002)(31686004)(5660300002)(66476007)(8936002)(186003)(6486002)(2906002)(2616005)(66946007)(6506007)(478600001)(6512007)(26005)(41300700001)(8676002)(55236004)(53546011)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?QU1Tc3M0RUJYSDV2ZzBzWXhFSEhjRitNQ0Vwano4NEhJT1J2U25ORUc5OUNu?= =?utf-8?B?Um1TNUJtT1RxUjY0ZUlka1dYT0NiTkpKdXRNWG1pREhWa1QrSGJ0emJVVlRO?= =?utf-8?B?VlN0aTc4aFdDaUVEQ1NrQ0xBNVNaMjFiQStnMk00N1JQVlFldFlPdnBPTzJa?= =?utf-8?B?dlFORU9FYXpJMkRNMysrSGVvRTYzM1hxbEY2RVJDMjVhQlpHRmpqcmR2bjFU?= =?utf-8?B?a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bTkrUm9ZU0dqT0xPNlV0b0Y5Qmhz?= =?utf-8?B?L2FwNDk4ZGpNQWpOVHRpN0U3UGtNWXBVZUpIZFNnTjFPUVRYL1RhcXRXTTlN?= =?utf-8?B?Rk5ZajZjUzFPK1ZpdmhEckVROTI2NU5UbGYraE9nd1A4ZEFSN2ZNMVdvK09w?= =?utf-8?B?bGc9PQ==?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1d850f56-2a67-4c6b-9ffe-08dab10b4f3c X-MS-Exchange-CrossTenant-AuthSource: CO6PR12MB5444.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 13:18:56.0987 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: En6jpPa21fOssVmsAhe7zMH/yH0/STmuZ9m9hP2bhCmFOUef7AhfcM3Od1aM1wu4VnK/7aSdgqUXKd9/9F3FwQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4537 X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_NONE autolearn=no 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 On 18/10/2022 07:25, Kartik wrote: > To get the valid data, read DMA status before terminating the DMA. As > dmaengine_terminate_all() deletes the DMA desc. > > Fixes: e9ea096dd225 ("serial: tegra: add serial driver") > > Signed-off-by: Akhil R > Signed-off-by: Kartik > --- > drivers/tty/serial/serial-tegra.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/tty/serial/serial-tegra.c b/drivers/tty/serial/serial-tegra.c > index b7170cb9a544..2779b4491f02 100644 > --- a/drivers/tty/serial/serial-tegra.c > +++ b/drivers/tty/serial/serial-tegra.c > @@ -619,8 +619,8 @@ static void tegra_uart_stop_tx(struct uart_port *u) > if (tup->tx_in_progress != TEGRA_UART_TX_DMA) > return; > > - dmaengine_terminate_all(tup->tx_dma_chan); > dmaengine_tx_status(tup->tx_dma_chan, tup->tx_cookie, &state); > + dmaengine_terminate_all(tup->tx_dma_chan); The change looks fine to me, but on further review of other similar drivers I see that they pause first ... dmaengine_pause(tup->tx_dma_chan); dmaengine_tx_status(tup->tx_dma_chan, tup->tx_cookie, &state); dmaengine_terminate_all(tup->tx_dma_chan); This makes sense so that when we calculate the amount of the data transferred we get the exact amount. Can we add a pause while we are at it? Thanks! Jon -- nvpublic