Revert "HV: added memory allocation functions for AP trampoline code relocation"

This reverts commit 41b83bb20b.
This commit is contained in:
lijinxia
2018-05-09 10:28:17 +00:00
committed by GitHub
parent d932d6397a
commit 035d3c2e19
5 changed files with 1 additions and 112 deletions

View File

@@ -341,54 +341,6 @@ int prepare_vm0_memmap_and_e820(struct vm *vm)
return 0;
}
uint64_t e820_alloc_low_memory(uint32_t size)
{
uint32_t i;
struct e820_entry *entry, *new_entry;
/* We want memory in page boundary and want integral multiple of pages */
size = ROUND_PAGE_UP(size);
for (i = 0; i < e820_entries; i++) {
entry = &e820[i];
uint64_t start, end, length;
start = ROUND_PAGE_UP(entry->baseaddr);
end = ROUND_PAGE_DOWN(entry->baseaddr + entry->length);
length = end - start;
length = (end > start) ? (end - start) : 0;
if ((entry->type != E820_TYPE_RAM)
|| (length < size)
|| (start >= MEM_1M)
|| (start + size > MEM_1M)) {
continue;
}
/* Found available memory */
e820_mem.total_mem_size -= size;
/* found exact size of e820 entry */
if (length == size) {
entry->type = E820_TYPE_RESERVED;
return start;
}
/* create a new entry for the allocated memory */
new_entry = &e820[e820_entries];
new_entry->type = E820_TYPE_RESERVED;
new_entry->baseaddr = end - size;
new_entry->length = entry->baseaddr + entry->length - new_entry->baseaddr;
entry->length -= new_entry->length;
e820_entries++;
return new_entry->baseaddr;
}
pr_fatal("Can't allocate memory under 1M from E820\n");
return ACRN_INVALID_HPA;
}
/*******************************************************************
* GUEST initial page table
*