]> git.proxmox.com Git - mirror_qemu.git/blame - include/hw/i386/pc.h
hw/arm/virt: Add default_bus_bypass_iommu machine option
[mirror_qemu.git] / include / hw / i386 / pc.h
CommitLineData
87ecb68b
PB
1#ifndef HW_PC_H
2#define HW_PC_H
376253ec 3
fe8ce968
PMD
4#include "qemu/notify.h"
5#include "qapi/qapi-types-common.h"
9617cddb 6#include "qemu/uuid.h"
9521d42b 7#include "hw/boards.h"
0d09e41a 8#include "hw/block/fdc.h"
ebc29e1b 9#include "hw/block/flash.h"
f0bb276b 10#include "hw/i386/x86.h"
376253ec 11
ac35f13b 12#include "hw/acpi/acpi_dev_interface.h"
fe8ce968 13#include "hw/hotplug.h"
db1015e9 14#include "qom/object.h"
3459a625 15
7a10ef51
LPF
16#define HPET_INTCAP "hpet-intcap"
17
619d11e4
IM
18/**
19 * PCMachineState:
781bbd6b 20 * @acpi_dev: link to ACPI PM device that performs ACPI hotplug handling
e3cadac0 21 * @boot_cpus: number of present VCPUs
619d11e4 22 */
c8ed1cd7 23typedef struct PCMachineState {
d5747cac 24 /*< private >*/
f0bb276b 25 X86MachineState parent_obj;
619d11e4
IM
26
27 /* <public> */
13fc8343
EH
28
29 /* State for other subsystems/APIs: */
9ebeed0c 30 Notifier machine_done;
781bbd6b 31
13fc8343 32 /* Pointers to devices and objects: */
13fc8343 33 PCIBus *bus;
ebe15582 34 I2CBus *smbus;
ebc29e1b 35 PFlashCFI01 *flash[2];
6b8d1416 36 ISADevice *pcspk;
c87b1520 37
13fc8343 38 /* Configuration options: */
9a45729d 39 uint64_t max_ram_below_4g;
d1048bef 40 OnOffAuto vmport;
5fe79386 41
021746c1 42 bool acpi_build_enabled;
f5878b03
CM
43 bool smbus_enabled;
44 bool sata_enabled;
45 bool pit_enabled;
0259c78c 46 bool hpet_enabled;
0657c657 47 uint64_t max_fw_size;
021746c1 48
dd4c2f01
EH
49 /* NUMA information: */
50 uint64_t numa_nodes;
51 uint64_t *node_mem;
cb135f59 52
091c466e
SK
53 /* ACPI Memory hotplug IO base address */
54 hwaddr memhp_io_base;
c8ed1cd7 55} PCMachineState;
d5747cac 56
781bbd6b 57#define PC_MACHINE_ACPI_DEVICE_PROP "acpi-device"
9a45729d 58#define PC_MACHINE_MAX_RAM_BELOW_4G "max-ram-below-4g"
f2ffbe2b 59#define PC_MACHINE_DEVMEM_REGION_SIZE "device-memory-region-size"
9b23cfb7 60#define PC_MACHINE_VMPORT "vmport"
be232eb0 61#define PC_MACHINE_SMBUS "smbus"
272f0428 62#define PC_MACHINE_SATA "sata"
feddd2fd 63#define PC_MACHINE_PIT "pit"
0657c657 64#define PC_MACHINE_MAX_FW_SIZE "max-fw-size"
95bee274
IM
65/**
66 * PCMachineClass:
13fc8343 67 *
13fc8343
EH
68 * Compat fields:
69 *
16a9e8a5
EH
70 * @enforce_aligned_dimm: check that DIMM's address/size is aligned by
71 * backend's alignment value if provided
13fc8343
EH
72 * @acpi_data_size: Size of the chunk of memory at the top of RAM
73 * for the BIOS ACPI tables and other BIOS
74 * datastructures.
75 * @gigabyte_align: Make sure that guest addresses aligned at
76 * 1Gbyte boundaries get mapped to host
77 * addresses aligned at 1Gbyte boundaries. This
78 * way we can use 1GByte pages in the host.
79 *
95bee274 80 */
db1015e9 81struct PCMachineClass {
d5747cac 82 /*< private >*/
f0bb276b 83 X86MachineClass parent_class;
95bee274
IM
84
85 /*< public >*/
13fc8343 86
13fc8343 87 /* Device configuration: */
7102fa70 88 bool pci_enabled;
13fc8343 89 bool kvmclock_enabled;
4b9c264b 90 const char *default_nic_model;
13fc8343
EH
91
92 /* Compat options: */
93
0788a56b
EH
94 /* Default CPU model version. See x86_cpu_set_default_version(). */
95 int default_cpu_version;
96
13fc8343 97 /* ACPI compat: */
7102fa70
EH
98 bool has_acpi_build;
99 bool rsdp_in_ram;
13fc8343
EH
100 int legacy_acpi_table_size;
101 unsigned acpi_data_size;
ebe15582 102 bool do_not_add_smb_acpi;
0a343a5a 103 int pci_root_uid;
13fc8343
EH
104
105 /* SMBIOS compat: */
7102fa70
EH
106 bool smbios_defaults;
107 bool smbios_legacy_mode;
108 bool smbios_uuid_encoded;
13fc8343
EH
109
110 /* RAM / address space compat: */
7102fa70
EH
111 bool gigabyte_align;
112 bool has_reserved_memory;
16a9e8a5 113 bool enforce_aligned_dimm;
13fc8343 114 bool broken_reserved_end;
36f96c4b 115
679dd1a9
IM
116 /* generate legacy CPU hotplug AML */
117 bool legacy_cpu_hotplug;
98e753a6
IM
118
119 /* use DMA capable linuxboot option rom */
120 bool linuxboot_dma_enabled;
fda672b5
SG
121
122 /* use PVH to load kernels that support this feature */
123 bool pvh_enabled;
8700a984
VK
124
125 /* create kvmclock device even when KVM PV features are not exposed */
126 bool kvmclock_create_always;
db1015e9 127};
d5747cac 128
d5747cac 129#define TYPE_PC_MACHINE "generic-pc-machine"
a489d195 130OBJECT_DECLARE_TYPE(PCMachineState, PCMachineClass, PC_MACHINE)
d5747cac 131
d665d696
PB
132/* ioapic.c */
133
417258f1
PMD
134GSIState *pc_gsi_create(qemu_irq **irqs, bool pci_enabled);
135
87ecb68b
PB
136/* pc.c */
137extern int fd_bootchk;
138
845773ab
IY
139void pc_acpi_smi_interrupt(void *opaque, int irq, int level);
140
e4e8ba04 141void pc_guest_info_init(PCMachineState *pcms);
3459a625 142
39848901
IM
143#define PCI_HOST_PROP_PCI_HOLE_START "pci-hole-start"
144#define PCI_HOST_PROP_PCI_HOLE_END "pci-hole-end"
145#define PCI_HOST_PROP_PCI_HOLE64_START "pci-hole64-start"
146#define PCI_HOST_PROP_PCI_HOLE64_END "pci-hole64-end"
147#define PCI_HOST_PROP_PCI_HOLE64_SIZE "pci-hole64-size"
401f2f3e
EV
148#define PCI_HOST_BELOW_4G_MEM_SIZE "below-4g-mem-size"
149#define PCI_HOST_ABOVE_4G_MEM_SIZE "above-4g-mem-size"
1466cef3 150
39848901 151
83d08f26
MT
152void pc_pci_as_mapping_init(Object *owner, MemoryRegion *system_memory,
153 MemoryRegion *pci_address_space);
39848901 154
7bc35e0f 155void xen_load_linux(PCMachineState *pcms);
5934e216
EH
156void pc_memory_init(PCMachineState *pcms,
157 MemoryRegion *system_memory,
158 MemoryRegion *rom_memory,
159 MemoryRegion **ram_memory);
9fa99d25 160uint64_t pc_pci_hole64_start(void);
48a18b3c 161DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus);
10e2483b
GH
162void pc_basic_device_init(struct PCMachineState *pcms,
163 ISABus *isa_bus, qemu_irq *gsi,
1611977c 164 ISADevice **rtc_state,
fd53c87c 165 bool create_fdctrl,
3a87d009 166 uint32_t hpet_irqs);
48a18b3c 167void pc_init_ne2k_isa(ISABus *bus, NICInfo *nd);
23d30407 168void pc_cmos_init(PCMachineState *pcms,
220a8846 169 BusState *ide0, BusState *ide1,
63ffb564 170 ISADevice *s);
4b9c264b 171void pc_nic_init(PCMachineClass *pcmc, ISABus *isa_bus, PCIBus *pci_bus);
845773ab 172void pc_pci_device_init(PCIBus *pci_bus);
8e78eb28 173
f885f1ea 174typedef void (*cpu_set_smm_t)(int smm, void *arg);
f885f1ea 175
4501d317 176void pc_i8259_create(ISABus *isa_bus, qemu_irq *i8259_irqs);
a39e3564 177
424e4a87
RK
178ISADevice *pc_find_fdc0(void);
179
d3e07dc8 180/* port92.c */
d812b3d6
EV
181#define PORT92_A20_LINE "a20"
182
d3e07dc8
PMD
183#define TYPE_PORT92 "port92"
184
cbc5b5f3 185/* pc_sysfw.c */
ebc29e1b 186void pc_system_flash_create(PCMachineState *pcms);
dd29b5c3 187void pc_system_flash_cleanup_unused(PCMachineState *pcms);
5e640a9e 188void pc_system_firmware_init(PCMachineState *pcms, MemoryRegion *rom_memory);
9617cddb
JB
189bool pc_system_ovmf_table_find(const char *entry, uint8_t **data,
190 int *data_len);
b5b31860 191void pc_system_parse_ovmf_flash(uint8_t *flash_ptr, size_t flash_size);
9617cddb 192
cbc5b5f3 193
ac35f13b
IM
194/* acpi-build.c */
195void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid,
80e5db30 196 const CPUArchIdList *apic_ids, GArray *entry);
ac35f13b 197
da7e13c0
CH
198extern GlobalProperty pc_compat_6_0[];
199extern const size_t pc_compat_6_0_len;
200
576a00bd
CH
201extern GlobalProperty pc_compat_5_2[];
202extern const size_t pc_compat_5_2_len;
203
3ff3c5d3
CH
204extern GlobalProperty pc_compat_5_1[];
205extern const size_t pc_compat_5_1_len;
206
541aaa1d
CH
207extern GlobalProperty pc_compat_5_0[];
208extern const size_t pc_compat_5_0_len;
209
3eb74d20
CH
210extern GlobalProperty pc_compat_4_2[];
211extern const size_t pc_compat_4_2_len;
212
9aec2e52
CH
213extern GlobalProperty pc_compat_4_1[];
214extern const size_t pc_compat_4_1_len;
215
9bf2650b
CH
216extern GlobalProperty pc_compat_4_0[];
217extern const size_t pc_compat_4_0_len;
218
abd93cc7
MAL
219extern GlobalProperty pc_compat_3_1[];
220extern const size_t pc_compat_3_1_len;
84e060bf 221
ddb3235d
MAL
222extern GlobalProperty pc_compat_3_0[];
223extern const size_t pc_compat_3_0_len;
9b4cf107 224
0d47310b
MAL
225extern GlobalProperty pc_compat_2_12[];
226extern const size_t pc_compat_2_12_len;
968ee4ad 227
43df70a9
MAL
228extern GlobalProperty pc_compat_2_11[];
229extern const size_t pc_compat_2_11_len;
df47ce8a 230
503224f4
MAL
231extern GlobalProperty pc_compat_2_10[];
232extern const size_t pc_compat_2_10_len;
a6fd5b0e 233
3e803152
MAL
234extern GlobalProperty pc_compat_2_9[];
235extern const size_t pc_compat_2_9_len;
465238d9 236
edc24ccd
MAL
237extern GlobalProperty pc_compat_2_8[];
238extern const size_t pc_compat_2_8_len;
abc62c89 239
5a995064
MAL
240extern GlobalProperty pc_compat_2_7[];
241extern const size_t pc_compat_2_7_len;
14c985cf 242
ff8f261f
MAL
243extern GlobalProperty pc_compat_2_6[];
244extern const size_t pc_compat_2_6_len;
d86c1451 245
fe759610
MAL
246extern GlobalProperty pc_compat_2_5[];
247extern const size_t pc_compat_2_5_len;
240240d5 248
2f99b9c2
MAL
249extern GlobalProperty pc_compat_2_4[];
250extern const size_t pc_compat_2_4_len;
251
8995dd90
MAL
252extern GlobalProperty pc_compat_2_3[];
253extern const size_t pc_compat_2_3_len;
254
1c30044e
MAL
255extern GlobalProperty pc_compat_2_2[];
256extern const size_t pc_compat_2_2_len;
257
c4fc5695
MAL
258extern GlobalProperty pc_compat_2_1[];
259extern const size_t pc_compat_2_1_len;
260
a310e653
MAL
261extern GlobalProperty pc_compat_2_0[];
262extern const size_t pc_compat_2_0_len;
263
264extern GlobalProperty pc_compat_1_7[];
265extern const size_t pc_compat_1_7_len;
266
267extern GlobalProperty pc_compat_1_6[];
268extern const size_t pc_compat_1_6_len;
269
270extern GlobalProperty pc_compat_1_5[];
271extern const size_t pc_compat_1_5_len;
272
273extern GlobalProperty pc_compat_1_4[];
274extern const size_t pc_compat_1_4_len;
275
cd6c1b70
EH
276/* Helper for setting model-id for CPU models that changed model-id
277 * depending on QEMU versions up to QEMU 2.4.
278 */
279#define PC_CPU_MODEL_IDS(v) \
6c36bddf
EH
280 { "qemu32-" TYPE_X86_CPU, "model-id", "QEMU Virtual CPU version " v, },\
281 { "qemu64-" TYPE_X86_CPU, "model-id", "QEMU Virtual CPU version " v, },\
282 { "athlon-" TYPE_X86_CPU, "model-id", "QEMU Virtual CPU version " v, },
cd6c1b70 283
25519b06 284#define DEFINE_PC_MACHINE(suffix, namestr, initfn, optsfn) \
865906f7
EH
285 static void pc_machine_##suffix##_class_init(ObjectClass *oc, void *data) \
286 { \
287 MachineClass *mc = MACHINE_CLASS(oc); \
288 optsfn(mc); \
865906f7
EH
289 mc->init = initfn; \
290 } \
291 static const TypeInfo pc_machine_type_##suffix = { \
292 .name = namestr TYPE_MACHINE_SUFFIX, \
293 .parent = TYPE_PC_MACHINE, \
294 .class_init = pc_machine_##suffix##_class_init, \
295 }; \
61f219df
EH
296 static void pc_machine_init_##suffix(void) \
297 { \
865906f7 298 type_register(&pc_machine_type_##suffix); \
61f219df 299 } \
0e6aac87 300 type_init(pc_machine_init_##suffix)
61f219df 301
bd8107d7 302extern void igd_passthrough_isa_bridge_create(PCIBus *bus, uint16_t gpu_dev_id);
87ecb68b 303#endif