2 * Copyright (c) 2018 Intel Corporation
3 * Copyright (c) 2019 Red Hat, Inc.
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.
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * You should have received a copy of the GNU General Public License along with
15 * this program. If not, see <http://www.gnu.org/licenses/>.
18 #ifndef HW_I386_MICROVM_H
19 #define HW_I386_MICROVM_H
21 #include "qemu-common.h"
22 #include "exec/hwaddr.h"
23 #include "qemu/notify.h"
25 #include "hw/boards.h"
26 #include "hw/i386/x86.h"
28 /* Platform virtio definitions */
29 #define VIRTIO_MMIO_BASE 0xfeb00000
30 #define VIRTIO_IRQ_BASE 5
31 #define VIRTIO_NUM_TRANSPORTS 8
32 #define VIRTIO_CMDLINE_MAXLEN 64
34 /* Machine type options */
35 #define MICROVM_MACHINE_PIT "pit"
36 #define MICROVM_MACHINE_PIC "pic"
37 #define MICROVM_MACHINE_RTC "rtc"
38 #define MICROVM_MACHINE_ISA_SERIAL "isa-serial"
39 #define MICROVM_MACHINE_OPTION_ROMS "x-option-roms"
40 #define MICROVM_MACHINE_AUTO_KERNEL_CMDLINE "auto-kernel-cmdline"
43 X86MachineClass parent
;
44 HotplugHandler
*(*orig_hotplug_handler
)(MachineState
*machine
,
46 } MicrovmMachineClass
;
49 X86MachineState parent
;
51 /* Machine type options */
57 bool auto_kernel_cmdline
;
60 bool kernel_cmdline_fixed
;
61 } MicrovmMachineState
;
63 #define TYPE_MICROVM_MACHINE MACHINE_TYPE_NAME("microvm")
64 #define MICROVM_MACHINE(obj) \
65 OBJECT_CHECK(MicrovmMachineState, (obj), TYPE_MICROVM_MACHINE)
66 #define MICROVM_MACHINE_GET_CLASS(obj) \
67 OBJECT_GET_CLASS(MicrovmMachineClass, obj, TYPE_MICROVM_MACHINE)
68 #define MICROVM_MACHINE_CLASS(class) \
69 OBJECT_CLASS_CHECK(MicrovmMachineClass, class, TYPE_MICROVM_MACHINE)