diff --git a/hypervisor/Makefile b/hypervisor/Makefile index e71f4f75a..d78f51e78 100644 --- a/hypervisor/Makefile +++ b/hypervisor/Makefile @@ -146,6 +146,7 @@ C_SRCS += arch/x86/configs/sharing_config.c else ifeq ($(CONFIG_PARTITION_MODE),y) C_SRCS += arch/x86/configs/partition_config.c C_SRCS += arch/x86/configs/$(CONFIG_BOARD)/ve820.c +C_SRCS += arch/x86/configs/$(CONFIG_BOARD)/pt_dev.c endif C_SRCS += boot/acpi.c diff --git a/hypervisor/arch/x86/configs/apl-mrb/partition_config.h b/hypervisor/arch/x86/configs/apl-mrb/partition_config.h new file mode 100644 index 000000000..f79a2a66c --- /dev/null +++ b/hypervisor/arch/x86/configs/apl-mrb/partition_config.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2019 Intel Corporation. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef PARTITION_CONFIG_H +#define PARTITION_CONFIG_H + +#define PRE_LAUNCH_VM_NUM 2 + +#define VM0_CONFIGURED + +#define VM0_CONFIG_NAME "PRE-LAUNCHED VM1 for APL-MRB" +#define VM0_CONFIG_TYPE PRE_LAUNCHED_VM +#define VM0_CONFIG_PCPU_BITMAP (PLUG_CPU(0) | PLUG_CPU(2)) +#define VM0_CONFIG_FLAGS IO_COMPLETION_POLLING +#define VM0_CONFIG_MEM_START_HPA 0x100000000UL +#define VM0_CONFIG_MEM_SIZE 0x20000000UL + +#define VM0_CONFIG_OS_NAME "ClearLinux 26600" +#define VM0_CONFIG_OS_BOOTARGS "root=/dev/sda3 rw rootwait noxsave maxcpus=2 nohpet console=hvc0 \ + console=ttyS2 no_timer_check ignore_loglevel log_buf_len=16M \ + consoleblank=0 tsc=reliable xapic_phys" + +#define VM1_CONFIGURED + +#define VM1_CONFIG_NAME "PRE-LAUNCHED VM2 for APL-MRB" +#define VM1_CONFIG_TYPE PRE_LAUNCHED_VM +#define VM1_CONFIG_PCPU_BITMAP (PLUG_CPU(1) | PLUG_CPU(3)) +#define VM1_CONFIG_FLAGS IO_COMPLETION_POLLING +#define VM1_CONFIG_MEM_START_HPA 0x120000000UL +#define VM1_CONFIG_MEM_SIZE 0x20000000UL + +#define VM1_CONFIG_OS_NAME "ClearLinux 26600" +#define VM1_CONFIG_OS_BOOTARGS "root=/dev/sda3 rw rootwait noxsave maxcpus=2 nohpet console=hvc0 \ + console=ttyS2 no_timer_check ignore_loglevel log_buf_len=16M \ + consoleblank=0 tsc=reliable xapic_phys" + +extern struct vpci_vdev_array vpci_vdev_array0, vpci_vdev_array1; + +#endif /* PARTITION_CONFIG_H */ diff --git a/hypervisor/arch/x86/configs/apl-mrb/pt_dev.c b/hypervisor/arch/x86/configs/apl-mrb/pt_dev.c new file mode 100644 index 000000000..c72503fed --- /dev/null +++ b/hypervisor/arch/x86/configs/apl-mrb/pt_dev.c @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2019 Intel Corporation. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include + +struct vpci_vdev_array vpci_vdev_array0 = { + .num_pci_vdev = 2, + + .vpci_vdev_list = { + {/*vdev 0: hostbridge */ + .vbdf.bits = {.b = 0x00U, .d = 0x00U, .f = 0x0U}, + .pbdf.bits = {.b = 0x00U, .d = 0x00U, .f = 0x0U}, + }, + + {/*vdev 1: SATA controller*/ + .vbdf.bits = {.b = 0x00U, .d = 0x01U, .f = 0x0U}, + .pbdf.bits = {.b = 0x00U, .d = 0x12U, .f = 0x0U}, + }, + } +}; + +struct vpci_vdev_array vpci_vdev_array1 = { + .num_pci_vdev = 3, + + .vpci_vdev_list = { + {/*vdev 0: hostbridge*/ + .vbdf.bits = {.b = 0x00U, .d = 0x00U, .f = 0x0U}, + .pbdf.bits = {.b = 0x00U, .d = 0x00U, .f = 0x0U}, + }, + + {/*vdev 1: USB controller*/ + .vbdf.bits = {.b = 0x00U, .d = 0x01U, .f = 0x0U}, + .pbdf.bits = {.b = 0x00U, .d = 0x15U, .f = 0x0U}, + }, + + {/*vdev 2: Ethernet*/ + .vbdf.bits = {.b = 0x00U, .d = 0x02U, .f = 0x0U}, + .pbdf.bits = {.b = 0x02U, .d = 0x00U, .f = 0x0U}, + }, + } +}; diff --git a/hypervisor/arch/x86/configs/dnv-cb2/partition_config.h b/hypervisor/arch/x86/configs/dnv-cb2/partition_config.h new file mode 100644 index 000000000..9390922e4 --- /dev/null +++ b/hypervisor/arch/x86/configs/dnv-cb2/partition_config.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2019 Intel Corporation. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef PARTITION_CONFIG_H +#define PARTITION_CONFIG_H + +#define PRE_LAUNCH_VM_NUM 2 + +#define VM0_CONFIGURED + +#define VM0_CONFIG_NAME "PRE-LAUNCHED VM1 for DNV-CB2" +#define VM0_CONFIG_TYPE PRE_LAUNCHED_VM +#define VM0_CONFIG_PCPU_BITMAP (PLUG_CPU(0) | PLUG_CPU(2) | PLUG_CPU(4) | PLUG_CPU(6)) +#define VM0_CONFIG_FLAGS LAPIC_PASSTHROUGH | IO_COMPLETION_POLLING +#define VM0_CONFIG_MEM_START_HPA 0x100000000UL +#define VM0_CONFIG_MEM_SIZE 0x80000000UL + +#define VM0_CONFIG_OS_NAME "ClearLinux 26600" +#define VM0_CONFIG_OS_BOOTARGS "root=/dev/sda rw rootwait noxsave maxcpus=4 nohpet console=hvc0 " \ + "console=ttyS0 no_timer_check ignore_loglevel log_buf_len=16M "\ + "consoleblank=0 tsc=reliable xapic_phys apic_debug" + +#define VM1_CONFIGURED + +#define VM1_CONFIG_NAME "PRE-LAUNCHED VM2 for DNV-CB2" +#define VM1_CONFIG_TYPE PRE_LAUNCHED_VM +#define VM1_CONFIG_PCPU_BITMAP (PLUG_CPU(1) | PLUG_CPU(3) | PLUG_CPU(5) | PLUG_CPU(7)) +#define VM1_CONFIG_FLAGS LAPIC_PASSTHROUGH | IO_COMPLETION_POLLING +#define VM1_CONFIG_MEM_START_HPA 0x180000000UL +#define VM1_CONFIG_MEM_SIZE 0x80000000UL + +#define VM1_CONFIG_OS_NAME "ClearLinux 26600" +#define VM1_CONFIG_OS_BOOTARGS "root=/dev/sda2 rw rootwait noxsave maxcpus=4 nohpet console=hvc0 "\ + "console=ttyS0 no_timer_check ignore_loglevel log_buf_len=16M "\ + "consoleblank=0 tsc=reliable xapic_phys apic_debug" + +extern struct vpci_vdev_array vpci_vdev_array0, vpci_vdev_array1; + +#endif /* PARTITION_CONFIG_H */ diff --git a/hypervisor/arch/x86/configs/dnv-cb2/pt_dev.c b/hypervisor/arch/x86/configs/dnv-cb2/pt_dev.c new file mode 100644 index 000000000..a4dfbdfd5 --- /dev/null +++ b/hypervisor/arch/x86/configs/dnv-cb2/pt_dev.c @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2019 Intel Corporation. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include + +struct vpci_vdev_array vpci_vdev_array0 = { + .num_pci_vdev = 3, + + .vpci_vdev_list = { + {/*vdev 0: hostbridge */ + .vbdf.bits = {.b = 0x00U, .d = 0x00U, .f = 0x0U}, + .pbdf.bits = {.b = 0x00U, .d = 0x00U, .f = 0x0U}, + }, + + {/*vdev 1: Ethernet*/ + .vbdf.bits = {.b = 0x00U, .d = 0x01U, .f = 0x0U}, + .pbdf.bits = {.b = 0x03U, .d = 0x00U, .f = 0x1U}, + }, + + {/*vdev 2: USB*/ + .vbdf.bits = {.b = 0x00U, .d = 0x02U, .f = 0x0U}, + .pbdf.bits = {.b = 0x00U, .d = 0x15U, .f = 0x0U}, + }, + } +}; + +struct vpci_vdev_array vpci_vdev_array1 = { + .num_pci_vdev = 3, + + .vpci_vdev_list = { + {/*vdev 0: hostbridge*/ + .vbdf.bits = {.b = 0x00U, .d = 0x00U, .f = 0x0U}, + .pbdf.bits = {.b = 0x00U, .d = 0x00U, .f = 0x0U}, + }, + + {/*vdev 1: SATA controller*/ + .vbdf.bits = {.b = 0x00U, .d = 0x05U, .f = 0x0U}, + .pbdf.bits = {.b = 0x00U, .d = 0x14U, .f = 0x0U}, + }, + + {/*vdev 2: Ethernet*/ + .vbdf.bits = {.b = 0x00U, .d = 0x06U, .f = 0x0U}, + .pbdf.bits = {.b = 0x03U, .d = 0x00U, .f = 0x0U}, + }, + } +}; diff --git a/hypervisor/arch/x86/configs/partition_config.c b/hypervisor/arch/x86/configs/partition_config.c index b54d91371..78b0ea7cb 100644 --- a/hypervisor/arch/x86/configs/partition_config.c +++ b/hypervisor/arch/x86/configs/partition_config.c @@ -1,10 +1,44 @@ /* - * Copyright (C) 2018 Intel Corporation. All rights reserved. + * Copyright (C) 2019 Intel Corporation. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ #include +#include + +#define INIT_VM_CONFIG(idx) \ + { \ + .type = VM##idx##_CONFIG_TYPE, \ + .name = VM##idx##_CONFIG_NAME, \ + .pcpu_bitmap = VM##idx##_CONFIG_PCPU_BITMAP, \ + .guest_flags = VM##idx##_CONFIG_FLAGS, \ + .memory = { \ + .start_hpa = VM##idx##_CONFIG_MEM_START_HPA, \ + .size = VM##idx##_CONFIG_MEM_SIZE, \ + }, \ + .os_config = { \ + .name = VM##idx##_CONFIG_OS_NAME, \ + .bootargs = VM##idx##_CONFIG_OS_BOOTARGS, \ + }, \ + .vm_vuart = true, \ + .vpci_vdev_array = &vpci_vdev_array##idx, \ + }, struct acrn_vm_config vm_configs[CONFIG_MAX_VM_NUM] __aligned(PAGE_SIZE) = { +#ifdef VM0_CONFIGURED + INIT_VM_CONFIG(0) +#endif + +#ifdef VM1_CONFIGURED + INIT_VM_CONFIG(1) +#endif + +#ifdef VM2_CONFIGURED + INIT_VM_CONFIG(2) +#endif + +#ifdef VM3_CONFIGURED + INIT_VM_CONFIG(3) +#endif };