]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/amdgpu: don't free conflicting apertures for non-display devices
authorAlex Deucher <alexander.deucher@amd.com>
Wed, 25 Sep 2024 14:29:31 +0000 (10:29 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 18 Mar 2025 18:03:38 +0000 (14:03 -0400)
PCI_CLASS_ACCELERATOR_PROCESSING devices won't ever be
the sysfb, so there is no need to free conflicting
apertures.

Reviewed-by: Kent Russell <kent.russell@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

index 17ce1677378e2bd57c8038bc08b3abd6742df3c9..cc0b6c70fcb8f5b411c78bd244c318064a3ee06a 100644 (file)
@@ -4399,10 +4399,17 @@ int amdgpu_device_init(struct amdgpu_device *adev,
        if (r)
                return r;
 
-       /* Get rid of things like offb */
-       r = aperture_remove_conflicting_pci_devices(adev->pdev, amdgpu_kms_driver.name);
-       if (r)
-               return r;
+       /*
+        * No need to remove conflicting FBs for non-display class devices.
+        * This prevents the sysfb from being freed accidently.
+        */
+       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);
+               if (r)
+                       return r;
+       }
 
        /* Enable TMZ based on IP_VERSION */
        amdgpu_gmc_tmz_set(adev);