[PATCH RFC 047/111] staging: etnaviv: publish and use mmu geometry

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Russell King <rmk+kernel@xxxxxxxxxxxxxxxx>

We model the GPU MMU using the iommu layer, which supports exporting
the iommu domain geometry.  Use this feature to publish the size of
the MMU window, and initialise the MMU drm_mm object according to
the available MMU window size.

As we only allocate a MMU page table which covers 256MB, yet we
initialised the drm_mm object to cover 1GB, this fixes an overflow
of the MMU page table array.

Signed-off-by: Russell King <rmk+kernel@xxxxxxxxxxxxxxxx>
---
 drivers/staging/etnaviv/etnaviv_iommu.c | 2 ++
 drivers/staging/etnaviv/etnaviv_mmu.c   | 4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/etnaviv/etnaviv_iommu.c b/drivers/staging/etnaviv/etnaviv_iommu.c
index 6aa91bcf1893..d8ac05aa2cd3 100644
--- a/drivers/staging/etnaviv/etnaviv_iommu.c
+++ b/drivers/staging/etnaviv/etnaviv_iommu.c
@@ -166,6 +166,8 @@ struct iommu_domain *etnaviv_iommu_domain_alloc(struct etnaviv_gpu *gpu)
 		return NULL;
 
 	domain->ops = &etnaviv_iommu_ops;
+	domain->geometry.aperture_start = GPU_MEM_START;
+	domain->geometry.aperture_end = GPU_MEM_START + PT_ENTRIES * SZ_4K;
 
 	ret = domain->ops->domain_init(domain);
 	if (ret)
diff --git a/drivers/staging/etnaviv/etnaviv_mmu.c b/drivers/staging/etnaviv/etnaviv_mmu.c
index 48a0818a3788..51d91e3d30ed 100644
--- a/drivers/staging/etnaviv/etnaviv_mmu.c
+++ b/drivers/staging/etnaviv/etnaviv_mmu.c
@@ -109,7 +109,9 @@ struct etnaviv_iommu *etnaviv_iommu_new(struct drm_device *dev,
 	mmu->domain = domain;
 	mmu->dev = dev;
 
-	drm_mm_init(&mmu->mm, 0x80000000, SZ_1G);
+	drm_mm_init(&mmu->mm, domain->geometry.aperture_start,
+		    domain->geometry.aperture_end -
+		      domain->geometry.aperture_start + 1);
 
 	iommu_set_fault_handler(domain, etnaviv_fault_handler, dev);
 
-- 
2.1.4

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel





[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux