mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-23 17:58:30 +00:00
ACRN: hv: Unify terminology for service vm
Rename is_sos_vm to is_service_vm Tracked-On: #6744 Signed-off-by: Liu Long <longliu@intel.com>
This commit is contained in:
@@ -381,7 +381,7 @@ static struct ptirq_remapping_info *add_intx_remapping(struct acrn_vm *vm, uint3
|
||||
pr_err("INTX re-add vpin %d", virt_gsi);
|
||||
}
|
||||
} else if (entry->vm != vm) {
|
||||
if (is_sos_vm(entry->vm)) {
|
||||
if (is_service_vm(entry->vm)) {
|
||||
entry->vm = vm;
|
||||
entry->virt_sid.value = virt_sid.value;
|
||||
entry->polarity = 0U;
|
||||
@@ -700,7 +700,7 @@ int32_t ptirq_intx_pin_remap(struct acrn_vm *vm, uint32_t virt_gsi, enum intx_ct
|
||||
* Device Model should pre-hold the mapping entries by calling
|
||||
* ptirq_add_intx_remapping for UOS.
|
||||
*
|
||||
* For SOS(sos_vm), it adds the mapping entries at runtime, if the
|
||||
* For Service VM, it adds the mapping entries at runtime, if the
|
||||
* entry already be held by others, return error.
|
||||
*/
|
||||
|
||||
@@ -710,9 +710,9 @@ int32_t ptirq_intx_pin_remap(struct acrn_vm *vm, uint32_t virt_gsi, enum intx_ct
|
||||
spinlock_obtain(&ptdev_lock);
|
||||
entry = find_ptirq_entry(PTDEV_INTR_INTX, &virt_sid, vm);
|
||||
if (entry == NULL) {
|
||||
if (is_sos_vm(vm)) {
|
||||
if (is_service_vm(vm)) {
|
||||
|
||||
/* for sos_vm, there is chance of vpin source switch
|
||||
/* for Service VM, there is chance of vpin source switch
|
||||
* between vPIC & vIOAPIC for one legacy phys_pin.
|
||||
*
|
||||
* here checks if there is already mapping entry from
|
||||
|
@@ -16,7 +16,7 @@
|
||||
int32_t validate_pstate(const struct acrn_vm *vm, uint64_t perf_ctl)
|
||||
{
|
||||
/* Note:
|
||||
* 1. We don't validate Px request from SOS_VM for now;
|
||||
* 1. We don't validate Px request from Service VM for now;
|
||||
* 2. Px request will be rejected if no VM Px data is set, even guest is running intel_pstate driver;
|
||||
* 3. The Pstate frequency varies from LFM to HFM and then TFM, but not all frequencies between
|
||||
* LFM to TFM are mapped in ACPI table. For acpi-cpufreq driver, the target Px value in MSR
|
||||
@@ -27,7 +27,7 @@ int32_t validate_pstate(const struct acrn_vm *vm, uint64_t perf_ctl)
|
||||
*/
|
||||
int32_t ret = -1;
|
||||
|
||||
if (is_sos_vm(vm)) {
|
||||
if (is_service_vm(vm)) {
|
||||
ret = 0;
|
||||
} else {
|
||||
uint8_t px_cnt = vm->pm.px_cnt;
|
||||
@@ -157,11 +157,11 @@ static inline void enter_s5(struct acrn_vcpu *vcpu, uint32_t pm1a_cnt_val, uint3
|
||||
|
||||
get_vm_lock(vm);
|
||||
/*
|
||||
* Currently, we assume SOS has full ACPI power management stack.
|
||||
* That means the value from SOS should be saved and used to shut
|
||||
* Currently, we assume Service VM has full ACPI power management stack.
|
||||
* That means the value from Service VM should be saved and used to shut
|
||||
* down the system.
|
||||
*/
|
||||
if (is_sos_vm(vm)) {
|
||||
if (is_service_vm(vm)) {
|
||||
save_s5_reg_val(pm1a_cnt_val, pm1b_cnt_val);
|
||||
}
|
||||
pause_vm(vm);
|
||||
@@ -382,8 +382,8 @@ void init_guest_pm(struct acrn_vm *vm)
|
||||
|
||||
/*
|
||||
* In enter_s5(), it will call save_s5_reg_val() to initialize system_pm1a_cnt_val/system_pm1b_cnt_val when the
|
||||
* vm is SOS.
|
||||
* If there is no SOS, save_s5_reg_val() will not be called and these 2 variables will not be initialized properly
|
||||
* vm is Service VM.
|
||||
* If there is no Service VM, save_s5_reg_val() will not be called and these 2 variables will not be initialized properly
|
||||
* so shutdown_system() will fail, explicitly init here to avoid this
|
||||
*/
|
||||
save_s5_reg_val((sx_data->s5_pkg.val_pm1a << BIT_SLP_TYPx) | (1U << BIT_SLP_EN),
|
||||
@@ -391,7 +391,7 @@ void init_guest_pm(struct acrn_vm *vm)
|
||||
|
||||
vm_setup_cpu_state(vm);
|
||||
|
||||
if (is_sos_vm(vm)) {
|
||||
if (is_service_vm(vm)) {
|
||||
/* Load pm S state data */
|
||||
if (vm_load_pm_s_state(vm) == 0) {
|
||||
register_pm1ab_handler(vm);
|
||||
|
@@ -442,7 +442,7 @@ static int32_t set_vcpuid_extended_function(struct acrn_vm *vm)
|
||||
if (result == 0) {
|
||||
init_vcpuid_entry(0x40000001U, 0U, 0U, &entry);
|
||||
/* EAX: Guest capability flags (e.g. whether it is a privilege VM) */
|
||||
if (is_sos_vm(vm)) {
|
||||
if (is_service_vm(vm)) {
|
||||
entry.eax |= GUEST_CAPS_PRIVILEGE_VM;
|
||||
}
|
||||
#ifdef CONFIG_HYPERV_ENABLED
|
||||
|
@@ -2184,8 +2184,8 @@ void vlapic_create(struct acrn_vcpu *vcpu, uint16_t pcpu_id)
|
||||
if (is_vcpu_bsp(vcpu)) {
|
||||
uint64_t *pml4_page =
|
||||
(uint64_t *)vcpu->vm->arch_vm.nworld_eptp;
|
||||
/* only need unmap it from SOS as UOS never mapped it */
|
||||
if (is_sos_vm(vcpu->vm)) {
|
||||
/* only need unmap it from Service VM as User VM never mapped it */
|
||||
if (is_service_vm(vcpu->vm)) {
|
||||
ept_del_mr(vcpu->vm, pml4_page,
|
||||
DEFAULT_APIC_BASE, PAGE_SIZE);
|
||||
}
|
||||
|
@@ -94,7 +94,7 @@ bool is_paused_vm(const struct acrn_vm *vm)
|
||||
return (vm->state == VM_PAUSED);
|
||||
}
|
||||
|
||||
bool is_sos_vm(const struct acrn_vm *vm)
|
||||
bool is_service_vm(const struct acrn_vm *vm)
|
||||
{
|
||||
return (vm != NULL) && (get_vm_config(vm->vm_id)->load_order == SOS_VM);
|
||||
}
|
||||
@@ -210,7 +210,7 @@ bool vm_hide_mtrr(const struct acrn_vm *vm)
|
||||
*/
|
||||
static void setup_io_bitmap(struct acrn_vm *vm)
|
||||
{
|
||||
if (is_sos_vm(vm)) {
|
||||
if (is_service_vm(vm)) {
|
||||
(void)memset(vm->arch_vm.io_bitmap, 0x00U, PAGE_SIZE * 2U);
|
||||
} else {
|
||||
/* block all IO port access from Guest */
|
||||
@@ -393,7 +393,7 @@ static void deny_hv_owned_devices(struct acrn_vm *sos)
|
||||
* @retval 0 on success
|
||||
*
|
||||
* @pre vm != NULL
|
||||
* @pre is_sos_vm(vm) == true
|
||||
* @pre is_service_vm(vm) == true
|
||||
*/
|
||||
static void prepare_sos_vm_memmap(struct acrn_vm *vm)
|
||||
{
|
||||
@@ -547,8 +547,8 @@ int32_t create_vm(uint16_t vm_id, uint64_t pcpu_bitmap, struct acrn_vm_config *v
|
||||
(void)memcpy_s(&vm->uuid[0], sizeof(vm->uuid),
|
||||
&vm_config->uuid[0], sizeof(vm_config->uuid));
|
||||
|
||||
if (is_sos_vm(vm)) {
|
||||
/* Only for SOS_VM */
|
||||
if (is_service_vm(vm)) {
|
||||
/* Only for Service VM */
|
||||
create_sos_vm_e820(vm);
|
||||
prepare_sos_vm_memmap(vm);
|
||||
|
||||
@@ -610,7 +610,7 @@ int32_t create_vm(uint16_t vm_id, uint64_t pcpu_bitmap, struct acrn_vm_config *v
|
||||
vrtc_init(vm);
|
||||
}
|
||||
|
||||
if (is_sos_vm(vm)) {
|
||||
if (is_service_vm(vm)) {
|
||||
deny_hv_owned_devices(vm);
|
||||
}
|
||||
|
||||
@@ -763,7 +763,7 @@ int32_t shutdown_vm(struct acrn_vm *vm)
|
||||
/* Only allow shutdown paused vm */
|
||||
vm->state = VM_POWERED_OFF;
|
||||
|
||||
if (is_sos_vm(vm)) {
|
||||
if (is_service_vm(vm)) {
|
||||
sbuf_reset();
|
||||
}
|
||||
|
||||
@@ -841,7 +841,7 @@ int32_t reset_vm(struct acrn_vm *vm)
|
||||
*/
|
||||
vm->arch_vm.vlapic_mode = VM_VLAPIC_XAPIC;
|
||||
|
||||
if (is_sos_vm(vm)) {
|
||||
if (is_service_vm(vm)) {
|
||||
(void)prepare_os_image(vm);
|
||||
}
|
||||
|
||||
@@ -897,7 +897,7 @@ void pause_vm(struct acrn_vm *vm)
|
||||
* @wakeup_vec[in] The resume address of vm
|
||||
*
|
||||
* @pre vm != NULL
|
||||
* @pre is_sos_vm(vm) && vm->state == VM_PAUSED
|
||||
* @pre is_service_vm(vm) && vm->state == VM_PAUSED
|
||||
*/
|
||||
void resume_vm_from_s3(struct acrn_vm *vm, uint32_t wakeup_vec)
|
||||
{
|
||||
@@ -938,7 +938,7 @@ void prepare_vm(uint16_t vm_id, struct acrn_vm_config *vm_config)
|
||||
build_vrsdp(vm);
|
||||
}
|
||||
|
||||
if (is_sos_vm(vm)) {
|
||||
if (is_service_vm(vm)) {
|
||||
/* We need to ensure all modules of pre-launched VMs have been loaded already
|
||||
* before loading SOS VM modules, otherwise the module of pre-launched VMs could
|
||||
* be corrupted because SOS VM kernel might pick any usable RAM to extract kernel
|
||||
|
@@ -31,7 +31,7 @@ void triple_fault_shutdown_vm(struct acrn_vcpu *vcpu)
|
||||
/* Inject pm1a S5 request to SOS to shut down the guest */
|
||||
(void)emulate_io(vcpu, io_req);
|
||||
} else {
|
||||
if (is_sos_vm(vm)) {
|
||||
if (is_service_vm(vm)) {
|
||||
uint16_t vm_id;
|
||||
|
||||
/* Shut down all non real time post-launched VMs */
|
||||
@@ -137,7 +137,7 @@ static bool handle_kb_write(struct acrn_vcpu *vcpu, __unused uint16_t addr, size
|
||||
|
||||
static bool handle_kb_read(struct acrn_vcpu *vcpu, uint16_t addr, size_t bytes)
|
||||
{
|
||||
if (is_sos_vm(vcpu->vm) && (bytes == 1U)) {
|
||||
if (is_service_vm(vcpu->vm) && (bytes == 1U)) {
|
||||
/* In case i8042 is defined as ACPI PNP device in BIOS, HV need expose physical 0x64 port. */
|
||||
vcpu->req.reqs.pio_request.value = pio_read8(addr);
|
||||
} else {
|
||||
@@ -219,7 +219,7 @@ void register_reset_port_handler(struct acrn_vm *vm)
|
||||
* Don't support MMIO or PCI based reset register for now.
|
||||
* ACPI Spec: Register_Bit_Width must be 8 and Register_Bit_Offset must be 0.
|
||||
*/
|
||||
if (is_sos_vm(vm) &&
|
||||
if (is_service_vm(vm) &&
|
||||
(gas->space_id == SPACE_SYSTEM_IO) &&
|
||||
(gas->bit_width == 8U) && (gas->bit_offset == 0U) &&
|
||||
(gas->address != 0xcf9U) && (gas->address != 0x64U)) {
|
||||
|
@@ -172,7 +172,7 @@ static int32_t dispatch_hypercall(struct acrn_vcpu *vcpu)
|
||||
uint64_t param1 = vcpu_get_gpreg(vcpu, CPU_REG_RDI); /* hypercall param1 from guest */
|
||||
uint64_t param2 = vcpu_get_gpreg(vcpu, CPU_REG_RSI); /* hypercall param2 from guest */
|
||||
|
||||
if ((permission_flags == 0UL) && is_sos_vm(vm)) {
|
||||
if ((permission_flags == 0UL) && is_service_vm(vm)) {
|
||||
/* A permission_flags of 0 indicates that this hypercall is for SOS to manage
|
||||
* post-launched VMs.
|
||||
*/
|
||||
@@ -221,7 +221,7 @@ int32_t vmcall_vmexit_handler(struct acrn_vcpu *vcpu)
|
||||
* guest flags. Attempts to invoke an unpermitted hypercall will make a vCPU see -EINVAL as the return
|
||||
* value. No exception is triggered in this case.
|
||||
*/
|
||||
if (!is_sos_vm(vm) && ((guest_flags & GUEST_FLAGS_ALLOWING_HYPERCALLS) == 0UL)) {
|
||||
if (!is_service_vm(vm) && ((guest_flags & GUEST_FLAGS_ALLOWING_HYPERCALLS) == 0UL)) {
|
||||
vcpu_inject_ud(vcpu);
|
||||
ret = -ENODEV;
|
||||
} else if (!is_hypercall_from_ring0()) {
|
||||
|
@@ -977,7 +977,7 @@ int32_t wrmsr_vmexit_handler(struct acrn_vcpu *vcpu)
|
||||
case MSR_IA32_BIOS_UPDT_TRIG:
|
||||
{
|
||||
/* We only allow SOS to do uCode update */
|
||||
if (is_sos_vm(vcpu->vm)) {
|
||||
if (is_service_vm(vcpu->vm)) {
|
||||
acrn_update_ucode(vcpu, v);
|
||||
}
|
||||
break;
|
||||
|
@@ -108,7 +108,7 @@ void init_vmtrr(struct acrn_vcpu *vcpu)
|
||||
vmtrr->def_type.bits.fixed_enable = 1U;
|
||||
vmtrr->def_type.bits.type = MTRR_MEM_TYPE_UC;
|
||||
|
||||
if (is_sos_vm(vcpu->vm)) {
|
||||
if (is_service_vm(vcpu->vm)) {
|
||||
cap.value = msr_read(MSR_IA32_MTRR_CAP);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user