pci_p2pmem_find_many(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… pci_p2pmem_find_many β€” ok bestie, let's find your memory provider πŸ’…

Hey girlypop, welcome to pci_p2pmem_find_many(9) from the Kernel API Manual β€” this one's literally the matchmaker of the PCI world, and honestly? It's giving wingman energy. Let's get into it πŸŽ€


✨ NAME ✨

pci_p2pmem_find_many β€” finds you a peer-to-peer DMA memory device that's compatible with the list of clients you hand it, and ngl it picks the shortest distance one. Like, it's not just gonna set you up with anybody, it's gonna find the closest match 🌸


πŸ¦‹ SYNOPSIS πŸ¦‹

struct pci_dev * pci_p2pmem_find_many (struct device **clients , int
num_clients );

That's the whole vibe. One function, two args, one struct pci_dev * coming back at you ✨


πŸŽ€ ARGUMENTS πŸŽ€

  • clients β€” the array of devices you wanna check, and heads up, it's NULL-terminated (so yes, you do need that final NULL, no skipping it πŸ™ˆ)
  • num_clients β€” how many client devices are actually in that list, bestie. Count them. All of them.

πŸ’– DESCRIPTION πŸ’–

Okay so picture this: if multiple devices are sitting behind the same switch, the one that's "closest" to the client devices you're using gets picked first. Which makes total sense, right? Like if one of the providers is literally the same as one of the clients, that provider is getting used ahead of any other providers that are unrelated. Home turf advantage, periodt πŸ‘‘

And if multiple providers are all an equal distance away? The function just picks one at random. No drama, no favourites, it's random 🎲

The return is a pointer to the PCI device with a reference taken β€” so when you're done, use pci_dev_put to give that reference back, okay? Don't leave it hanging 😭 If no compatible device is found, you get NULL, that's it, that's the answer.

Also super important: the found provider will also be assigned to the client list β€” so like, your list gets updated too, bestie. iykyk πŸ’…

🌈 SEE ALSO 🌈


Alright my love, that's the page 🫢 This one's from ./drivers/pci, October 2026, Kernel API Manual edition β€” go forth and find your provider, and don't forget pci_dev_put! πŸ’œβ­

πŸ“¦ where this page comes from