hv: implement msix.c for MSI-X remapping

Similar to MSI emulation, this patch emulates the Message Control word
within MSI-X Capability Structure.

Also it emulates MSI-X table. MSI-X remapping is triggered when the guest
is changing the Mask bit in Vector Control, or the Message Data/Addr when
MSI-X Enable bit 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-10-09 10:22:19 -07:00
committed by lijinxia
parent dcebdb8e98
commit 7c506ebc69
4 changed files with 383 additions and 0 deletions

View File

@@ -51,6 +51,12 @@ struct pci_bar {
enum pci_bar_type type;
};
struct msix_table_entry {
uint64_t addr;
uint32_t data;
uint32_t vector_control;
};
struct pci_pdev {
/* The bar info of the physical PCI device. */
struct pci_bar bar[PCI_BAR_COUNT];
@@ -65,6 +71,19 @@ struct msi {
uint32_t caplen;
};
/* MSI-X capability structure */
struct msix {
struct msix_table_entry tables[CONFIG_MAX_MSIX_TABLE_NUM];
uint64_t mmio_gpa;
uint64_t mmio_hva;
uint64_t mmio_size;
uint32_t capoff;
uint32_t caplen;
uint32_t table_bar;
uint32_t table_offset;
uint32_t table_count;
};
struct pci_vdev {
struct pci_vdev_ops *ops;
struct vpci *vpci;
@@ -80,6 +99,7 @@ struct pci_vdev {
#ifndef CONFIG_PARTITION_MODE
struct msi msi;
struct msix msix;
#endif
};