* [PATCH] powerpc/iommu: Refactor spapr_tce_platform_iommu_attach_dev()
@ 2024-02-15 13:52 Shivaprasad G Bhat
2024-04-22 9:21 ` Michael Ellerman
0 siblings, 1 reply; 2+ messages in thread
From: Shivaprasad G Bhat @ 2024-02-15 13:52 UTC (permalink / raw)
To: iommu, linuxppc-dev
Cc: linux-kernel, mpe, npiggin, christophe.leroy, aneesh.kumar,
naveen.n.rao, jgg, jroedel, tpearson, aik, bgray, gregkh, sbhat,
gbatra, vaibhav, venkat88
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] powerpc/iommu: Refactor spapr_tce_platform_iommu_attach_dev()
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
0 siblings, 0 replies; 2+ messages in thread
From: Michael Ellerman @ 2024-04-22 9:21 UTC (permalink / raw)
To: iommu, linuxppc-dev, Shivaprasad G Bhat
Cc: linux-kernel, mpe, npiggin, christophe.leroy, aneesh.kumar,
naveen.n.rao, jgg, jroedel, tpearson, aik, bgray, gregkh, gbatra,
vaibhav, venkat88
On Thu, 15 Feb 2024 07:52:32 -0600, Shivaprasad G Bhat wrote:
> The patch makes the iommu_group_get() call only when using it
> thereby avoiding the unnecessary get & put for domain already
> being set case.
>
>
Applied to powerpc/fixes.
[1/1] powerpc/iommu: Refactor spapr_tce_platform_iommu_attach_dev()
https://git.kernel.org/powerpc/c/5bd31ab5f79eb6e3bdfa0ca0b57650f9d1604062
cheers
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-04-22 9:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox