[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BN9PR11MB527689614CBD807A113493B48CED9@BN9PR11MB5276.namprd11.prod.outlook.com>
Date: Tue, 12 Apr 2022 07:39:07 +0000
From: "Tian, Kevin" <kevin.tian@...el.com>
To: Lu Baolu <baolu.lu@...ux.intel.com>,
Joerg Roedel <joro@...tes.org>,
Jason Gunthorpe <jgg@...dia.com>,
Christoph Hellwig <hch@...radead.org>,
"Raj, Ashok" <ashok.raj@...el.com>, Will Deacon <will@...nel.org>,
"Robin Murphy" <robin.murphy@....com>,
Jean-Philippe Brucker <jean-philippe@...aro.com>
CC: Eric Auger <eric.auger@...hat.com>,
"Liu, Yi L" <yi.l.liu@...el.com>,
"Pan, Jacob jun" <jacob.jun.pan@...el.com>,
"iommu@...ts.linux-foundation.org" <iommu@...ts.linux-foundation.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH RFC v3 02/12] iommu: Add a flag to indicate immutable
singleton group
> From: Lu Baolu <baolu.lu@...ux.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?
Powered by blists - more mailing lists