[PATCH libdrm 1/2] amdgpu: mostly revert "use the high VA range if possible v2"

Christian König ckoenig.leichtzumerken at gmail.com
Mon Feb 26 13:16:34 UTC 2018


This reverts commit 07ea20d5beb24315b721adf83bbfa72ce016e146.

Unfortunately it turned out that this change broke some corner cases in
Mesa.

Revert it for now, but keep the high range in separate VA managers.

Signed-off-by: Christian König <christian.koenig at amd.com>
---
 amdgpu/amdgpu_device.c   | 28 +++++++++++++++-------------
 amdgpu/amdgpu_internal.h |  6 +++++-
 2 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/amdgpu/amdgpu_device.c b/amdgpu/amdgpu_device.c
index 6ee25a9e..ca0c7987 100644
--- a/amdgpu/amdgpu_device.c
+++ b/amdgpu/amdgpu_device.c
@@ -264,27 +264,29 @@ int amdgpu_device_initialize(int fd,
 		goto cleanup;
 	}
 
-	if (dev->dev_info.high_va_offset && dev->dev_info.high_va_max) {
-		start = dev->dev_info.high_va_offset;
-		max = dev->dev_info.high_va_max;
-	} else {
-		start = dev->dev_info.virtual_address_offset;
-		max = dev->dev_info.virtual_address_max;
-	}
-
-	max = MIN2(max, (start & ~0xffffffffULL) + 0x100000000ULL);
+	start = dev->dev_info.virtual_address_offset;
+	max = MIN2(dev->dev_info.virtual_address_max, 0x100000000ULL);
 	amdgpu_vamgr_init(&dev->vamgr_32, start, max,
 			  dev->dev_info.virtual_address_alignment);
 	dev->address32_hi = start >> 32;
 
 	start = max;
-	if (dev->dev_info.high_va_offset && dev->dev_info.high_va_max)
-		max = dev->dev_info.high_va_max;
-	else
-		max = dev->dev_info.virtual_address_max;
+	max = MAX2(dev->dev_info.virtual_address_max, 0x100000000ULL);
 	amdgpu_vamgr_init(&dev->vamgr, start, max,
 			  dev->dev_info.virtual_address_alignment);
 
+	start = dev->dev_info.high_va_offset;
+	max = MIN2(dev->dev_info.high_va_max, (start & ~0xffffffffULL) +
+		   0x100000000ULL);
+	amdgpu_vamgr_init(&dev->vamgr_high_32, start, max,
+			  dev->dev_info.virtual_address_alignment);
+
+	start = max;
+	max = MAX2(dev->dev_info.high_va_max, (start & ~0xffffffffULL) +
+		   0x100000000ULL);
+	amdgpu_vamgr_init(&dev->vamgr_high, start, max,
+			  dev->dev_info.virtual_address_alignment);
+
 	amdgpu_parse_asic_ids(dev);
 
 	*major_version = dev->major_version;
diff --git a/amdgpu/amdgpu_internal.h b/amdgpu/amdgpu_internal.h
index dd0c3a61..423880ed 100644
--- a/amdgpu/amdgpu_internal.h
+++ b/amdgpu/amdgpu_internal.h
@@ -84,10 +84,14 @@ struct amdgpu_device {
 	pthread_mutex_t bo_table_mutex;
 	struct drm_amdgpu_info_device dev_info;
 	struct amdgpu_gpu_info info;
-	/** The global VA manager for the whole virtual address space */
+	/** The VA manager for the lower virtual address space */
 	struct amdgpu_bo_va_mgr vamgr;
 	/** The VA manager for the 32bit address space */
 	struct amdgpu_bo_va_mgr vamgr_32;
+	/** The VA manager for the high virtual address space */
+	struct amdgpu_bo_va_mgr vamgr_high;
+	/** The VA manager for the 32bit high address space */
+	struct amdgpu_bo_va_mgr vamgr_high_32;
 };
 
 struct amdgpu_bo {
-- 
2.14.1



More information about the amd-gfx mailing list