summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2017-11-15 20:07:38 +0100
committerAlex Deucher <alexander.deucher@amd.com>2017-12-06 12:47:53 -0500
commit31b8adab3247eaa6cffbaa59276456b694718cc8 (patch)
treef093fc4787187182109c64a1c9ee9506abc8260d /drivers
parent35888630cb65d2a7e28f44b042b671f7d6e91f60 (diff)
downloadlinux-stable-31b8adab3247eaa6cffbaa59276456b694718cc8.tar.gz
linux-stable-31b8adab3247eaa6cffbaa59276456b694718cc8.tar.bz2
linux-stable-31b8adab3247eaa6cffbaa59276456b694718cc8.zip
drm/amdgpu: require a root bus window above 4GB for BAR resize
Don't even try to resize the BAR when there is no window above 4GB. Signed-off-by: Christian König <christian.koenig@amd.com> Acked-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_device.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 636a9138067e..4e668b70371e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -764,6 +764,9 @@ int amdgpu_device_resize_fb_bar(struct amdgpu_device *adev)
{
u64 space_needed = roundup_pow_of_two(adev->mc.real_vram_size);
u32 rbar_size = order_base_2(((space_needed >> 20) | 1)) - 1;
+ struct pci_bus *root;
+ struct resource *res;
+ unsigned i;
u16 cmd;
int r;
@@ -771,6 +774,21 @@ int amdgpu_device_resize_fb_bar(struct amdgpu_device *adev)
if (amdgpu_sriov_vf(adev))
return 0;
+ /* Check if the root BUS has 64bit memory resources */
+ root = adev->pdev->bus;
+ while (root->parent)
+ root = root->parent;
+
+ pci_bus_for_each_resource(root, res, i) {
+ if (res && res->flags & IORESOURCE_MEM_64 &&
+ res->start > 0x100000000ull)
+ break;
+ }
+
+ /* Trying to resize is pointless without a root hub window above 4GB */
+ if (!res)
+ return 0;
+
/* Disable memory decoding while we change the BAR addresses and size */
pci_read_config_word(adev->pdev, PCI_COMMAND, &cmd);
pci_write_config_word(adev->pdev, PCI_COMMAND,