mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-20 20:53:46 +00:00
dm: add new ioctl to create and destroy a device
Add IC_CREATE_DEVICE and IC_DESTROY_DEVICE ioctls to create and destroy an emulated device in hypervisor v3: change IC_CREATE_DEVICE and IC_DESTROY_DEVICE to IC_CREATE_HV_VDEV and IC_DESTROY_HV_VDEV Tracked-On: #4853 Signed-off-by: Yuan Liu <yuan1.liu@intel.com> Acked-by: Wang, Yu1 <yu1.wang@intel.com>
This commit is contained in:
parent
1b711ed629
commit
a977d35e0c
@ -616,6 +616,18 @@ vm_unmap_ptdev_mmio(struct vmctx *ctx, int bus, int slot, int func,
|
|||||||
return ioctl(ctx->fd, IC_UNSET_MEMSEG, &memmap);
|
return ioctl(ctx->fd, IC_UNSET_MEMSEG, &memmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
vm_create_hv_vdev(struct vmctx *ctx, struct acrn_emul_dev *dev)
|
||||||
|
{
|
||||||
|
return ioctl(ctx->fd, IC_CREATE_HV_VDEV, dev);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
vm_destroy_hv_vdev(struct vmctx *ctx, struct acrn_emul_dev *dev)
|
||||||
|
{
|
||||||
|
return ioctl(ctx->fd, IC_DESTROY_HV_VDEV, dev);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
vm_set_ptdev_intx_info(struct vmctx *ctx, uint16_t virt_bdf, uint16_t phys_bdf,
|
vm_set_ptdev_intx_info(struct vmctx *ctx, uint16_t virt_bdf, uint16_t phys_bdf,
|
||||||
int virt_pin, int phys_pin, bool pic_pin)
|
int virt_pin, int phys_pin, bool pic_pin)
|
||||||
|
@ -109,6 +109,8 @@
|
|||||||
#define IC_DEASSIGN_PCIDEV _IC_ID(IC_ID, IC_ID_PCI_BASE + 0x06)
|
#define IC_DEASSIGN_PCIDEV _IC_ID(IC_ID, IC_ID_PCI_BASE + 0x06)
|
||||||
#define IC_ASSIGN_MMIODEV _IC_ID(IC_ID, IC_ID_PCI_BASE + 0x07)
|
#define IC_ASSIGN_MMIODEV _IC_ID(IC_ID, IC_ID_PCI_BASE + 0x07)
|
||||||
#define IC_DEASSIGN_MMIODEV _IC_ID(IC_ID, IC_ID_PCI_BASE + 0x08)
|
#define IC_DEASSIGN_MMIODEV _IC_ID(IC_ID, IC_ID_PCI_BASE + 0x08)
|
||||||
|
#define IC_CREATE_HV_VDEV _IC_ID(IC_ID, IC_ID_PCI_BASE + 0x09)
|
||||||
|
#define IC_DESTROY_HV_VDEV _IC_ID(IC_ID, IC_ID_PCI_BASE + 0x0A)
|
||||||
|
|
||||||
/* Power management */
|
/* Power management */
|
||||||
#define IC_ID_PM_BASE 0x60UL
|
#define IC_ID_PM_BASE 0x60UL
|
||||||
@ -202,6 +204,49 @@ struct acrn_mmiodev {
|
|||||||
|
|
||||||
} __attribute__((aligned(8)));
|
} __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)));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief pass thru device irq data structure
|
* @brief pass thru device irq data structure
|
||||||
*/
|
*/
|
||||||
|
@ -136,6 +136,8 @@ int vm_set_ptdev_intx_info(struct vmctx *ctx, uint16_t virt_bdf,
|
|||||||
uint16_t phys_bdf, int virt_pin, int phys_pin, bool pic_pin);
|
uint16_t phys_bdf, int virt_pin, int phys_pin, bool pic_pin);
|
||||||
int vm_reset_ptdev_intx_info(struct vmctx *ctx, uint16_t virt_bdf,
|
int vm_reset_ptdev_intx_info(struct vmctx *ctx, uint16_t virt_bdf,
|
||||||
uint16_t phys_bdf, int virt_pin, bool pic_pin);
|
uint16_t phys_bdf, int virt_pin, bool pic_pin);
|
||||||
|
int vm_create_hv_vdev(struct vmctx *ctx, struct acrn_emul_dev *dev);
|
||||||
|
int vm_destroy_hv_vdev(struct vmctx *ctx, struct acrn_emul_dev *dev);
|
||||||
|
|
||||||
int acrn_parse_cpu_affinity(char *arg);
|
int acrn_parse_cpu_affinity(char *arg);
|
||||||
int vm_create_vcpu(struct vmctx *ctx, uint16_t vcpu_id);
|
int vm_create_vcpu(struct vmctx *ctx, uint16_t vcpu_id);
|
||||||
|
Loading…
Reference in New Issue
Block a user