All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shivaprasad G Bhat <sbhat@linux.ibm.com>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: iommu@lists.linux.dev, linuxppc-dev@lists.ozlabs.org,
	linux-kernel@vger.kernel.org, mpe@ellerman.id.au,
	npiggin@gmail.com, christophe.leroy@csgroup.eu,
	aneesh.kumar@kernel.org, naveen.n.rao@linux.ibm.com,
	jroedel@suse.de, tpearson@raptorengineering.com, aik@amd.com,
	bgray@linux.ibm.com, gregkh@linuxfoundation.org,
	gbatra@linux.vnet.ibm.com, vaibhav@linux.ibm.com
Subject: Re: [PATCH 2/2] iommu: Fix the domain type checks when default_domain is set
Date: Fri, 26 Jan 2024 20:49:04 +0530	[thread overview]
Message-ID: <c03f81bb-3a50-4191-9884-25a914e60672@linux.ibm.com> (raw)
In-Reply-To: <20240125155257.GX50608@ziepe.ca>

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@linux.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

WARNING: multiple messages have this Message-ID (diff)
From: Shivaprasad G Bhat <sbhat@linux.ibm.com>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: jroedel@suse.de, gbatra@linux.vnet.ibm.com,
	gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
	aneesh.kumar@kernel.org, tpearson@raptorengineering.com,
	iommu@lists.linux.dev, npiggin@gmail.com, bgray@linux.ibm.com,
	naveen.n.rao@linux.ibm.com, vaibhav@linux.ibm.com,
	linuxppc-dev@lists.ozlabs.org, aik@amd.com
Subject: Re: [PATCH 2/2] iommu: Fix the domain type checks when default_domain is set
Date: Fri, 26 Jan 2024 20:49:04 +0530	[thread overview]
Message-ID: <c03f81bb-3a50-4191-9884-25a914e60672@linux.ibm.com> (raw)
In-Reply-To: <20240125155257.GX50608@ziepe.ca>

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@linux.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

  reply	other threads:[~2024-01-26 15:19 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-25 12:08 [PATCH 0/2] powerpc: iommu: Fix the vfio-pci bind and unbind issues Shivaprasad G Bhat
2024-01-25 12:08 ` Shivaprasad G Bhat
2024-01-25 12:08 ` [PATCH 1/2] powerpc: iommu: Bring back table group release_ownership() call Shivaprasad G Bhat
2024-01-25 12:08   ` Shivaprasad G Bhat
2024-01-25 15:50   ` Jason Gunthorpe
2024-01-25 15:50     ` Jason Gunthorpe
2024-01-26 15:13     ` Shivaprasad G Bhat
2024-01-26 15:13       ` Shivaprasad G Bhat
2024-01-26 15:17       ` Jason Gunthorpe
2024-01-26 15:17         ` Jason Gunthorpe
2024-01-26 15:29         ` Timothy Pearson
2024-01-26 15:29           ` Timothy Pearson
2024-01-26 15:38           ` Jason Gunthorpe
2024-01-26 15:38             ` Jason Gunthorpe
2024-01-26 15:39             ` Timothy Pearson
2024-01-26 15:39               ` Timothy Pearson
2024-01-26 15:44               ` Timothy Pearson
2024-01-26 15:44                 ` Timothy Pearson
2024-01-26 15:44               ` Jason Gunthorpe
2024-01-26 15:44                 ` Jason Gunthorpe
2024-01-25 12:08 ` [PATCH 2/2] iommu: Fix the domain type checks when default_domain is set Shivaprasad G Bhat
2024-01-25 12:08   ` Shivaprasad G Bhat
2024-01-25 15:52   ` Jason Gunthorpe
2024-01-25 15:52     ` Jason Gunthorpe
2024-01-26 15:19     ` Shivaprasad G Bhat [this message]
2024-01-26 15:19       ` Shivaprasad G Bhat

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c03f81bb-3a50-4191-9884-25a914e60672@linux.ibm.com \
    --to=sbhat@linux.ibm.com \
    --cc=aik@amd.com \
    --cc=aneesh.kumar@kernel.org \
    --cc=bgray@linux.ibm.com \
    --cc=christophe.leroy@csgroup.eu \
    --cc=gbatra@linux.vnet.ibm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=iommu@lists.linux.dev \
    --cc=jgg@ziepe.ca \
    --cc=jroedel@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=naveen.n.rao@linux.ibm.com \
    --cc=npiggin@gmail.com \
    --cc=tpearson@raptorengineering.com \
    --cc=vaibhav@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.