amdgpu: use the high VA range if possible v2
authorChristian König <christian.koenig@amd.com>
Tue, 7 Nov 2017 14:31:45 +0000 (15:31 +0100)
committerChristian König <christian.koenig@amd.com>
Tue, 9 Jan 2018 16:15:09 +0000 (17:15 +0100)
Retire the low range on Vega10 this frees up everything below 0xffff800000000000 for HMM.

v2: keep the 32bit range working.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
amdgpu/amdgpu_device.c

index d707718..a0d0172 100644 (file)
@@ -264,13 +264,23 @@ int amdgpu_device_initialize(int fd,
                goto cleanup;
        }
 
-       start = dev->dev_info.virtual_address_offset;
-       max = MIN2(dev->dev_info.virtual_address_max, 0x100000000ULL);
+       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 & ~0xffffffff) + 0x100000000ULL);
        amdgpu_vamgr_init(&dev->vamgr_32, start, max,
                          dev->dev_info.virtual_address_alignment);
 
-       start = MAX2(dev->dev_info.virtual_address_offset, 0x100000000ULL);
-       max = MAX2(dev->dev_info.virtual_address_max, 0x100000000ULL);
+       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;
        amdgpu_vamgr_init(&dev->vamgr, start, max,
                          dev->dev_info.virtual_address_alignment);