From: Shivaprasad G Bhat <sbhat@linux.ibm.com> To: iommu@lists.linux.dev, linuxppc-dev@lists.ozlabs.org Cc: 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, jgg@ziepe.ca, jroedel@suse.de, tpearson@raptorengineering.com, aik@amd.com, bgray@linux.ibm.com, gregkh@linuxfoundation.org, sbhat@linux.ibm.com, gbatra@linux.vnet.ibm.com, vaibhav@linux.ibm.com, venkat88@linux.vnet.ibm.com Subject: [PATCH] powerpc/iommu: Refactor spapr_tce_platform_iommu_attach_dev() Date: Thu, 15 Feb 2024 07:52:32 -0600 [thread overview] Message-ID: <170800513841.2411.13524607664262048895.stgit@linux.ibm.com> (raw) The patch makes the iommu_group_get() call only when using it thereby avoiding the unnecessary get & put for domain already being set case. Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Shivaprasad G Bhat <sbhat@linux.ibm.com> --- Changelog: v2: https://lore.kernel.org/linux-iommu/170793401503.7491.9431631474642074097.stgit@linux.ibm.com/ - As the v1 itself was merged, the patch was suggested to be reposted as cleanup/refactoring to be applied on top of v1. - Removed the versioning as this is actually new cleanup/refactoring. - Retaining the Reviewed-by as the effective new code was actually reviewed. v1: https://lore.kernel.org/all/170784021983.6249.10039296655906636112.stgit@linux.ibm.com/ - Minor refactor to call the iommu_get_group only if required. - Updated the title, description and signature(Closes/Reported-by). arch/powerpc/kernel/iommu.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c index a9bebfd56b3b..37fae3bd89c6 100644 --- a/arch/powerpc/kernel/iommu.c +++ b/arch/powerpc/kernel/iommu.c @@ -1285,15 +1285,14 @@ spapr_tce_platform_iommu_attach_dev(struct iommu_domain *platform_domain, struct device *dev) { struct iommu_domain *domain = iommu_get_domain_for_dev(dev); - struct iommu_group *grp = iommu_group_get(dev); struct iommu_table_group *table_group; + struct iommu_group *grp; /* At first attach the ownership is already set */ - if (!domain) { - iommu_group_put(grp); + if (!domain) return 0; - } + grp = iommu_group_get(dev); table_group = iommu_group_get_iommudata(grp); /* * The domain being set to PLATFORM from earlier
WARNING: multiple messages have this Message-ID (diff)
From: Shivaprasad G Bhat <sbhat@linux.ibm.com> To: iommu@lists.linux.dev, linuxppc-dev@lists.ozlabs.org Cc: venkat88@linux.vnet.ibm.com, jroedel@suse.de, gbatra@linux.vnet.ibm.com, sbhat@linux.ibm.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, aneesh.kumar@kernel.org, jgg@ziepe.ca, tpearson@raptorengineering.com, npiggin@gmail.com, bgray@linux.ibm.com, naveen.n.rao@linux.ibm.com, vaibhav@linux.ibm.com, aik@amd.com Subject: [PATCH] powerpc/iommu: Refactor spapr_tce_platform_iommu_attach_dev() Date: Thu, 15 Feb 2024 07:52:32 -0600 [thread overview] Message-ID: <170800513841.2411.13524607664262048895.stgit@linux.ibm.com> (raw) The patch makes the iommu_group_get() call only when using it thereby avoiding the unnecessary get & put for domain already being set case. Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Shivaprasad G Bhat <sbhat@linux.ibm.com> --- Changelog: v2: https://lore.kernel.org/linux-iommu/170793401503.7491.9431631474642074097.stgit@linux.ibm.com/ - As the v1 itself was merged, the patch was suggested to be reposted as cleanup/refactoring to be applied on top of v1. - Removed the versioning as this is actually new cleanup/refactoring. - Retaining the Reviewed-by as the effective new code was actually reviewed. v1: https://lore.kernel.org/all/170784021983.6249.10039296655906636112.stgit@linux.ibm.com/ - Minor refactor to call the iommu_get_group only if required. - Updated the title, description and signature(Closes/Reported-by). arch/powerpc/kernel/iommu.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c index a9bebfd56b3b..37fae3bd89c6 100644 --- a/arch/powerpc/kernel/iommu.c +++ b/arch/powerpc/kernel/iommu.c @@ -1285,15 +1285,14 @@ spapr_tce_platform_iommu_attach_dev(struct iommu_domain *platform_domain, struct device *dev) { struct iommu_domain *domain = iommu_get_domain_for_dev(dev); - struct iommu_group *grp = iommu_group_get(dev); struct iommu_table_group *table_group; + struct iommu_group *grp; /* At first attach the ownership is already set */ - if (!domain) { - iommu_group_put(grp); + if (!domain) return 0; - } + grp = iommu_group_get(dev); table_group = iommu_group_get_iommudata(grp); /* * The domain being set to PLATFORM from earlier
next reply other threads:[~2024-02-15 13:53 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-02-15 13:52 Shivaprasad G Bhat [this message] 2024-02-15 13:52 ` [PATCH] powerpc/iommu: Refactor spapr_tce_platform_iommu_attach_dev() Shivaprasad G Bhat 2024-04-22 9:21 ` Michael Ellerman 2024-04-22 9:21 ` Michael Ellerman
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=170800513841.2411.13524607664262048895.stgit@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 \ --cc=venkat88@linux.vnet.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: linkBe 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.