hv: define a MACRO to indicate maximum memory size
~0UL is widely used to specify the maximum memory size when calling e820_alloc_memory(), this patch to define a MACRO for it to avoid using this magic number. Tracked-On: #8502 Signed-off-by: Yonghua Huang <yonghua.huang@intel.com> Reviewed-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
parent
a4a73b5aac
commit
791019edc5
|
@ -86,7 +86,7 @@ static void reserve_ept_bitmap(void)
|
|||
bitmap_size = (get_ept_page_num() * CONFIG_MAX_VM_NUM) / 8;
|
||||
bitmap_offset = get_ept_page_num() / 8;
|
||||
|
||||
bitmap_base = e820_alloc_memory(bitmap_size, ~0UL);
|
||||
bitmap_base = e820_alloc_memory(bitmap_size, MEM_SIZE_MAX);
|
||||
set_paging_supervisor(bitmap_base, bitmap_size);
|
||||
|
||||
for(i = 0; i < CONFIG_MAX_VM_NUM; i++){
|
||||
|
@ -103,7 +103,7 @@ void reserve_buffer_for_ept_pages(void)
|
|||
uint16_t vm_id;
|
||||
uint32_t offset = 0U;
|
||||
|
||||
page_base = e820_alloc_memory(get_total_ept_4k_pages_size(), ~0UL);
|
||||
page_base = e820_alloc_memory(get_total_ept_4k_pages_size(), MEM_SIZE_MAX);
|
||||
set_paging_supervisor(page_base, get_total_ept_4k_pages_size());
|
||||
for (vm_id = 0U; vm_id < CONFIG_MAX_VM_NUM; vm_id++) {
|
||||
ept_pages[vm_id] = (struct page *)(void *)(page_base + offset);
|
||||
|
|
|
@ -51,12 +51,12 @@ static void init_vept_pool(void)
|
|||
{
|
||||
uint64_t page_base;
|
||||
|
||||
page_base = e820_alloc_memory(calc_sept_size(), ~0UL);
|
||||
page_base = e820_alloc_memory(calc_sept_size(), MEM_SIZE_MAX);
|
||||
|
||||
set_paging_supervisor(page_base, calc_sept_size());
|
||||
|
||||
sept_pages = (struct page *)page_base;
|
||||
sept_page_bitmap = (uint64_t*)e820_alloc_memory((calc_sept_page_num() / 64U), ~0UL);
|
||||
sept_page_bitmap = (uint64_t *)e820_alloc_memory((calc_sept_page_num() / 64U), MEM_SIZE_MAX);
|
||||
}
|
||||
|
||||
static bool is_present_ept_entry(uint64_t ept_entry)
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
#define E820_MAX_ENTRIES 64U
|
||||
|
||||
#define MEM_SIZE_MAX (~0UL)
|
||||
|
||||
/** Defines a single entry in an E820 memory map. */
|
||||
struct e820_entry {
|
||||
/** The base address of the memory range. */
|
||||
|
|
Loading…
Reference in New Issue