Commit 0884abb259f180bc737cdb2c681d907b86f266e8
Committed by
Greg Kroah-Hartman
1 parent
03f836fcb6
drm/amdgpu: move PX checking into amdgpu_device_ip_early_init
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>
Showing 2 changed files with 13 additions and 11 deletions Side-by-side Diff
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
... | ... | @@ -30,6 +30,7 @@ |
30 | 30 | #include <linux/module.h> |
31 | 31 | #include <linux/console.h> |
32 | 32 | #include <linux/slab.h> |
33 | +#include <linux/pci.h> | |
33 | 34 | |
34 | 35 | #include <drm/drm_atomic_helper.h> |
35 | 36 | #include <drm/drm_probe_helper.h> |
... | ... | @@ -2069,6 +2070,8 @@ |
2069 | 2070 | */ |
2070 | 2071 | static int amdgpu_device_ip_early_init(struct amdgpu_device *adev) |
2071 | 2072 | { |
2073 | + struct drm_device *dev = adev_to_drm(adev); | |
2074 | + struct pci_dev *parent; | |
2072 | 2075 | int i, r; |
2073 | 2076 | |
2074 | 2077 | amdgpu_device_enable_virtual_display(adev); |
... | ... | @@ -2167,6 +2170,16 @@ |
2167 | 2170 | /* FIXME: not supported yet */ |
2168 | 2171 | return -EINVAL; |
2169 | 2172 | } |
2173 | + | |
2174 | + if (amdgpu_has_atpx() && | |
2175 | + (amdgpu_is_atpx_hybrid() || | |
2176 | + amdgpu_has_atpx_dgpu_power_cntl()) && | |
2177 | + ((adev->flags & AMD_IS_APU) == 0) && | |
2178 | + !pci_is_thunderbolt_attached(to_pci_dev(dev->dev))) | |
2179 | + adev->flags |= AMD_IS_PX; | |
2180 | + | |
2181 | + parent = pci_upstream_bridge(adev->pdev); | |
2182 | + adev->has_pr3 = parent ? pci_pr3_present(parent) : false; | |
2170 | 2183 | |
2171 | 2184 | amdgpu_amdkfd_device_probe(adev); |
2172 | 2185 |
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
... | ... | @@ -152,20 +152,9 @@ |
152 | 152 | int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags) |
153 | 153 | { |
154 | 154 | struct drm_device *dev; |
155 | - struct pci_dev *parent; | |
156 | 155 | int r, acpi_status; |
157 | 156 | |
158 | 157 | dev = adev_to_drm(adev); |
159 | - | |
160 | - if (amdgpu_has_atpx() && | |
161 | - (amdgpu_is_atpx_hybrid() || | |
162 | - amdgpu_has_atpx_dgpu_power_cntl()) && | |
163 | - ((flags & AMD_IS_APU) == 0) && | |
164 | - !pci_is_thunderbolt_attached(to_pci_dev(dev->dev))) | |
165 | - flags |= AMD_IS_PX; | |
166 | - | |
167 | - parent = pci_upstream_bridge(adev->pdev); | |
168 | - adev->has_pr3 = parent ? pci_pr3_present(parent) : false; | |
169 | 158 | |
170 | 159 | /* amdgpu_device_init should report only fatal error |
171 | 160 | * like memory allocation failure or iomapping failure, |