diff options
author | Mikko Perttunen <mperttunen@nvidia.com> | 2016-12-14 13:16:11 +0200 |
---|---|---|
committer | Thierry Reding <treding@nvidia.com> | 2017-04-05 18:11:46 +0200 |
commit | ad92601521ea1928e702dc709384d21e96202155 (patch) | |
tree | 9560c41ea247234608ed2d24894101d02da04b95 /drivers/gpu/drm/tegra/drm.h | |
parent | 5e91144dd702d068b22a75911c06104e56cb4858 (diff) | |
download | linux-stable-ad92601521ea1928e702dc709384d21e96202155.tar.gz linux-stable-ad92601521ea1928e702dc709384d21e96202155.tar.bz2 linux-stable-ad92601521ea1928e702dc709384d21e96202155.zip |
drm/tegra: Add Tegra DRM allocation API
Add a new IO virtual memory allocation API to allow clients to
allocate non-GEM memory in the Tegra DRM IOMMU domain. This is
required e.g. for loading client firmware when clients are attached
to the IOMMU domain.
The allocator allocates contiguous physical pages that are then
mapped contiguously to the IOMMU domain using the iova_domain
library provided by the kernel. Contiguous physical pages are
used so that the same allocator works also when IOMMU support
is disabled and therefore devices access physical memory directly.
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'drivers/gpu/drm/tegra/drm.h')
-rw-r--r-- | drivers/gpu/drm/tegra/drm.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/drm/tegra/drm.h index 368dde1bed18..668ccfb5cb05 100644 --- a/drivers/gpu/drm/tegra/drm.h +++ b/drivers/gpu/drm/tegra/drm.h @@ -12,6 +12,7 @@ #include <uapi/drm/tegra_drm.h> #include <linux/host1x.h> +#include <linux/iova.h> #include <linux/of_gpio.h> #include <drm/drmP.h> @@ -45,6 +46,12 @@ struct tegra_drm { struct mutex mm_lock; struct drm_mm mm; + struct { + struct iova_domain domain; + unsigned long shift; + unsigned long limit; + } carveout; + struct mutex clients_lock; struct list_head clients; @@ -106,6 +113,10 @@ int tegra_drm_unregister_client(struct tegra_drm *tegra, int tegra_drm_init(struct tegra_drm *tegra, struct drm_device *drm); int tegra_drm_exit(struct tegra_drm *tegra); +void *tegra_drm_alloc(struct tegra_drm *tegra, size_t size, dma_addr_t *iova); +void tegra_drm_free(struct tegra_drm *tegra, size_t size, void *virt, + dma_addr_t iova); + struct tegra_dc_soc_info; struct tegra_output; |