hv: riscv: initialize service vm vfdt

Initialize Service VM vFDT by reserving hypervisor and pre-launched VM
memory regions.

The vFDT is copied to Service VM to the place just before the kernel
load address, and this needs to be fixed later when MMU module is
implemented.

Tracked-On: #8841
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
This commit is contained in:
Yifan Liu
2025-10-06 14:10:47 +00:00
committed by acrnsi-robot
parent b02903e6dd
commit 7bcb81314f
8 changed files with 99 additions and 0 deletions

View File

@@ -23,6 +23,7 @@
#include <dm/vrtc.h>
#include <spinlock.h>
#include <vm_config.h>
#include <fdt_api.h>
#include <asm/guest/vm.h>
#include <vcpu.h>
@@ -100,6 +101,8 @@ struct acrn_vm {
void *root_stg2ptp;
struct pgtable stg2_pgtable;
spinlock_t stg2pt_lock; /* Spin-lock used to protect stg2pt to add/modify/remove for a VM */
uint8_t fdt_raw[MAX_FDT_SIZE] __aligned(8);
} __aligned(PAGE_SIZE);
/*

View File

@@ -12,4 +12,11 @@
*/
#define VIRT_FDT_LOAD_ADDR 0x80200000UL
void init_service_vm_vfdt(struct acrn_vm *vm);
void arch_init_service_vm_vfdt(struct acrn_vm *vm);
static inline void *vm_get_vfdt(struct acrn_vm *vm) {
return (void *)vm->fdt_raw;
}
#endif /* VFDT_H */