diff --git a/devicemodel/core/vmmapi.c b/devicemodel/core/vmmapi.c index 88f38068c..6aafb6616 100644 --- a/devicemodel/core/vmmapi.c +++ b/devicemodel/core/vmmapi.c @@ -643,61 +643,3 @@ vm_irqfd(struct vmctx *ctx, struct acrn_irqfd *args) { return ioctl(ctx->fd, ACRN_IOCTL_IRQFD, args); } - -int -vm_get_config(struct vmctx *ctx, struct acrn_vm_config_header *vm_cfg, struct acrn_platform_info *plat_info) -{ - int i, err = 0; - int configs_size; - uint8_t *configs_buff = NULL; - struct acrn_vm_config_header *pcfg; - struct acrn_platform_info platform_info; - - if ((ctx == NULL) || (vm_cfg == NULL)) - return -1; - - /* The first IOCTL to get max_vm and vm_config size of a VM */ - bzero(&platform_info, sizeof(platform_info)); - err = ioctl(ctx->fd, ACRN_IOCTL_GET_PLATFORM_INFO, &platform_info); - if (err) { - pr_err("%s: IOCTL first time failed!\n", __func__); - goto exit; - } - - configs_size = platform_info.sw.max_vms * platform_info.sw.vm_config_size; - configs_buff = calloc(1, configs_size); - if (configs_buff == NULL) { - pr_err("%s, Allocate memory fail.\n", __func__); - return -1; - } - - platform_info.sw.vm_configs_addr = configs_buff; - err = ioctl(ctx->fd, ACRN_IOCTL_GET_PLATFORM_INFO, &platform_info); - if (err) { - pr_err("%s: IOCTL second time failed!\n", __func__); - goto exit; - } - - for (i = 0; i < platform_info.sw.max_vms; i++) { - pcfg = (struct acrn_vm_config_header *)(configs_buff + (i * platform_info.sw.vm_config_size)); - if (!strncmp(ctx->name, pcfg->name, strnlen(ctx->name, MAX_VM_NAME_LEN))) - break; - } - - if (i == platform_info.sw.max_vms) { - pr_err("%s, Not found target VM.\n", __func__); - err = -1; - goto exit; - } - - memcpy((void *)vm_cfg, (void *)pcfg, sizeof(struct acrn_vm_config_header)); - if (plat_info != NULL) { - memcpy((void *)plat_info, (void *)&platform_info, sizeof(struct acrn_platform_info)); - pr_info("%s, l2_cat_shift=%u, l3_cat_shift=%u\n", - __func__, platform_info.hw.l2_cat_shift, platform_info.hw.l3_cat_shift); - } - -exit: - free(configs_buff); - return err; -} diff --git a/devicemodel/include/public/hsm_ioctl_defs.h b/devicemodel/include/public/hsm_ioctl_defs.h index 3c89f4f21..3a617cc64 100644 --- a/devicemodel/include/public/hsm_ioctl_defs.h +++ b/devicemodel/include/public/hsm_ioctl_defs.h @@ -69,9 +69,6 @@ /* * Common IOCTL IDs definition for ACRN userspace */ -#define ACRN_IOCTL_GET_PLATFORM_INFO \ - _IOR(ACRN_IOCTL_TYPE, 0x03, struct acrn_platform_info) - #define ACRN_IOCTL_CREATE_VM \ _IOWR(ACRN_IOCTL_TYPE, 0x10, struct acrn_vm_creation) #define ACRN_IOCTL_DESTROY_VM \ @@ -223,45 +220,6 @@ struct acrn_ioreq_notify { }; #define ACRN_PLATFORM_LAPIC_IDS_MAX 64 -/** - * @brief - Information of a platform from hypervisor - * - * If vm_configs_addr is provided, the driver uses a bounce buffer (kmalloced - * for continuous memory region) to fetch VM configurations data from the - * hypervisor. - */ -struct acrn_platform_info { - struct { - /** Physical CPU number of the platform */ - __u16 cpu_num; - /** Version of this structure */ - __u16 version; - /** Order of the number of threads sharing L2 cache */ - __u32 l2_cat_shift; - /** Order of the number of threads sharing L3 cache */ - __u32 l3_cat_shift; - /** IDs of LAPICs of all threads */ - __u8 lapic_ids[ACRN_PLATFORM_LAPIC_IDS_MAX]; - /** Reserved for alignment and should be 0 */ - __u8 reserved[52]; - } hw; - - struct { - /** Maximum number of vCPU of a VM */ - __u16 max_vcpus_per_vm; - /** Maximum number of VM */ - __u16 max_vms; - /** Size of configuration of a VM */ - __u32 vm_config_size; - - /** Memory address which user space provided to - * store the VM configurations - */ - void *vm_configs_addr; - __u8 reserved[112]; - } sw; -}; - struct acrn_ioeventfd { #define ACRN_IOEVENTFD_FLAG_PIO 0x01 #define ACRN_IOEVENTFD_FLAG_DATAMATCH 0x02 diff --git a/devicemodel/include/vmmapi.h b/devicemodel/include/vmmapi.h index 523c2ef10..fdaa63e2b 100644 --- a/devicemodel/include/vmmapi.h +++ b/devicemodel/include/vmmapi.h @@ -150,6 +150,4 @@ void vm_reset_watchdog(struct vmctx *ctx); int vm_ioeventfd(struct vmctx *ctx, struct acrn_ioeventfd *args); int vm_irqfd(struct vmctx *ctx, struct acrn_irqfd *args); -int vm_get_config(struct vmctx *ctx, struct acrn_vm_config_header *vm_cfg, - struct acrn_platform_info *plat_info); #endif /* _VMMAPI_H_ */