mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
drm/amdgpu: Use pci_rebar_get_max_size()
Use pci_rebar_get_max_size() to simplify amdgpu_device_resize_fb_bar(). Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Christian König <christian.koenig@amd.com> Link: https://patch.msgid.link/20251113180053.27944-11-ilpo.jarvinen@linux.intel.com
This commit is contained in:
committed by
Bjorn Helgaas
parent
46ba95bed9
commit
c7df7059e3
@@ -1673,9 +1673,9 @@ int amdgpu_device_resize_fb_bar(struct amdgpu_device *adev)
|
|||||||
int rbar_size = pci_rebar_bytes_to_size(adev->gmc.real_vram_size);
|
int rbar_size = pci_rebar_bytes_to_size(adev->gmc.real_vram_size);
|
||||||
struct pci_bus *root;
|
struct pci_bus *root;
|
||||||
struct resource *res;
|
struct resource *res;
|
||||||
|
int max_size, r;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
u16 cmd;
|
u16 cmd;
|
||||||
int r;
|
|
||||||
|
|
||||||
if (!IS_ENABLED(CONFIG_PHYS_ADDR_T_64BIT))
|
if (!IS_ENABLED(CONFIG_PHYS_ADDR_T_64BIT))
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1721,8 +1721,10 @@ int amdgpu_device_resize_fb_bar(struct amdgpu_device *adev)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Limit the BAR size to what is available */
|
/* Limit the BAR size to what is available */
|
||||||
rbar_size = min(fls(pci_rebar_get_possible_sizes(adev->pdev, 0)) - 1,
|
max_size = pci_rebar_get_max_size(adev->pdev, 0);
|
||||||
rbar_size);
|
if (max_size < 0)
|
||||||
|
return 0;
|
||||||
|
rbar_size = min(max_size, rbar_size);
|
||||||
|
|
||||||
/* Disable memory decoding while we change the BAR addresses and size */
|
/* Disable memory decoding while we change the BAR addresses and size */
|
||||||
pci_read_config_word(adev->pdev, PCI_COMMAND, &cmd);
|
pci_read_config_word(adev->pdev, PCI_COMMAND, &cmd);
|
||||||
|
|||||||
Reference in New Issue
Block a user