From 41e2d40d1f2f5a00099117c641068a0a105cff34 Mon Sep 17 00:00:00 2001 From: Li Fei1 Date: Fri, 5 Mar 2021 14:16:48 +0800 Subject: [PATCH] hv: e820: remove get_mem_range_info No one uses get_mem_range_info to get the top/bottom/size of the physical memory. We could get these informations by e820 table easily. Tracked-On: #5830 Signed-off-by: Li Fei1 Acked-by: eddie Dong --- hypervisor/arch/x86/e820.c | 37 ------------------------------ hypervisor/include/arch/x86/e820.h | 3 --- 2 files changed, 40 deletions(-) diff --git a/hypervisor/arch/x86/e820.c b/hypervisor/arch/x86/e820.c index dd34e7aac..4916e4137 100644 --- a/hypervisor/arch/x86/e820.c +++ b/hypervisor/arch/x86/e820.c @@ -21,37 +21,9 @@ static uint32_t hv_e820_entries_nr; /* Describe the memory layout the hypervisor uses */ static struct e820_entry hv_e820[E820_MAX_ENTRIES]; -/* Describe the top/bottom/size of the physical memory the hypervisor manages */ -static struct mem_range hv_mem_range; #define DBG_LEVEL_E820 6U -static void obtain_mem_range_info(void) -{ - uint32_t i; - struct e820_entry *entry; - - hv_mem_range.mem_bottom = UINT64_MAX; - hv_mem_range.mem_top = 0x0UL; - hv_mem_range.total_mem_size = 0UL; - - for (i = 0U; i < hv_e820_entries_nr; i++) { - entry = &hv_e820[i]; - - if (hv_mem_range.mem_bottom > entry->baseaddr) { - hv_mem_range.mem_bottom = entry->baseaddr; - } - - if ((entry->baseaddr + entry->length) > hv_mem_range.mem_top) { - hv_mem_range.mem_top = entry->baseaddr + entry->length; - } - - if (entry->type == E820_TYPE_RAM) { - hv_mem_range.total_mem_size += entry->length; - } - } -} - /* * @brief reserve some RAM, hide it from sos_vm, return its start address * @param size_arg Amount of memory to be found and marked reserved @@ -82,7 +54,6 @@ uint64_t e820_alloc_memory(uint32_t size_arg, uint64_t max_addr) /* found exact size of e820 entry */ if (length == size) { entry->type = E820_TYPE_RESERVED; - hv_mem_range.total_mem_size -= size; ret = start; } else { @@ -102,7 +73,6 @@ uint64_t e820_alloc_memory(uint32_t size_arg, uint64_t max_addr) new_entry->length = (entry->baseaddr + entry->length) - new_entry->baseaddr; /* Shrink the existing entry and total available memory */ entry->length -= new_entry->length; - hv_mem_range.total_mem_size -= new_entry->length; hv_e820_entries_nr++; ret = new_entry->baseaddr; @@ -159,8 +129,6 @@ void init_e820(void) dev_dbg(DBG_LEVEL_E820, "Base: 0x%016lx length: 0x%016lx\n", mmap[i].baseaddr, mmap[i].length); } - - obtain_mem_range_info(); } uint32_t get_e820_entries_count(void) @@ -172,8 +140,3 @@ const struct e820_entry *get_e820_entry(void) { return hv_e820; } - -const struct mem_range *get_mem_range_info(void) -{ - return &hv_mem_range; -} diff --git a/hypervisor/include/arch/x86/e820.h b/hypervisor/include/arch/x86/e820.h index a3d3f0f2f..658916e9f 100644 --- a/hypervisor/include/arch/x86/e820.h +++ b/hypervisor/include/arch/x86/e820.h @@ -44,7 +44,4 @@ uint32_t get_e820_entries_count(void); /* get the e802 entiries */ const struct e820_entry *get_e820_entry(void); -/* get the e820 total memory info */ -const struct mem_range *get_mem_range_info(void); - #endif