Merge tag 'kvmarm-fixes-5.11-2' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-microblaze.git] / drivers / gpu / drm / amd / amdgpu / amdgpu_kms.c
index fc12fc7..b16b327 100644 (file)
@@ -133,6 +133,7 @@ void amdgpu_register_gpu_instance(struct amdgpu_device *adev)
 int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags)
 {
        struct drm_device *dev;
+       struct pci_dev *parent;
        int r, acpi_status;
 
        dev = adev_to_drm(adev);
@@ -144,6 +145,9 @@ int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags)
            !pci_is_thunderbolt_attached(dev->pdev))
                flags |= AMD_IS_PX;
 
+       parent = pci_upstream_bridge(adev->pdev);
+       adev->has_pr3 = parent ? pci_pr3_present(parent) : false;
+
        /* amdgpu_device_init should report only fatal error
         * like memory allocation failure or iomapping failure,
         * or memory manager initialization failure, it must
@@ -156,9 +160,14 @@ int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags)
                goto out;
        }
 
-       if (amdgpu_device_supports_boco(dev) &&
-           (amdgpu_runtime_pm != 0)) { /* enable runpm by default for boco */
+       if (amdgpu_device_supports_atpx(dev) &&
+           (amdgpu_runtime_pm != 0)) { /* enable runpm by default for atpx */
+               adev->runpm = true;
+               dev_info(adev->dev, "Using ATPX for runtime pm\n");
+       } else if (amdgpu_device_supports_boco(dev) &&
+                  (amdgpu_runtime_pm != 0)) { /* enable runpm by default for boco */
                adev->runpm = true;
+               dev_info(adev->dev, "Using BOCO for runtime pm\n");
        } else if (amdgpu_device_supports_baco(dev) &&
                   (amdgpu_runtime_pm != 0)) {
                switch (adev->asic_type) {
@@ -180,6 +189,8 @@ int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags)
                        adev->runpm = true;
                        break;
                }
+               if (adev->runpm)
+                       dev_info(adev->dev, "Using BACO for runtime pm\n");
        }
 
        /* Call ACPI methods: require modeset init
@@ -192,7 +203,7 @@ int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags)
 
        if (adev->runpm) {
                /* only need to skip on ATPX */
-               if (amdgpu_device_supports_boco(dev) &&
+               if (amdgpu_device_supports_atpx(dev) &&
                    !amdgpu_is_atpx_hybrid())
                        dev_pm_set_driver_flags(dev->dev, DPM_FLAG_NO_DIRECT_COMPLETE);
                pm_runtime_use_autosuspend(dev->dev);