remoteproc: Use iommu_paging_domain_alloc()
PATCH 1/1 remoteproc: Use iommu_paging_domain_alloc()
An iommu domain is allocated in rproc_enable_iommu() and is attached to rproc->dev.parent in the same function.
Use iommu_paging_domain_alloc() to make it explicit.
--- drivers/remoteproc/remoteproc_core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/remoteproc/remoteproc_core.c +3 -3
@@ -109,10 +109,10 @@ static int rproc_enable_iommu(struct rproc *rproc)return 0 ; } - domain =iommu_domain_alloc (dev->bus); -if (!domain) { + domain =iommu_paging_domain_alloc (dev); +if (IS_ERR (domain)) {dev_err (dev,"can't alloc iommu domain\n" ); -return -ENOMEM ; +return PTR_ERR (domain); }iommu_set_fault_handler (domain, rproc_iommu_fault, rproc);
Signature · 1 line
2.34.1
Mathieu Poirier
maintainerHi Baolu,
Sorry for the late reply, this slipped through the cracks.
Quoted 17 lines · Lu Baolu
An iommu domain is allocated in
rproc_enable_iommu()and is attached torproc->dev.parentin the same function.Use
iommu_paging_domain_alloc()to make it explicit.Signed-off-by Lu Baolu <[email protected]>Reviewed-by Jason Gunthorpe <[email protected]>--- drivers/remoteproc/remoteproc_core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/remoteproc/remoteproc_core.c +0
-0
drivers/remoteproc/remoteproc_core.c static int rproc_enable_iommu(struct rproc *rproc) · line 112
Quoted 6 lines
drivers/remoteproc/remoteproc_core.c +1
-2@@ -109,10 +109,10 @@ static int rproc_enable_iommu(struct rproc *rproc)return 0 ; } - domain =iommu_domain_alloc (dev->bus); -if (!domain) { + domain =iommu_paging_domain_alloc (dev);
I'm a little hesitant here. Function iommu_domain_alloc() passes NULL two the second argument of __iommu_domain_alloc() while iommu_paging_domain_alloc() provides a 'dev'. I don't have any HW to test on and I am not familiar enough with the IOMMU subsystem to confidently more forward.
I am asking the Qualcomm (Bjorn and friends) and TI crew (Beleswar, Andrew, Nishanth and Hari) to test this patch on their IOMMU devices and get back to me with a "Tested-by".
Thanks,
Mathieu
Quoted 10 lines
drivers/remoteproc/remoteproc_core.c +2
-1+if (IS_ERR (domain)) {dev_err (dev,"can't alloc iommu domain\n" ); -return -ENOMEM ; +return PTR_ERR (domain); }iommu_set_fault_handler (domain, rproc_iommu_fault, rproc);Signature · 1 line
2.34.1
Quoted 8 lines · Mathieu Poirier
drivers/remoteproc/remoteproc_core.c static int rproc_enable_iommu(struct rproc *rproc) · line 112
Quoted 3 lines
drivers/remoteproc/remoteproc_core.c +1
-2- domain =iommu_domain_alloc (dev->bus); -if (!domain) { + domain =iommu_paging_domain_alloc (dev);I'm a little hesitant here. Function
iommu_domain_alloc()passes NULL two the second argument of__iommu_domain_alloc()whileiommu_paging_domain_alloc()provides a 'dev'. I don't have any HW to test on and I am not familiar enough with the IOMMU subsystem to confidently more forward.
So long as dev is the device that will be initiating DMA this is a correct change from the iommu subsystem perspective.
Jason
Hi All,
Quoted 34 lines · Mathieu Poirier
Hi Baolu,
Sorry for the late reply, this slipped through the cracks.
Quoted 17 lines · Lu Baolu
An iommu domain is allocated in
rproc_enable_iommu()and is attached torproc->dev.parentin the same function.Use
iommu_paging_domain_alloc()to make it explicit.Signed-off-by Lu Baolu <[email protected]>Reviewed-by Jason Gunthorpe <[email protected]>--- drivers/remoteproc/remoteproc_core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/remoteproc/remoteproc_core.c +0
-0drivers/remoteproc/remoteproc_core.c static int rproc_enable_iommu(struct rproc *rproc) · line 112
Quoted 6 lines
drivers/remoteproc/remoteproc_core.c +1
-2@@ -109,10 +109,10 @@ static int rproc_enable_iommu(struct rproc *rproc)return 0 ; } - domain =iommu_domain_alloc (dev->bus); -if (!domain) { + domain =iommu_paging_domain_alloc (dev);I'm a little hesitant here. Function
iommu_domain_alloc()passes NULL two the second argument of__iommu_domain_alloc()whileiommu_paging_domain_alloc()provides a 'dev'. I don't have any HW to test on and I am not familiar enough with the IOMMU subsystem to confidently more forward.
Quoted 3 lines
I am asking the Qualcomm (Bjorn and friends) and TI crew (Beleswar, Andrew, Nishanth and Hari) to test this patch on their IOMMU devices and get back to me with a "Tested-by".
Just a heads-up. Currently, I am seeing boot failures while booting remotecores in TI's IOMMU devices with mainline kernel. Working on the the fix, once it is done, will apply the above patch and test it ASAP.
Thanks,
Beleswar
Quoted 15 lines
Thanks,
MathieuQuoted 10 lines
drivers/remoteproc/remoteproc_core.c +2
-1+if (IS_ERR (domain)) {dev_err (dev,"can't alloc iommu domain\n" ); -return -ENOMEM ; +return PTR_ERR (domain); }iommu_set_fault_handler (domain, rproc_iommu_fault, rproc);Signature · 1 line
2.34.1
Quoted 11 lines · Jason Gunthorpe
Quoted 8 lines · Mathieu Poirier
drivers/remoteproc/remoteproc_core.c static int rproc_enable_iommu(struct rproc *rproc) · line 112
Quoted 3 lines
drivers/remoteproc/remoteproc_core.c +1
-2- domain =iommu_domain_alloc (dev->bus); -if (!domain) { + domain =iommu_paging_domain_alloc (dev);I'm a little hesitant here. Function
iommu_domain_alloc()passes NULL two the second argument of__iommu_domain_alloc()whileiommu_paging_domain_alloc()provides a 'dev'. I don't have any HW to test on and I am not familiar enough with the IOMMU subsystem to confidently more forward.
Quoted 2 lines
So long as dev is the device that will be initiating DMA this is a correct change from the iommu subsystem perspective.
This is the only call site left for iommu_domain_alloc() - we want to remove this API on the next cycle. Please take the patch
Thanks,
Jason
Mathieu Poirier
maintainerQuoted 13 lines · Jason Gunthorpe
Quoted 11 lines · Jason Gunthorpe
Quoted 8 lines · Mathieu Poirier
Quoted 3 lines
- domain =
iommu_domain_alloc(dev->bus);
- if (!domain) {
+ domain =iommu_paging_domain_alloc(dev);I'm a little hesitant here. Function
iommu_domain_alloc()passes NULL two the second argument of__iommu_domain_alloc()whileiommu_paging_domain_alloc()provides a 'dev'. I don't have any HW to test on and I am not familiar enough with the IOMMU subsystem to confidently more forward.
Quoted 6 lines
Quoted 2 lines
So long as dev is the device that will be initiating DMA this is a correct change from the iommu subsystem perspective.
This is the only call site left for
iommu_domain_alloc()- we want to remove this API on the next cycle. Please take the patch
And I have no intentions of delaying things further. I will discuss this with Bjorn later this week in Vienna.
Quoted 2 lines
Thanks,
Jason
Beleswar Prasad Padhi
Acked-byQuoted 37 lines · Beleswar Prasad Padhi
Hi All,
Quoted 34 lines · Mathieu Poirier
Hi Baolu,
Sorry for the late reply, this slipped through the cracks.
Quoted 1 line · Lu Baolu
An iommu domain is allocated in
rproc_enable_iommu()and isattached to
Quoted 5 lines
rproc->dev.parentin the same function.Quoted 2 lines
Use
iommu_paging_domain_alloc()to make it explicit.Signed-off-by Lu Baolu <[email protected]>Reviewed-by Jason Gunthorpe <[email protected]>Link:
https://lore.kernel.org/r/[email protected]
Quoted 4 lines
---
drivers/remoteproc/remoteproc_core.c| 6 +++---1 file changed, 3 insertions(+), 3 deletions(-)Review
Quoted 1 line
(quoted diff) +0
-0
b/drivers/remoteproc/remoteproc_core.cdrivers/remoteproc/remoteproc_core.c static int rproc_enable_iommu(struct rproc
Quoted 4 lines
index
f276956f2c5c..eb66f78ec8b7100644drivers/remoteproc/remoteproc_core.c +0
-0@@ -109,10 +109,10 @@ static int rproc_enable_iommu(struct rproc*rproc)
drivers/remoteproc/remoteproc_core.c static int rproc_enable_iommu(struct rproc *rproc) · line 112
Quoted 5 lines
drivers/remoteproc/remoteproc_core.c +1
-1return 0; } > - domain = iommu_domain_alloc(dev->bus); - if (!domain) { + domain = iommu_paging_domain_alloc(dev);I'm a little hesitant here. Function
iommu_domain_alloc()passes NULL two the second argument of__iommu_domain_alloc()whileiommu_paging_domain_alloc()provides a 'dev'. I don't have any HW to test on and I am not familiar enough with the IOMMU subsystem to confidently more forward.
Quoted 6 lines
Quoted 3 lines
I am asking the Qualcomm (Bjorn and friends) and TI crew (Beleswar, Andrew, Nishanth and Hari) to test this patch on their IOMMU devices and get back to me with a "Tested-by".
Just a heads-up. Currently, I am seeing boot failures while booting remotecores in TI's IOMMU devices with mainline kernel. Working on the the fix, once it is done, will apply the above patch and test it ASAP.
Since commit 17de3f5fdd35, the IOMMU framework has changed how it handles callback ops, moving away from using bus->iommu_ops. The omap-iommu driver has not yet been updated to align with these framework changes. Therefore, omap-iommu, and hence, omap-remoteproc have been broken since 17de3f5fdd35.
This patch is a step in the right direction for adapting the remoteproc_core framework to the newer IOMMU framework by looking for iommu_ops attached to the dev structure instead of dev->bus. Due to time constraints, I was unable to update the omap-iommu driver to accommodate these changes, so, I could not test this patch. However, logically, this patch LGTM. So,
Thanks,
Beleswar
Quoted 16 lines
Thanks,
BeleswarQuoted 12 lines
Thanks,
MathieuQuoted 8 lines
drivers/remoteproc/remoteproc_core.c +2
-2+ if (IS_ERR(domain)) { dev_err(dev, "can't alloc iommu domain\n"); - return -ENOMEM; + return PTR_ERR(domain); } > iommu_set_fault_handler(domain, rproc_iommu_fault, rproc); -- > 2.34.1
Quoted 4 lines · Beleswar Prasad Padhi
Since commit
17de3f5fdd35, the IOMMU framework has changed how it handles callback ops, moving away from usingbus->iommu_ops. The omap-iommu driver has not yet been updated to align with these framework changes. Therefore, omap-iommu, and hence, omap-remoteproc have been broken since17de3f5fdd35.
That commit is a year old now, if nobody has cared to fix or report this can we consider removing some of this old code from upstream? Usually a year of being broken without anyone caring is a good enough threshold.
Quoted 1 line
Acked-by Beleswar Padhi <[email protected]>
Thanks
Jason
Mathieu Poirier
maintainerQuoted 12 lines · Lu Baolu
An iommu domain is allocated in
rproc_enable_iommu()and is attached torproc->dev.parentin the same function.Use
iommu_paging_domain_alloc()to make it explicit.Signed-off-by Lu Baolu <[email protected]>Reviewed-by Jason Gunthorpe <[email protected]>--- drivers/remoteproc/remoteproc_core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
I have applied this patch.
Thanks,
Mathieu
Quoted 21 lines
drivers/remoteproc/remoteproc_core.c +3
-3@@ -109,10 +109,10 @@ static int rproc_enable_iommu(struct rproc *rproc)return 0 ; } - domain =iommu_domain_alloc (dev->bus); -if (!domain) { + domain =iommu_paging_domain_alloc (dev); +if (IS_ERR (domain)) {dev_err (dev,"can't alloc iommu domain\n" ); -return -ENOMEM ; +return PTR_ERR (domain); }iommu_set_fault_handler (domain, rproc_iommu_fault, rproc);Signature · 1 line
2.34.1
Quoted 14 lines · Mathieu Poirier
Quoted 12 lines · Lu Baolu
An iommu domain is allocated in
rproc_enable_iommu()and is attached torproc->dev.parentin the same function.Use
iommu_paging_domain_alloc()to make it explicit.Signed-off-by Lu Baolu <[email protected]>Reviewed-by Jason Gunthorpe <[email protected]>--- drivers/remoteproc/remoteproc_core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Quoted 1 line
I have applied this patch.
It is a bit late now. Can we run the stragglers through the iommu tree? We want to put dependent patches on top of this.
Jason
Quoted 16 lines · Jason Gunthorpe
Quoted 14 lines · Mathieu Poirier
Quoted 12 lines · Lu Baolu
An iommu domain is allocated in
rproc_enable_iommu()and is attached torproc->dev.parentin the same function.Use
iommu_paging_domain_alloc()to make it explicit.Signed-off-by Lu Baolu <[email protected]>Reviewed-by Jason Gunthorpe <[email protected]>--- drivers/remoteproc/remoteproc_core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Quoted 5 lines
Quoted 1 line
I have applied this patch.
It is a bit late now. Can we run the stragglers through the iommu tree? We want to put dependent patches on top of this.
Sure, we can do that:
Please send me a pull request so that I can also carry the patch in my tree.