All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fbdev/efifb: Release PCI device's runtime PM ref during FB destroy
@ 2021-08-02 13:35 ` Imre Deak
  0 siblings, 0 replies; 23+ messages in thread
From: Imre Deak @ 2021-08-02 13:35 UTC (permalink / raw)
  To: linux-fbdev, Kai-Heng Feng
  Cc: dri-devel, Thomas Zimmermann, Alex Deucher, intel-gfx

Atm the EFI FB driver gets a runtime PM reference for the associated GFX
PCI device during driver probing and releases it only when removing the
driver.

When fbcon switches to the FB provided by the PCI device's driver (for
instance i915/drmfb), the EFI FB will get only unregistered without the
EFI FB driver getting unloaded, keeping the runtime PM reference
acquired during driver probing. This reference will prevent the PCI
driver from runtime suspending the device.

Fix this by releasing the RPM reference from the EFI FB's destroy hook,
called when the FB gets unregistered.

Fixes: a6c0fd3d5a8b ("efifb: Ensure graphics device for efifb stays at PCI D0")
Cc: Kai-Heng Feng <kai.heng.feng@canonical.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 drivers/video/fbdev/efifb.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/video/fbdev/efifb.c b/drivers/video/fbdev/efifb.c
index 8ea8f079cde26..25cdea32b9633 100644
--- a/drivers/video/fbdev/efifb.c
+++ b/drivers/video/fbdev/efifb.c
@@ -47,6 +47,8 @@ static bool use_bgrt = true;
 static bool request_mem_succeeded = false;
 static u64 mem_flags = EFI_MEMORY_WC | EFI_MEMORY_UC;
 
+static struct pci_dev *efifb_pci_dev;	/* dev with BAR covering the efifb */
+
 static struct fb_var_screeninfo efifb_defined = {
 	.activate		= FB_ACTIVATE_NOW,
 	.height			= -1,
@@ -243,6 +245,9 @@ static inline void efifb_show_boot_graphics(struct fb_info *info) {}
 
 static void efifb_destroy(struct fb_info *info)
 {
+	if (efifb_pci_dev)
+		pm_runtime_put(&efifb_pci_dev->dev);
+
 	if (info->screen_base) {
 		if (mem_flags & (EFI_MEMORY_UC | EFI_MEMORY_WC))
 			iounmap(info->screen_base);
@@ -333,7 +338,6 @@ ATTRIBUTE_GROUPS(efifb);
 
 static bool pci_dev_disabled;	/* FB base matches BAR of a disabled device */
 
-static struct pci_dev *efifb_pci_dev;	/* dev with BAR covering the efifb */
 static struct resource *bar_resource;
 static u64 bar_offset;
 
@@ -603,8 +607,6 @@ static int efifb_remove(struct platform_device *pdev)
 	unregister_framebuffer(info);
 	sysfs_remove_groups(&pdev->dev.kobj, efifb_groups);
 	framebuffer_release(info);
-	if (efifb_pci_dev)
-		pm_runtime_put(&efifb_pci_dev->dev);
 
 	return 0;
 }
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2021-08-13 13:46 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-02 13:35 [PATCH] fbdev/efifb: Release PCI device's runtime PM ref during FB destroy Imre Deak
2021-08-02 13:35 ` [Intel-gfx] " Imre Deak
2021-08-02 15:05 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
2021-08-03  0:58 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2021-08-04 22:23 ` [Intel-gfx] [PATCH] " Daniel Vetter
2021-08-07 15:21   ` Imre Deak
2021-08-09 14:19     ` Daniel Vetter
2021-08-09 13:31 ` [PATCH v2] " Imre Deak
2021-08-09 13:31   ` [Intel-gfx] " Imre Deak
2021-08-10  8:36   ` Imre Deak
2021-08-10 14:48     ` Alex Deucher
2021-08-10 14:48       ` Alex Deucher
2021-08-10 15:20       ` Kai-Heng Feng
2021-08-10 15:20         ` Kai-Heng Feng
2021-08-13 13:46   ` Imre Deak
2021-08-09 14:49 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for fbdev/efifb: Release PCI device's runtime PM ref during FB destroy (rev2) Patchwork
2021-08-09 15:12   ` Imre Deak
2021-08-09 16:37     ` Vudum, Lakshminarayana
2021-08-09 16:10 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2021-08-09 17:23 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2021-08-09 17:57   ` Imre Deak
2021-08-09 18:32     ` Vudum, Lakshminarayana
2021-08-09 18:21 ` [Intel-gfx] ✓ Fi.CI.IGT: success " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.