mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-24 06:29:19 +00:00
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 <fei1.li@intel.com> Acked-by: eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
3a465388d4
commit
41e2d40d1f
@ -21,37 +21,9 @@
|
|||||||
static uint32_t hv_e820_entries_nr;
|
static uint32_t hv_e820_entries_nr;
|
||||||
/* Describe the memory layout the hypervisor uses */
|
/* Describe the memory layout the hypervisor uses */
|
||||||
static struct e820_entry hv_e820[E820_MAX_ENTRIES];
|
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
|
#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
|
* @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
|
* @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 */
|
/* found exact size of e820 entry */
|
||||||
if (length == size) {
|
if (length == size) {
|
||||||
entry->type = E820_TYPE_RESERVED;
|
entry->type = E820_TYPE_RESERVED;
|
||||||
hv_mem_range.total_mem_size -= size;
|
|
||||||
ret = start;
|
ret = start;
|
||||||
} else {
|
} 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;
|
new_entry->length = (entry->baseaddr + entry->length) - new_entry->baseaddr;
|
||||||
/* Shrink the existing entry and total available memory */
|
/* Shrink the existing entry and total available memory */
|
||||||
entry->length -= new_entry->length;
|
entry->length -= new_entry->length;
|
||||||
hv_mem_range.total_mem_size -= new_entry->length;
|
|
||||||
hv_e820_entries_nr++;
|
hv_e820_entries_nr++;
|
||||||
|
|
||||||
ret = new_entry->baseaddr;
|
ret = new_entry->baseaddr;
|
||||||
@ -159,8 +129,6 @@ void init_e820(void)
|
|||||||
dev_dbg(DBG_LEVEL_E820, "Base: 0x%016lx length: 0x%016lx\n",
|
dev_dbg(DBG_LEVEL_E820, "Base: 0x%016lx length: 0x%016lx\n",
|
||||||
mmap[i].baseaddr, mmap[i].length);
|
mmap[i].baseaddr, mmap[i].length);
|
||||||
}
|
}
|
||||||
|
|
||||||
obtain_mem_range_info();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t get_e820_entries_count(void)
|
uint32_t get_e820_entries_count(void)
|
||||||
@ -172,8 +140,3 @@ const struct e820_entry *get_e820_entry(void)
|
|||||||
{
|
{
|
||||||
return hv_e820;
|
return hv_e820;
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct mem_range *get_mem_range_info(void)
|
|
||||||
{
|
|
||||||
return &hv_mem_range;
|
|
||||||
}
|
|
||||||
|
@ -44,7 +44,4 @@ uint32_t get_e820_entries_count(void);
|
|||||||
/* get the e802 entiries */
|
/* get the e802 entiries */
|
||||||
const struct e820_entry *get_e820_entry(void);
|
const struct e820_entry *get_e820_entry(void);
|
||||||
|
|
||||||
/* get the e820 total memory info */
|
|
||||||
const struct mem_range *get_mem_range_info(void);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user