Skip to content

Commit 5b1852e

Browse files
jsun26intelwenlingz
authored andcommitted
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>
1 parent 2d4809e commit 5b1852e

File tree

7 files changed

+30
-5
lines changed

7 files changed

+30
-5
lines changed

hypervisor/arch/x86/Kconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,3 +304,8 @@ config ENFORCE_VALIDATED_ACPI_INFO
304304
config L1D_FLUSH_VMENTRY_ENABLED
305305
bool "Enable L1 cache flush before VM entry"
306306
default n
307+
308+
config MAX_KATA_VM_NUM
309+
int "Maximum number of Kata Containers in SOS"
310+
range 0 1
311+
default 0

hypervisor/common/hypercall.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ int32_t hcall_get_platform_info(struct acrn_vm *vm, uint64_t param)
121121

122122
platform_info.cpu_num = get_pcpu_nums();
123123
platform_info.max_vcpus_per_vm = CONFIG_MAX_VCPUS_PER_VM;
124+
platform_info.max_kata_containers = CONFIG_MAX_KATA_VM_NUM;
124125
if (copy_to_gpa(vm, &platform_info, param, sizeof(platform_info)) != 0) {
125126
pr_err("%s: Unable copy param to vm\n", __func__);
126127
ret = -1;

hypervisor/include/public/acrn_hv_defs.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,11 @@ struct hc_platform_info {
297297
/** Maximum vCPU number for one VM. */
298298
uint16_t max_vcpus_per_vm;
299299

300+
/** Maximum Kata container number in SOS VM */
301+
uint8_t max_kata_containers;
302+
300303
/** Align the size of Configuration info to 128Bytes. */
301-
uint8_t reserved1[126];
304+
uint8_t reserved1[125];
302305
} __aligned(8);
303306

304307
/**

hypervisor/scenarios/hybrid/vm_configurations.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#define DM_OWNED_GUEST_FLAG_MASK (GUEST_FLAG_SECURE_WORLD_ENABLED | GUEST_FLAG_LAPIC_PASSTHROUGH | \
1414
GUEST_FLAG_RT | GUEST_FLAG_IO_COMPLETION_POLLING)
1515

16-
#define CONFIG_MAX_VM_NUM 3U
16+
#define CONFIG_MAX_VM_NUM (3U + CONFIG_MAX_KATA_VM_NUM)
1717

1818
#define VM0_CONFIG_PCPU_BITMAP (PLUG_CPU(3))
1919
#define VM0_CONFIG_MEM_START_HPA 0x100000000UL

hypervisor/scenarios/industry/vm_configurations.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
#include <misc_cfg.h>
1111

12-
#define CONFIG_MAX_VM_NUM 4U
12+
#define CONFIG_MAX_VM_NUM (4U + CONFIG_MAX_KATA_VM_NUM)
1313

1414
/* Bits mask of guest flags that can be programmed by device model. Other bits are set by hypervisor only */
1515
#define DM_OWNED_GUEST_FLAG_MASK (GUEST_FLAG_SECURE_WORLD_ENABLED | GUEST_FLAG_LAPIC_PASSTHROUGH | \

hypervisor/scenarios/sdc/vm_configurations.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,21 @@ struct acrn_vm_config vm_configs[CONFIG_MAX_VM_NUM] = {
5252
.addr.port_base = INVALID_COM_BASE,
5353
}
5454

55-
}
55+
},
56+
#if CONFIG_MAX_KATA_VM_NUM > 0
57+
{
58+
.load_order = POST_LAUNCHED_VM,
59+
.uuid = {0xa7U, 0xadU, 0xa5U, 0x06U, 0x1aU, 0xb0U, 0x4bU, 0x6bU, \
60+
0xa0U, 0xdaU, 0xe5U, 0x13U, 0xcaU, 0x9bU, 0x8cU, 0x2fU},
61+
/* a7ada506-1ab0-4b6b-a0da-e513ca9b8c2f */
62+
.vuart[0] = {
63+
.type = VUART_LEGACY_PIO,
64+
.addr.port_base = INVALID_COM_BASE,
65+
},
66+
.vuart[1] = {
67+
.type = VUART_LEGACY_PIO,
68+
.addr.port_base = INVALID_COM_BASE,
69+
}
70+
},
71+
#endif
5672
};

hypervisor/scenarios/sdc/vm_configurations.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
#include <misc_cfg.h>
1111

12-
#define CONFIG_MAX_VM_NUM 2U
12+
#define CONFIG_MAX_VM_NUM (2U + CONFIG_MAX_KATA_VM_NUM)
1313

1414
/* Bits mask of guest flags that can be programmed by device model. Other bits are set by hypervisor only */
1515
#define DM_OWNED_GUEST_FLAG_MASK (GUEST_FLAG_SECURE_WORLD_ENABLED | GUEST_FLAG_LAPIC_PASSTHROUGH | \

0 commit comments

Comments
 (0)