mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-11-12 16:33:13 +00:00
hv: multiarch: replace memset with sanitize_pte
for x86, when using a new page to set up page table, sanitize to specific hpa page address is needed, however, for other arch, sanitized to 0 is fine. To avoid duplicate memory setting at the time of alloc_page and sanitize pte, replace memset in alloc_page with sanitized pte operation. Tracked-On: #8831 Signed-off-by: hangliu1 <hang1.liu@intel.com> Reviewed-by: Fei Li <fei1.li@intel.com> Acked-by: Wang, Yu1 <yu1.wang@intel.com>
This commit is contained in:
@@ -54,7 +54,7 @@ struct page *alloc_page(struct page_pool *pool)
|
||||
*/
|
||||
panic("no dummy aviable!");
|
||||
}
|
||||
(void)memset(page, 0U, PAGE_SIZE);
|
||||
sanitize_pte((uint64_t *)page, NULL);
|
||||
return page;
|
||||
}
|
||||
|
||||
@@ -621,7 +621,6 @@ void pgtable_add_map(uint64_t *pgtl3_page, uint64_t paddr_base, uint64_t vaddr_b
|
||||
void *pgtable_create_root(const struct pgtable *table)
|
||||
{
|
||||
uint64_t *page = (uint64_t *)alloc_page(table->pool);
|
||||
sanitize_pte(page, table);
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +92,8 @@ static inline uint64_t get_pgentry(const uint64_t *pte)
|
||||
static inline void set_pgentry(uint64_t *ptep, uint64_t pte, const struct pgtable *table)
|
||||
{
|
||||
*ptep = pte;
|
||||
table->flush_cache_pagewalk(ptep);
|
||||
if (table && table->flush_cache_pagewalk)
|
||||
table->flush_cache_pagewalk(ptep);
|
||||
}
|
||||
|
||||
void init_page_pool(struct page_pool *pool, uint64_t *page_base,
|
||||
|
||||
Reference in New Issue
Block a user