hv: implement ivshmem device-specific registers emulation

Ivshmem device defines four registers including Interrupt Mask, Interrupt
Status, IVPostion and Doorbell. The first two are useless and no emulation
is required. The latter two are used for interrupts and will be implemented
in the future.

This patch also introduces a new priv_data member for structure pci_vdev,
it can be used to find an ivshmem device through pci_vdev.

v2: refine code style

v3: 1) add @pre for ivshmem_mmio_handler function
    2) refine code style

v4: 1) set ivshmem registers default value when vBAR mapping
    2) change find_ivshmem_device to set_ivshmem_device

v5: 1) change set_ivshmem_device to find_and_set_ivshmem_device
    2) add a ASSERT to check if the vdev->priv_data is set successfully

v6: change find_and_set_ivshmem_device to create_ivshmem_device

Tracked-On: #4853

Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Yuan Liu
2020-08-14 12:15:26 +08:00
committed by wenlingz
parent b6661e48d8
commit 43683c7fc9
2 changed files with 92 additions and 0 deletions

View File

@@ -139,6 +139,7 @@ struct pci_vdev {
struct pci_vdev *parent_user;
struct pci_vdev *user; /* NULL means this device is not used or is a zombie VF */
struct hlist_node link;
void *priv_data;
};
union pci_cfg_addr_reg {