Skip to content

Commit 31cdf8c

Browse files
Shawnshhlijinxia
authored andcommitted
HV:transfer page_table_type type
struct map_params's member page_table_type is enum _page_table_type, transferred it. Signed-off-by: Huihuang Shi <huihuang.shi@intel.com> Reviewed-by: Junjie Mao <junjie.mao@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
1 parent b67836f commit 31cdf8c

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

hypervisor/arch/x86/mmu.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ void invept(struct vcpu *vcpu)
190190
_invept(INVEPT_TYPE_ALL_CONTEXTS, desc);
191191
}
192192

193-
bool check_mmu_1gb_support(int page_table_type)
193+
bool check_mmu_1gb_support(enum _page_table_type page_table_type)
194194
{
195195
bool status = false;
196196

@@ -201,7 +201,8 @@ bool check_mmu_1gb_support(int page_table_type)
201201
return status;
202202
}
203203

204-
static inline uint32_t check_page_table_present(int page_table_type,
204+
static inline uint32_t
205+
check_page_table_present(enum _page_table_type page_table_type,
205206
uint64_t table_entry)
206207
{
207208
if (page_table_type == PTT_EPT) {
@@ -227,7 +228,8 @@ static inline uint32_t check_page_table_present(int page_table_type,
227228

228229
static uint32_t map_mem_region(void *vaddr, void *paddr,
229230
void *table_base, uint64_t attr, uint32_t table_level,
230-
int table_type, enum mem_map_request_type request_type)
231+
enum _page_table_type table_type,
232+
enum mem_map_request_type request_type)
231233
{
232234
uint64_t table_entry;
233235
uint32_t table_offset;

hypervisor/include/arch/x86/mmu.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,15 @@
213213
#define ROUND_PAGE_UP(addr) (((addr) + CPU_PAGE_SIZE - 1) & CPU_PAGE_MASK)
214214
#define ROUND_PAGE_DOWN(addr) ((addr) & CPU_PAGE_MASK)
215215

216+
enum _page_table_type {
217+
PTT_HOST = 0, /* Mapping for hypervisor */
218+
PTT_EPT = 1,
219+
PAGETABLE_TYPE_UNKNOWN,
220+
};
221+
216222
struct map_params {
217223
/* enum _page_table_type: HOST or EPT*/
218-
int page_table_type;
224+
enum _page_table_type page_table_type;
219225
/* used HVA->HPA for HOST, used GPA->HPA for EPT */
220226
void *pml4_base;
221227
/* used HPA->HVA for HOST, used HPA->GPA for EPT */
@@ -230,12 +236,6 @@ struct entry_params {
230236
uint64_t page_size;
231237
};
232238

233-
enum _page_table_type {
234-
PTT_HOST = 0, /* Mapping for hypervisor */
235-
PTT_EPT = 1,
236-
PAGETABLE_TYPE_UNKNOWN,
237-
};
238-
239239
/* Represent the 4 levels of translation tables in IA-32e paging mode */
240240
enum _page_table_level {
241241
IA32E_PML4 = 0,
@@ -284,7 +284,7 @@ struct mem_io_node {
284284
};
285285

286286
uint64_t get_paging_pml4(void);
287-
bool check_mmu_1gb_support(int page_table_type);
287+
bool check_mmu_1gb_support(enum _page_table_type page_table_type);
288288
void *alloc_paging_struct(void);
289289
void free_paging_struct(void *ptr);
290290
void enable_paging(uint64_t pml4_base_addr);

0 commit comments

Comments
 (0)