From patchwork Tue Nov 14 14:55:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinan Kaya X-Patchwork-Id: 10057815 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C7B3F601D3 for ; Tue, 14 Nov 2017 14:55:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF56829740 for ; Tue, 14 Nov 2017 14:55:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B41832977C; Tue, 14 Nov 2017 14:55:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3F83D29740 for ; Tue, 14 Nov 2017 14:55:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=cRB8NbJVDB9mLFxMJImsH/03VlknDRd15ZTpXfne7no=; b=QXo JjsLOxQDXd+q6r+HjHsRT5gHpVsPCPBBBGPgANrgn+wVrVQ7lX5aCdHYWmNksKhvwwedN092dc8Nl wC9aaz0TMR7x8+NqLBnJMqJXUa8kpJ/Dl1pVSXWw91LnwsPq58OFYHQ5mqrixzS39eiEKKErnIBWw eJpgXc+DffBvc4jufkvVhwND114IFtpqIqIvROIKs3FsAaK/PnkP3SMCwT0FBVUAx8kL6qW8mwqaY mmLk34sHiY+ga5AEIqbbOLVvfjY3hHv0p7sskFE2j6jGlTmiB7ff0jTbpFD/KK9i5cFjRinf1BU3C DToCKYS4r1TqXPsOD4lqS/7Z1TF2bRQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eEccc-00013G-QJ; Tue, 14 Nov 2017 14:55:30 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eEccZ-0000wo-Fx for linux-arm-kernel@lists.infradead.org; Tue, 14 Nov 2017 14:55:29 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id BF2716080B; Tue, 14 Nov 2017 14:55:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1510671306; bh=cY1oNgvHVKa8jvz7vLmgGccuY+5EhLCStIZ9RBPLneM=; h=From:To:Cc:Subject:Date:From; b=RWlEnxjVrtc1W6ZZukMvV0k8n9IuZ6GAnmEHAkCLdLhirbM8dxd5/C9XTSXx0ymSx 7cSVREmwiL4gNmGLa3gRtuZbapPl3DB0zMy0Fj/0guDudEiZVQpgEsi/Q7Du/m7TXl 5Kpu5ZWdVqtEKMA9kz6a7YjQQqAci0K103eNe6Uw= Received: from drakthul.qualcomm.com (global_nat1_iad_fw.qualcomm.com [129.46.232.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: okaya@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 802EC60265; Tue, 14 Nov 2017 14:55:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1510671306; bh=cY1oNgvHVKa8jvz7vLmgGccuY+5EhLCStIZ9RBPLneM=; h=From:To:Cc:Subject:Date:From; b=RWlEnxjVrtc1W6ZZukMvV0k8n9IuZ6GAnmEHAkCLdLhirbM8dxd5/C9XTSXx0ymSx 7cSVREmwiL4gNmGLa3gRtuZbapPl3DB0zMy0Fj/0guDudEiZVQpgEsi/Q7Du/m7TXl 5Kpu5ZWdVqtEKMA9kz6a7YjQQqAci0K103eNe6Uw= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 802EC60265 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=okaya@codeaurora.org From: Sinan Kaya To: dmaengine@vger.kernel.org, timur@codeaurora.org Subject: [PATCH] dmaengine: qcom_hidma: check pending interrupts Date: Tue, 14 Nov 2017 09:55:01 -0500 Message-Id: <1510671301-23223-1-git-send-email-okaya@codeaurora.org> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171114_065527_625267_2A2717E3 X-CRM114-Status: GOOD ( 11.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sinan Kaya , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Driver is missing the interrupts if two requests are queued up at the same time as the interrupt handler is servicing a request that was just delivered. The ISR clears the interrupt at the end but it could be clearing the interrupt for an outstanding event. Therefore, second interrupt never arrives. Clear the interrupt first and then check for completions. Also, make sure that request start and interrupt clear do not overlap in time by using a spinlock. Signed-off-by: Sinan Kaya --- drivers/dma/qcom/hidma_ll.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/dma/qcom/hidma_ll.c b/drivers/dma/qcom/hidma_ll.c index 4999e26..7c6e2ff 100644 --- a/drivers/dma/qcom/hidma_ll.c +++ b/drivers/dma/qcom/hidma_ll.c @@ -393,6 +393,8 @@ static int hidma_ll_reset(struct hidma_lldev *lldev) */ static void hidma_ll_int_handler_internal(struct hidma_lldev *lldev, int cause) { + unsigned long irqflags; + if (cause & HIDMA_ERR_INT_MASK) { dev_err(lldev->dev, "error 0x%x, disabling...\n", cause); @@ -410,6 +412,10 @@ static void hidma_ll_int_handler_internal(struct hidma_lldev *lldev, int cause) return; } + spin_lock_irqsave(&lldev->lock, irqflags); + writel_relaxed(cause, lldev->evca + HIDMA_EVCA_IRQ_CLR_REG); + spin_unlock_irqrestore(&lldev->lock, irqflags); + /* * Fine tuned for this HW... * @@ -421,9 +427,6 @@ static void hidma_ll_int_handler_internal(struct hidma_lldev *lldev, int cause) * Try to consume as many EVREs as possible. */ hidma_handle_tre_completion(lldev); - - /* We consumed TREs or there are pending TREs or EVREs. */ - writel_relaxed(cause, lldev->evca + HIDMA_EVCA_IRQ_CLR_REG); } irqreturn_t hidma_ll_inthandler(int chirq, void *arg)