Lines Matching +full:- +full:- +full:disable +full:- +full:fdt

2  * ARM mach-virt emulation
23 * + we want to present a very stripped-down minimalist platform,
41 #include "hw/vfio/vfio-calxeda-xgmac.h"
42 #include "hw/vfio/vfio-amd-xgbe.h"
56 #include "qemu/error-report.h"
58 #include "hw/pci-host/gpex.h"
59 #include "hw/virtio/virtio-pci.h"
60 #include "hw/core/sysbus-fdt.h"
61 #include "hw/platform-bus.h"
62 #include "hw/qdev-properties.h"
63 #include "hw/arm/fdt.h"
72 #include "qapi/qapi-visit-common.h"
74 #include "standard-headers/linux/input.h"
77 #include "target/arm/cpu-qom.h"
81 #include "hw/mem/pc-dimm.h"
84 #include "hw/virtio/virtio-md-pci.h"
85 #include "hw/virtio/virtio-iommu.h"
87 #include "qemu/guest-random.h"
90 { TYPE_VIRTIO_IOMMU_PCI, "aw-bits", "48" },
96 * TYPE_VIRT_MACHINE is abstract and mc->compat_props g_ptr_array_new()
101 compat_props_add(mc->compat_props, arm_virt_compat, in arm_virt_compat_set()
113 mc->desc = "QEMU " MACHINE_VER_STR(__VA_ARGS__) " ARM Virtual Machine"; \
116 mc->alias = "virt"; \
206 * layout, depending on 'compact-highmem' property. With legacy layout, the
226 [VIRT_MMIO] = 16, /* ...to 16 + NUM_VIRTIO_TRANSPORTS - 1 */
227 [VIRT_GIC_V2M] = 48, /* ...to 48 + NUM_GICV2M_SPIS - 1 */
228 [VIRT_SMMU] = 74, /* ...to 74 + NUM_SMMU_IRQS - 1 */
229 [VIRT_PLATFORM_BUS] = 112, /* ...to 112 + PLATFORM_BUS_NUM_IRQS -1 */
242 qemu_fdt_setprop_u64(ms->fdt, node, "kaslr-seed", seed.kaslr); in create_randomness()
243 qemu_fdt_setprop(ms->fdt, node, "rng-seed", seed.rng, sizeof(seed.rng)); in create_randomness()
254 CPUARMState *env = &cpu->env; in ns_el2_virt_timer_present()
263 int nb_numa_nodes = ms->numa_state->num_nodes; in create_fdt()
264 void *fdt = create_device_tree(&vms->fdt_size); in create_fdt() local
266 if (!fdt) { in create_fdt()
271 ms->fdt = fdt; in create_fdt()
274 qemu_fdt_setprop_string(fdt, "/", "compatible", "linux,dummy-virt"); in create_fdt()
275 qemu_fdt_setprop_cell(fdt, "/", "#address-cells", 0x2); in create_fdt()
276 qemu_fdt_setprop_cell(fdt, "/", "#size-cells", 0x2); in create_fdt()
277 qemu_fdt_setprop_string(fdt, "/", "model", "linux,dummy-virt"); in create_fdt()
283 * - It avoids potential bugs where we forget to mark a DMA in create_fdt()
284 * capable device as being dma-coherent in create_fdt()
285 * - It avoids spurious warnings from the Linux kernel about in create_fdt()
288 qemu_fdt_setprop(fdt, "/", "dma-coherent", NULL, 0); in create_fdt()
291 qemu_fdt_add_subnode(fdt, "/chosen"); in create_fdt()
292 if (vms->dtb_randomness) { in create_fdt()
296 if (vms->secure) { in create_fdt()
297 qemu_fdt_add_subnode(fdt, "/secure-chosen"); in create_fdt()
298 if (vms->dtb_randomness) { in create_fdt()
299 create_randomness(ms, "/secure-chosen"); in create_fdt()
303 qemu_fdt_add_subnode(fdt, "/aliases"); in create_fdt()
310 vms->clock_phandle = qemu_fdt_alloc_phandle(fdt); in create_fdt()
311 qemu_fdt_add_subnode(fdt, "/apb-pclk"); in create_fdt()
312 qemu_fdt_setprop_string(fdt, "/apb-pclk", "compatible", "fixed-clock"); in create_fdt()
313 qemu_fdt_setprop_cell(fdt, "/apb-pclk", "#clock-cells", 0x0); in create_fdt()
314 qemu_fdt_setprop_cell(fdt, "/apb-pclk", "clock-frequency", 24000000); in create_fdt()
315 qemu_fdt_setprop_string(fdt, "/apb-pclk", "clock-output-names", in create_fdt()
317 qemu_fdt_setprop_cell(fdt, "/apb-pclk", "phandle", vms->clock_phandle); in create_fdt()
319 if (nb_numa_nodes > 0 && ms->numa_state->have_numa_distance) { in create_fdt()
330 cpu_to_be32(ms->numa_state->nodes[i].distance[j]); in create_fdt()
334 qemu_fdt_add_subnode(fdt, "/distance-map"); in create_fdt()
335 qemu_fdt_setprop_string(fdt, "/distance-map", "compatible", in create_fdt()
336 "numa-distance-map-v1"); in create_fdt()
337 qemu_fdt_setprop(fdt, "/distance-map", "distance-matrix", in create_fdt()
345 /* On real hardware these interrupts are level-triggered. in fdt_add_timer_nodes()
346 * On KVM they were edge-triggered before host kernel version 4.4, in fdt_add_timer_nodes()
347 * and level-triggered afterwards. in fdt_add_timer_nodes()
348 * On emulated QEMU they are level-triggered. in fdt_add_timer_nodes()
352 * pre-4.8 ignore the DT and leave the interrupt configured in fdt_add_timer_nodes()
359 * For backwards-compatibility, virt-2.8 and earlier will continue in fdt_add_timer_nodes()
360 * to say these are edge-triggered, but later machines will report in fdt_add_timer_nodes()
368 if (vmc->claim_edge_triggered_timers) { in fdt_add_timer_nodes()
372 if (vms->gic_version == VIRT_GIC_VERSION_2) { in fdt_add_timer_nodes()
375 (1 << MACHINE(vms)->smp.cpus) - 1); in fdt_add_timer_nodes()
378 qemu_fdt_add_subnode(ms->fdt, "/timer"); in fdt_add_timer_nodes()
381 if (arm_feature(&armcpu->env, ARM_FEATURE_V8)) { in fdt_add_timer_nodes()
382 const char compat[] = "arm,armv8-timer\0arm,armv7-timer"; in fdt_add_timer_nodes()
383 qemu_fdt_setprop(ms->fdt, "/timer", "compatible", in fdt_add_timer_nodes()
386 qemu_fdt_setprop_string(ms->fdt, "/timer", "compatible", in fdt_add_timer_nodes()
387 "arm,armv7-timer"); in fdt_add_timer_nodes()
389 qemu_fdt_setprop(ms->fdt, "/timer", "always-on", NULL, 0); in fdt_add_timer_nodes()
390 if (vms->ns_el2_virt_timer_irq) { in fdt_add_timer_nodes()
391 qemu_fdt_setprop_cells(ms->fdt, "/timer", "interrupts", in fdt_add_timer_nodes()
403 qemu_fdt_setprop_cells(ms->fdt, "/timer", "interrupts", in fdt_add_timer_nodes()
421 int smp_cpus = ms->smp.cpus; in fdt_add_cpu_nodes()
425 * On ARM v8 64-bit systems value should be set to 2, in fdt_add_cpu_nodes()
428 * in the system, #address-cells can be set to 1, since in fdt_add_cpu_nodes()
432 * Here we actually don't know whether our system is 32- or 64-bit one. in fdt_add_cpu_nodes()
434 * at least one of them has Aff3 populated, we set #address-cells to 2. in fdt_add_cpu_nodes()
445 qemu_fdt_add_subnode(ms->fdt, "/cpus"); in fdt_add_cpu_nodes()
446 qemu_fdt_setprop_cell(ms->fdt, "/cpus", "#address-cells", addr_cells); in fdt_add_cpu_nodes()
447 qemu_fdt_setprop_cell(ms->fdt, "/cpus", "#size-cells", 0x0); in fdt_add_cpu_nodes()
449 for (cpu = smp_cpus - 1; cpu >= 0; cpu--) { in fdt_add_cpu_nodes()
454 qemu_fdt_add_subnode(ms->fdt, nodename); in fdt_add_cpu_nodes()
455 qemu_fdt_setprop_string(ms->fdt, nodename, "device_type", "cpu"); in fdt_add_cpu_nodes()
456 qemu_fdt_setprop_string(ms->fdt, nodename, "compatible", in fdt_add_cpu_nodes()
457 armcpu->dtb_compatible); in fdt_add_cpu_nodes()
459 if (vms->psci_conduit != QEMU_PSCI_CONDUIT_DISABLED && smp_cpus > 1) { in fdt_add_cpu_nodes()
460 qemu_fdt_setprop_string(ms->fdt, nodename, in fdt_add_cpu_nodes()
461 "enable-method", "psci"); in fdt_add_cpu_nodes()
465 qemu_fdt_setprop_u64(ms->fdt, nodename, "reg", in fdt_add_cpu_nodes()
468 qemu_fdt_setprop_cell(ms->fdt, nodename, "reg", in fdt_add_cpu_nodes()
472 if (ms->possible_cpus->cpus[cs->cpu_index].props.has_node_id) { in fdt_add_cpu_nodes()
473 qemu_fdt_setprop_cell(ms->fdt, nodename, "numa-node-id", in fdt_add_cpu_nodes()
474 ms->possible_cpus->cpus[cs->cpu_index].props.node_id); in fdt_add_cpu_nodes()
477 if (!vmc->no_cpu_topology) { in fdt_add_cpu_nodes()
478 qemu_fdt_setprop_cell(ms->fdt, nodename, "phandle", in fdt_add_cpu_nodes()
479 qemu_fdt_alloc_phandle(ms->fdt)); in fdt_add_cpu_nodes()
485 if (!vmc->no_cpu_topology) { in fdt_add_cpu_nodes()
487 * Add vCPU topology description through fdt node cpu-map. in fdt_add_cpu_nodes()
489 * See Linux Documentation/devicetree/bindings/cpu/cpu-topology.txt in fdt_add_cpu_nodes()
502 qemu_fdt_add_subnode(ms->fdt, "/cpus/cpu-map"); in fdt_add_cpu_nodes()
504 for (cpu = smp_cpus - 1; cpu >= 0; cpu--) { in fdt_add_cpu_nodes()
508 if (ms->smp.threads > 1) { in fdt_add_cpu_nodes()
510 "/cpus/cpu-map/socket%d/cluster%d/core%d/thread%d", in fdt_add_cpu_nodes()
511 cpu / (ms->smp.clusters * ms->smp.cores * ms->smp.threads), in fdt_add_cpu_nodes()
512 (cpu / (ms->smp.cores * ms->smp.threads)) % ms->smp.clusters, in fdt_add_cpu_nodes()
513 (cpu / ms->smp.threads) % ms->smp.cores, in fdt_add_cpu_nodes()
514 cpu % ms->smp.threads); in fdt_add_cpu_nodes()
517 "/cpus/cpu-map/socket%d/cluster%d/core%d", in fdt_add_cpu_nodes()
518 cpu / (ms->smp.clusters * ms->smp.cores), in fdt_add_cpu_nodes()
519 (cpu / ms->smp.cores) % ms->smp.clusters, in fdt_add_cpu_nodes()
520 cpu % ms->smp.cores); in fdt_add_cpu_nodes()
522 qemu_fdt_add_path(ms->fdt, map_path); in fdt_add_cpu_nodes()
523 qemu_fdt_setprop_phandle(ms->fdt, map_path, "cpu", cpu_path); in fdt_add_cpu_nodes()
536 vms->msi_phandle = qemu_fdt_alloc_phandle(ms->fdt); in fdt_add_its_gic_node()
538 vms->memmap[VIRT_GIC_ITS].base); in fdt_add_its_gic_node()
539 qemu_fdt_add_subnode(ms->fdt, nodename); in fdt_add_its_gic_node()
540 qemu_fdt_setprop_string(ms->fdt, nodename, "compatible", in fdt_add_its_gic_node()
541 "arm,gic-v3-its"); in fdt_add_its_gic_node()
542 qemu_fdt_setprop(ms->fdt, nodename, "msi-controller", NULL, 0); in fdt_add_its_gic_node()
543 qemu_fdt_setprop_cell(ms->fdt, nodename, "#msi-cells", 1); in fdt_add_its_gic_node()
544 qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "reg", in fdt_add_its_gic_node()
545 2, vms->memmap[VIRT_GIC_ITS].base, in fdt_add_its_gic_node()
546 2, vms->memmap[VIRT_GIC_ITS].size); in fdt_add_its_gic_node()
547 qemu_fdt_setprop_cell(ms->fdt, nodename, "phandle", vms->msi_phandle); in fdt_add_its_gic_node()
557 vms->memmap[VIRT_GIC_V2M].base); in fdt_add_v2m_gic_node()
558 vms->msi_phandle = qemu_fdt_alloc_phandle(ms->fdt); in fdt_add_v2m_gic_node()
559 qemu_fdt_add_subnode(ms->fdt, nodename); in fdt_add_v2m_gic_node()
560 qemu_fdt_setprop_string(ms->fdt, nodename, "compatible", in fdt_add_v2m_gic_node()
561 "arm,gic-v2m-frame"); in fdt_add_v2m_gic_node()
562 qemu_fdt_setprop(ms->fdt, nodename, "msi-controller", NULL, 0); in fdt_add_v2m_gic_node()
563 qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "reg", in fdt_add_v2m_gic_node()
564 2, vms->memmap[VIRT_GIC_V2M].base, in fdt_add_v2m_gic_node()
565 2, vms->memmap[VIRT_GIC_V2M].size); in fdt_add_v2m_gic_node()
566 qemu_fdt_setprop_cell(ms->fdt, nodename, "phandle", vms->msi_phandle); in fdt_add_v2m_gic_node()
575 vms->gic_phandle = qemu_fdt_alloc_phandle(ms->fdt); in fdt_add_gic_node()
576 qemu_fdt_setprop_cell(ms->fdt, "/", "interrupt-parent", vms->gic_phandle); in fdt_add_gic_node()
579 vms->memmap[VIRT_GIC_DIST].base); in fdt_add_gic_node()
580 qemu_fdt_add_subnode(ms->fdt, nodename); in fdt_add_gic_node()
581 qemu_fdt_setprop_cell(ms->fdt, nodename, "#interrupt-cells", 3); in fdt_add_gic_node()
582 qemu_fdt_setprop(ms->fdt, nodename, "interrupt-controller", NULL, 0); in fdt_add_gic_node()
583 qemu_fdt_setprop_cell(ms->fdt, nodename, "#address-cells", 0x2); in fdt_add_gic_node()
584 qemu_fdt_setprop_cell(ms->fdt, nodename, "#size-cells", 0x2); in fdt_add_gic_node()
585 qemu_fdt_setprop(ms->fdt, nodename, "ranges", NULL, 0); in fdt_add_gic_node()
586 if (vms->gic_version != VIRT_GIC_VERSION_2) { in fdt_add_gic_node()
589 qemu_fdt_setprop_string(ms->fdt, nodename, "compatible", in fdt_add_gic_node()
590 "arm,gic-v3"); in fdt_add_gic_node()
592 qemu_fdt_setprop_cell(ms->fdt, nodename, in fdt_add_gic_node()
593 "#redistributor-regions", nb_redist_regions); in fdt_add_gic_node()
596 qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "reg", in fdt_add_gic_node()
597 2, vms->memmap[VIRT_GIC_DIST].base, in fdt_add_gic_node()
598 2, vms->memmap[VIRT_GIC_DIST].size, in fdt_add_gic_node()
599 2, vms->memmap[VIRT_GIC_REDIST].base, in fdt_add_gic_node()
600 2, vms->memmap[VIRT_GIC_REDIST].size); in fdt_add_gic_node()
602 qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "reg", in fdt_add_gic_node()
603 2, vms->memmap[VIRT_GIC_DIST].base, in fdt_add_gic_node()
604 2, vms->memmap[VIRT_GIC_DIST].size, in fdt_add_gic_node()
605 2, vms->memmap[VIRT_GIC_REDIST].base, in fdt_add_gic_node()
606 2, vms->memmap[VIRT_GIC_REDIST].size, in fdt_add_gic_node()
607 2, vms->memmap[VIRT_HIGH_GIC_REDIST2].base, in fdt_add_gic_node()
608 2, vms->memmap[VIRT_HIGH_GIC_REDIST2].size); in fdt_add_gic_node()
611 if (vms->virt) { in fdt_add_gic_node()
612 qemu_fdt_setprop_cells(ms->fdt, nodename, "interrupts", in fdt_add_gic_node()
618 /* 'cortex-a15-gic' means 'GIC v2' */ in fdt_add_gic_node()
619 qemu_fdt_setprop_string(ms->fdt, nodename, "compatible", in fdt_add_gic_node()
620 "arm,cortex-a15-gic"); in fdt_add_gic_node()
621 if (!vms->virt) { in fdt_add_gic_node()
622 qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "reg", in fdt_add_gic_node()
623 2, vms->memmap[VIRT_GIC_DIST].base, in fdt_add_gic_node()
624 2, vms->memmap[VIRT_GIC_DIST].size, in fdt_add_gic_node()
625 2, vms->memmap[VIRT_GIC_CPU].base, in fdt_add_gic_node()
626 2, vms->memmap[VIRT_GIC_CPU].size); in fdt_add_gic_node()
628 qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "reg", in fdt_add_gic_node()
629 2, vms->memmap[VIRT_GIC_DIST].base, in fdt_add_gic_node()
630 2, vms->memmap[VIRT_GIC_DIST].size, in fdt_add_gic_node()
631 2, vms->memmap[VIRT_GIC_CPU].base, in fdt_add_gic_node()
632 2, vms->memmap[VIRT_GIC_CPU].size, in fdt_add_gic_node()
633 2, vms->memmap[VIRT_GIC_HYP].base, in fdt_add_gic_node()
634 2, vms->memmap[VIRT_GIC_HYP].size, in fdt_add_gic_node()
635 2, vms->memmap[VIRT_GIC_VCPU].base, in fdt_add_gic_node()
636 2, vms->memmap[VIRT_GIC_VCPU].size); in fdt_add_gic_node()
637 qemu_fdt_setprop_cells(ms->fdt, nodename, "interrupts", in fdt_add_gic_node()
644 qemu_fdt_setprop_cell(ms->fdt, nodename, "phandle", vms->gic_phandle); in fdt_add_gic_node()
654 if (!arm_feature(&armcpu->env, ARM_FEATURE_PMU)) { in fdt_add_pmu_nodes()
659 if (vms->gic_version == VIRT_GIC_VERSION_2) { in fdt_add_pmu_nodes()
662 (1 << MACHINE(vms)->smp.cpus) - 1); in fdt_add_pmu_nodes()
665 qemu_fdt_add_subnode(ms->fdt, "/pmu"); in fdt_add_pmu_nodes()
666 if (arm_feature(&armcpu->env, ARM_FEATURE_V8)) { in fdt_add_pmu_nodes()
667 const char compat[] = "arm,armv8-pmuv3"; in fdt_add_pmu_nodes()
668 qemu_fdt_setprop(ms->fdt, "/pmu", "compatible", in fdt_add_pmu_nodes()
670 qemu_fdt_setprop_cells(ms->fdt, "/pmu", "interrupts", in fdt_add_pmu_nodes()
680 int irq = vms->irqmap[VIRT_ACPI_GED]; in create_acpi_ged()
683 if (ms->ram_slots) { in create_acpi_ged()
687 if (ms->nvdimms_state->is_enabled) { in create_acpi_ged()
692 qdev_prop_set_uint32(dev, "ged-event", event); in create_acpi_ged()
695 sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, vms->memmap[VIRT_ACPI_GED].base); in create_acpi_ged()
696 sysbus_mmio_map(SYS_BUS_DEVICE(dev), 1, vms->memmap[VIRT_PCDIMM_ACPI].base); in create_acpi_ged()
697 sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, qdev_get_gpio_in(vms->gic, irq)); in create_acpi_ged()
707 if (!strcmp(itsclass, "arm-gicv3-its")) { in create_its()
708 if (!vms->tcg_its) { in create_its()
720 object_property_set_link(OBJECT(dev), "parent-gicv3", OBJECT(vms->gic), in create_its()
723 sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, vms->memmap[VIRT_GIC_ITS].base); in create_its()
726 vms->msi_controller = VIRT_MSI_CTRL_ITS; in create_its()
732 int irq = vms->irqmap[VIRT_GIC_V2M]; in create_v2m()
735 dev = qdev_new("arm-gicv2m"); in create_v2m()
736 qdev_prop_set_uint32(dev, "base-spi", irq); in create_v2m()
737 qdev_prop_set_uint32(dev, "num-spi", NUM_GICV2M_SPIS); in create_v2m()
739 sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, vms->memmap[VIRT_GIC_V2M].base); in create_v2m()
743 qdev_get_gpio_in(vms->gic, irq + i)); in create_v2m()
747 vms->msi_controller = VIRT_MSI_CTRL_GICV2M; in create_v2m()
761 (vms->gic_version != VIRT_GIC_VERSION_2); in gicv3_nmi_present()
771 unsigned int smp_cpus = ms->smp.cpus; in create_gic()
775 if (vms->gic_version == VIRT_GIC_VERSION_2) { in create_gic()
781 switch (vms->gic_version) { in create_gic()
794 vms->gic = qdev_new(gictype); in create_gic()
795 qdev_prop_set_uint32(vms->gic, "revision", revision); in create_gic()
796 qdev_prop_set_uint32(vms->gic, "num-cpu", smp_cpus); in create_gic()
797 /* Note that the num-irq property counts both internal and external in create_gic()
800 qdev_prop_set_uint32(vms->gic, "num-irq", NUM_IRQS + 32); in create_gic()
802 qdev_prop_set_bit(vms->gic, "has-security-extensions", vms->secure); in create_gic()
805 if (vms->gic_version != VIRT_GIC_VERSION_2) { in create_gic()
819 MIN(smp_cpus - redist0_count, redist1_capacity)); in create_gic()
821 qdev_prop_set_array(vms->gic, "redist-region-count", in create_gic()
825 if (vms->tcg_its) { in create_gic()
826 object_property_set_link(OBJECT(vms->gic), "sysmem", in create_gic()
828 qdev_prop_set_bit(vms->gic, "has-lpi", true); in create_gic()
833 qdev_prop_set_bit(vms->gic, "has-virtualization-extensions", in create_gic()
834 vms->virt); in create_gic()
839 qdev_prop_set_bit(vms->gic, "has-nmi", true); in create_gic()
842 gicbusdev = SYS_BUS_DEVICE(vms->gic); in create_gic()
844 sysbus_mmio_map(gicbusdev, 0, vms->memmap[VIRT_GIC_DIST].base); in create_gic()
845 if (vms->gic_version != VIRT_GIC_VERSION_2) { in create_gic()
846 sysbus_mmio_map(gicbusdev, 1, vms->memmap[VIRT_GIC_REDIST].base); in create_gic()
849 vms->memmap[VIRT_HIGH_GIC_REDIST2].base); in create_gic()
852 sysbus_mmio_map(gicbusdev, 1, vms->memmap[VIRT_GIC_CPU].base); in create_gic()
853 if (vms->virt) { in create_gic()
854 sysbus_mmio_map(gicbusdev, 2, vms->memmap[VIRT_GIC_HYP].base); in create_gic()
855 sysbus_mmio_map(gicbusdev, 3, vms->memmap[VIRT_GIC_VCPU].base); in create_gic()
880 qdev_get_gpio_in(vms->gic, in create_gic()
884 if (vms->gic_version != VIRT_GIC_VERSION_2) { in create_gic()
885 qemu_irq irq = qdev_get_gpio_in(vms->gic, in create_gic()
887 qdev_connect_gpio_out_named(cpudev, "gicv3-maintenance-interrupt", in create_gic()
889 } else if (vms->virt) { in create_gic()
890 qemu_irq irq = qdev_get_gpio_in(vms->gic, in create_gic()
895 qdev_connect_gpio_out_named(cpudev, "pmu-interrupt", 0, in create_gic()
896 qdev_get_gpio_in(vms->gic, intidbase in create_gic()
907 if (vms->gic_version != VIRT_GIC_VERSION_2) { in create_gic()
917 if (vms->gic_version != VIRT_GIC_VERSION_2 && vms->its) { in create_gic()
919 } else if (vms->gic_version == VIRT_GIC_VERSION_2) { in create_gic()
928 hwaddr base = vms->memmap[uart].base; in create_uart()
929 hwaddr size = vms->memmap[uart].size; in create_uart()
930 int irq = vms->irqmap[uart]; in create_uart()
941 sysbus_connect_irq(s, 0, qdev_get_gpio_in(vms->gic, irq)); in create_uart()
944 qemu_fdt_add_subnode(ms->fdt, nodename); in create_uart()
946 qemu_fdt_setprop(ms->fdt, nodename, "compatible", in create_uart()
948 qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "reg", in create_uart()
950 qemu_fdt_setprop_cells(ms->fdt, nodename, "interrupts", in create_uart()
953 qemu_fdt_setprop_cells(ms->fdt, nodename, "clocks", in create_uart()
954 vms->clock_phandle, vms->clock_phandle); in create_uart()
955 qemu_fdt_setprop(ms->fdt, nodename, "clock-names", in create_uart()
959 qemu_fdt_setprop_string(ms->fdt, "/chosen", "stdout-path", nodename); in create_uart()
960 qemu_fdt_setprop_string(ms->fdt, "/aliases", "serial0", nodename); in create_uart()
962 qemu_fdt_setprop_string(ms->fdt, "/aliases", "serial1", nodename); in create_uart()
966 qemu_fdt_setprop_string(ms->fdt, nodename, "status", "disabled"); in create_uart()
967 qemu_fdt_setprop_string(ms->fdt, nodename, "secure-status", "okay"); in create_uart()
969 qemu_fdt_setprop_string(ms->fdt, "/secure-chosen", "stdout-path", in create_uart()
979 hwaddr base = vms->memmap[VIRT_RTC].base; in create_rtc()
980 hwaddr size = vms->memmap[VIRT_RTC].size; in create_rtc()
981 int irq = vms->irqmap[VIRT_RTC]; in create_rtc()
985 sysbus_create_simple("pl031", base, qdev_get_gpio_in(vms->gic, irq)); in create_rtc()
988 qemu_fdt_add_subnode(ms->fdt, nodename); in create_rtc()
989 qemu_fdt_setprop(ms->fdt, nodename, "compatible", compat, sizeof(compat)); in create_rtc()
990 qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "reg", in create_rtc()
992 qemu_fdt_setprop_cells(ms->fdt, nodename, "interrupts", in create_rtc()
995 qemu_fdt_setprop_cell(ms->fdt, nodename, "clocks", vms->clock_phandle); in create_rtc()
996 qemu_fdt_setprop_string(ms->fdt, nodename, "clock-names", "apb_pclk"); in create_rtc()
1005 if (s->acpi_dev) { in virt_powerdown_req()
1006 acpi_send_event(s->acpi_dev, ACPI_POWER_DOWN_STATUS); in virt_powerdown_req()
1013 static void create_gpio_keys(char *fdt, DeviceState *pl061_dev, in create_gpio_keys() argument
1016 gpio_key_dev = sysbus_create_simple("gpio-key", -1, in create_gpio_keys()
1020 qemu_fdt_add_subnode(fdt, "/gpio-keys"); in create_gpio_keys()
1021 qemu_fdt_setprop_string(fdt, "/gpio-keys", "compatible", "gpio-keys"); in create_gpio_keys()
1023 qemu_fdt_add_subnode(fdt, "/gpio-keys/poweroff"); in create_gpio_keys()
1024 qemu_fdt_setprop_string(fdt, "/gpio-keys/poweroff", in create_gpio_keys()
1026 qemu_fdt_setprop_cell(fdt, "/gpio-keys/poweroff", "linux,code", in create_gpio_keys()
1028 qemu_fdt_setprop_cells(fdt, "/gpio-keys/poweroff", in create_gpio_keys()
1035 static void create_secure_gpio_pwr(char *fdt, DeviceState *pl061_dev, in create_secure_gpio_pwr() argument
1040 /* gpio-pwr */ in create_secure_gpio_pwr()
1041 gpio_pwr_dev = sysbus_create_simple("gpio-pwr", -1, NULL); in create_secure_gpio_pwr()
1043 /* connect secure pl061 to gpio-pwr */ in create_secure_gpio_pwr()
1049 qemu_fdt_add_subnode(fdt, "/gpio-poweroff"); in create_secure_gpio_pwr()
1050 qemu_fdt_setprop_string(fdt, "/gpio-poweroff", "compatible", in create_secure_gpio_pwr()
1051 "gpio-poweroff"); in create_secure_gpio_pwr()
1052 qemu_fdt_setprop_cells(fdt, "/gpio-poweroff", in create_secure_gpio_pwr()
1054 qemu_fdt_setprop_string(fdt, "/gpio-poweroff", "status", "disabled"); in create_secure_gpio_pwr()
1055 qemu_fdt_setprop_string(fdt, "/gpio-poweroff", "secure-status", in create_secure_gpio_pwr()
1058 qemu_fdt_add_subnode(fdt, "/gpio-restart"); in create_secure_gpio_pwr()
1059 qemu_fdt_setprop_string(fdt, "/gpio-restart", "compatible", in create_secure_gpio_pwr()
1060 "gpio-restart"); in create_secure_gpio_pwr()
1061 qemu_fdt_setprop_cells(fdt, "/gpio-restart", in create_secure_gpio_pwr()
1063 qemu_fdt_setprop_string(fdt, "/gpio-restart", "status", "disabled"); in create_secure_gpio_pwr()
1064 qemu_fdt_setprop_string(fdt, "/gpio-restart", "secure-status", in create_secure_gpio_pwr()
1073 hwaddr base = vms->memmap[gpio].base; in create_gpio_devices()
1074 hwaddr size = vms->memmap[gpio].size; in create_gpio_devices()
1075 int irq = vms->irqmap[gpio]; in create_gpio_devices()
1087 sysbus_connect_irq(s, 0, qdev_get_gpio_in(vms->gic, irq)); in create_gpio_devices()
1089 uint32_t phandle = qemu_fdt_alloc_phandle(ms->fdt); in create_gpio_devices()
1091 qemu_fdt_add_subnode(ms->fdt, nodename); in create_gpio_devices()
1092 qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "reg", in create_gpio_devices()
1094 qemu_fdt_setprop(ms->fdt, nodename, "compatible", compat, sizeof(compat)); in create_gpio_devices()
1095 qemu_fdt_setprop_cell(ms->fdt, nodename, "#gpio-cells", 2); in create_gpio_devices()
1096 qemu_fdt_setprop(ms->fdt, nodename, "gpio-controller", NULL, 0); in create_gpio_devices()
1097 qemu_fdt_setprop_cells(ms->fdt, nodename, "interrupts", in create_gpio_devices()
1100 qemu_fdt_setprop_cell(ms->fdt, nodename, "clocks", vms->clock_phandle); in create_gpio_devices()
1101 qemu_fdt_setprop_string(ms->fdt, nodename, "clock-names", "apb_pclk"); in create_gpio_devices()
1102 qemu_fdt_setprop_cell(ms->fdt, nodename, "phandle", phandle); in create_gpio_devices()
1106 qemu_fdt_setprop_string(ms->fdt, nodename, "status", "disabled"); in create_gpio_devices()
1107 qemu_fdt_setprop_string(ms->fdt, nodename, "secure-status", "okay"); in create_gpio_devices()
1113 create_gpio_keys(ms->fdt, pl061_dev, phandle); in create_gpio_devices()
1115 create_secure_gpio_pwr(ms->fdt, pl061_dev, phandle); in create_gpio_devices()
1122 hwaddr size = vms->memmap[VIRT_MMIO].size; in create_virtio_devices()
1127 * create a list of virtio-mmio buses with decreasing base addresses. in create_virtio_devices()
1129 * When a -device option is processed from the command line, in create_virtio_devices()
1130 * qbus_find_recursive() picks the next free virtio-mmio bus in forwards in create_virtio_devices()
1131 * order. The upshot is that -device options in increasing command line in create_virtio_devices()
1132 * order are mapped to virtio-mmio buses with decreasing base addresses. in create_virtio_devices()
1136 * the first -device on the command line. (The end-to-end order is a in create_virtio_devices()
1138 * guest kernel's name-to-address assignment strategy.) in create_virtio_devices()
1153 int irq = vms->irqmap[VIRT_MMIO] + i; in create_virtio_devices()
1154 hwaddr base = vms->memmap[VIRT_MMIO].base + i * size; in create_virtio_devices()
1156 sysbus_create_simple("virtio-mmio", base, in create_virtio_devices()
1157 qdev_get_gpio_in(vms->gic, irq)); in create_virtio_devices()
1167 for (i = NUM_VIRTIO_TRANSPORTS - 1; i >= 0; i--) { in create_virtio_devices()
1169 int irq = vms->irqmap[VIRT_MMIO] + i; in create_virtio_devices()
1170 hwaddr base = vms->memmap[VIRT_MMIO].base + i * size; in create_virtio_devices()
1173 qemu_fdt_add_subnode(ms->fdt, nodename); in create_virtio_devices()
1174 qemu_fdt_setprop_string(ms->fdt, nodename, in create_virtio_devices()
1176 qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "reg", in create_virtio_devices()
1178 qemu_fdt_setprop_cells(ms->fdt, nodename, "interrupts", in create_virtio_devices()
1181 qemu_fdt_setprop(ms->fdt, nodename, "dma-coherent", NULL, 0); in create_virtio_devices()
1198 qdev_prop_set_uint64(dev, "sector-length", VIRT_FLASH_SECTOR_SIZE); in virt_flash_create1()
1200 qdev_prop_set_uint8(dev, "device-width", 2); in virt_flash_create1()
1201 qdev_prop_set_bit(dev, "big-endian", false); in virt_flash_create1()
1215 vms->flash[0] = virt_flash_create1(vms, "virt.flash0", "pflash0"); in virt_flash_create()
1216 vms->flash[1] = virt_flash_create1(vms, "virt.flash1", "pflash1"); in virt_flash_create()
1227 qdev_prop_set_uint32(dev, "num-blocks", size / VIRT_FLASH_SECTOR_SIZE); in virt_flash_map1()
1247 hwaddr flashsize = vms->memmap[VIRT_FLASH].size / 2; in virt_flash_map()
1248 hwaddr flashbase = vms->memmap[VIRT_FLASH].base; in virt_flash_map()
1250 virt_flash_map1(vms->flash[0], flashbase, flashsize, in virt_flash_map()
1252 virt_flash_map1(vms->flash[1], flashbase + flashsize, flashsize, in virt_flash_map()
1260 hwaddr flashsize = vms->memmap[VIRT_FLASH].size / 2; in virt_flash_fdt()
1261 hwaddr flashbase = vms->memmap[VIRT_FLASH].base; in virt_flash_fdt()
1268 qemu_fdt_add_subnode(ms->fdt, nodename); in virt_flash_fdt()
1269 qemu_fdt_setprop_string(ms->fdt, nodename, "compatible", "cfi-flash"); in virt_flash_fdt()
1270 qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "reg", in virt_flash_fdt()
1273 qemu_fdt_setprop_cell(ms->fdt, nodename, "bank-width", 4); in virt_flash_fdt()
1281 qemu_fdt_add_subnode(ms->fdt, nodename); in virt_flash_fdt()
1282 qemu_fdt_setprop_string(ms->fdt, nodename, "compatible", "cfi-flash"); in virt_flash_fdt()
1283 qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "reg", in virt_flash_fdt()
1285 qemu_fdt_setprop_cell(ms->fdt, nodename, "bank-width", 4); in virt_flash_fdt()
1286 qemu_fdt_setprop_string(ms->fdt, nodename, "status", "disabled"); in virt_flash_fdt()
1287 qemu_fdt_setprop_string(ms->fdt, nodename, "secure-status", "okay"); in virt_flash_fdt()
1291 qemu_fdt_add_subnode(ms->fdt, nodename); in virt_flash_fdt()
1292 qemu_fdt_setprop_string(ms->fdt, nodename, "compatible", "cfi-flash"); in virt_flash_fdt()
1293 qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "reg", in virt_flash_fdt()
1295 qemu_fdt_setprop_cell(ms->fdt, nodename, "bank-width", 4); in virt_flash_fdt()
1308 /* Map legacy -drive if=pflash to machine properties */ in virt_firmware_init()
1309 for (i = 0; i < ARRAY_SIZE(vms->flash); i++) { in virt_firmware_init()
1310 pflash_cfi01_legacy_drive(vms->flash[i], in virt_firmware_init()
1316 pflash_blk0 = pflash_cfi01_get_blk(vms->flash[0]); in virt_firmware_init()
1318 bios_name = MACHINE(vms)->firmware; in virt_firmware_init()
1326 "specified with -bios or with -drive if=pflash... " in virt_firmware_init()
1331 /* Fall back to -bios */ in virt_firmware_init()
1338 mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(vms->flash[0]), 0); in virt_firmware_init()
1353 hwaddr base = vms->memmap[VIRT_FW_CFG].base; in create_fw_cfg()
1354 hwaddr size = vms->memmap[VIRT_FW_CFG].size; in create_fw_cfg()
1359 fw_cfg_add_i16(fw_cfg, FW_CFG_NB_CPUS, (uint16_t)ms->smp.cpus); in create_fw_cfg()
1361 nodename = g_strdup_printf("/fw-cfg@%" PRIx64, base); in create_fw_cfg()
1362 qemu_fdt_add_subnode(ms->fdt, nodename); in create_fw_cfg()
1363 qemu_fdt_setprop_string(ms->fdt, nodename, in create_fw_cfg()
1364 "compatible", "qemu,fw-cfg-mmio"); in create_fw_cfg()
1365 qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "reg", in create_fw_cfg()
1367 qemu_fdt_setprop(ms->fdt, nodename, "dma-coherent", NULL, 0); in create_fw_cfg()
1400 qemu_fdt_setprop(ms->fdt, nodename, "interrupt-map", in create_pcie_irq_map()
1403 qemu_fdt_setprop_cells(ms->fdt, nodename, "interrupt-map-mask", in create_pcie_irq_map()
1414 const char compat[] = "arm,smmu-v3"; in create_smmu()
1415 int irq = vms->irqmap[VIRT_SMMU]; in create_smmu()
1417 hwaddr base = vms->memmap[VIRT_SMMU].base; in create_smmu()
1418 hwaddr size = vms->memmap[VIRT_SMMU].size; in create_smmu()
1419 const char irq_names[] = "eventq\0priq\0cmdq-sync\0gerror"; in create_smmu()
1423 if (vms->iommu != VIRT_IOMMU_SMMUV3 || !vms->iommu_phandle) { in create_smmu()
1429 if (!vmc->no_nested_smmu) { in create_smmu()
1432 object_property_set_link(OBJECT(dev), "primary-bus", OBJECT(bus), in create_smmu()
1438 qdev_get_gpio_in(vms->gic, irq + i)); in create_smmu()
1442 qemu_fdt_add_subnode(ms->fdt, node); in create_smmu()
1443 qemu_fdt_setprop(ms->fdt, node, "compatible", compat, sizeof(compat)); in create_smmu()
1444 qemu_fdt_setprop_sized_cells(ms->fdt, node, "reg", 2, base, 2, size); in create_smmu()
1446 qemu_fdt_setprop_cells(ms->fdt, node, "interrupts", in create_smmu()
1452 qemu_fdt_setprop(ms->fdt, node, "interrupt-names", irq_names, in create_smmu()
1455 qemu_fdt_setprop(ms->fdt, node, "dma-coherent", NULL, 0); in create_smmu()
1457 qemu_fdt_setprop_cell(ms->fdt, node, "#iommu-cells", 1); in create_smmu()
1459 qemu_fdt_setprop_cell(ms->fdt, node, "phandle", vms->iommu_phandle); in create_smmu()
1465 const char compat[] = "virtio,pci-iommu\0pci1af4,1057"; in create_virtio_iommu_dt_bindings()
1466 uint16_t bdf = vms->virtio_iommu_bdf; in create_virtio_iommu_dt_bindings()
1470 vms->iommu_phandle = qemu_fdt_alloc_phandle(ms->fdt); in create_virtio_iommu_dt_bindings()
1472 node = g_strdup_printf("%s/virtio_iommu@%x,%x", vms->pciehb_nodename, in create_virtio_iommu_dt_bindings()
1474 qemu_fdt_add_subnode(ms->fdt, node); in create_virtio_iommu_dt_bindings()
1475 qemu_fdt_setprop(ms->fdt, node, "compatible", compat, sizeof(compat)); in create_virtio_iommu_dt_bindings()
1476 qemu_fdt_setprop_sized_cells(ms->fdt, node, "reg", in create_virtio_iommu_dt_bindings()
1480 qemu_fdt_setprop_cell(ms->fdt, node, "#iommu-cells", 1); in create_virtio_iommu_dt_bindings()
1481 qemu_fdt_setprop_cell(ms->fdt, node, "phandle", vms->iommu_phandle); in create_virtio_iommu_dt_bindings()
1484 qemu_fdt_setprop_cells(ms->fdt, vms->pciehb_nodename, "iommu-map", in create_virtio_iommu_dt_bindings()
1485 0x0, vms->iommu_phandle, 0x0, bdf, in create_virtio_iommu_dt_bindings()
1486 bdf + 1, vms->iommu_phandle, bdf + 1, 0xffff - bdf); in create_virtio_iommu_dt_bindings()
1491 hwaddr base_mmio = vms->memmap[VIRT_PCIE_MMIO].base; in create_pcie()
1492 hwaddr size_mmio = vms->memmap[VIRT_PCIE_MMIO].size; in create_pcie()
1493 hwaddr base_mmio_high = vms->memmap[VIRT_HIGH_PCIE_MMIO].base; in create_pcie()
1494 hwaddr size_mmio_high = vms->memmap[VIRT_HIGH_PCIE_MMIO].size; in create_pcie()
1495 hwaddr base_pio = vms->memmap[VIRT_PCIE_PIO].base; in create_pcie()
1496 hwaddr size_pio = vms->memmap[VIRT_PCIE_PIO].size; in create_pcie()
1500 int irq = vms->irqmap[VIRT_PCIE]; in create_pcie()
1515 ecam_id = VIRT_ECAM_ID(vms->highmem_ecam); in create_pcie()
1516 base_ecam = vms->memmap[ecam_id].base; in create_pcie()
1517 size_ecam = vms->memmap[ecam_id].size; in create_pcie()
1522 memory_region_init_alias(ecam_alias, OBJECT(dev), "pcie-ecam", in create_pcie()
1533 memory_region_init_alias(mmio_alias, OBJECT(dev), "pcie-mmio", in create_pcie()
1537 if (vms->highmem_mmio) { in create_pcie()
1541 memory_region_init_alias(high_mmio_alias, OBJECT(dev), "pcie-mmio-high", in create_pcie()
1552 qdev_get_gpio_in(vms->gic, irq + i)); in create_pcie()
1557 pci->bypass_iommu = vms->default_bus_bypass_iommu; in create_pcie()
1558 vms->bus = pci->bus; in create_pcie()
1559 if (vms->bus) { in create_pcie()
1560 pci_init_nic_devices(pci->bus, mc->default_nic); in create_pcie()
1563 nodename = vms->pciehb_nodename = g_strdup_printf("/pcie@%" PRIx64, base); in create_pcie()
1564 qemu_fdt_add_subnode(ms->fdt, nodename); in create_pcie()
1565 qemu_fdt_setprop_string(ms->fdt, nodename, in create_pcie()
1566 "compatible", "pci-host-ecam-generic"); in create_pcie()
1567 qemu_fdt_setprop_string(ms->fdt, nodename, "device_type", "pci"); in create_pcie()
1568 qemu_fdt_setprop_cell(ms->fdt, nodename, "#address-cells", 3); in create_pcie()
1569 qemu_fdt_setprop_cell(ms->fdt, nodename, "#size-cells", 2); in create_pcie()
1570 qemu_fdt_setprop_cell(ms->fdt, nodename, "linux,pci-domain", 0); in create_pcie()
1571 qemu_fdt_setprop_cells(ms->fdt, nodename, "bus-range", 0, in create_pcie()
1572 nr_pcie_buses - 1); in create_pcie()
1573 qemu_fdt_setprop(ms->fdt, nodename, "dma-coherent", NULL, 0); in create_pcie()
1575 if (vms->msi_phandle) { in create_pcie()
1576 qemu_fdt_setprop_cells(ms->fdt, nodename, "msi-map", in create_pcie()
1577 0, vms->msi_phandle, 0, 0x10000); in create_pcie()
1580 qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "reg", in create_pcie()
1583 if (vms->highmem_mmio) { in create_pcie()
1584 qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "ranges", in create_pcie()
1593 qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "ranges", in create_pcie()
1600 qemu_fdt_setprop_cell(ms->fdt, nodename, "#interrupt-cells", 1); in create_pcie()
1601 create_pcie_irq_map(ms, vms->gic_phandle, irq, nodename); in create_pcie()
1603 if (vms->iommu) { in create_pcie()
1604 vms->iommu_phandle = qemu_fdt_alloc_phandle(ms->fdt); in create_pcie()
1606 switch (vms->iommu) { in create_pcie()
1608 create_smmu(vms, vms->bus); in create_pcie()
1609 qemu_fdt_setprop_cells(ms->fdt, nodename, "iommu-map", in create_pcie()
1610 0x0, vms->iommu_phandle, 0x0, 0x10000); in create_pcie()
1626 dev->id = g_strdup(TYPE_PLATFORM_BUS_DEVICE); in create_platform_bus()
1628 qdev_prop_set_uint32(dev, "mmio_size", vms->memmap[VIRT_PLATFORM_BUS].size); in create_platform_bus()
1630 vms->platform_bus_dev = dev; in create_platform_bus()
1634 int irq = vms->irqmap[VIRT_PLATFORM_BUS] + i; in create_platform_bus()
1635 sysbus_connect_irq(s, i, qdev_get_gpio_in(vms->gic, irq)); in create_platform_bus()
1639 vms->memmap[VIRT_PLATFORM_BUS].base, in create_platform_bus()
1659 hwaddr base = vms->memmap[VIRT_SECURE_MEM].base; in create_secure_ram()
1660 hwaddr size = vms->memmap[VIRT_SECURE_MEM].size; in create_secure_ram()
1663 memory_region_init_ram(secram, NULL, "virt.secure-ram", size, in create_secure_ram()
1668 qemu_fdt_add_subnode(ms->fdt, nodename); in create_secure_ram()
1669 qemu_fdt_setprop_string(ms->fdt, nodename, "device_type", "memory"); in create_secure_ram()
1670 qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "reg", 2, base, 2, size); in create_secure_ram()
1671 qemu_fdt_setprop_string(ms->fdt, nodename, "status", "disabled"); in create_secure_ram()
1672 qemu_fdt_setprop_string(ms->fdt, nodename, "secure-status", "okay"); in create_secure_ram()
1675 create_tag_ram(secure_tag_sysmem, base, size, "mach-virt.secure-tag"); in create_secure_ram()
1688 *fdt_size = board->fdt_size; in machvirt_dtb()
1689 return ms->fdt; in machvirt_dtb()
1707 vmc->smbios_old_sys_ver ? "1.0" : mc->name); in virt_build_smbios()
1710 mem_array.address = vms->memmap[VIRT_MEM].base; in virt_build_smbios()
1711 mem_array.length = ms->ram_size; in virt_build_smbios()
1719 fw_cfg_add_file(vms->fw_cfg, "etc/smbios/smbios-tables", in virt_build_smbios()
1721 fw_cfg_add_file(vms->fw_cfg, "etc/smbios/smbios-anchor", in virt_build_smbios()
1733 struct arm_boot_info *info = &vms->bootinfo; in virt_machine_done()
1743 if (info->dtb_filename == NULL) { in virt_machine_done()
1744 platform_bus_add_all_fdt_nodes(ms->fdt, "/intc", in virt_machine_done()
1745 vms->memmap[VIRT_PLATFORM_BUS].base, in virt_machine_done()
1746 vms->memmap[VIRT_PLATFORM_BUS].size, in virt_machine_done()
1747 vms->irqmap[VIRT_PLATFORM_BUS]); in virt_machine_done()
1749 if (arm_load_dtb(info->dtb_start, info, info->dtb_limit, as, ms) < 0) { in virt_machine_done()
1753 fw_cfg_add_extra_pci_roots(vms->bus, vms->fw_cfg); in virt_machine_done()
1764 if (!vmc->disallow_affinity_adjustment) { in virt_cpu_mp_affinity()
1765 /* Adjust MPIDR like 64-bit KVM hosts, which incorporate the in virt_cpu_mp_affinity()
1766 * GIC's target-list limitations. 32-bit KVM hosts currently in virt_cpu_mp_affinity()
1770 * purposes are to make TCG consistent (with 64-bit KVM hosts) in virt_cpu_mp_affinity()
1773 if (vms->gic_version == VIRT_GIC_VERSION_2) { in virt_cpu_mp_affinity()
1786 &vms->highmem_redists, in virt_get_high_memmap_enabled()
1787 &vms->highmem_ecam, in virt_get_high_memmap_enabled()
1788 &vms->highmem_mmio, in virt_get_high_memmap_enabled()
1791 assert(ARRAY_SIZE(extended_memmap) - VIRT_LOWMEMMAP_LAST == in virt_get_high_memmap_enabled()
1793 assert(index - VIRT_LOWMEMMAP_LAST < ARRAY_SIZE(enabled_array)); in virt_get_high_memmap_enabled()
1795 return enabled_array[index - VIRT_LOWMEMMAP_LAST]; in virt_get_high_memmap_enabled()
1810 vms->memmap[i].base = region_base; in virt_set_high_memmap()
1811 vms->memmap[i].size = region_size; in virt_set_high_memmap()
1819 * For each device that doesn't fit, disable it. in virt_set_high_memmap()
1823 if (vms->highmem_compact && !*region_enabled) { in virt_set_high_memmap()
1829 vms->highest_gpa = base - 1; in virt_set_high_memmap()
1840 vms->memmap = extended_memmap; in virt_set_memmap()
1843 vms->memmap[i] = base_memmap[i]; in virt_set_memmap()
1846 if (ms->ram_slots > ACPI_MAX_RAM_SLOTS) { in virt_set_memmap()
1848 ms->ram_slots); in virt_set_memmap()
1856 if (!vms->highmem) { in virt_set_memmap()
1868 ROUND_UP(vms->memmap[VIRT_MEM].base + ms->ram_size, GiB); in virt_set_memmap()
1869 device_memory_size = ms->maxram_size - ms->ram_size + ms->ram_slots * GiB; in virt_set_memmap()
1875 pa_bits, memtop - BIT_ULL(pa_bits)); in virt_set_memmap()
1882 if (base < vms->memmap[VIRT_MEM].base + LEGACY_RAMLIMIT_BYTES) { in virt_set_memmap()
1883 base = vms->memmap[VIRT_MEM].base + LEGACY_RAMLIMIT_BYTES; in virt_set_memmap()
1887 vms->highest_gpa = memtop - 1; in virt_set_memmap()
1905 error_report("gic-version=host requires KVM"); in finalize_gic_version_do()
1909 /* For KVM, gic-version=host means gic-version=max */ in finalize_gic_version_do()
1928 * the end-user requested more than 8 VCPUs we now default in finalize_gic_version_do()
1975 * finalize_gic_version - Determines the final gic_version
1976 * according to the gic-version property
1983 unsigned int max_cpus = MACHINE(vms)->smp.max_cpus; in finalize_gic_version()
2004 accel_name = "KVM with kernel-irqchip=off"; in finalize_gic_version()
2007 if (module_object_class_by_name("arm-gicv3")) { in finalize_gic_version()
2009 if (vms->virt) { in finalize_gic_version()
2023 vms->gic_version = finalize_gic_version_do(accel_name, vms->gic_version, in finalize_gic_version()
2033 int max_cpus = MACHINE(vms)->smp.max_cpus; in virt_cpu_post_init()
2040 "kvm-steal-time", NULL); in virt_cpu_post_init()
2043 hwaddr pvtime_reg_base = vms->memmap[VIRT_PVTIME].base; in virt_cpu_post_init()
2044 hwaddr pvtime_reg_size = vms->memmap[VIRT_PVTIME].size; in virt_cpu_post_init()
2067 assert(arm_feature(&ARM_CPU(cpu)->env, ARM_FEATURE_PMU)); in virt_cpu_post_init()
2075 + cpu->cpu_index in virt_cpu_post_init()
2080 if (aarch64 && vms->highmem) { in virt_cpu_post_init()
2081 int requested_pa_size = 64 - clz64(vms->highest_gpa); in virt_cpu_post_init()
2107 bool has_ged = !vmc->no_ged; in machvirt_init()
2108 unsigned int smp_cpus = machine->smp.cpus; in machvirt_init()
2109 unsigned int max_cpus = machine->smp.max_cpus; in machvirt_init()
2111 possible_cpus = mc->possible_cpu_arch_ids(machine); in machvirt_init()
2118 if (!vms->memmap) { in machvirt_init()
2128 cpuobj = object_new(possible_cpus->cpus[0].type); in machvirt_init()
2143 if (vms->secure) { in machvirt_init()
2147 * containing the system memory at low priority; any secure-only in machvirt_init()
2151 memory_region_init(secure_sysmem, OBJECT(machine), "secure-memory", in machvirt_init()
2153 memory_region_add_subregion_overlap(secure_sysmem, 0, sysmem, -1); in machvirt_init()
2160 * implement PSCI itself, so disable QEMU's internal implementation in machvirt_init()
2169 if (vms->secure && firmware_loaded) { in machvirt_init()
2170 vms->psci_conduit = QEMU_PSCI_CONDUIT_DISABLED; in machvirt_init()
2171 } else if (vms->virt) { in machvirt_init()
2172 vms->psci_conduit = QEMU_PSCI_CONDUIT_SMC; in machvirt_init()
2174 vms->psci_conduit = QEMU_PSCI_CONDUIT_HVC; in machvirt_init()
2182 if (vms->gic_version == VIRT_GIC_VERSION_2) { in machvirt_init()
2186 if (vms->highmem_redists) { in machvirt_init()
2193 "supported by machine 'mach-virt' (%d)", in machvirt_init()
2195 if (vms->gic_version != VIRT_GIC_VERSION_2 && !vms->highmem_redists) { in machvirt_init()
2196 error_printf("Try 'highmem-redists=on' for more CPUs\n"); in machvirt_init()
2202 if (vms->secure && (kvm_enabled() || hvf_enabled())) { in machvirt_init()
2203 error_report("mach-virt: %s does not support providing " in machvirt_init()
2209 if (vms->virt && (kvm_enabled() || hvf_enabled())) { in machvirt_init()
2210 error_report("mach-virt: %s does not support providing " in machvirt_init()
2216 if (vms->mte && hvf_enabled()) { in machvirt_init()
2217 error_report("mach-virt: %s does not support providing " in machvirt_init()
2225 assert(possible_cpus->len == max_cpus); in machvirt_init()
2226 for (n = 0; n < possible_cpus->len; n++) { in machvirt_init()
2234 cpuobj = object_new(possible_cpus->cpus[n].type); in machvirt_init()
2235 object_property_set_int(cpuobj, "mp-affinity", in machvirt_init()
2236 possible_cpus->cpus[n].arch_id, NULL); in machvirt_init()
2239 cs->cpu_index = n; in machvirt_init()
2241 numa_cpu_pre_plug(&possible_cpus->cpus[cs->cpu_index], DEVICE(cpuobj), in machvirt_init()
2246 if (!vms->secure) { in machvirt_init()
2250 if (!vms->virt && object_property_find(cpuobj, "has_el2")) { in machvirt_init()
2254 if (vmc->kvm_no_adjvtime && in machvirt_init()
2255 object_property_find(cpuobj, "kvm-no-adjvtime")) { in machvirt_init()
2256 object_property_set_bool(cpuobj, "kvm-no-adjvtime", true, NULL); in machvirt_init()
2259 if (vmc->no_kvm_steal_time && in machvirt_init()
2260 object_property_find(cpuobj, "kvm-steal-time")) { in machvirt_init()
2261 object_property_set_bool(cpuobj, "kvm-steal-time", false, NULL); in machvirt_init()
2264 if (vmc->no_pmu && object_property_find(cpuobj, "pmu")) { in machvirt_init()
2268 if (vmc->no_tcg_lpa2 && object_property_find(cpuobj, "lpa2")) { in machvirt_init()
2272 if (object_property_find(cpuobj, "reset-cbar")) { in machvirt_init()
2273 object_property_set_int(cpuobj, "reset-cbar", in machvirt_init()
2274 vms->memmap[VIRT_CPUPERIPHS].base, in machvirt_init()
2280 if (vms->secure) { in machvirt_init()
2281 object_property_set_link(cpuobj, "secure-memory", in machvirt_init()
2285 if (vms->mte) { in machvirt_init()
2293 if (!object_property_find(cpuobj, "tag-memory")) { in machvirt_init()
2301 "tag-memory", UINT64_MAX / 32); in machvirt_init()
2303 if (vms->secure) { in machvirt_init()
2306 "secure-tag-memory", in machvirt_init()
2309 /* As with ram, secure-tag takes precedence over tag. */ in machvirt_init()
2311 0, tag_sysmem, -1); in machvirt_init()
2315 object_property_set_link(cpuobj, "tag-memory", in machvirt_init()
2317 if (vms->secure) { in machvirt_init()
2318 object_property_set_link(cpuobj, "secure-tag-memory", in machvirt_init()
2339 vms->ns_el2_virt_timer_irq = ns_el2_virt_timer_present() && in machvirt_init()
2340 !vmc->no_ns_el2_virt_timer_irq; in machvirt_init()
2345 memory_region_add_subregion(sysmem, vms->memmap[VIRT_MEM].base, in machvirt_init()
2346 machine->ram); in machvirt_init()
2359 * if a backend is configured explicitly via '-serial <backend>'. in machvirt_init()
2369 * aliases node information and /chosen/stdout-path regardless of in machvirt_init()
2372 * For similar back-compatibility reasons, if UART1 is the secure UART in machvirt_init()
2376 if (!vms->secure) { in machvirt_init()
2380 vms->second_ns_uart_present = true; in machvirt_init()
2385 if (vms->secure) { in machvirt_init()
2389 if (vms->secure) { in machvirt_init()
2394 create_tag_ram(tag_sysmem, vms->memmap[VIRT_MEM].base, in machvirt_init()
2395 machine->ram_size, "mach-virt.tag"); in machvirt_init()
2398 vms->highmem_ecam &= (!firmware_loaded || aarch64); in machvirt_init()
2405 vms->acpi_dev = create_acpi_ged(vms); in machvirt_init()
2410 if (vms->secure && !vmc->no_secure_gpio) { in machvirt_init()
2415 vms->powerdown_notifier.notify = virt_powerdown_req; in machvirt_init()
2416 qemu_register_powerdown_notifier(&vms->powerdown_notifier); in machvirt_init()
2424 vms->fw_cfg = create_fw_cfg(vms, &address_space_memory); in machvirt_init()
2425 rom_set_fw(vms->fw_cfg); in machvirt_init()
2429 if (machine->nvdimms_state->is_enabled) { in machvirt_init()
2432 .address = vms->memmap[VIRT_NVDIMM_ACPI].base, in machvirt_init()
2436 nvdimm_init_acpi_state(machine->nvdimms_state, sysmem, in machvirt_init()
2438 vms->fw_cfg, OBJECT(vms)); in machvirt_init()
2441 vms->bootinfo.ram_size = machine->ram_size; in machvirt_init()
2442 vms->bootinfo.board_id = -1; in machvirt_init()
2443 vms->bootinfo.loader_start = vms->memmap[VIRT_MEM].base; in machvirt_init()
2444 vms->bootinfo.get_dtb = machvirt_dtb; in machvirt_init()
2445 vms->bootinfo.skip_dtb_autoload = true; in machvirt_init()
2446 vms->bootinfo.firmware_loaded = firmware_loaded; in machvirt_init()
2447 vms->bootinfo.psci_conduit = vms->psci_conduit; in machvirt_init()
2448 arm_load_kernel(ARM_CPU(first_cpu), machine, &vms->bootinfo); in machvirt_init()
2450 vms->machine_done.notify = virt_machine_done; in machvirt_init()
2451 qemu_add_machine_init_done_notifier(&vms->machine_done); in machvirt_init()
2458 return vms->secure; in virt_get_secure()
2465 vms->secure = value; in virt_set_secure()
2472 return vms->virt; in virt_get_virt()
2479 vms->virt = value; in virt_set_virt()
2486 return vms->highmem; in virt_get_highmem()
2493 vms->highmem = value; in virt_set_highmem()
2500 return vms->highmem_compact; in virt_get_compact_highmem()
2507 vms->highmem_compact = value; in virt_set_compact_highmem()
2514 return vms->highmem_redists; in virt_get_highmem_redists()
2521 vms->highmem_redists = value; in virt_set_highmem_redists()
2528 return vms->highmem_ecam; in virt_get_highmem_ecam()
2535 vms->highmem_ecam = value; in virt_set_highmem_ecam()
2542 return vms->highmem_mmio; in virt_get_highmem_mmio()
2549 vms->highmem_mmio = value; in virt_set_highmem_mmio()
2557 return vms->its; in virt_get_its()
2564 vms->its = value; in virt_set_its()
2571 return vms->dtb_randomness; in virt_get_dtb_randomness()
2578 vms->dtb_randomness = value; in virt_set_dtb_randomness()
2585 return g_strdup(vms->oem_id); in virt_get_oem_id()
2595 "User specified oem-id value is bigger than 6 bytes in size"); in virt_set_oem_id()
2599 strncpy(vms->oem_id, value, 6); in virt_set_oem_id()
2606 return g_strdup(vms->oem_table_id); in virt_get_oem_table_id()
2617 "User specified oem-table-id value is bigger than 8 bytes in size"); in virt_set_oem_table_id()
2620 strncpy(vms->oem_table_id, value, 8); in virt_set_oem_table_id()
2626 if (vms->acpi == ON_OFF_AUTO_OFF) { in virt_is_acpi_enabled()
2636 OnOffAuto acpi = vms->acpi; in virt_get_acpi()
2646 visit_type_OnOffAuto(v, name, &vms->acpi, errp); in virt_set_acpi()
2653 return vms->ras; in virt_get_ras()
2660 vms->ras = value; in virt_set_ras()
2667 return vms->mte; in virt_get_mte()
2674 vms->mte = value; in virt_set_mte()
2682 switch (vms->gic_version) { in virt_get_gic_version()
2701 vms->gic_version = VIRT_GIC_VERSION_4; in virt_set_gic_version()
2703 vms->gic_version = VIRT_GIC_VERSION_3; in virt_set_gic_version()
2705 vms->gic_version = VIRT_GIC_VERSION_2; in virt_set_gic_version()
2707 vms->gic_version = VIRT_GIC_VERSION_HOST; /* Will probe later */ in virt_set_gic_version()
2709 vms->gic_version = VIRT_GIC_VERSION_MAX; /* Will probe later */ in virt_set_gic_version()
2711 error_setg(errp, "Invalid gic-version value"); in virt_set_gic_version()
2720 switch (vms->iommu) { in virt_get_iommu()
2735 vms->iommu = VIRT_IOMMU_SMMUV3; in virt_set_iommu()
2737 vms->iommu = VIRT_IOMMU_NONE; in virt_set_iommu()
2748 return vms->default_bus_bypass_iommu; in virt_get_default_bus_bypass_iommu()
2756 vms->default_bus_bypass_iommu = value; in virt_set_default_bus_bypass_iommu()
2763 const CPUArchIdList *possible_cpus = mc->possible_cpu_arch_ids(ms); in virt_cpu_index_to_props()
2765 assert(cpu_index < possible_cpus->len); in virt_cpu_index_to_props()
2766 return possible_cpus->cpus[cpu_index].props; in virt_cpu_index_to_props()
2771 int64_t socket_id = ms->possible_cpus->cpus[idx].props.socket_id; in virt_get_default_cpu_node_id()
2773 return socket_id % ms->numa_state->num_nodes; in virt_get_default_cpu_node_id()
2779 unsigned int max_cpus = ms->smp.max_cpus; in virt_possible_cpu_arch_ids()
2783 if (ms->possible_cpus) { in virt_possible_cpu_arch_ids()
2784 assert(ms->possible_cpus->len == max_cpus); in virt_possible_cpu_arch_ids()
2785 return ms->possible_cpus; in virt_possible_cpu_arch_ids()
2788 ms->possible_cpus = g_malloc0(sizeof(CPUArchIdList) + in virt_possible_cpu_arch_ids()
2790 ms->possible_cpus->len = max_cpus; in virt_possible_cpu_arch_ids()
2791 for (n = 0; n < ms->possible_cpus->len; n++) { in virt_possible_cpu_arch_ids()
2792 ms->possible_cpus->cpus[n].type = ms->cpu_type; in virt_possible_cpu_arch_ids()
2793 ms->possible_cpus->cpus[n].arch_id = in virt_possible_cpu_arch_ids()
2796 assert(!mc->smp_props.dies_supported); in virt_possible_cpu_arch_ids()
2797 ms->possible_cpus->cpus[n].props.has_socket_id = true; in virt_possible_cpu_arch_ids()
2798 ms->possible_cpus->cpus[n].props.socket_id = in virt_possible_cpu_arch_ids()
2799 n / (ms->smp.clusters * ms->smp.cores * ms->smp.threads); in virt_possible_cpu_arch_ids()
2800 ms->possible_cpus->cpus[n].props.has_cluster_id = true; in virt_possible_cpu_arch_ids()
2801 ms->possible_cpus->cpus[n].props.cluster_id = in virt_possible_cpu_arch_ids()
2802 (n / (ms->smp.cores * ms->smp.threads)) % ms->smp.clusters; in virt_possible_cpu_arch_ids()
2803 ms->possible_cpus->cpus[n].props.has_core_id = true; in virt_possible_cpu_arch_ids()
2804 ms->possible_cpus->cpus[n].props.core_id = in virt_possible_cpu_arch_ids()
2805 (n / ms->smp.threads) % ms->smp.cores; in virt_possible_cpu_arch_ids()
2806 ms->possible_cpus->cpus[n].props.has_thread_id = true; in virt_possible_cpu_arch_ids()
2807 ms->possible_cpus->cpus[n].props.thread_id = in virt_possible_cpu_arch_ids()
2808 n % ms->smp.threads; in virt_possible_cpu_arch_ids()
2810 return ms->possible_cpus; in virt_possible_cpu_arch_ids()
2820 if (!vms->acpi_dev) { in virt_memory_pre_plug()
2822 "memory hotplug is not enabled: missing acpi-ged device"); in virt_memory_pre_plug()
2826 if (vms->mte) { in virt_memory_pre_plug()
2831 if (is_nvdimm && !ms->nvdimms_state->is_enabled) { in virt_memory_pre_plug()
2832 error_setg(errp, "nvdimm is not enabled: add 'nvdimm=on' to '-M'"); in virt_memory_pre_plug()
2849 nvdimm_plug(ms->nvdimms_state); in virt_memory_plug()
2852 hotplug_handler_plug(HOTPLUG_HANDLER(vms->acpi_dev), in virt_memory_plug()
2870 if (vms->iommu != VIRT_IOMMU_NONE) { in virt_machine_device_pre_plug_cb()
2875 switch (vms->msi_controller) { in virt_machine_device_pre_plug_cb()
2882 base_memmap[VIRT_GIC_ITS].size - 1; in virt_machine_device_pre_plug_cb()
2887 db_end = db_start + base_memmap[VIRT_GIC_V2M].size - 1; in virt_machine_device_pre_plug_cb()
2896 qdev_prop_set_array(dev, "reserved-regions", reserved_regions); in virt_machine_device_pre_plug_cb()
2906 if (vms->platform_bus_dev) { in virt_machine_device_plug_cb()
2910 platform_bus_link_device(PLATFORM_BUS_DEVICE(vms->platform_bus_dev), in virt_machine_device_plug_cb()
2924 vms->iommu = VIRT_IOMMU_VIRTIO; in virt_machine_device_plug_cb()
2925 vms->virtio_iommu_bdf = pci_get_bdf(pdev); in virt_machine_device_plug_cb()
2935 if (!vms->acpi_dev) { in virt_dimm_unplug_request()
2937 "memory hotplug is not enabled: missing acpi-ged device"); in virt_dimm_unplug_request()
2946 hotplug_handler_unplug_request(HOTPLUG_HANDLER(vms->acpi_dev), dev, in virt_dimm_unplug_request()
2956 hotplug_handler_unplug(HOTPLUG_HANDLER(vms->acpi_dev), dev, &local_err); in virt_dimm_unplug()
3010 * for arm64 kvm_type [7-0] encodes the requested number of bits
3024 requested_pa_size = 64 - clz64(vms->highest_gpa); in virt_kvm_type()
3034 error_report("-m and ,maxmem option values " in virt_kvm_type()
3038 return -1; in virt_kvm_type()
3058 int requested_ipa_size = 64 - clz64(vms->highest_gpa); in virt_hvf_get_physical_address_range()
3071 error_report("-m and ,maxmem option values " in virt_hvf_get_physical_address_range()
3075 return -1; in virt_hvf_get_physical_address_range()
3087 ARM_CPU_TYPE_NAME("cortex-a7"), in virt_machine_class_init()
3088 ARM_CPU_TYPE_NAME("cortex-a15"), in virt_machine_class_init()
3090 ARM_CPU_TYPE_NAME("cortex-a35"), in virt_machine_class_init()
3091 ARM_CPU_TYPE_NAME("cortex-a55"), in virt_machine_class_init()
3092 ARM_CPU_TYPE_NAME("cortex-a72"), in virt_machine_class_init()
3093 ARM_CPU_TYPE_NAME("cortex-a76"), in virt_machine_class_init()
3094 ARM_CPU_TYPE_NAME("cortex-a710"), in virt_machine_class_init()
3096 ARM_CPU_TYPE_NAME("neoverse-n1"), in virt_machine_class_init()
3097 ARM_CPU_TYPE_NAME("neoverse-v1"), in virt_machine_class_init()
3098 ARM_CPU_TYPE_NAME("neoverse-n2"), in virt_machine_class_init()
3102 ARM_CPU_TYPE_NAME("cortex-a53"), in virt_machine_class_init()
3103 ARM_CPU_TYPE_NAME("cortex-a57"), in virt_machine_class_init()
3112 mc->init = machvirt_init; in virt_machine_class_init()
3117 mc->max_cpus = 512; in virt_machine_class_init()
3125 mc->block_default_type = IF_VIRTIO; in virt_machine_class_init()
3126 mc->no_cdrom = 1; in virt_machine_class_init()
3127 mc->pci_allow_0_address = true; in virt_machine_class_init()
3128 /* We know we will never create a pre-ARMv7 CPU which needs 1K pages */ in virt_machine_class_init()
3129 mc->minimum_page_bits = 12; in virt_machine_class_init()
3130 mc->possible_cpu_arch_ids = virt_possible_cpu_arch_ids; in virt_machine_class_init()
3131 mc->cpu_index_to_instance_props = virt_cpu_index_to_props; in virt_machine_class_init()
3133 mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a15"); in virt_machine_class_init()
3135 mc->default_cpu_type = ARM_CPU_TYPE_NAME("max"); in virt_machine_class_init()
3137 mc->valid_cpu_types = valid_cpu_types; in virt_machine_class_init()
3138 mc->get_default_cpu_node_id = virt_get_default_cpu_node_id; in virt_machine_class_init()
3139 mc->kvm_type = virt_kvm_type; in virt_machine_class_init()
3140 mc->hvf_get_physical_address_range = virt_hvf_get_physical_address_range; in virt_machine_class_init()
3141 assert(!mc->get_hotplug_handler); in virt_machine_class_init()
3142 mc->get_hotplug_handler = virt_machine_get_hotplug_handler; in virt_machine_class_init()
3143 hc->pre_plug = virt_machine_device_pre_plug_cb; in virt_machine_class_init()
3144 hc->plug = virt_machine_device_plug_cb; in virt_machine_class_init()
3145 hc->unplug_request = virt_machine_device_unplug_request_cb; in virt_machine_class_init()
3146 hc->unplug = virt_machine_device_unplug_cb; in virt_machine_class_init()
3147 mc->nvdimm_supported = true; in virt_machine_class_init()
3148 mc->smp_props.clusters_supported = true; in virt_machine_class_init()
3149 mc->auto_enable_numa_with_memhp = true; in virt_machine_class_init()
3150 mc->auto_enable_numa_with_memdev = true; in virt_machine_class_init()
3152 mc->cpu_cluster_has_numa_boundary = true; in virt_machine_class_init()
3153 mc->default_ram_id = "mach-virt.ram"; in virt_machine_class_init()
3154 mc->default_nic = "virtio-net-pci"; in virt_machine_class_init()
3164 "Set on/off to enable/disable the ARM " in virt_machine_class_init()
3170 "Set on/off to enable/disable emulating a " in virt_machine_class_init()
3177 "Set on/off to enable/disable using " in virt_machine_class_init()
3180 object_class_property_add_bool(oc, "compact-highmem", in virt_machine_class_init()
3183 object_class_property_set_description(oc, "compact-highmem", in virt_machine_class_init()
3184 "Set on/off to enable/disable compact " in virt_machine_class_init()
3187 object_class_property_add_bool(oc, "highmem-redists", in virt_machine_class_init()
3190 object_class_property_set_description(oc, "highmem-redists", in virt_machine_class_init()
3191 "Set on/off to enable/disable high " in virt_machine_class_init()
3195 object_class_property_add_bool(oc, "highmem-ecam", in virt_machine_class_init()
3198 object_class_property_set_description(oc, "highmem-ecam", in virt_machine_class_init()
3199 "Set on/off to enable/disable high " in virt_machine_class_init()
3202 object_class_property_add_bool(oc, "highmem-mmio", in virt_machine_class_init()
3205 object_class_property_set_description(oc, "highmem-mmio", in virt_machine_class_init()
3206 "Set on/off to enable/disable high " in virt_machine_class_init()
3209 object_class_property_add_str(oc, "gic-version", virt_get_gic_version, in virt_machine_class_init()
3211 object_class_property_set_description(oc, "gic-version", in virt_machine_class_init()
3220 object_class_property_add_bool(oc, "default-bus-bypass-iommu", in virt_machine_class_init()
3223 object_class_property_set_description(oc, "default-bus-bypass-iommu", in virt_machine_class_init()
3224 "Set on/off to enable/disable " in virt_machine_class_init()
3230 … "Set on/off to enable/disable reporting host memory errors " in virt_machine_class_init()
3235 "Set on/off to enable/disable emulating a " in virt_machine_class_init()
3242 "Set on/off to enable/disable " in virt_machine_class_init()
3245 object_class_property_add_bool(oc, "dtb-randomness", in virt_machine_class_init()
3248 object_class_property_set_description(oc, "dtb-randomness", in virt_machine_class_init()
3249 "Set off to disable passing random or " in virt_machine_class_init()
3250 "non-deterministic dtb nodes to guest"); in virt_machine_class_init()
3252 object_class_property_add_bool(oc, "dtb-kaslr-seed", in virt_machine_class_init()
3255 object_class_property_set_description(oc, "dtb-kaslr-seed", in virt_machine_class_init()
3256 "Deprecated synonym of dtb-randomness"); in virt_machine_class_init()
3258 object_class_property_add_str(oc, "x-oem-id", in virt_machine_class_init()
3261 object_class_property_set_description(oc, "x-oem-id", in virt_machine_class_init()
3267 object_class_property_add_str(oc, "x-oem-table-id", in virt_machine_class_init()
3270 object_class_property_set_description(oc, "x-oem-table-id", in virt_machine_class_init()
3286 vms->secure = false; in virt_instance_init()
3289 vms->virt = false; in virt_instance_init()
3292 vms->highmem = true; in virt_instance_init()
3293 vms->highmem_compact = !vmc->no_highmem_compact; in virt_instance_init()
3294 vms->gic_version = VIRT_GIC_VERSION_NOSEL; in virt_instance_init()
3296 vms->highmem_ecam = !vmc->no_highmem_ecam; in virt_instance_init()
3297 vms->highmem_mmio = true; in virt_instance_init()
3298 vms->highmem_redists = true; in virt_instance_init()
3300 if (vmc->no_its) { in virt_instance_init()
3301 vms->its = false; in virt_instance_init()
3304 vms->its = true; in virt_instance_init()
3306 if (vmc->no_tcg_its) { in virt_instance_init()
3307 vms->tcg_its = false; in virt_instance_init()
3309 vms->tcg_its = true; in virt_instance_init()
3314 vms->iommu = VIRT_IOMMU_NONE; in virt_instance_init()
3317 vms->default_bus_bypass_iommu = false; in virt_instance_init()
3320 vms->ras = false; in virt_instance_init()
3323 vms->mte = false; in virt_instance_init()
3325 /* Supply kaslr-seed and rng-seed by default */ in virt_instance_init()
3326 vms->dtb_randomness = true; in virt_instance_init()
3328 vms->irqmap = a15irqmap; in virt_instance_init()
3332 vms->oem_id = g_strndup(ACPI_BUILD_APPNAME6, 6); in virt_instance_init()
3333 vms->oem_table_id = g_strndup(ACPI_BUILD_APPNAME8, 8); in virt_instance_init()
3366 compat_props_add(mc->compat_props, hw_compat_9_1, hw_compat_9_1_len); in virt_machine_9_1_options()
3367 /* 9.1 and earlier have only a stage-1 SMMU, not a nested s1+2 one */ in virt_machine_9_1_options()
3368 vmc->no_nested_smmu = true; in virt_machine_9_1_options()
3375 mc->smbios_memory_device_size = 16 * GiB; in virt_machine_9_0_options()
3376 compat_props_add(mc->compat_props, hw_compat_9_0, hw_compat_9_0_len); in virt_machine_9_0_options()
3385 compat_props_add(mc->compat_props, hw_compat_8_2, hw_compat_8_2_len); in virt_machine_8_2_options()
3391 vmc->no_ns_el2_virt_timer_irq = true; in virt_machine_8_2_options()
3398 compat_props_add(mc->compat_props, hw_compat_8_1, hw_compat_8_1_len); in virt_machine_8_1_options()
3405 compat_props_add(mc->compat_props, hw_compat_8_0, hw_compat_8_0_len); in virt_machine_8_0_options()
3412 compat_props_add(mc->compat_props, hw_compat_7_2, hw_compat_7_2_len); in virt_machine_7_2_options()
3421 compat_props_add(mc->compat_props, hw_compat_7_1, hw_compat_7_1_len); in virt_machine_7_1_options()
3423 vmc->no_highmem_compact = true; in virt_machine_7_1_options()
3430 compat_props_add(mc->compat_props, hw_compat_7_0, hw_compat_7_0_len); in virt_machine_7_0_options()
3439 compat_props_add(mc->compat_props, hw_compat_6_2, hw_compat_6_2_len); in virt_machine_6_2_options()
3440 vmc->no_tcg_lpa2 = true; in virt_machine_6_2_options()
3449 compat_props_add(mc->compat_props, hw_compat_6_1, hw_compat_6_1_len); in virt_machine_6_1_options()
3450 mc->smp_props.prefer_sockets = true; in virt_machine_6_1_options()
3451 vmc->no_cpu_topology = true; in virt_machine_6_1_options()
3454 vmc->no_tcg_its = true; in virt_machine_6_1_options()
3461 compat_props_add(mc->compat_props, hw_compat_6_0, hw_compat_6_0_len); in virt_machine_6_0_options()
3470 compat_props_add(mc->compat_props, hw_compat_5_2, hw_compat_5_2_len); in virt_machine_5_2_options()
3471 vmc->no_secure_gpio = true; in virt_machine_5_2_options()
3480 compat_props_add(mc->compat_props, hw_compat_5_1, hw_compat_5_1_len); in virt_machine_5_1_options()
3481 vmc->no_kvm_steal_time = true; in virt_machine_5_1_options()
3490 compat_props_add(mc->compat_props, hw_compat_5_0, hw_compat_5_0_len); in virt_machine_5_0_options()
3491 mc->numa_mem_supported = true; in virt_machine_5_0_options()
3492 vmc->acpi_expose_flash = true; in virt_machine_5_0_options()
3493 mc->auto_enable_numa_with_memdev = false; in virt_machine_5_0_options()
3502 compat_props_add(mc->compat_props, hw_compat_4_2, hw_compat_4_2_len); in virt_machine_4_2_options()
3503 vmc->kvm_no_adjvtime = true; in virt_machine_4_2_options()
3512 compat_props_add(mc->compat_props, hw_compat_4_1, hw_compat_4_1_len); in virt_machine_4_1_options()
3513 vmc->no_ged = true; in virt_machine_4_1_options()
3514 mc->auto_enable_numa_with_memhp = false; in virt_machine_4_1_options()
3521 compat_props_add(mc->compat_props, hw_compat_4_0, hw_compat_4_0_len); in virt_machine_4_0_options()
3528 compat_props_add(mc->compat_props, hw_compat_3_1, hw_compat_3_1_len); in virt_machine_3_1_options()
3535 compat_props_add(mc->compat_props, hw_compat_3_0, hw_compat_3_0_len); in virt_machine_3_0_options()
3544 compat_props_add(mc->compat_props, hw_compat_2_12, hw_compat_2_12_len); in virt_machine_2_12_options()
3545 vmc->no_highmem_ecam = true; in virt_machine_2_12_options()
3546 mc->max_cpus = 255; in virt_machine_2_12_options()
3555 compat_props_add(mc->compat_props, hw_compat_2_11, hw_compat_2_11_len); in virt_machine_2_11_options()
3556 vmc->smbios_old_sys_ver = true; in virt_machine_2_11_options()
3563 compat_props_add(mc->compat_props, hw_compat_2_10, hw_compat_2_10_len); in virt_machine_2_10_options()
3565 mc->ignore_memory_transaction_failures = true; in virt_machine_2_10_options()
3572 compat_props_add(mc->compat_props, hw_compat_2_9, hw_compat_2_9_len); in virt_machine_2_9_options()
3581 compat_props_add(mc->compat_props, hw_compat_2_8, hw_compat_2_8_len); in virt_machine_2_8_options()
3583 * our timers were edge-triggered, not level-triggered. in virt_machine_2_8_options()
3585 vmc->claim_edge_triggered_timers = true; in virt_machine_2_8_options()
3594 compat_props_add(mc->compat_props, hw_compat_2_7, hw_compat_2_7_len); in virt_machine_2_7_options()
3596 vmc->no_its = true; in virt_machine_2_7_options()
3598 mc->minimum_page_bits = 0; in virt_machine_2_7_options()
3607 compat_props_add(mc->compat_props, hw_compat_2_6, hw_compat_2_6_len); in virt_machine_2_6_options()
3608 vmc->disallow_affinity_adjustment = true; in virt_machine_2_6_options()
3609 /* Disable PMU for 2.6 as PMU support was first introduced in 2.7 */ in virt_machine_2_6_options()
3610 vmc->no_pmu = true; in virt_machine_2_6_options()