hw/arm/virt: pass VirtMachineState instead of VirtGuestInfo
[qemu/ar7.git] / include / hw / arm / virt.h
blobb1eed52d3b48436f1e2b208011a71ec340ada43c
1 /*
3 * Copyright (c) 2015 Linaro Limited
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
12 * more details.
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/>.
17 * Emulate a virtual board which works by passing Linux all the information
18 * it needs about what devices are present via the device tree.
19 * There are some restrictions about what we can do here:
20 * + we can only present devices whose Linux drivers will work based
21 * purely on the device tree with no platform data at all
22 * + we want to present a very stripped-down minimalist platform,
23 * both because this reduces the security attack surface from the guest
24 * and also because it reduces our exposure to being broken when
25 * the kernel updates its device tree bindings and requires further
26 * information in a device binding that we aren't providing.
27 * This is essentially the same approach kvmtool uses.
30 #ifndef QEMU_ARM_VIRT_H
31 #define QEMU_ARM_VIRT_H
33 #include "qemu-common.h"
34 #include "exec/hwaddr.h"
35 #include "qemu/notify.h"
36 #include "hw/boards.h"
37 #include "hw/arm/arm.h"
39 #define NUM_GICV2M_SPIS 64
40 #define NUM_VIRTIO_TRANSPORTS 32
42 #define ARCH_TIMER_VIRT_IRQ 11
43 #define ARCH_TIMER_S_EL1_IRQ 13
44 #define ARCH_TIMER_NS_EL1_IRQ 14
45 #define ARCH_TIMER_NS_EL2_IRQ 10
47 #define VIRTUAL_PMU_IRQ 7
49 #define PPI(irq) ((irq) + 16)
51 enum {
52 VIRT_FLASH,
53 VIRT_MEM,
54 VIRT_CPUPERIPHS,
55 VIRT_GIC_DIST,
56 VIRT_GIC_CPU,
57 VIRT_GIC_V2M,
58 VIRT_GIC_ITS,
59 VIRT_GIC_REDIST,
60 VIRT_UART,
61 VIRT_MMIO,
62 VIRT_RTC,
63 VIRT_FW_CFG,
64 VIRT_PCIE,
65 VIRT_PCIE_MMIO,
66 VIRT_PCIE_PIO,
67 VIRT_PCIE_ECAM,
68 VIRT_PLATFORM_BUS,
69 VIRT_PCIE_MMIO_HIGH,
70 VIRT_GPIO,
71 VIRT_SECURE_UART,
72 VIRT_SECURE_MEM,
75 typedef struct MemMapEntry {
76 hwaddr base;
77 hwaddr size;
78 } MemMapEntry;
80 typedef struct VirtGuestInfo {
81 int smp_cpus;
82 FWCfgState *fw_cfg;
83 const MemMapEntry *memmap;
84 const int *irqmap;
85 bool use_highmem;
86 int gic_version;
87 bool no_its;
88 } VirtGuestInfo;
90 typedef struct {
91 MachineClass parent;
92 bool disallow_affinity_adjustment;
93 bool no_its;
94 bool no_pmu;
95 bool claim_edge_triggered_timers;
96 } VirtMachineClass;
98 typedef struct {
99 MachineState parent;
100 VirtGuestInfo acpi_guest_info;
101 Notifier machine_done;
102 bool secure;
103 bool highmem;
104 int32_t gic_version;
105 struct arm_boot_info bootinfo;
106 const MemMapEntry *memmap;
107 const int *irqmap;
108 int smp_cpus;
109 void *fdt;
110 int fdt_size;
111 uint32_t clock_phandle;
112 uint32_t gic_phandle;
113 uint32_t msi_phandle;
114 bool using_psci;
115 } VirtMachineState;
117 #define TYPE_VIRT_MACHINE MACHINE_TYPE_NAME("virt")
118 #define VIRT_MACHINE(obj) \
119 OBJECT_CHECK(VirtMachineState, (obj), TYPE_VIRT_MACHINE)
120 #define VIRT_MACHINE_GET_CLASS(obj) \
121 OBJECT_GET_CLASS(VirtMachineClass, obj, TYPE_VIRT_MACHINE)
122 #define VIRT_MACHINE_CLASS(klass) \
123 OBJECT_CLASS_CHECK(VirtMachineClass, klass, TYPE_VIRT_MACHINE)
125 void virt_acpi_setup(VirtMachineState *vms);
127 #endif /* QEMU_ARM_VIRT_H */