Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

authored by

Ilpo Järvinen and committed by
Bjorn Helgaas
c7df7059 46ba95be

+5 -3
+5 -3
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
··· 1673 1673 int rbar_size = pci_rebar_bytes_to_size(adev->gmc.real_vram_size); 1674 1674 struct pci_bus *root; 1675 1675 struct resource *res; 1676 + int max_size, r; 1676 1677 unsigned int i; 1677 1678 u16 cmd; 1678 - int r; 1679 1679 1680 1680 if (!IS_ENABLED(CONFIG_PHYS_ADDR_T_64BIT)) 1681 1681 return 0; ··· 1721 1721 return 0; 1722 1722 1723 1723 /* Limit the BAR size to what is available */ 1724 - rbar_size = min(fls(pci_rebar_get_possible_sizes(adev->pdev, 0)) - 1, 1725 - rbar_size); 1724 + max_size = pci_rebar_get_max_size(adev->pdev, 0); 1725 + if (max_size < 0) 1726 + return 0; 1727 + rbar_size = min(max_size, rbar_size); 1726 1728 1727 1729 /* Disable memory decoding while we change the BAR addresses and size */ 1728 1730 pci_read_config_word(adev->pdev, PCI_COMMAND, &cmd);