1 /* 2 * Copyright (C) 2022 Intel Corporation. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #include <asm/vm_config.h> 8 #include <vuart.h> 9 #include <asm/pci_dev.h> 10 #include <asm/pgtable.h> 11 #include <schedule.h> 12 13 extern struct acrn_vm_pci_dev_config vm0_pci_devs[VM0_CONFIG_PCI_DEV_NUM]; 14 extern struct pt_intx_config vm0_pt_intx[1U]; 15 static struct vm_hpa_regions vm0_hpa[] = { 16 {.start_hpa = 0x100000000, .size_hpa = 0x20000000}, 17 }; 18 extern struct acrn_vm_pci_dev_config vm1_pci_devs[VM1_CONFIG_PCI_DEV_NUM]; 19 extern struct pt_intx_config vm1_pt_intx[1U]; 20 static struct vm_hpa_regions vm1_hpa[] = { 21 {.start_hpa = 0x120000000, .size_hpa = 0x20000000}, 22 }; 23 struct acrn_vm_config vm_configs[CONFIG_MAX_VM_NUM] = { 24 { 25 /* Static configured VM0 */ 26 CONFIG_PRE_STD_VM, 27 .name = "PRE_STD_VM0", 28 .sched_params = 29 { 30 .prio = PRIO_LOW, 31 }, 32 .companion_vm_id = 65535U, 33 .guest_flags = (GUEST_FLAG_STATIC_VM), 34 .cpu_affinity = VM0_CONFIG_CPU_AFFINITY, 35 .memory = 36 { 37 .region_num = 1, 38 .host_regions = vm0_hpa, 39 }, 40 .os_config = 41 { 42 .name = "", 43 .kernel_type = KERNEL_BZIMAGE, 44 .kernel_mod_tag = "Linux_bzImage", 45 .ramdisk_mod_tag = "Ubuntu", 46 .bootargs = VM0_BOOT_ARGS, 47 }, 48 .acpi_config = 49 { 50 .acpi_mod_tag = "ACPI_VM0", 51 }, 52 .vuart[0] = 53 { 54 .type = VUART_LEGACY_PIO, 55 .addr.port_base = 0x3F8U, 56 .irq = 4U, 57 }, 58 .vuart[1] = 59 { 60 .irq = 3U, 61 .type = VUART_LEGACY_PIO, 62 .addr.port_base = 0x2F8U, 63 .t_vuart.vm_id = 1U, 64 .t_vuart.vuart_id = 1U, 65 }, 66 .pci_dev_num = VM0_CONFIG_PCI_DEV_NUM, 67 .pci_devs = vm0_pci_devs, 68 #ifdef VM0_PASSTHROUGH_TPM 69 .pt_tpm2 = true, 70 .mmiodevs[0] = 71 { 72 .name = "tpm2", 73 .res[0] = 74 { 75 .user_vm_pa = VM0_TPM_BUFFER_BASE_ADDR_GPA, 76 .host_pa = VM0_TPM_BUFFER_BASE_ADDR, 77 .size = VM0_TPM_BUFFER_SIZE, 78 .mem_type = EPT_UNCACHED, 79 }, 80 .res[1] = 81 { 82 .user_vm_pa = VM0_TPM_EVENTLOG_BASE_ADDR, 83 .host_pa = VM0_TPM_EVENTLOG_BASE_ADDR_HPA, 84 .size = VM0_TPM_EVENTLOG_SIZE, 85 .mem_type = EPT_WB, 86 }, 87 }, 88 #endif 89 #ifdef P2SB_BAR_ADDR 90 .pt_p2sb_bar = true, 91 .mmiodevs[0] = 92 { 93 .res[0] = 94 { 95 .user_vm_pa = P2SB_BAR_ADDR_GPA, 96 .host_pa = P2SB_BAR_ADDR, 97 .size = P2SB_BAR_SIZE, 98 }, 99 }, 100 #endif 101 .pt_intx_num = 0, 102 .pt_intx = vm0_pt_intx, 103 }, 104 { 105 /* Static configured VM1 */ 106 CONFIG_PRE_STD_VM, 107 .name = "PRE_STD_VM1", 108 .sched_params = 109 { 110 .prio = PRIO_LOW, 111 }, 112 .companion_vm_id = 65535U, 113 .guest_flags = (GUEST_FLAG_STATIC_VM), 114 .cpu_affinity = VM1_CONFIG_CPU_AFFINITY, 115 .memory = 116 { 117 .region_num = 1, 118 .host_regions = vm1_hpa, 119 }, 120 .os_config = 121 { 122 .name = "", 123 .kernel_type = KERNEL_BZIMAGE, 124 .kernel_mod_tag = "Linux_bzImage", 125 .ramdisk_mod_tag = "", 126 .bootargs = VM1_BOOT_ARGS, 127 }, 128 .acpi_config = 129 { 130 .acpi_mod_tag = "ACPI_VM1", 131 }, 132 .vuart[0] = 133 { 134 .type = VUART_LEGACY_PIO, 135 .addr.port_base = 0x3F8U, 136 .irq = 4U, 137 }, 138 .vuart[1] = 139 { 140 .irq = 3U, 141 .type = VUART_LEGACY_PIO, 142 .t_vuart.vm_id = 0U, 143 .t_vuart.vuart_id = 1U, 144 .addr.port_base = 0x2F8U, 145 }, 146 .pci_dev_num = VM1_CONFIG_PCI_DEV_NUM, 147 .pci_devs = vm1_pci_devs, 148 .pt_intx_num = 0, 149 .pt_intx = vm1_pt_intx, 150 }, 151 { 152 /* Dynamic configured VM2 */ 153 CONFIG_POST_STD_VM, 154 }, 155 { 156 /* Dynamic configured VM3 */ 157 CONFIG_POST_STD_VM, 158 }, 159 { 160 /* Dynamic configured VM4 */ 161 CONFIG_POST_STD_VM, 162 }, 163 { 164 /* Dynamic configured VM5 */ 165 CONFIG_POST_STD_VM, 166 }, 167 { 168 /* Dynamic configured VM6 */ 169 CONFIG_POST_STD_VM, 170 }, 171 { 172 /* Dynamic configured VM7 */ 173 CONFIG_POST_STD_VM, 174 }, 175 { 176 /* Dynamic configured VM8 */ 177 CONFIG_POST_STD_VM, 178 }, 179 { 180 /* Dynamic configured VM9 */ 181 CONFIG_POST_STD_VM, 182 }, 183 { 184 /* Dynamic configured VM10 */ 185 CONFIG_POST_STD_VM, 186 }, 187 { 188 /* Dynamic configured VM11 */ 189 CONFIG_POST_STD_VM, 190 }, 191 { 192 /* Dynamic configured VM12 */ 193 CONFIG_POST_STD_VM, 194 }, 195 { 196 /* Dynamic configured VM13 */ 197 CONFIG_POST_STD_VM, 198 }, 199 { 200 /* Dynamic configured VM14 */ 201 CONFIG_POST_STD_VM, 202 }, 203 { 204 /* Dynamic configured VM15 */ 205 CONFIG_POST_STD_VM, 206 } 207 208 }; 209