diff --git a/hypervisor/include/arch/x86/board.h b/hypervisor/include/arch/x86/board.h index 0c73d0822..66f428b37 100644 --- a/hypervisor/include/arch/x86/board.h +++ b/hypervisor/include/arch/x86/board.h @@ -30,7 +30,7 @@ extern struct dmar_info plat_dmar_info; #ifdef CONFIG_RDT_ENABLED extern struct platform_clos_info platform_l2_clos_array[MAX_PLATFORM_CLOS_NUM]; extern struct platform_clos_info platform_l3_clos_array[MAX_PLATFORM_CLOS_NUM]; -extern struct platform_clos_info platform_mba_clos_array[MAX_PLATFORM_CLOS_NUM]; +extern struct platform_clos_info platform_mba_clos_array[MAX_MBA_CLOS_NUM_ENTRIES]; #endif extern const struct cpu_state_table board_cpu_state_tbl; diff --git a/hypervisor/include/arch/x86/page.h b/hypervisor/include/arch/x86/page.h index 78caf47b4..26dba2e55 100644 --- a/hypervisor/include/arch/x86/page.h +++ b/hypervisor/include/arch/x86/page.h @@ -7,7 +7,7 @@ #ifndef PAGE_H #define PAGE_H -#include +#include #define PAGE_SHIFT 12U #define PAGE_SIZE (1U << PAGE_SHIFT) @@ -31,14 +31,14 @@ * - Guest OS won't re-program device MMIO bars to the address not covered by * this EPT_ADDRESS_SPACE. */ -#define EPT_ADDRESS_SPACE(size) ((size > MEM_2G) ? \ +#define EPT_ADDRESS_SPACE(size) (((size) > MEM_2G) ? \ ((size) + PLATFORM_LO_MMIO_SIZE + PLATFORM_HI_MMIO_SIZE) \ : (MEM_2G + PLATFORM_LO_MMIO_SIZE + PLATFORM_HI_MMIO_SIZE)) #define PTDEV_HI_MMIO_START ((CONFIG_UOS_RAM_SIZE > MEM_2G) ? \ (CONFIG_UOS_RAM_SIZE + PLATFORM_LO_MMIO_SIZE) : (MEM_2G + PLATFORM_LO_MMIO_SIZE)) -#define PRE_VM_EPT_ADDRESS_SPACE(size) (PTDEV_HI_MMIO_START + PTDEV_HI_MMIO_SIZE) +#define PRE_VM_EPT_ADDRESS_SPACE(size) (PTDEV_HI_MMIO_START + HI_MMIO_SIZE) #define TOTAL_EPT_4K_PAGES_SIZE (PRE_VM_NUM*(PT_PAGE_NUM(PRE_VM_EPT_ADDRESS_SPACE(CONFIG_UOS_RAM_SIZE))*MEM_4K)) + \ (SOS_VM_NUM*(PT_PAGE_NUM(EPT_ADDRESS_SPACE(CONFIG_SOS_RAM_SIZE))*MEM_4K)) + \ diff --git a/hypervisor/scenarios/sdc/vm_configurations.c b/hypervisor/scenarios/sdc/vm_configurations.c deleted file mode 100644 index 70ff7f592..000000000 --- a/hypervisor/scenarios/sdc/vm_configurations.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2018 Intel Corporation. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include -#include -#include - -struct acrn_vm_config vm_configs[CONFIG_MAX_VM_NUM] = { - { /* VM0 */ - CONFIG_SOS_VM, - .name = "ACRN SOS VM", - - /* Allow SOS to reboot the host since there is supposed to be the highest severity guest */ - .guest_flags = 0UL, - .memory = { - .start_hpa = 0UL, - .size = CONFIG_SOS_RAM_SIZE, - }, - .os_config = { - .name = "ACRN Service OS", - .kernel_type = KERNEL_BZIMAGE, - .kernel_mod_tag = "Linux_bzImage", - .bootargs = SOS_VM_BOOTARGS, - }, - .vuart[0] = { - .type = VUART_LEGACY_PIO, - .addr.port_base = SOS_COM1_BASE, - .irq = SOS_COM1_IRQ, - }, - .vuart[1] = { - .type = VUART_LEGACY_PIO, - .addr.port_base = INVALID_COM_BASE, - }, - }, - { /* VM1 */ - CONFIG_POST_STD_VM(1), - .cpu_affinity = VM1_CONFIG_CPU_AFFINITY, - .vuart[0] = { - .type = VUART_LEGACY_PIO, - .addr.port_base = INVALID_COM_BASE, - }, - .vuart[1] = { - .type = VUART_LEGACY_PIO, - .addr.port_base = INVALID_COM_BASE, - } - - }, -#if CONFIG_MAX_KATA_VM_NUM > 0 - { /* VM2 */ - CONFIG_KATA_VM(1), - .cpu_affinity = VM2_CONFIG_CPU_AFFINITY, - .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 deleted file mode 100644 index ab9456e79..000000000 --- a/hypervisor/scenarios/sdc/vm_configurations.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2018 Intel Corporation. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef VM_CONFIGURATIONS_H -#define VM_CONFIGURATIONS_H - -#include - -/* SOS_VM_NUM can only be 0U or 1U; - * When SOS_VM_NUM is 0U, MAX_POST_VM_NUM must be 0U too; - * MAX_POST_VM_NUM must be bigger than CONFIG_MAX_KATA_VM_NUM; - */ -#define PRE_VM_NUM 0U -#define SOS_VM_NUM 1U -#define MAX_POST_VM_NUM 2U /* including 1 KATA VM */ -#define CONFIG_MAX_KATA_VM_NUM 1U - -/* 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 | \ - GUEST_FLAG_RT | GUEST_FLAG_IO_COMPLETION_POLLING) - -#define SOS_VM_BOOTARGS SOS_ROOTFS \ - "rw rootwait " \ - "console=tty0 " \ - SOS_CONSOLE \ - "consoleblank=0 " \ - "no_timer_check " \ - "quiet loglevel=3 " \ - "i915.nuclear_pageflip=1 " \ - "i915.avail_planes_per_pipe=0x01010F " \ - "i915.domain_plane_owners=0x011111110000 " \ - "i915.enable_gvt=1 " \ - SOS_IDLE \ - SOS_BOOTARGS_DIFF - -#if CONFIG_MAX_KATA_VM_NUM > 0 - #define VM1_CONFIG_CPU_AFFINITY (AFFINITY_CPU(1U) | AFFINITY_CPU(2U)) - #define VM2_CONFIG_CPU_AFFINITY (AFFINITY_CPU(3U)) -#else - #define VM1_CONFIG_CPU_AFFINITY (AFFINITY_CPU(1U) | AFFINITY_CPU(2U) | AFFINITY_CPU(3U)) -#endif -#endif /* VM_CONFIGURATIONS_H */ diff --git a/hypervisor/arch/x86/configs/nuc7i7dnb/board.c b/misc/vm_configs/boards/nuc7i7dnb/board.c similarity index 100% rename from hypervisor/arch/x86/configs/nuc7i7dnb/board.c rename to misc/vm_configs/boards/nuc7i7dnb/board.c diff --git a/misc/vm_configs/boards/nuc7i7dnb/board_info.h b/misc/vm_configs/boards/nuc7i7dnb/board_info.h new file mode 100644 index 000000000..38c8417e8 --- /dev/null +++ b/misc/vm_configs/boards/nuc7i7dnb/board_info.h @@ -0,0 +1,20 @@ +/* + * Copyright (C) 2020 Intel Corporation. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef BOARD_INFO_H +#define BOARD_INFO_H + +#define MAX_PCPU_NUM 4U +#define MAX_PLATFORM_CLOS_NUM 0U +#define MAX_MBA_CLOS_NUM_ENTRIES 0U +#define MAX_VMSIX_ON_MSI_PDEVS_NUM 0U +#define MAX_HIDDEN_PDEVS_NUM 0U + +#define HI_MMIO_START ~0UL +#define HI_MMIO_END 0UL +#define HI_MMIO_SIZE 0x0UL + +#endif /* BOARD_INFO_H */ diff --git a/hypervisor/arch/x86/configs/nuc7i7dnb/pci_devices.h b/misc/vm_configs/boards/nuc7i7dnb/pci_devices.h similarity index 55% rename from hypervisor/arch/x86/configs/nuc7i7dnb/pci_devices.h rename to misc/vm_configs/boards/nuc7i7dnb/pci_devices.h index ad3061f49..9ca190708 100644 --- a/hypervisor/arch/x86/configs/nuc7i7dnb/pci_devices.h +++ b/misc/vm_configs/boards/nuc7i7dnb/pci_devices.h @@ -9,18 +9,12 @@ #define PTDEV_HI_MMIO_SIZE 0xe00000UL -#define SATA_CONTROLLER_0 .pbdf.bits = {.b = 0x00U, .d = 0x17U, .f = 0x00U}, \ - .vbar_base[0] = PTDEV_HI_MMIO_START + 0x200000UL, \ - .vbar_base[1] = PTDEV_HI_MMIO_START + 0x400000UL, \ - .vbar_base[5] = PTDEV_HI_MMIO_START + 0x600000UL +#define SATA_CONTROLLER_0 .pbdf.bits = {.b = 0x00U, .d = 0x17U, .f = 0x00U} -#define USB_CONTROLLER_0 .pbdf.bits = {.b = 0x00U, .d = 0x14U, .f = 0x00U}, \ - .vbar_base[0] = PTDEV_HI_MMIO_START + 0x800000UL +#define USB_CONTROLLER_0 .pbdf.bits = {.b = 0x00U, .d = 0x14U, .f = 0x00U} -#define ETHERNET_CONTROLLER_0 .pbdf.bits = {.b = 0x00U, .d = 0x1fU, .f = 0x06U}, \ - .vbar_base[0] = PTDEV_HI_MMIO_START + 0xa00000UL +#define ETHERNET_CONTROLLER_0 .pbdf.bits = {.b = 0x00U, .d = 0x1fU, .f = 0x06U} -#define NETWORK_CONTROLLER_0 .pbdf.bits = {.b = 0x01U, .d = 0x00U, .f = 0x00U}, \ - .vbar_base[0] = PTDEV_HI_MMIO_START + 0xc00000UL +#define NETWORK_CONTROLLER_0 .pbdf.bits = {.b = 0x01U, .d = 0x00U, .f = 0x00U} #endif /* PCI_DEVICES_H_ */ diff --git a/hypervisor/arch/x86/configs/nuc7i7dnb/platform_acpi_info.h b/misc/vm_configs/boards/nuc7i7dnb/platform_acpi_info.h similarity index 100% rename from hypervisor/arch/x86/configs/nuc7i7dnb/platform_acpi_info.h rename to misc/vm_configs/boards/nuc7i7dnb/platform_acpi_info.h diff --git a/hypervisor/arch/x86/configs/nuc7i7dnb/misc_cfg.h b/misc/vm_configs/scenarios/hybrid/nuc7i7dnb/misc_cfg.h similarity index 75% rename from hypervisor/arch/x86/configs/nuc7i7dnb/misc_cfg.h rename to misc/vm_configs/scenarios/hybrid/nuc7i7dnb/misc_cfg.h index 91b730318..c8bacaecb 100644 --- a/hypervisor/arch/x86/configs/nuc7i7dnb/misc_cfg.h +++ b/misc/vm_configs/scenarios/hybrid/nuc7i7dnb/misc_cfg.h @@ -7,10 +7,6 @@ #ifndef MISC_CFG_H #define MISC_CFG_H -#define MAX_PCPU_NUM 4U -#define MAX_PLATFORM_CLOS_NUM 0U -#define MAX_VMSIX_ON_MSI_PDEVS_NUM 0U - #define ROOTFS_0 "root=/dev/sda3 " #define ROOTFS_1 "root=/dev/nvme0n1p3 " @@ -27,10 +23,4 @@ #define SOS_BOOTARGS_DIFF "" #endif -#define MAX_HIDDEN_PDEVS_NUM 0U - -#define HI_MMIO_START ~0UL -#define HI_MMIO_END 0UL - - #endif /* MISC_CFG_H */ diff --git a/hypervisor/arch/x86/configs/nuc7i7dnb.config b/misc/vm_configs/scenarios/hybrid/nuc7i7dnb/nuc7i7dnb.config similarity index 100% rename from hypervisor/arch/x86/configs/nuc7i7dnb.config rename to misc/vm_configs/scenarios/hybrid/nuc7i7dnb/nuc7i7dnb.config diff --git a/hypervisor/scenarios/hybrid/vm_configurations.c b/misc/vm_configs/scenarios/hybrid/vm_configurations.c similarity index 100% rename from hypervisor/scenarios/hybrid/vm_configurations.c rename to misc/vm_configs/scenarios/hybrid/vm_configurations.c diff --git a/hypervisor/scenarios/hybrid/vm_configurations.h b/misc/vm_configs/scenarios/hybrid/vm_configurations.h similarity index 100% rename from hypervisor/scenarios/hybrid/vm_configurations.h rename to misc/vm_configs/scenarios/hybrid/vm_configurations.h diff --git a/misc/vm_configs/scenarios/industry/nuc7i7dnb/misc_cfg.h b/misc/vm_configs/scenarios/industry/nuc7i7dnb/misc_cfg.h new file mode 100644 index 000000000..c8bacaecb --- /dev/null +++ b/misc/vm_configs/scenarios/industry/nuc7i7dnb/misc_cfg.h @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2019 Intel Corporation. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef MISC_CFG_H +#define MISC_CFG_H + +#define ROOTFS_0 "root=/dev/sda3 " +#define ROOTFS_1 "root=/dev/nvme0n1p3 " + +#define SOS_ROOTFS ROOTFS_0 +#define SOS_CONSOLE "console=ttyS0 " +#define SOS_COM1_BASE 0x3F8U +#define SOS_COM1_IRQ 4U +#define SOS_COM2_BASE 0x2F8U +#define SOS_COM2_IRQ 3U + +#ifndef CONFIG_RELEASE +#define SOS_BOOTARGS_DIFF "hvlog=2M@0xE00000 memmap=0x200000$0xE00000 " +#else +#define SOS_BOOTARGS_DIFF "" +#endif + +#endif /* MISC_CFG_H */ diff --git a/misc/vm_configs/scenarios/industry/nuc7i7dnb/nuc7i7dnb.config b/misc/vm_configs/scenarios/industry/nuc7i7dnb/nuc7i7dnb.config new file mode 100644 index 000000000..0d91ddd19 --- /dev/null +++ b/misc/vm_configs/scenarios/industry/nuc7i7dnb/nuc7i7dnb.config @@ -0,0 +1,5 @@ +# Generated by Kconfiglib (https://github.com/ulfalizer/Kconfiglib) +CONFIG_BOARD="nuc7i7dnb" +CONFIG_SERIAL_LEGACY=y +CONFIG_HV_RAM_START=0x41000000 +CONFIG_RDT_ENABLED=n diff --git a/hypervisor/scenarios/industry/vm_configurations.c b/misc/vm_configs/scenarios/industry/vm_configurations.c similarity index 100% rename from hypervisor/scenarios/industry/vm_configurations.c rename to misc/vm_configs/scenarios/industry/vm_configurations.c diff --git a/hypervisor/scenarios/industry/vm_configurations.h b/misc/vm_configs/scenarios/industry/vm_configurations.h similarity index 100% rename from hypervisor/scenarios/industry/vm_configurations.h rename to misc/vm_configs/scenarios/industry/vm_configurations.h diff --git a/misc/vm_configs/scenarios/logical_partition/nuc7i7dnb/misc_cfg.h b/misc/vm_configs/scenarios/logical_partition/nuc7i7dnb/misc_cfg.h new file mode 100644 index 000000000..280006bb7 --- /dev/null +++ b/misc/vm_configs/scenarios/logical_partition/nuc7i7dnb/misc_cfg.h @@ -0,0 +1,10 @@ +/* + * Copyright (C) 2020 Intel Corporation. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef MISC_CFG_H +#define MISC_CFG_H + +#endif /* MISC_CFG_H */ diff --git a/misc/vm_configs/scenarios/logical_partition/nuc7i7dnb/nuc7i7dnb.config b/misc/vm_configs/scenarios/logical_partition/nuc7i7dnb/nuc7i7dnb.config new file mode 100644 index 000000000..0d91ddd19 --- /dev/null +++ b/misc/vm_configs/scenarios/logical_partition/nuc7i7dnb/nuc7i7dnb.config @@ -0,0 +1,5 @@ +# Generated by Kconfiglib (https://github.com/ulfalizer/Kconfiglib) +CONFIG_BOARD="nuc7i7dnb" +CONFIG_SERIAL_LEGACY=y +CONFIG_HV_RAM_START=0x41000000 +CONFIG_RDT_ENABLED=n diff --git a/hypervisor/scenarios/logical_partition/pci_dev.c b/misc/vm_configs/scenarios/logical_partition/nuc7i7dnb/pci_dev.c similarity index 73% rename from hypervisor/scenarios/logical_partition/pci_dev.c rename to misc/vm_configs/scenarios/logical_partition/nuc7i7dnb/pci_dev.c index 78f3590b8..fc94aaf7c 100644 --- a/hypervisor/scenarios/logical_partition/pci_dev.c +++ b/misc/vm_configs/scenarios/logical_partition/nuc7i7dnb/pci_dev.c @@ -7,13 +7,11 @@ #include #include #include +#include #include #include -/* The vbar_base info of pt devices is included in device MACROs which defined in - * arch/x86/configs/$(CONFIG_BOARD)/pci_devices.h. - * The memory range of vBAR should exactly match with the e820 layout of VM. - */ +#define PTDEV(PCI_DEV) PCI_DEV, PCI_DEV##_VBAR struct acrn_vm_pci_dev_config vm0_pci_devs[VM0_CONFIG_PCI_DEV_NUM] = { { @@ -24,12 +22,12 @@ struct acrn_vm_pci_dev_config vm0_pci_devs[VM0_CONFIG_PCI_DEV_NUM] = { { .emu_type = PCI_DEV_TYPE_PTDEV, .vbdf.bits = {.b = 0x00U, .d = 0x01U, .f = 0x00U}, - VM0_STORAGE_CONTROLLER + PTDEV(SATA_CONTROLLER_0), }, { .emu_type = PCI_DEV_TYPE_PTDEV, .vbdf.bits = {.b = 0x00U, .d = 0x02U, .f = 0x00U}, - VM0_NETWORK_CONTROLLER + PTDEV(ETHERNET_CONTROLLER_0), }, }; @@ -42,13 +40,11 @@ struct acrn_vm_pci_dev_config vm1_pci_devs[VM1_CONFIG_PCI_DEV_NUM] = { { .emu_type = PCI_DEV_TYPE_PTDEV, .vbdf.bits = {.b = 0x00U, .d = 0x01U, .f = 0x00U}, - VM1_STORAGE_CONTROLLER + PTDEV(USB_CONTROLLER_0), }, -#if defined(VM1_NETWORK_CONTROLLER) { .emu_type = PCI_DEV_TYPE_PTDEV, .vbdf.bits = {.b = 0x00U, .d = 0x02U, .f = 0x00U}, - VM1_NETWORK_CONTROLLER + PTDEV(NETWORK_CONTROLLER_0), }, -#endif }; diff --git a/misc/vm_configs/scenarios/logical_partition/nuc7i7dnb/vbar_base.h b/misc/vm_configs/scenarios/logical_partition/nuc7i7dnb/vbar_base.h new file mode 100644 index 000000000..8045a3194 --- /dev/null +++ b/misc/vm_configs/scenarios/logical_partition/nuc7i7dnb/vbar_base.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2020 Intel Corporation. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef VBAR_BASE_H_ +#define VBAR_BASE_H_ + +#define VGA_COMPATIBLE_CONTROLLER_0_VBAR .vbar_base[0] = 0xde000000UL, \ + .vbar_base[2] = 0xc0000000UL + +#define SYSTEM_PERIPHERAL_0_VBAR .vbar_base[0] = 0xdf252000UL + +#define USB_CONTROLLER_0_VBAR .vbar_base[0] = 0xdf230000UL + +#define SIGNAL_PROCESSING_CONTROLLER_0_VBAR .vbar_base[0] = 0xdf251000UL + +#define SIGNAL_PROCESSING_CONTROLLER_1_VBAR .vbar_base[0] = 0xdf250000UL + +#define SIGNAL_PROCESSING_CONTROLLER_2_VBAR .vbar_base[0] = 0xdf24f000UL + +#define COMMUNICATION_CONTROLLER_0_VBAR .vbar_base[0] = 0xdf24e000UL + +#define SERIAL_CONTROLLER_0_VBAR .vbar_base[1] = 0xdf24d000UL + +#define SATA_CONTROLLER_0_VBAR .vbar_base[0] = 0xdf248000UL, \ + .vbar_base[1] = 0xdf24c000UL, \ + .vbar_base[5] = 0xdf24b000UL + +#define MEMORY_CONTROLLER_0_VBAR .vbar_base[0] = 0xdf244000UL + +#define AUDIO_DEVICE_0_VBAR .vbar_base[0] = 0xdf240000UL, \ + .vbar_base[4] = 0xdf220000UL + +#define SMBUS_0_VBAR .vbar_base[0] = 0xdf24a000UL + +#define ETHERNET_CONTROLLER_0_VBAR .vbar_base[0] = 0xdf200000UL + +#define NETWORK_CONTROLLER_0_VBAR .vbar_base[0] = 0xdf100000UL + +#define NON_VOLATILE_MEMORY_CONTROLLER_0_VBAR .vbar_base[0] = 0xdf000000UL + +#endif /* VBAR_BASE_H_ */ diff --git a/hypervisor/scenarios/logical_partition/vm_configurations.c b/misc/vm_configs/scenarios/logical_partition/vm_configurations.c similarity index 100% rename from hypervisor/scenarios/logical_partition/vm_configurations.c rename to misc/vm_configs/scenarios/logical_partition/vm_configurations.c diff --git a/hypervisor/scenarios/logical_partition/vm_configurations.h b/misc/vm_configs/scenarios/logical_partition/vm_configurations.h similarity index 100% rename from hypervisor/scenarios/logical_partition/vm_configurations.h rename to misc/vm_configs/scenarios/logical_partition/vm_configurations.h