]> Gentwo Git Trees - linux/.git/commitdiff
PCI: Convert BAR sizes bitmasks to u64
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Thu, 13 Nov 2025 18:00:53 +0000 (20:00 +0200)
committerBjorn Helgaas <bhelgaas@google.com>
Fri, 14 Nov 2025 18:34:22 +0000 (12:34 -0600)
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
drivers/gpu/drm/xe/xe_vram.c
drivers/pci/iov.c
drivers/pci/pci-sysfs.c
drivers/pci/rebar.c
include/linux/pci.h

index 524469f8a4bd71e47e3dd82f4b554aa47b92fa12..10f8a73e190bd54274d38d8cbf5d527ba0a79e89 100644 (file)
@@ -69,7 +69,7 @@ static void resize_vram_bar(struct xe_device *xe)
 
                if (!pci_rebar_size_supported(pdev, LMEM_BAR, rebar_size)) {
                        drm_info(&xe->drm,
-                                "Requested size: %lluMiB is not supported by rebar sizes: 0x%x. Leaving default: %lluMiB\n",
+                                "Requested size: %lluMiB is not supported by rebar sizes: 0x%llx. Leaving default: %lluMiB\n",
                                 (u64)pci_rebar_size_to_bytes(rebar_size) >> 20,
                                 pci_rebar_get_possible_sizes(pdev, LMEM_BAR),
                                 (u64)current_size >> 20);
index 71ed85d38508451c23fc0f34345c9915e440e7dc..00784a60ba80bb55ff2790d8f87e15a90c652a24 100644 (file)
@@ -1367,7 +1367,7 @@ EXPORT_SYMBOL_GPL(pci_iov_vf_bar_set_size);
 u32 pci_iov_vf_bar_get_sizes(struct pci_dev *dev, int resno, int num_vfs)
 {
        u64 vf_len = pci_resource_len(dev, resno);
-       u32 sizes;
+       u64 sizes;
 
        if (!num_vfs)
                return 0;
index 2a1b5456c2dc1d0435ceb0a68c5976753b75b611..cb512bf0df7cc04e43c8d29601b7aae34d1d5acb 100644 (file)
@@ -1587,7 +1587,7 @@ static ssize_t __resource_resize_show(struct device *dev, int n, char *buf)
        pci_config_pm_runtime_get(pdev);
 
        ret = sysfs_emit(buf, "%016llx\n",
-                        (u64)pci_rebar_get_possible_sizes(pdev, n));
+                        pci_rebar_get_possible_sizes(pdev, n));
 
        pci_config_pm_runtime_put(pdev);
 
index e99b89bd5e5119b0b8fa40873205067811399b67..7f6dece19138e6b276563d4c1ca09c297d00a274 100644 (file)
@@ -105,7 +105,7 @@ static int pci_rebar_find_pos(struct pci_dev *pdev, int bar)
  * Return: A bitmask of possible sizes (bit 0=1MB, bit 31=128TB), or %0 if
  *        BAR isn't resizable.
  */
-u32 pci_rebar_get_possible_sizes(struct pci_dev *pdev, int bar)
+u64 pci_rebar_get_possible_sizes(struct pci_dev *pdev, int bar)
 {
        int pos;
        u32 cap;
@@ -155,7 +155,7 @@ EXPORT_SYMBOL_GPL(pci_rebar_size_supported);
  */
 int pci_rebar_get_max_size(struct pci_dev *pdev, int bar)
 {
-       u32 sizes;
+       u64 sizes;
 
        sizes = pci_rebar_get_possible_sizes(pdev, bar);
        if (!sizes)
index 898bc3a4e8e7db98bd4f26754a11b681f6035505..4b7f4c08b5c7b919bd8f7bac9a2920c53f9bd314 100644 (file)
@@ -1423,7 +1423,7 @@ int pci_release_resource(struct pci_dev *dev, int resno);
 /* Resizable BAR related routines */
 int pci_rebar_bytes_to_size(u64 bytes);
 resource_size_t pci_rebar_size_to_bytes(int size);
-u32 pci_rebar_get_possible_sizes(struct pci_dev *pdev, int bar);
+u64 pci_rebar_get_possible_sizes(struct pci_dev *pdev, int bar);
 bool pci_rebar_size_supported(struct pci_dev *pdev, int bar, int size);
 int pci_rebar_get_max_size(struct pci_dev *pdev, int bar);
 int __must_check pci_resize_resource(struct pci_dev *dev, int i, int size,