STRUCT GENWQE_SGL(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 NAME 🌸

struct genwqe_sgl β€” the scatter gather list that describes user-space memory, bestie πŸ’–

Like, it's the little struct that keeps track of a chunk of memory that lives in user space, and says "okay here's where it is, here's how big it is, and here's whether we're writing it back." Very organized. Very demure.


✨ SYNOPSIS ✨

struct genwqe_sgl {
    dma_addr_t sgl_dma_addr;
    struct sg_entry *sgl;
    size_t sgl_size;
    void __user *user_addr;
    size_t user_size;
    int write;
    unsigned long nr_pages;
    unsigned long fpage_offs;
    size_t fpage_size;
    size_t lpage_size;
    void *fpage;
    dma_addr_t fpage_dma_addr;
    void *lpage;
    dma_addr_t lpage_dma_addr;
 };

That's the whole glow-up right there πŸ‘‘ β€” fourteen fields, zero notes in the original about what half of them do, which honestly is giving "the docs ran out of steam at field six" energy πŸ’€ (more on that below).


πŸŽ€ Members πŸŽ€

  • sgl_dma_addr β€” the DMA address of the sgl. That's the address the hardware side sees, not the cute little pointer your CPU uses 🫢
  • sgl β€” the scatter gather list itself. Heads up: it needs to be 128 byte aligned. Not a suggestion, not a vibe, an actual alignment requirement β€” so don't come at it with a random pointer 😭
  • sgl_size β€” the size of the area used for the sgl.
  • user_addr β€” the user-space address of the memory area. This is the pointer that lives in the user's world, marked void __user * so nobody forgets πŸ‘€
  • user_size β€” how big that user-space memory area is.
  • write β€” should we write it back to userspace? It's an int, so it's basically a yes/no situation dressed up as a number. write = yes bestie, put it back. πŸ–ŠοΈ
  • nr_pages β€” number of pages. Present in the struct, and the original manual doesn't say anything more about it. That's it. That's the whole lore. πŸ™ˆ
  • fpage_offs β€” first-page offset. Same deal: it's in the struct, no further description in the manual. πŸ€·β€β™€οΈ
  • fpage_size β€” first-page size. In the struct, no extra notes in the original.
  • lpage_size β€” last-page size. Also in the struct, also undescribed. The manual really said "you'll figure it out" for this whole tail end of the struct πŸ’€
  • fpage β€” first page pointer. Yep, in the struct, no description in the original.
  • fpage_dma_addr β€” DMA address of that first page. Again, listed, no description given.
  • lpage β€” last page pointer. Listed, no description given.
  • lpage_dma_addr β€” DMA address of the last page. Listed, no description given.
Ngl the original page only spells out sgl_dma_addr, sgl, sgl_size, user_addr, user_size and write β€” the rest are just... there, doing their thing, unbothered, moisturised, in their lane πŸ’… I'm not out here inventing behavior for them, so no cap: what you see is what the manpage gives you.

πŸ¦‹ SEE ALSO πŸ¦‹

Go read these next, they're all in the kernel file ./drivers/misc/genwqe/card_base.h and they're lowkey essential for the full picture:


That's the whole page, bestie ✨ It came from ./drivers/misc/genwqe, dated October 2026, and it's filed under struct genwqe_sgl(9) β€” go forth and align your scatter gather lists to 128 bytes, mwah πŸ’‹πŸŒˆ

πŸ“¦ where this page comes from