vPCI: split passthrough PCI device from DM to HV

In this case, we could handle all the passthrough PCI devices in ACRN hypervisor.
But we still need DM to initialize BAR resources and Intx for passthrough PCI
device for post-launched VM since these informations should been filled into
ACPI tables. So
1. we add a HC vm_assign_pcidev to pass the extra informations to replace the old
vm_assign_ptdev.
2. we saso remove HC vm_set_ptdev_msix_info since it could been setted by the post-launched
VM now same as SOS.
3. remove vm_map_ptdev_mmio call for PTDev in DM since ACRN hypervisor will handle these
BAR access.
4. the most important thing is to trap PCI configure space access for PTDev in HV for
post-launched VM and bypass the virtual PCI device configure space access to DM.

This patch doesn't do the clean work. Will do it in the next patch.

Tracked-On: #4371
Signed-off-by: Li Fei1 <fei1.li@intel.com>
This commit is contained in:
Li Fei1
2020-02-10 20:58:53 +08:00
committed by wenlingz
parent aa38ed5b69
commit dafa3da693
5 changed files with 125 additions and 182 deletions

View File

@@ -619,18 +619,9 @@ int32_t ptirq_prepare_msix_remap(struct acrn_vm *vm, uint16_t virt_bdf, uint16_t
spinlock_obtain(&ptdev_lock);
entry = ptirq_lookup_entry_by_sid(PTDEV_INTR_MSI, &virt_sid, vm);
if (entry == NULL) {
/* SOS_VM we add mapping dynamically */
if (is_sos_vm(vm) || is_prelaunched_vm(vm)) {
entry = add_msix_remapping(vm, virt_bdf, phys_bdf, entry_nr);
if (entry == NULL) {
pr_err("dev-assign: msi entry exist in others");
}
} else {
/* ptirq_prepare_msix_remap is called by SOS on demand, if
* failed to find pre-hold mapping, return error to
* the caller.
*/
pr_err("dev-assign: msi entry not exist");
entry = add_msix_remapping(vm, virt_bdf, phys_bdf, entry_nr);
if (entry == NULL) {
pr_err("dev-assign: msi entry exist in others");
}
}
spinlock_release(&ptdev_lock);