Skip to content

Commit

Permalink
dmaengine: qcom_hidma: pause the channel on shutdown
Browse files Browse the repository at this point in the history
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 <okaya@codeaurora.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
  • Loading branch information
Sinan Kaya authored and Vinod Koul committed Mar 27, 2017
1 parent c3a4528 commit dc7c733
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions drivers/dma/qcom/hidma.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -908,6 +922,7 @@ MODULE_DEVICE_TABLE(of, hidma_match);
static struct platform_driver hidma_driver = {
.probe = hidma_probe,
.remove = hidma_remove,
.shutdown = hidma_shutdown,
.driver = {
.name = "hidma",
.of_match_table = hidma_match,
Expand Down

0 comments on commit dc7c733

Please sign in to comment.