On 5/15/26 11:23, Jason Gunthorpe wrote:
On Mon, May 11, 2026 at 07:02:57PM -0700, Mukesh R wrote:+static struct iommu_domain *hv_iommu_domain_alloc_paging(struct device *dev) +{ + struct hv_domain *hvdom; + int rc; + + if (hv_l1vh_partition() && !hv_curr_thread_is_vmm()) { + pr_err("Hyper-V: l1vh iommu does not support host devices\n"); + return NULL; + } + + hvdom = kzalloc(sizeof(struct hv_domain), GFP_KERNEL); + if (hvdom == NULL) + return NULL; + + spin_lock_init(&hvdom->mappings_lock); + hvdom->mappings_tree = RB_ROOT_CACHED; + + /* Called under iommu group mutex, so single threaded */ + if (++unique_id == HV_DEVICE_DOMAIN_ID_S2_NULL) /* ie, UINTMAX */ + goto out_err; + + hvdom->domid_num = unique_id; + hvdom->partid = hv_get_current_partid(); + hvdom->iommu_dom.geometry = default_geometry; + hvdom->iommu_dom.pgsize_bitmap = HV_IOMMU_PGSIZES; + + /* For guests, by default we do direct attaches, so no domain in hyp */ + if (hv_dom_owner_is_vmm(hvdom) && !hv_no_attdev) + hvdom->attached_dom = true;What are you thinking sending something like this?!?!? The function is called *alloc domain PAGING*, it does not, and can not allocate weird "special" domains that are not PAGING domains. I just spent a long time removing all this kind of crazyness from drivers. There is alot of other things I don't like in this patch, but this is too much. You have to drop this "direct attach" idea from the first iteration, Linux can't do it without alot more work, you should start with the basic paging domain mode. Jason
Yeah, agree. There was some ambivalence whether this could be a stop gap solution until the iommufd based solution is fully designed. I'll remove the "direct attach" stuff and resend with just basic paging domain mode. Thanks for the review. Thanks, -Mukesh

