summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2022-03-02 12:53:46 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2022-03-02 12:53:46 +0000
commitb2e5c779172c5c90cbb40faae65bb8185808363f (patch)
tree24fd2cb05ed48bdbfb0593952a20191cdf413798
parentc6119c9785657e099c2c98105169c7cf734ee70e (diff)
drm/amd: Check if ASPM is enabled from PCIe subsystem
From Mario Limonciello ea44fcee7e3d87725423c904306a99cd42bd24b7 in linux 5.15.y/5.15.26 7294863a6f01248d72b61d38478978d638641bee in mainline linux
-rw-r--r--sys/dev/pci/drm/amd/amdgpu/amdgpu_drv.c3
-rw-r--r--sys/dev/pci/drm/amd/amdgpu/amdgpu_kms.c6
2 files changed, 8 insertions, 1 deletions
diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_drv.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_drv.c
index 0914e142eb9..ce524e36159 100644
--- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_drv.c
+++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_drv.c
@@ -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;
diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_kms.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_kms.c
index 193f66774a3..e8cbeabd125 100644
--- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_kms.c
+++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_kms.c
@@ -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;