mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-21 13:08:42 +00:00
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:
parent
3e1fa0fb98
commit
6680208ed9
@ -712,7 +712,7 @@ vm_irqfd(struct vmctx *ctx, struct acrn_irqfd *args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
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
|
#define VM_CFG_BUFF_SIZE 0x8000
|
||||||
int i, err = 0;
|
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));
|
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:
|
exit:
|
||||||
free(configs_buff);
|
free(configs_buff);
|
||||||
|
@ -337,7 +337,7 @@ uint8_t *build_vrtct(struct vmctx *ctx, void *cfg)
|
|||||||
vrtct->length = sizeof(struct acpi_table_hdr);
|
vrtct->length = sizeof(struct acpi_table_hdr);
|
||||||
vrtct->checksum = 0;
|
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__);
|
pr_err("%s, get VM configuration fail.\n", __func__);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
@ -329,8 +329,25 @@ struct platform_info {
|
|||||||
/** version of this structure */
|
/** version of this structure */
|
||||||
uint16_t version;
|
uint16_t version;
|
||||||
|
|
||||||
/** Align the size of version & hardware info to 128Bytes. */
|
uint32_t l2_cat_shift;
|
||||||
uint8_t reserved0[124];
|
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 */
|
/** Configuration Information */
|
||||||
/** Maximum vCPU number for one VM. */
|
/** Maximum vCPU number for one VM. */
|
||||||
|
@ -151,5 +151,5 @@ void vm_reset_watchdog(struct vmctx *ctx);
|
|||||||
|
|
||||||
int vm_ioeventfd(struct vmctx *ctx, struct acrn_ioeventfd *args);
|
int vm_ioeventfd(struct vmctx *ctx, struct acrn_ioeventfd *args);
|
||||||
int vm_irqfd(struct vmctx *ctx, struct acrn_irqfd *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_ */
|
#endif /* _VMMAPI_H_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user