spapr_cpu_core.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * sPAPR CPU core device.
  3. *
  4. * Copyright (C) 2016 Bharata B Rao <bharata@linux.vnet.ibm.com>
  5. *
  6. * This work is licensed under the terms of the GNU GPL, version 2 or later.
  7. * See the COPYING file in the top-level directory.
  8. */
  9. #ifndef HW_SPAPR_CPU_CORE_H
  10. #define HW_SPAPR_CPU_CORE_H
  11. #include "hw/cpu/core.h"
  12. #include "hw/qdev-core.h"
  13. #include "target/ppc/cpu-qom.h"
  14. #include "target/ppc/cpu.h"
  15. #include "qom/object.h"
  16. #define TYPE_SPAPR_CPU_CORE "spapr-cpu-core"
  17. OBJECT_DECLARE_TYPE(SpaprCpuCore, SpaprCpuCoreClass,
  18. SPAPR_CPU_CORE)
  19. #define SPAPR_CPU_CORE_TYPE_NAME(model) model "-" TYPE_SPAPR_CPU_CORE
  20. struct SpaprCpuCore {
  21. /*< private >*/
  22. CPUCore parent_obj;
  23. /*< public >*/
  24. PowerPCCPU **threads;
  25. int node_id;
  26. };
  27. struct SpaprCpuCoreClass {
  28. DeviceClass parent_class;
  29. const char *cpu_type;
  30. };
  31. const char *spapr_get_cpu_core_type(const char *cpu_type);
  32. void spapr_cpu_set_entry_state(PowerPCCPU *cpu, target_ulong nip,
  33. target_ulong r1, target_ulong r3,
  34. target_ulong r4);
  35. struct nested_ppc_state;
  36. typedef struct SpaprCpuState {
  37. uint64_t vpa_addr;
  38. uint64_t slb_shadow_addr, slb_shadow_size;
  39. uint64_t dtl_addr, dtl_size;
  40. bool prod; /* not migrated, only used to improve dispatch latencies */
  41. struct ICPState *icp;
  42. struct XiveTCTX *tctx;
  43. /* Fields for nested-HV support */
  44. bool in_nested; /* true while the L2 is executing */
  45. struct nested_ppc_state *nested_host_state; /* holds the L1 state while L2 executes */
  46. } SpaprCpuState;
  47. static inline SpaprCpuState *spapr_cpu_state(PowerPCCPU *cpu)
  48. {
  49. return (SpaprCpuState *)cpu->machine_data;
  50. }
  51. #endif