2
0

xive2.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /*
  2. * QEMU PowerPC XIVE2 interrupt controller model (POWER10)
  3. *
  4. * Copyright (c) 2019-2024, IBM Corporation.
  5. *
  6. * SPDX-License-Identifier: GPL-2.0-or-later
  7. */
  8. #ifndef PPC_XIVE2_H
  9. #define PPC_XIVE2_H
  10. #include "hw/ppc/xive.h"
  11. #include "hw/ppc/xive2_regs.h"
  12. #include "hw/sysbus.h"
  13. /*
  14. * XIVE2 Router (POWER10)
  15. */
  16. typedef struct Xive2Router {
  17. SysBusDevice parent;
  18. XiveFabric *xfb;
  19. } Xive2Router;
  20. #define TYPE_XIVE2_ROUTER "xive2-router"
  21. OBJECT_DECLARE_TYPE(Xive2Router, Xive2RouterClass, XIVE2_ROUTER);
  22. /*
  23. * Configuration flags
  24. */
  25. #define XIVE2_GEN1_TIMA_OS 0x00000001
  26. #define XIVE2_VP_SAVE_RESTORE 0x00000002
  27. #define XIVE2_THREADID_8BITS 0x00000004
  28. typedef struct Xive2RouterClass {
  29. SysBusDeviceClass parent;
  30. /* XIVE table accessors */
  31. int (*get_eas)(Xive2Router *xrtr, uint8_t eas_blk, uint32_t eas_idx,
  32. Xive2Eas *eas);
  33. int (*get_pq)(Xive2Router *xrtr, uint8_t eas_blk, uint32_t eas_idx,
  34. uint8_t *pq);
  35. int (*set_pq)(Xive2Router *xrtr, uint8_t eas_blk, uint32_t eas_idx,
  36. uint8_t *pq);
  37. int (*get_end)(Xive2Router *xrtr, uint8_t end_blk, uint32_t end_idx,
  38. Xive2End *end);
  39. int (*write_end)(Xive2Router *xrtr, uint8_t end_blk, uint32_t end_idx,
  40. Xive2End *end, uint8_t word_number);
  41. int (*get_nvp)(Xive2Router *xrtr, uint8_t nvp_blk, uint32_t nvp_idx,
  42. Xive2Nvp *nvp);
  43. int (*write_nvp)(Xive2Router *xrtr, uint8_t nvp_blk, uint32_t nvp_idx,
  44. Xive2Nvp *nvp, uint8_t word_number);
  45. int (*get_nvgc)(Xive2Router *xrtr, bool crowd,
  46. uint8_t nvgc_blk, uint32_t nvgc_idx,
  47. Xive2Nvgc *nvgc);
  48. int (*write_nvgc)(Xive2Router *xrtr, bool crowd,
  49. uint8_t nvgc_blk, uint32_t nvgc_idx,
  50. Xive2Nvgc *nvgc);
  51. uint8_t (*get_block_id)(Xive2Router *xrtr);
  52. uint32_t (*get_config)(Xive2Router *xrtr);
  53. } Xive2RouterClass;
  54. int xive2_router_get_eas(Xive2Router *xrtr, uint8_t eas_blk, uint32_t eas_idx,
  55. Xive2Eas *eas);
  56. int xive2_router_get_end(Xive2Router *xrtr, uint8_t end_blk, uint32_t end_idx,
  57. Xive2End *end);
  58. int xive2_router_write_end(Xive2Router *xrtr, uint8_t end_blk, uint32_t end_idx,
  59. Xive2End *end, uint8_t word_number);
  60. int xive2_router_get_nvp(Xive2Router *xrtr, uint8_t nvp_blk, uint32_t nvp_idx,
  61. Xive2Nvp *nvp);
  62. int xive2_router_write_nvp(Xive2Router *xrtr, uint8_t nvp_blk, uint32_t nvp_idx,
  63. Xive2Nvp *nvp, uint8_t word_number);
  64. int xive2_router_get_nvgc(Xive2Router *xrtr, bool crowd,
  65. uint8_t nvgc_blk, uint32_t nvgc_idx,
  66. Xive2Nvgc *nvgc);
  67. int xive2_router_write_nvgc(Xive2Router *xrtr, bool crowd,
  68. uint8_t nvgc_blk, uint32_t nvgc_idx,
  69. Xive2Nvgc *nvgc);
  70. uint32_t xive2_router_get_config(Xive2Router *xrtr);
  71. void xive2_router_notify(XiveNotifier *xn, uint32_t lisn, bool pq_checked);
  72. /*
  73. * XIVE2 Presenter (POWER10)
  74. */
  75. int xive2_presenter_tctx_match(XivePresenter *xptr, XiveTCTX *tctx,
  76. uint8_t format,
  77. uint8_t nvt_blk, uint32_t nvt_idx,
  78. bool crowd, bool cam_ignore,
  79. uint32_t logic_serv);
  80. uint64_t xive2_presenter_nvp_backlog_op(XivePresenter *xptr,
  81. uint8_t blk, uint32_t idx,
  82. uint16_t offset);
  83. uint64_t xive2_presenter_nvgc_backlog_op(XivePresenter *xptr,
  84. bool crowd,
  85. uint8_t blk, uint32_t idx,
  86. uint16_t offset, uint16_t val);
  87. /*
  88. * XIVE2 END ESBs (POWER10)
  89. */
  90. #define TYPE_XIVE2_END_SOURCE "xive2-end-source"
  91. OBJECT_DECLARE_SIMPLE_TYPE(Xive2EndSource, XIVE2_END_SOURCE)
  92. typedef struct Xive2EndSource {
  93. DeviceState parent;
  94. uint32_t nr_ends;
  95. /* ESB memory region */
  96. uint32_t esb_shift;
  97. MemoryRegion esb_mmio;
  98. Xive2Router *xrtr;
  99. } Xive2EndSource;
  100. /*
  101. * XIVE2 Thread Interrupt Management Area (POWER10)
  102. */
  103. void xive2_tm_set_hv_cppr(XivePresenter *xptr, XiveTCTX *tctx,
  104. hwaddr offset, uint64_t value, unsigned size);
  105. void xive2_tm_set_os_cppr(XivePresenter *xptr, XiveTCTX *tctx,
  106. hwaddr offset, uint64_t value, unsigned size);
  107. void xive2_tm_push_os_ctx(XivePresenter *xptr, XiveTCTX *tctx, hwaddr offset,
  108. uint64_t value, unsigned size);
  109. uint64_t xive2_tm_pull_os_ctx(XivePresenter *xptr, XiveTCTX *tctx,
  110. hwaddr offset, unsigned size);
  111. void xive2_tm_pull_os_ctx_ol(XivePresenter *xptr, XiveTCTX *tctx,
  112. hwaddr offset, uint64_t value, unsigned size);
  113. bool xive2_tm_irq_precluded(XiveTCTX *tctx, int ring, uint8_t priority);
  114. void xive2_tm_set_lsmfb(XiveTCTX *tctx, int ring, uint8_t priority);
  115. void xive2_tm_set_hv_target(XivePresenter *xptr, XiveTCTX *tctx,
  116. hwaddr offset, uint64_t value, unsigned size);
  117. void xive2_tm_pull_phys_ctx_ol(XivePresenter *xptr, XiveTCTX *tctx,
  118. hwaddr offset, uint64_t value, unsigned size);
  119. #endif /* PPC_XIVE2_H */