> From: Lu Baolu <baolu...@linux.intel.com>
> Sent: Sunday, April 10, 2022 6:25 PM
> @@ -898,6 +941,20 @@ int iommu_group_add_device(struct iommu_group
> *group, struct device *dev)
>       list_add_tail(&device->list, &group->devices);
>       if (group->domain  && !iommu_is_attach_deferred(dev))
>               ret = __iommu_attach_device(group->domain, dev);
> +
> +     /*
> +      * Use standard PCI bus topology, isolation features, and DMA
> +      * alias quirks to set the immutable singleton attribute. If
> +      * the device came from DT, assume it is static and then
> +      * singleton can know from the device count in the group.
> +      */
> +     if (dev_is_pci(dev))
> +             group->immutable_singleton =
> +                             pci_immutably_isolated(to_pci_dev(dev));
> +     else if (is_of_node(dev_fwnode(dev)))
> +             group->immutable_singleton =
> +                             (iommu_group_device_count(group) == 1);
> +

btw probably we also want to check when a 2nd device is added
to a group marked as singleton, just in case some weird thing happens?
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to