hv: Use new struct acrn_platform_info to adapt new HSM driver

struct hc_platform_info	->	struct acrn_platform_info
MAX_PLATFORM_LAPIC_IDS	->	ACRN_PLATFORM_LAPIC_IDS_MAX

A layout change to the struct hc_platform_info is that move
max_kata_containers to back of vm_config_size,
		uint16_t max_vcpus_per_vm;
		uint16_t max_vms;
		uint32_t vm_config_size;
		uint64_t max_kata_containers;
Then, they are nature 64-bits aligned.

Tracked-On: #6282
Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
This commit is contained in:
Shuo A Liu
2021-07-07 11:30:48 +08:00
committed by wenlingz
parent 3deb973b7a
commit 7efe18a84b
3 changed files with 63 additions and 65 deletions

View File

@@ -379,68 +379,66 @@ struct hc_api_version {
uint32_t minor_version;
} __aligned(8);
#define ACRN_PLATFORM_LAPIC_IDS_MAX 64
/**
* Hypervisor API, return it for HC_GET_PLATFORM_INFO hypercall
*/
struct hc_platform_info {
struct acrn_platform_info {
/** Hardware Information */
/** Physical CPU number */
uint16_t cpu_num;
struct {
/** Physical CPU number */
uint16_t cpu_num;
/** version of this structure */
uint16_t version;
/** version of this structure */
uint16_t version;
uint32_t l2_cat_shift;
uint32_t l3_cat_shift;
uint32_t l2_cat_shift;
uint32_t l3_cat_shift;
/** pLAPIC ID list */
uint8_t lapic_ids[ACRN_PLATFORM_LAPIC_IDS_MAX];
#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];
/**
* 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 reserved[52];
} hw;
/** Configuration Information */
/** Maximum vCPU number for one VM. */
uint16_t max_vcpus_per_vm;
struct {
/** Maximum vCPU number for one VM. */
uint16_t max_vcpus_per_vm;
/** Number of configured VMs */
uint16_t max_vms;
/**
* The size of acrn_vm_config is various on different platforms.
* This is the size of this struct which is used by the caller
* to parse the vm_configs array.
*/
uint32_t vm_config_size;
/** Maximum Kata container number in SOS VM */
uint8_t max_kata_containers;
/**
* Address to an array of struct acrn_vm_config, containing all
* the configurations of all VMs. VHM treats it as an opague data
* structure.
*
* The size of one array element is vm_config_entry_size while
* the number of elements is max_vms.
*/
uint64_t vm_configs_addr;
uint8_t reserved1[7];
/** Number of configured VMs */
uint16_t max_vms;
/**
* The size of acrn_vm_config is various on different platforms.
* This is the size of this struct which is used by the caller
* to parse the vm_configs array.
*/
uint32_t vm_config_entry_size;
/**
* Address to an array of struct acrn_vm_config, containing all
* the configurations of all VMs. VHM treats it as an opague data
* structure.
*
* The size of one array element is vm_config_entry_size while
* the number of elements is max_vms.
*/
uint64_t vm_configs_addr;
/** Align the size of Configuration info to 128Bytes. */
uint8_t reserved2[104];
/** Maximum Kata container number in SOS VM */
uint64_t max_kata_containers;
/** Align the size of Configuration info to 128Bytes. */
uint8_t reserved[104];
} sw;
} __aligned(8);
/**