hv_pci_alloc...idge_windows(9)
π hv_pci_alloc...idge_windows(9) π
okay so bestie, welcome to the Kernel API Manual β¨ this one's about hv_pci_allocate_bridge_windows, and it's honestly such a mood β a little hack that makes the whole Hyper-V PCI bus go π«Ά
πΈ NAME πΈ
hv_pci_allocate_bridge_windows β allocate memory regions for the bus π
β¨ SYNOPSIS β¨
int hv_pci_allocate_bridge_windows (struct hv_pcibus_device *hbus );
literally that's the whole call, no cap π
π¦ ARGUMENTS π¦
hbusβ the root PCI bus, as understood by this driver π₯ (like, this driver's own idea of what the root bus is, not some other subsystem's, iykyk)
π DESCRIPTION π
okay so first thing: this function calls vmbus_allocate_mmio, and ngl that call is itself a bit of a compromise. π
ideally β in a perfect world, main character timeline β we might change the pnp layer in the kernel so that it comprehends either PCI devices which are "grandchildren of ACPI," with some intermediate bus node (in this case, VMBus), or change it so it understands VMBus. but the pnp layer? it's been declared deprecated, and it's not subject to change. π periodt, no edits, we don't touch it.
so the workaround, implemented right here, is: ask VMBus to allocate MMIO space for this bus. π§ VMBus itself knows which ranges are appropriate by looking at its own ACPI objects β it's got the receipts, it's the one with the info. then, after these ranges are claimed, they're modified to look like they would have looked if the ACPI and pnp code had allocated bridge windows. it's giving "dress up your descriptors so they fit in" π
and here's why that matters, bestie: these descriptors have to exist in this form in order to satisfy the code which will get invoked when the endpoint PCI function driver calls request_mem_region or request_mem_region_exclusive. like, that code is gonna vibe check those descriptors, and if they're not in the right shape? π so yeah, we cosplay them into bridge-window form. iconic behavior, honestly. π
β RETURN β
0on success π-errnoon failure π
π₯ SEE ALSO π₯
okay the link-up section, and it's long β grab a snack π
- the kernel file
./drivers/pci/controller/pci-hyperv.c(the source of truth, the mothership π) struct hv_msi_desc(9)struct hv_msi_desc2(9)struct tran_int_desc(9)hv_irq_retarget_interrupt(9)hv_pci_generic_compl(9)devfn_to_wslot(9)wslot_to_devfn(9)_hv_pcifront_read_config(9)_hv_pcifront_write_config(9)hv_pcifront_read_config(9)hv_pcifront_write_config(9)hv_pci_read_config_compl(9)hv_read_config_block(9)hv_pci_write_config_compl(9)hv_write_config_block(9)hv_register_block_invalidate(9)hv_msi_free(9)hv_compose_msi_msg(9)hv_pcie_init_irq_domain(9)get_bar_size(9)survey_child_resources(9)prepopulate_bars(9)create_root_hv_pci_bus(9)q_resource_requirements(9)new_pcichild_device(9)get_pcichild_wslot(9)pci_devices_present_work(9)hv_pci_start_relations_work(9)hv_pci_devices_present(9)hv_pci_devices_present2(9)hv_eject_device_work(9)hv_pci_eject_device(9)hv_pci_onchannelcallback(9)hv_pci_protocol_negotiation(9)hv_pci_free_bridge_windows(9)hv_allocate_config_window(9)hv_pci_enter_d0(9)hv_pci_query_relations(9)hv_send_resources_allocated(9)hv_send_resources_released(9)hv_pci_probe(9)hv_pci_remove(9)
ok real talk for a sec: this whole thing is a workaround for a deprecated layer that we cannot change, so please don't go thinking the descriptor-reshaping is optional or cosmetic β therequest_mem_region/request_mem_region_exclusivepath depends on those descriptors being in that exact form. π«Ά
okay that's the page!! this one lives over in ./drivers/pci/controller and it's dated October 2026 β so like, future vibes, but the manual page is hv_pci_alloc...idge_windows(9) bestie, go read it, slay πβ¨ππ¦πΈπ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms