[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <06240213-dbc6-ea1c-ca49-28663387ac70@linux.intel.com>
Date: Tue, 12 Apr 2022 21:10:03 +0800
From: Lu Baolu <baolu.lu@...ux.intel.com>
To: "Tian, Kevin" <kevin.tian@...el.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: baolu.lu@...ux.intel.com, 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
On 2022/4/12 15:39, Tian, Kevin wrote:
>> 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?
It depends on how we judge whether the group to which a DT device
belongs is a singleton. As I explained in another thread, current trick
doesn't support doing this.
Best regards,
baolu
Powered by blists - more mailing lists