mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-24 02:08:04 +00:00
hv: add new hypercalls to create and destroy an emulated device in hypervisor
Add HC_CREATE_VDEV and HC_DESTROY_VDEV two hypercalls that are used to create and destroy an emulated device(PCI device or legacy device) in hypervisor v3: 1) change HC_CREATE_DEVICE and HC_DESTROY_DEVICE to HC_CREATE_VDEV and HC_DESTROY_VDEV 2) refine code style v4: 1) remove unnecessary parameter 2) add VM state check for HC_CREATE_VDEV and HC_DESTROY hypercalls Tracked-On: #4853 Reviewed-by: Wang, Yu1 <yu1.wang@intel.com> Signed-off-by: Yuan Liu <yuan1.liu@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
@@ -69,6 +69,8 @@
|
||||
#define HC_DEASSIGN_PCIDEV BASE_HC_ID(HC_ID, HC_ID_PCI_BASE + 0x06UL)
|
||||
#define HC_ASSIGN_MMIODEV BASE_HC_ID(HC_ID, HC_ID_PCI_BASE + 0x07UL)
|
||||
#define HC_DEASSIGN_MMIODEV BASE_HC_ID(HC_ID, HC_ID_PCI_BASE + 0x08UL)
|
||||
#define HC_CREATE_VDEV BASE_HC_ID(HC_ID, HC_ID_PCI_BASE + 0x09UL)
|
||||
#define HC_DESTROY_VDEV BASE_HC_ID(HC_ID, HC_ID_PCI_BASE + 0x0AUL)
|
||||
|
||||
/* DEBUG */
|
||||
#define HC_ID_DBG_BASE 0x60UL
|
||||
@@ -323,6 +325,49 @@ struct acrn_mmiodev {
|
||||
|
||||
} __attribute__((aligned(8)));
|
||||
|
||||
/**
|
||||
* @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)));
|
||||
|
||||
/**
|
||||
* Hypervisor api version info, return it for HC_GET_API_VERSION hypercall
|
||||
*/
|
||||
|
Reference in New Issue
Block a user