1
2
3
4
5
6
7
8
9
10#ifndef PPC_SPAPR_XIVE_H
11#define PPC_SPAPR_XIVE_H
12
13#include "hw/ppc/spapr_irq.h"
14#include "hw/ppc/xive.h"
15
16#define TYPE_SPAPR_XIVE "spapr-xive"
17#define SPAPR_XIVE(obj) OBJECT_CHECK(SpaprXive, (obj), TYPE_SPAPR_XIVE)
18#define SPAPR_XIVE_CLASS(klass) \
19 OBJECT_CLASS_CHECK(SpaprXiveClass, (klass), TYPE_SPAPR_XIVE)
20#define SPAPR_XIVE_GET_CLASS(obj) \
21 OBJECT_GET_CLASS(SpaprXiveClass, (obj), TYPE_SPAPR_XIVE)
22
23typedef struct SpaprXive {
24 XiveRouter parent;
25
26
27 XiveSource source;
28 hwaddr vc_base;
29
30
31 XiveENDSource end_source;
32 hwaddr end_base;
33
34
35 gchar *nodename;
36
37
38 XiveEAS *eat;
39 uint32_t nr_irqs;
40 XiveEND *endt;
41 uint32_t nr_ends;
42
43
44 hwaddr tm_base;
45 MemoryRegion tm_mmio;
46
47
48 int fd;
49 void *tm_mmap;
50 MemoryRegion tm_mmio_kvm;
51 VMChangeStateEntry *change;
52} SpaprXive;
53
54typedef struct SpaprXiveClass {
55 XiveRouterClass parent;
56
57 DeviceRealize parent_realize;
58} SpaprXiveClass;
59
60
61
62
63
64
65#define SPAPR_XIVE_BLOCK_ID 0x0
66
67void spapr_xive_pic_print_info(SpaprXive *xive, Monitor *mon);
68
69void spapr_xive_hcall_init(SpaprMachineState *spapr);
70void spapr_xive_mmio_set_enabled(SpaprXive *xive, bool enable);
71void spapr_xive_map_mmio(SpaprXive *xive);
72
73int spapr_xive_end_to_target(uint8_t end_blk, uint32_t end_idx,
74 uint32_t *out_server, uint8_t *out_prio);
75
76
77
78
79int kvmppc_xive_connect(SpaprInterruptController *intc, uint32_t nr_servers,
80 Error **errp);
81void kvmppc_xive_disconnect(SpaprInterruptController *intc);
82void kvmppc_xive_reset(SpaprXive *xive, Error **errp);
83void kvmppc_xive_set_source_config(SpaprXive *xive, uint32_t lisn, XiveEAS *eas,
84 Error **errp);
85void kvmppc_xive_sync_source(SpaprXive *xive, uint32_t lisn, Error **errp);
86uint64_t kvmppc_xive_esb_rw(XiveSource *xsrc, int srcno, uint32_t offset,
87 uint64_t data, bool write);
88void kvmppc_xive_set_queue_config(SpaprXive *xive, uint8_t end_blk,
89 uint32_t end_idx, XiveEND *end,
90 Error **errp);
91void kvmppc_xive_get_queue_config(SpaprXive *xive, uint8_t end_blk,
92 uint32_t end_idx, XiveEND *end,
93 Error **errp);
94void kvmppc_xive_synchronize_state(SpaprXive *xive, Error **errp);
95int kvmppc_xive_pre_save(SpaprXive *xive);
96int kvmppc_xive_post_load(SpaprXive *xive, int version_id);
97
98#endif
99