Skip to contentSkip to conversation

firmware/sysfb: Disable sysfb for firmware buffers with unknown parent

PATCH In review Thomas Zimmermann 3 participants 3 messages Sep 24, 2024

Subsystems (2)
lore
Share & tools
lore

Thomas Zimmermann

author maintainer
#0 lore raw

PATCH 1/1 firmware/sysfb: Disable sysfb for firmware buffers with unknown parent

The sysfb framebuffer handling only operates on graphics devices that provide the system's firmware framebuffer. If that device is not known, assume that any graphics device has been initialized by firmware.

Fixes a problem on i915 where sysfb does not release the firmware framebuffer after the native graphics driver loaded.

Fixes b49420d6a1ae ("video/aperture: optionally match the device in sysfb_disable()")
Cc Javier Martinez Canillas <[email protected]>
Cc Thomas Zimmermann <[email protected]>
Cc Helge Deller <[email protected]>
Cc Sam Ravnborg <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Alex Deucher <[email protected]>
Cc Linux regression tracking (Thorsten Leemhuis) <[email protected]>
Cc <[email protected]> # v6.11+
---
 drivers/firmware/sysfb.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/firmware/sysfb.c +3 -1
index 02a07d3d0d40..a3df782fa687 100644
@@ -67,9 +67,11 @@ static bool sysfb_unregister(void)
 void sysfb_disable(struct device *dev)
 {
 	struct screen_info *si = &screen_info;
+	struct device *parent;
 
 	mutex_lock(&disable_lock);
-	if (!dev || dev == sysfb_parent_dev(si)) {
+	parent = sysfb_parent_dev(si);
+	if (!dev || !parent || dev == parent) {
 		sysfb_unregister();
 		disabled = true;
 	}
Signature · 1 line
2.46.0
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Thomas Zimmermann

The sysfb framebuffer handling only operates on graphics devices that provide the system's firmware framebuffer. If that device is not known, assume that any graphics device has been initialized by firmware.

Fixes a problem on i915 where sysfb does not release the firmware framebuffer after the native graphics driver loaded.

Quoted 14 lines
Fixes b49420d6a1ae ("video/aperture: optionally match the device in sysfb_disable()")
Cc Javier Martinez Canillas <[email protected]>
Cc Thomas Zimmermann <[email protected]>
Cc Helge Deller <[email protected]>
Cc Sam Ravnborg <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Alex Deucher <[email protected]>
Cc Linux regression tracking (Thorsten Leemhuis) <[email protected]>
Cc <[email protected]> # v6.11+

Thanks for fixing this.

Quoted 24 lines
---
 drivers/firmware/sysfb.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/firmware/sysfb.c +3 -2
index 02a07d3d0d40..a3df782fa687 100644
@@ -67,9 +67,11 @@ static bool sysfb_unregister(void)
 void sysfb_disable(struct device *dev)
 {
        struct screen_info *si = &screen_info;
+       struct device *parent;
 
        mutex_lock(&disable_lock);
-       if (!dev || dev == sysfb_parent_dev(si)) {
+       parent = sysfb_parent_dev(si);
+       if (!dev || !parent || dev == parent) {
                sysfb_unregister();
                disabled = true;
        }
--

2.46.0

maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Thomas Zimmermann

Thomas Zimmermann <[email protected]> writes:

Hello Thomas,

Quoted 33 lines

The sysfb framebuffer handling only operates on graphics devices that provide the system's firmware framebuffer. If that device is not known, assume that any graphics device has been initialized by firmware.

Fixes a problem on i915 where sysfb does not release the firmware framebuffer after the native graphics driver loaded.

Fixes b49420d6a1ae ("video/aperture: optionally match the device in sysfb_disable()")
Cc Javier Martinez Canillas <[email protected]>
Cc Thomas Zimmermann <[email protected]>
Cc Helge Deller <[email protected]>
Cc Sam Ravnborg <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Alex Deucher <[email protected]>
Cc Linux regression tracking (Thorsten Leemhuis) <[email protected]>
Cc <[email protected]> # v6.11+
---
 drivers/firmware/sysfb.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/firmware/sysfb.c +0 -0
index 02a07d3d0d40..a3df782fa687 100644
@@ -67,9 +67,11 @@ static bool sysfb_unregister(void)
 void sysfb_disable(struct device *dev)
 {

drivers/firmware/sysfb.c static bool sysfb_unregister(void) · line 77

Quoted 10 lines
drivers/firmware/sysfb.c +3 -1
 	struct screen_info *si = &screen_info;
+	struct device *parent;
 
 	mutex_lock(&disable_lock);
-	if (!dev || dev == sysfb_parent_dev(si)) {
+	parent = sysfb_parent_dev(si);
+	if (!dev || !parent || dev == parent) {
 		sysfb_unregister();
 		disabled = true;
 	}
Signature · 5 lines
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat