diff --git a/hypervisor/arch/x86/Kconfig b/hypervisor/arch/x86/Kconfig index 7acd1db80..73ddc6557 100644 --- a/hypervisor/arch/x86/Kconfig +++ b/hypervisor/arch/x86/Kconfig @@ -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 diff --git a/hypervisor/common/hypercall.c b/hypervisor/common/hypercall.c index e2159e2c3..453537275 100644 --- a/hypervisor/common/hypercall.c +++ b/hypervisor/common/hypercall.c @@ -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; diff --git a/hypervisor/include/public/acrn_hv_defs.h b/hypervisor/include/public/acrn_hv_defs.h index 5a4abafcc..1c5b1ab07 100644 --- a/hypervisor/include/public/acrn_hv_defs.h +++ b/hypervisor/include/public/acrn_hv_defs.h @@ -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); /** diff --git a/hypervisor/scenarios/hybrid/vm_configurations.h b/hypervisor/scenarios/hybrid/vm_configurations.h index 60c2ead4f..db0a3dfa1 100644 --- a/hypervisor/scenarios/hybrid/vm_configurations.h +++ b/hypervisor/scenarios/hybrid/vm_configurations.h @@ -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 diff --git a/hypervisor/scenarios/industry/vm_configurations.h b/hypervisor/scenarios/industry/vm_configurations.h index ea86e93a3..f68d3290e 100644 --- a/hypervisor/scenarios/industry/vm_configurations.h +++ b/hypervisor/scenarios/industry/vm_configurations.h @@ -9,7 +9,7 @@ #include -#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 | \ diff --git a/hypervisor/scenarios/sdc/vm_configurations.c b/hypervisor/scenarios/sdc/vm_configurations.c index 12db9a511..fcc0559d8 100644 --- a/hypervisor/scenarios/sdc/vm_configurations.c +++ b/hypervisor/scenarios/sdc/vm_configurations.c @@ -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 }; diff --git a/hypervisor/scenarios/sdc/vm_configurations.h b/hypervisor/scenarios/sdc/vm_configurations.h index 7bb9a2d1c..c2c44b410 100644 --- a/hypervisor/scenarios/sdc/vm_configurations.h +++ b/hypervisor/scenarios/sdc/vm_configurations.h @@ -9,7 +9,7 @@ #include -#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 | \