Skip to contentSkip to conversation

firmware: imx: make sure MU irq can wake up system from suspend mode

PATCH In review Anson Huang 3 participants 10 messages Apr 23, 2020 – Jun 17, 2020 Arm i.MX and Layerscape

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 firmware: imx: make sure MU irq can wake up system from suspend mode

IRQF_NO_SUSPEND flag is set for MU IRQ of IPC work, but with this flag set, IRQD_WAKEUP_ARMED flag will NOT be set during suspend_device_irq() phase, then when MU IRQ arrives, it will NOT wake up system from suspend.

To fix this issue, pm_system_wakeup() is called in general MU IRQ handler to make sure system can be waked up when MU IRQ arrives.

---
 drivers/firmware/imx/imx-scu-irq.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/firmware/imx/imx-scu-irq.c +2 -0
index db655e8..d9dcc20 100644
@@ -10,6 +10,7 @@
 #include <linux/firmware/imx/ipc.h>
 #include <linux/firmware/imx/sci.h>
 #include <linux/mailbox_client.h>
+#include <linux/suspend.h>
 
 #define IMX_SC_IRQ_FUNC_ENABLE	1
 #define IMX_SC_IRQ_FUNC_STATUS	2
@@ -91,6 +92,7 @@ static void imx_scu_irq_work_handler(struct work_struct *work)
 		if (!irq_status)
 			continue;
 
+		pm_system_wakeup();
 		imx_scu_irq_notifier_call_chain(irq_status, &i);
 	}
 }
Signature · 1 line
2.7.4
#1 lore raw

PATCH 2/2 firmware: imx: MU IRQ group number should be 7

The MU IRQ group number should be 7 instead of 4.

---
 drivers/firmware/imx/imx-scu-irq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/imx/imx-scu-irq.c +1 -1
index d9dcc20..66fef88 100644
@@ -14,7 +14,7 @@
 
 #define IMX_SC_IRQ_FUNC_ENABLE	1
 #define IMX_SC_IRQ_FUNC_STATUS	2
-#define IMX_SC_IRQ_NUM_GROUP	4
+#define IMX_SC_IRQ_NUM_GROUP	7
 
 static u32 mu_resource_id;
 
Signature · 7 lines
2.7.4


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#2 lore raw

RE: [PATCH 2/2] firmware: imx: MU IRQ group number should be 7

Quoted 6 lines

From: Anson Huang <[email protected]>
Sent: Friday, April 24, 2020 7:07 AM

The MU IRQ group number should be 7 instead of 4.

Are we using others IRQ group?
If not, this change may slow down the irq handling speed.

Regards
Aisheng

Quoted 20 lines
---
 drivers/firmware/imx/imx-scu-irq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/imx/imx-scu-irq.c +1 -2
index d9dcc20..66fef88 100644
@@ -14,7 +14,7 @@
 
 #define IMX_SC_IRQ_FUNC_ENABLE	1
 #define IMX_SC_IRQ_FUNC_STATUS	2
-#define IMX_SC_IRQ_NUM_GROUP	4
+#define IMX_SC_IRQ_NUM_GROUP	7
 
 static u32 mu_resource_id;
 
--

2.7.4

#3 lore raw

RE: [PATCH 2/2] firmware: imx: MU IRQ group number should be 7

Quoted 15 lines

-----Original Message-----
From: Aisheng Dong <[email protected]>
Sent: 2020年4月24日 10:33
To: Anson Huang <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: dl-linux-imx <[email protected]>
Subject: RE: [PATCH 2/2] firmware: imx: MU IRQ group number should be 7

Quoted 3 lines

From: Anson Huang <[email protected]>
Sent: Friday, April 24, 2020 7:07 AM

Quoted 6 lines
Quoted 3 lines

The MU IRQ group number should be 7 instead of 4.

Are we using others IRQ group?
If not, this change may slow down the irq handling speed.

The irq handling is using work queue, NOT in ISR, so the speed is NOT that sensitive. The scu group irq driver should provide full functions, as other drivers using it may enable the group they want.

Anson

#4 lore raw

RE: [PATCH 2/2] firmware: imx: MU IRQ group number should be 7

Quoted 19 lines

From: Anson Huang <[email protected]>
Sent: Friday, April 24, 2020 10:36 AM

Quoted 16 lines

-----Original Message-----
From: Aisheng Dong <[email protected]>
Sent: 2020年4月24日 10:33
To: Anson Huang <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: dl-linux-imx <[email protected]>
Subject: RE: [PATCH 2/2] firmware: imx: MU IRQ group number should be 7

Quoted 5 lines

From: Anson Huang <[email protected]>
Sent: Friday, April 24, 2020 7:07 AM

The MU IRQ group number should be 7 instead of 4.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Are we using others IRQ group?
If not, this change may slow down the irq handling speed.

The irq handling is using work queue, NOT in ISR, so the speed is NOT that sensitive.

SCU IPC is shared by the whole system, each SCU transfer takes about 10~20 us. Here you may waste 30~60us if not really used.

Quoted 2 lines

The scu group irq driver should provide full functions, as other drivers using it may enable the group they want.

Below are extra GROUPs you're going to add:

#define SC_IRQ_GROUP_SYSCTR     4U   /*!< System counter interrupts */
#define SC_IRQ_GROUP_REBOOTED   5U   /*!< Partition reboot complete */
#define SC_IRQ_GROUP_REBOOT     6U   /*!< Partition reboot starting */

Are we really going to use it? It seems I also didn't see any users in downstream tree.

Some functions provided by SCFW may not really used by Linux.
I think I's better to add them when we really need them, otherwise we benefit nothing But wasting CPU mips.

Regards
Aisheng

Quoted 2 lines

Anson

#5 lore raw

RE: [PATCH 2/2] firmware: imx: MU IRQ group number should be 7

Quoted 42 lines

Subject: RE: [PATCH 2/2] firmware: imx: MU IRQ group number should be 7

Quoted 20 lines

From: Anson Huang <[email protected]>
Sent: Friday, April 24, 2020 10:36 AM

Quoted 17 lines

-----Original Message-----
From: Aisheng Dong <[email protected]>
Sent: 2020年4月24日 10:33
To: Anson Huang <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: dl-linux-imx <[email protected]>
Subject: RE: [PATCH 2/2] firmware: imx: MU IRQ group number should be
7

Quoted 5 lines

From: Anson Huang <[email protected]>
Sent: Friday, April 24, 2020 7:07 AM

The MU IRQ group number should be 7 instead of 4.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Are we using others IRQ group?
If not, this change may slow down the irq handling speed.

The irq handling is using work queue, NOT in ISR, so the speed is NOT that sensitive.

SCU IPC is shared by the whole system, each SCU transfer takes about 10~20 us.
Here you may waste 30~60us if not really used.

Quoted 2 lines

The scu group irq driver should provide full functions, as other drivers using it may enable the group they want.

Below are extra GROUPs you're going to add:

#define SC_IRQ_GROUP_SYSCTR     4U   /*!< System counter interrupts */
#define SC_IRQ_GROUP_REBOOTED   5U   /*!< Partition reboot complete
Quoted 8 lines

*/
#define SC_IRQ_GROUP_REBOOT 6U /*!< Partition reboot starting */
Are we really going to use it? It seems I also didn't see any users in downstream tree.

Some functions provided by SCFW may not really used by Linux.
I think I's better to add them when we really need them, otherwise we benefit nothing But wasting CPU mips.

I don't agree this, if SCFW NOT support it, it should fix from SCFW. This is aligned with our internal tree.

Anson

#6 lore raw

RE: [PATCH 2/2] firmware: imx: MU IRQ group number should be 7

Quoted 49 lines

From: Anson Huang <[email protected]>
Sent: Friday, April 24, 2020 10:54 AM

Quoted 46 lines

Subject: RE: [PATCH 2/2] firmware: imx: MU IRQ group number should be 7

Quoted 20 lines

From: Anson Huang <[email protected]>
Sent: Friday, April 24, 2020 10:36 AM

Quoted 17 lines

-----Original Message-----
From: Aisheng Dong <[email protected]>
Sent: 2020年4月24日 10:33
To: Anson Huang <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: dl-linux-imx <[email protected]>
Subject: RE: [PATCH 2/2] firmware: imx: MU IRQ group number should be
7

Quoted 5 lines

From: Anson Huang <[email protected]>
Sent: Friday, April 24, 2020 7:07 AM

The MU IRQ group number should be 7 instead of 4.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Are we using others IRQ group?
If not, this change may slow down the irq handling speed.

The irq handling is using work queue, NOT in ISR, so the speed is NOT that sensitive.

SCU IPC is shared by the whole system, each SCU transfer takes about 10~20 us.
Here you may waste 30~60us if not really used.

Quoted 2 lines

The scu group irq driver should provide full functions, as other drivers using it may enable the group they want.

Below are extra GROUPs you're going to add:

#define SC_IRQ_GROUP_SYSCTR     4U   /*!< System counter interrupts */
#define SC_IRQ_GROUP_REBOOTED   5U   /*!< Partition reboot complete

*/
#define SC_IRQ_GROUP_REBOOT 6U /*!< Partition reboot starting */
Are we really going to use it? It seems I also didn't see any users in downstream tree.

Quoted 6 lines
Quoted 3 lines

Some functions provided by SCFW may not really used by Linux. I think I's better to add them when we really need them, otherwise we benefit nothing But wasting CPU mips.

I don't agree this, if SCFW NOT support it, it should fix from SCFW. This is aligned with our internal tree.

Hmm, internal tree does not decide upstream tree. That's a lesson we've already learned for many years.

For example, we only upstream SCU API really used by Linux. Not all of them as we simply did for local 4.19 release.

Regards
Aisheng

Quoted 2 lines

Anson

Reviewed-by on v1 1/2
#7 lore raw
In reply to Anson Huang
Quoted 8 lines

From: Anson Huang <[email protected]>
Sent: Friday, April 24, 2020 7:07 AM

IRQF_NO_SUSPEND flag is set for MU IRQ of IPC work, but with this flag set, IRQD_WAKEUP_ARMED flag will NOT be set during suspend_device_irq() phase, then when MU IRQ arrives, it will NOT wake up system from suspend.

Quoted 4 lines

To fix this issue, pm_system_wakeup() is called in general MU IRQ handler to make sure system can be waked up when MU IRQ arrives.

Regards
Aisheng

Quoted 28 lines
---
 drivers/firmware/imx/imx-scu-irq.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/firmware/imx/imx-scu-irq.c +2 -0
index db655e8..d9dcc20 100644
@@ -10,6 +10,7 @@
 #include <linux/firmware/imx/ipc.h>
 #include <linux/firmware/imx/sci.h>
 #include <linux/mailbox_client.h>
+#include <linux/suspend.h>
 
 #define IMX_SC_IRQ_FUNC_ENABLE	1
 #define IMX_SC_IRQ_FUNC_STATUS	2
@@ -91,6 +92,7 @@ static void imx_scu_irq_work_handler(struct work_struct
 *work)
 		if (!irq_status)
 			continue;
 
+		pm_system_wakeup();
 		imx_scu_irq_notifier_call_chain(irq_status, &i);
 	}

}
--
2.7.4

#8 lore raw
In reply to Anson Huang

Gentle ping...

Quoted 37 lines

Subject: [PATCH 1/2] firmware: imx: make sure MU irq can wake up system from suspend mode

IRQF_NO_SUSPEND flag is set for MU IRQ of IPC work, but with this flag set, IRQD_WAKEUP_ARMED flag will NOT be set during suspend_device_irq() phase, then when MU IRQ arrives, it will NOT wake up system from suspend.

To fix this issue, pm_system_wakeup() is called in general MU IRQ handler to make sure system can be waked up when MU IRQ arrives.

---
 drivers/firmware/imx/imx-scu-irq.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/firmware/imx/imx-scu-irq.c +2 -0
index db655e8..d9dcc20 100644
@@ -10,6 +10,7 @@
 #include <linux/firmware/imx/ipc.h>
 #include <linux/firmware/imx/sci.h>
 #include <linux/mailbox_client.h>
+#include <linux/suspend.h>
 
 #define IMX_SC_IRQ_FUNC_ENABLE	1
 #define IMX_SC_IRQ_FUNC_STATUS	2
@@ -91,6 +92,7 @@ static void imx_scu_irq_work_handler(struct work_struct
 *work)
 		if (!irq_status)
 			continue;
 
+		pm_system_wakeup();
 		imx_scu_irq_notifier_call_chain(irq_status, &i);
 	}
Quoted 3 lines

}
--
2.7.4

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#9 lore raw
In reply to Anson Huang
Quoted 9 lines · Anson Huang

IRQF_NO_SUSPEND flag is set for MU IRQ of IPC work, but with this flag set, IRQD_WAKEUP_ARMED flag will NOT be set during suspend_device_irq() phase, then when MU IRQ arrives, it will NOT wake up system from suspend.

To fix this issue, pm_system_wakeup() is called in general MU IRQ handler to make sure system can be waked up when MU IRQ arrives.

I see you guys haven't got agreement on patch #2, so applied #1 only.

Shawn