Files
acrn-hypervisor/hypervisor/arch/riscv/pgtable.c
hangliu1 cbab9cbab8 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>
2025-10-21 14:14:55 +08:00

32 lines
681 B
C

/*
* Copyright (C) 2023-2025 Intel Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#include <pgtable.h>
uint64_t arch_pgtl_large(uint64_t pgtle)
{
return (pgtle & PAGE_V) && ((pgtle & PAGE_TYPE_MASK) != PAGE_TYPE_TABLE);
}
uint64_t arch_pgtl_page_paddr(uint64_t pgtle)
{
uint64_t base = (pgtle & PTE_PFN_MASK) >> PAGE_BASE_OFFSET;
return ((base << PTE_SHIFT) & PAGE_PFN_MASK);
}
void *arch_hpa2hva_early(uint64_t x)
{
/* ASSUMPTION: MMU is in bare mode or using identical mapping */
return (void *)x;
}
uint64_t arch_hva2hpa_early(void *x)
{
/* ASSUMPTION: MMU is in bare mode or using identical mapping */
return (uint64_t)x;
}