virt.c (2077fef91d5eb8e3745a84fabd87a5ee7d2b535d) | virt.c (4cbca7d9b4de5ecf6a8447b2eba89d591717f6c4) |
---|---|
1/* 2 * ARM mach-virt emulation 3 * 4 * Copyright (c) 2013 Linaro Limited 5 * 6 * This program is free software; you can redistribute it and/or modify it 7 * under the terms and conditions of the GNU General Public License, 8 * version 2 or later, as published by the Free Software Foundation. --- 230 unchanged lines hidden (view full) --- 239 qemu_fdt_setprop_string(fdt, "/distance-map", "compatible", 240 "numa-distance-map-v1"); 241 qemu_fdt_setprop(fdt, "/distance-map", "distance-matrix", 242 matrix, size); 243 g_free(matrix); 244 } 245} 246 | 1/* 2 * ARM mach-virt emulation 3 * 4 * Copyright (c) 2013 Linaro Limited 5 * 6 * This program is free software; you can redistribute it and/or modify it 7 * under the terms and conditions of the GNU General Public License, 8 * version 2 or later, as published by the Free Software Foundation. --- 230 unchanged lines hidden (view full) --- 239 qemu_fdt_setprop_string(fdt, "/distance-map", "compatible", 240 "numa-distance-map-v1"); 241 qemu_fdt_setprop(fdt, "/distance-map", "distance-matrix", 242 matrix, size); 243 g_free(matrix); 244 } 245} 246 |
247static void fdt_add_psci_node(const VirtMachineState *vms) 248{ 249 uint32_t cpu_suspend_fn; 250 uint32_t cpu_off_fn; 251 uint32_t cpu_on_fn; 252 uint32_t migrate_fn; 253 void *fdt = vms->fdt; 254 ARMCPU *armcpu = ARM_CPU(qemu_get_cpu(0)); 255 const char *psci_method; 256 257 switch (vms->psci_conduit) { 258 case QEMU_PSCI_CONDUIT_DISABLED: 259 return; 260 case QEMU_PSCI_CONDUIT_HVC: 261 psci_method = "hvc"; 262 break; 263 case QEMU_PSCI_CONDUIT_SMC: 264 psci_method = "smc"; 265 break; 266 default: 267 g_assert_not_reached(); 268 } 269 270 qemu_fdt_add_subnode(fdt, "/psci"); 271 if (armcpu->psci_version == 2) { 272 const char comp[] = "arm,psci-0.2\0arm,psci"; 273 qemu_fdt_setprop(fdt, "/psci", "compatible", comp, sizeof(comp)); 274 275 cpu_off_fn = QEMU_PSCI_0_2_FN_CPU_OFF; 276 if (arm_feature(&armcpu->env, ARM_FEATURE_AARCH64)) { 277 cpu_suspend_fn = QEMU_PSCI_0_2_FN64_CPU_SUSPEND; 278 cpu_on_fn = QEMU_PSCI_0_2_FN64_CPU_ON; 279 migrate_fn = QEMU_PSCI_0_2_FN64_MIGRATE; 280 } else { 281 cpu_suspend_fn = QEMU_PSCI_0_2_FN_CPU_SUSPEND; 282 cpu_on_fn = QEMU_PSCI_0_2_FN_CPU_ON; 283 migrate_fn = QEMU_PSCI_0_2_FN_MIGRATE; 284 } 285 } else { 286 qemu_fdt_setprop_string(fdt, "/psci", "compatible", "arm,psci"); 287 288 cpu_suspend_fn = QEMU_PSCI_0_1_FN_CPU_SUSPEND; 289 cpu_off_fn = QEMU_PSCI_0_1_FN_CPU_OFF; 290 cpu_on_fn = QEMU_PSCI_0_1_FN_CPU_ON; 291 migrate_fn = QEMU_PSCI_0_1_FN_MIGRATE; 292 } 293 294 /* We adopt the PSCI spec's nomenclature, and use 'conduit' to refer 295 * to the instruction that should be used to invoke PSCI functions. 296 * However, the device tree binding uses 'method' instead, so that is 297 * what we should use here. 298 */ 299 qemu_fdt_setprop_string(fdt, "/psci", "method", psci_method); 300 301 qemu_fdt_setprop_cell(fdt, "/psci", "cpu_suspend", cpu_suspend_fn); 302 qemu_fdt_setprop_cell(fdt, "/psci", "cpu_off", cpu_off_fn); 303 qemu_fdt_setprop_cell(fdt, "/psci", "cpu_on", cpu_on_fn); 304 qemu_fdt_setprop_cell(fdt, "/psci", "migrate", migrate_fn); 305} 306 | |
307static void fdt_add_timer_nodes(const VirtMachineState *vms) 308{ 309 /* On real hardware these interrupts are level-triggered. 310 * On KVM they were edge-triggered before host kernel version 4.4, 311 * and level-triggered afterwards. 312 * On emulated QEMU they are level-triggered. 313 * 314 * Getting the DTB info about them wrong is awkward for some --- 1089 unchanged lines hidden (view full) --- 1404 "secure-memory", &error_abort); 1405 } 1406 1407 object_property_set_bool(cpuobj, true, "realized", &error_fatal); 1408 object_unref(cpuobj); 1409 } 1410 fdt_add_timer_nodes(vms); 1411 fdt_add_cpu_nodes(vms); | 247static void fdt_add_timer_nodes(const VirtMachineState *vms) 248{ 249 /* On real hardware these interrupts are level-triggered. 250 * On KVM they were edge-triggered before host kernel version 4.4, 251 * and level-triggered afterwards. 252 * On emulated QEMU they are level-triggered. 253 * 254 * Getting the DTB info about them wrong is awkward for some --- 1089 unchanged lines hidden (view full) --- 1344 "secure-memory", &error_abort); 1345 } 1346 1347 object_property_set_bool(cpuobj, true, "realized", &error_fatal); 1348 object_unref(cpuobj); 1349 } 1350 fdt_add_timer_nodes(vms); 1351 fdt_add_cpu_nodes(vms); |
1412 fdt_add_psci_node(vms); | |
1413 1414 memory_region_allocate_system_memory(ram, NULL, "mach-virt.ram", 1415 machine->ram_size); 1416 memory_region_add_subregion(sysmem, vms->memmap[VIRT_MEM].base, ram); 1417 1418 create_flash(vms, sysmem, secure_sysmem ? secure_sysmem : sysmem); 1419 1420 create_gic(vms, pic); --- 375 unchanged lines hidden --- | 1352 1353 memory_region_allocate_system_memory(ram, NULL, "mach-virt.ram", 1354 machine->ram_size); 1355 memory_region_add_subregion(sysmem, vms->memmap[VIRT_MEM].base, ram); 1356 1357 create_flash(vms, sysmem, secure_sysmem ? secure_sysmem : sysmem); 1358 1359 create_gic(vms, pic); --- 375 unchanged lines hidden --- |