Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp472515lqt; Fri, 19 Apr 2024 01:02:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUUBfKmcKsX/rNb8yzExq+sjjF1sykC8CwGS8wewaLM2cq4C6YgOlDhrk4bNipJnK8IoR26sztz+DA3weq1NhXBxdvYZ8UsZmfb0xzPBw== X-Google-Smtp-Source: AGHT+IHz5q4BvUCztWLsmurDXV9HOR7NTghuhCvgsp6b3qVsQEwqGwS4wwHcpLoNbYeZf1Y/kplW X-Received: by 2002:a17:903:25cb:b0:1e2:ac38:2657 with SMTP id jc11-20020a17090325cb00b001e2ac382657mr1241028plb.24.1713513759536; Fri, 19 Apr 2024 01:02:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713513759; cv=pass; d=google.com; s=arc-20160816; b=cBuZGwooUcf25FMlts5xlRvbo1Kz9+xP9Cpxv9yg3yFePmnXvo+kFQRMkYVsf9pVJ7 29qZHQSuJ9CZQK9WiPhYfnHKweMxZKB/tcECNb0VXgUTDYAtMFDNrcnBn//RZ0h2x1NM Mp/wkpG8nP8PBebb5gYdguJjnCU3bNrE/bqSNWI3uVLRDrjq3lkCmrlZhL7TgRdogwE+ 8d2OmdhkJAZ8xFp9Oh31k5JwA80XYj7NAK+hpAsOjOLOsqnBQlcJrTAuvVlC08+MZ2+8 sHIt7KLd2+Q8qww0dv9WqdsNTBSoaFlOvwTvbB6Y4VCb/nGMsDUAiXdnhByRFRhBlOhV FibA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:cms-type:content-transfer-encoding:in-reply-to:from :content-language:cc:to:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature:dkim-filter; bh=J9bihqNNeBouBSVdYnB6FnDBnwZNOKQIvLcjL9JmkYw=; fh=9kb7XvmYHViIRK1l/9SKeNovLfHwTB3ZKeL9uz6et1E=; b=E2qFV0oyal5Qs//jfds/7o77DDN5rSxvgofTO2gsRhKyvDgOMD+9Z9WYnMH7WCtbSa 7ycOcuTg41h8Q3UEse/lq6yRDHoogxcQ6P6dGcnJyOdqTsgpL05ZZok2nH4J5YCpIGOr 5YMMFaTjFisNeSuvAhhBGn5Bq+IXC5CiayQGw89io/WdoeHYpTl2amY0Fhdyes7u5vXc tB6a7w0IHnSrU+mWEbbcQVbtyLwk2Tu3Rt2282tI0zYYvyFIMlKgfHEZ11Rj4ufOOwsZ Ui7bUqYQvZUujDwbEPFNahazp7A5JIs6fZEYN0h7fIW+0KE4AauhvVGvpYfIdaK51IvA bCMw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=gBW0EeNi; arc=pass (i=1 spf=pass spfdomain=samsung.com dkim=pass dkdomain=samsung.com dmarc=pass fromdomain=samsung.com); spf=pass (google.com: domain of linux-kernel+bounces-151139-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151139-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id z5-20020a170902708500b001e3e1e5f00bsi2793822plk.112.2024.04.19.01.02.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 01:02:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-151139-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=gBW0EeNi; arc=pass (i=1 spf=pass spfdomain=samsung.com dkim=pass dkdomain=samsung.com dmarc=pass fromdomain=samsung.com); spf=pass (google.com: domain of linux-kernel+bounces-151139-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151139-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id AFD03B216E1 for ; Fri, 19 Apr 2024 08:01:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4DEB74CB45; Fri, 19 Apr 2024 08:00:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="gBW0EeNi" Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 38C983E485 for ; Fri, 19 Apr 2024 08:00:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.118.77.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713513657; cv=none; b=W0yAMJU2m2cvns/Ak5BZGFTPA5oz89Ryfqu9R+U7oxQkPNtNCs0qW0uagOXxH51O43QAMUQRGq//6esQ/wk59RHrTQjePv4UMkEouU0NcUcdrJ0QrgqiravWkiAY484EhaSyYei1oMjbJ0ZC5KDf2Jfj5kFSYkVT3nTSlGf0qhA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713513657; c=relaxed/simple; bh=AgrdqcfcVenz/u2x8vvoZSIcULG4CY5K/v+Edvos+bU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:From:In-Reply-To: Content-Type:References; b=M2lRJxB0KT4dsoOzdPGtSDVK0CtSnu9tsoHZYHcCXoUKEoSnDv9JPpdkNSClEBcSaJWyiPs/dyc8IuLqba63bRkeeee7q7OeI0TA+l/lHlLpB9qwuxRMdPxCOb5ARmwrrg5ouqiG659Ubk9KRUTUtiR5Ctsl3ZZsv92L5j8iIPk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=gBW0EeNi; arc=none smtp.client-ip=210.118.77.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20240419080048euoutp01eb15e156885f5f0ec3fe9cb106e4bf94~Hn5WxhkxF1076610766euoutp01K for ; Fri, 19 Apr 2024 08:00:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20240419080048euoutp01eb15e156885f5f0ec3fe9cb106e4bf94~Hn5WxhkxF1076610766euoutp01K DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1713513648; bh=J9bihqNNeBouBSVdYnB6FnDBnwZNOKQIvLcjL9JmkYw=; h=Date:Subject:To:Cc:From:In-Reply-To:References:From; b=gBW0EeNiw1nnZA5YaD7ATlgFadq/boYP+dQhquA3i4syUWnxNENtPHg4aovQSzg0I qaMVUZmAZIRtuuWz/u2mUPL7dinx3KF+IscS8Y/8AXX5dhL7Si976oZ+5bqa6CTs35 SJjtKRu19SjF2GyjxbmmmnZrk7JJ0L8ZSR55gBCg= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20240419080048eucas1p19edea2062fc38a56d38e09d4fdc612bb~Hn5WbO-MQ2067220672eucas1p1u; Fri, 19 Apr 2024 08:00:48 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 5E.95.09875.0B422266; Fri, 19 Apr 2024 09:00:48 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20240419080047eucas1p2c8bf21f4654b592ec250f04c76eee380~Hn5WIvRYQ2267722677eucas1p2b; Fri, 19 Apr 2024 08:00:47 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20240419080047eusmtrp20f97472dc91695be666a2963f1cac9d7~Hn5WIH6_s2364823648eusmtrp2r; Fri, 19 Apr 2024 08:00:47 +0000 (GMT) X-AuditID: cbfec7f4-11bff70000002693-9c-662224b0da16 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 5A.E1.08810.FA422266; Fri, 19 Apr 2024 09:00:47 +0100 (BST) Received: from [106.210.134.192] (unknown [106.210.134.192]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20240419080047eusmtip28a71cb280150640c6b7b24ddda1a9e4a~Hn5VnrEMi0746207462eusmtip29; Fri, 19 Apr 2024 08:00:47 +0000 (GMT) Message-ID: Date: Fri, 19 Apr 2024 10:00:47 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 11/15] tty: msm_serial: use dmaengine_prep_slave_sg() To: Jiri Slaby , gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Bjorn Andersson , Konrad Dybcio , linux-arm-msm@vger.kernel.org, Anders Roxell Content-Language: en-US From: Marek Szyprowski In-Reply-To: Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprNKsWRmVeSWpSXmKPExsWy7djPc7obVJTSDM6sZLW4NeU3k8W2DhuL 5sXr2SzezZWx6Ji8ncVi4v6z7BaXd81hszizuJfdgcNj06pONo871/aweeyfu4bd4/MmuQCW KC6blNSczLLUIn27BK6MA3/3MBc84a/oWHqRsYFxAm8XIyeHhICJRMeEs+wgtpDACkaJE1c0 uhi5gOwvjBJ/+6ayQDifGSVerr/ACNPR3raGFSKxnFHizuKdUFUfGSWe3rgBlOHg4BWwk/jX Eg3SwCKgKvH2yHSwFbwCghInZz5hAbFFBeQl7t+aARYXFvCUeNpymxmkVUTAUaL1bzXISGaB u4wSM3ZvZQOpYRYQl7j1ZD4TiM0mYCjR9bYLLM4JtGrdxbvMEDXyEs1bZzODNEsI3OGQWHNo PjvE1S4Sv+euZYKwhSVeHd8CFZeR+L8TZChIQzujxILf96GcCYwSDc9vQf1sLXHn3C82kPOY BTQl1u/Shwg7SszZcQvsYQkBPokbbwUhjuCTmLRtOjNEmFeio00IolpNYtbxdXBrD164xDyB UWkWUrDMQvLmLCTvzELYu4CRZRWjeGppcW56arFRXmq5XnFibnFpXrpecn7uJkZg+jn97/iX HYzLX33UO8TIxMF4iFGCg1lJhNeMQzFNiDclsbIqtSg/vqg0J7X4EKM0B4uSOK9qinyqkEB6 YklqdmpqQWoRTJaJg1OqgSm779TvgKj1lcV9jNcalhue/7r0yTaxe4vTtEX3TbslNFnzbYhS zT39JK7py3J8g+f2nE44r70htGZCqpzgrtrPOi/qnXaWrLu7a+n5J8Yq9mdKv9UFzf8QxaK2 /arEnOuv5p+4svrt6bMCpztW3plXF83J6B+w++nf8IiVv8OfJLlmtmcfi9rf+Drs62X21ffN LoZui11jX+FQ/Um231HL3yjLue2uxh5nxUfvCzhOFdYJLyxev/KKw+qEgqdWnPu2HTt0SXsL y+p5LpkB1vnLn/8XiVmZ2Lmm0/nW5zu7Tv65vJX3/u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u4 T4xn/VqNyH9FHJNXK7EUZyQaajEXFScCAICzG1BBAwAA X-CMS-MailID: 20240419080047eucas1p2c8bf21f4654b592ec250f04c76eee380 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20240415211716eucas1p10050cc8d4024707dd6f6331111cd3ce1 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20240415211716eucas1p10050cc8d4024707dd6f6331111cd3ce1 References: <20240405060826.2521-1-jirislaby@kernel.org> <20240405060826.2521-12-jirislaby@kernel.org> <54679d54-3957-489d-a8b5-b98ea1c8a93c@kernel.org> <0335b679-da36-42c1-a1ba-8affb7a98d44@samsung.com> <783c05cd-0cd2-4b0e-9dce-2a9fdfee7c74@kernel.org> <8947962f-e39e-4e96-9d1e-691e40d49349@kernel.org> On 19.04.2024 09:53, Jiri Slaby wrote: > On 19. 04. 24, 9:43, Jiri Slaby wrote: >> On 17. 04. 24, 14:45, Marek Szyprowski wrote: >>> I alse tried to change the "if (dma->mapped)" check in >>> msm_start_tx() to: >>> >>> 1. if (dma->tx_sg.length) >>> >>> 2. if (dma->tx_sg.page_link & ~SG_PAGE_LINK_MASK) >>> >>> but none of the above worked what is really strange and >>> incomprehensible >>> for me. >>> >> >> Aaaah, nevermind, what about this? >> >> Two bugs: >> 1) dma_map_sg() returns the number of mapped entries. Not zero! >> 2) And I forgot to zero tx_sg in case of error. >> >> --- a/drivers/tty/serial/msm_serial.c >> +++ b/drivers/tty/serial/msm_serial.c >> @@ -506,8 +506,8 @@ static int msm_handle_tx_dma(struct msm_port >> *msm_port, unsigned int count) >>          kfifo_dma_out_prepare(&tport->xmit_fifo, &dma->tx_sg, 1, >> count); >> >>          ret = dma_map_sg(port->dev, &dma->tx_sg, 1, dma->dir); >> -       if (ret) >> -               return ret; >> +       if (!ret) > > Still wrong, ret = -EIO missing in here. "if (ret <= 0)" seems to be better here. Indeed this fixed the issue. I checked the code many times, but I missed this dma_map_sg() return value issue. Tested-by: Marek Szyprowski > >> +               goto zero_out; >> >>          dma->desc = dmaengine_prep_slave_sg(dma->chan, &dma->tx_sg, 1, >>                                                  DMA_MEM_TO_DEV, >> @@ -548,6 +548,7 @@ static int msm_handle_tx_dma(struct msm_port >> *msm_port, unsigned int count) >>          return 0; >>   unmap: >>          dma_unmap_sg(port->dev, &dma->tx_sg, 1, dma->dir); >> +zero_out: >>          sg_init_table(&dma->tx_sg, 1); >>          return ret; >>   } >> >> >> thanks, > Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland