STRUCT IOMMU_HW_INFO(9)
π struct iommu_hw_info β NAME
okay so bestie, this is the manual page for struct iommu_hw_info, and it's literally the struct behind ioctl(IOMMU_GET_HW_INFO). yes THAT ioctl. she's the one who goes and asks the iommu "hey queen, what are your hardware vibes?" π
(also hi, this is from the Kernel API Manual, more on that at the very bottom π«Ά)
β¨ SYNOPSIS β¨
here's the struct in all her glory, copy it exactly bestie, don't freehand this:
struct iommu_hw_info {
__u32 size;
__u32 flags;
__u32 dev_id;
__u32 data_len;
__aligned_u64 data_uptr;
union {
__u32 in_data_type;
__u32 out_data_type;
};
__u8 out_max_pasid_log2;
__u8 __reserved[3];
__aligned_u64 out_capabilities;
};
πΈ Members πΈ
every field, one by one, no skipping, we don't do that here π
sizeβ this issizeof(struct iommu_hw_info). that's it. that's the field. iconic honestly.flagsβ must be0. not1, not "eh close enough". zero. π¨dev_idβ the device that's bound to the iommufd. the main character device, if you will πdata_lenβ bidirectional bestie π«. as input, it's the length in bytes of your user buffer. as output, it's the length of data that the kernel actually supports.data_uptrβ a user pointer to a user-space buffer, and the kernel uses it to fill in the iommu type specific hardware information data. it's giving "you bring the cup, kernel brings the tea" π{unnamed_union}β anonymous. she has no name. she simply exists. π¦in_data_typeβ plot twist: this shares the same field without_data_type, so it's a bidirectional field π. whenIOMMU_HW_INFO_FLAG_INPUT_TYPEis set, an input type carried via thisin_data_typefield is valid, and it's requesting the info data for that given type. ifIOMMU_HW_INFO_FLAG_INPUT_TYPEis unset, then any input value gets treated asIOMMU_HW_INFO_TYPE_DEFAULT. so like, no pressure on the input value in that case πout_data_typeβ outputs the iommu hardware info type, as defined in the enumiommu_hw_info_type. this is the "which flavor is this" field π¦
out_max_pasid_log2β outputs the width of PASIDs.0means no PASID support, periodt. β οΈ and heads up: PCI devices should turn toout_capabilitiesto check whether a specific capability is supported or not.__reservedβ must be0. again. zero. do not get creative with the reserved bytes, bestie, that's how you end up in the group chat at 3am πout_capabilitiesβ outputs the generic iommu capability info type, as defined in the enumiommu_hw_capabilities. the receipts of what she can do β¨
π¦ Description π¦
so what does this thing actually do. okay so: it queries iommu type specific hardware information data from an iommu that sits behind a given device which has been bound to iommufd. that hardware info data gets used to sync capabilities between the virtual iommu and the physical iommu β like, for example, a nested translation setup needs to check the hardware info so that a guest stage-1 page table can be compatible with the physical iommu. it's literally matchmaking between virtual and physical, and honestly? they slay together π
to actually capture that iommu type specific hardware information data, data_uptr and its length data_len must be provided. no buffer, no data, no cap π§’
here's the deets on sizes, and this part matters so read it properly:
- if your user buffer is larger than the data the kernel has, the trailing bytes will be zeroed. thoughtful queen.
- otherwise, the kernel only fills the buffer using the given length in
data_len.
if the ioctl succeeds, then:
data_lengets updated to the length that the kernel actually supports, andout_data_typegets filled in, so you can decode the data that got filled into the buffer pointed to bydata_uptr.
also, input data_len == zero is allowed. yes really. zero is a valid input. she said "I'll allow it" π
π₯ SEE ALSO π₯
the whole extended friend group, in order, all of them, we're not leaving anyone out of the group chat π
- 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_hwpt_set_dirty_tracking(9)enum iommufd_hwpt_get_dirty_bitmap_flags(9)struct iommu_hwpt_get_dirty_bitmap(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)
and that's the whole page bestie, you ate that π«Άβ¨
source things for the record: this one lives under ./include/uapi/linux, and the version/date situation is October 2026. go forth and query your hardware info, you got this ππ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms