]> git.karo-electronics.de Git - linux-beck.git/commitdiff
iommu/tegra: gart: Set aperture at domain initialization time
authorThierry Reding <treding@nvidia.com>
Fri, 27 Mar 2015 10:07:26 +0000 (11:07 +0100)
committerJoerg Roedel <jroedel@suse.de>
Tue, 31 Mar 2015 14:34:12 +0000 (16:34 +0200)
The aperture of the domain should always be available, otherwise drivers
need to attach first before they can use the aperture geometry.

Cc: Hiroshi Doyu <hdoyu@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/tegra-gart.c

index c48da057dbb1e5b6be38e6b28daced1046454687..5f3b68c26b839de6feea48ef9cf8820aa4e972ba 100644 (file)
@@ -156,20 +156,10 @@ static inline bool gart_iova_range_valid(struct gart_device *gart,
 static int gart_iommu_attach_dev(struct iommu_domain *domain,
                                 struct device *dev)
 {
-       struct gart_device *gart;
+       struct gart_device *gart = domain->priv;
        struct gart_client *client, *c;
        int err = 0;
 
-       gart = gart_handle;
-       if (!gart)
-               return -EINVAL;
-       domain->priv = gart;
-
-       domain->geometry.aperture_start = gart->iovmm_base;
-       domain->geometry.aperture_end   = gart->iovmm_base +
-                                       gart->page_count * GART_PAGE_SIZE - 1;
-       domain->geometry.force_aperture = true;
-
        client = devm_kzalloc(gart->dev, sizeof(*c), GFP_KERNEL);
        if (!client)
                return -ENOMEM;
@@ -218,6 +208,19 @@ out:
 
 static int gart_iommu_domain_init(struct iommu_domain *domain)
 {
+       struct gart_device *gart;
+
+       gart = gart_handle;
+       if (!gart)
+               return -EINVAL;
+
+       domain->priv = gart;
+
+       domain->geometry.aperture_start = gart->iovmm_base;
+       domain->geometry.aperture_end = gart->iovmm_base +
+                                       gart->page_count * GART_PAGE_SIZE - 1;
+       domain->geometry.force_aperture = true;
+
        return 0;
 }