hv: dm: Use new virtual device management ioctls

IC_ADD_HV_VDEV		->	ACRN_IOCTL_CREATE_VDEV
IC_REMOVE_HV_VDEV	->	ACRN_IOCTL_DESTROY_VDEV
struct acrn_emul_dev	->	struct acrn_vdev

Also, move struct acrn_vdev to acrn_common.h as this structure is used
by both DM and HV.

Tracked-On: #6282
Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
This commit is contained in:
Shuo A Liu
2021-07-07 17:23:40 +08:00
committed by wenlingz
parent 9e7abbb38c
commit 98c80d75b8
16 changed files with 77 additions and 126 deletions

View File

@@ -112,7 +112,6 @@
_IOW(ACRN_IOCTL_TYPE, 0x42, struct acrn_vm_memmap)
/* PCI assignment*/
#define IC_ID_PCI_BASE 0x50UL
#define ACRN_IOCTL_SET_PTDEV_INTR \
_IOW(ACRN_IOCTL_TYPE, 0x53, struct acrn_ptdev_irq)
#define ACRN_IOCTL_RESET_PTDEV_INTR \
@@ -125,8 +124,10 @@
_IOW(ACRN_IOCTL_TYPE, 0x57, struct acrn_mmiodev)
#define ACRN_IOCTL_DEASSIGN_MMIODEV \
_IOW(ACRN_IOCTL_TYPE, 0x58, struct acrn_mmiodev)
#define IC_ADD_HV_VDEV _IC_ID(IC_ID, IC_ID_PCI_BASE + 0x09)
#define IC_REMOVE_HV_VDEV _IC_ID(IC_ID, IC_ID_PCI_BASE + 0x0A)
#define ACRN_IOCTL_CREATE_VDEV \
_IOW(ACRN_IOCTL_TYPE, 0x59, struct acrn_vdev)
#define ACRN_IOCTL_DESTROY_VDEV \
_IOW(ACRN_IOCTL_TYPE, 0x5A, struct acrn_vdev)
/* Power management */
#define IC_ID_PM_BASE 0x60UL
@@ -182,49 +183,6 @@ struct acrn_vm_memmap {
__u64 len;
};
/**
* @brief Info to create or destroy a virtual PCI or legacy device for a VM
*
* the parameter for HC_CREATE_VDEV or HC_DESTROY_VDEV hypercall
*/
struct acrn_emul_dev {
/*
* the identifier of the device, the low 32 bits represent the vendor
* id and device id of PCI device and the high 32 bits represent the
* device number of the legacy device
*/
union dev_id_info {
uint64_t value;
struct fields_info {
uint16_t vendor_id;
uint16_t device_id;
uint32_t legacy_device_number;
} fields;
} dev_id;
/*
* the slot of the device, if the device is a PCI device, the slot
* represents BDF, otherwise it represents legacy device slot number
*/
uint32_t slot;
/** reserved for extension */
uint32_t reserved0;
/** the IO resource address of the device, initialized by ACRN-DM. */
uint32_t io_addr[6];
/** the IO resource size of the device, initialized by ACRN-DM. */
uint32_t io_size[6];
/** the options for the virtual device, initialized by ACRN-DM. */
uint8_t args[128];
/** reserved for extension */
uint64_t reserved1[8];
} __attribute__((aligned(8)));
/* Type of interrupt of a passthrough device */
#define ACRN_PTDEV_IRQ_INTX 0
#define ACRN_PTDEV_IRQ_MSI 1