pci_epc_mem_map(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… pci_epc_mem_map(9) β€” the kernel API manual, bestie edition πŸŽ€

okay so real talk, this is a page straight out of the Kernel API Manual and it's all about pci_epc_mem_map β€” allocate a controller memory region and map it onto a PCI address, no cap ✨


✨ NAME ✨

pci_epc_mem_map β€” allocate and map a PCI address to a CPU address πŸ¦‹


🌸 SYNOPSIS 🌸

int pci_epc_mem_map (struct pci_epc *epc , u8 func_no , u8 vfunc_no ,
u64 pci_addr , size_t pci_size , struct pci_epc_map *map );

πŸ’– ARGUMENTS πŸ’–

  • epc β€” the EPC device on which the CPU address is gonna get allocated and mapped, periodt πŸ‘‘
  • func_no β€” the physical endpoint function number inside the EPC device, iykyk
  • vfunc_no β€” the virtual endpoint function number, and it lives inside that physical function 🫢
  • pci_addr β€” the PCI address that the CPU address should be mapped to ⭐
  • pci_size β€” how many bytes to map, starting from pci_addr πŸ’œ
  • map β€” where the mapping info gets returned, like the little goodie bag of results πŸŽ€

🌈 DESCRIPTION 🌈

So what's actually happening: it allocates a controller memory address region and maps it to an RC PCI address region. The way that it does this is it takes the controller's physical address mapping constraints into account using the controller operation align_addr 😌. And bestie, if that operation is not defined? Then we're assuming there are literally no alignment constraints for the mapping. easy vibe check πŸ’…

The effective size of the PCI address range that gets mapped from pci_addr is indicated by map->pci_size β€” and heads up, this size may be less than the requested pci_size πŸ”₯. The local virtual CPU address for the mapping is indicated by map->virt_addr (and map->phys_addr is the physical address, in case you were wondering πŸ™ˆ). The size and the CPU address of the controller memory that got allocated and mapped are respectively indicated by map->map_size and map->virt_base (and map->phys_base gives you the physical address of map->virt_base β€” yes, they went there).

Returns 0 on success and a negative error code in case of error 🧚


⭐ SEE ALSO ⭐

Kernel file ./drivers/pci/endpoint/pci-epc-core.c plus the whole friend group:


ngl that's a lot of cross-references but every single one of them is iconic in its own right 🫢

and that's the whole page, bestie πŸ’– it lives in ./drivers/pci/endpoint, dated October 2026, and it's filed under pci_epc_mem_map(9) in the Kernel API Manual. slay, go map some memory πŸ§šβœ¨πŸŽ€

πŸ“¦ where this page comes from