gen_l3_mask_from_pattern(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… gen_l3_mask_from_pattern (kernel API manual, bestie edition) πŸ’…

Okay so this one lives in the Kernel API Manual, and it's giving "glorified copy-paste but make it hardware" energy. The function is gen_l3_mask_from_pattern β€” and yes, the name is literally what it does: it replicates a bit pattern according to a mask. Iconic, honestly. πŸŽ€


✨ NAME ✨

gen_l3_mask_from_pattern β€” replicate a bit pattern according to a mask. That's it. That's the whole vibe. πŸ¦‹


🌸 SYNOPSIS 🌸

void gen_l3_mask_from_pattern (struct xe_device *xe , xe_l3_bank_mask_t
dst , xe_l3_bank_mask_t pattern , int patternbits , unsigned long mask
);

πŸ’– ARGUMENTS πŸ’–

  • xe β€” the device, aka the main character we're doing all this for πŸ‘‘
  • dst β€” destination, where the finished mask goes to live its best life
  • pattern β€” the pattern we're replicating, the little ceo of this operation
  • patternbits β€” size of the pattern, in bits (yes, in bits, write that down πŸ“)
  • mask β€” the mask describing where to replicate the pattern. It's the map, the pattern is the passenger πŸ—ΊοΈ

πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the tea: this is used to compute the L3 bank masks in a generic format on various platforms where the internal representation of L3 node and masks from registers are different. Basically every platform has its own little dialect and this function is the translator bestie. 🌈

ngl the original diagrams got a little squished in transit, but the numbers are all here and they're all correct β€” lowkey the whole point is pattern goes in, mask says which slots get a copy, dst comes out. no cap. πŸ’…

Example 1: ----------

pattern     = 0b1111
              β””β”¬β”€β”˜
patternbits = 4 (bits)

mask        = 0b0101
                 │││└────────────────── 0b1111   (=1Γ—0b1111)
                 ││└──────────── 0b0000   (=0Γ—0b1111)
                 │└────── 0b1111   (=1Γ—0b1111)
                 β”” 0b0000   (=0Γ—0b1111)

dst         = 0b0000 0b1111 0b0000 0b1111

Example 2: ----------

pattern     = 0b11111111
              β””β”¬β”€β”€β”€β”€β”€β”˜
patternbits = 8 (bits)

mask        = 0b10
                 │└────────── 0b00000000   (=0Γ—0b11111111)
                 β”” 0b11111111   (=1Γ—0b11111111)

dst         = 0b11111111 0b00000000

Like… the mask is a 0b0101 and the pattern is 0b1111, and dst is just the pattern stamped into every slot the mask marked with a 1. It's giving sticker sheet. It's giving "copy the aesthetic into these exact spots." Obsessed. πŸ”₯


πŸ‘‘ SEE ALSO πŸ‘‘


Okay bestie, that's the whole page! 🫢 This little number ships from ./drivers/gpu/drm/xe, dated October 2026, straight out of the Kernel API Manual. Go replicate some patterns, slay, and remember: the vibe changes, the facts do not. πŸ’œβœ¨πŸ“

πŸ“¦ where this page comes from