scmi_zones_register(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… scmi_zones_register β€” like, the real kernel API manual, bestie

okay so this is scmi_zones_register(9) from the Kernel API Manual, and it's genuinely iconic β€” it's the function that gets your SCMI powercap zones registered in the right order so nothing explodes later. sit down, grab a strawberry something, and let's get into it πŸ“βœ¨


✨ NAME ✨

scmi_zones_register β€” register SCMI powercap zones starting from parent zones 🫢


πŸ¦‹ SYNOPSIS πŸ¦‹

int scmi_zones_register (struct device *dev , struct scmi_powercap_root *pr );

πŸŽ€ ARGUMENTS πŸŽ€

  • dev β€” a reference to the SCMI device πŸ’»
  • pr β€” a reference to the root powercap zones descriptors πŸ‘‘

🌸 DESCRIPTION 🌸

So here's the tea: when we register SCMI powercap zones with the powercap framework, we have to be so careful about order β€” always register zones starting from the root ones, and deregister starting from the leaves. it's giving "respect the hierarchy or perish" 🌈

But unfortunately 😭 we can't just assume the array of available SCMI powercap zones that the SCMI platform firmware hands us is built to comply with that requirement. nope. not a vibe.

So this function, given the set of SCMI powercap zones to register, takes care to walk the SCMI powercap zones trees up to the root, registering any unregistered parent zone before registering the child zones. like, it does the homework for you πŸ’… at the same time, each registered-zone height in such a tree is accounted for, and each zone, once registered, is stored in the registered_zones array that is indexed by zone height. this way it'll be trivial, at unregister time, to walk the registered_zones array backward and unregister all the zones starting from the leaves β€” removing children zones before parents. main character ordering, no cap πŸ‘‘

While doing all this, we prune away any zone marked as invalid (like the ones sporting an SCMI abstract power scale) as long as they're positioned as leaves in the SCMI powercap zones hierarchy. but heads up: any non-leaf invalid zone causes the entire process to fail, since we cannot assume the correctness of an SCMI powercap zones hierarchy if some of the internal nodes are missing. 🫠 that's a hard no, bestie.

ngl, one lil note: the array of SCMI powercap zones as returned by the SCMI platform is known to be sane β€” i.e. zones relationships have been validated at the protocol layer. so that part's already slaying ⭐

πŸ”₯ RETURN πŸ”₯

0 on Success ✨


πŸ‘‘ SEE ALSO πŸ‘‘

  • Kernel file ./drivers/powercap/arm_scmi_powercap.c

okay that's the whole thing, you ate that πŸ’– this cutie lives in ./drivers/powercap, dated October 2026, and it's from the Kernel API Manual β€” scmi_zones_register(9), periodt πŸ¦‹πŸŽ€

πŸ“¦ where this page comes from