drm/amdgpu: require a root bus window above 4GB for BAR resize
Subsystems (2)
PATCH 1/1 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.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +18 -0
@@ -765,6 +765,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;
@@ -772,6 +775,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,
Signature · 6 lines
2.11.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20171115201230.1365-1-christian.koenig-5C7GfCeVMHo@public.gmane.org
Deucher, Alexander
Acked-by Alex DeucherQuoted 10 lines
-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian König
Sent: Wednesday, November 15, 2017 3:13 PM
To: [email protected]
Subject: [PATCH] drm/amdgpu: require a root bus window above 4GB for BAR resize
Quoted 3 lines
Don't even try to resize the BAR when there is no window above 4GB.
Signed-off-by Christian König <[email protected]>
Quoted 50 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3
-0@@ -765,6 +765,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;drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +15
-0int r;@@ -772,6 +775,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 */
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-1pci_read_config_word (adev->pdev,PCI_COMMAND , &cmd); pci_write_config_word(adev->pdev, PCI_COMMAND, --2.11.0
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx