hv: multiarch: add hva2hpa_early/hpa2hva_early to common

Add arch_hva2hpa_early/arch_hpa2hva_early to common, and wrap it in
hva2hpa_early/hpa2hva_early.

Tracked-On: #8831
Signed-off-by: hangliu1 <hang1.liu@intel.com>
Reviewed-by: Liu, Yifan1 <yifan1.liu@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
This commit is contained in:
hangliu1
2025-10-16 14:21:29 +08:00
committed by acrnsi-robot
parent 8615271e45
commit cbab9cbab8
7 changed files with 77 additions and 66 deletions

View File

@@ -8,21 +8,6 @@
#include <asm/page.h>
/* FIXME: Temporary RISC-V build workaround
* This file provides hva2hpa[_early] and hpa2hva[_early] function stubs to
* satisfy existing code dependencies. Remove this file and migrate to the
* common pgtable.h implementation once the MMU module is properly integrated.
*/
static inline void *hpa2hva_early(uint64_t x)
{
return (void *)x;
}
static inline uint64_t hva2hpa_early(void *x)
{
return (uint64_t)x;
}
#define SATP_MODE_SV48 0x9000000000000000UL
#define SATP_PPN_MASK 0x00000FFFFFFFFFFFUL

View File

@@ -144,55 +144,7 @@
#define EPT_ENTRY_PFN_MASK ((~EPT_PFN_HIGH_MASK) & PAGE_MASK)
/**
* @brief Translate a host physical address to a host virtual address before paging mode enabled.
*
* This function is used to translate a host physical address to a host virtual address before paging mode enabled. HPA
* is 1:1 mapping to HVA.
*
* It returns the host virtual address that corresponds to the given host physical address.
*
* @param[in] x The host physical address
*
* @return The translated host virtual address
*
* @retval NULL if x == 0
*
* @pre N/A
*
* @post N/A
*
* @remark This function is used before paging mode enabled.
*/
static inline void *hpa2hva_early(uint64_t x)
{
return (void *)x;
}
/**
* @brief Translate a host virtual address to a host physical address before paging mode enabled.
*
* This function is used to translate a host virtual address to a host physical address before paging mode enabled. HVA
* is 1:1 mapping to HPA.
*
* It returns the host physical address that corresponds to the given host virtual address.
*
* @param[in] x The host virtual address to be translated
*
* @return The translated host physical address
*
* @retval 0 if x == NULL
*
* @pre N/A
*
* @post N/A
*
* @remark This function is used before paging mode enabled.
*/
static inline uint64_t hva2hpa_early(void *x)
{
return (uint64_t)x;
}
#define HAS_EARLY_MAP
#endif /* PGTABLE_H */