From: Zack Rusin <zack.rusin@broadcom.com>
To: dri-devel@lists.freedesktop.org
Cc: "Alex Deucher" <alexander.deucher@amd.com>,
"Christian König" <christian.koenig@amd.com>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Lijo Lazar" <lijo.lazar@amd.com>,
"Hawking Zhang" <Hawking.Zhang@amd.com>,
"Mario Limonciello" <mario.limonciello@amd.com>,
"Ce Sun" <cesun102@amd.com>,
"Mario Limonciello (AMD)" <superm1@kernel.org>,
"Timur Kristóf" <timur.kristof@gmail.com>,
"Vitaly Prosyak" <vitaly.prosyak@amd.com>,
amd-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: [PATCH 04/12] drm/amdgpu: Use devm aperture helpers for sysfb restore on probe failure
Date: Mon, 29 Dec 2025 16:58:10 -0500 [thread overview]
Message-ID: <20251229215906.3688205-5-zack.rusin@broadcom.com> (raw)
In-Reply-To: <20251229215906.3688205-1-zack.rusin@broadcom.com>
Use devm_aperture_remove_conflicting_pci_devices() instead of the
non-devm variant to automatically restore the system framebuffer
(efifb/simpledrm) if the driver's probe fails after removing the
firmware framebuffer.
Call devm_aperture_remove_conflicting_pci_devices_done() after
successful probe to cancel the automatic restore, as the driver
is now responsible for display output.
The aperture removal only applies to VGA and display class devices,
matching the existing behavior. This ensures users don't lose
display output if the amdgpu driver fails to probe after removing
the firmware framebuffer.
Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: David Airlie <airlied@gmail.com>
Cc: Simona Vetter <simona@ffwll.ch>
Cc: Lijo Lazar <lijo.lazar@amd.com>
Cc: Hawking Zhang <Hawking.Zhang@amd.com>
Cc: Mario Limonciello <mario.limonciello@amd.com>
Cc: Ce Sun <cesun102@amd.com>
Cc: "Mario Limonciello (AMD)" <superm1@kernel.org>
Cc: "Timur Kristóf" <timur.kristof@gmail.com>
Cc: Vitaly Prosyak <vitaly.prosyak@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
---
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 9 +++++++--
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 7 +++++++
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 58c3ffe707d1..6c867657225e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -4737,8 +4737,13 @@ int amdgpu_device_init(struct amdgpu_device *adev,
*/
if ((pdev->class >> 8) == PCI_CLASS_DISPLAY_VGA ||
(pdev->class >> 8) == PCI_CLASS_DISPLAY_OTHER) {
- /* Get rid of things like offb */
- r = aperture_remove_conflicting_pci_devices(adev->pdev, amdgpu_kms_driver.name);
+ /*
+ * Get rid of things like offb. Use devm variant to
+ * automatically restore sysfb if probe fails. This ensures
+ * the user doesn't lose display if our probe fails after
+ * removing the firmware framebuffer (efifb/simpledrm).
+ */
+ r = devm_aperture_remove_conflicting_pci_devices(adev->pdev, amdgpu_kms_driver.name);
if (r)
return r;
}
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 2dfbddcef9ab..fc2d2dbaebe8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -32,6 +32,7 @@
#include <drm/drm_probe_helper.h>
#include <drm/drm_vblank.h>
+#include <linux/aperture.h>
#include <linux/cc_platform.h>
#include <linux/dynamic_debug.h>
#include <linux/module.h>
@@ -2528,6 +2529,12 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
amdgpu_get_secondary_funcs(adev);
}
+ /*
+ * Probe succeeded - cancel the automatic sysfb restore action.
+ * We're now responsible for display output.
+ */
+ devm_aperture_remove_conflicting_pci_devices_done(pdev);
+
return 0;
err_pci:
--
2.48.1
next prev parent reply other threads:[~2025-12-29 21:59 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-29 21:58 [PATCH 00/12] Recover sysfb after DRM " Zack Rusin
2025-12-29 21:58 ` [PATCH 01/12] video/aperture: Add sysfb restore on " Zack Rusin
2025-12-29 21:58 ` [PATCH 02/12] drm/vmwgfx: Use devm aperture helpers for sysfb restore on " Zack Rusin
2025-12-29 21:58 ` [PATCH 03/12] drm/xe: " Zack Rusin
2025-12-29 21:58 ` Zack Rusin [this message]
2025-12-29 21:58 ` [PATCH 05/12] drm/virtio: Add " Zack Rusin
2026-01-15 10:12 ` Dmitry Osipenko
2025-12-29 21:58 ` [PATCH 06/12] drm/nouveau: Use devm aperture helpers for " Zack Rusin
2025-12-29 21:58 ` [PATCH 07/12] drm/qxl: " Zack Rusin
2025-12-29 21:58 ` [PATCH 08/12] drm/vboxvideo: " Zack Rusin
2025-12-29 21:58 ` [PATCH 09/12] drm/hyperv: Add " Zack Rusin
2025-12-29 21:58 ` [PATCH 10/12] drm/ast: Use devm aperture helpers for " Zack Rusin
2025-12-29 21:58 ` [PATCH 11/12] drm/radeon: " Zack Rusin
2025-12-29 21:58 ` [PATCH 12/12] drm/i915: " Zack Rusin
2026-01-09 10:34 ` [PATCH 00/12] Recover sysfb after DRM " Thomas Zimmermann
2026-01-10 4:52 ` Zack Rusin
2026-01-15 11:02 ` Thomas Zimmermann
2026-01-15 14:39 ` Christian König
2026-01-15 14:54 ` Thomas Zimmermann
2026-01-15 15:58 ` Christian König
2026-01-15 15:10 ` Ville Syrjälä
2026-01-15 16:36 ` Gerd Hoffmann
2026-01-15 16:39 ` Mario Limonciello
2026-01-16 7:39 ` Thomas Zimmermann
2026-01-16 3:59 ` Zack Rusin
2026-01-16 7:58 ` Thomas Zimmermann
2026-01-17 6:02 ` Zack Rusin
2026-01-19 10:03 ` Christian König
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251229215906.3688205-5-zack.rusin@broadcom.com \
--to=zack.rusin@broadcom.com \
--cc=Hawking.Zhang@amd.com \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=cesun102@amd.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=lijo.lazar@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=simona@ffwll.ch \
--cc=superm1@kernel.org \
--cc=timur.kristof@gmail.com \
--cc=vitaly.prosyak@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®