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 pt_intx_config vm0_pt_intx[1U]; 14 static struct vm_hpa_regions vm0_hpa[] = { 15 {.start_hpa = 0x100000000, .size_hpa = 0x20000000}, 16 {.start_hpa = 0x120000000, .size_hpa = 0x10000000}, 17 }; 18 extern struct acrn_vm_pci_dev_config sos_pci_devs[CONFIG_MAX_PCI_DEV_NUM]; 19 struct acrn_vm_config 20 vm_configs[CONFIG_MAX_VM_NUM] = 21 {{ 22 /* Static configured VM0 */ 23 CONFIG_PRE_STD_VM, 24 .name = "SAFETY_VM0", 25 .sched_params = 26 { 27 .prio = PRIO_LOW, 28 }, 29 .companion_vm_id = 65535U, 30 .guest_flags = (GUEST_FLAG_STATIC_VM), 31 .cpu_affinity = VM0_CONFIG_CPU_AFFINITY, 32 .memory = 33 { 34 .region_num = 2, 35 .host_regions = vm0_hpa, 36 }, 37 .os_config = 38 { 39 .name = "", 40 .kernel_type = KERNEL_ELF, 41 .kernel_mod_tag = "Zephyr_ElfImage", 42 .ramdisk_mod_tag = "", 43 .bootargs = VM0_BOOT_ARGS, 44 }, 45 .acpi_config = 46 { 47 .acpi_mod_tag = "ACPI_VM0", 48 }, 49 .vuart[0] = 50 { 51 .type = VUART_LEGACY_PIO, 52 .addr.port_base = 0x3F8U, 53 .irq = 4U, 54 }, 55 .vuart[1] = 56 { 57 .irq = 3U, 58 .type = VUART_LEGACY_PIO, 59 .addr.port_base = 0x2F8U, 60 .t_vuart.vm_id = 1U, 61 .t_vuart.vuart_id = 1U, 62 }, 63 .vuart[2] = 64 { 65 .irq = 3U, 66 .type = VUART_LEGACY_PIO, 67 .t_vuart.vm_id = 1U, 68 .t_vuart.vuart_id = 2U, 69 .addr.port_base = 0x2F8U, 70 }, 71 #ifdef VM0_PASSTHROUGH_TPM 72 .pt_tpm2 = true, 73 .mmiodevs[0] = 74 { 75 .name = "tpm2", 76 .res[0] = 77 { 78 .user_vm_pa = VM0_TPM_BUFFER_BASE_ADDR_GPA, 79 .host_pa = VM0_TPM_BUFFER_BASE_ADDR, 80 .size = VM0_TPM_BUFFER_SIZE, 81 .mem_type = EPT_UNCACHED, 82 }, 83 .res[1] = 84 { 85 .user_vm_pa = VM0_TPM_EVENTLOG_BASE_ADDR, 86 .host_pa = VM0_TPM_EVENTLOG_BASE_ADDR_HPA, 87 .size = VM0_TPM_EVENTLOG_SIZE, 88 .mem_type = EPT_WB, 89 }, 90 }, 91 #endif 92 #ifdef P2SB_BAR_ADDR 93 .pt_p2sb_bar = true, 94 .mmiodevs[0] = 95 { 96 .res[0] = 97 { 98 .user_vm_pa = P2SB_BAR_ADDR_GPA, 99 .host_pa = P2SB_BAR_ADDR, 100 .size = P2SB_BAR_SIZE, 101 }, 102 }, 103 #endif 104 .pt_intx_num = 0, 105 .pt_intx = vm0_pt_intx, 106 }, 107 { 108 /* Static configured VM1 */ 109 CONFIG_SERVICE_VM, 110 .name = "ACRN_Service_VM", 111 /* Allow Service VM to reboot the system since it is the highest priority VM. */ 112 .sched_params = 113 { 114 .prio = PRIO_LOW, 115 }, 116 .companion_vm_id = 65535U, 117 .guest_flags = (GUEST_FLAG_STATIC_VM), 118 .cpu_affinity = SERVICE_VM_CONFIG_CPU_AFFINITY, 119 .os_config = 120 { 121 .name = "", 122 .kernel_type = KERNEL_BZIMAGE, 123 .kernel_mod_tag = "Linux_bzImage", 124 .ramdisk_mod_tag = "", 125 .bootargs = SERVICE_VM_OS_BOOTARGS, 126 }, 127 .vuart[0] = 128 { 129 .type = VUART_LEGACY_PIO, 130 .addr.port_base = 0x3F8U, 131 .irq = 4U, 132 }, 133 .vuart[1] = 134 { 135 .irq = 3U, 136 .type = VUART_LEGACY_PIO, 137 .t_vuart.vm_id = 0U, 138 .t_vuart.vuart_id = 1U, 139 .addr.port_base = 0x2F8U, 140 }, 141 .vuart[2] = 142 { 143 .irq = 0U, 144 .type = VUART_LEGACY_PIO, 145 .addr.port_base = 0X9000U, 146 .t_vuart.vm_id = 0U, 147 .t_vuart.vuart_id = 2U, 148 }, 149 .vuart[3] = 150 { 151 .irq = 0U, 152 .type = VUART_LEGACY_PIO, 153 .addr.port_base = 0X9008U, 154 .t_vuart.vm_id = 2U, 155 .t_vuart.vuart_id = 1U, 156 }, 157 .vuart[4] = 158 { 159 .irq = 0U, 160 .type = VUART_LEGACY_PIO, 161 .addr.port_base = 0X9010U, 162 .t_vuart.vm_id = 3U, 163 .t_vuart.vuart_id = 1U, 164 }, 165 .pci_dev_num = 0U, 166 .pci_devs = sos_pci_devs, 167 }, 168 { 169 /* Static configured VM2 */ 170 CONFIG_POST_STD_VM, 171 .name = "POST_STD_VM1", 172 .sched_params = 173 { 174 .prio = PRIO_LOW, 175 }, 176 .companion_vm_id = 65535U, 177 .guest_flags = (GUEST_FLAG_STATIC_VM), 178 .cpu_affinity = VM2_CONFIG_CPU_AFFINITY, 179 .vuart[0] = 180 { 181 .type = VUART_LEGACY_PIO, 182 .addr.port_base = 0x3F8U, 183 .irq = 4U, 184 }, 185 .vuart[1] = 186 { 187 .irq = 3U, 188 .type = VUART_LEGACY_PIO, 189 .t_vuart.vm_id = 1U, 190 .t_vuart.vuart_id = 3U, 191 .addr.port_base = 0x2F8U, 192 }, 193 }, 194 { 195 /* Static configured VM3 */ 196 CONFIG_POST_STD_VM, 197 .name = "POST_STD_VM2", 198 .sched_params = 199 { 200 .prio = PRIO_LOW, 201 }, 202 .companion_vm_id = 65535U, 203 .guest_flags = (GUEST_FLAG_STATIC_VM), 204 .cpu_affinity = VM3_CONFIG_CPU_AFFINITY, 205 .vuart[0] = 206 { 207 .type = VUART_LEGACY_PIO, 208 .addr.port_base = 0x3F8U, 209 .irq = 4U, 210 }, 211 .vuart[1] = 212 { 213 .irq = 3U, 214 .type = VUART_LEGACY_PIO, 215 .t_vuart.vm_id = 1U, 216 .t_vuart.vuart_id = 4U, 217 .addr.port_base = 0x2F8U, 218 }, 219 }, 220 { 221 /* Dynamic configured VM4 */ 222 CONFIG_POST_STD_VM, 223 }, 224 { 225 /* Dynamic configured VM5 */ 226 CONFIG_POST_STD_VM, 227 }, 228 { 229 /* Dynamic configured VM6 */ 230 CONFIG_POST_STD_VM, 231 }, 232 { 233 /* Dynamic configured VM7 */ 234 CONFIG_POST_STD_VM, 235 }, 236 { 237 /* Dynamic configured VM8 */ 238 CONFIG_POST_STD_VM, 239 }, 240 { 241 /* Dynamic configured VM9 */ 242 CONFIG_POST_STD_VM, 243 }, 244 { 245 /* Dynamic configured VM10 */ 246 CONFIG_POST_STD_VM, 247 }, 248 { 249 /* Dynamic configured VM11 */ 250 CONFIG_POST_STD_VM, 251 }, 252 { 253 /* Dynamic configured VM12 */ 254 CONFIG_POST_STD_VM, 255 }, 256 { 257 /* Dynamic configured VM13 */ 258 CONFIG_POST_STD_VM, 259 }, 260 { 261 /* Dynamic configured VM14 */ 262 CONFIG_POST_STD_VM, 263 }, 264 { 265 /* Dynamic configured VM15 */ 266 CONFIG_POST_STD_VM, 267 } 268 269 }; 270