xive.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572
  1. /*
  2. * QEMU PowerPC XIVE interrupt controller model
  3. *
  4. *
  5. * The POWER9 processor comes with a new interrupt controller, called
  6. * XIVE as "eXternal Interrupt Virtualization Engine".
  7. *
  8. * = Overall architecture
  9. *
  10. *
  11. * XIVE Interrupt Controller
  12. * +------------------------------------+ IPIs
  13. * | +---------+ +---------+ +--------+ | +-------+
  14. * | |VC | |CQ | |PC |----> | CORES |
  15. * | | esb | | | | |----> | |
  16. * | | eas | | Bridge | | tctx |----> | |
  17. * | |SC end | | | | nvt | | | |
  18. * +------+ | +---------+ +----+----+ +--------+ | +-+-+-+-+
  19. * | RAM | +------------------|-----------------+ | | |
  20. * | | | | | |
  21. * | | | | | |
  22. * | | +--------------------v------------------------v-v-v--+ other
  23. * | <--+ Power Bus +--> chips
  24. * | esb | +---------+-----------------------+------------------+
  25. * | eas | | |
  26. * | end | +--|------+ |
  27. * | nvt | +----+----+ | +----+----+
  28. * +------+ |SC | | |SC |
  29. * | | | | |
  30. * | PQ-bits | | | PQ-bits |
  31. * | local |-+ | in VC |
  32. * +---------+ +---------+
  33. * PCIe NX,NPU,CAPI
  34. *
  35. * SC: Source Controller (aka. IVSE)
  36. * VC: Virtualization Controller (aka. IVRE)
  37. * PC: Presentation Controller (aka. IVPE)
  38. * CQ: Common Queue (Bridge)
  39. *
  40. * PQ-bits: 2 bits source state machine (P:pending Q:queued)
  41. * esb: Event State Buffer (Array of PQ bits in an IVSE)
  42. * eas: Event Assignment Structure
  43. * end: Event Notification Descriptor
  44. * nvt: Notification Virtual Target
  45. * tctx: Thread interrupt Context
  46. *
  47. *
  48. * The XIVE IC is composed of three sub-engines :
  49. *
  50. * - Interrupt Virtualization Source Engine (IVSE), or Source
  51. * Controller (SC). These are found in PCI PHBs, in the PSI host
  52. * bridge controller, but also inside the main controller for the
  53. * core IPIs and other sub-chips (NX, CAP, NPU) of the
  54. * chip/processor. They are configured to feed the IVRE with events.
  55. *
  56. * - Interrupt Virtualization Routing Engine (IVRE) or Virtualization
  57. * Controller (VC). Its job is to match an event source with an
  58. * Event Notification Descriptor (END).
  59. *
  60. * - Interrupt Virtualization Presentation Engine (IVPE) or
  61. * Presentation Controller (PC). It maintains the interrupt context
  62. * state of each thread and handles the delivery of the external
  63. * exception to the thread.
  64. *
  65. * In XIVE 1.0, the sub-engines used to be referred as:
  66. *
  67. * SC Source Controller
  68. * VC Virtualization Controller
  69. * PC Presentation Controller
  70. * CQ Common Queue (PowerBUS Bridge)
  71. *
  72. *
  73. * = XIVE internal tables
  74. *
  75. * Each of the sub-engines uses a set of tables to redirect exceptions
  76. * from event sources to CPU threads.
  77. *
  78. * +-------+
  79. * User or OS | EQ |
  80. * or +------>|entries|
  81. * Hypervisor | | .. |
  82. * Memory | +-------+
  83. * | ^
  84. * | |
  85. * +-------------------------------------------------+
  86. * | |
  87. * Hypervisor +------+ +---+--+ +---+--+ +------+
  88. * Memory | ESB | | EAT | | ENDT | | NVTT |
  89. * (skiboot) +----+-+ +----+-+ +----+-+ +------+
  90. * ^ | ^ | ^ | ^
  91. * | | | | | | |
  92. * +-------------------------------------------------+
  93. * | | | | | | |
  94. * | | | | | | |
  95. * +----|--|--------|--|--------|--|-+ +-|-----+ +------+
  96. * | | | | | | | | | | tctx| |Thread|
  97. * IPI or --> | + v + v + v |---| + .. |-----> |
  98. * HW events --> | | | | | |
  99. * IVSE | IVRE | | IVPE | +------+
  100. * +---------------------------------+ +-------+
  101. *
  102. *
  103. *
  104. * The IVSE have a 2-bits state machine, P for pending and Q for queued,
  105. * for each source that allows events to be triggered. They are stored in
  106. * an Event State Buffer (ESB) array and can be controlled by MMIOs.
  107. *
  108. * If the event is let through, the IVRE looks up in the Event Assignment
  109. * Structure (EAS) table for an Event Notification Descriptor (END)
  110. * configured for the source. Each Event Notification Descriptor defines
  111. * a notification path to a CPU and an in-memory Event Queue, in which
  112. * will be enqueued an EQ data for the OS to pull.
  113. *
  114. * The IVPE determines if a Notification Virtual Target (NVT) can
  115. * handle the event by scanning the thread contexts of the VCPUs
  116. * dispatched on the processor HW threads. It maintains the state of
  117. * the thread interrupt context (TCTX) of each thread in a NVT table.
  118. *
  119. * = Acronyms
  120. *
  121. * Description In XIVE 1.0, used to be referred as
  122. *
  123. * EAS Event Assignment Structure IVE Interrupt Virt. Entry
  124. * EAT Event Assignment Table IVT Interrupt Virt. Table
  125. * ENDT Event Notif. Descriptor Table EQDT Event Queue Desc. Table
  126. * EQ Event Queue same
  127. * ESB Event State Buffer SBE State Bit Entry
  128. * NVT Notif. Virtual Target VPD Virtual Processor Desc.
  129. * NVTT Notif. Virtual Target Table VPDT Virtual Processor Desc. Table
  130. * TCTX Thread interrupt Context
  131. *
  132. *
  133. * Copyright (c) 2017-2024, IBM Corporation.
  134. *
  135. * SPDX-License-Identifier: GPL-2.0-or-later
  136. */
  137. #ifndef PPC_XIVE_H
  138. #define PPC_XIVE_H
  139. #include "system/kvm.h"
  140. #include "hw/sysbus.h"
  141. #include "hw/ppc/xive_regs.h"
  142. #include "qom/object.h"
  143. /*
  144. * XIVE Notifier (Interface between Source and Router)
  145. */
  146. typedef struct XiveNotifier XiveNotifier;
  147. #define TYPE_XIVE_NOTIFIER "xive-notifier"
  148. #define XIVE_NOTIFIER(obj) \
  149. INTERFACE_CHECK(XiveNotifier, (obj), TYPE_XIVE_NOTIFIER)
  150. typedef struct XiveNotifierClass XiveNotifierClass;
  151. DECLARE_CLASS_CHECKERS(XiveNotifierClass, XIVE_NOTIFIER,
  152. TYPE_XIVE_NOTIFIER)
  153. struct XiveNotifierClass {
  154. InterfaceClass parent;
  155. void (*notify)(XiveNotifier *xn, uint32_t lisn, bool pq_checked);
  156. };
  157. /*
  158. * XIVE Interrupt Source
  159. */
  160. #define TYPE_XIVE_SOURCE "xive-source"
  161. OBJECT_DECLARE_SIMPLE_TYPE(XiveSource, XIVE_SOURCE)
  162. /*
  163. * XIVE Interrupt Source characteristics, which define how the ESB are
  164. * controlled.
  165. */
  166. #define XIVE_SRC_H_INT_ESB 0x1 /* ESB managed with hcall H_INT_ESB */
  167. #define XIVE_SRC_STORE_EOI 0x2 /* Store EOI supported */
  168. #define XIVE_SRC_PQ_DISABLE 0x4 /* Disable check on the PQ state bits */
  169. struct XiveSource {
  170. DeviceState parent;
  171. /* IRQs */
  172. uint32_t nr_irqs;
  173. unsigned long *lsi_map;
  174. /* PQ bits and LSI assertion bit */
  175. uint8_t *status;
  176. uint8_t reset_pq; /* PQ state on reset */
  177. /* ESB memory region */
  178. uint64_t esb_flags;
  179. uint32_t esb_shift;
  180. MemoryRegion esb_mmio;
  181. MemoryRegion esb_mmio_emulated;
  182. /* KVM support */
  183. void *esb_mmap;
  184. MemoryRegion esb_mmio_kvm;
  185. XiveNotifier *xive;
  186. };
  187. /*
  188. * ESB MMIO setting. Can be one page, for both source triggering and
  189. * source management, or two different pages. See below for magic
  190. * values.
  191. */
  192. #define XIVE_ESB_4K 12 /* PSI HB only */
  193. #define XIVE_ESB_4K_2PAGE 13
  194. #define XIVE_ESB_64K 16
  195. #define XIVE_ESB_64K_2PAGE 17
  196. static inline bool xive_source_esb_has_2page(XiveSource *xsrc)
  197. {
  198. return xsrc->esb_shift == XIVE_ESB_64K_2PAGE ||
  199. xsrc->esb_shift == XIVE_ESB_4K_2PAGE;
  200. }
  201. static inline uint64_t xive_source_esb_len(XiveSource *xsrc)
  202. {
  203. return (1ull << xsrc->esb_shift) * xsrc->nr_irqs;
  204. }
  205. /* The trigger page is always the first/even page */
  206. static inline hwaddr xive_source_esb_page(XiveSource *xsrc, uint32_t srcno)
  207. {
  208. assert(srcno < xsrc->nr_irqs);
  209. return (1ull << xsrc->esb_shift) * srcno;
  210. }
  211. /* In a two pages ESB MMIO setting, the odd page is for management */
  212. static inline hwaddr xive_source_esb_mgmt(XiveSource *xsrc, int srcno)
  213. {
  214. hwaddr addr = xive_source_esb_page(xsrc, srcno);
  215. if (xive_source_esb_has_2page(xsrc)) {
  216. addr += (1 << (xsrc->esb_shift - 1));
  217. }
  218. return addr;
  219. }
  220. /*
  221. * Each interrupt source has a 2-bit state machine which can be
  222. * controlled by MMIO. P indicates that an interrupt is pending (has
  223. * been sent to a queue and is waiting for an EOI). Q indicates that
  224. * the interrupt has been triggered while pending.
  225. *
  226. * This acts as a coalescing mechanism in order to guarantee that a
  227. * given interrupt only occurs at most once in a queue.
  228. *
  229. * When doing an EOI, the Q bit will indicate if the interrupt
  230. * needs to be re-triggered.
  231. */
  232. #define XIVE_STATUS_ASSERTED 0x4 /* Extra bit for LSI */
  233. #define XIVE_ESB_VAL_P 0x2
  234. #define XIVE_ESB_VAL_Q 0x1
  235. #define XIVE_ESB_RESET 0x0
  236. #define XIVE_ESB_PENDING XIVE_ESB_VAL_P
  237. #define XIVE_ESB_QUEUED (XIVE_ESB_VAL_P | XIVE_ESB_VAL_Q)
  238. #define XIVE_ESB_OFF XIVE_ESB_VAL_Q
  239. bool xive_esb_trigger(uint8_t *pq);
  240. bool xive_esb_eoi(uint8_t *pq);
  241. uint8_t xive_esb_set(uint8_t *pq, uint8_t value);
  242. /*
  243. * "magic" Event State Buffer (ESB) MMIO offsets.
  244. *
  245. * The following offsets into the ESB MMIO allow to read or manipulate
  246. * the PQ bits. They must be used with an 8-byte load instruction.
  247. * They all return the previous state of the interrupt (atomically).
  248. *
  249. * Additionally, some ESB pages support doing an EOI via a store and
  250. * some ESBs support doing a trigger via a separate trigger page.
  251. */
  252. #define XIVE_ESB_STORE_EOI 0x400 /* Store */
  253. #define XIVE_ESB_LOAD_EOI 0x000 /* Load */
  254. #define XIVE_ESB_GET 0x800 /* Load */
  255. #define XIVE_ESB_INJECT 0x800 /* Store */
  256. #define XIVE_ESB_SET_PQ_00 0xc00 /* Load */
  257. #define XIVE_ESB_SET_PQ_01 0xd00 /* Load */
  258. #define XIVE_ESB_SET_PQ_10 0xe00 /* Load */
  259. #define XIVE_ESB_SET_PQ_11 0xf00 /* Load */
  260. uint8_t xive_source_esb_get(XiveSource *xsrc, uint32_t srcno);
  261. uint8_t xive_source_esb_set(XiveSource *xsrc, uint32_t srcno, uint8_t pq);
  262. /*
  263. * Source status helpers
  264. */
  265. static inline void xive_source_set_status(XiveSource *xsrc, uint32_t srcno,
  266. uint8_t status, bool enable)
  267. {
  268. if (enable) {
  269. xsrc->status[srcno] |= status;
  270. } else {
  271. xsrc->status[srcno] &= ~status;
  272. }
  273. }
  274. static inline void xive_source_set_asserted(XiveSource *xsrc, uint32_t srcno,
  275. bool enable)
  276. {
  277. xive_source_set_status(xsrc, srcno, XIVE_STATUS_ASSERTED, enable);
  278. }
  279. static inline bool xive_source_is_asserted(XiveSource *xsrc, uint32_t srcno)
  280. {
  281. return xsrc->status[srcno] & XIVE_STATUS_ASSERTED;
  282. }
  283. void xive_source_pic_print_info(XiveSource *xsrc, uint32_t offset,
  284. GString *buf);
  285. static inline bool xive_source_irq_is_lsi(XiveSource *xsrc, uint32_t srcno)
  286. {
  287. assert(srcno < xsrc->nr_irqs);
  288. return test_bit(srcno, xsrc->lsi_map);
  289. }
  290. static inline void xive_source_irq_set_lsi(XiveSource *xsrc, uint32_t srcno)
  291. {
  292. assert(srcno < xsrc->nr_irqs);
  293. bitmap_set(xsrc->lsi_map, srcno, 1);
  294. }
  295. void xive_source_set_irq(void *opaque, int srcno, int val);
  296. /*
  297. * XIVE Thread interrupt Management (TM) context
  298. */
  299. #define TYPE_XIVE_TCTX "xive-tctx"
  300. OBJECT_DECLARE_SIMPLE_TYPE(XiveTCTX, XIVE_TCTX)
  301. /*
  302. * XIVE Thread interrupt Management register rings :
  303. *
  304. * QW-0 User event-based exception state
  305. * QW-1 O/S OS context for priority management, interrupt acks
  306. * QW-2 Pool hypervisor pool context for virtual processors dispatched
  307. * QW-3 Physical physical thread context and security context
  308. */
  309. #define XIVE_TM_RING_COUNT 4
  310. #define XIVE_TM_RING_SIZE 0x10
  311. typedef struct XivePresenter XivePresenter;
  312. struct XiveTCTX {
  313. DeviceState parent_obj;
  314. CPUState *cs;
  315. qemu_irq hv_output;
  316. qemu_irq os_output;
  317. uint8_t regs[XIVE_TM_RING_COUNT * XIVE_TM_RING_SIZE];
  318. XivePresenter *xptr;
  319. };
  320. static inline uint32_t xive_tctx_word2(uint8_t *ring)
  321. {
  322. return *((uint32_t *) &ring[TM_WORD2]);
  323. }
  324. /*
  325. * XIVE Router
  326. */
  327. typedef struct XiveFabric XiveFabric;
  328. struct XiveRouter {
  329. SysBusDevice parent;
  330. XiveFabric *xfb;
  331. };
  332. #define TYPE_XIVE_ROUTER "xive-router"
  333. OBJECT_DECLARE_TYPE(XiveRouter, XiveRouterClass,
  334. XIVE_ROUTER)
  335. struct XiveRouterClass {
  336. SysBusDeviceClass parent;
  337. /* XIVE table accessors */
  338. int (*get_eas)(XiveRouter *xrtr, uint8_t eas_blk, uint32_t eas_idx,
  339. XiveEAS *eas);
  340. int (*get_pq)(XiveRouter *xrtr, uint8_t eas_blk, uint32_t eas_idx,
  341. uint8_t *pq);
  342. int (*set_pq)(XiveRouter *xrtr, uint8_t eas_blk, uint32_t eas_idx,
  343. uint8_t *pq);
  344. int (*get_end)(XiveRouter *xrtr, uint8_t end_blk, uint32_t end_idx,
  345. XiveEND *end);
  346. int (*write_end)(XiveRouter *xrtr, uint8_t end_blk, uint32_t end_idx,
  347. XiveEND *end, uint8_t word_number);
  348. int (*get_nvt)(XiveRouter *xrtr, uint8_t nvt_blk, uint32_t nvt_idx,
  349. XiveNVT *nvt);
  350. int (*write_nvt)(XiveRouter *xrtr, uint8_t nvt_blk, uint32_t nvt_idx,
  351. XiveNVT *nvt, uint8_t word_number);
  352. uint8_t (*get_block_id)(XiveRouter *xrtr);
  353. void (*end_notify)(XiveRouter *xrtr, XiveEAS *eas);
  354. };
  355. int xive_router_get_eas(XiveRouter *xrtr, uint8_t eas_blk, uint32_t eas_idx,
  356. XiveEAS *eas);
  357. int xive_router_get_end(XiveRouter *xrtr, uint8_t end_blk, uint32_t end_idx,
  358. XiveEND *end);
  359. int xive_router_write_end(XiveRouter *xrtr, uint8_t end_blk, uint32_t end_idx,
  360. XiveEND *end, uint8_t word_number);
  361. int xive_router_get_nvt(XiveRouter *xrtr, uint8_t nvt_blk, uint32_t nvt_idx,
  362. XiveNVT *nvt);
  363. int xive_router_write_nvt(XiveRouter *xrtr, uint8_t nvt_blk, uint32_t nvt_idx,
  364. XiveNVT *nvt, uint8_t word_number);
  365. void xive_router_notify(XiveNotifier *xn, uint32_t lisn, bool pq_checked);
  366. void xive_router_end_notify(XiveRouter *xrtr, XiveEAS *eas);
  367. /*
  368. * XIVE Presenter
  369. */
  370. typedef struct XiveTCTXMatch {
  371. XiveTCTX *tctx;
  372. uint8_t ring;
  373. bool precluded;
  374. } XiveTCTXMatch;
  375. #define TYPE_XIVE_PRESENTER "xive-presenter"
  376. #define XIVE_PRESENTER(obj) \
  377. INTERFACE_CHECK(XivePresenter, (obj), TYPE_XIVE_PRESENTER)
  378. typedef struct XivePresenterClass XivePresenterClass;
  379. DECLARE_CLASS_CHECKERS(XivePresenterClass, XIVE_PRESENTER,
  380. TYPE_XIVE_PRESENTER)
  381. #define XIVE_PRESENTER_GEN1_TIMA_OS 0x1
  382. struct XivePresenterClass {
  383. InterfaceClass parent;
  384. int (*match_nvt)(XivePresenter *xptr, uint8_t format,
  385. uint8_t nvt_blk, uint32_t nvt_idx,
  386. bool crowd, bool cam_ignore, uint8_t priority,
  387. uint32_t logic_serv, XiveTCTXMatch *match);
  388. bool (*in_kernel)(const XivePresenter *xptr);
  389. uint32_t (*get_config)(XivePresenter *xptr);
  390. int (*broadcast)(XivePresenter *xptr,
  391. uint8_t nvt_blk, uint32_t nvt_idx,
  392. bool crowd, bool cam_ignore, uint8_t priority);
  393. };
  394. int xive_presenter_tctx_match(XivePresenter *xptr, XiveTCTX *tctx,
  395. uint8_t format,
  396. uint8_t nvt_blk, uint32_t nvt_idx,
  397. bool cam_ignore, uint32_t logic_serv);
  398. bool xive_presenter_notify(XiveFabric *xfb, uint8_t format,
  399. uint8_t nvt_blk, uint32_t nvt_idx,
  400. bool crowd, bool cam_ignore, uint8_t priority,
  401. uint32_t logic_serv, bool *precluded);
  402. uint32_t xive_get_vpgroup_size(uint32_t nvp_index);
  403. /*
  404. * XIVE Fabric (Interface between Interrupt Controller and Machine)
  405. */
  406. #define TYPE_XIVE_FABRIC "xive-fabric"
  407. #define XIVE_FABRIC(obj) \
  408. INTERFACE_CHECK(XiveFabric, (obj), TYPE_XIVE_FABRIC)
  409. typedef struct XiveFabricClass XiveFabricClass;
  410. DECLARE_CLASS_CHECKERS(XiveFabricClass, XIVE_FABRIC,
  411. TYPE_XIVE_FABRIC)
  412. struct XiveFabricClass {
  413. InterfaceClass parent;
  414. int (*match_nvt)(XiveFabric *xfb, uint8_t format,
  415. uint8_t nvt_blk, uint32_t nvt_idx,
  416. bool crowd, bool cam_ignore, uint8_t priority,
  417. uint32_t logic_serv, XiveTCTXMatch *match);
  418. int (*broadcast)(XiveFabric *xfb, uint8_t nvt_blk, uint32_t nvt_idx,
  419. bool crowd, bool cam_ignore, uint8_t priority);
  420. };
  421. /*
  422. * XIVE END ESBs
  423. */
  424. #define TYPE_XIVE_END_SOURCE "xive-end-source"
  425. OBJECT_DECLARE_SIMPLE_TYPE(XiveENDSource, XIVE_END_SOURCE)
  426. struct XiveENDSource {
  427. DeviceState parent;
  428. uint32_t nr_ends;
  429. /* ESB memory region */
  430. uint32_t esb_shift;
  431. MemoryRegion esb_mmio;
  432. XiveRouter *xrtr;
  433. };
  434. /*
  435. * For legacy compatibility, the exceptions define up to 256 different
  436. * priorities. P9 implements only 9 levels : 8 active levels [0 - 7]
  437. * and the least favored level 0xFF.
  438. */
  439. #define XIVE_PRIORITY_MAX 7
  440. /*
  441. * Convert a priority number to an Interrupt Pending Buffer (IPB)
  442. * register, which indicates a pending interrupt at the priority
  443. * corresponding to the bit number
  444. */
  445. static inline uint8_t xive_priority_to_ipb(uint8_t priority)
  446. {
  447. return priority > XIVE_PRIORITY_MAX ?
  448. 0 : 1 << (XIVE_PRIORITY_MAX - priority);
  449. }
  450. static inline uint8_t xive_priority_to_pipr(uint8_t priority)
  451. {
  452. return priority > XIVE_PRIORITY_MAX ? 0xFF : priority;
  453. }
  454. /*
  455. * Convert an Interrupt Pending Buffer (IPB) register to a Pending
  456. * Interrupt Priority Register (PIPR), which contains the priority of
  457. * the most favored pending notification.
  458. */
  459. static inline uint8_t xive_ipb_to_pipr(uint8_t ibp)
  460. {
  461. return ibp ? clz32((uint32_t)ibp << 24) : 0xff;
  462. }
  463. /*
  464. * XIVE Thread Interrupt Management Aera (TIMA)
  465. *
  466. * This region gives access to the registers of the thread interrupt
  467. * management context. It is four page wide, each page providing a
  468. * different view of the registers. The page with the lower offset is
  469. * the most privileged and gives access to the entire context.
  470. */
  471. #define XIVE_TM_HW_PAGE 0x0
  472. #define XIVE_TM_HV_PAGE 0x1
  473. #define XIVE_TM_OS_PAGE 0x2
  474. #define XIVE_TM_USER_PAGE 0x3
  475. void xive_tctx_tm_write(XivePresenter *xptr, XiveTCTX *tctx, hwaddr offset,
  476. uint64_t value, unsigned size);
  477. uint64_t xive_tctx_tm_read(XivePresenter *xptr, XiveTCTX *tctx, hwaddr offset,
  478. unsigned size);
  479. void xive_tctx_pic_print_info(XiveTCTX *tctx, GString *buf);
  480. Object *xive_tctx_create(Object *cpu, XivePresenter *xptr, Error **errp);
  481. void xive_tctx_reset(XiveTCTX *tctx);
  482. void xive_tctx_destroy(XiveTCTX *tctx);
  483. void xive_tctx_pipr_update(XiveTCTX *tctx, uint8_t ring, uint8_t priority,
  484. uint8_t group_level);
  485. void xive_tctx_reset_signal(XiveTCTX *tctx, uint8_t ring);
  486. void xive_tctx_notify(XiveTCTX *tctx, uint8_t ring, uint8_t group_level);
  487. /*
  488. * KVM XIVE device helpers
  489. */
  490. int kvmppc_xive_source_reset_one(XiveSource *xsrc, int srcno, Error **errp);
  491. void kvmppc_xive_source_set_irq(void *opaque, int srcno, int val);
  492. int kvmppc_xive_cpu_connect(XiveTCTX *tctx, Error **errp);
  493. int kvmppc_xive_cpu_synchronize_state(XiveTCTX *tctx, Error **errp);
  494. int kvmppc_xive_cpu_get_state(XiveTCTX *tctx, Error **errp);
  495. int kvmppc_xive_cpu_set_state(XiveTCTX *tctx, Error **errp);
  496. #endif /* PPC_XIVE_H */