diff options
author | Thierry Reding <treding@nvidia.com> | 2015-03-27 06:07:26 -0400 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2015-03-31 10:34:12 -0400 |
commit | 836a8ac9fe60fb112e830464868791bf7470e7b6 (patch) | |
tree | a6e480fd0547ae4380210bdb28a56914f527ce2a /drivers/iommu | |
parent | 471d9144b4ec2a2cbf497af7e186c1fe89b5150e (diff) |
iommu/tegra: gart: Set aperture at domain initialization time
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>
Diffstat (limited to 'drivers/iommu')
-rw-r--r-- | drivers/iommu/tegra-gart.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/drivers/iommu/tegra-gart.c b/drivers/iommu/tegra-gart.c index c48da057dbb1..5f3b68c26b83 100644 --- a/drivers/iommu/tegra-gart.c +++ b/drivers/iommu/tegra-gart.c | |||
@@ -156,20 +156,10 @@ static inline bool gart_iova_range_valid(struct gart_device *gart, | |||
156 | static int gart_iommu_attach_dev(struct iommu_domain *domain, | 156 | static int gart_iommu_attach_dev(struct iommu_domain *domain, |
157 | struct device *dev) | 157 | struct device *dev) |
158 | { | 158 | { |
159 | struct gart_device *gart; | 159 | struct gart_device *gart = domain->priv; |
160 | struct gart_client *client, *c; | 160 | struct gart_client *client, *c; |
161 | int err = 0; | 161 | int err = 0; |
162 | 162 | ||
163 | gart = gart_handle; | ||
164 | if (!gart) | ||
165 | return -EINVAL; | ||
166 | domain->priv = gart; | ||
167 | |||
168 | domain->geometry.aperture_start = gart->iovmm_base; | ||
169 | domain->geometry.aperture_end = gart->iovmm_base + | ||
170 | gart->page_count * GART_PAGE_SIZE - 1; | ||
171 | domain->geometry.force_aperture = true; | ||
172 | |||
173 | client = devm_kzalloc(gart->dev, sizeof(*c), GFP_KERNEL); | 163 | client = devm_kzalloc(gart->dev, sizeof(*c), GFP_KERNEL); |
174 | if (!client) | 164 | if (!client) |
175 | return -ENOMEM; | 165 | return -ENOMEM; |
@@ -218,6 +208,19 @@ out: | |||
218 | 208 | ||
219 | static int gart_iommu_domain_init(struct iommu_domain *domain) | 209 | static int gart_iommu_domain_init(struct iommu_domain *domain) |
220 | { | 210 | { |
211 | struct gart_device *gart; | ||
212 | |||
213 | gart = gart_handle; | ||
214 | if (!gart) | ||
215 | return -EINVAL; | ||
216 | |||
217 | domain->priv = gart; | ||
218 | |||
219 | domain->geometry.aperture_start = gart->iovmm_base; | ||
220 | domain->geometry.aperture_end = gart->iovmm_base + | ||
221 | gart->page_count * GART_PAGE_SIZE - 1; | ||
222 | domain->geometry.force_aperture = true; | ||
223 | |||
221 | return 0; | 224 | return 0; |
222 | } | 225 | } |
223 | 226 | ||