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 bool is_inserting; 24 bool is_removing; 25 } AcpiCpuStatus; 26 27 typedef struct CPUHotplugState { 28 MemoryRegion ctrl_reg; 29 uint32_t selector; 30 uint8_t command; 31 uint32_t dev_count; 32 AcpiCpuStatus *devs; 33 } CPUHotplugState; 34 35 void acpi_cpu_plug_cb(HotplugHandler *hotplug_dev, 36 CPUHotplugState *cpu_st, DeviceState *dev, Error **errp); 37 38 void acpi_cpu_unplug_request_cb(HotplugHandler *hotplug_dev, 39 CPUHotplugState *cpu_st, 40 DeviceState *dev, Error **errp); 41 42 void acpi_cpu_unplug_cb(CPUHotplugState *cpu_st, 43 DeviceState *dev, Error **errp); 44 45 void cpu_hotplug_hw_init(MemoryRegion *as, Object *owner, 46 CPUHotplugState *state, hwaddr base_addr); 47 48 typedef struct CPUHotplugFeatures { 49 bool apci_1_compatible; 50 } CPUHotplugFeatures; 51 52 void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts, 53 hwaddr io_base, 54 const char *res_root, 55 const char *event_handler_method); 56 57 extern const VMStateDescription vmstate_cpu_hotplug; 58 #define VMSTATE_CPU_HOTPLUG(cpuhp, state) \ 59 VMSTATE_STRUCT(cpuhp, state, 1, \ 60 vmstate_cpu_hotplug, CPUHotplugState) 61 62 #endif 63