Skip to content

Commit

Permalink
drm/tegra: gem: Take into account IOMMU aperture
Browse files Browse the repository at this point in the history
The IOMMU may not always be able to address 2 GiB of memory. On Tegra20,
the GART supports 32 MiB starting at 0x58000000. Also the aperture on
Tegra30 and later is in fact the full 4 GiB, rather than just 2 GiB as
currently assumed.

Signed-off-by: Thierry Reding <treding@nvidia.com>
  • Loading branch information
Thierry Reding committed Jun 12, 2015
1 parent 3c1dae0 commit 4553f73
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions drivers/gpu/drm/tegra/drm.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,22 @@ static int tegra_drm_load(struct drm_device *drm, unsigned long flags)
return -ENOMEM;

if (iommu_present(&platform_bus_type)) {
struct iommu_domain_geometry *geometry;
u64 start, end;

tegra->domain = iommu_domain_alloc(&platform_bus_type);
if (!tegra->domain) {
err = -ENOMEM;
goto free;
}

DRM_DEBUG("IOMMU context initialized\n");
drm_mm_init(&tegra->mm, 0, SZ_2G);
geometry = &tegra->domain->geometry;
start = geometry->aperture_start;
end = geometry->aperture_end;

DRM_DEBUG("IOMMU context initialized (aperture: %#llx-%#llx)\n",
start, end);
drm_mm_init(&tegra->mm, start, end - start + 1);
}

mutex_init(&tegra->clients_lock);
Expand Down

0 comments on commit 4553f73

Please sign in to comment.