Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1609260 > unrolled thread

[PATCH 1/2] dmaengine: qcom_hidma: disable/enable IRQs on pause/resume

Started bySinan Kaya <okaya@codeaurora.org>
First post2017-03-26 00:10 +0100
Last post2017-03-27 07:20 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/2] dmaengine: qcom_hidma: disable/enable IRQs on pause/resume Sinan Kaya <okaya@codeaurora.org> - 2017-03-26 00:10 +0100
    [PATCH 2/2] dmaengine: qcom_hidma: pause the channel on shutdown Sinan Kaya <okaya@codeaurora.org> - 2017-03-26 00:10 +0100
    Re: [PATCH 1/2] dmaengine: qcom_hidma: disable/enable IRQs on  pause/resume Vinod Koul <vinod.koul@intel.com> - 2017-03-27 07:20 +0200

#1609260 — [PATCH 1/2] dmaengine: qcom_hidma: disable/enable IRQs on pause/resume

FromSinan Kaya <okaya@codeaurora.org>
Date2017-03-26 00:10 +0100
Subject[PATCH 1/2] dmaengine: qcom_hidma: disable/enable IRQs on pause/resume
Message-ID<tp2YN-7Ly-1@gated-at.bofh.it>
Once the channels are stopped, disable interrupts to make sure no new
HW interaction can happen.

Similarly, re-enable the interrupts only if we know that channel is
operational again.

Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
---
 drivers/dma/qcom/hidma_ll.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/dma/qcom/hidma_ll.c b/drivers/dma/qcom/hidma_ll.c
index 6645bdf..1530a66 100644
--- a/drivers/dma/qcom/hidma_ll.c
+++ b/drivers/dma/qcom/hidma_ll.c
@@ -499,6 +499,9 @@ int hidma_ll_enable(struct hidma_lldev *lldev)
 	lldev->trch_state = HIDMA_CH_ENABLED;
 	lldev->evch_state = HIDMA_CH_ENABLED;
 
+	/* enable irqs */
+	writel(ENABLE_IRQS, lldev->evca + HIDMA_EVCA_IRQ_EN_REG);
+
 	return 0;
 }
 
@@ -596,6 +599,9 @@ int hidma_ll_disable(struct hidma_lldev *lldev)
 
 	lldev->trch_state = HIDMA_CH_SUSPENDED;
 	lldev->evch_state = HIDMA_CH_SUSPENDED;
+
+	/* disable interrupts */
+	writel(0, lldev->evca + HIDMA_EVCA_IRQ_EN_REG);
 	return 0;
 }
 
-- 
1.9.1

[toc] | [next] | [standalone]


#1609261 — [PATCH 2/2] dmaengine: qcom_hidma: pause the channel on shutdown

FromSinan Kaya <okaya@codeaurora.org>
Date2017-03-26 00:10 +0100
Subject[PATCH 2/2] dmaengine: qcom_hidma: pause the channel on shutdown
Message-ID<tp2YN-7Ly-5@gated-at.bofh.it>
In reply to#1609260
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>
---
 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,
-- 
1.9.1

[toc] | [prev] | [next] | [standalone]


#1609450 — Re: [PATCH 1/2] dmaengine: qcom_hidma: disable/enable IRQs on pause/resume

FromVinod Koul <vinod.koul@intel.com>
Date2017-03-27 07:20 +0200
SubjectRe: [PATCH 1/2] dmaengine: qcom_hidma: disable/enable IRQs on pause/resume
Message-ID<tpvep-2Ve-1@gated-at.bofh.it>
In reply to#1609260
On Sat, Mar 25, 2017 at 07:04:02PM -0400, Sinan Kaya wrote:
> Once the channels are stopped, disable interrupts to make sure no new
> HW interaction can happen.
> 
> Similarly, re-enable the interrupts only if we know that channel is
> operational again.

Applied both, thanks

-- 
~Vinod

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web