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 <xinhui.pan@amd.com>
Cette révision appartient à :
xinhui pan a créé et Xinhui Pan a révisé 2018-08-09 06:08:15 -04:00
1 Parent fe04dd6890
révision 8fbf4a26ec
1 fichier modifié
+1 -1
+1 -1
Voir le fichier
@@ -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);
}