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:
parent
3deb973b7a
commit
7efe18a84b
|
@ -186,7 +186,7 @@ static void get_cache_shift(uint32_t *l2_shift, uint32_t *l3_shift)
|
|||
* for the current platform.
|
||||
*
|
||||
* @param vcpu Pointer to vCPU that initiates the hypercall.
|
||||
* @param param1 GPA pointer to struct hc_platform_info.
|
||||
* @param param1 GPA pointer to struct acrn_platform_info.
|
||||
*
|
||||
* @pre is_sos_vm(vcpu->vm)
|
||||
* @return 0 on success, non zero in case of error.
|
||||
|
@ -195,7 +195,7 @@ int32_t hcall_get_platform_info(struct acrn_vcpu *vcpu, __unused struct acrn_vm
|
|||
uint64_t param1, __unused uint64_t param2)
|
||||
{
|
||||
struct acrn_vm *vm = vcpu->vm;
|
||||
struct hc_platform_info pi = { 0 };
|
||||
struct acrn_platform_info pi = { 0 };
|
||||
uint32_t entry_size = sizeof(struct acrn_vm_config);
|
||||
int32_t ret;
|
||||
|
||||
|
@ -205,22 +205,22 @@ int32_t hcall_get_platform_info(struct acrn_vcpu *vcpu, __unused struct acrn_vm
|
|||
uint16_t i;
|
||||
uint16_t pcpu_nums = get_pcpu_nums();
|
||||
|
||||
get_cache_shift(&pi.l2_cat_shift, &pi.l3_cat_shift);
|
||||
get_cache_shift(&pi.hw.l2_cat_shift, &pi.hw.l3_cat_shift);
|
||||
|
||||
for (i = 0U; i < min(pcpu_nums, MAX_PLATFORM_LAPIC_IDS); i++) {
|
||||
pi.lapic_ids[i] = per_cpu(lapic_id, i);
|
||||
for (i = 0U; i < min(pcpu_nums, ACRN_PLATFORM_LAPIC_IDS_MAX); i++) {
|
||||
pi.hw.lapic_ids[i] = per_cpu(lapic_id, i);
|
||||
}
|
||||
|
||||
pi.cpu_num = pcpu_nums;
|
||||
pi.version = 0x100; /* version 1.0; byte[1:0] = major:minor version */
|
||||
pi.max_vcpus_per_vm = MAX_VCPUS_PER_VM;
|
||||
pi.max_kata_containers = CONFIG_MAX_KATA_VM_NUM;
|
||||
pi.max_vms = CONFIG_MAX_VM_NUM;
|
||||
pi.vm_config_entry_size = entry_size;
|
||||
pi.hw.cpu_num = pcpu_nums;
|
||||
pi.hw.version = 0x100; /* version 1.0; byte[1:0] = major:minor version */
|
||||
pi.sw.max_vcpus_per_vm = MAX_VCPUS_PER_VM;
|
||||
pi.sw.max_kata_containers = CONFIG_MAX_KATA_VM_NUM;
|
||||
pi.sw.max_vms = CONFIG_MAX_VM_NUM;
|
||||
pi.sw.vm_config_size = entry_size;
|
||||
|
||||
/* If it wants to get the vm_configs info */
|
||||
if (pi.vm_configs_addr != 0UL) {
|
||||
ret = copy_to_gpa(vm, (void *)get_vm_config(0U), pi.vm_configs_addr, entry_size * pi.max_vms);
|
||||
if (pi.sw.vm_configs_addr != 0UL) {
|
||||
ret = copy_to_gpa(vm, (void *)get_vm_config(0U), pi.sw.vm_configs_addr, entry_size * pi.sw.max_vms);
|
||||
}
|
||||
|
||||
if (ret == 0) {
|
||||
|
|
|
@ -61,7 +61,7 @@ int32_t hcall_get_api_version(struct acrn_vcpu *vcpu, struct acrn_vm *target_vm,
|
|||
*
|
||||
* @param vcpu Pointer to vCPU that initiates the hypercall.
|
||||
* @param target_vm not used
|
||||
* @param param1 GPA pointer to struct hc_platform_info.
|
||||
* @param param1 GPA pointer to struct acrn_platform_info.
|
||||
* @param param2 not used
|
||||
*
|
||||
* @pre is_sos_vm(vcpu->vm)
|
||||
|
|
|
@ -379,23 +379,23 @@ 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 */
|
||||
struct {
|
||||
/** Physical CPU number */
|
||||
uint16_t cpu_num;
|
||||
|
||||
/** version of this structure */
|
||||
uint16_t version;
|
||||
|
||||
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];
|
||||
uint8_t lapic_ids[ACRN_PLATFORM_LAPIC_IDS_MAX];
|
||||
|
||||
/**
|
||||
* sizeof(uint8_t reserved0[]) + sizeof(l2_cat_shift)
|
||||
|
@ -408,26 +408,21 @@ struct hc_platform_info {
|
|||
* 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];
|
||||
uint8_t reserved[52];
|
||||
} hw;
|
||||
|
||||
/** Configuration Information */
|
||||
struct {
|
||||
/** Maximum vCPU number for one VM. */
|
||||
uint16_t max_vcpus_per_vm;
|
||||
|
||||
/** Maximum Kata container number in SOS VM */
|
||||
uint8_t max_kata_containers;
|
||||
|
||||
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;
|
||||
uint32_t vm_config_size;
|
||||
|
||||
/**
|
||||
* Address to an array of struct acrn_vm_config, containing all
|
||||
|
@ -439,8 +434,11 @@ struct hc_platform_info {
|
|||
*/
|
||||
uint64_t vm_configs_addr;
|
||||
|
||||
/** Maximum Kata container number in SOS VM */
|
||||
uint64_t max_kata_containers;
|
||||
/** Align the size of Configuration info to 128Bytes. */
|
||||
uint8_t reserved2[104];
|
||||
uint8_t reserved[104];
|
||||
} sw;
|
||||
} __aligned(8);
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue