xref: /qemu/include/hw/i386/microvm.h (revision 8063396b)
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  *
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
12  * more details.
13  *
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/>.
16  */
17 
18 #ifndef HW_I386_MICROVM_H
19 #define HW_I386_MICROVM_H
20 
21 #include "qemu-common.h"
22 #include "exec/hwaddr.h"
23 #include "qemu/notify.h"
24 
25 #include "hw/boards.h"
26 #include "hw/i386/x86.h"
27 #include "hw/acpi/acpi_dev_interface.h"
28 #include "qom/object.h"
29 
30 /* Platform virtio definitions */
31 #define VIRTIO_MMIO_BASE      0xfeb00000
32 #define VIRTIO_NUM_TRANSPORTS 8
33 #define VIRTIO_CMDLINE_MAXLEN 64
34 
35 #define GED_MMIO_BASE         0xfea00000
36 #define GED_MMIO_BASE_MEMHP   (GED_MMIO_BASE + 0x100)
37 #define GED_MMIO_BASE_REGS    (GED_MMIO_BASE + 0x200)
38 #define GED_MMIO_IRQ          9
39 
40 /* Machine type options */
41 #define MICROVM_MACHINE_PIT                 "pit"
42 #define MICROVM_MACHINE_PIC                 "pic"
43 #define MICROVM_MACHINE_RTC                 "rtc"
44 #define MICROVM_MACHINE_ISA_SERIAL          "isa-serial"
45 #define MICROVM_MACHINE_OPTION_ROMS         "x-option-roms"
46 #define MICROVM_MACHINE_AUTO_KERNEL_CMDLINE "auto-kernel-cmdline"
47 
48 struct MicrovmMachineClass {
49     X86MachineClass parent;
50     HotplugHandler *(*orig_hotplug_handler)(MachineState *machine,
51                                            DeviceState *dev);
52 };
53 
54 struct MicrovmMachineState {
55     X86MachineState parent;
56 
57     /* Machine type options */
58     OnOffAuto pic;
59     OnOffAuto pit;
60     OnOffAuto rtc;
61     bool isa_serial;
62     bool option_roms;
63     bool auto_kernel_cmdline;
64 
65     /* Machine state */
66     uint32_t virtio_irq_base;
67     bool kernel_cmdline_fixed;
68     Notifier machine_done;
69     Notifier powerdown_req;
70 };
71 
72 #define TYPE_MICROVM_MACHINE   MACHINE_TYPE_NAME("microvm")
73 OBJECT_DECLARE_TYPE(MicrovmMachineState, MicrovmMachineClass, MICROVM_MACHINE)
74 
75 #endif
76