Messages in this thread Patches in this message | | | From | Hiroshi Doyu <> | Date | Fri, 20 Jan 2012 07:14:03 +0100 | Subject | Re: [PATCH 0/5] IOMMU: Make IOMMU-API ready for GART-like hardware |
| |
Hi Joerg,
From: Joerg Roedel <joerg.roedel@amd.com> Subject: [PATCH 0/5] IOMMU: Make IOMMU-API ready for GART-like hardware Date: Thu, 19 Jan 2012 15:30:00 +0100 Message-ID: <1326983405-319-1-git-send-email-joerg.roedel@amd.com>
> Hi, > > this patch-set adds two new functions the the IOMMU-API: > > * iommu_domain_set_attr() > * iommu_domain_get_attr() > > These are generic functions to set and change attributes of a domain. > The plan is to have a set of generic attributes implemented by more than > one IOMMU driver as well as driver specific ones. As an example for the > first type this patch-set also implements the DOMAIN_ATTR_GEOMETRY > attribute. It can be used to query information about the address space > window that can be remapped by the iommu hardware. With this attribute > is is very easy to support IOMMUs like GART and friends.
For Tegra GART & SMMU, this info is passed from board files as resource data via "platform_get_resource(,IORESOURCE_MEM,)". I think that this could be the attachement patch in Tegra case. The attached patches are based on the following post.
https://lkml.org/lkml/2012/1/5/26 https://lkml.org/lkml/2012/1/5/27 From 82d0f808a6ab0b8ce3837945f53d9ef042b5dacd Mon Sep 17 00:00:00 2001 From: Hiroshi DOYU <hdoyu@nvidia.com> Date: Fri, 20 Jan 2012 07:56:07 +0200 Subject: [PATCH 1/2] iommu/tegra/gart: Implement DOMAIN_ATTR_GEOMETRY attribute
Implement the attribute for the Tegra GART driver.
Signed-off-by: Hiroshi DOYU <hdoyu@nvidia.com> --- drivers/iommu/tegra-gart.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/drivers/iommu/tegra-gart.c b/drivers/iommu/tegra-gart.c index feaccd4..e237b08 100644 --- a/drivers/iommu/tegra-gart.c +++ b/drivers/iommu/tegra-gart.c @@ -181,6 +181,12 @@ static int gart_iommu_attach_dev(struct iommu_domain *domain, 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(dev, sizeof(*c), GFP_KERNEL); if (!client) return -ENOMEM; -- 1.7.5.4 From 04388853213b89eae29c9138eb53359aba6de18e Mon Sep 17 00:00:00 2001 From: Hiroshi DOYU <hdoyu@nvidia.com> Date: Fri, 20 Jan 2012 08:02:54 +0200 Subject: [PATCH 2/2] iommu/tegra/smmu: Implement DOMAIN_ATTR_GEOMETRY attribute
Implement the attribute for the Tegra SMMU driver.
Signed-off-by: Hiroshi DOYU <hdoyu@nvidia.com> --- drivers/iommu/tegra-smmu.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c index 7deea32..84504ff 100644 --- a/drivers/iommu/tegra-smmu.c +++ b/drivers/iommu/tegra-smmu.c @@ -723,6 +723,12 @@ found: spin_unlock_irqrestore(&as->lock, flags); domain->priv = as; + + domain->geometry.aperture_start = smmu->iovmm_base; + domain->geometry.aperture_end = smmu->iovmm_base + + smmu->page_count * SMMU_PAGE_SIZE - 1; + domain->geometry.force_aperture = true; + dev_dbg(smmu->dev, "smmu_as@%p\n", as); return 0; -- 1.7.5.4
| |