microvm.c (f014c974595a1e3482c6afb57557a6e479b80328) microvm.c (f5918a992839454c6e87234760bdf7aee804aa33)
1/*
2 * Copyright (c) 2018 Intel Corporation
3 * Copyright (c) 2019 Red Hat, Inc.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2 or later, as published by the Free Software Foundation.
8 *

--- 14 unchanged lines hidden (view full) ---

23#include "qapi/visitor.h"
24#include "qapi/qapi-visit-common.h"
25#include "sysemu/sysemu.h"
26#include "sysemu/cpus.h"
27#include "sysemu/numa.h"
28#include "sysemu/reset.h"
29#include "sysemu/runstate.h"
30#include "acpi-microvm.h"
1/*
2 * Copyright (c) 2018 Intel Corporation
3 * Copyright (c) 2019 Red Hat, Inc.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2 or later, as published by the Free Software Foundation.
8 *

--- 14 unchanged lines hidden (view full) ---

23#include "qapi/visitor.h"
24#include "qapi/qapi-visit-common.h"
25#include "sysemu/sysemu.h"
26#include "sysemu/cpus.h"
27#include "sysemu/numa.h"
28#include "sysemu/reset.h"
29#include "sysemu/runstate.h"
30#include "acpi-microvm.h"
31#include "microvm-dt.h"
31
32#include "hw/loader.h"
33#include "hw/irq.h"
34#include "hw/kvm/clock.h"
35#include "hw/i386/microvm.h"
36#include "hw/i386/x86.h"
37#include "target/i386/cpu.h"
38#include "hw/intc/i8259.h"

--- 287 unchanged lines hidden (view full) ---

326 fw_cfg_add_bytes(fw_cfg, FW_CFG_E820_TABLE,
327 &e820_reserve, sizeof(e820_reserve));
328 fw_cfg_add_file(fw_cfg, "etc/e820", e820_table,
329 sizeof(struct e820_entry) * e820_get_num_entries());
330
331 rom_set_fw(fw_cfg);
332
333 if (machine->kernel_filename != NULL) {
32
33#include "hw/loader.h"
34#include "hw/irq.h"
35#include "hw/kvm/clock.h"
36#include "hw/i386/microvm.h"
37#include "hw/i386/x86.h"
38#include "target/i386/cpu.h"
39#include "hw/intc/i8259.h"

--- 287 unchanged lines hidden (view full) ---

327 fw_cfg_add_bytes(fw_cfg, FW_CFG_E820_TABLE,
328 &e820_reserve, sizeof(e820_reserve));
329 fw_cfg_add_file(fw_cfg, "etc/e820", e820_table,
330 sizeof(struct e820_entry) * e820_get_num_entries());
331
332 rom_set_fw(fw_cfg);
333
334 if (machine->kernel_filename != NULL) {
334 x86_load_linux(x86ms, fw_cfg, 0, true);
335 x86_load_linux(x86ms, fw_cfg, 0, true, true);
335 }
336
337 if (mms->option_roms) {
338 for (i = 0; i < nb_option_roms; i++) {
339 rom_add_option(option_rom[i].name, option_rom[i].bootindex);
340 }
341 }
342

--- 278 unchanged lines hidden (view full) ---

621}
622
623static void microvm_machine_done(Notifier *notifier, void *data)
624{
625 MicrovmMachineState *mms = container_of(notifier, MicrovmMachineState,
626 machine_done);
627
628 acpi_setup_microvm(mms);
336 }
337
338 if (mms->option_roms) {
339 for (i = 0; i < nb_option_roms; i++) {
340 rom_add_option(option_rom[i].name, option_rom[i].bootindex);
341 }
342 }
343

--- 278 unchanged lines hidden (view full) ---

622}
623
624static void microvm_machine_done(Notifier *notifier, void *data)
625{
626 MicrovmMachineState *mms = container_of(notifier, MicrovmMachineState,
627 machine_done);
628
629 acpi_setup_microvm(mms);
630 dt_setup_microvm(mms);
629}
630
631static void microvm_powerdown_req(Notifier *notifier, void *data)
632{
633 MicrovmMachineState *mms = container_of(notifier, MicrovmMachineState,
634 powerdown_req);
635 X86MachineState *x86ms = X86_MACHINE(mms);
636

--- 25 unchanged lines hidden (view full) ---

662 mms->machine_done.notify = microvm_machine_done;
663 qemu_add_machine_init_done_notifier(&mms->machine_done);
664 mms->powerdown_req.notify = microvm_powerdown_req;
665 qemu_register_powerdown_notifier(&mms->powerdown_req);
666}
667
668static void microvm_class_init(ObjectClass *oc, void *data)
669{
631}
632
633static void microvm_powerdown_req(Notifier *notifier, void *data)
634{
635 MicrovmMachineState *mms = container_of(notifier, MicrovmMachineState,
636 powerdown_req);
637 X86MachineState *x86ms = X86_MACHINE(mms);
638

--- 25 unchanged lines hidden (view full) ---

664 mms->machine_done.notify = microvm_machine_done;
665 qemu_add_machine_init_done_notifier(&mms->machine_done);
666 mms->powerdown_req.notify = microvm_powerdown_req;
667 qemu_register_powerdown_notifier(&mms->powerdown_req);
668}
669
670static void microvm_class_init(ObjectClass *oc, void *data)
671{
670 X86MachineClass *x86mc = X86_MACHINE_CLASS(oc);
671 MachineClass *mc = MACHINE_CLASS(oc);
672 HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc);
673
674 mc->init = microvm_machine_state_init;
675
676 mc->family = "microvm_i386";
677 mc->desc = "microvm (i386)";
678 mc->units_per_default_bus = 1;

--- 14 unchanged lines hidden (view full) ---

693
694 /* hotplug (for cpu coldplug) */
695 mc->get_hotplug_handler = microvm_get_hotplug_handler;
696 hc->pre_plug = microvm_device_pre_plug_cb;
697 hc->plug = microvm_device_plug_cb;
698 hc->unplug_request = microvm_device_unplug_request_cb;
699 hc->unplug = microvm_device_unplug_cb;
700
672 MachineClass *mc = MACHINE_CLASS(oc);
673 HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc);
674
675 mc->init = microvm_machine_state_init;
676
677 mc->family = "microvm_i386";
678 mc->desc = "microvm (i386)";
679 mc->units_per_default_bus = 1;

--- 14 unchanged lines hidden (view full) ---

694
695 /* hotplug (for cpu coldplug) */
696 mc->get_hotplug_handler = microvm_get_hotplug_handler;
697 hc->pre_plug = microvm_device_pre_plug_cb;
698 hc->plug = microvm_device_plug_cb;
699 hc->unplug_request = microvm_device_unplug_request_cb;
700 hc->unplug = microvm_device_unplug_cb;
701
701 x86mc->fwcfg_dma_enabled = true;
702
703 object_class_property_add(oc, MICROVM_MACHINE_PIC, "OnOffAuto",
704 microvm_machine_get_pic,
705 microvm_machine_set_pic,
706 NULL, NULL);
707 object_class_property_set_description(oc, MICROVM_MACHINE_PIC,
708 "Enable i8259 PIC");
709
710 object_class_property_add(oc, MICROVM_MACHINE_PIT, "OnOffAuto",

--- 67 unchanged lines hidden ---
702 object_class_property_add(oc, MICROVM_MACHINE_PIC, "OnOffAuto",
703 microvm_machine_get_pic,
704 microvm_machine_set_pic,
705 NULL, NULL);
706 object_class_property_set_description(oc, MICROVM_MACHINE_PIC,
707 "Enable i8259 PIC");
708
709 object_class_property_add(oc, MICROVM_MACHINE_PIT, "OnOffAuto",

--- 67 unchanged lines hidden ---