提交 836a8ac9 编写于 作者: T Thierry Reding 提交者: Joerg Roedel

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: NThierry Reding <treding@nvidia.com>
Signed-off-by: NJoerg Roedel <jroedel@suse.de>
上级 471d9144
...@@ -156,20 +156,10 @@ static inline bool gart_iova_range_valid(struct gart_device *gart, ...@@ -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, static int gart_iommu_attach_dev(struct iommu_domain *domain,
struct device *dev) struct device *dev)
{ {
struct gart_device *gart; struct gart_device *gart = domain->priv;
struct gart_client *client, *c; struct gart_client *client, *c;
int err = 0; 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); client = devm_kzalloc(gart->dev, sizeof(*c), GFP_KERNEL);
if (!client) if (!client)
return -ENOMEM; return -ENOMEM;
...@@ -218,6 +208,19 @@ static void gart_iommu_detach_dev(struct iommu_domain *domain, ...@@ -218,6 +208,19 @@ static void gart_iommu_detach_dev(struct iommu_domain *domain,
static int gart_iommu_domain_init(struct iommu_domain *domain) 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; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册