From 8fbf4a26ec7bdbcfef30865c7a951144f41b7474 Mon Sep 17 00:00:00 2001 From: xinhui pan Date: Thu, 9 Aug 2018 17:41:03 +0800 Subject: [PATCH] thunk: fix a vm area release issue On some asics, like tonga, the memory alignment size is as big as 0x8000. fmm_allocate* alloc vm area with size passed in which is not aligned mostly. But __fmm_release free vm area with vm_object_t->size which is aligned. That might cause aperture_release_area fail to free the vm area as the size might be bigger than zone itself or it just free another vm area nearby unexpected. This patch somehow will alloc more space than it needed on tonga. gfx900+ is not affected. Change-Id: I5a88c92b08c4e6f6bc05881798f769b55d6debe9 Signed-off-by: xinhui pan --- src/fmm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fmm.c b/src/fmm.c index e2374a403f..1b43140435 100644 --- a/src/fmm.c +++ b/src/fmm.c @@ -509,7 +509,7 @@ static bool aperture_is_valid(void *app_base, void *app_limit) */ static uint64_t vm_align_area_size(manageable_aperture_t *app, uint64_t size) { - return ALIGN_UP(size + (uint64_t)app->guard_pages * PAGE_SIZE, + return ALIGN_UP(ALIGN_UP(size, app->align) + (uint64_t)app->guard_pages * PAGE_SIZE, app->align); }