dm: deal with physical GSI sharing

- hardcode the devices' GSI info based on the platform
- reject the passthrough if the following requirement is not met
  all the PCI devices that are sharing the same GSI should be assigned
  to same VM to avoid physical GSI sharing between multiple VMs.

v4 -> v5
 * Move the gsi_dev_mapping_tables definition in a separate file
 * Add the GSI info that might be used by GPIO
 * Update the HW name

v3 - > v4
 * Refine the format of raw data to improve the readability
 * Remove the redundant code when adding the new dev into the gsi
    sharing group

v2 -> v3
 * Add the MSI/MSI-x capability check
   Do not add the device which supports MSI/MSI-x to the GSI sharing
   group.

v1 -> v2
 * Update the GSI raw data based on SBL
 * Free the resources when gsi sharing violation occurs
 * Move the MACRO PCI_BDF(b, d, f) to pci_core.h since passthrough.c
    and gsi_sharing.c are both using it

Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Reviewed-by: Edwin Zhai <edwin.zhai@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Shiqing Gao
2018-06-15 09:08:47 +08:00
committed by Xie, nanlin
parent 9600dfa07d
commit 789899d05f
6 changed files with 395 additions and 4 deletions

View File

@@ -67,8 +67,6 @@
#define MSIX_TABLE_COUNT(ctrl) (((ctrl) & PCIM_MSIXCTRL_TABLE_SIZE) + 1)
#define MSIX_CAPLEN 12
#define PCI_BDF(bus, dev, func) (((bus & 0xFF)<<8) | ((dev & 0x1F)<<3) \
| ((func & 0x7)))
#define PCI_BDF_GPU 0x00000010 /* 00:02.0 */
@@ -894,7 +892,7 @@ native_pci_system_init()
/*
* return zero on success or non-zero on failure
*/
static int
int
pciaccess_init(void)
{
int error;
@@ -957,6 +955,7 @@ passthru_init(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
}
ptdev->phys_bdf = PCI_BDF(bus, slot, func);
update_pt_info(ptdev->phys_bdf);
error = pciaccess_init();
if (error < 0)
@@ -1031,7 +1030,7 @@ done:
return error;
}
static void
void
pciaccess_cleanup(void)
{
pthread_mutex_lock(&ref_cnt_mtx);