iommu/tegra: gart: Remove unnecessary cleanup with devm_*()
Subsystems (3)
PATCH 1/2 iommu/tegra: gart: Remove unnecessary cleanup with devm_*()
Remove unnecessary cleanup procedures with devm_*().
--- drivers/iommu/tegra-gart.c | 22 +++------------------- 1 files changed, 3 insertions(+), 19 deletions(-)
drivers/iommu/tegra-gart.c +3 -19
@@ -345,7 +345,6 @@ static int tegra_gart_probe(struct platform_device *pdev)struct gart_device *gart;struct resource *res, *res_remap;void __iomem *gart_regs; -int err;struct device *dev = &pdev->dev;if (gart_handle)
@@ -370,8 +369,7 @@ static int tegra_gart_probe(struct platform_device *pdev) gart_regs =devm_ioremap (dev, res->start,resource_size (res));if (!gart_regs) {dev_err (dev,"failed to remap GART registers\n" ); - err = -ENXIO ; - goto fail; +return -ENXIO ; } gart->dev = &pdev->dev;
@@ -385,8 +383,7 @@ static int tegra_gart_probe(struct platform_device *pdev) gart->savedata =vmalloc (sizeof (u32) * gart->page_count);if (!gart->savedata) {dev_err (dev,"failed to allocate context save area\n" ); - err = -ENOMEM ; - goto fail; +return -ENOMEM ; }platform_set_drvdata (pdev, gart);
@@ -394,27 +391,14 @@ static int tegra_gart_probe(struct platform_device *pdev) gart_handle = gart;return 0 ; - -fail: -if (gart_regs) -devm_iounmap (dev, gart_regs); -if (gart && gart->savedata) -vfree (gart->savedata); -devm_kfree (dev, gart); -return err; }static int tegra_gart_remove (struct platform_device *pdev) {struct gart_device *gart =platform_get_drvdata (pdev); -struct device *dev = gart->dev;writel (0 , gart->regs +GART_CONFIG ); -if (gart->savedata) -vfree (gart->savedata); -if (gart->regs) -devm_iounmap (dev, gart->regs); -devm_kfree (dev, gart); +vfree (gart->savedata); gart_handle =NULL ;return 0 ; }
Signature · 1 line
1.7.5.4
PATCH 2/2 iommu/tegra: gart: Reserve iomem resource
GART Register/Aperture range should be reserved.
--- drivers/iommu/tegra-gart.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)
drivers/iommu/tegra-gart.c +7 -1
@@ -366,12 +366,18 @@ static int tegra_gart_probe(struct platform_device *pdev)return -ENOMEM ; } - gart_regs =devm_ioremap (dev, res->start,resource_size (res)); + gart_regs =devm_request_and_ioremap (dev, res);if (!gart_regs) {dev_err (dev,"failed to remap GART registers\n" );return -ENXIO ; } +if (!devm_request_mem_region (dev, res_remap->start, +resource_size (res_remap),dev_name (dev))) { +dev_err (dev,"failed to reserve GART aperture\n" ); +return -EBUSY ; + } + gart->dev = &pdev->dev;spin_lock_init (&gart->pte_lock);spin_lock_init (&gart->client_lock);
Signature · 1 line
1.7.5.4
Re: [PATCH 2/2] iommu/tegra: gart: Reserve iomem resource
Quoted 18 lines · Hiroshi DOYU
GART Register/Aperture range should be reserved.
Signed-off-by Hiroshi DOYU <[email protected]>--- drivers/iommu/tegra-gart.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)drivers/iommu/tegra-gart.c +1
-1@@ -366,12 +366,18 @@ static int tegra_gart_probe(struct platform_device *pdev)return -ENOMEM ; } - gart_regs =devm_ioremap (dev, res->start,resource_size (res)); + gart_regs =devm_request_and_ioremap (dev, res);if (!gart_regs) {
drivers/iommu/tegra-gart.c static int tegra_gart_probe(struct platform_device *pdev) · line 380
Quoted 10 lines
drivers/iommu/tegra-gart.c +6
-0dev_err (dev,"failed to remap GART registers\n" );return -ENXIO ; } +if (!devm_request_mem_region (dev, res_remap->start, +resource_size (res_remap),dev_name (dev))) { +dev_err (dev,"failed to reserve GART aperture\n" ); +return -EBUSY ; + } +
I'm not so sure that this is a good idea. If the GART driver requests the GART aperture, then users of the GART aperture (e.g. the DRM driver) will no longer be able to use it.
Thierry
Re: [PATCH 2/2] iommu/tegra: gart: Reserve iomem resource
Quoted 2 lines · Thierry Reding
Quoted 1 line · Hiroshi DOYU
GART Register/Aperture range should be reserved.
...
Quoted 2 lines
Quoted 2 lines
drivers/iommu/tegra-gart.c +0
-0
...
Quoted 7 lines
Quoted 3 lines
drivers/iommu/tegra-gart.c +1
-0+ if (!devm_request_mem_region(dev, res_remap->start, +
resource_size(res_remap),dev_name(dev))) { + dev_err(dev,
"failed to reserve GART aperture\n"); + return-EBUSY; + } +I'm not so sure that this is a good idea. If the GART driver requests the GART aperture, then users of the GART aperture (e.g. the DRM driver) will no longer be able to use it.
Presumably the DRM driver would be obtaining access to parts of the GART aperture through the GART driver, rather than just grabbing the IO region and using it for itself?
Re: [PATCH 2/2] iommu/tegra: gart: Reserve iomem resource
Am Montag, den 21.05.2012, 10:41 -0600 schrieb Stephen Warren:
Quoted 15 lines · Thierry Reding
Quoted 2 lines · Hiroshi DOYU
Quoted 1 line
GART Register/Aperture range should be reserved.
...
Quoted 2 lines
Quoted 2 lines
drivers/iommu/tegra-gart.c +0
-0...
Quoted 7 lines
Quoted 3 lines
drivers/iommu/tegra-gart.c +1
-0+ if (!devm_request_mem_region(dev, res_remap->start, +
resource_size(res_remap),dev_name(dev))) { + dev_err(dev,
"failed to reserve GART aperture\n"); + return-EBUSY; + } +I'm not so sure that this is a good idea. If the GART driver requests the GART aperture, then users of the GART aperture (e.g. the DRM driver) will no longer be able to use it.
Quoted 3 lines
Presumably the DRM driver would be obtaining access to parts of the GART aperture through the GART driver, rather than just grabbing the IO region and using it for itself?
With a TTM-like memory manager the DRM driver will take over the address space management of the GART aperture. The GART driver is only used to set up the mappings in the IOMMU. The DRM driver is the one that sets up/tears down the CPU mappings on demand, so the aperture should be claimed in the DRM driver.
-- Lucas
Re: [PATCH 2/2] iommu/tegra: gart: Reserve iomem resource
Quoted 20 lines · Lucas Stach
Am Montag, den 21.05.2012, 10:41 -0600 schrieb Stephen Warren:
Quoted 15 lines · Thierry Reding
Quoted 2 lines · Hiroshi DOYU
Quoted 1 line
GART Register/Aperture range should be reserved.
...
Quoted 2 lines
Quoted 2 lines
drivers/iommu/tegra-gart.c +0
-0...
Quoted 7 lines
Quoted 3 lines
drivers/iommu/tegra-gart.c +1
-0+ if (!devm_request_mem_region(dev, res_remap->start, +
resource_size(res_remap),dev_name(dev))) { + dev_err(dev,
"failed to reserve GART aperture\n"); + return-EBUSY; + } +I'm not so sure that this is a good idea. If the GART driver requests the GART aperture, then users of the GART aperture (e.g. the DRM driver) will no longer be able to use it.
Quoted 3 lines
Presumably the DRM driver would be obtaining access to parts of the GART aperture through the GART driver, rather than just grabbing the IO region and using it for itself?
Quoted 5 lines
With a TTM-like memory manager the DRM driver will take over the address space management of the GART aperture. The GART driver is only used to set up the mappings in the IOMMU. The DRM driver is the one that sets up/tears down the CPU mappings on demand, so the aperture should be claimed in the DRM driver.
Even if the DRM driver is managing the aperture, I still think the GART driver should claim it. The physical address of the aperture is a property of the GART, so only the GART's resources (and DT node) should contain a representation of where that aperture is. The DRM driver should call into the GART driver to find out where the aperture is, and hence GART is able to claim it without conflict.
Re: [PATCH 2/2] iommu/tegra: gart: Reserve iomem resource
Quoted 27 lines · Stephen Warren
Quoted 20 lines · Lucas Stach
Am Montag, den 21.05.2012, 10:41 -0600 schrieb Stephen Warren:
Quoted 15 lines · Thierry Reding
Quoted 2 lines · Hiroshi DOYU
Quoted 1 line
GART Register/Aperture range should be reserved.
...
Quoted 2 lines
Quoted 2 lines
drivers/iommu/tegra-gart.c +0
-0...
Quoted 7 lines
Quoted 3 lines
drivers/iommu/tegra-gart.c +1
-0+ if (!devm_request_mem_region(dev, res_remap->start, +
resource_size(res_remap),dev_name(dev))) { + dev_err(dev,
"failed to reserve GART aperture\n"); + return-EBUSY; + } +I'm not so sure that this is a good idea. If the GART driver requests the GART aperture, then users of the GART aperture (e.g. the DRM driver) will no longer be able to use it.
Quoted 3 lines
Presumably the DRM driver would be obtaining access to parts of the GART aperture through the GART driver, rather than just grabbing the IO region and using it for itself?
Quoted 5 lines
With a TTM-like memory manager the DRM driver will take over the address space management of the GART aperture. The GART driver is only used to set up the mappings in the IOMMU. The DRM driver is the one that sets up/tears down the CPU mappings on demand, so the aperture should be claimed in the DRM driver.
Quoted 6 lines
Even if the DRM driver is managing the aperture, I still think the GART driver should claim it. The physical address of the aperture is a property of the GART, so only the GART's resources (and DT node) should contain a representation of where that aperture is. The DRM driver should call into the GART driver to find out where the aperture is, and hence GART is able to claim it without conflict.
That could be difficult to do. There isn't any API to allow this. I guess if something like that is added it should probably go into the IOMMU framework.
Thierry
Re: [PATCH 2/2] iommu/tegra: gart: Reserve iomem resource
Am Montag, den 21.05.2012, 19:31 +0200 schrieb Thierry Reding:
Quoted 35 lines · Stephen Warren
Quoted 27 lines · Lucas Stach
Quoted 20 lines
Am Montag, den 21.05.2012, 10:41 -0600 schrieb Stephen Warren:
Quoted 15 lines · Thierry Reding
Quoted 2 lines · Hiroshi DOYU
Quoted 1 line
GART Register/Aperture range should be reserved.
...
Quoted 2 lines
Quoted 2 lines
drivers/iommu/tegra-gart.c +0
-0...
Quoted 7 lines
Quoted 3 lines
drivers/iommu/tegra-gart.c +1
-0+ if (!devm_request_mem_region(dev, res_remap->start, +
resource_size(res_remap),dev_name(dev))) { + dev_err(dev,
"failed to reserve GART aperture\n"); + return-EBUSY; + } +I'm not so sure that this is a good idea. If the GART driver requests the GART aperture, then users of the GART aperture (e.g. the DRM driver) will no longer be able to use it.
Quoted 3 lines
Presumably the DRM driver would be obtaining access to parts of the GART aperture through the GART driver, rather than just grabbing the IO region and using it for itself?
Quoted 5 lines
With a TTM-like memory manager the DRM driver will take over the address space management of the GART aperture. The GART driver is only used to set up the mappings in the IOMMU. The DRM driver is the one that sets up/tears down the CPU mappings on demand, so the aperture should be claimed in the DRM driver.
Quoted 6 lines
Even if the DRM driver is managing the aperture, I still think the GART driver should claim it. The physical address of the aperture is a property of the GART, so only the GART's resources (and DT node) should contain a representation of where that aperture is. The DRM driver should call into the GART driver to find out where the aperture is, and hence GART is able to claim it without conflict.
Quoted 2 lines
That could be difficult to do. There isn't any API to allow this. I guess if something like that is added it should probably go into the IOMMU framework.
Ah, yes. There already was a plan to add properties for this to the IOMMU API. So I'm ok with the GART driver claiming the resources. I will try to push the needed API changes forward in the next few days.
-- Lucas
Re: [PATCH 2/2] iommu/tegra: gart: Reserve iomem resource
Hi Lucas,
Quoted 36 lines · On Mon, 21 May 2012 19:38:28 +0200 Lucas Stach…
Am Montag, den 21.05.2012, 19:31 +0200 schrieb Thierry Reding:
Quoted 35 lines · Stephen Warren
Quoted 33 lines · Lucas Stach
Quoted 20 lines
Am Montag, den 21.05.2012, 10:41 -0600 schrieb Stephen Warren:
Quoted 15 lines · Thierry Reding
Quoted 2 lines · Hiroshi DOYU
Quoted 1 line
GART Register/Aperture range should be reserved.
...
Quoted 2 lines
Quoted 2 lines
drivers/iommu/tegra-gart.c +0
-0...
Quoted 7 lines
Quoted 3 lines
drivers/iommu/tegra-gart.c +1
-0+ if (!devm_request_mem_region(dev, res_remap->start, +
resource_size(res_remap),dev_name(dev))) { + dev_err(dev,
"failed to reserve GART aperture\n"); + return-EBUSY; + } +I'm not so sure that this is a good idea. If the GART driver requests the GART aperture, then users of the GART aperture (e.g. the DRM driver) will no longer be able to use it.
Quoted 3 lines
Presumably the DRM driver would be obtaining access to parts of the GART aperture through the GART driver, rather than just grabbing the IO region and using it for itself?
Quoted 5 lines
With a TTM-like memory manager the DRM driver will take over the address space management of the GART aperture. The GART driver is only used to set up the mappings in the IOMMU. The DRM driver is the one that sets up/tears down the CPU mappings on demand, so the aperture should be claimed in the DRM driver.
Even if the DRM driver is managing the aperture, I still think the GART driver should claim it. The physical address of the aperture is a property of the GART, so only the GART's resources (and DT node) should contain a representation of where that aperture is. The DRM driver should call into the GART driver to find out where the aperture is, and hence GART is able to claim it without conflict.
Quoted 5 lines
Quoted 2 lines
That could be difficult to do. There isn't any API to allow this. I guess if something like that is added it should probably go into the IOMMU framework.
Ah, yes. There already was a plan to add properties for this to the IOMMU API. So I'm ok with the GART driver claiming the resources.
I think that DRM driver should be independent of GART, one specific implementation of IOMMU H/W, but it should be a normal client of DMA BUF(or DMABUF API?), which asks info via IOMMU API if necessary.
For new IOMMU API, I guess that the following would be the one we need here.
[PATCH 0/5] IOMMU: Make IOMMU-API ready for GART-like hardware
https://lkml.org/lkml/2012/1/19/170
Quoted 2 lines
I will try to push the needed API changes forward in the next few days.
Have you had any chance to post the above succeeding patch? I couldn't find.
Re: [PATCH 2/2] iommu/tegra: gart: Reserve iomem resource
Hello Hiroshi,
Am Montag, den 18.06.2012, 13:37 +0300 schrieb Hiroshi Doyu:
Quoted 44 lines
Hi Lucas,
Quoted 39 lines · On Mon, 21 May 2012 19:38:28 +0200 Lucas Stach…
Am Montag, den 21.05.2012, 19:31 +0200 schrieb Thierry Reding:
Quoted 37 lines · Stephen Warren
Quoted 27 lines · Lucas Stach
Quoted 20 lines
Am Montag, den 21.05.2012, 10:41 -0600 schrieb Stephen Warren:
Quoted 15 lines · Thierry Reding
Quoted 2 lines · Hiroshi DOYU
Quoted 1 line
GART Register/Aperture range should be reserved.
...
Quoted 2 lines
Quoted 2 lines
drivers/iommu/tegra-gart.c +0
-0...
Quoted 7 lines
Quoted 3 lines
drivers/iommu/tegra-gart.c +1
-0+ if (!devm_request_mem_region(dev, res_remap->start, +
resource_size(res_remap),dev_name(dev))) { + dev_err(dev,
"failed to reserve GART aperture\n"); + return-EBUSY; + } +I'm not so sure that this is a good idea. If the GART driver requests the GART aperture, then users of the GART aperture (e.g. the DRM driver) will no longer be able to use it.
Quoted 3 lines
Presumably the DRM driver would be obtaining access to parts of the GART aperture through the GART driver, rather than just grabbing the IO region and using it for itself?
Quoted 5 lines
With a TTM-like memory manager the DRM driver will take over the address space management of the GART aperture. The GART driver is only used to set up the mappings in the IOMMU. The DRM driver is the one that sets up/tears down the CPU mappings on demand, so the aperture should be claimed in the DRM driver.
Quoted 6 lines
Even if the DRM driver is managing the aperture, I still think the GART driver should claim it. The physical address of the aperture is a property of the GART, so only the GART's resources (and DT node) should contain a representation of where that aperture is. The DRM driver should call into the GART driver to find out where the aperture is, and hence GART is able to claim it without conflict.
That could be difficult to do. There isn't any API to allow this. I guess if something like that is added it should probably go into the IOMMU framework.
Quoted 6 lines
Quoted 2 lines
Ah, yes. There already was a plan to add properties for this to the IOMMU API. So I'm ok with the GART driver claiming the resources.
I think that DRM driver should be independent of GART, one specific implementation of IOMMU H/W, but it should be a normal client of DMA BUF(or DMABUF API?), which asks info via IOMMU API if necessary.
You are right that the DRM driver should not care about the specific IOMMU implementation. It shouldn't matter to the graphics driver if it sits on top of a Tegra 2 GART with a fixed aperture of 32MB or on top of a Tegra 3 SMMU with an virtual address space of several Gigabytes.
However graphics cores are one of the most complicated devices when it comes to DMA resource management. Because of it's natural operation mode as a completely parallel coprocessor to the CPU and the big amounts of data that has to be mapped at every given time, the GPU doesn't fit terribly well within the normal Linux Kernel DMA API.
We already have a solution for GPU address space management in the kernel, called TTM, which in turn integrates with other things like DMABUF. But to guarantee the best performance TTM will have to manage the whole virtual address space of the GPU. So I think the IOMMU API is the perfect abstraction level for interaction between the DRM and the GART/SMMU driver. This way the DRM is able to manage the DMA resources on it's own while staying completely agnostic about the underlying IOMMU hardware.
Quoted 6 lines
For new IOMMU API, I guess that the following would be the one we need here.
[PATCH 0/5] IOMMU: Make IOMMU-API ready for GART-like hardware
https://lkml.org/lkml/2012/1/19/170
Yes, this is exactly the patchset I had in mind.
Quoted 6 lines
Quoted 2 lines
I will try to push the needed API changes forward in the next few days.
Have you had any chance to post the above succeeding patch? I couldn't find.
No, sorry. I was occupied with other things for the last weeks and couldn't find the time to revisit this topic.
-- Lucas
PATCH 1/2 iommu/tegra: gart: Remove unnecessary cleanup with devm_*()
From: Hiroshi DOYU <[email protected]>
Remove unnecessary cleanup procedures with devm_*().
--- drivers/iommu/tegra-gart.c | 22 +++------------------- 1 files changed, 3 insertions(+), 19 deletions(-)
drivers/iommu/tegra-gart.c +3 -19
@@ -345,7 +345,6 @@ static int tegra_gart_probe(struct platform_device *pdev)struct gart_device *gart;struct resource *res, *res_remap;void __iomem *gart_regs; -int err;struct device *dev = &pdev->dev;if (gart_handle)
@@ -370,8 +369,7 @@ static int tegra_gart_probe(struct platform_device *pdev) gart_regs =devm_ioremap (dev, res->start,resource_size (res));if (!gart_regs) {dev_err (dev,"failed to remap GART registers\n" ); - err = -ENXIO ; - goto fail; +return -ENXIO ; } gart->dev = &pdev->dev;
@@ -385,8 +383,7 @@ static int tegra_gart_probe(struct platform_device *pdev) gart->savedata =vmalloc (sizeof (u32) * gart->page_count);if (!gart->savedata) {dev_err (dev,"failed to allocate context save area\n" ); - err = -ENOMEM ; - goto fail; +return -ENOMEM ; }platform_set_drvdata (pdev, gart);
@@ -394,27 +391,14 @@ static int tegra_gart_probe(struct platform_device *pdev) gart_handle = gart;return 0 ; - -fail: -if (gart_regs) -devm_iounmap (dev, gart_regs); -if (gart && gart->savedata) -vfree (gart->savedata); -devm_kfree (dev, gart); -return err; }static int tegra_gart_remove (struct platform_device *pdev) {struct gart_device *gart =platform_get_drvdata (pdev); -struct device *dev = gart->dev;writel (0 , gart->regs +GART_CONFIG ); -if (gart->savedata) -vfree (gart->savedata); -if (gart->regs) -devm_iounmap (dev, gart->regs); -devm_kfree (dev, gart); +vfree (gart->savedata); gart_handle =NULL ;return 0 ; }
Signature · 1 line
1.7.5.4
A message that is not in the archive (sent off-list or not yet received): 1340175873-12531-1-git-send-email-hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org
PATCH 2/2 iommu/tegra: gart: Reserve iomem resource
From: Hiroshi DOYU <[email protected]>
GART Register/Aperture range should be reserved.
--- drivers/iommu/tegra-gart.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)
drivers/iommu/tegra-gart.c +7 -1
@@ -366,12 +366,18 @@ static int tegra_gart_probe(struct platform_device *pdev)return -ENOMEM ; } - gart_regs =devm_ioremap (dev, res->start,resource_size (res)); + gart_regs =devm_request_and_ioremap (dev, res);if (!gart_regs) {dev_err (dev,"failed to remap GART registers\n" );return -ENXIO ; } +if (!devm_request_mem_region (dev, res_remap->start, +resource_size (res_remap),dev_name (dev))) { +dev_err (dev,"failed to reserve GART aperture\n" ); +return -EBUSY ; + } + gart->dev = &pdev->dev;spin_lock_init (&gart->pte_lock);spin_lock_init (&gart->client_lock);
Signature · 1 line
1.7.5.4
A message that is not in the archive (sent off-list or not yet received): 1340175873-12531-2-git-send-email-hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org
Stephen Warren
Acked-byRe: [PATCH 2/2] iommu/tegra: gart: Reserve iomem resource
Quoted 7 lines · Hiroshi DOYU
From: Hiroshi DOYU <[email protected]>
GART Register/Aperture range should be reserved.
Signed-off-by Hiroshi DOYU <[email protected]>Cc Thierry Reding <[email protected]>Cc Lucas Stach <[email protected]>
Stephen Warren
Acked-byQuoted 7 lines · Hiroshi DOYU
From: Hiroshi DOYU <[email protected]>
Remove unnecessary cleanup procedures with devm_*().
Signed-off-by Hiroshi DOYU <[email protected]>Reviewed-by Thierry Reding <[email protected]>Cc Lucas Stach <[email protected]>
Re: [PATCH 2/2] iommu/tegra: gart: Reserve iomem resource
In reply to Thierry RedingQuoted 35 lines · Thierry Reding
Quoted 27 lines · Stephen Warren
Quoted 20 lines · Lucas Stach
Am Montag, den 21.05.2012, 10:41 -0600 schrieb Stephen Warren:
Quoted 15 lines · Thierry Reding
Quoted 2 lines · Hiroshi DOYU
Quoted 1 line
GART Register/Aperture range should be reserved.
...
Quoted 2 lines
Quoted 2 lines
drivers/iommu/tegra-gart.c +0
-0...
Quoted 7 lines
Quoted 3 lines
drivers/iommu/tegra-gart.c +1
-0+ if (!devm_request_mem_region(dev, res_remap->start, +
resource_size(res_remap),dev_name(dev))) { + dev_err(dev,
"failed to reserve GART aperture\n"); + return-EBUSY; + } +I'm not so sure that this is a good idea. If the GART driver requests the GART aperture, then users of the GART aperture (e.g. the DRM driver) will no longer be able to use it.
Quoted 3 lines
Presumably the DRM driver would be obtaining access to parts of the GART aperture through the GART driver, rather than just grabbing the IO region and using it for itself?
Quoted 5 lines
With a TTM-like memory manager the DRM driver will take over the address space management of the GART aperture. The GART driver is only used to set up the mappings in the IOMMU. The DRM driver is the one that sets up/tears down the CPU mappings on demand, so the aperture should be claimed in the DRM driver.
Quoted 6 lines
Even if the DRM driver is managing the aperture, I still think the GART driver should claim it. The physical address of the aperture is a property of the GART, so only the GART's resources (and DT node) should contain a representation of where that aperture is. The DRM driver should call into the GART driver to find out where the aperture is, and hence GART is able to claim it without conflict.
Quoted 2 lines
That could be difficult to do. There isn't any API to allow this. I guess if something like that is added it should probably go into the IOMMU framework.
Thinking some more about this, even then care needs to be taken to allow only one user access to the GART aperture. Having the DRM driver request the region would automatically prevent any other driver from requesting the same memory. This is no longer true if an extra API is used to request the GART aperture from the IOMMU. Unless of course some of these restrictions are reimplemented in the IOMMU API.
Thierry
Quoted 7 lines · Hiroshi DOYU
Remove unnecessary cleanup procedures with devm_*().
Signed-off-by Hiroshi DOYU <[email protected]>--- drivers/iommu/tegra-gart.c | 22 +++------------------- 1 files changed, 3 insertions(+), 19 deletions(-)