HV: Add flush_address_space API.

flush_address_space is used to flush address space by clflushopt instruction.

Signed-off-by: Jack Ren <jack.ren@intel.com>
Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Reviewed-by: Li, Fei1 <fei1.li@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Yuan Liu
2019-06-13 18:03:53 +08:00
committed by ACRN System Integration
parent 6fd397e82b
commit f81585eb3d
2 changed files with 25 additions and 0 deletions

View File

@@ -294,3 +294,16 @@ void init_paging(void)
/* set ptep in sanitized_page point to itself */
sanitize_pte((uint64_t *)sanitized_page);
}
/*
* @pre: addr != NULL && size != 0
*/
void flush_address_space(void *addr, uint64_t size)
{
uint64_t n = 0UL;
while (n < size) {
clflushopt((char *)addr + n);
n += CACHE_LINE_SIZE;
}
}