> From: Jason Gunthorpe
> Sent: Saturday, May 7, 2022 1:55 AM
> 
> On Fri, May 06, 2022 at 05:44:11PM +0100, Robin Murphy wrote:
> >
> > So if it *is* a domain then I can call NULL->attach_dev() and...? ;)
> 
> You can call iommu_group_set_domain(group, NULL) and it will work.
> 
> As I said, it must have this symmetry:
> 
>  __iommu_group_attach_core_domain()
>  assert(__iommu_group_is_core_domain())
> 
> This is why I choose the name, because it is a clear pairing with
> __iommu_group_attach_core_domain().
> 
> How about __iommu_group_is_core_domain_attached() ? Solves the
> grammer
> issue

Or just __iommu_group_is_core_managed() to avoid the confusion
on whether NULL domain is considered as 'attached'? 'core managed'
can cover NULL domain as a policy in iommu core.

Alternatively we can also keep current name but moving the NULL domain
check out, i.e.:

assert(!group->domain || __iommu_group_is_core_domain(group));

This actually better pairs with __iommu_group_attach_core_domain()
as the latter is clearly defined for non-NULL domains:

+/*
+ * Put the group's domain back to the appropriate core-owned domain - either 
the
+ * standard kernel-mode DMA configuration or an all-DMA-blocked domain.
+ */
+static void __iommu_group_set_core_domain(struct iommu_group *group)

Thanks
Kevin
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to