drivers/gpu/drm/xe/xe_pci_rebar.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/xe/xe_pci_rebar.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/xe/xe_pci_rebar.c- Extension
.c- Size
- 3010 bytes
- Lines
- 107
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/pci.hlinux/types.hregs/xe_bars.hxe_device_types.hxe_module.hxe_pci_rebar.hxe_printk.h
Detected Declarations
function resize_barfunction xe_pci_rebar_resizefunction pci_bus_for_each_resource
Annotated Snippet
if (!pci_rebar_size_supported(pdev, LMEM_BAR, rebar_size)) {
xe_info(xe, "Requested size %lluMiB is not supported by rebar sizes: 0x%llx. Leaving default: %lluMiB\n",
(u64)pci_rebar_size_to_bytes(rebar_size) >> ilog2(SZ_1M),
pci_rebar_get_possible_sizes(pdev, LMEM_BAR),
(u64)current_size >> ilog2(SZ_1M));
return;
}
rebar_size = pci_rebar_size_to_bytes(rebar_size);
if (rebar_size == current_size)
return;
} else {
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)
return;
}
xe_info(xe, "Attempting to resize bar from %lluMiB -> %lluMiB\n",
(u64)current_size >> ilog2(SZ_1M), (u64)rebar_size >> ilog2(SZ_1M));
while (root->parent)
root = root->parent;
pci_bus_for_each_resource(root, root_res, i) {
if (root_res && root_res->flags & (IORESOURCE_MEM | IORESOURCE_MEM_64) &&
(u64)root_res->start > 0x100000000ul)
break;
}
if (!root_res) {
xe_info(xe, "Can't resize VRAM BAR - platform support is missing. Consider enabling 'Resizable BAR' support in your BIOS\n");
return;
}
pci_read_config_dword(pdev, PCI_COMMAND, &pci_cmd);
pci_write_config_dword(pdev, PCI_COMMAND, pci_cmd & ~PCI_COMMAND_MEMORY);
resize_bar(xe, LMEM_BAR, rebar_size);
pci_assign_unassigned_bus_resources(pdev->bus);
pci_write_config_dword(pdev, PCI_COMMAND, pci_cmd);
}
Annotation
- Immediate include surface: `linux/pci.h`, `linux/types.h`, `regs/xe_bars.h`, `xe_device_types.h`, `xe_module.h`, `xe_pci_rebar.h`, `xe_printk.h`.
- Detected declarations: `function resize_bar`, `function xe_pci_rebar_resize`, `function pci_bus_for_each_resource`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.