Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758902AbbLBTEM (ORCPT ); Wed, 2 Dec 2015 14:04:12 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:42915 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751209AbbLBTEJ (ORCPT ); Wed, 2 Dec 2015 14:04:09 -0500 Subject: Re: [PATCH V7 3/3] dma: add Qualcomm Technologies HIDMA channel driver To: Vinod Koul References: <1448245707-27499-1-git-send-email-okaya@codeaurora.org> <1448245707-27499-4-git-send-email-okaya@codeaurora.org> <20151130085948.GC3901@localhost> <565CAC4C.7080909@codeaurora.org> <20151201113458.GL3901@localhost> <565E0E1D.1040505@codeaurora.org> Cc: dmaengine@vger.kernel.org, timur@codeaurora.org, cov@codeaurora.org, jcm@redhat.com, agross@codeaurora.org, arnd@arndb.de, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org From: Sinan Kaya Message-ID: <565F40A5.2040701@codeaurora.org> Date: Wed, 2 Dec 2015 14:04:05 -0500 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <565E0E1D.1040505@codeaurora.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2076 Lines: 49 On 12/1/2015 4:16 PM, Sinan Kaya wrote: >>>> >>> >>>>> >>>> +static enum dma_status hidma_tx_status(struct dma_chan *dmach, >>>>> >>>> + dma_cookie_t cookie, struct dma_tx_state *txstate) >>>>> >>>> +{ >>>>> >>>> + struct hidma_chan *mchan = to_hidma_chan(dmach); >>>>> >>>> + enum dma_status ret; >>>>> >>>> + >>>>> >>>> + if (mchan->paused) >>>>> >>>> + ret = DMA_PAUSED; >>>> >>> >>>> >>> This is not quite right. The status query is for a descriptor and NOT for >>>> >>> channel. Here if the descriptor queried was running then it would be paused >>>> >>> for the rest pending txn, it would be DMA_IN_PROGRESS. >>> >> >>> >> The channel can be paused by the hypervisor. If it is paused, then no >>> >> other transaction will go through including the pending requests. That's >>> >> why, I'm checking the state first. >> > >> > You are missing the point. Channel can be paused, yes but the descriptor >> > is in queue and is not paused. The descriptor running is paused, yes. >> > There is subtle difference between these > I'll follow your recommendation. PAUSE for the currently active > descriptor and DMA_IN_PROGRESS for the rest. > I'm now confused. I looked at several DMA driver implementations. 1. They call dma_cookie_status function to see if the job is done. 2. If done, they return right ahead. 3. Otherwise, dma_cookie_status returns DMA_IN_PROGRESS. 4. Next the code checks if the channel is paused and return value is DMA_IN_PROGRESS. The code changes return code to DMA_PAUSED. Whereas, I was returning paused first before even checking if the descriptor is done. Are you OK with the sequence 1..4 above? -- Sinan Kaya Qualcomm Technologies, Inc. on behalf of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/