STRUCT ARM_SMMU_INVS(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 struct arm_smmu_invs(9) 🌸

okay bestie, so this is a page straight outta the Kernel API Manual β€” it's all about struct arm_smmu_invs, and ngl it's giving main-character energy in the world of invalidation bookkeeping πŸ’…


✨ NAME ✨

struct arm_smmu_invs β€” the per-domain invalidation array, periodt πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

struct arm_smmu_invs {
    size_t max_invs;
    size_t num_invs;
    size_t num_trashes;
    rwlock_t rwlock;
    bool has_ats;
    struct rcu_head rcu;
    struct arm_smmu_inv inv[];
};

πŸ’– Members πŸ’–

  • max_invs β€” the maximum capacity of that flexible array, like the hard ceiling, fr fr 🚧
  • num_invs β€” how many invalidations are actually chillin' in the flexible array. lowkey it may be smaller than max_invs once a tailing trash entry gets excluded, but it must not be greater than max_invs β€” that's the vibe check 🫢
  • num_trashes β€” the number of trash entries in the array, there for arm_smmu_invs_purge to deal with. Must not be greater than num_invs, no cap πŸ’€
  • rwlock β€” an optional rwlock that fences ATS operations πŸ”’
  • has_ats β€” a flag that says whether the array contains an INV_TYPE_ATS or an INV_TYPE_ATS_FULL ⭐
  • rcu β€” the rcu head for kfree_rcu 🧚
  • inv β€” the flexible invalidation array itself, the icon πŸ‘‘

πŸ”₯ Description πŸ”₯

So the arm_smmu_invs is an RCU data structure. During a ->attach_dev callback, arm_smmu_invs_merge, arm_smmu_invs_unref and arm_smmu_invs_purge all get used to allocate a brand-new copy of an old array β€” that's how additions and deletions happen in the old domain's and the new domain's invs arrays. it's giving "copy + glow-up" energy ✨

Then there's arm_smmu_invs_unref, which mutates a given array by internally reducing the user counts of some given entries. why?? because it exists to support a no-fail routine, like attaching to an IOMMU_DOMAIN_BLOCKED β€” no room for failure, bestie 😀. and it could totally pair with a followup arm_smmu_invs_purge call to generate a new clean array. fresh start, slay 🌈

The concurrent invalidation thread will push every invalidation described in the array into the command queue, once for each invalidation event. it's designed like this on purpose β€” to optimize the invalidation fast path by avoiding locks. speed, elegance, no lock drama πŸ™ˆ

A domain can be shared across SMMU instances, okay? so when an instance gets removed, it would delete all the entries that belong to that particular SMMU instance. then a synchronize_rcu would have to be called to sync the array β€” this exists to prevent any concurrent invalidation thread that's still accessing the old array from issuing commands to the command queue of a removed SMMU instance. safety first, always πŸ›‘οΈπŸ’œ


πŸ‘€ SEE ALSO πŸ‘€

  • Kernel file ./drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h struct arm_smmu_inv_state(9)

and that's the whole page, bestie πŸŽ€ that little footer energy at the bottom was the ./drivers/iommu/arm/arm-smmu-v3 source, dated October 2026 β€” so yeah, mark your calendars, iykyk πŸ’…πŸŒΈ

πŸ“¦ where this page comes from