xref: /qemu/include/hw/acpi/cpu.h (revision 5e1b5d93887b52eede156f846b6c4c5c8bbcfcdb)
1 /*
2  * QEMU ACPI hotplug utilities
3  *
4  * Copyright (C) 2016 Red Hat Inc
5  *
6  * Authors:
7  *   Igor Mammedov <imammedo@redhat.com>
8  *
9  * This work is licensed under the terms of the GNU GPL, version 2 or later.
10  * See the COPYING file in the top-level directory.
11  */
12 #ifndef ACPI_CPU_H
13 #define ACPI_CPU_H
14 
15 #include "hw/qdev-core.h"
16 #include "hw/acpi/acpi.h"
17 #include "hw/acpi/aml-build.h"
18 #include "hw/hotplug.h"
19 
20 typedef struct AcpiCpuStatus {
21     struct CPUState *cpu;
22     uint64_t arch_id;
23 } AcpiCpuStatus;
24 
25 typedef struct CPUHotplugState {
26     MemoryRegion ctrl_reg;
27     uint32_t selector;
28     uint32_t dev_count;
29     AcpiCpuStatus *devs;
30 } CPUHotplugState;
31 
32 void acpi_cpu_plug_cb(HotplugHandler *hotplug_dev,
33                       CPUHotplugState *cpu_st, DeviceState *dev, Error **errp);
34 
35 void cpu_hotplug_hw_init(MemoryRegion *as, Object *owner,
36                          CPUHotplugState *state, hwaddr base_addr);
37 
38 typedef struct CPUHotplugFeatures {
39     bool apci_1_compatible;
40 } CPUHotplugFeatures;
41 
42 void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
43                     hwaddr io_base,
44                     const char *res_root);
45 
46 extern const VMStateDescription vmstate_cpu_hotplug;
47 #define VMSTATE_CPU_HOTPLUG(cpuhp, state) \
48     VMSTATE_STRUCT(cpuhp, state, 1, \
49                    vmstate_cpu_hotplug, CPUHotplugState)
50 
51 #endif
52