Generalize size-dependent virtual address alignment

Support all fragment sizes up to 2MB by aligning buffers according
to their size.

Change-Id: I82b7ef8be6f1507d941e5c97edb6618adf8c66de
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Tá an tiomantas seo le fáil i:
Felix Kuehling
2017-08-28 14:57:20 -04:00
tuismitheoir 65d680c035
tiomantas 52598cf37e
+5 -8
Féach ar an gComhad
@@ -544,14 +544,11 @@ static void *aperture_allocate_area_aligned(manageable_aperture_t *app,
if (align < app->align)
align = app->align;
/* Huge-page and Big-K TLB optimizations require proper alignment */
if (MemorySizeInBytes >= GPU_HUGE_PAGE_SIZE) {
if (align < GPU_HUGE_PAGE_SIZE)
align = GPU_HUGE_PAGE_SIZE;
} else if (MemorySizeInBytes >= GPU_BIGK_PAGE_SIZE) {
if (align < GPU_BIGK_PAGE_SIZE)
align = GPU_BIGK_PAGE_SIZE;
}
/* Align big buffers to the next power-of-2 up to huge page
* size for flexible fragment size TLB optimizations
*/
while (align < GPU_HUGE_PAGE_SIZE && MemorySizeInBytes >= (align << 1))
align <<= 1;
MemorySizeInBytes = vm_align_area_size(app, MemorySizeInBytes);