Thread (13 messages) 13 messages, 5 authors, 2012-06-20

Re: [PATCH 2/2] iommu/tegra: gart: Reserve iomem resource

From: Thierry Reding <hidden>
Date: 2012-05-21 17:39:13
Also in: lkml

* Thierry Reding wrote:
* Stephen Warren wrote:
quoted
On 05/21/2012 11:05 AM, Lucas Stach wrote:
quoted
Am Montag, den 21.05.2012, 10:41 -0600 schrieb Stephen Warren:
quoted
On 05/21/2012 08:11 AM, Thierry Reding wrote:
quoted
* Hiroshi DOYU wrote:
quoted
GART Register/Aperture range should be reserved.
...
quoted
quoted
diff --git a/drivers/iommu/tegra-gart.c
b/drivers/iommu/tegra-gart.c
...
quoted
quoted
+	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?
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.
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

Attachments

  • (unnamed) [application/pgp-signature] 198 bytes
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help