From c735b0ebca579e3b91755f70a5d3d205c2f5713f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Povi=C5=A1er?= Date: Wed, 22 Feb 2023 15:25:18 +0100 Subject: [PATCH] sio: Allocate from top of memory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Place the firmware data we are preparing at the top of memory. Signed-off-by: Martin PoviĊĦer --- src/sio.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/sio.c b/src/sio.c index 0c1c9c6f..e8554ff6 100644 --- a/src/sio.c +++ b/src/sio.c @@ -42,7 +42,7 @@ static void *alloc_mapped_data(size_t size, u64 *iova) else mapping->iova = *iova = ALIGN_UP((mapping - 1)->iova + (mapping - 1)->size, SZ_16K); mapping->size = ALIGN_UP(size, SZ_4K); - mapping->phys = (u64)memalign(SZ_16K, ALIGN_UP(size, SZ_16K)); + mapping->phys = top_of_memory_alloc(size); memset64((void *)mapping->phys, 0, ALIGN_UP(mapping->size, SZ_16K)); done: @@ -211,7 +211,9 @@ err: for (int i = 0; i < MAX_FWDATA; i++) { if (!sio_fwdata[i].size) break; - free((void *)sio_fwdata[i].phys); + // No way to give back memory with the top of memory + // allocator. + // free((void *)sio_fwdata[i].phys); } free(sio_fwdata); free(sio_fwparams);