Skip to contentSkip to conversation

media: aspeed-video: ignore interrupts that aren't enabled

PATCH In review Zev Weiss 6 participants 8 messages Jun 17, 2021 – Oct 8, 2021

Subsystems (2)
lore
Share & tools
lore

Zev Weiss

author
#0 lore raw

PATCH v3 1/1 media: aspeed-video: ignore interrupts that aren't enabled

As partially addressed in commit 65d270acb2d6 ("media: aspeed: clear garbage interrupts"), the ASpeed video engine sometimes asserts interrupts that the driver hasn't enabled. In addition to the CAPTURE_COMPLETE and FRAME_COMPLETE interrupts dealt with in that patch, COMP_READY has also been observed. Instead of playing whack-a-mole with each one individually, we can instead just blanket ignore everything we haven't explicitly enabled.

---

Changes since v2 [1]:
- minor commit message improvements

Changes since v1 [0]:
- dropped error message
- switched to a blanket-ignore approach as suggested by Ryan

[0] https://lore.kernel.org/linux-arm-kernel/20201215024542.18888-1-zev at bewilderbeest.net/
[1] https://lore.kernel.org/openbmc/20210506234048.3214-1-zev at bewilderbeest.net/

 drivers/media/platform/aspeed-video.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)
drivers/media/platform/aspeed-video.c +6 -10
index 7bb6babdcade..77611c296a25 100644
@@ -563,6 +563,12 @@ static irqreturn_t aspeed_video_irq(int irq, void *arg)
 	struct aspeed_video *video = arg;
 	u32 sts = aspeed_video_read(video, VE_INTERRUPT_STATUS);
 
+	/*
+	 * Hardware sometimes asserts interrupts that we haven't actually
+	 * enabled; ignore them if so.
+	 */
+	sts &= aspeed_video_read(video, VE_INTERRUPT_CTRL);
+
 	/*
 	 * Resolution changed or signal was lost; reset the engine and
 	 * re-initialize
@@ -629,16 +635,6 @@ static irqreturn_t aspeed_video_irq(int irq, void *arg)
 			aspeed_video_start_frame(video);
 	}
 
-	/*
-	 * CAPTURE_COMPLETE and FRAME_COMPLETE interrupts come even when these
-	 * are disabled in the VE_INTERRUPT_CTRL register so clear them to
-	 * prevent unnecessary interrupt calls.
-	 */
-	if (sts & VE_INTERRUPT_CAPTURE_COMPLETE)
-		sts &= ~VE_INTERRUPT_CAPTURE_COMPLETE;
-	if (sts & VE_INTERRUPT_FRAME_COMPLETE)
-		sts &= ~VE_INTERRUPT_FRAME_COMPLETE;
-
 	return sts ? IRQ_NONE : IRQ_HANDLED;
 }
 
Signature · 1 line
2.32.0
Tested-by on v3 1/1
#1 lore raw
Quoted 30 lines · Zev Weiss

As partially addressed in commit 65d270acb2d6 ("media: aspeed: clear garbage interrupts"), the ASpeed video engine sometimes asserts interrupts that the driver hasn't enabled. In addition to the CAPTURE_COMPLETE and FRAME_COMPLETE interrupts dealt with in that patch, COMP_READY has also been observed. Instead of playing whack-a-mole with each one individually, we can instead just blanket ignore everything we haven't explicitly enabled.

---

Changes since v2 [1]:
- minor commit message improvements

Changes since v1 [0]:
- dropped error message
- switched to a blanket-ignore approach as suggested by Ryan

[0] https://lore.kernel.org/linux-arm-kernel/20201215024542.18888-1-zev at bewilderbeest.net/
[1] https://lore.kernel.org/openbmc/20210506234048.3214-1-zev at bewilderbeest.net/

 drivers/media/platform/aspeed-video.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)
drivers/media/platform/aspeed-video.c +0 -0
index 7bb6babdcade..77611c296a25 100644

drivers/media/platform/aspeed-video.c static irqreturn_t aspeed_video_irq(int irq, void *arg) · line 571

Quoted 9 lines
drivers/media/platform/aspeed-video.c +6 -0
@@ -563,6 +563,12 @@ static irqreturn_t aspeed_video_irq(int irq, void *arg)
        struct aspeed_video *video = arg;
        u32 sts = aspeed_video_read(video, VE_INTERRUPT_STATUS);
 
+       /*
+        * Hardware sometimes asserts interrupts that we haven't actually
+        * enabled; ignore them if so.
+        */
+       sts &= aspeed_video_read(video, VE_INTERRUPT_CTRL);
+

Without the patch, the driver gets an unhandled IRQ in a few hours after the KVM page is opened.
This patch is tested on Bytedance's OpenBMC system and the issue has not been reproduced anymore.

Signature · 2 lines
BRs,
Lei YU
Reviewed-by on v3 1/1
#2 lore raw
In reply to Zev Weiss
Quoted 7 lines · Zev Weiss

As partially addressed in commit 65d270acb2d6 ("media: aspeed: clear garbage interrupts"), the ASpeed video engine sometimes asserts interrupts that the driver hasn't enabled. In addition to the CAPTURE_COMPLETE and FRAME_COMPLETE interrupts dealt with in that patch, COMP_READY has also been observed. Instead of playing whack-a-mole with each one individually, we can instead just blanket ignore everything we haven't explicitly enabled.

Suspect this will fix an intermittent problem on AST2500 with screensaver. Change looks good, thanks!

Quoted 59 lines

---

Changes since v2 [1]:
- minor commit message improvements

Changes since v1 [0]:
- dropped error message
- switched to a blanket-ignore approach as suggested by Ryan

[0]
https://lore.kernel.org/linux-arm-kernel/20201215024542.18888-1-zev at bewilderbeest.net/
[1]
https://lore.kernel.org/openbmc/20210506234048.3214-1-zev at bewilderbeest.net/

 drivers/media/platform/aspeed-video.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)
drivers/media/platform/aspeed-video.c +2 -0
index 7bb6babdcade..77611c296a25 100644
@@ -563,6 +563,12 @@ static irqreturn_t aspeed_video_irq(int irq,
 void *arg)
 	struct aspeed_video *video = arg;
 	u32 sts = aspeed_video_read(video, VE_INTERRUPT_STATUS);
 
+	/*
+	 * Hardware sometimes asserts interrupts that we haven't

actually

drivers/media/platform/aspeed-video.c +4 -2
+	 * enabled; ignore them if so.
+	 */
+	sts &= aspeed_video_read(video, VE_INTERRUPT_CTRL);
+
 	/*
 	 * Resolution changed or signal was lost; reset the engine and
 	 * re-initialize
@@ -629,16 +635,6 @@ static irqreturn_t aspeed_video_irq(int irq,
 void *arg)
 			aspeed_video_start_frame(video);
 	}
 
-	/*
-	 * CAPTURE_COMPLETE and FRAME_COMPLETE interrupts come even

when these

drivers/media/platform/aspeed-video.c +0 -1
-	 * are disabled in the VE_INTERRUPT_CTRL register so clear them

to

drivers/media/platform/aspeed-video.c +0 -7
-	 * prevent unnecessary interrupt calls.
-	 */
-	if (sts & VE_INTERRUPT_CAPTURE_COMPLETE)
-		sts &= ~VE_INTERRUPT_CAPTURE_COMPLETE;
-	if (sts & VE_INTERRUPT_FRAME_COMPLETE)
-		sts &= ~VE_INTERRUPT_FRAME_COMPLETE;
-
 	return sts ? IRQ_NONE : IRQ_HANDLED;
 }
reviewer Reviewed-by
#3 lore raw
Quoted 21 lines

-----Original Message-----
From: Eddie James <[email protected]>
Sent: Wednesday, September 1, 2021 11:07 PM
To: Zev Weiss <[email protected]>
Cc: Jae Hyun Yoo <[email protected]>; Ryan Chen <[email protected]>; linux-aspeed at lists.ozlabs.org; Andrew Jeffery <[email protected]>; openbmc at lists.ozlabs.org; linux-kernel at vger.kernel.org; Mauro Carvalho Chehab <[email protected]>;
linux-arm-kernel at lists.infradead.org; linux-media at vger.kernel.org
Subject: Re: [PATCH v3] media: aspeed-video: ignore interrupts that aren't enabled

Quoted 7 lines · Zev Weiss

As partially addressed in commit 65d270acb2d6 ("media: aspeed: clear garbage interrupts"), the ASpeed video engine sometimes asserts interrupts that the driver hasn't enabled. In addition to the CAPTURE_COMPLETE and FRAME_COMPLETE interrupts dealt with in that patch, COMP_READY has also been observed. Instead of playing whack-a-mole with each one individually, we can instead just blanket ignore everything we haven't explicitly enabled.

Quoted 5 lines

Suspect this will fix an intermittent problem on AST2500 with screensaver. Change looks good, thanks!

Quoted 61 lines
Quoted 7 lines

---

Changes since v2 [1]:
- minor commit message improvements

Quoted 9 lines

Changes since v1 [0]:
- dropped error message
- switched to a blanket-ignore approach as suggested by Ryan

[0]
https://lore.kernel.org/linux-arm-kernel/20201215024542.18888-1-zev at be wilderbeest.net/
[1]

https://lore.kernel.org/openbmc/20210506234048.3214-1-zev at bewilderbees

Quoted 44 lines

t.net/

 drivers/media/platform/aspeed-video.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)
drivers/media/platform/aspeed-video.c +2 -0
index 7bb6babdcade..77611c296a25 100644
@@ -563,6 +563,12 @@ static irqreturn_t aspeed_video_irq(int irq, void
 *arg)
 	struct aspeed_video *video = arg;
 	u32 sts = aspeed_video_read(video, VE_INTERRUPT_STATUS);
 
+	/*
+	 * Hardware sometimes asserts interrupts that we haven't

actually

drivers/media/platform/aspeed-video.c +4 -2
+	 * enabled; ignore them if so.
+	 */
+	sts &= aspeed_video_read(video, VE_INTERRUPT_CTRL);
+
 	/*
 	 * Resolution changed or signal was lost; reset the engine and
 	 * re-initialize
@@ -629,16 +635,6 @@ static irqreturn_t aspeed_video_irq(int irq, void
 *arg)
 			aspeed_video_start_frame(video);
 	}
 
-	/*
-	 * CAPTURE_COMPLETE and FRAME_COMPLETE interrupts come even

when these

drivers/media/platform/aspeed-video.c +0 -1
-	 * are disabled in the VE_INTERRUPT_CTRL register so clear them

to

drivers/media/platform/aspeed-video.c +0 -7
-	 * prevent unnecessary interrupt calls.
-	 */
-	if (sts & VE_INTERRUPT_CAPTURE_COMPLETE)
-		sts &= ~VE_INTERRUPT_CAPTURE_COMPLETE;
-	if (sts & VE_INTERRUPT_FRAME_COMPLETE)
-		sts &= ~VE_INTERRUPT_FRAME_COMPLETE;
-
 	return sts ? IRQ_NONE : IRQ_HANDLED;  }
maintainer Acked-by
#4 lore raw

Hi Mauro,

Quoted 12 lines · Ryan Chen
Quoted 12 lines

Subject: Re: [PATCH v3] media: aspeed-video: ignore interrupts that aren't enabled

Quoted 7 lines · Zev Weiss

As partially addressed in commit 65d270acb2d6 ("media: aspeed: clear garbage interrupts"), the ASpeed video engine sometimes asserts interrupts that the driver hasn't enabled. In addition to the CAPTURE_COMPLETE and FRAME_COMPLETE interrupts dealt with in that patch, COMP_READY has also been observed. Instead of playing whack-a-mole with each one individually, we can instead just blanket ignore everything we haven't explicitly enabled.

Quoted 8 lines
Quoted 5 lines

Suspect this will fix an intermittent problem on AST2500 with screensaver. Change looks good, thanks!

Quoted 2 lines
Quoted 2 lines

I notice this wasn't merged in the pull request you sent for v5.15. Would you be able to ensure it makes it in the next pull request you send?

It can have some fixes tags too:

Fixes 65d270acb2d6 ("media: aspeed: clear garbage interrupts")
Fixes d2b4387f3bdf ("media: platform: Add Aspeed Video Engine driver")

Cheers,

Joel

Quoted 60 lines
Quoted 59 lines
Quoted 5 lines

---

Changes since v2 [1]:
- minor commit message improvements

Quoted 9 lines

Changes since v1 [0]:
- dropped error message
- switched to a blanket-ignore approach as suggested by Ryan

[0]
https://lore.kernel.org/linux-arm-kernel/20201215024542.18888-1-zev at be wilderbeest.net/
[1]

https://lore.kernel.org/openbmc/20210506234048.3214-1-zev at bewilderbees

Quoted 44 lines

t.net/

 drivers/media/platform/aspeed-video.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)
drivers/media/platform/aspeed-video.c +2 -0
index 7bb6babdcade..77611c296a25 100644
@@ -563,6 +563,12 @@ static irqreturn_t aspeed_video_irq(int irq, void
 *arg)
    struct aspeed_video *video = arg;
    u32 sts = aspeed_video_read(video, VE_INTERRUPT_STATUS);
 
+   /*
+    * Hardware sometimes asserts interrupts that we haven't

actually

drivers/media/platform/aspeed-video.c +4 -2
+    * enabled; ignore them if so.
+    */
+   sts &= aspeed_video_read(video, VE_INTERRUPT_CTRL);
+
    /*
     * Resolution changed or signal was lost; reset the engine and
     * re-initialize
@@ -629,16 +635,6 @@ static irqreturn_t aspeed_video_irq(int irq, void
 *arg)
                    aspeed_video_start_frame(video);
    }
 
-   /*
-    * CAPTURE_COMPLETE and FRAME_COMPLETE interrupts come even

when these
- * are disabled in the VE_INTERRUPT_CTRL register so clear them
to

drivers/media/platform/aspeed-video.c +0 -7
-    * prevent unnecessary interrupt calls.
-    */
-   if (sts & VE_INTERRUPT_CAPTURE_COMPLETE)
-           sts &= ~VE_INTERRUPT_CAPTURE_COMPLETE;
-   if (sts & VE_INTERRUPT_FRAME_COMPLETE)
-           sts &= ~VE_INTERRUPT_FRAME_COMPLETE;
-
    return sts ? IRQ_NONE : IRQ_HANDLED;  }
author
#5 lore raw
Quoted 30 lines · Joel Stanley

Hi Mauro,

Quoted 12 lines · Ryan Chen
Quoted 12 lines

Subject: Re: [PATCH v3] media: aspeed-video: ignore interrupts that aren't enabled

Quoted 7 lines · Zev Weiss

As partially addressed in commit 65d270acb2d6 ("media: aspeed: clear garbage interrupts"), the ASpeed video engine sometimes asserts interrupts that the driver hasn't enabled. In addition to the CAPTURE_COMPLETE and FRAME_COMPLETE interrupts dealt with in that patch, COMP_READY has also been observed. Instead of playing whack-a-mole with each one individually, we can instead just blanket ignore everything we haven't explicitly enabled.

Quoted 8 lines
Quoted 5 lines

Suspect this will fix an intermittent problem on AST2500 with screensaver. Change looks good, thanks!

Quoted 2 lines
Quoted 2 lines

I notice this wasn't merged in the pull request you sent for v5.15. Would you be able to ensure it makes it in the next pull request you send?

It can have some fixes tags too:

Quoted 8 lines
Fixes 65d270acb2d6 ("media: aspeed: clear garbage interrupts")
Fixes d2b4387f3bdf ("media: platform: Add Aspeed Video Engine driver")

Cheers,

Joel

Also not in the recent merge of the media/v5.15-2 tag it looks like -- ping?

Thanks,
Zev

maintainer
#6 lore raw

Hi Greg,

Quoted 36 lines · Zev Weiss
Quoted 34 lines · Joel Stanley

Hi Mauro,

Quoted 12 lines · Ryan Chen
Quoted 12 lines

Subject: Re: [PATCH v3] media: aspeed-video: ignore interrupts that aren't enabled

Quoted 7 lines · Zev Weiss

As partially addressed in commit 65d270acb2d6 ("media: aspeed: clear garbage interrupts"), the ASpeed video engine sometimes asserts interrupts that the driver hasn't enabled. In addition to the CAPTURE_COMPLETE and FRAME_COMPLETE interrupts dealt with in that patch, COMP_READY has also been observed. Instead of playing whack-a-mole with each one individually, we can instead just blanket ignore everything we haven't explicitly enabled.

Quoted 8 lines
Quoted 5 lines

Suspect this will fix an intermittent problem on AST2500 with screensaver. Change looks good, thanks!

Quoted 2 lines
Quoted 2 lines

I notice this wasn't merged in the pull request you sent for v5.15. Would you be able to ensure it makes it in the next pull request you send?

It can have some fixes tags too:

Fixes 65d270acb2d6 ("media: aspeed: clear garbage interrupts")
Fixes d2b4387f3bdf ("media: platform: Add Aspeed Video Engine driver")
Quoted 6 lines
Quoted 4 lines

Cheers,

Joel

Also not in the recent merge of the media/v5.15-2 tag it looks like -- ping?

We're struggling to get a hold of the media maintainers to merge this fix. Have you heard from them recently?

Cheers,

Joel

#7 lore raw
Quoted 41 lines · Joel Stanley

Hi Greg,

Quoted 38 lines · Zev Weiss
Quoted 36 lines · Joel Stanley

Hi Mauro,

Quoted 12 lines · Ryan Chen
Quoted 12 lines

Subject: Re: [PATCH v3] media: aspeed-video: ignore interrupts that aren't enabled

Quoted 7 lines · Zev Weiss

As partially addressed in commit 65d270acb2d6 ("media: aspeed: clear garbage interrupts"), the ASpeed video engine sometimes asserts interrupts that the driver hasn't enabled. In addition to the CAPTURE_COMPLETE and FRAME_COMPLETE interrupts dealt with in that patch, COMP_READY has also been observed. Instead of playing whack-a-mole with each one individually, we can instead just blanket ignore everything we haven't explicitly enabled.

Quoted 8 lines
Quoted 5 lines

Suspect this will fix an intermittent problem on AST2500 with screensaver. Change looks good, thanks!

Quoted 2 lines
Quoted 2 lines

I notice this wasn't merged in the pull request you sent for v5.15. Would you be able to ensure it makes it in the next pull request you send?

It can have some fixes tags too:

Fixes 65d270acb2d6 ("media: aspeed: clear garbage interrupts")
Fixes d2b4387f3bdf ("media: platform: Add Aspeed Video Engine driver")

Cheers,

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Joel

Also not in the recent merge of the media/v5.15-2 tag it looks like -- ping?

We're struggling to get a hold of the media maintainers to merge this fix. Have you heard from them recently?

I have seen them on the mailing list, yes.

good luck!

greg k-h