RE: [PATCH v2 22/31] iommu/vt-d: Export a helper to do function for each dmar_drhd_unit
From: Tian, Kevin
Date: Thu Apr 09 2026 - 03:49:59 EST
> From: Xu Yilun <yilun.xu@xxxxxxxxxxxxxxx>
> Sent: Saturday, March 28, 2026 12:01 AM
>
> @@ -86,6 +86,8 @@ extern struct list_head dmar_drhd_units;
> dmar_rcu_check()) \
> if (i=drhd->iommu, 0) {} else
>
> +int do_for_each_drhd_unit(int (*fn)(struct dmar_drhd_unit *));
> +
> static inline bool dmar_rcu_check(void)
It's a bit weird to insert it here. Move it to follow for_each_iommu().
> +
> +int do_for_each_drhd_unit(int (*fn)(struct dmar_drhd_unit *))
> +{
> + struct dmar_drhd_unit *drhd;
> + int ret;
> +
> + guard(rwsem_read)(&dmar_global_lock);
> +
> + for_each_drhd_unit(drhd) {
> + ret = fn(drhd);
> + if (ret)
> + return ret;
> + }
> + return 0;
> +}
use for_each_active_drhd_unit(). or is there need to setup the trusted
configuration even on ignored iommu?