From 06e9220794e1bdb663adc098cc67c25d7de733a4 Mon Sep 17 00:00:00 2001 From: Yonghua Huang Date: Sat, 5 Dec 2020 22:06:56 +0800 Subject: [PATCH] dm: rename ioctl command for hv-emulated management Use add/remove device instead of create/destroy. Tracked-On: #5586 Signed-off-by: Yonghua Huang --- devicemodel/core/vmmapi.c | 8 ++++---- devicemodel/hw/pci/ivshmem.c | 4 ++-- devicemodel/hw/pci/uart.c | 4 ++-- devicemodel/include/public/vhm_ioctl_defs.h | 4 ++-- devicemodel/include/vmmapi.h | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/devicemodel/core/vmmapi.c b/devicemodel/core/vmmapi.c index 0614062fb..595e06cb6 100644 --- a/devicemodel/core/vmmapi.c +++ b/devicemodel/core/vmmapi.c @@ -618,15 +618,15 @@ vm_unmap_ptdev_mmio(struct vmctx *ctx, int bus, int slot, int func, } int -vm_create_hv_vdev(struct vmctx *ctx, struct acrn_emul_dev *dev) +vm_add_hv_vdev(struct vmctx *ctx, struct acrn_emul_dev *dev) { - return ioctl(ctx->fd, IC_CREATE_HV_VDEV, dev); + return ioctl(ctx->fd, IC_ADD_HV_VDEV, dev); } int -vm_destroy_hv_vdev(struct vmctx *ctx, struct acrn_emul_dev *dev) +vm_remove_hv_vdev(struct vmctx *ctx, struct acrn_emul_dev *dev) { - return ioctl(ctx->fd, IC_DESTROY_HV_VDEV, dev); + return ioctl(ctx->fd, IC_REMOVE_HV_VDEV, dev); } int diff --git a/devicemodel/hw/pci/ivshmem.c b/devicemodel/hw/pci/ivshmem.c index 90d58326a..e832d0d75 100644 --- a/devicemodel/hw/pci/ivshmem.c +++ b/devicemodel/hw/pci/ivshmem.c @@ -167,7 +167,7 @@ create_ivshmem_from_hv(struct vmctx *ctx, struct pci_vdev *vdev, dev.io_addr[IVSHMEM_MEM_BAR + 1] = addr; dev.io_size[IVSHMEM_MEM_BAR] = shm_size; strncpy((char*)dev.args, shm_name, 32); - return vm_create_hv_vdev(ctx, &dev); + return vm_add_hv_vdev(ctx, &dev); } static void @@ -352,7 +352,7 @@ destroy_ivshmem_from_hv(struct vmctx *ctx, struct pci_vdev *vdev) emul_dev.dev_id.fields.vendor_id = IVSHMEM_VENDOR_ID; emul_dev.dev_id.fields.device_id = IVSHMEM_DEVICE_ID; emul_dev.slot = PCI_BDF(vdev->bus, vdev->slot, vdev->func); - vm_destroy_hv_vdev(ctx, &emul_dev); + vm_remove_hv_vdev(ctx, &emul_dev); } static void diff --git a/devicemodel/hw/pci/uart.c b/devicemodel/hw/pci/uart.c index c3bf821fc..2b4929041 100644 --- a/devicemodel/hw/pci/uart.c +++ b/devicemodel/hw/pci/uart.c @@ -122,7 +122,7 @@ pci_uart_init(struct vmctx *ctx, struct pci_vdev *dev, char *opts) vdev.io_addr[0] = pci_get_cfgdata32(dev, PCIR_BAR(0)); vdev.io_addr[1] = pci_get_cfgdata32(dev, PCIR_BAR(1)); *((uint32_t *)vdev.args) = vuart_idx; - err = vm_create_hv_vdev(ctx, &vdev); + err = vm_add_hv_vdev(ctx, &vdev); if (err) { pr_err("HV can't create vuart with vuart_idx=%d\n", vuart_idx); } @@ -156,7 +156,7 @@ pci_uart_deinit(struct vmctx *ctx, struct pci_vdev *dev, char *opts) emul_dev.dev_id.fields.vendor_id = COM_VENDOR; emul_dev.dev_id.fields.device_id = COM_DEV; emul_dev.slot = PCI_BDF(dev->bus, dev->slot, dev->func); - vm_destroy_hv_vdev(ctx, &emul_dev); + vm_remove_hv_vdev(ctx, &emul_dev); return; } diff --git a/devicemodel/include/public/vhm_ioctl_defs.h b/devicemodel/include/public/vhm_ioctl_defs.h index 99942b538..59770a11c 100644 --- a/devicemodel/include/public/vhm_ioctl_defs.h +++ b/devicemodel/include/public/vhm_ioctl_defs.h @@ -109,8 +109,8 @@ #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_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) +#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) /* Power management */ #define IC_ID_PM_BASE 0x60UL diff --git a/devicemodel/include/vmmapi.h b/devicemodel/include/vmmapi.h index 059097e24..a007fa4c4 100644 --- a/devicemodel/include/vmmapi.h +++ b/devicemodel/include/vmmapi.h @@ -136,8 +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); int vm_reset_ptdev_intx_info(struct vmctx *ctx, uint16_t virt_bdf, 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 vm_add_hv_vdev(struct vmctx *ctx, struct acrn_emul_dev *dev); +int vm_remove_hv_vdev(struct vmctx *ctx, struct acrn_emul_dev *dev); int acrn_parse_cpu_affinity(char *arg); int vm_create_vcpu(struct vmctx *ctx, uint16_t vcpu_id);