mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 18:13:41 +02:00
drm/xe/vram: Use pci_rebar_get_max_size()
Use pci_rebar_get_max_size() from PCI core in resize_vram_bar() to simplify code. Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Christian König <christian.koenig@amd.com> Acked-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Link: https://patch.msgid.link/20251113180053.27944-10-ilpo.jarvinen@linux.intel.com
This commit is contained in:
parent
1c680f2acd
commit
46ba95bed9
|
|
@ -53,16 +53,11 @@ static void resize_vram_bar(struct xe_device *xe)
|
|||
resource_size_t current_size;
|
||||
resource_size_t rebar_size;
|
||||
struct resource *root_res;
|
||||
u32 bar_size_mask;
|
||||
int max_size, i;
|
||||
u32 pci_cmd;
|
||||
int i;
|
||||
|
||||
/* gather some relevant info */
|
||||
current_size = pci_resource_len(pdev, LMEM_BAR);
|
||||
bar_size_mask = pci_rebar_get_possible_sizes(pdev, LMEM_BAR);
|
||||
|
||||
if (!bar_size_mask)
|
||||
return;
|
||||
|
||||
if (force_vram_bar_size < 0)
|
||||
return;
|
||||
|
|
@ -76,7 +71,8 @@ static void resize_vram_bar(struct xe_device *xe)
|
|||
drm_info(&xe->drm,
|
||||
"Requested size: %lluMiB is not supported by rebar sizes: 0x%x. Leaving default: %lluMiB\n",
|
||||
(u64)pci_rebar_size_to_bytes(rebar_size) >> 20,
|
||||
bar_size_mask, (u64)current_size >> 20);
|
||||
pci_rebar_get_possible_sizes(pdev, LMEM_BAR),
|
||||
(u64)current_size >> 20);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -84,7 +80,10 @@ static void resize_vram_bar(struct xe_device *xe)
|
|||
if (rebar_size == current_size)
|
||||
return;
|
||||
} else {
|
||||
rebar_size = pci_rebar_size_to_bytes(__fls(bar_size_mask));
|
||||
max_size = pci_rebar_get_max_size(pdev, LMEM_BAR);
|
||||
if (max_size < 0)
|
||||
return;
|
||||
rebar_size = pci_rebar_size_to_bytes(max_size);
|
||||
|
||||
/* only resize if larger than current */
|
||||
if (rebar_size <= current_size)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user