Commit Graph

8476 Commits

Author SHA1 Message Date
Shiqing Gao
672093a940 hv: multi-arch: include common IRQ header instead of arch-specific one
Include the common IRQ header rather than the arch-specific version.
This follows the style we defined for multi-arch development.

Remaining RISC-V related files will be updated in later patches when
integration with the common IRQ framework is implemented.

Tracked-On: #8845
Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-11-05 15:14:41 +08:00
Shiqing Gao
d943af7f2d hv: multi-arch: move NR_IRQS definition to arch-specific headers
Move NR_IRQS from the common header to arch-specific headers since its
value differs between architectures.
 - On x86, it is 256.
 - On RISC-V, it includes both CPU interrupts and external interrupts
   (from PLIC, APLIC, etc.).

Tracked-On: #8845
Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-11-05 15:14:41 +08:00
Shiqing Gao
ec88134829 hv: multi-arch: move and rename arch-specific IRQ functions
Move the declarations of arch-specific IRQ functions from their
arch-specific headers into the common header file.

Also rename these functions from xxx_arch() to arch_xxx() for better
naming consistency across architectures.

This change follows the style defined for multi-arch development.

Tracked-On: #8845
Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-11-05 15:14:41 +08:00
Wei6 Zhang
b919e3d155 misc: add the SBI uart type for RISC-V
Tracked-On: #8842
Signed-off-by: Wei6 Zhang <wei6.zhang@intel.com>
2025-11-04 14:44:49 +08:00
Yifan Liu
ff4ef41ac2 misc: Specify raw image address for qemu-riscv
On QEMU with 8GB RAM size.

Tracked-On: #8838
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-11-04 10:59:30 +08:00
Yifan Liu
6d8274aa83 misc: Add bare boot configuration to qemu-riscv scenario
Tracked-On: #8838
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-11-04 10:59:30 +08:00
Yifan Liu
a18b953ee8 hv: bugfix: Add missing parameter in print
Tracked-On: #8838
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-11-04 10:59:30 +08:00
Yifan Liu
0230069811 hv: riscv: bugfix: missing sstatus in thread context
This patch fixes two bugs. The reason for writing them
into one commit is that they are related and the fixes
change the same places.

The first bug:
The size of struct stack_frame is 0x78, not 0x80, but
the save/restore assembly routine allocates/deallocates
the size of stack frame by 0x80.

The vcpu thread stack is initialized by allocating
sizeof(struct stack_frame) from the top of the stack
and put initial values there (arch_build_stack_frame).

The vcpu thread stack will underflow at the first
time this thread gets scheduled. So the fix is to change
the 0x80 to 0x78 in save/restore routine.

The second bug:
Save/restore routine needs to capture sstatus, as different
threads might have different interrupt enabling settings.
For example, vcpu threads always get scheduled out when the
interrupts are disabled, but idle thread needs to have the
interrupts enabled. So sstatus needs to be saved/restored.
The fix is to add a new member sstatus in struct stack_frame.

Adding a new member in struct stack_frame boost the size
of struct stack_frame to 0x80, which in this case the fix
of the first bug is no longer needed.

Tracked-On: #8838
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-11-04 10:59:30 +08:00
Yifan Liu
af28e2bca1 hv: riscv: Replace old macro csr read with inline functions
There are two reasons to use inline functions and numbered-CSR
instead of simply string concat.
1, With old style, CSR names have to be written in lower cases
and cannot prefix anything. This sometimes causes confusion with
variables. For example, csr_write(sstatus, sstatus). Changing to
inline function with MACROs can reduce confusion:
   csr_write(CSR_SSTATUS, sstatus)
2, Using number macros allows us to manage CSRs in a more organized
way. We can now put CSR names in variables or arrays and access them
using variables instead of just string names.

Tracked-On: #8838
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-11-04 10:59:30 +08:00
Yifan Liu
59cd872858 hv: riscv: Add CSR operation functions and CSR macros
Adds csr read/write/set/clear/read_set/read_clear/swap utilities.

Also adds definitions for CSRs.

Tracked-On: #8838
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-11-04 10:59:30 +08:00
Yifan Liu
f8f57328b6 hv: vboot: init fdt module for pre-launched VM
Pre-launched VM needs to load pre-compiled FDT binary (which is the same
when it needs pre-compiled ACPI binary).

Tracked-On: #8838
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-11-04 10:59:30 +08:00
Yifan Liu
b5098f8f25 hv/misc: Add support for pre-launched VM FDT import
Just as we accept pre-compiled ACPI binary for pre-launched VM, this
commit adds support for pre-launched VM to accept pre-compiled FDT
binary with default tag FDT_VMx, where x is the VM id.

Tracked-On: #8838
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-11-04 10:59:30 +08:00
Yifan Liu
834a1f8b97 hv/misc: boot: Add bare boot protocol
Bare boot protocol is a protocol to be used when there are no protocols
(such as multiboot1/2) are available: ACRN have no way to know where its
modules are being loaded, how large they are, and what are their command
line arguments.

Bare boot protocol allows you to pre-configure (hard-code) modules' address and
sizes. ACRN will find modules based on the pre-configured information
without the need of a bootloader passing information to it.

Tracked-On: #8838
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-11-04 10:59:30 +08:00
Yifan Liu
a82c08849e hv: fdt: Save and sanity check fdt
Saves physical FDT and do basic sanity checking.

Tracked-On: #8838
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-11-04 10:59:30 +08:00
Yifan Liu
66f896d40b hv: lib: Import libfdt
Import libfdt (BSD-2-Clause) into ACRN hypervisor library.

Tracked-On: #8838
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-11-04 10:59:30 +08:00
Yifan Liu
390db422d8 hv: lib: Add several missing standard string/memory APIs
Integrating libfdt requires the presence of these APIs.

Tracked-On: #8838
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-11-04 10:59:30 +08:00
Yifan Liu
ac7e07e01b misc: Add CONFIG_FDT_PARSE_ENABLED option
This option controls whether runtime FDT parsing
is enabled. If off, hypervisor needs to use static configuration
information from config-tool.

Tracked-On: #8838
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-11-04 10:59:30 +08:00
Yifan Liu
8d7aaf67f8 doc: Adjust doxyfile and rst file based on multi-arch change
Some inputs and references need to change accordingly.

Tracked-On: #8830
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
2025-10-30 13:30:32 +08:00
Yifan Liu
0e333ca422 hv: riscv: Add skeleton vcpu and vm to enable RISC-V build
This commit also removes dummy files added in early development stage.

Tracked-On: #8830
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Reviewed-by: Fei Li <fei1.li@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-10-30 13:30:32 +08:00
Yifan Liu
5fcfa7e2fd [FIXME] hv: riscv: Add dummy guest memory implementation
Besides implementing copy_from/to_gpa, this commit also wraps a dummy
commit in mmu.c that exposes API of adding hv mmu mapping.

Tracked-On: #8830
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Reviewed-by: Fei Li <fei1.li@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-10-30 13:30:32 +08:00
Yifan Liu
d4e56e84f2 hv: seed: Conditionally expose seed module in vboot
We may not need this for every architecture. Conditionally
wraps it.

Tracked-On: #8830
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-10-30 13:30:32 +08:00
Yifan Liu
53f268d8ac misc: board_config multiarchitecture
This commit sets up basic multi-architecture framework for board config
module so that board configuration headers/C files can be generated
per-architecture.

Tracked-On: #8830
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Reviewed-by: Fei Li <fei1.li@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-10-30 13:30:32 +08:00
Yifan Liu
437dac74f6 hv: mmu: Move MEM_xx definition to common mmu.h
Tracked-On: #8830
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Reviewed-by: Fei, Li <fei1.li@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-10-30 13:30:32 +08:00
Yifan Liu
e930c77af9 hv: vboot: Move vboot init to common scope
Currently for risc-v, only rawimage loader is supported. Change other
loaders later.

Tracked-On: #8830
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Reviewed-by: Fei Li <fei1.li@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-10-30 13:30:32 +08:00
Yifan Liu
a3f20d8417 hv: move event.c to common makefile
Can be moved without content change.

Tracked-On: #8830
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Reviewed-by: Fei Li <fei1.li@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-10-30 13:30:32 +08:00
Yifan Liu
0db8c93506 hv: guest_memory: Move guest_memory header to common scope
This header can be moved directly to common scope without logic change.

Tracked-On: #8830
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Reviewed-by: Fei Li <fei1.li@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-10-30 13:30:32 +08:00
Yifan Liu
61afe9e51a hv: vm_load: move vcpu register init to arch_vm_prepare_bsp
For service and pre-launched VMs, the image loaders in ACRN
are functioning the same way as an in-guest bootloader such
as GRUB, which allows ACRN to load a guest image and start
directly from there and therefore skipping the firmware
initialization stage.

To re-use image loader code as much as possible, the image loader
logic is splitted into two stages, the loading stage and
environmental preparation stage. Most part of the loading stage
are common logic, and environmental preparation stage should
be completely arch-specific.

The best place for stage two loader logic is arch_vm_prepare_bsp,
which prepares vcpu register states based on the loaded image
(entry point, load address, etc.).

This commit refactors only the rawimage loader. Other loaders
are left for future improvement.

Tracked-On: #8830
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Reviewed-by: Fei Li <fei1.li@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-10-30 13:30:32 +08:00
Yifan Liu
bbf2dec9b8 hv: vm_load: Move rip setting to arch_vm_prepare_bsp
prepare_os_image should not touch vcpu internal state.
Move this operation to arch_vm_prepare_bsp.

Since arch_vm_prepare_bsp now changes vcpu registers,
this action also affects the logic of resume_vm_from_s3.

Refactor resume_vm_from_s3 to avoid direct call to
start_vm.

Tracked-On: #8830
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Reviewed-by: Fei Li <fei1.li@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-10-30 13:30:32 +08:00
Yifan Liu
43a09e86a7 hv: host_pm: Move two common APIs to common scope
Move shutdown_system to common (and rename to shutdown_host)
Move reset_host to common

Tracked-On: #8830
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Reviewed-by: Fei Li <fei1.li@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-10-30 13:30:32 +08:00
Yifan Liu
4e888b0378 hv/misc: vm_config: vm_config abstraction
Move vm_config to common scope. This change also affects auto-generated
C/H files from configuration tools.

Tracked-On: #8830
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Reviewed-by: Fei Li <fei1.li@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-10-30 13:30:32 +08:00
Yifan Liu
127c2074a0 hv: vm: Move some common helpers to common scope
No logic change. Only movement.

Tracked-On: #8830
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Reviewed-by: Fei Li <fei1.li@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-10-30 13:30:32 +08:00
Yifan Liu
a4f136188c hv: vm: Move reset_vm to common scope
Move reset_vm to common scope and remove unused reset_mode.

The reset_mode in x86 reset_vm code is simply used as an if condition
on whether the prepare_os_image should be executed. The entire
if body will never be true as we don't support resetting Service VM
without resetting ACRN hypervisor. To reset Service VM, the only
way is through a platform reset. Therefore the prepare_os_image
action will never be called. Delete this action.

Once the if condition and prepare_os_image action is deleted,
the input parameter "mode" is useless. Delete that too. The reset_vm
API in ACRN is simply a "warm reset". It does not need to take
input.

Tracked-On: #8830
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Reviewed-by: Fei Li <fei1.li@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-10-30 13:30:32 +08:00
Yifan Liu
e0130295b5 hv: vm: Move shutdown_vm to common scope
The shutdown_vm is renamed to destroy_vm,
and introduce arch_deinit_vm as mandatory arch public API.

The original shutdown_vm checks if all VMs are shutting down,
and shutdown platform if no other VMs are running.

This logic is moved to the caller of original shutdown_vm
except hypercall, as we post-launched VM shutdown should not
trigger platform shutdown.

Tracked-On: #8830
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Reviewed-by: Fei Li <fei1.li@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-10-30 13:30:32 +08:00
Yifan Liu
6ed46a696d hv: vm: Move pause_vm to common scope
Tracked-On: #8830
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Reviewed-by: Fei, Li <fei1.li@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-10-30 13:30:32 +08:00
Yifan Liu
8cb6d01810 hv: vm: Move start_vm to common scope
start_vm is moved to common scope calling
arch_vm_start_bsp, which is a mandatory API
for all archs.

Tracked-On: #8830
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Reviewed-by: Fei Li <fei1.li@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-10-30 13:30:32 +08:00
Yifan Liu
da6ab1cab7 hv: vm: Add is_prelaunched_vm check in security_vm_fixup
This is to make sure that only Prelaunched VM gets this fixup.

Tracked-On: #8830
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-10-30 13:30:32 +08:00
Yifan Liu
3ebedf7539 hv: vm: Get rid of prepare_vm
The logic in prepare_vm can be embedded to launch_vms
and create_vm with better readability.

The movement does not change original logic.

Tracked-On: #8830
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Reviewed-by: Li Fei <fei1.li@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-10-30 13:30:32 +08:00
Yifan Liu
6a4ba8116c hv: vm: Move launch_vms and create_vm to common scope
launch_vms and create_vm need to be moved together as both of
them reference file-static structures. All related structures
and helpers accessing structures are also moved.

Tracked-On: #8830
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Reviewed-by: Li Fei <fei1.li@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-10-30 13:30:32 +08:00
Yifan Liu
81b78d0464 hv: vcpu: Move kick_vcpu and vcpu_make_request to common scope
Adjust kick_vcpu logic and move to common scope.
Moves also vcpu_make_request to common scope and adds
vcpu_has_pending_request and vcpu_take_request helpers.

Tracked-On: #8830
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Reviewed-by: Li Fei <fei1.li@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-10-30 13:30:32 +08:00
Yifan Liu
c86fa2e2e2 hv: vcpu: Move some helpers to common vcpu.c
Some arch-independent helpers can be moved to common vcpu.c.

Tracked-On: #8830
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Reviewed-by: Li Fei <fei1.li@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-10-30 13:30:32 +08:00
Yifan Liu
c526809125 hv: vcpu: Move zombie_vcpu to common scope
Remove the extraneous new_state argument.

Tracked-On: #8830
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Reviewed-by: Fei Li <fei1.li@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-10-30 13:30:32 +08:00
Yifan Liu
a870bac7f8 hv: vcpu: Move reset_vcpu to common scope
Move reset_vcpu to common. Original x86 reset_vcpu
takes an extra parameter to handle both reset and init reset.

Common API hides this detail and let arch specific code handle
this.

This patch also renames x86 specific vcpu_reset_internal to
x86_vcpu_reset_internal.

Tracked-On: #8830
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Reviewed-by: Fei Li <fei1.li@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-10-30 13:30:32 +08:00
Yifan Liu
1a5bc2aae1 hv: vcpu: Move launch_vcpu to common scope
Tracked-On: #8830
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Reviewed-by: Fei Li <fei1.li@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-10-30 13:30:32 +08:00
Yifan Liu
62d07897e2 hv: vcpu: Move offline_vcpu to common vcpu.c and rename to destroy_vcpu
destroy_vcpu: Call arch_deinit_vcpu, and do common deinit.

Tracked-On: #8830
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Reviewed-by: Fei Li <fei1.li@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-10-30 13:30:32 +08:00
Yifan Liu
70bcf024da hv: vcpu: Move vcpu_set_state to common scope
Movement only.

Tracked-On: #8830
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-10-30 13:30:32 +08:00
Yifan Liu
223ccc5711 hv: x86: Move update_vm_vlapic_state out of vcpu_set_state
vlapic state updating basically updates a per-VM variable of
vlapic mode. vlapic mode updating should NOT happen with each
and every vcpu state update. Consider the case where a VM has
all vcpus except the last one being X2APIC, and the last one
is in the process of transitioning to X2APIC. When HV is emulating
the transitioning, request processing fails and we zombie this
vcpu. This causes the vlapic_mode to be incorrectly set to
X2APIC.

vlapic mode updating should be confined to the following cases:
1, when guest changes APIC mode
2, when guest receives SIPI/INIT

Here we also prove that the logic is correct/equivalent as before.

update_vm_vlapic_state is called in vcpu state transitioning functions:
offline_vcpu, zombie_vcpu, reset_vcpu, launch_vcpu.

launch_vcpu:
launch_vcpu is called in two places. vBSP launch and vAP launch.
vBSP launch does not need to update vlapic state as by default
vm->arch_vm.vlapic_mode is set to XAPIC_MODE (set in create_vm).
vAP launch is handled by this patch.

reset_vcpu:
reset_vcpu is called in two places. INIT_RESET and VM reset.
INIT_RESET is handled in this patch. VM reset does not need to
update_vm_vlapic_state as we manually set this to default XAPIC
in reset_vm.

zombie_vcpu:
As stated above, zombie_vcpu should NOT change vlapic mode, as
the action of zombie_vcpu is transparent to guest. It is only called
to pause vcpu thread.

offline_vcpu:
Offline_vcpu is called in two places: shutdown_vm and hypercall to
offline Service VM vcpus. In the first case it doesn't matter as
VM is being destroyed. In the second case, Service VM is already
in one of XAPIC or X2APIC mode, and offlining vcpus does not change
this mode (therefore not needed).

Tracked-On: #8830
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-10-30 13:30:32 +08:00
Yifan Liu
134c5f6ab7 hv: vcpu: Move create_vcpu to common vcpu.c
Move vcpu API create_vcpu to common.

* Break create_vcpu into common vcpu init and arch_init_vcpu
  for arch-specific initialization.
* Move vcpu_thread to arch-specific and rename to arch_vcpu_thread

Tracked-On: #8830
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Reviewed-by: Fei Li <fei1.li@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-10-30 13:30:32 +08:00
Yifan Liu
688741074f hv: vm: Move vm common parts under common/vm.h (data structure)
This commit moves struct acrn_vm under common header vm.h, and move some
x86-specific members of struct acrn_vm into arch_vm. This commit focuses
on struct cleanup only. API cleanup will be in future patch series.

The affected members are:
e820_entry_num
e820_entries
wire_mode
wbinvd_lock
vlapic_mode_lock
vcpuid_entry_nr
vcpuid_level
vcpuid_xlevel
vcpuid_entries
reset_control
pm
sworld_control
sworld_snapshot
intr_inject_delay_delta

Moved to common vm.h:
ept_lock -> rename to stg2pt_lock
ept_pgtable -> rename to stg2_pgtable
nworld_eptp -> rename to root_stg2ptp
emul_mmio_lock
nr_emul_mmio_regions
emul_mmio
emul_pio

To avoid circular dependency, some in-header helpers are also moved into
common vm.h.

Tracked-On: #8830
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Reviewed-by: Fei Li <fei1.li@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-10-30 13:30:32 +08:00
Yifan Liu
cf91e66ac0 hv: vcpu: Move vcpu common parts under common/vcpu.h (data structure)
This commit cleans up struct acrn_vcpu. vcpu API cleanup will be in
future patch series.

Create a common vcpu.h hosting struct acrn_vcpu, and move some x86
specific members of struct acrn_vcpu into struct acrn_vcpu_arch. These
members includes:

reg_cached
reg_updated
inst_ctxt

And pending_req is being moved from arch to common.

And the maximum number of events (i.e., VCPU_EVENT_NUM) are being
replaced by MAX_VCPU_EVENT_NUM.

To avoid circular dependency, some in-header helpers are moved into
vcpu.c with only prototypes being declared inside header.

Tracked-On: #8830
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Reviewed-by: Fei Li <fei1.li@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-10-30 13:30:32 +08:00
Yifan Liu
dca091fd90 misc: Fix FutureWarning on incorrect search ignoring root
Fix those annoying warnings.

Tracked-On: #8830
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
2025-10-30 13:30:32 +08:00