STRUCT CDX_DRIVER(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ struct cdx_driver β€” CDX device driver ✨

okay so bestie, welcome to the struct cdx_driver glow-up πŸ’… this is the page from the Kernel API Manual, manual name and all β€” and it's giving "the blueprint every CDX device driver fills in to become a real one" πŸ‘‘


🌸 NAME 🌸

struct cdx_driver β€” the CDX device driver struct, aka the personality sheet your driver has to fill out πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

struct cdx_driver {
    struct device_driver driver;
    const struct cdx_device_id *match_id_table;
    int (*probe)(struct cdx_device *dev);
    int (*remove)(struct cdx_device *dev);
    void (*shutdown)(struct cdx_device *dev);
    void (*reset_prepare)(struct cdx_device *dev);
    void (*reset_done)(struct cdx_device *dev);
    bool driver_managed_dma;
};

πŸ’– Members πŸ’–

⭐ driver

the generic device driver, nestled in there like the base layer of the fit 🫢

⭐ match_id_table

the table of supported device matching Ids β€” basically the vibes list of which devices this driver is willing to be seen with 😌

⭐ probe

the function called when a device is added πŸ‘€ this is the "hi bestie, you're here!" moment

⭐ remove

the function called when a device is removed 😭 the goodbye handler, fr fr

⭐ shutdown

the function called at shutdown time to quiesce the device πŸ’€ quiet it down, tuck it in, no more chaos

⭐ reset_prepare

the function called before is reset to notify driver β€” heads up before the reset happens, so the driver is never caught off guard πŸ™ˆ

⭐ reset_done

the function called after reset is complete to notify driver β€” "okay bestie, we're back, you good?" ✨

⭐ driver_managed_dma

this one is the whole main character, listen up πŸ”₯ the Device driver doesn't use kernel DMA API for DMA. For most device drivers, no need to care about this flag as long as all DMAs are handled through the kernel DMA API. For some special ones, for example VFIO drivers, they know how to manage the DMA themselves and set this flag so that the IOMMU layer will allow them to setup and manage their own I/O address space πŸ‘‘

so lowkey: if all your DMA goes through the kernel DMA API, you can literally ignore this flag and go live your life 🌈 set it only if you're one of those special drivers that handles DMA on its own, iykyk

🧚 SEE ALSO 🧚


and that's the whole page, bestie, no cap πŸ’œ this lil slice of the kernel API lives in ./include/linux/cdx and the version on deck is from October 2026 β€” go forth and register your drivers, slay πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from