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/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

authored by

Ilpo Järvinen and committed by
Bjorn Helgaas
46ba95be 1c680f2a

+7 -8
+7 -8
drivers/gpu/drm/xe/xe_vram.c
··· 53 53 resource_size_t current_size; 54 54 resource_size_t rebar_size; 55 55 struct resource *root_res; 56 - u32 bar_size_mask; 56 + int max_size, i; 57 57 u32 pci_cmd; 58 - int i; 59 58 60 59 /* gather some relevant info */ 61 60 current_size = pci_resource_len(pdev, LMEM_BAR); 62 - bar_size_mask = pci_rebar_get_possible_sizes(pdev, LMEM_BAR); 63 - 64 - if (!bar_size_mask) 65 - return; 66 61 67 62 if (force_vram_bar_size < 0) 68 63 return; ··· 71 76 drm_info(&xe->drm, 72 77 "Requested size: %lluMiB is not supported by rebar sizes: 0x%x. Leaving default: %lluMiB\n", 73 78 (u64)pci_rebar_size_to_bytes(rebar_size) >> 20, 74 - bar_size_mask, (u64)current_size >> 20); 79 + pci_rebar_get_possible_sizes(pdev, LMEM_BAR), 80 + (u64)current_size >> 20); 75 81 return; 76 82 } 77 83 ··· 80 84 if (rebar_size == current_size) 81 85 return; 82 86 } else { 83 - rebar_size = pci_rebar_size_to_bytes(__fls(bar_size_mask)); 87 + max_size = pci_rebar_get_max_size(pdev, LMEM_BAR); 88 + if (max_size < 0) 89 + return; 90 + rebar_size = pci_rebar_size_to_bytes(max_size); 84 91 85 92 /* only resize if larger than current */ 86 93 if (rebar_size <= current_size)