From patchwork Sat Mar 25 23:04:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinan Kaya X-Patchwork-Id: 9644905 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 63A96601D7 for ; Sat, 25 Mar 2017 23:04:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4EFBF26530 for ; Sat, 25 Mar 2017 23:04:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 43A9727FA0; Sat, 25 Mar 2017 23:04:36 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9269F26D05 for ; Sat, 25 Mar 2017 23:04:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751218AbdCYXEc (ORCPT ); Sat, 25 Mar 2017 19:04:32 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:41420 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751164AbdCYXEb (ORCPT ); Sat, 25 Mar 2017 19:04:31 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 1F7E6607A3; Sat, 25 Mar 2017 23:04:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1490483053; bh=KbTrNZBrd+XbSaj0EybuEh5Co3zrYsob0nm2mXfrTzk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Os0Lar/qB2343p7JbyG2syoulOLbSGn6z2JBE31+mRAK5wV8WFLqv28LkhKCB1iu4 PzgE78YpltufTTQyCuxKmZgcRsGyND8IXYJMsrEm1lB9w3X2qPvVUBfLMAX3ovV1HO NQkYIXzcLVkaO22FlPesocGxU38shzhEIAnAeAbU= 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 A985860A4F; Sat, 25 Mar 2017 23:04:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1490483052; bh=KbTrNZBrd+XbSaj0EybuEh5Co3zrYsob0nm2mXfrTzk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n5DYEzI6tApDxPjde/QzyxRFcmPrP8Ofhj+4aKqbb4kNQywZXbEgtB27gZm7eNNtj FjutlP37pO/qhQ9Ca9a0RULm6dMykqshnnW8nOZyHUSFXGu5LjQvlZ9zp+jEEHDiq3 kHhOsLzsusrpGReeDpz30vG2TLCIB7yWyDqqRxng= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org A985860A4F 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 Cc: linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Sinan Kaya , Andy Gross , David Brown , Dan Williams , Vinod Koul , linux-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] dmaengine: qcom_hidma: pause the channel on shutdown Date: Sat, 25 Mar 2017 19:04:03 -0400 Message-Id: <1490483043-4364-2-git-send-email-okaya@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1490483043-4364-1-git-send-email-okaya@codeaurora.org> References: <1490483043-4364-1-git-send-email-okaya@codeaurora.org> Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We need to ensure that all DMAs and interrupts are cleared during shutdown operation in order for kexec to start the next kernel clearly. Otherwise, HW could be performing a DMA into random addresses in the middle of second kernel start. Signed-off-by: Sinan Kaya --- drivers/dma/qcom/hidma.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/dma/qcom/hidma.c b/drivers/dma/qcom/hidma.c index 3c982c9..5072a7d 100644 --- a/drivers/dma/qcom/hidma.c +++ b/drivers/dma/qcom/hidma.c @@ -865,6 +865,20 @@ static int hidma_probe(struct platform_device *pdev) return rc; } +static void hidma_shutdown(struct platform_device *pdev) +{ + struct hidma_dev *dmadev = platform_get_drvdata(pdev); + + dev_info(dmadev->ddev.dev, "HI-DMA engine shutdown\n"); + + pm_runtime_get_sync(dmadev->ddev.dev); + if (hidma_ll_disable(dmadev->lldev)) + dev_warn(dmadev->ddev.dev, "channel did not stop\n"); + pm_runtime_mark_last_busy(dmadev->ddev.dev); + pm_runtime_put_autosuspend(dmadev->ddev.dev); + +} + static int hidma_remove(struct platform_device *pdev) { struct hidma_dev *dmadev = platform_get_drvdata(pdev); @@ -908,6 +922,7 @@ static int hidma_remove(struct platform_device *pdev) static struct platform_driver hidma_driver = { .probe = hidma_probe, .remove = hidma_remove, + .shutdown = hidma_shutdown, .driver = { .name = "hidma", .of_match_table = hidma_match,