STRUCT IOMMU_HWPT_GET_DIRTY_BITMAP(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct iommu_hwpt_get_dirty_bitmap(9)

okay bestie, so this is the page for struct iommu_hwpt_get_dirty_bitmap β€” it's the struct backing the ioctl(IOMMU_HWPT_GET_DIRTY_BITMAP) call, and it lives in the Kernel API Manual. Yes, the whole struct name is a mouthful, no I will not be shortening it, it's iconic and we respect it πŸ’–


🌸 NAME 🌸

struct iommu_hwpt_get_dirty_bitmap β€” the ioctl(IOMMU_HWPT_GET_DIRTY_BITMAP) squad leader 🫢

✨ SYNOPSIS ✨

here's the whole fit, copied exactly, don't touch a single underscore:

struct iommu_hwpt_get_dirty_bitmap {
    __u32 size;
    __u32 hwpt_id;
    __u32 flags;
    __u32 __reserved;
    __aligned_u64 iova;
    __aligned_u64 length;
    __aligned_u64 page_size;
    __aligned_u64 data;
 };

πŸŽ€ Members πŸŽ€

  • size β€” literally just sizeof(struct iommu_hwpt_get_dirty_bitmap). it's the classic "how big am I" field, we love a self-aware struct ✨
  • hwpt_id β€” the HW pagetable ID that represents the IOMMU domain. think of it as the domain's little name tag 🏷️
  • flags β€” a combination of enum iommufd_hwpt_get_dirty_bitmap_flags. mix and match, it's a combo platter 🌈
  • __reserved β€” must be 0. not "probably 0", not "0 if you feel like it". zero. periodt πŸ’€
  • iova β€” the base IOVA of the bitmap's first bit. where the whole party starts πŸ“
  • length β€” the size of the IOVA range. how much of the world we're looking at πŸ—ΊοΈ
  • page_size β€” the page size granularity of each bit in the bitmap. one bit = one page, that's the deal πŸŽ€
  • data β€” the bitmap where the dirty bits get set. the bitmap's bits each represent a page_size, which you deviate from an arbitrary iova. yep, that's exactly how it's phrased, i'm not fighting it 😭

πŸ”₯ Description πŸ”₯

so how do you actually check if a given IOVA is dirty? like this, bestie, and yes you gotta be careful with the math:

data[(iova / page_size) / 64] & (1ULL << ((iova / page_size) % 64))

then the actual work: it walks the IOMMU pagetables for a given IOVA range to return a bitmap with the dirty IOVAs. king behavior πŸ‘‘

and heads up β€” in doing so, it will also by default clear any dirty bit metadata set in the IOPTE. so like, reading the dirty bits is also a little bit of a reset. not me casually wiping metadata while you're just trying to look πŸ™ˆ know that going in.

lowkey important: that default-clear thing is a real behaviour, not a vibe. if you needed those IOPTE dirty bits to stick around, this is your heads-up ⚠️

πŸ¦‹ SEE ALSO πŸ¦‹

the whole extended friend group, no gatekeeping, everyone's invited:

  • Kernel file ./include/uapi/linux/iommufd.h
  • General ioctl format(9)
  • struct iommu_destroy(9)
  • struct iommu_ioas_alloc(9)
  • struct iommu_iova_range(9)
  • struct iommu_ioas_iova_ranges(9)
  • struct iommu_ioas_allow_iovas(9)
  • enum iommufd_ioas_map_flags(9)
  • struct iommu_ioas_map(9)
  • struct iommu_ioas_noiommu_get_pa(9)
  • struct iommu_ioas_map_file(9)
  • struct iommu_ioas_copy(9)
  • struct iommu_ioas_unmap(9)
  • enum iommufd_option(9)
  • enum iommufd_option_ops(9)
  • struct iommu_option(9)
  • enum iommufd_vfio_ioas_op(9)
  • struct iommu_vfio_ioas(9)
  • enum iommufd_hwpt_alloc_flags(9)
  • enum iommu_hwpt_vtd_s1_flags(9)
  • struct iommu_hwpt_vtd_s1(9)
  • struct iommu_hwpt_arm_smmuv3(9)
  • struct iommu_hwpt_amd_guest(9)
  • enum iommu_hwpt_data_type(9)
  • struct iommu_hwpt_alloc(9)
  • enum iommu_hw_info_vtd_flags(9)
  • struct iommu_hw_info_vtd(9)
  • enum iommu_hw_info_arm_smmuv3_flags(9)
  • struct iommu_hw_info_arm_smmuv3(9)
  • struct iommu_hw_info_tegra241_cmdqv(9)
  • struct iommu_hw_info_amd(9)
  • enum iommu_hw_info_type(9)
  • enum iommufd_hw_capabilities(9)
  • enum iommufd_hw_info_flags(9)
  • struct iommu_hw_info(9)
  • struct iommu_hwpt_set_dirty_tracking(9)
  • enum iommufd_hwpt_get_dirty_bitmap_flags(9)
  • enum iommu_hwpt_invalidate_data_type(9)
  • enum iommu_hwpt_vtd_s1_invalidate_flags(9)
  • struct iommu_hwpt_vtd_s1_invalidate(9)
  • struct iommu_viommu_arm_smmuv3_invalidate(9)
  • struct iommu_hwpt_invalidate(9)
  • enum iommu_hwpt_pgfault_flags(9)
  • enum iommu_hwpt_pgfault_perm(9)
  • struct iommu_hwpt_pgfault(9)
  • enum iommufd_page_response_code(9)
  • struct iommu_hwpt_page_response(9)
  • struct iommu_fault_alloc(9)
  • enum iommu_viommu_type(9)
  • struct iommu_viommu_tegra241_cmdqv(9)
  • struct iommu_viommu_alloc(9)
  • struct iommu_vdevice_alloc(9)
  • struct iommu_ioas_change_process(9)
  • enum iommu_veventq_flag(9)
  • struct iommufd_vevent_header(9)
  • enum iommu_veventq_type(9)
  • struct iommu_vevent_arm_smmuv3(9)
  • struct iommu_vevent_tegra241_cmdqv(9)
  • struct iommu_veventq_alloc(9)
  • enum iommu_hw_queue_type(9)
  • struct iommu_hw_queue_alloc(9)

k that's the whole page, we ate and left no crumbs πŸ“ source lives in ./include/uapi/linux, dated October 2026, and it's signed off as struct iommu...dirty_bitmap(9) β€” mwah, go read the rest of the iommufd lore bestie, it's giving lore-dump and honestly? obsessed πŸ’œπŸ§š

πŸ“¦ where this page comes from