HV: add kata support on sdc scenario

In current design, devicemodel passes VM UUID to create VMs and hypervisor
would check the UUID whether it is matched with the one in VM configurations.

Kata container would maintain few UUIDs to let ACRN launch the VM, so
hypervisor need to add these UUIDs in VM configurations for Kata running.
In the hypercall of hcall_get_platform_info(), hypervisor will report the
maximum Kata container number it will support. The patch will add a Kconfig
to indicate the maximum Kata container number that SOS could support.

In current stage, only one Kata container is supported by SOS on SDC scenario
so add one UUID for Kata container in SDC VM configuration. If we want to
support Kata on other scenarios in the future, we could follow the example
of this patch;

Tracked-On: #3402

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Victor Sun 2019-06-13 09:50:31 +08:00 committed by wenlingz
parent 2d4809e3b1
commit 5b1852e482
7 changed files with 30 additions and 5 deletions

View File

@ -304,3 +304,8 @@ config ENFORCE_VALIDATED_ACPI_INFO
config L1D_FLUSH_VMENTRY_ENABLED
bool "Enable L1 cache flush before VM entry"
default n
config MAX_KATA_VM_NUM
int "Maximum number of Kata Containers in SOS"
range 0 1
default 0

View File

@ -121,6 +121,7 @@ int32_t hcall_get_platform_info(struct acrn_vm *vm, uint64_t param)
platform_info.cpu_num = get_pcpu_nums();
platform_info.max_vcpus_per_vm = CONFIG_MAX_VCPUS_PER_VM;
platform_info.max_kata_containers = CONFIG_MAX_KATA_VM_NUM;
if (copy_to_gpa(vm, &platform_info, param, sizeof(platform_info)) != 0) {
pr_err("%s: Unable copy param to vm\n", __func__);
ret = -1;

View File

@ -297,8 +297,11 @@ struct hc_platform_info {
/** Maximum vCPU number for one VM. */
uint16_t max_vcpus_per_vm;
/** Maximum Kata container number in SOS VM */
uint8_t max_kata_containers;
/** Align the size of Configuration info to 128Bytes. */
uint8_t reserved1[126];
uint8_t reserved1[125];
} __aligned(8);
/**

View File

@ -13,7 +13,7 @@
#define DM_OWNED_GUEST_FLAG_MASK (GUEST_FLAG_SECURE_WORLD_ENABLED | GUEST_FLAG_LAPIC_PASSTHROUGH | \
GUEST_FLAG_RT | GUEST_FLAG_IO_COMPLETION_POLLING)
#define CONFIG_MAX_VM_NUM 3U
#define CONFIG_MAX_VM_NUM (3U + CONFIG_MAX_KATA_VM_NUM)
#define VM0_CONFIG_PCPU_BITMAP (PLUG_CPU(3))
#define VM0_CONFIG_MEM_START_HPA 0x100000000UL

View File

@ -9,7 +9,7 @@
#include <misc_cfg.h>
#define CONFIG_MAX_VM_NUM 4U
#define CONFIG_MAX_VM_NUM (4U + CONFIG_MAX_KATA_VM_NUM)
/* Bits mask of guest flags that can be programmed by device model. Other bits are set by hypervisor only */
#define DM_OWNED_GUEST_FLAG_MASK (GUEST_FLAG_SECURE_WORLD_ENABLED | GUEST_FLAG_LAPIC_PASSTHROUGH | \

View File

@ -52,5 +52,21 @@ struct acrn_vm_config vm_configs[CONFIG_MAX_VM_NUM] = {
.addr.port_base = INVALID_COM_BASE,
}
}
},
#if CONFIG_MAX_KATA_VM_NUM > 0
{
.load_order = POST_LAUNCHED_VM,
.uuid = {0xa7U, 0xadU, 0xa5U, 0x06U, 0x1aU, 0xb0U, 0x4bU, 0x6bU, \
0xa0U, 0xdaU, 0xe5U, 0x13U, 0xcaU, 0x9bU, 0x8cU, 0x2fU},
/* a7ada506-1ab0-4b6b-a0da-e513ca9b8c2f */
.vuart[0] = {
.type = VUART_LEGACY_PIO,
.addr.port_base = INVALID_COM_BASE,
},
.vuart[1] = {
.type = VUART_LEGACY_PIO,
.addr.port_base = INVALID_COM_BASE,
}
},
#endif
};

View File

@ -9,7 +9,7 @@
#include <misc_cfg.h>
#define CONFIG_MAX_VM_NUM 2U
#define CONFIG_MAX_VM_NUM (2U + CONFIG_MAX_KATA_VM_NUM)
/* Bits mask of guest flags that can be programmed by device model. Other bits are set by hypervisor only */
#define DM_OWNED_GUEST_FLAG_MASK (GUEST_FLAG_SECURE_WORLD_ENABLED | GUEST_FLAG_LAPIC_PASSTHROUGH | \