[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c03f81bb-3a50-4191-9884-25a914e60672@linux.ibm.com>
Date: Fri, 26 Jan 2024 20:49:04 +0530
From: Shivaprasad G Bhat <sbhat@...ux.ibm.com>
To: Jason Gunthorpe <jgg@...pe.ca>
Cc: iommu@...ts.linux.dev, linuxppc-dev@...ts.ozlabs.org,
linux-kernel@...r.kernel.org, mpe@...erman.id.au, npiggin@...il.com,
christophe.leroy@...roup.eu, aneesh.kumar@...nel.org,
naveen.n.rao@...ux.ibm.com, jroedel@...e.de,
tpearson@...torengineering.com, aik@....com, bgray@...ux.ibm.com,
gregkh@...uxfoundation.org, gbatra@...ux.vnet.ibm.com,
vaibhav@...ux.ibm.com
Subject: Re: [PATCH 2/2] iommu: Fix the domain type checks when default_domain
is set
On 1/25/24 21:22, Jason Gunthorpe wrote:
> On Thu, Jan 25, 2024 at 06:08:52AM -0600, Shivaprasad G Bhat wrote:
>> On PPC64, the iommu_ops.def_domain_type() is not defined and
>> CONFIG_IOMMU_DMA not enabled. With commit 0f6a90436a57 ("iommu: Do not
>> use IOMMU_DOMAIN_DMA if CONFIG_IOMMU_DMA is not enabled"), the
>> iommu_get_default_domain_type() return IOMMU_DOMAIN_IDENTITY. With
>> commit 2ad56efa80db ("powerpc/iommu: Setup a default domain and remove
>> set_platform_dma_ops"), the defaule_domain is set wih the type being
>> PLATFORM. With these two changes, iommu_group_alloc_default_domain()
>> ends up returning the NULL(with recent changes, ERR_PTR(-EINVAL))
>> leading to iommu_probe_device() failure and the device has no
>> iommu_group set in effect. Subsequently, the bind to vfio(VFIO_IOMMU)
>> fail as the iommu_group is not set for the device.
>>
>> Make the iommu_get_default_domain_type() to take default_domain->type
>> into consideration along with default_domain_type() and fix
>> iommu_group_alloc_default_domain() to not error out if the requested
>> type is same as default domain type.
>>
>> Fixes: 2ad56efa80db ("powerpc/iommu: Setup a default domain and remove set_platform_dma_ops")
>> Fixes: 0f6a90436a57 ("iommu: Do not use IOMMU_DOMAIN_DMA if CONFIG_IOMMU_DMA is not enabled")
>> Signed-off-by: Shivaprasad G Bhat <sbhat@...ux.ibm.com>
>> ---
>> drivers/iommu/iommu.c | 14 ++++++++++----
>> 1 file changed, 10 insertions(+), 4 deletions(-)
> Are you OK with this version?
>
> https://lore.kernel.org/linux-iommu/20240123174905.GS50608@ziepe.ca/
>
> ?
>
> I think it does the same thing
Yes, This works. I see a very minor difference of default_domain->type
is given
precedence over def_domain_type(). Please keep me CC when you post this
fix, I'll
test it with any(?) other changes if coming along with it.
Thanks,
Shivaprasad
> Jason
Powered by blists - more mailing lists