hv: resolve the negative impacts to UOS MSI/MSI-X remapping

After enabling vPCI in hypervisor for vm0, UOS may not able be launched
successfully. Consider this scenario (take MSI-X for example):

- DM makes hypercall to hypervisor to do MSI-X remapping on behalf of
  UOS guests.
- After the hypercall, VHM module in SOS kernel updates the physical
  MSI-X table with the physical Message Data/Addr.
- These MMIO write requests are intercepted by hypervisor, which will
  call ptdev_msix_remap() to do MSI-S remapping.

It may fail due to 2 possible reasons:

1) wrong target VM because:
  hypervisor thinks it's a VM0 MSI-X device but they have been registered
  as UOS guests through HC_SET_PTDEV_INTR_INFO hypercall.

2) wrong ptdev_msi_info->vmsi_data because:
  The virtual MSI-X table is supposed to hold virtual Message data/addr
  but the SOS VHM writes the physical ones to it.

This patch resolves these problems by ignoring the HC_VM_PCI_MSIX_REMAP
hypercall, so virtual and physical Message Data are the same from SOS'
perspective and it won't mess up the virtual PCI device in HV.

Also in HC_SET_PTDEV_INTR_INFO handler, vpci updates the target VM
when the PCI devices are assigned to different VMs.

The UOS' MSI/MSI-X remapping is triggered by hypervisor when SOS (either
DM or VHM) updates the Message Data/Addr.

Tracked-On: #1568
Signed-off-by: dongshen <dongsheng.x.zhang@intel.com>
Signed-off-by: Zide Chen <zide.chen@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
Zide Chen
2018-10-24 14:24:53 -07:00
committed by Xie, Nanlin
parent c1d2499e5c
commit 0255e62798
5 changed files with 57 additions and 60 deletions

View File

@@ -119,10 +119,12 @@ int vmcall_vmexit_handler(struct vcpu *vcpu)
ret = hcall_write_protect_page(vm, (uint16_t)param1, param2);
break;
/*
* Don't do MSI remapping and make the pmsi_data equal to vmsi_data
* This is a temporary solution before this hypercall is removed from SOS
*/
case HC_VM_PCI_MSIX_REMAP:
/* param1: vmid */
ret = hcall_remap_pci_msix(vm, (uint16_t)param1, param2);
ret = 0;
break;
case HC_VM_GPA2HPA: