mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-21 08:50:27 +00:00
hv: vPCI: remove passthrough PCI device unuse code
Now we split passthrough PCI device from DM to HV, we could remove all the passthrough PCI device unused code. Tracked-On: #4371 Signed-off-by: Li Fei1 <fei1.li@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
@@ -585,70 +585,6 @@ static void deinit_postlaunched_vm_vpci(struct acrn_vm *vm)
|
||||
spinlock_release(&sos_vm->vpci.lock);
|
||||
}
|
||||
|
||||
/**
|
||||
* @pre target_vm != NULL && Pointer target_vm shall point to SOS_VM
|
||||
*/
|
||||
void vpci_set_ptdev_intr_info(struct acrn_vm *target_vm, uint16_t vbdf, uint16_t pbdf)
|
||||
{
|
||||
struct pci_vdev *vdev, *target_vdev;
|
||||
struct acrn_vpci *target_vpci;
|
||||
union pci_bdf bdf;
|
||||
struct acrn_vm *sos_vm;
|
||||
|
||||
bdf.value = pbdf;
|
||||
sos_vm = get_sos_vm();
|
||||
spinlock_obtain(&sos_vm->vpci.lock);
|
||||
vdev = pci_find_vdev(&sos_vm->vpci, bdf);
|
||||
if ((vdev == NULL) || (vdev->pdev == NULL)) {
|
||||
pr_err("%s, can't find PCI device for vm%d, vbdf (0x%x) pbdf (0x%x)", __func__,
|
||||
target_vm->vm_id, vbdf, pbdf);
|
||||
} else {
|
||||
if (vdev->vpci->vm == sos_vm) {
|
||||
spinlock_obtain(&target_vm->vpci.lock);
|
||||
target_vpci = &(target_vm->vpci);
|
||||
vdev->vpci = target_vpci;
|
||||
|
||||
target_vdev = &target_vpci->pci_vdevs[target_vpci->pci_vdev_cnt];
|
||||
target_vpci->pci_vdev_cnt++;
|
||||
(void)memcpy_s((void *)target_vdev, sizeof(struct pci_vdev),
|
||||
(void *)vdev, sizeof(struct pci_vdev));
|
||||
target_vdev->bdf.value = vbdf;
|
||||
|
||||
vdev->new_owner = target_vdev;
|
||||
spinlock_release(&target_vm->vpci.lock);
|
||||
}
|
||||
}
|
||||
spinlock_release(&sos_vm->vpci.lock);
|
||||
}
|
||||
|
||||
/**
|
||||
* @pre target_vm != NULL && Pointer target_vm shall point to SOS_VM
|
||||
*/
|
||||
void vpci_reset_ptdev_intr_info(struct acrn_vm *target_vm, uint16_t vbdf, uint16_t pbdf)
|
||||
{
|
||||
struct pci_vdev *vdev;
|
||||
union pci_bdf bdf;
|
||||
struct acrn_vm *sos_vm;
|
||||
|
||||
bdf.value = pbdf;
|
||||
sos_vm = get_sos_vm();
|
||||
spinlock_obtain(&sos_vm->vpci.lock);
|
||||
vdev = pci_find_vdev(&sos_vm->vpci, bdf);
|
||||
if (vdev == NULL) {
|
||||
pr_err("%s, can't find PCI device for vm%d, vbdf (0x%x) pbdf (0x%x)", __func__,
|
||||
target_vm->vm_id, vbdf, pbdf);
|
||||
} else {
|
||||
/* Return this PCI device to SOS */
|
||||
if (vdev->vpci->vm == target_vm) {
|
||||
spinlock_obtain(&target_vm->vpci.lock);
|
||||
vdev->vpci = &sos_vm->vpci;
|
||||
vdev->new_owner = NULL;
|
||||
spinlock_release(&target_vm->vpci.lock);
|
||||
}
|
||||
}
|
||||
spinlock_release(&sos_vm->vpci.lock);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief assign a PCI device from SOS to target post-launched VM.
|
||||
*
|
||||
|
Reference in New Issue
Block a user