hv: implement msi.c to handle MSI remapping for vm0

Emulate MSI Capability structure for vm0 in sharing mode:

- it intercepts the IO requests for MSI Capability structure, emulates
  the Message Control word, and bypasses all other I/O requests to the
  physical device.

- criteria to trigger MSI remapping: MSI Enable bit is being changed,
  Message Data/Addr is being changed when MSI Enable is set.

Tracked-On: #1568
Signed-off-by: dongshen <dongsheng.x.zhang@intel.com>
Signed-off-by: Zide Chen <zide.chen@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
Zide Chen
2018-09-24 12:29:01 -07:00
committed by lijinxia
parent 6af47f249c
commit dcebdb8e98
6 changed files with 271 additions and 1 deletions

View File

@@ -161,6 +161,7 @@ static inline bool pci_bar_access(uint32_t offset)
uint32_t pci_pdev_read_cfg(union pci_bdf bdf, uint32_t offset, uint32_t bytes);
void pci_pdev_write_cfg(union pci_bdf bdf, uint32_t offset, uint32_t bytes, uint32_t val);
void enable_disable_pci_intx(union pci_bdf bdf, bool enable);
void pci_scan_bus(pci_enumeration_cb cb, void *data);

View File

@@ -59,6 +59,12 @@ struct pci_pdev {
union pci_bdf bdf;
};
/* MSI capability structure */
struct msi {
uint32_t capoff;
uint32_t caplen;
};
struct pci_vdev {
struct pci_vdev_ops *ops;
struct vpci *vpci;
@@ -71,6 +77,10 @@ struct pci_vdev {
/* The bar info of the virtual PCI device. */
struct pci_bar bar[PCI_BAR_COUNT];
#ifndef CONFIG_PARTITION_MODE
struct msi msi;
#endif
};
struct pci_addr_info {