mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-16 06:19:24 +00:00
ACRN: hv: Terminology modification in hv code
Rename sos_vm to service_vm. rename sos_vmid to service_vmid. rename sos_vm_ptr to service_vm_ptr. rename get_sos_vm to get_service_vm. rename sos_vm_gpa to service_vm_gpa. rename sos_vm_e820 to service_vm_e820. rename sos_efi_info to service_vm_efi_info. rename sos_vm_config to service_vm_config. rename sos_vm_hpa2gpa to service_vm_hpa2gpa. rename vdev_in_sos to vdev_in_service_vm. rename create_sos_vm_e820 to create_service_vm_e820. rename sos_high64_max_ram to service_vm_high64_max_ram. rename prepare_sos_vm_memmap to prepare_service_vm_memmap. rename post_uos_sworld_memory to post_user_vm_sworld_memory rename hcall_sos_offline_cpu to hcall_service_vm_offline_cpu. rename filter_mem_from_sos_e820 to filter_mem_from_service_vm_e820. rename create_sos_vm_efi_mmap_desc to create_service_vm_efi_mmap_desc. rename HC_SOS_OFFLINE_CPU to HC_SERVICE_VM_OFFLINE_CPU. rename SOS to Service VM in comments message. Tracked-On: #6744 Signed-off-by: Liu Long <long.liu@linux.intel.com> Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
This commit is contained in:
@@ -258,7 +258,7 @@ static void vdev_pt_allow_io_vbar(struct pci_vdev *vdev, uint32_t idx)
|
||||
{
|
||||
struct acrn_vm *vm = vpci2vm(vdev->vpci);
|
||||
|
||||
/* For SOS, all port IO access is allowed by default, so skip SOS here */
|
||||
/* For Service VM, all port IO access is allowed by default, so skip Service VM here */
|
||||
if (!is_service_vm(vm)) {
|
||||
struct pci_vbar *vbar = &vdev->vbars[idx];
|
||||
if (vbar->base_gpa != 0UL) {
|
||||
@@ -276,7 +276,7 @@ static void vdev_pt_deny_io_vbar(struct pci_vdev *vdev, uint32_t idx)
|
||||
{
|
||||
struct acrn_vm *vm = vpci2vm(vdev->vpci);
|
||||
|
||||
/* For SOS, all port IO access is allowed by default, so skip SOS here */
|
||||
/* For Service VM, all port IO access is allowed by default, so skip Service VM here */
|
||||
if (!is_service_vm(vm)) {
|
||||
struct pci_vbar *vbar = &vdev->vbars[idx];
|
||||
if (vbar->base_gpa != 0UL) {
|
||||
@@ -556,7 +556,7 @@ void init_vdev_pt(struct pci_vdev *vdev, bool is_pf_vdev)
|
||||
}
|
||||
} else {
|
||||
if (vdev->phyfun->vpci != vdev->vpci) {
|
||||
/* VF is assigned to a UOS */
|
||||
/* VF is assigned to a User VM */
|
||||
uint32_t vid, did;
|
||||
|
||||
vdev->nr_bars = PCI_BAR_COUNT;
|
||||
|
@@ -155,7 +155,7 @@ static void pci_vdev_update_vbar_base(struct pci_vdev *vdev, uint32_t idx)
|
||||
|| (!mem_aligned_check(base, vdev->vbars[idx].size))) {
|
||||
res = (base < (1UL << 32UL)) ? &(vdev->vpci->res32): &(vdev->vpci->res64);
|
||||
/* VM tries to reprogram vbar address out of pci mmio bar window, it can be caused by:
|
||||
* 1. For SOS, <board>.xml is misaligned with the actual native platform, and we get wrong mmio window.
|
||||
* 1. For Service VM, <board>.xml is misaligned with the actual native platform, and we get wrong mmio window.
|
||||
* 2. Malicious operation from VM, it tries to reprogram vbar address out of pci mmio bar window
|
||||
*/
|
||||
pr_err("%s reprogram PCI:%02x:%02x.%x BAR%d to addr:0x%lx,"
|
||||
|
@@ -118,7 +118,7 @@ static void init_vhostbridge(struct pci_vdev *vdev)
|
||||
*/
|
||||
pciexbar_low = UOS_VIRT_PCI_MMCFG_BASE | 0x1U;
|
||||
} else {
|
||||
/*Inject physical ECAM value to SOS vhostbridge since SOS may check PCIe-MMIO Base Address with it */
|
||||
/*Inject physical ECAM value to Service VM vhostbridge since Service VM may check PCIe-MMIO Base Address with it */
|
||||
phys_did = pci_pdev_read_cfg(hostbridge_bdf, PCIR_DEVICE, 2);
|
||||
for (i = 0U; i < (sizeof(hostbridge_did_highbytes) / sizeof(uint32_t)); i++) {
|
||||
if (((phys_did & 0xff00U) >> 8) == hostbridge_did_highbytes[i]) {
|
||||
|
@@ -107,7 +107,7 @@ static bool vpci_pio_cfgaddr_write(struct acrn_vcpu *vcpu, uint16_t addr, size_t
|
||||
* @pre vcpu->vm != NULL
|
||||
* @pre vcpu->vm->vm_id < CONFIG_MAX_VM_NUM
|
||||
* @pre (get_vm_config(vcpu->vm->vm_id)->load_order == PRE_LAUNCHED_VM)
|
||||
* || (get_vm_config(vcpu->vm->vm_id)->load_order == SOS_VM)
|
||||
* || (get_vm_config(vcpu->vm->vm_id)->load_order == SERVICE_VM)
|
||||
*
|
||||
* @retval true on success.
|
||||
* @retval false. (ACRN will deliver this IO request to DM to handle for post-launched VM)
|
||||
@@ -224,7 +224,7 @@ int32_t init_vpci(struct acrn_vm *vm)
|
||||
vm->iommu = create_iommu_domain(vm->vm_id, hva2hpa(vm->arch_vm.nworld_eptp), 48U);
|
||||
|
||||
vm_config = get_vm_config(vm->vm_id);
|
||||
/* virtual PCI MMCONFIG for SOS is same with the physical value */
|
||||
/* virtual PCI MMCONFIG for Service VM is same with the physical value */
|
||||
if (vm_config->load_order == SOS_VM) {
|
||||
pci_mmcfg = get_mmcfg_region();
|
||||
vm->vpci.pci_mmcfg = *pci_mmcfg;
|
||||
@@ -341,7 +341,7 @@ static void remove_vdev_pt_iommu_domain(const struct pci_vdev *vdev)
|
||||
* @brief Find an available vdev structure with BDF from a specified vpci structure.
|
||||
* If the vdev's vpci is the same as the specified vpci, the vdev is available.
|
||||
* If the vdev's vpci is not the same as the specified vpci, the vdev has already
|
||||
* been assigned and it is unavailable for SOS.
|
||||
* been assigned and it is unavailable for Service VM.
|
||||
* If the vdev's vpci is NULL, the vdev is a orphan/zombie instance, it can't
|
||||
* be accessed by any vpci.
|
||||
*
|
||||
@@ -358,7 +358,7 @@ static struct pci_vdev *find_available_vdev(struct acrn_vpci *vpci, union pci_bd
|
||||
|
||||
if ((vdev != NULL) && (vdev->user != vdev)) {
|
||||
if (vdev->user != NULL) {
|
||||
/* the SOS is able to access, if and only if the SOS has higher severity than the UOS. */
|
||||
/* the Service VM is able to access, if and only if the Service VM has higher severity than the UOS. */
|
||||
if (get_vm_severity(vpci2vm(vpci)->vm_id) <
|
||||
get_vm_severity(vpci2vm(vdev->user->vpci)->vm_id)) {
|
||||
vdev = NULL;
|
||||
@@ -693,7 +693,7 @@ static int32_t vpci_init_vdevs(struct acrn_vm *vm)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief assign a PCI device from SOS to target post-launched VM.
|
||||
* @brief assign a PCI device from Service VM to target post-launched VM.
|
||||
*
|
||||
* @pre tgt_vm != NULL
|
||||
* @pre pcidev != NULL
|
||||
@@ -702,41 +702,41 @@ int32_t vpci_assign_pcidev(struct acrn_vm *tgt_vm, struct acrn_pcidev *pcidev)
|
||||
{
|
||||
int32_t ret = 0;
|
||||
uint32_t idx;
|
||||
struct pci_vdev *vdev_in_sos, *vdev;
|
||||
struct pci_vdev *vdev_in_service_vm, *vdev;
|
||||
struct acrn_vpci *vpci;
|
||||
union pci_bdf bdf;
|
||||
struct acrn_vm *sos_vm;
|
||||
struct acrn_vm *service_vm;
|
||||
|
||||
bdf.value = pcidev->phys_bdf;
|
||||
sos_vm = get_sos_vm();
|
||||
spinlock_obtain(&sos_vm->vpci.lock);
|
||||
vdev_in_sos = pci_find_vdev(&sos_vm->vpci, bdf);
|
||||
if ((vdev_in_sos != NULL) && (vdev_in_sos->user == vdev_in_sos) &&
|
||||
(vdev_in_sos->pdev != NULL) &&
|
||||
!is_host_bridge(vdev_in_sos->pdev) && !is_bridge(vdev_in_sos->pdev)) {
|
||||
service_vm = get_service_vm();
|
||||
spinlock_obtain(&service_vm->vpci.lock);
|
||||
vdev_in_service_vm = pci_find_vdev(&service_vm->vpci, bdf);
|
||||
if ((vdev_in_service_vm != NULL) && (vdev_in_service_vm->user == vdev_in_service_vm) &&
|
||||
(vdev_in_service_vm->pdev != NULL) &&
|
||||
!is_host_bridge(vdev_in_service_vm->pdev) && !is_bridge(vdev_in_service_vm->pdev)) {
|
||||
|
||||
/* ToDo: Each PT device must support one type reset */
|
||||
if (!vdev_in_sos->pdev->has_pm_reset && !vdev_in_sos->pdev->has_flr &&
|
||||
!vdev_in_sos->pdev->has_af_flr) {
|
||||
if (!vdev_in_service_vm->pdev->has_pm_reset && !vdev_in_service_vm->pdev->has_flr &&
|
||||
!vdev_in_service_vm->pdev->has_af_flr) {
|
||||
pr_fatal("%s %x:%x.%x not support FLR or not support PM reset\n",
|
||||
__func__, bdf.bits.b, bdf.bits.d, bdf.bits.f);
|
||||
} else {
|
||||
/* DM will reset this device before assigning it */
|
||||
pdev_restore_bar(vdev_in_sos->pdev);
|
||||
pdev_restore_bar(vdev_in_service_vm->pdev);
|
||||
}
|
||||
|
||||
vdev_in_sos->vdev_ops->deinit_vdev(vdev_in_sos);
|
||||
vdev_in_service_vm->vdev_ops->deinit_vdev(vdev_in_service_vm);
|
||||
|
||||
vpci = &(tgt_vm->vpci);
|
||||
|
||||
spinlock_obtain(&tgt_vm->vpci.lock);
|
||||
vdev = vpci_init_vdev(vpci, vdev_in_sos->pci_dev_config, vdev_in_sos->phyfun);
|
||||
vdev = vpci_init_vdev(vpci, vdev_in_service_vm->pci_dev_config, vdev_in_service_vm->phyfun);
|
||||
pci_vdev_write_vcfg(vdev, PCIR_INTERRUPT_LINE, 1U, pcidev->intr_line);
|
||||
pci_vdev_write_vcfg(vdev, PCIR_INTERRUPT_PIN, 1U, pcidev->intr_pin);
|
||||
for (idx = 0U; idx < vdev->nr_bars; idx++) {
|
||||
/* VF is assigned to a UOS */
|
||||
if (vdev->phyfun != NULL) {
|
||||
vdev->vbars[idx] = vdev_in_sos->vbars[idx];
|
||||
vdev->vbars[idx] = vdev_in_service_vm->vbars[idx];
|
||||
if (has_msix_cap(vdev) && (idx == vdev->msix.table_bar)) {
|
||||
vdev->msix.mmio_hpa = vdev->vbars[idx].base_hpa;
|
||||
vdev->msix.mmio_size = vdev->vbars[idx].size;
|
||||
@@ -753,11 +753,11 @@ int32_t vpci_assign_pcidev(struct acrn_vm *tgt_vm, struct acrn_pcidev *pcidev)
|
||||
/*We should re-add the vdev to hashlist since its vbdf has changed */
|
||||
hlist_del(&vdev->link);
|
||||
hlist_add_head(&vdev->link, &vpci->vdevs_hlist_heads[hash64(vdev->bdf.value, VDEV_LIST_HASHBITS)]);
|
||||
vdev->parent_user = vdev_in_sos;
|
||||
vdev_in_sos->user = vdev;
|
||||
vdev->parent_user = vdev_in_service_vm;
|
||||
vdev_in_service_vm->user = vdev;
|
||||
} else {
|
||||
vdev->vdev_ops->deinit_vdev(vdev);
|
||||
vdev_in_sos->vdev_ops->init_vdev(vdev_in_sos);
|
||||
vdev_in_service_vm->vdev_ops->init_vdev(vdev_in_service_vm);
|
||||
}
|
||||
spinlock_release(&tgt_vm->vpci.lock);
|
||||
} else {
|
||||
@@ -767,13 +767,13 @@ int32_t vpci_assign_pcidev(struct acrn_vm *tgt_vm, struct acrn_pcidev *pcidev)
|
||||
pcidev->virt_bdf >> 8U, (pcidev->virt_bdf >> 3U) & 0x1fU, pcidev->virt_bdf & 0x7U);
|
||||
ret = -ENODEV;
|
||||
}
|
||||
spinlock_release(&sos_vm->vpci.lock);
|
||||
spinlock_release(&service_vm->vpci.lock);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief deassign a PCI device from target post-launched VM to SOS.
|
||||
* @brief deassign a PCI device from target post-launched VM to Service VM.
|
||||
*
|
||||
* @pre tgt_vm != NULL
|
||||
* @pre pcidev != NULL
|
||||
|
@@ -42,7 +42,7 @@
|
||||
* 1. configure tool can select whether a PCI bridge is emulated or pass through
|
||||
*
|
||||
* Open:
|
||||
* 1. SOS how to reset PCI devices under the PCI bridge
|
||||
* 1. Service VM how to reset PCI devices under the PCI bridge
|
||||
*/
|
||||
|
||||
#include <asm/guest/vm.h>
|
||||
|
@@ -216,7 +216,7 @@ static void enable_vfs(struct pci_vdev *pf_vdev)
|
||||
} else {
|
||||
/*
|
||||
* If the VF physical device was not created successfully, the pdev/vdev
|
||||
* will also not be created so that SOS can aware of VF creation failure,
|
||||
* will also not be created so that Service VM can aware of VF creation failure,
|
||||
*/
|
||||
pr_err("PF %x:%x.%x can't create VFs after 100 ms",
|
||||
pf_vdev->bdf.bits.b, pf_vdev->bdf.bits.d, pf_vdev->bdf.bits.f);
|
||||
@@ -238,7 +238,7 @@ static void disable_vfs(struct pci_vdev *pf_vdev)
|
||||
* we simply set the VF instance status to "zombie" to avoid dynamically adding/removing
|
||||
* resources
|
||||
*
|
||||
* If the VF drivers are still running in SOS or UOS, the MMIO access will return 0xFF.
|
||||
* If the VF drivers are still running in Service VM or User VM, the MMIO access will return 0xFF.
|
||||
*/
|
||||
num_vfs = read_sriov_reg(pf_vdev, PCIR_SRIOV_NUMVFS);
|
||||
first = read_sriov_reg(pf_vdev, PCIR_SRIOV_FST_VF_OFF);
|
||||
|
Reference in New Issue
Block a user