cpu.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. #include "qapi/qapi-types-acpi.h"
  15. #include "hw/qdev-core.h"
  16. #include "hw/acpi/acpi.h"
  17. #include "hw/acpi/aml-build.h"
  18. #include "hw/boards.h"
  19. #include "hw/hotplug.h"
  20. #define ACPI_CPU_HOTPLUG_REG_LEN 12
  21. typedef struct AcpiCpuStatus {
  22. CPUState *cpu;
  23. uint64_t arch_id;
  24. bool is_inserting;
  25. bool is_removing;
  26. bool fw_remove;
  27. uint32_t ost_event;
  28. uint32_t ost_status;
  29. } AcpiCpuStatus;
  30. typedef struct CPUHotplugState {
  31. MemoryRegion ctrl_reg;
  32. uint32_t selector;
  33. uint8_t command;
  34. uint32_t dev_count;
  35. AcpiCpuStatus *devs;
  36. } CPUHotplugState;
  37. void acpi_cpu_plug_cb(HotplugHandler *hotplug_dev,
  38. CPUHotplugState *cpu_st, DeviceState *dev, Error **errp);
  39. void acpi_cpu_unplug_request_cb(HotplugHandler *hotplug_dev,
  40. CPUHotplugState *cpu_st,
  41. DeviceState *dev, Error **errp);
  42. void acpi_cpu_unplug_cb(CPUHotplugState *cpu_st,
  43. DeviceState *dev, Error **errp);
  44. void cpu_hotplug_hw_init(MemoryRegion *as, Object *owner,
  45. CPUHotplugState *state, hwaddr base_addr);
  46. typedef struct CPUHotplugFeatures {
  47. bool acpi_1_compatible;
  48. bool has_legacy_cphp;
  49. bool fw_unplugs_cpu;
  50. const char *smi_path;
  51. } CPUHotplugFeatures;
  52. typedef void (*build_madt_cpu_fn)(int uid, const CPUArchIdList *apic_ids,
  53. GArray *entry, bool force_enabled);
  54. void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
  55. build_madt_cpu_fn build_madt_cpu, hwaddr base_addr,
  56. const char *res_root,
  57. const char *event_handler_method,
  58. AmlRegionSpace rs);
  59. void acpi_cpu_ospm_status(CPUHotplugState *cpu_st, ACPIOSTInfoList ***list);
  60. extern const VMStateDescription vmstate_cpu_hotplug;
  61. #define VMSTATE_CPU_HOTPLUG(cpuhp, state) \
  62. VMSTATE_STRUCT(cpuhp, state, 1, \
  63. vmstate_cpu_hotplug, CPUHotplugState)
  64. #endif