]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
drm/amdgpu: move PX checking into amdgpu_device_ip_early_init
authorAlex Deucher <alexander.deucher@amd.com>
Mon, 24 Jan 2022 18:42:30 +0000 (13:42 -0500)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 20 May 2022 12:37:18 +0000 (14:37 +0200)
BugLink: https://bugs.launchpad.net/bugs/1969110
commit 901e2be20dc55079997ea1885ea77fc72e6826e7 upstream.

We need to set the APU flag from IP discovery before
we evaluate this code.

Acked-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 0884abb259f180bc737cdb2c681d907b86f266e8)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c

index 1545884dc703e828ddb0b64f07068a46857c0a6e..c3f91f20988b0f6384b4fbc34119c705592a154d 100644 (file)
@@ -30,6 +30,7 @@
 #include <linux/module.h>
 #include <linux/console.h>
 #include <linux/slab.h>
+#include <linux/pci.h>
 
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_probe_helper.h>
@@ -2069,6 +2070,8 @@ out:
  */
 static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)
 {
+       struct drm_device *dev = adev_to_drm(adev);
+       struct pci_dev *parent;
        int i, r;
 
        amdgpu_device_enable_virtual_display(adev);
@@ -2168,6 +2171,16 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)
                return -EINVAL;
        }
 
+       if (amdgpu_has_atpx() &&
+           (amdgpu_is_atpx_hybrid() ||
+            amdgpu_has_atpx_dgpu_power_cntl()) &&
+           ((adev->flags & AMD_IS_APU) == 0) &&
+           !pci_is_thunderbolt_attached(to_pci_dev(dev->dev)))
+               adev->flags |= AMD_IS_PX;
+
+       parent = pci_upstream_bridge(adev->pdev);
+       adev->has_pr3 = parent ? pci_pr3_present(parent) : false;
+
        amdgpu_amdkfd_device_probe(adev);
 
        adev->pm.pp_feature = amdgpu_pp_feature_mask;
index 09a2fe839059164c2b444a14dcc5ec41fc1987b3..6744427577b36d4aa768b79dd44224e5eab53560 100644 (file)
@@ -152,21 +152,10 @@ static void amdgpu_get_audio_func(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);
 
-       if (amdgpu_has_atpx() &&
-           (amdgpu_is_atpx_hybrid() ||
-            amdgpu_has_atpx_dgpu_power_cntl()) &&
-           ((flags & AMD_IS_APU) == 0) &&
-           !pci_is_thunderbolt_attached(to_pci_dev(dev->dev)))
-               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