[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <48cf6b2b-28ee-178d-6471-460e781e7b20@linux.intel.com>
Date: Sat, 20 Nov 2021 19:16:13 +0800
From: Lu Baolu <baolu.lu@...ux.intel.com>
To: Jörg Rödel <joro@...tes.org>
Cc: baolu.lu@...ux.intel.com, "Tian, Kevin" <kevin.tian@...el.com>,
Jason Gunthorpe <jgg@...dia.com>,
Chaitanya Kulkarni <kch@...dia.com>,
"Raj, Ashok" <ashok.raj@...el.com>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"rafael@...nel.org" <rafael@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Cornelia Huck <cohuck@...hat.com>,
Will Deacon <will@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"iommu@...ts.linux-foundation.org" <iommu@...ts.linux-foundation.org>,
Christoph Hellwig <hch@...radead.org>,
Alex Williamson <alex.williamson@...hat.com>,
"Pan, Jacob jun" <jacob.jun.pan@...el.com>,
"linux-pci@...r.kernel.org" <linux-pci@...r.kernel.org>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Diana Craciun <diana.craciun@....nxp.com>
Subject: Re: [PATCH 01/11] iommu: Add device dma ownership set/release
interfaces
Hi Joerg,
On 11/19/21 11:06 PM, Jörg Rödel wrote:
> On Fri, Nov 19, 2021 at 07:14:10PM +0800, Lu Baolu wrote:
>> The singleton group requirement for iommu_attach/detach_device() was
>> added by below commit:
>>
>> commit 426a273834eae65abcfc7132a21a85b3151e0bce
>> Author: Joerg Roedel <jroedel@...e.de>
>> Date: Thu May 28 18:41:30 2015 +0200
>>
>> iommu: Limit iommu_attach/detach_device to devices with their own group
>>
>> This patch changes the behavior of the iommu_attach_device
>> and iommu_detach_device functions. With this change these
>> functions only work on devices that have their own group.
>> For all other devices the iommu_group_attach/detach
>> functions must be used.
>>
>> Signed-off-by: Joerg Roedel <jroedel@...e.de>
>>
>> Joerg,can you please shed some light on the background of this
>> requirement? Does above idea of transition from singleton group
>> to group with single driver bound make sense to you?
>
> This change came to be because the iommu_attach/detach_device()
> interface doesn't fit well into a world with iommu-groups. Devices
> within a group are by definition not isolated between each other, so
> they must all be in the same address space (== iommu_domain). So it
> doesn't make sense to allow attaching a single device within a group to
> a different iommu_domain.
Thanks for the explanation. It's very helpful. There seems to be a lot
of discussions around this, but I didn't see any meaningful reasons to
break the assumption of "all devices in a group being in a same address
space".
Best regards,
baolu
>
> I know that in theory it is safe to allow devices within a group to be
> in different domains because there iommu-groups catch multiple
> non-isolation cases:
>
> 1) Devices behind a non-ACS capable bridge or multiple functions
> of a PCI device. Here it is safe to put the devices into
> different iommu-domains as long as all affected devices are
> controlled by the same owner.
>
> 2) Devices which share a single request-id and can't be
> differentiated by the IOMMU hardware. These always need to be
> in the same iommu_domain.
>
> To lift the single-domain-per-group requirement the iommu core code
> needs to learn the difference between the two cases above.
>
> Regards,
>
> Joerg
>
Powered by blists - more mailing lists