dm: vmmapi: augment the vm_get_config() vmmapi to include a struct platform_info* parameter

This allows users to retrieve and use the requested platform_info information from hypervisor

Tracked-On: #6020
Reviewed-by: Wang, Yu1 <yu1.wang@intel.com>
Signed-off-by: dongshen <dongsheng.x.zhang@intel.com>
This commit is contained in:
dongshen 2021-05-19 17:33:03 -07:00 committed by wenlingz
parent 3e1fa0fb98
commit 6680208ed9
4 changed files with 25 additions and 5 deletions

View File

@ -712,7 +712,7 @@ vm_irqfd(struct vmctx *ctx, struct acrn_irqfd *args)
}
int
vm_get_config(struct vmctx *ctx, struct acrn_vm_config *vm_cfg)
vm_get_config(struct vmctx *ctx, struct acrn_vm_config *vm_cfg, struct platform_info *plat_info)
{
#define VM_CFG_BUFF_SIZE 0x8000
int i, err = 0;
@ -751,6 +751,9 @@ vm_get_config(struct vmctx *ctx, struct acrn_vm_config *vm_cfg)
}
memcpy((void *)vm_cfg, (void *)pcfg, sizeof(struct acrn_vm_config));
if (plat_info != NULL) {
memcpy((void *)plat_info, (void *)&platform_info, sizeof(struct platform_info));
}
exit:
free(configs_buff);

View File

@ -337,7 +337,7 @@ uint8_t *build_vrtct(struct vmctx *ctx, void *cfg)
vrtct->length = sizeof(struct acpi_table_hdr);
vrtct->checksum = 0;
if (vm_get_config(ctx, &vm_cfg)) {
if (vm_get_config(ctx, &vm_cfg, NULL)) {
pr_err("%s, get VM configuration fail.\n", __func__);
goto error;
}

View File

@ -329,8 +329,25 @@ struct platform_info {
/** version of this structure */
uint16_t version;
/** Align the size of version & hardware info to 128Bytes. */
uint8_t reserved0[124];
uint32_t l2_cat_shift;
uint32_t l3_cat_shift;
#define MAX_PLATFORM_LAPIC_IDS 64U
/** pLAPIC ID list */
uint8_t lapic_ids[MAX_PLATFORM_LAPIC_IDS];
/**
* sizeof(uint8_t reserved0[]) + sizeof(l2_cat_shift)
* + sizeof(l3_cat_shift) + sizeof(uint8_t lapic_ids[]) = 124
*
* Note:
* 1. DM needs to use the same logic as hypervisor to calculate vLAPIC IDs
* based on physical APIC IDs and CPU affinity setting.
*
* 2. Can only support at most 116 cores. And it assumes LAPIC ID is 8bits
* (X2APIC mode supports 32 bits)
*/
uint8_t reserved0[116U - MAX_PLATFORM_LAPIC_IDS];
/** Configuration Information */
/** Maximum vCPU number for one VM. */

View File

@ -151,5 +151,5 @@ 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 *vm_cfg);
int vm_get_config(struct vmctx *ctx, struct acrn_vm_config *vm_cfg, struct platform_info *plat_info);
#endif /* _VMMAPI_H_ */