drm/amd: Check if ASPM is enabled from PCIe subsystem
authorjsg <jsg@openbsd.org>
Wed, 2 Mar 2022 12:53:45 +0000 (12:53 +0000)
committerjsg <jsg@openbsd.org>
Wed, 2 Mar 2022 12:53:45 +0000 (12:53 +0000)
From Mario Limonciello
ea44fcee7e3d87725423c904306a99cd42bd24b7 in linux 5.15.y/5.15.26
7294863a6f01248d72b61d38478978d638641bee in mainline linux

sys/dev/pci/drm/amd/amdgpu/amdgpu_drv.c
sys/dev/pci/drm/amd/amdgpu/amdgpu_kms.c

index 0914e14..ce524e3 100644 (file)
@@ -1279,6 +1279,9 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
        bool is_fw_fb;
        resource_size_t base, size;
 
+       if (amdgpu_aspm == -1 && !pcie_aspm_enabled(pdev))
+               amdgpu_aspm = 0;
+
        if (amdgpu_virtual_display ||
            amdgpu_device_asic_has_dc_support(flags & AMD_ASIC_MASK))
                supports_atomic = true;
index 193f667..e8cbeab 100644 (file)
@@ -1855,7 +1855,7 @@ amdgpu_attach(struct device *parent, struct device *self, void *aux)
 
        printf("\n");
 
-       /* from amdgpu_pci_probe() */
+       /* from amdgpu_pci_probe(), aspm test done later */
 
        if (!amdgpu_virtual_display &&
             amdgpu_device_asic_has_dc_support(adev->family))
@@ -1880,6 +1880,10 @@ amdgpu_attach(struct device *parent, struct device *self, void *aux)
        adev->pdev = dev->pdev;
        adev->is_fw_fb = adev->primary;
 
+       /* from amdgpu_pci_probe() */
+       if (amdgpu_aspm == -1 && !pcie_aspm_enabled(adev->pdev))
+               amdgpu_aspm = 0;
+
        if (!supports_atomic)
                dev->driver_features &= ~DRIVER_ATOMIC;