Skip to contentSkip to conversation

dmaengine: xgene-dma: Fix double IRQ issue by setting IRQ_DISABLE_UNLAZY flag

PATCH In review Rameshswar Prasad Sahu 4 participants 10 messages Dec 23, 2015 – Jan 7, 2016 1 message not in the archive dmaengine

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dmaengine: xgene-dma: Fix double IRQ issue by setting IRQ_DISABLE_UNLAZY flag

From: Rameshwar Prasad Sahu <[email protected]>

For interrupt controller that doesn't support irq_disable and hardware with level interrupt, an extra interrupt can be pending. This patch fixes the issue by setting IRQ_DISABLE_UNLAZY flag for the interrupt line.

Reference: http://git.kernel.org/tip/e9849777d0e27cdd2902805be51da73e7c79578c

---
 drivers/dma/xgene-dma.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/dma/xgene-dma.c +4 -0
index 9dfa2b0..6363e84 100644
@@ -29,6 +29,7 @@
 #include <linux/dmapool.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
+#include <linux/irq.h>
 #include <linux/module.h>
 #include <linux/of_device.h>
 
@@ -1610,6 +1611,7 @@ static int xgene_dma_request_irqs(struct xgene_dma *pdma)
 	/* Register DMA channel rx irq */
 	for (i = 0; i < XGENE_DMA_MAX_CHANNEL; i++) {
 		chan = &pdma->chan[i];
+		irq_set_status_flags(chan->rx_irq, IRQ_DISABLE_UNLAZY);
 		ret = devm_request_irq(chan->dev, chan->rx_irq,
 				       xgene_dma_chan_ring_isr,
 				       0, chan->name, chan);
@@ -1620,6 +1622,7 @@ static int xgene_dma_request_irqs(struct xgene_dma *pdma)
 
 			for (j = 0; j < i; j++) {
 				chan = &pdma->chan[i];
+				irq_clear_status_flags(chan->rx_irq, IRQ_DISABLE_UNLAZY);
 				devm_free_irq(chan->dev, chan->rx_irq, chan);
 			}
 
@@ -1640,6 +1643,7 @@ static void xgene_dma_free_irqs(struct xgene_dma *pdma)
 
 	for (i = 0; i < XGENE_DMA_MAX_CHANNEL; i++) {
 		chan = &pdma->chan[i];
+		irq_clear_status_flags(chan->rx_irq, IRQ_DISABLE_UNLAZY);
 		devm_free_irq(chan->dev, chan->rx_irq, chan);
 	}
 }

--
1.7.1

#1 lore raw
Quoted 7 lines · Rameshswar Prasad Sahu

From: Rameshwar Prasad Sahu <[email protected]>

For interrupt controller that doesn't support irq_disable and hardware with level interrupt, an extra interrupt can be pending. This patch fixes the issue by setting IRQ_DISABLE_UNLAZY flag for the interrupt line.

Reference: http://git.kernel.org/tip/e9849777d0e27cdd2902805be51da73e7c79578c

I seem to have got this patch thrice :(

Quoted 19 lines
---
 drivers/dma/xgene-dma.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/dma/xgene-dma.c +1 -0
index 9dfa2b0..6363e84 100644
@@ -29,6 +29,7 @@
 #include <linux/dmapool.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
+#include <linux/irq.h>
 #include <linux/module.h>
 #include <linux/of_device.h>
 

drivers/dma/xgene-dma.c static int xgene_dma_request_irqs(struct xgene_dma *pdma) · line 1614

Quoted 4 lines
drivers/dma/xgene-dma.c +1 -0
@@ -1610,6 +1611,7 @@ static int xgene_dma_request_irqs(struct xgene_dma *pdma)
 	/* Register DMA channel rx irq */
 	for (i = 0; i < XGENE_DMA_MAX_CHANNEL; i++) {
 		chan = &pdma->chan[i];
+		irq_set_status_flags(chan->rx_irq, IRQ_DISABLE_UNLAZY);

Why not use irq_settings_disable_unlazy(), at least read the reference you pointed out!

Quoted 21 lines
drivers/dma/xgene-dma.c +2 -1
 		ret = devm_request_irq(chan->dev, chan->rx_irq,
 				       xgene_dma_chan_ring_isr,
 				       0, chan->name, chan);
@@ -1620,6 +1622,7 @@ static int xgene_dma_request_irqs(struct xgene_dma *pdma)
 
 			for (j = 0; j < i; j++) {
 				chan = &pdma->chan[i];
+				irq_clear_status_flags(chan->rx_irq, IRQ_DISABLE_UNLAZY);
 				devm_free_irq(chan->dev, chan->rx_irq, chan);
 			}
 
@@ -1640,6 +1643,7 @@ static void xgene_dma_free_irqs(struct xgene_dma *pdma)
 
 	for (i = 0; i < XGENE_DMA_MAX_CHANNEL; i++) {
 		chan = &pdma->chan[i];
+		irq_clear_status_flags(chan->rx_irq, IRQ_DISABLE_UNLAZY);
 		devm_free_irq(chan->dev, chan->rx_irq, chan);
 	}
 }
--

1.7.1

Signature · 1 line
~Vinod
#2 lore raw

Hi Vinod,

Quoted 10 lines · Vinod Koul
Quoted 7 lines · Rameshswar Prasad Sahu

From: Rameshwar Prasad Sahu <[email protected]>

For interrupt controller that doesn't support irq_disable and hardware with level interrupt, an extra interrupt can be pending. This patch fixes the issue by setting IRQ_DISABLE_UNLAZY flag for the interrupt line.

Reference: http://git.kernel.org/tip/e9849777d0e27cdd2902805be51da73e7c79578c

I seem to have got this patch thrice :(

Due to mail failure (some issue was in my email client) to some email-id it was multiple times,

Quoted 19 lines
Quoted 19 lines
---
 drivers/dma/xgene-dma.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/dma/xgene-dma.c +1 -0
index 9dfa2b0..6363e84 100644
@@ -29,6 +29,7 @@
 #include <linux/dmapool.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
+#include <linux/irq.h>
 #include <linux/module.h>
 #include <linux/of_device.h>
 
Quoted 8 lines

drivers/dma/xgene-dma.c static int xgene_dma_request_irqs(struct xgene_dma *pdma) · line 1614

Quoted 5 lines
drivers/dma/xgene-dma.c +1 -0
@@ -1610,6 +1611,7 @@ static int xgene_dma_request_irqs(struct xgene_dma *pdma)
      /* Register DMA channel rx irq */
      for (i = 0; i < XGENE_DMA_MAX_CHANNEL; i++) {
              chan = &pdma->chan[i];
+             irq_set_status_flags(chan->rx_irq, IRQ_DISABLE_UNLAZY);

Why not use irq_settings_disable_unlazy(), at least read the reference you pointed out!

irq_settings_disable_unlazy() is helper function to test IRQ_DISABLE_UNLAZY flag is set or not, it's not for setting this flag. FYI...
+static inline bool irq_settings_disable_unlazy(struct irq_desc *desc) +{
+ return desc->status_use_accessors & _IRQ_DISABLE_UNLAZY; +}

Quoted 25 lines
Quoted 21 lines
drivers/dma/xgene-dma.c +2 -1
              ret = devm_request_irq(chan->dev, chan->rx_irq,
                                     xgene_dma_chan_ring_isr,
                                     0, chan->name, chan);
@@ -1620,6 +1622,7 @@ static int xgene_dma_request_irqs(struct xgene_dma *pdma)
 
                      for (j = 0; j < i; j++) {
                              chan = &pdma->chan[i];
+                             irq_clear_status_flags(chan->rx_irq, IRQ_DISABLE_UNLAZY);
                              devm_free_irq(chan->dev, chan->rx_irq, chan);
                      }
 
@@ -1640,6 +1643,7 @@ static void xgene_dma_free_irqs(struct xgene_dma *pdma)
 
      for (i = 0; i < XGENE_DMA_MAX_CHANNEL; i++) {
              chan = &pdma->chan[i];
+             irq_clear_status_flags(chan->rx_irq, IRQ_DISABLE_UNLAZY);
              devm_free_irq(chan->dev, chan->rx_irq, chan);
      }
 }
--
Quoted 1 line

1.7.1

--
~Vinod

#3 lore raw
Quoted 10 lines · Rameshwar Sahu

Hi Vinod,

Quoted 7 lines · Vinod Koul
Quoted 6 lines · Rameshswar Prasad Sahu

From: Rameshwar Prasad Sahu <[email protected]>

For interrupt controller that doesn't support irq_disable and hardware with level interrupt, an extra interrupt can be pending. This patch fixes the issue by setting IRQ_DISABLE_UNLAZY flag for the interrupt line.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Reference: http://git.kernel.org/tip/e9849777d0e27cdd2902805be51da73e7c79578c

I seem to have got this patch thrice :(

Due to mail failure (some issue was in my email client) to some email-id it was multiple times,

git send-email ?

Quoted 31 lines
Quoted 19 lines
Quoted 19 lines
---
 drivers/dma/xgene-dma.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/dma/xgene-dma.c +1 -0
index 9dfa2b0..6363e84 100644
@@ -29,6 +29,7 @@
 #include <linux/dmapool.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
+#include <linux/irq.h>
 #include <linux/module.h>
 #include <linux/of_device.h>
 
Quoted 8 lines

drivers/dma/xgene-dma.c static int xgene_dma_request_irqs(struct xgene_dma *pdma) · line 1614

Quoted 5 lines
drivers/dma/xgene-dma.c +1 -0
@@ -1610,6 +1611,7 @@ static int xgene_dma_request_irqs(struct xgene_dma *pdma)
      /* Register DMA channel rx irq */
      for (i = 0; i < XGENE_DMA_MAX_CHANNEL; i++) {
              chan = &pdma->chan[i];
+             irq_set_status_flags(chan->rx_irq, IRQ_DISABLE_UNLAZY);

Why not use irq_settings_disable_unlazy(), at least read the reference you pointed out!

irq_settings_disable_unlazy() is helper function to test IRQ_DISABLE_UNLAZY flag is set or not, it's not for setting this flag. FYI...

Review

Quoted 4 lines
(quoted diff) +4 -0
+static inline bool irq_settings_disable_unlazy(struct irq_desc *desc)
+{
+ return desc->status_use_accessors & _IRQ_DISABLE_UNLAZY;
+}

Ah yes, I saw clear API and assumed there would be set. Then I think we should add a set helper as well as the usage is intended for drivers to set this flag

Thomas,

Any reason why you didn't add a set helper, only test and clear?

Signature · 1 line
~Vinod
#4 lore raw
Quoted 11 lines · Vinod Koul
Quoted 10 lines · Rameshwar Sahu

Hi Vinod,

Quoted 7 lines · Vinod Koul
Quoted 6 lines · Rameshswar Prasad Sahu

From: Rameshwar Prasad Sahu <[email protected]>

For interrupt controller that doesn't support irq_disable and hardware with level interrupt, an extra interrupt can be pending. This patch fixes the issue by setting IRQ_DISABLE_UNLAZY flag for the interrupt line.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Reference: http://git.kernel.org/tip/e9849777d0e27cdd2902805be51da73e7c79578c

I seem to have got this patch thrice :(

Due to mail failure (some issue was in my email client) to some email-id it was multiple times,

git send-email ?

Yes, was not able to send Arnd Bergmann.

Quoted 47 lines
Quoted 32 lines
Quoted 20 lines
Quoted 20 lines
---
 drivers/dma/xgene-dma.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/dma/xgene-dma.c +1 -0
index 9dfa2b0..6363e84 100644
@@ -29,6 +29,7 @@
 #include <linux/dmapool.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
+#include <linux/irq.h>
 #include <linux/module.h>
 #include <linux/of_device.h>
 
Quoted 8 lines

drivers/dma/xgene-dma.c static int xgene_dma_request_irqs(struct xgene_dma *pdma) · line 1614

Quoted 5 lines
drivers/dma/xgene-dma.c +1 -0
@@ -1610,6 +1611,7 @@ static int xgene_dma_request_irqs(struct xgene_dma *pdma)
      /* Register DMA channel rx irq */
      for (i = 0; i < XGENE_DMA_MAX_CHANNEL; i++) {
              chan = &pdma->chan[i];
+             irq_set_status_flags(chan->rx_irq, IRQ_DISABLE_UNLAZY);

Why not use irq_settings_disable_unlazy(), at least read the reference you pointed out!

irq_settings_disable_unlazy() is helper function to test IRQ_DISABLE_UNLAZY flag is set or not, it's not for setting this flag. FYI...

Review

Quoted 4 lines
(quoted diff) +4 -0
+static inline bool irq_settings_disable_unlazy(struct irq_desc *desc)
+{
+ return desc->status_use_accessors & _IRQ_DISABLE_UNLAZY;
+}

Ah yes, I saw clear API and assumed there would be set. Then I think we should add a set helper as well as the usage is intended for drivers to set this flag

Thomas,

Any reason why you didn't add a set helper, only test and clear?

--
~Vinod

#5 lore raw
In reply to Vinod Koul
Quoted 22 lines · Vinod Koul
Quoted 12 lines · Rameshwar Sahu
Quoted 8 lines

drivers/dma/xgene-dma.c static int xgene_dma_request_irqs(struct xgene_dma *pdma) · line 1614

Quoted 5 lines
drivers/dma/xgene-dma.c +1 -0
@@ -1610,6 +1611,7 @@ static int xgene_dma_request_irqs(struct xgene_dma *pdma)
      /* Register DMA channel rx irq */
      for (i = 0; i < XGENE_DMA_MAX_CHANNEL; i++) {
              chan = &pdma->chan[i];
+             irq_set_status_flags(chan->rx_irq, IRQ_DISABLE_UNLAZY);

Why not use irq_settings_disable_unlazy(), at least read the reference you pointed out!

irq_settings_disable_unlazy() is helper function to test IRQ_DISABLE_UNLAZY flag is set or not, it's not for setting this flag. FYI...

Review

Quoted 4 lines
(quoted diff) +4 -0
+static inline bool irq_settings_disable_unlazy(struct irq_desc *desc)
+{
+ return desc->status_use_accessors & _IRQ_DISABLE_UNLAZY;
+}

Ah yes, I saw clear API and assumed there would be set. Then I think we should add a set helper as well as the usage is intended for drivers to set this flag

Quoted 3 lines

Thomas,

Any reason why you didn't add a set helper, only test and clear?

Why would I? Those helpers are core internal and not usable in random drivers.

Drivers have irq_set_status_flags()/irq_clear_status_flags() ...

Thanks,

tglx

#7 lore raw
In reply to a message not in the archive
Quoted 34 lines · Suman Tripathi
Quoted 31 lines · Thomas Gleixner
Quoted 28 lines · Vinod Koul
Quoted 15 lines · Rameshwar Sahu
Quoted 11 lines

drivers/dma/xgene-dma.c static int xgene_dma_request_irqs(struct · line 1616

Quoted 7 lines
drivers/dma/xgene-dma.c +1 -0
@@ -1610,6 +1611,7 @@ static int xgene_dma_request_irqs(struct
 xgene_dma *pdma)
      /* Register DMA channel rx irq */
      for (i = 0; i < XGENE_DMA_MAX_CHANNEL; i++) {
              chan = &pdma->chan[i];
+             irq_set_status_flags(chan->rx_irq,
 IRQ_DISABLE_UNLAZY);

Why not use irq_settings_disable_unlazy(), at least read the reference you
pointed out!

irq_settings_disable_unlazy() is helper function to test IRQ_DISABLE_UNLAZY flag is set or not, it's not for setting this flag. FYI...

Review

Quoted 4 lines
(quoted diff) +4 -0
+static inline bool irq_settings_disable_unlazy(struct irq_desc *desc)
+{
+ return desc->status_use_accessors & _IRQ_DISABLE_UNLAZY;
+}

Ah yes, I saw clear API and assumed there would be set. Then I think we should add a set helper as well as the usage is intended for drivers to set this flag

Thomas,

Any reason why you didn't add a set helper, only test and clear?

Quoted 7 lines
Quoted 2 lines

Why would I? Those helpers are core internal and not usable in random drivers.

i think the problem is the name of the function. It should be something

irq_check_settings_disable_unlazy

resending in plain text mode. Sorry for this.

I think the problem is the name of the function. It should be something

irq_check_settings_disable_unlazy

Quoted 20 lines
Quoted 4 lines

Drivers have irq_set_status_flags()/irq_clear_status_flags() ...

Quoted 8 lines

Thanks,

tglx

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

--
Thanks,
with regards,
Suman Tripathi

Signature · 3 lines
Thanks,
with regards,
Suman Tripathi
#8 lore raw
In reply to a message not in the archive
Quoted 8 lines · Suman Tripathi
Quoted 3 lines · Thomas Gleixner

Why would I? Those helpers are core internal and not usable in random drivers.

i think the problem is the name of the function. It should be something

irq_check_settings_disable_unlazy

And why is that relevant to a driver? Again, those helpers are core internal and well understood.

Thanks,

tglx

#9 lore raw
In reply to Thomas Gleixner
Quoted 23 lines · Thomas Gleixner
Quoted 22 lines · Vinod Koul
Quoted 12 lines · Rameshwar Sahu
Quoted 8 lines

drivers/dma/xgene-dma.c static int xgene_dma_request_irqs(struct xgene_dma *pdma) · line 1614

Quoted 5 lines
drivers/dma/xgene-dma.c +1 -0
@@ -1610,6 +1611,7 @@ static int xgene_dma_request_irqs(struct xgene_dma *pdma)
      /* Register DMA channel rx irq */
      for (i = 0; i < XGENE_DMA_MAX_CHANNEL; i++) {
              chan = &pdma->chan[i];
+             irq_set_status_flags(chan->rx_irq, IRQ_DISABLE_UNLAZY);

Why not use irq_settings_disable_unlazy(), at least read the reference you pointed out!

irq_settings_disable_unlazy() is helper function to test IRQ_DISABLE_UNLAZY flag is set or not, it's not for setting this flag. FYI...

Review

Quoted 4 lines
(quoted diff) +4 -0
+static inline bool irq_settings_disable_unlazy(struct irq_desc *desc)
+{
+ return desc->status_use_accessors & _IRQ_DISABLE_UNLAZY;
+}

Ah yes, I saw clear API and assumed there would be set. Then I think we should add a set helper as well as the usage is intended for drivers to set this flag

Quoted 7 lines
Quoted 3 lines

Thomas,

Any reason why you didn't add a set helper, only test and clear?

Why would I? Those helpers are core internal and not usable in random drivers.

Drivers have irq_set_status_flags()/irq_clear_status_flags() ...

The effect of irq_set_status_flags(irq, IRQ_DISABLE_UNLAZY) is same as providing a helper. If your recommendation is to use this by driver then I am find with the approach too

Thanks

Signature · 1 line
~Vinod