HV: rename the term of vm0 to sos vm

Under sharing mode, VM0 is identical with SOS VM. But the coupling of
SOS VM and VM 0 is not friendly for partition mode.

This patch is a pure term change of vm0 to sos VM, it does not change
any code logic or senmantic.

Tracked-On: #2291

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Victor Sun
2019-01-21 14:48:31 +08:00
committed by Eddie Dong
parent 55e5ed2e1a
commit 49e6deaf26
39 changed files with 174 additions and 174 deletions

View File

@@ -86,7 +86,7 @@ int32_t ptirq_intx_pin_remap(struct acrn_vm *vm, uint32_t virt_pin, uint32_t vpi
/**
* @brief Add an interrupt remapping entry for INTx as pre-hold mapping.
*
* Except vm0, Device Model should call this function to pre-hold ptdev intx
* Except sos_vm, Device Model should call this function to pre-hold ptdev intx
* The entry is identified by phys_pin, one entry vs. one phys_pin.
* Currently, one phys_pin can only be held by one pin source (vPIC or vIOAPIC).
*
@@ -125,7 +125,7 @@ void ptirq_remove_intx_remapping(struct acrn_vm *vm, uint32_t virt_pin, bool pic
* @brief Add interrupt remapping entry/entries for MSI/MSI-x as pre-hold mapping.
*
* Add pre-hold mapping of the given number of vectors between the given physical and virtual BDF for the given vm.
* Except vm0, Device Model should call this function to pre-hold ptdev MSI/MSI-x.
* Except sos_vm, Device Model should call this function to pre-hold ptdev MSI/MSI-x.
* The entry is identified by phys_bdf:msi_idx, one entry vs. one phys_bdf:msi_idx.
*
* @param[in] vm pointer to acrn_vm

View File

@@ -18,10 +18,10 @@ struct e820_mem_params {
/* HV read multiboot header to get e820 entries info and calc total RAM info */
void init_e820(void);
/* before boot vm0(service OS), call it to hide the HV RAM entry in e820 table from vm0 */
void rebuild_vm0_e820(void);
/* before boot sos_vm(service OS), call it to hide the HV RAM entry in e820 table from sos_vm */
void rebuild_sos_vm_e820(void);
/* get some RAM below 1MB in e820 entries, hide it from vm0, return its start address */
/* get some RAM below 1MB in e820 entries, hide it from sos_vm, return its start address */
uint64_t e820_alloc_low_memory(uint32_t size_arg);
/* copy the original e820 entries info to param_e820 */

View File

@@ -70,7 +70,7 @@
#define LDTR_AR (0x0082U) /* LDT, type must be 2, refer to SDM Vol3 26.3.1.2 */
#define TR_AR (0x008bU) /* TSS (busy), refer to SDM Vol3 26.3.1.2 */
void prepare_vm0_memmap(struct acrn_vm *vm);
void prepare_sos_vm_memmap(struct acrn_vm *vm);
/* Use # of paging level to identify paging mode */
enum vm_paging_mode {

View File

@@ -235,7 +235,7 @@ struct acrn_vm_config {
} __aligned(8);
static inline bool is_vm0(const struct acrn_vm *vm)
static inline bool is_sos_vm(const struct acrn_vm *vm)
{
return (vm->vm_id) == 0U;
}

View File

@@ -238,13 +238,13 @@ uint64_t gpa2hpa(struct acrn_vm *vm, uint64_t gpa);
*/
uint64_t local_gpa2hpa(struct acrn_vm *vm, uint64_t gpa, uint32_t *size);
/**
* @brief Translating from host-physical address to guest-physical address for VM0
* @brief Translating from host-physical address to guest-physical address for SOS_VM
*
* @param[in] hpa the specified host-physical address
*
* @pre: the gpa and hpa are identical mapping in SOS.
*/
uint64_t vm0_hpa2gpa(uint64_t hpa);
uint64_t sos_vm_hpa2gpa(uint64_t hpa);
/**
* @brief Guest-physical memory region mapping
*

View File

@@ -485,7 +485,7 @@ struct iommu_domain;
/**
* @brief Assign a device specified by bus & devfun to a iommu domain.
*
* Remove the device from the VM0 domain (if present), and add it to the specific domain.
* Remove the device from the SOS_VM domain (if present), and add it to the specific domain.
*
* @param[in] domain iommu domain the device is assigned to
* @param[in] bus the 8-bit bus number of the device
@@ -502,7 +502,7 @@ int32_t assign_iommu_device(struct iommu_domain *domain, uint8_t bus, uint8_t de
/**
* @brief Unassign a device specified by bus & devfun from a iommu domain .
*
* Remove the device from the specific domain, and then add it to the VM0 domain (if present).
* Remove the device from the specific domain, and then add it to the SOS_VM domain (if present).
*
* @param[in] domain iommu domain the device is assigned to
* @param[in] bus the 8-bit bus number of the device
@@ -594,19 +594,19 @@ void resume_iommu(void);
int32_t init_iommu(void);
/**
* @brief Init VM0 domain of iommu.
* @brief Init SOS_VM domain of iommu.
*
* Create VM0 domain using the Normal World's EPT table of VM0 as address translation table.
* All PCI devices are added to the VM0 domain when creating it.
* Create SOS_VM domain using the Normal World's EPT table of SOS_VM as address translation table.
* All PCI devices are added to the SOS_VM domain when creating it.
*
* @param[in] vm0 pointer to VM0
* @param[in] sos_vm pointer to SOS_VM
*
* @pre vm0 shall point to VM0
* @pre sos_vm shall point to SOS_VM
*
* @remark to reduce boot time & memory cost, a config IOMMU_INIT_BUS_LIMIT, which limit the bus number.
*
*/
void init_iommu_vm0_domain(struct acrn_vm *vm0);
void init_iommu_sos_vm_domain(struct acrn_vm *sos_vm);
/**
* @brief check the iommu if support cache snoop.

View File

@@ -32,7 +32,7 @@ bool is_hypercall_from_ring0(void);
* @param vm Pointer to VM data structure
* @param lapicid lapic id of the vcpu which wants to offline
*
* @pre Pointer vm shall point to VM0
* @pre Pointer vm shall point to SOS_VM
* @return 0 on success, non-zero on error.
*/
int32_t hcall_sos_offline_cpu(struct acrn_vm *vm, uint64_t lapicid);
@@ -40,13 +40,13 @@ int32_t hcall_sos_offline_cpu(struct acrn_vm *vm, uint64_t lapicid);
/**
* @brief Get hypervisor api version
*
* The function only return api version information when VM is VM0.
* The function only return api version information when VM is SOS_VM.
*
* @param vm Pointer to VM data structure
* @param param guest physical memory address. The api version returned
* will be copied to this gpa
*
* @pre Pointer vm shall point to VM0
* @pre Pointer vm shall point to SOS_VM
* @return 0 on success, non-zero on error.
*/
int32_t hcall_get_api_version(struct acrn_vm *vm, uint64_t param);
@@ -62,7 +62,7 @@ int32_t hcall_get_api_version(struct acrn_vm *vm, uint64_t param);
* @param param guest physical memory address. This gpa points to
* struct acrn_create_vm
*
* @pre Pointer vm shall point to VM0
* @pre Pointer vm shall point to SOS_VM
* @return 0 on success, non-zero on error.
*/
int32_t hcall_create_vm(struct acrn_vm *vm, uint64_t param);
@@ -131,7 +131,7 @@ int32_t hcall_pause_vm(uint16_t vmid);
* @param param guest physical address. This gpa points to
* struct acrn_create_vcpu
*
* @pre Pointer vm shall point to VM0
* @pre Pointer vm shall point to SOS_VM
* @return 0 on success, non-zero on error.
*/
int32_t hcall_create_vcpu(struct acrn_vm *vm, uint16_t vmid, uint64_t param);
@@ -163,7 +163,7 @@ int32_t hcall_set_vcpu_regs(struct acrn_vm *vm, uint16_t vmid, uint64_t param);
* @param vmid ID of the VM
* @param ops request command for IRQ set or clear
*
* @pre Pointer vm shall point to VM0
* @pre Pointer vm shall point to SOS_VM
* @return 0 on success, non-zero on error.
*/
int32_t hcall_set_irqline(const struct acrn_vm *vm, uint16_t vmid,
@@ -178,7 +178,7 @@ int32_t hcall_set_irqline(const struct acrn_vm *vm, uint16_t vmid,
* @param vmid ID of the VM
* @param param guest physical address. This gpa points to struct acrn_msi_entry
*
* @pre Pointer vm shall point to VM0
* @pre Pointer vm shall point to SOS_VM
* @return 0 on success, non-zero on error.
*/
int32_t hcall_inject_msi(struct acrn_vm *vm, uint16_t vmid, uint64_t param);
@@ -194,7 +194,7 @@ int32_t hcall_inject_msi(struct acrn_vm *vm, uint16_t vmid, uint64_t param);
* @param param guest physical address. This gpa points to
* struct acrn_set_ioreq_buffer
*
* @pre Pointer vm shall point to VM0
* @pre Pointer vm shall point to SOS_VM
* @return 0 on success, non-zero on error.
*/
int32_t hcall_set_ioreq_buffer(struct acrn_vm *vm, uint16_t vmid, uint64_t param);
@@ -219,7 +219,7 @@ int32_t hcall_notify_ioreq_finish(uint16_t vmid, uint16_t vcpu_id);
* @param param guest physical address. This gpa points to
* struct set_memmaps
*
* @pre Pointer vm shall point to VM0
* @pre Pointer vm shall point to SOS_VM
* @return 0 on success, non-zero on error.
*/
int32_t hcall_set_vm_memory_regions(struct acrn_vm *vm, uint64_t param);
@@ -232,7 +232,7 @@ int32_t hcall_set_vm_memory_regions(struct acrn_vm *vm, uint64_t param);
* @param wp_gpa guest physical address. This gpa points to
* struct wp_data
*
* @pre Pointer vm shall point to VM0
* @pre Pointer vm shall point to SOS_VM
* @return 0 on success, non-zero on error.
*/
int32_t hcall_write_protect_page(struct acrn_vm *vm, uint16_t vmid, uint64_t wp_gpa);
@@ -247,7 +247,7 @@ int32_t hcall_write_protect_page(struct acrn_vm *vm, uint16_t vmid, uint64_t wp_
* @param vmid ID of the VM
* @param param guest physical address. This gpa points to struct vm_gpa2hpa
*
* @pre Pointer vm shall point to VM0
* @pre Pointer vm shall point to SOS_VM
* @return 0 on success, non-zero on error.
*/
int32_t hcall_gpa_to_hpa(struct acrn_vm *vm, uint16_t vmid, uint64_t param);
@@ -261,7 +261,7 @@ int32_t hcall_gpa_to_hpa(struct acrn_vm *vm, uint16_t vmid, uint64_t param);
* To keep the compatibility it still can be the guest physical address that
* points to the physical BDF of the assigning ptdev.(Depreciated)
*
* @pre Pointer vm shall point to VM0
* @pre Pointer vm shall point to SOS_VM
* @return 0 on success, non-zero on error.
*/
int32_t hcall_assign_ptdev(struct acrn_vm *vm, uint16_t vmid, uint64_t param);
@@ -275,7 +275,7 @@ int32_t hcall_assign_ptdev(struct acrn_vm *vm, uint16_t vmid, uint64_t param);
* To keep the compatibility it still can be the guest physical address that
* points to the physical BDF of the deassigning ptdev.(Depreciated)
*
* @pre Pointer vm shall point to VM0
* @pre Pointer vm shall point to SOS_VM
* @return 0 on success, non-zero on error.
*/
int32_t hcall_deassign_ptdev(struct acrn_vm *vm, uint16_t vmid, uint64_t param);
@@ -288,7 +288,7 @@ int32_t hcall_deassign_ptdev(struct acrn_vm *vm, uint16_t vmid, uint64_t param);
* @param param guest physical address. This gpa points to data structure of
* hc_ptdev_irq including intr remapping info
*
* @pre Pointer vm shall point to VM0
* @pre Pointer vm shall point to SOS_VM
* @return 0 on success, non-zero on error.
*/
int32_t hcall_set_ptdev_intr_info(struct acrn_vm *vm, uint16_t vmid, uint64_t param);
@@ -301,7 +301,7 @@ int32_t hcall_set_ptdev_intr_info(struct acrn_vm *vm, uint16_t vmid, uint64_t pa
* @param param guest physical address. This gpa points to data structure of
* hc_ptdev_irq including intr remapping info
*
* @pre Pointer vm shall point to VM0
* @pre Pointer vm shall point to SOS_VM
* @return 0 on success, non-zero on error.
*/
int32_t hcall_reset_ptdev_intr_info(struct acrn_vm *vm, uint16_t vmid,
@@ -315,7 +315,7 @@ int32_t hcall_reset_ptdev_intr_info(struct acrn_vm *vm, uint16_t vmid,
* @param param2 hypercall param2 from guest
* @param hypcall_id hypercall ID from guest
*
* @pre Pointer vm shall point to VM0
* @pre Pointer vm shall point to SOS_VM
* @return 0 on success, non-zero on error.
*/
int32_t hcall_debug(struct acrn_vm *vm, uint64_t param1, uint64_t param2, uint64_t hypcall_id);
@@ -327,7 +327,7 @@ int32_t hcall_debug(struct acrn_vm *vm, uint64_t param1, uint64_t param2, uint64
* @param cmd cmd to show get which VCPU power state data
* @param param VCPU power state data
*
* @pre Pointer vm shall point to VM0
* @pre Pointer vm shall point to SOS_VM
* @return 0 on success, non-zero on error.
*/
@@ -341,7 +341,7 @@ int32_t hcall_get_cpu_pm_state(struct acrn_vm *vm, uint64_t cmd, uint64_t param)
* @param param guest physical address. This gpa points to data structure of
* acrn_intr_monitor
*
* @pre Pointer vm shall point to VM0
* @pre Pointer vm shall point to SOS_VM
* @return 0 on success, non-zero on error.
*/
int32_t hcall_vm_intr_monitor(struct acrn_vm *vm, uint16_t vmid, uint64_t param);
@@ -412,7 +412,7 @@ int32_t hcall_save_restore_sworld_ctx(struct acrn_vcpu *vcpu);
* @param vm Pointer to VM data structure
* @param param the expected notifier vector from guest
*
* @pre Pointer vm shall point to VM0
* @pre Pointer vm shall point to SOS_VM
* @return 0 on success, non-zero on error.
*/
int32_t hcall_set_callback_vector(const struct acrn_vm *vm, uint64_t param);

View File

@@ -45,7 +45,7 @@ static inline void *gpa2hva(struct acrn_vm *vm, uint64_t x)
static inline uint64_t hva2gpa(struct acrn_vm *vm, void *x)
{
return (is_vm0(vm)) ? vm0_hpa2gpa(hva2hpa(x)) : INVALID_GPA;
return (is_sos_vm(vm)) ? sos_vm_hpa2gpa(hva2hpa(x)) : INVALID_GPA;
}
#endif /* !ASSEMBLER */

View File

@@ -123,8 +123,8 @@ struct vm_memory_region {
/** the beginning guest physical address of the memory reion*/
uint64_t gpa;
/** VM0's guest physcial address which gpa will be mapped to */
uint64_t vm0_gpa;
/** SOS_VM's guest physcial address which gpa will be mapped to */
uint64_t sos_vm_gpa;
/** size of the memory region */
uint64_t size;