]> git.proxmox.com Git - mirror_qemu.git/blame - include/hw/i386/pc.h
memhp: extend address auto assignment to support gaps
[mirror_qemu.git] / include / hw / i386 / pc.h
CommitLineData
87ecb68b
PB
1#ifndef HW_PC_H
2#define HW_PC_H
376253ec
AL
3
4#include "qemu-common.h"
8170dfa0 5#include "qemu/typedefs.h"
022c62cb 6#include "exec/memory.h"
9521d42b 7#include "hw/boards.h"
0d09e41a
PB
8#include "hw/isa/isa.h"
9#include "hw/block/fdc.h"
1422e32d 10#include "net/net.h"
0d09e41a 11#include "hw/i386/ioapic.h"
376253ec 12
3459a625 13#include "qemu/range.h"
b20c9bd5
MT
14#include "qemu/bitmap.h"
15#include "sysemu/sysemu.h"
16#include "hw/pci/pci.h"
d5747cac 17#include "hw/boards.h"
68a27b20 18#include "hw/compat.h"
a7d69ff1 19#include "hw/mem/pc-dimm.h"
3459a625 20
7a10ef51
LPF
21#define HPET_INTCAP "hpet-intcap"
22
619d11e4
IM
23/**
24 * PCMachineState:
781bbd6b 25 * @acpi_dev: link to ACPI PM device that performs ACPI hotplug handling
91aa70ab
IM
26 * @enforce_aligned_dimm: check that DIMM's address/size is aligned by
27 * backend's alignment value if provided
619d11e4 28 */
d5747cac
IM
29struct PCMachineState {
30 /*< private >*/
31 MachineState parent_obj;
619d11e4
IM
32
33 /* <public> */
a7d69ff1 34 MemoryHotplugState hotplug_memory;
781bbd6b
IM
35
36 HotplugHandler *acpi_dev;
2d996150 37 ISADevice *rtc;
c87b1520
DS
38
39 uint64_t max_ram_below_4g;
d1048bef 40 OnOffAuto vmport;
355023f2 41 OnOffAuto smm;
91aa70ab 42 bool enforce_aligned_dimm;
c0aa4e1e 43 ram_addr_t below_4g_mem_size, above_4g_mem_size;
d5747cac
IM
44};
45
781bbd6b 46#define PC_MACHINE_ACPI_DEVICE_PROP "acpi-device"
bf1e8939 47#define PC_MACHINE_MEMHP_REGION_SIZE "hotplug-memory-region-size"
c87b1520 48#define PC_MACHINE_MAX_RAM_BELOW_4G "max-ram-below-4g"
9b23cfb7 49#define PC_MACHINE_VMPORT "vmport"
355023f2 50#define PC_MACHINE_SMM "smm"
91aa70ab 51#define PC_MACHINE_ENFORCE_ALIGNED_DIMM "enforce-aligned-dimm"
781bbd6b 52
95bee274
IM
53/**
54 * PCMachineClass:
55 * @get_hotplug_handler: pointer to parent class callback @get_hotplug_handler
56 */
d5747cac
IM
57struct PCMachineClass {
58 /*< private >*/
59 MachineClass parent_class;
95bee274
IM
60
61 /*< public >*/
2f8b5008 62 bool broken_reserved_end;
95bee274
IM
63 HotplugHandler *(*get_hotplug_handler)(MachineState *machine,
64 DeviceState *dev);
d5747cac
IM
65};
66
d5747cac
IM
67#define TYPE_PC_MACHINE "generic-pc-machine"
68#define PC_MACHINE(obj) \
69 OBJECT_CHECK(PCMachineState, (obj), TYPE_PC_MACHINE)
70#define PC_MACHINE_GET_CLASS(obj) \
71 OBJECT_GET_CLASS(PCMachineClass, (obj), TYPE_PC_MACHINE)
72#define PC_MACHINE_CLASS(klass) \
73 OBJECT_CLASS_CHECK(PCMachineClass, (klass), TYPE_PC_MACHINE)
74
87ecb68b
PB
75/* PC-style peripherals (also used by other machines). */
76
3459a625
MT
77typedef struct PcPciInfo {
78 Range w32;
79 Range w64;
80} PcPciInfo;
81
f854ecc7
MT
82#define ACPI_PM_PROP_S3_DISABLED "disable_s3"
83#define ACPI_PM_PROP_S4_DISABLED "disable_s4"
84#define ACPI_PM_PROP_S4_VAL "s4_val"
85#define ACPI_PM_PROP_SCI_INT "sci_int"
86#define ACPI_PM_PROP_ACPI_ENABLE_CMD "acpi_enable_cmd"
87#define ACPI_PM_PROP_ACPI_DISABLE_CMD "acpi_disable_cmd"
88#define ACPI_PM_PROP_PM_IO_BASE "pm_io_base"
89#define ACPI_PM_PROP_GPE0_BLK "gpe0_blk"
90#define ACPI_PM_PROP_GPE0_BLK_LEN "gpe0_blk_len"
92055797 91#define ACPI_PM_PROP_TCO_ENABLED "enable_tco"
f854ecc7 92
3459a625 93struct PcGuestInfo {
6dd2a5c9 94 bool isapc_ram_fw;
f30ee8a9 95 hwaddr ram_size, ram_size_below_4g;
b20c9bd5
MT
96 unsigned apic_id_limit;
97 bool apic_xrupt_override;
98 uint64_t numa_nodes;
99 uint64_t *node_mem;
100 uint64_t *node_cpu;
3459a625 101 FWCfgState *fw_cfg;
07fb6176 102 int legacy_acpi_table_size;
72c194f7 103 bool has_acpi_build;
de268e13 104 bool has_reserved_memory;
384fb32e 105 bool rsdp_in_ram;
3459a625
MT
106};
107
87ecb68b 108/* parallel.c */
07dc7880
MA
109
110void parallel_hds_isa_init(ISABus *bus, int n);
defdb20e 111
63858cd9 112bool parallel_mm_init(MemoryRegion *address_space,
a8170e5e 113 hwaddr base, int it_shift, qemu_irq irq,
defdb20e 114 CharDriverState *chr);
87ecb68b
PB
115
116/* i8259.c */
117
9aa78c42 118extern DeviceState *isa_pic;
48a18b3c 119qemu_irq *i8259_init(ISABus *bus, qemu_irq parent_irq);
10b61882 120qemu_irq *kvm_i8259_init(ISABus *bus);
9aa78c42
JK
121int pic_read_irq(DeviceState *d);
122int pic_get_output(DeviceState *d);
1ce6be24
MA
123void hmp_info_pic(Monitor *mon, const QDict *qdict);
124void hmp_info_irq(Monitor *mon, const QDict *qdict);
87ecb68b 125
d665d696
PB
126/* ioapic.c */
127
128void kvm_ioapic_dump_state(Monitor *mon, const QDict *qdict);
6bde8fd6 129void ioapic_dump_state(Monitor *mon, const QDict *qdict);
d665d696 130
b881fbe9 131/* Global System Interrupts */
96051119 132
b881fbe9 133#define GSI_NUM_PINS IOAPIC_NUM_PINS
845773ab 134
b881fbe9 135typedef struct GSIState {
43a0db35 136 qemu_irq i8259_irq[ISA_NUM_IRQS];
b881fbe9
JK
137 qemu_irq ioapic_irq[IOAPIC_NUM_PINS];
138} GSIState;
139
140void gsi_handler(void *opaque, int n, int level);
845773ab 141
87ecb68b 142/* vmport.c */
d67f679d
JK
143typedef uint32_t (VMPortReadFunc)(void *opaque, uint32_t address);
144
48a18b3c 145static inline void vmport_init(ISABus *bus)
6872ef61 146{
48a18b3c 147 isa_create_simple(bus, "vmport");
6872ef61 148}
d67f679d
JK
149
150void vmport_register(unsigned char command, VMPortReadFunc *func, void *opaque);
86d86414
BS
151void vmmouse_get_data(uint32_t *data);
152void vmmouse_set_data(const uint32_t *data);
87ecb68b 153
87ecb68b
PB
154/* pckbd.c */
155
156void i8042_init(qemu_irq kbd_irq, qemu_irq mouse_irq, uint32_t io_base);
157void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq,
dbff76ac 158 MemoryRegion *region, ram_addr_t size,
a8170e5e 159 hwaddr mask);
956a3e6b
BS
160void i8042_isa_mouse_fake_event(void *opaque);
161void i8042_setup_a20_line(ISADevice *dev, qemu_irq *a20_out);
87ecb68b 162
87ecb68b
PB
163/* pc.c */
164extern int fd_bootchk;
165
355023f2 166bool pc_machine_is_smm_enabled(PCMachineState *pcms);
8e78eb28 167void pc_register_ferr_irq(qemu_irq irq);
845773ab
IY
168void pc_acpi_smi_interrupt(void *opaque, int irq, int level);
169
62fc403f 170void pc_cpus_init(const char *cpu_model, DeviceState *icc_bridge);
c649983b 171void pc_hot_add_cpu(const int64_t id, Error **errp);
f7e4dd6c 172void pc_acpi_init(const char *default_dsdt);
3459a625 173
b9cfc918 174PcGuestInfo *pc_guest_info_init(PCMachineState *pcms);
3459a625 175
927766c7
MT
176void pc_set_legacy_acpi_data_size(void);
177
39848901
IM
178#define PCI_HOST_PROP_PCI_HOLE_START "pci-hole-start"
179#define PCI_HOST_PROP_PCI_HOLE_END "pci-hole-end"
180#define PCI_HOST_PROP_PCI_HOLE64_START "pci-hole64-start"
181#define PCI_HOST_PROP_PCI_HOLE64_END "pci-hole64-end"
182#define PCI_HOST_PROP_PCI_HOLE64_SIZE "pci-hole64-size"
1466cef3
MT
183#define DEFAULT_PCI_HOLE64_SIZE (~0x0ULL)
184
39848901 185
83d08f26
MT
186void pc_pci_as_mapping_init(Object *owner, MemoryRegion *system_memory,
187 MemoryRegion *pci_address_space);
39848901 188
df1f79fd 189FWCfgState *xen_load_linux(PCMachineState *pcms,
b33a5bbf 190 PcGuestInfo *guest_info);
62b160c0 191FWCfgState *pc_memory_init(PCMachineState *pcms,
9521d42b 192 MemoryRegion *system_memory,
a88b362c 193 MemoryRegion *rom_memory,
3459a625
MT
194 MemoryRegion **ram_memory,
195 PcGuestInfo *guest_info);
0b0cc076 196qemu_irq pc_allocate_cpu_irq(void);
48a18b3c
HP
197DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus);
198void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
1611977c 199 ISADevice **rtc_state,
fd53c87c 200 bool create_fdctrl,
7a10ef51
LPF
201 bool no_vmport,
202 uint32 hpet_irqs);
48a18b3c 203void pc_init_ne2k_isa(ISABus *bus, NICInfo *nd);
23d30407 204void pc_cmos_init(PCMachineState *pcms,
220a8846 205 BusState *ide0, BusState *ide1,
63ffb564 206 ISADevice *s);
9011a1a7 207void pc_nic_init(ISABus *isa_bus, PCIBus *pci_bus);
845773ab 208void pc_pci_device_init(PCIBus *pci_bus);
8e78eb28 209
f885f1ea 210typedef void (*cpu_set_smm_t)(int smm, void *arg);
f885f1ea 211
a39e3564
JB
212void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name);
213
9d5e77a2 214/* acpi_piix.c */
53b67b30 215
a5c82852
AF
216I2CBus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
217 qemu_irq sci_irq, qemu_irq smi_irq,
61e66c62 218 int smm_enabled, DeviceState **piix4_pm);
87ecb68b 219void piix4_smbus_register_device(SMBusDevice *dev, uint8_t addr);
87ecb68b 220
16b29ae1
AL
221/* hpet.c */
222extern int no_hpet;
223
87ecb68b 224/* piix_pci.c */
0a3bacf3
JQ
225struct PCII440FXState;
226typedef struct PCII440FXState PCII440FXState;
227
7bb836e4
MT
228#define TYPE_I440FX_PCI_HOST_BRIDGE "i440FX-pcihost"
229#define TYPE_I440FX_PCI_DEVICE "i440FX"
230
595a4f07
TC
231#define TYPE_IGD_PASSTHROUGH_I440FX_PCI_DEVICE "igd-passthrough-i440FX"
232
7bb836e4
MT
233PCIBus *i440fx_init(const char *host_type, const char *pci_type,
234 PCII440FXState **pi440fx_state, int *piix_devfn,
60573079 235 ISABus **isa_bus, qemu_irq *pic,
aee97b84
AK
236 MemoryRegion *address_space_mem,
237 MemoryRegion *address_space_io,
ae0a5466 238 ram_addr_t ram_size,
ddaaefb4 239 ram_addr_t below_4g_mem_size,
39848901 240 ram_addr_t above_4g_mem_size,
ae0a5466
AK
241 MemoryRegion *pci_memory,
242 MemoryRegion *ram_memory);
87ecb68b 243
277e9340 244PCIBus *find_i440fx(void);
823e675a 245/* piix4.c */
b1d8e52e 246extern PCIDevice *piix4_dev;
142e9787 247int piix4_init(PCIBus *bus, ISABus **isa_bus, int devfn);
87ecb68b
PB
248
249/* vga.c */
cb5a7aa8 250enum vga_retrace_method {
251 VGA_RETRACE_DUMB,
252 VGA_RETRACE_PRECISE
253};
254
255extern enum vga_retrace_method vga_retrace_method;
87ecb68b 256
a8170e5e
AK
257int isa_vga_mm_init(hwaddr vram_base,
258 hwaddr ctrl_base, int it_shift,
be20f9e9 259 MemoryRegion *address_space);
87ecb68b 260
87ecb68b 261/* ne2000.c */
48a18b3c 262static inline bool isa_ne2000_init(ISABus *bus, int base, int irq, NICInfo *nd)
60a14ad3 263{
4a17cc4f
AF
264 DeviceState *dev;
265 ISADevice *isadev;
87ecb68b 266
60a14ad3
BS
267 qemu_check_nic_model(nd, "ne2k_isa");
268
4a17cc4f
AF
269 isadev = isa_try_create(bus, "ne2k_isa");
270 if (!isadev) {
cd1b8a8b
BS
271 return false;
272 }
4a17cc4f
AF
273 dev = DEVICE(isadev);
274 qdev_prop_set_uint32(dev, "iobase", base);
275 qdev_prop_set_uint32(dev, "irq", irq);
276 qdev_set_nic_properties(dev, nd);
277 qdev_init_nofail(dev);
cd1b8a8b 278 return true;
60a14ad3 279}
87ecb68b 280
cbc5b5f3 281/* pc_sysfw.c */
6dd2a5c9
PB
282void pc_system_firmware_init(MemoryRegion *rom_memory,
283 bool isapc_ram_fw);
cbc5b5f3 284
3ab135f3 285/* pvpanic.c */
309cd62d 286uint16_t pvpanic_port(void);
3ab135f3 287
4c5b10b7
JS
288/* e820 types */
289#define E820_RAM 1
290#define E820_RESERVED 2
291#define E820_ACPI 3
292#define E820_NVS 4
293#define E820_UNUSABLE 5
294
295int e820_add_entry(uint64_t, uint64_t, uint32_t);
7bf8ef19
GS
296int e820_get_num_entries(void);
297bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
4c5b10b7 298
87e896ab
EH
299#define PC_COMPAT_2_4 \
300 HW_COMPAT_2_4
301
42134ac9 302#define PC_COMPAT_2_3 \
87e896ab 303 PC_COMPAT_2_4 \
28b8e4d0
JK
304 HW_COMPAT_2_3 \
305 {\
306 .driver = TYPE_X86_CPU,\
307 .property = "arat",\
308 .value = "off",\
3046bb5d
RK
309 },{\
310 .driver = "qemu64" "-" TYPE_X86_CPU,\
311 .property = "level",\
312 .value = stringify(4),\
313 },{\
314 .driver = "kvm64" "-" TYPE_X86_CPU,\
315 .property = "level",\
316 .value = stringify(5),\
317 },{\
318 .driver = "pentium3" "-" TYPE_X86_CPU,\
319 .property = "level",\
320 .value = stringify(2),\
321 },{\
322 .driver = "n270" "-" TYPE_X86_CPU,\
323 .property = "level",\
324 .value = stringify(5),\
325 },{\
326 .driver = "Conroe" "-" TYPE_X86_CPU,\
327 .property = "level",\
328 .value = stringify(4),\
329 },{\
330 .driver = "Penryn" "-" TYPE_X86_CPU,\
331 .property = "level",\
332 .value = stringify(4),\
333 },{\
334 .driver = "Nehalem" "-" TYPE_X86_CPU,\
335 .property = "level",\
336 .value = stringify(4),\
337 },{\
338 .driver = "n270" "-" TYPE_X86_CPU,\
339 .property = "xlevel",\
340 .value = stringify(0x8000000a),\
341 },{\
342 .driver = "Penryn" "-" TYPE_X86_CPU,\
343 .property = "xlevel",\
344 .value = stringify(0x8000000a),\
345 },{\
346 .driver = "Conroe" "-" TYPE_X86_CPU,\
347 .property = "xlevel",\
348 .value = stringify(0x8000000a),\
349 },{\
350 .driver = "Nehalem" "-" TYPE_X86_CPU,\
351 .property = "xlevel",\
352 .value = stringify(0x8000000a),\
353 },{\
354 .driver = "Westmere" "-" TYPE_X86_CPU,\
355 .property = "xlevel",\
356 .value = stringify(0x8000000a),\
357 },{\
358 .driver = "SandyBridge" "-" TYPE_X86_CPU,\
359 .property = "xlevel",\
360 .value = stringify(0x8000000a),\
27751aab
RK
361 },{\
362 .driver = "IvyBridge" "-" TYPE_X86_CPU,\
363 .property = "xlevel",\
364 .value = stringify(0x8000000a),\
3046bb5d
RK
365 },{\
366 .driver = "Haswell" "-" TYPE_X86_CPU,\
367 .property = "xlevel",\
368 .value = stringify(0x8000000a),\
369 },{\
370 .driver = "Haswell-noTSX" "-" TYPE_X86_CPU,\
371 .property = "xlevel",\
372 .value = stringify(0x8000000a),\
373 },{\
374 .driver = "Broadwell" "-" TYPE_X86_CPU,\
375 .property = "xlevel",\
376 .value = stringify(0x8000000a),\
377 },{\
378 .driver = "Broadwell-noTSX" "-" TYPE_X86_CPU,\
379 .property = "xlevel",\
380 .value = stringify(0x8000000a),\
28b8e4d0 381 },
42134ac9
EH
382
383#define PC_COMPAT_2_2 \
384 PC_COMPAT_2_3 \
27add381
EH
385 HW_COMPAT_2_2 \
386 {\
387 .driver = "kvm64" "-" TYPE_X86_CPU,\
388 .property = "vme",\
389 .value = "off",\
390 },\
391 {\
392 .driver = "kvm32" "-" TYPE_X86_CPU,\
393 .property = "vme",\
394 .value = "off",\
395 },\
396 {\
397 .driver = "Conroe" "-" TYPE_X86_CPU,\
398 .property = "vme",\
399 .value = "off",\
400 },\
401 {\
402 .driver = "Penryn" "-" TYPE_X86_CPU,\
403 .property = "vme",\
404 .value = "off",\
405 },\
406 {\
407 .driver = "Nehalem" "-" TYPE_X86_CPU,\
408 .property = "vme",\
409 .value = "off",\
410 },\
411 {\
412 .driver = "Westmere" "-" TYPE_X86_CPU,\
413 .property = "vme",\
414 .value = "off",\
415 },\
416 {\
417 .driver = "SandyBridge" "-" TYPE_X86_CPU,\
418 .property = "vme",\
419 .value = "off",\
420 },\
421 {\
422 .driver = "Haswell" "-" TYPE_X86_CPU,\
423 .property = "vme",\
424 .value = "off",\
425 },\
426 {\
427 .driver = "Broadwell" "-" TYPE_X86_CPU,\
428 .property = "vme",\
429 .value = "off",\
430 },\
431 {\
432 .driver = "Opteron_G1" "-" TYPE_X86_CPU,\
433 .property = "vme",\
434 .value = "off",\
435 },\
436 {\
437 .driver = "Opteron_G2" "-" TYPE_X86_CPU,\
438 .property = "vme",\
439 .value = "off",\
440 },\
441 {\
442 .driver = "Opteron_G3" "-" TYPE_X86_CPU,\
443 .property = "vme",\
444 .value = "off",\
445 },\
446 {\
447 .driver = "Opteron_G4" "-" TYPE_X86_CPU,\
448 .property = "vme",\
449 .value = "off",\
450 },\
451 {\
452 .driver = "Opteron_G5" "-" TYPE_X86_CPU,\
453 .property = "vme",\
454 .value = "off",\
455 },\
456 {\
457 .driver = "Haswell" "-" TYPE_X86_CPU,\
458 .property = "f16c",\
459 .value = "off",\
460 },\
461 {\
462 .driver = "Haswell" "-" TYPE_X86_CPU,\
463 .property = "rdrand",\
464 .value = "off",\
465 },\
466 {\
467 .driver = "Broadwell" "-" TYPE_X86_CPU,\
468 .property = "f16c",\
469 .value = "off",\
470 },\
471 {\
472 .driver = "Broadwell" "-" TYPE_X86_CPU,\
473 .property = "rdrand",\
474 .value = "off",\
475 },
42134ac9
EH
476
477#define PC_COMPAT_2_1 \
478 PC_COMPAT_2_2 \
27add381
EH
479 HW_COMPAT_2_1 \
480 {\
481 .driver = "coreduo" "-" TYPE_X86_CPU,\
482 .property = "vmx",\
483 .value = "on",\
484 },\
485 {\
486 .driver = "core2duo" "-" TYPE_X86_CPU,\
487 .property = "vmx",\
488 .value = "on",\
489 },
42134ac9 490
9df11c9f 491#define PC_COMPAT_2_0 \
42134ac9 492 PC_COMPAT_2_1 \
9df11c9f 493 {\
3eff1f46
PB
494 .driver = "virtio-scsi-pci",\
495 .property = "any_layout",\
496 .value = "off",\
497 },{\
34774320
IM
498 .driver = "PIIX4_PM",\
499 .property = "memory-hotplug-support",\
500 .value = "off",\
501 },\
9df11c9f 502 {\
aa93200b
GS
503 .driver = "apic",\
504 .property = "version",\
505 .value = stringify(0x11),\
34774320
IM
506 },\
507 {\
7bafd888
GH
508 .driver = "nec-usb-xhci",\
509 .property = "superspeed-ports-first",\
510 .value = "off",\
13cc2c3e 511 },\
e6043e92
DDAG
512 {\
513 .driver = "nec-usb-xhci",\
514 .property = "force-pcie-endcap",\
515 .value = "on",\
516 },\
13cc2c3e
BZ
517 {\
518 .driver = "pci-serial",\
519 .property = "prog_if",\
520 .value = stringify(0),\
521 },\
522 {\
523 .driver = "pci-serial-2x",\
fa118d1f 524 .property = "prog_if",\
13cc2c3e
BZ
525 .value = stringify(0),\
526 },\
527 {\
528 .driver = "pci-serial-4x",\
529 .property = "prog_if",\
530 .value = stringify(0),\
f57fcf70
JW
531 },\
532 {\
533 .driver = "virtio-net-pci",\
534 .property = "guest_announce",\
535 .value = "off",\
b8f5cfd6
EH
536 },\
537 {\
538 .driver = "ICH9-LPC",\
539 .property = "memory-hotplug-support",\
540 .value = "off",\
541 },{\
542 .driver = "xio3130-downstream",\
543 .property = COMPAT_PROP_PCP,\
544 .value = "off",\
545 },{\
546 .driver = "ioh3420",\
547 .property = COMPAT_PROP_PCP,\
548 .value = "off",\
a7cde24d 549 },
9df11c9f 550
5319dc7b 551#define PC_COMPAT_1_7 \
a7cde24d 552 PC_COMPAT_2_0 \
5319dc7b
GH
553 {\
554 .driver = TYPE_USB_DEVICE,\
555 .property = "msos-desc",\
556 .value = "no",\
9e047b98
MT
557 },\
558 {\
559 .driver = "PIIX4_PM",\
560 .property = "acpi-pci-hotplug-with-bridge-support",\
561 .value = "off",\
b8f5cfd6
EH
562 },\
563 {\
564 .driver = "hpet",\
565 .property = HPET_INTCAP,\
566 .value = stringify(4),\
a7cde24d 567 },
5319dc7b 568
e9845f09 569#define PC_COMPAT_1_6 \
a7cde24d 570 PC_COMPAT_1_7 \
e9845f09
VM
571 {\
572 .driver = "e1000",\
573 .property = "mitigation",\
574 .value = "off",\
f8e6a11a
EH
575 },{\
576 .driver = "qemu64-" TYPE_X86_CPU,\
577 .property = "model",\
578 .value = stringify(2),\
579 },{\
580 .driver = "qemu32-" TYPE_X86_CPU,\
581 .property = "model",\
582 .value = stringify(3),\
04c7d8b8
CR
583 },{\
584 .driver = "i440FX-pcihost",\
585 .property = "short_root_bus",\
586 .value = stringify(1),\
587 },{\
588 .driver = "q35-pcihost",\
589 .property = "short_root_bus",\
590 .value = stringify(1),\
a7cde24d 591 },
e9845f09 592
ffce9ebb 593#define PC_COMPAT_1_5 \
a7cde24d 594 PC_COMPAT_1_6 \
ffce9ebb
EH
595 {\
596 .driver = "Conroe-" TYPE_X86_CPU,\
597 .property = "model",\
598 .value = stringify(2),\
6b11322e
EH
599 },{\
600 .driver = "Conroe-" TYPE_X86_CPU,\
601 .property = "level",\
602 .value = stringify(2),\
ffce9ebb
EH
603 },{\
604 .driver = "Penryn-" TYPE_X86_CPU,\
605 .property = "model",\
606 .value = stringify(2),\
6b11322e
EH
607 },{\
608 .driver = "Penryn-" TYPE_X86_CPU,\
609 .property = "level",\
610 .value = stringify(2),\
ffce9ebb
EH
611 },{\
612 .driver = "Nehalem-" TYPE_X86_CPU,\
613 .property = "model",\
614 .value = stringify(2),\
6b11322e
EH
615 },{\
616 .driver = "Nehalem-" TYPE_X86_CPU,\
617 .property = "level",\
618 .value = stringify(2),\
488f069b
MT
619 },{\
620 .driver = "virtio-net-pci",\
621 .property = "any_layout",\
622 .value = "off",\
9337e3b6
EH
623 },{\
624 .driver = TYPE_X86_CPU,\
625 .property = "pmu",\
626 .value = "on",\
04c7d8b8
CR
627 },{\
628 .driver = "i440FX-pcihost",\
629 .property = "short_root_bus",\
630 .value = stringify(0),\
631 },{\
632 .driver = "q35-pcihost",\
633 .property = "short_root_bus",\
634 .value = stringify(0),\
a7cde24d 635 },
ffce9ebb 636
bf3caa3d 637#define PC_COMPAT_1_4 \
a7cde24d 638 PC_COMPAT_1_5 \
bf3caa3d
PB
639 {\
640 .driver = "scsi-hd",\
641 .property = "discard_granularity",\
642 .value = stringify(0),\
4974920a 643 },{\
bf3caa3d
PB
644 .driver = "scsi-cd",\
645 .property = "discard_granularity",\
646 .value = stringify(0),\
4974920a 647 },{\
bf3caa3d
PB
648 .driver = "scsi-disk",\
649 .property = "discard_granularity",\
650 .value = stringify(0),\
4974920a 651 },{\
bf3caa3d
PB
652 .driver = "ide-hd",\
653 .property = "discard_granularity",\
654 .value = stringify(0),\
4974920a 655 },{\
bf3caa3d
PB
656 .driver = "ide-cd",\
657 .property = "discard_granularity",\
658 .value = stringify(0),\
4974920a 659 },{\
bf3caa3d
PB
660 .driver = "ide-drive",\
661 .property = "discard_granularity",\
662 .value = stringify(0),\
c45e5b5b 663 },{\
bf3caa3d
PB
664 .driver = "virtio-blk-pci",\
665 .property = "discard_granularity",\
666 .value = stringify(0),\
4974920a 667 },{\
554f1997
GH
668 .driver = "virtio-serial-pci",\
669 .property = "vectors",\
670 /* DEV_NVECTORS_UNSPECIFIED as a uint32_t string */\
671 .value = stringify(0xFFFFFFFF),\
644c9858
DF
672 },{ \
673 .driver = "virtio-net-pci", \
674 .property = "ctrl_guest_offloads", \
675 .value = "off", \
c45e5b5b
GH
676 },{\
677 .driver = "e1000",\
678 .property = "romfile",\
679 .value = "pxe-e1000.rom",\
680 },{\
681 .driver = "ne2k_pci",\
682 .property = "romfile",\
683 .value = "pxe-ne2k_pci.rom",\
684 },{\
685 .driver = "pcnet",\
686 .property = "romfile",\
687 .value = "pxe-pcnet.rom",\
688 },{\
689 .driver = "rtl8139",\
690 .property = "romfile",\
691 .value = "pxe-rtl8139.rom",\
692 },{\
693 .driver = "virtio-net-pci",\
694 .property = "romfile",\
695 .value = "pxe-virtio.rom",\
b2a856d9
AF
696 },{\
697 .driver = "486-" TYPE_X86_CPU,\
698 .property = "model",\
699 .value = stringify(0),\
27add381
EH
700 },\
701 {\
702 .driver = "n270" "-" TYPE_X86_CPU,\
703 .property = "movbe",\
704 .value = "off",\
705 },\
706 {\
707 .driver = "Westmere" "-" TYPE_X86_CPU,\
708 .property = "pclmulqdq",\
709 .value = "off",\
a7cde24d 710 },
bf3caa3d 711
25519b06 712#define DEFINE_PC_MACHINE(suffix, namestr, initfn, optsfn) \
865906f7
EH
713 static void pc_machine_##suffix##_class_init(ObjectClass *oc, void *data) \
714 { \
715 MachineClass *mc = MACHINE_CLASS(oc); \
716 optsfn(mc); \
717 mc->name = namestr; \
718 mc->init = initfn; \
719 } \
720 static const TypeInfo pc_machine_type_##suffix = { \
721 .name = namestr TYPE_MACHINE_SUFFIX, \
722 .parent = TYPE_PC_MACHINE, \
723 .class_init = pc_machine_##suffix##_class_init, \
724 }; \
61f219df
EH
725 static void pc_machine_init_##suffix(void) \
726 { \
865906f7 727 type_register(&pc_machine_type_##suffix); \
61f219df
EH
728 } \
729 machine_init(pc_machine_init_##suffix)
730
25519b06
EH
731#define SET_MACHINE_COMPAT(m, COMPAT) do { \
732 static GlobalProperty props[] = { \
733 COMPAT \
734 { /* end of list */ } \
735 }; \
736 (m)->compat_props = props; \
737} while (0)
738
bd8107d7 739extern void igd_passthrough_isa_bridge_create(PCIBus *bus, uint16_t gpu_dev_id);
87ecb68b 740#endif