hv: pgtable: rename 'struct memory_ops' to 'struct pgtable'

The fields and APIs in old 'struct memory_ops' are used to add/modify/delete
page table (page or entry). So rename 'struct memory_ops' to 'struct pgtable'.

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:
Li Fei1
2021-03-08 14:13:16 +08:00
committed by wenlingz
parent ef98fa69ce
commit 768e483cd2
10 changed files with 118 additions and 118 deletions

View File

@@ -108,7 +108,7 @@ struct vm_arch {
*/
void *sworld_eptp;
void *sworld_memory_base_hva;
struct memory_ops ept_mem_ops;
struct pgtable ept_pgtable;
struct acrn_vioapics vioapics; /* Virtual IOAPIC/s */
struct acrn_vpic vpic; /* Virtual PIC */

View File

@@ -81,8 +81,8 @@ static inline uint64_t round_pde_down(uint64_t val)
#define PAGE_SIZE_2M MEM_2M
#define PAGE_SIZE_1G MEM_1G
void sanitize_pte_entry(uint64_t *ptep, const struct memory_ops *mem_ops);
void sanitize_pte(uint64_t *pt_page, const struct memory_ops *mem_ops);
void sanitize_pte_entry(uint64_t *ptep, const struct pgtable *table);
void sanitize_pte(uint64_t *pt_page, const struct pgtable *table);
/**
* @brief MMU paging enable
*
@@ -110,9 +110,9 @@ void enable_smap(void);
*/
void init_paging(void);
void mmu_add(uint64_t *pml4_page, uint64_t paddr_base, uint64_t vaddr_base,
uint64_t size, uint64_t prot, const struct memory_ops *mem_ops);
uint64_t size, uint64_t prot, const struct pgtable *table);
void mmu_modify_or_del(uint64_t *pml4_page, uint64_t vaddr_base, uint64_t size,
uint64_t prot_set, uint64_t prot_clr, const struct memory_ops *mem_ops, uint32_t type);
uint64_t prot_set, uint64_t prot_clr, const struct pgtable *table, uint32_t type);
void ppt_clear_user_bit(uint64_t base, uint64_t size);
void ppt_set_nx_bit(uint64_t base, uint64_t size, bool add);

View File

@@ -66,7 +66,7 @@ struct page_pool {
struct page *dummy_page;
};
struct memory_ops {
struct pgtable {
uint64_t default_access_right;
struct page_pool *pool;
bool (*large_page_support)(enum _page_table_level level, uint64_t prot);
@@ -76,8 +76,8 @@ struct memory_ops {
void (*recover_exe_right)(uint64_t *entry);
};
extern const struct memory_ops ppt_mem_ops;
void init_ept_mem_ops(struct memory_ops *mem_ops, uint16_t vm_id);
extern const struct pgtable ppt_pgtable;
void init_ept_pgtable(struct pgtable *table, uint16_t vm_id);
struct page *alloc_page(struct page_pool *pool);
void free_page(struct page_pool *pool, struct page *page);
void *get_reserve_sworld_memory_base(void);

View File

@@ -255,10 +255,10 @@ static inline uint64_t get_pgentry(const uint64_t *pte)
/*
* pgentry may means pml4e/pdpte/pde/pte
*/
static inline void set_pgentry(uint64_t *ptep, uint64_t pte, const struct memory_ops *mem_ops)
static inline void set_pgentry(uint64_t *ptep, uint64_t pte, const struct pgtable *table)
{
*ptep = pte;
mem_ops->clflush_pagewalk(ptep);
table->clflush_pagewalk(ptep);
}
static inline uint64_t pde_large(uint64_t pde)
@@ -275,7 +275,7 @@ static inline uint64_t pdpte_large(uint64_t pdpte)
*@pre (pml4_page != NULL) && (pg_size != NULL)
*/
const uint64_t *lookup_address(uint64_t *pml4_page, uint64_t addr,
uint64_t *pg_size, const struct memory_ops *mem_ops);
uint64_t *pg_size, const struct pgtable *table);
/**
* @}