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.

PCI: Convert BAR sizes bitmasks to u64

PCIe r7.0, sec 7.8.6, defines resizable BAR sizes beyond the currently
supported maximum of 128TB, which will require more than u32 to store the
entire bitmask.

Convert Resizable BAR related functions to use u64 bitmask for BAR sizes to
make the typing more future-proof.

The support for the larger BAR sizes themselves is not added at this point.

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-12-ilpo.jarvinen@linux.intel.com

authored by

Ilpo Järvinen and committed by
Bjorn Helgaas
bf0a90fc c7df7059

+6 -6
+1 -1
drivers/gpu/drm/xe/xe_vram.c
··· 69 69 70 70 if (!pci_rebar_size_supported(pdev, LMEM_BAR, rebar_size)) { 71 71 drm_info(&xe->drm, 72 - "Requested size: %lluMiB is not supported by rebar sizes: 0x%x. Leaving default: %lluMiB\n", 72 + "Requested size: %lluMiB is not supported by rebar sizes: 0x%llx. Leaving default: %lluMiB\n", 73 73 (u64)pci_rebar_size_to_bytes(rebar_size) >> 20, 74 74 pci_rebar_get_possible_sizes(pdev, LMEM_BAR), 75 75 (u64)current_size >> 20);
+1 -1
drivers/pci/iov.c
··· 1367 1367 u32 pci_iov_vf_bar_get_sizes(struct pci_dev *dev, int resno, int num_vfs) 1368 1368 { 1369 1369 u64 vf_len = pci_resource_len(dev, resno); 1370 - u32 sizes; 1370 + u64 sizes; 1371 1371 1372 1372 if (!num_vfs) 1373 1373 return 0;
+1 -1
drivers/pci/pci-sysfs.c
··· 1587 1587 pci_config_pm_runtime_get(pdev); 1588 1588 1589 1589 ret = sysfs_emit(buf, "%016llx\n", 1590 - (u64)pci_rebar_get_possible_sizes(pdev, n)); 1590 + pci_rebar_get_possible_sizes(pdev, n)); 1591 1591 1592 1592 pci_config_pm_runtime_put(pdev); 1593 1593
+2 -2
drivers/pci/rebar.c
··· 105 105 * Return: A bitmask of possible sizes (bit 0=1MB, bit 31=128TB), or %0 if 106 106 * BAR isn't resizable. 107 107 */ 108 - u32 pci_rebar_get_possible_sizes(struct pci_dev *pdev, int bar) 108 + u64 pci_rebar_get_possible_sizes(struct pci_dev *pdev, int bar) 109 109 { 110 110 int pos; 111 111 u32 cap; ··· 155 155 */ 156 156 int pci_rebar_get_max_size(struct pci_dev *pdev, int bar) 157 157 { 158 - u32 sizes; 158 + u64 sizes; 159 159 160 160 sizes = pci_rebar_get_possible_sizes(pdev, bar); 161 161 if (!sizes)
+1 -1
include/linux/pci.h
··· 1423 1423 /* Resizable BAR related routines */ 1424 1424 int pci_rebar_bytes_to_size(u64 bytes); 1425 1425 resource_size_t pci_rebar_size_to_bytes(int size); 1426 - u32 pci_rebar_get_possible_sizes(struct pci_dev *pdev, int bar); 1426 + u64 pci_rebar_get_possible_sizes(struct pci_dev *pdev, int bar); 1427 1427 bool pci_rebar_size_supported(struct pci_dev *pdev, int bar, int size); 1428 1428 int pci_rebar_get_max_size(struct pci_dev *pdev, int bar); 1429 1429 int __must_check pci_resize_resource(struct pci_dev *dev, int i, int size,