amdgpu: mostly revert "use the high VA range if possible v2"
authorChristian König <christian.koenig@amd.com>
Mon, 26 Feb 2018 11:30:36 +0000 (12:30 +0100)
committerChristian König <christian.koenig@amd.com>
Wed, 28 Feb 2018 12:27:38 +0000 (13:27 +0100)
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@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
amdgpu/amdgpu_device.c
amdgpu/amdgpu_internal.h

index 6ee25a9..ca0c798 100644 (file)
@@ -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;
index dd0c3a6..423880e 100644 (file)
@@ -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 {