cmdq_pkt_write_s_mask(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… cmdq_pkt_write_s_mask β€” kernel API manual, but make it a group chat

okay so bestie, we're looking at cmdq_pkt_write_s_mask(9) β€” it's from the Kernel API Manual and it's literally the function that appends a masked write_s command onto a CMDQ packet. iconic behavior, no cap. ✨


🌸 NAME

cmdq_pkt_write_s_mask β€” append a write_s-with-mask command to the CMDQ packet. that's the whole vibe. it does one thing and it slays at it πŸŽ€


πŸ¦‹ SYNOPSIS

int cmdq_pkt_write_s_mask (struct cmdq_pkt *pkt , u16 high_addr_reg_idx
, u16 addr_low , u16 src_reg_idx , u32 mask );

five args, one int coming back at you. keep the signature exactly like this, fr fr β€” don't go rearranging things, the compiler will not be cute about it πŸ’€


✨ ARGUMENTS

  • pkt β€” the CMDQ packet. your main character. everything gets appended to her πŸ‘‘
  • high_addr_reg_idx β€” internal register ID which contains the high address of pa. so like, the top half lives in a register, not inline 🧚
  • addr_low β€” low address of pa. the bottom half, right here in the call 🫢
  • src_reg_idx β€” the CMDQ internal register ID which caches the source value. that's where the value you're writing is chillin' πŸ’œ
  • mask β€” the specified target address mask. use U32_MAX if you don't need one, bestie β€” that's the "no mask, we're fine" setting 🌈

⭐ RETURN

0 for success; else the error code is returned. so like… zero is the slay, anything else means go read your error codes 😭


πŸ”₯ DESCRIPTION

Support write value to physical address without subsys. let me say that again for the people in the back β€” no subsys, we're going direct πŸ’…

here's the routine, follow along:

  • use CMDQ_ADDR_HIGH to get the high address, and then call cmdq_pkt_assign to assign that value into an internal reg πŸŽ€
  • also use CMDQ_ADDR_LOW to get the low address for the addr_low parameter when you call this function. split it up, keep it clean, that's the move ✨
ngl, if you skip the cmdq_pkt_assign step and just yeet a garbage reg index in there, that's on you β€” the docs are literally telling you the order of operations. read them. 🫢

πŸ’– SEE ALSO

Kernel file ./include/linux/soc/mediatek/mtk-cmdq.h β€” go read it, it's giving source of truth:

like, that's the whole friend group right there. go say hi πŸ‘‹


anyway that's the page, bestie πŸ₯° this one's sourced from ./include/linux/soc/mediatek and dated October 2026 β€” so it's fresh, it's documented, it's ready for you. now go write some masked registers and be iconic πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from