Skip to contentSkip to conversation

drm/amdgpu: don't free conflicting apertures for accelerators

PATCH New Alex Deucher 1 participant 1 message Oct 30, 2024

Subsystems (2)
lore
Share & tools
lore

Alex Deucher

author maintainer
#0 lore raw

PATCH 1/1 drm/amdgpu: don't free conflicting apertures for accelerators

PCI_CLASS_ACCELERATOR_PROCESSING devices won't ever be the sysfb, so there is no need to free conflicting apertures. This could lead to the sysfb aperture being freed while we still need it for the platform fb.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +10 -4
index 383bbee87df5..e74395bdebe4 100644
@@ -4290,10 +4290,16 @@ int amdgpu_device_init(struct amdgpu_device *adev,
 	if (r)
 		return r;
 
-	/* Get rid of things like offb */
-	r = drm_aperture_remove_conflicting_pci_framebuffers(adev->pdev, &amdgpu_kms_driver);
-	if (r)
-		return r;
+	/*
+	 * No need to remove conflicting FBs for accelerator class devices.
+	 * This prevents the sysfb from being freed accidently.
+	 */
+	if ((adev->pdev->class >> 8) != PCI_CLASS_ACCELERATOR_PROCESSING) {
+		/* Get rid of things like offb */
+		r = drm_aperture_remove_conflicting_pci_framebuffers(adev->pdev, &amdgpu_kms_driver);
+		if (r)
+			return r;
+	}
 
 	/* Enable TMZ based on IP_VERSION */
 	amdgpu_gmc_tmz_set(adev);
Signature · 1 line
2.47.0