Skip to content

Commit eeea1a4

Browse files
ozbenhmpe
authored andcommitted
powerpc/powernv: Add XIVE related definitions to opal-api.h
Signed-off-by: Benjamin Herrenschmidt <[email protected]> Signed-off-by: Michael Ellerman <[email protected]>
1 parent 97da385 commit eeea1a4

File tree

3 files changed

+124
-1
lines changed

3 files changed

+124
-1
lines changed

arch/powerpc/include/asm/opal-api.h

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
#define OPAL_I2C_ARBT_LOST -22
4141
#define OPAL_I2C_NACK_RCVD -23
4242
#define OPAL_I2C_STOP_ERR -24
43+
#define OPAL_XIVE_PROVISIONING -31
44+
#define OPAL_XIVE_FREE_ACTIVE -32
4345

4446
/* API Tokens (in r0) */
4547
#define OPAL_INVALID_CALL -1
@@ -168,7 +170,24 @@
168170
#define OPAL_INT_SET_MFRR 125
169171
#define OPAL_PCI_TCE_KILL 126
170172
#define OPAL_NMMU_SET_PTCR 127
171-
#define OPAL_LAST 127
173+
#define OPAL_XIVE_RESET 128
174+
#define OPAL_XIVE_GET_IRQ_INFO 129
175+
#define OPAL_XIVE_GET_IRQ_CONFIG 130
176+
#define OPAL_XIVE_SET_IRQ_CONFIG 131
177+
#define OPAL_XIVE_GET_QUEUE_INFO 132
178+
#define OPAL_XIVE_SET_QUEUE_INFO 133
179+
#define OPAL_XIVE_DONATE_PAGE 134
180+
#define OPAL_XIVE_ALLOCATE_VP_BLOCK 135
181+
#define OPAL_XIVE_FREE_VP_BLOCK 136
182+
#define OPAL_XIVE_GET_VP_INFO 137
183+
#define OPAL_XIVE_SET_VP_INFO 138
184+
#define OPAL_XIVE_ALLOCATE_IRQ 139
185+
#define OPAL_XIVE_FREE_IRQ 140
186+
#define OPAL_XIVE_SYNC 141
187+
#define OPAL_XIVE_DUMP 142
188+
#define OPAL_XIVE_RESERVED3 143
189+
#define OPAL_XIVE_RESERVED4 144
190+
#define OPAL_LAST 144
172191

173192
/* Device tree flags */
174193

@@ -928,6 +947,59 @@ enum {
928947
OPAL_PCI_TCE_KILL_ALL,
929948
};
930949

950+
/* The xive operation mode indicates the active "API" and
951+
* corresponds to the "mode" parameter of the opal_xive_reset()
952+
* call
953+
*/
954+
enum {
955+
OPAL_XIVE_MODE_EMU = 0,
956+
OPAL_XIVE_MODE_EXPL = 1,
957+
};
958+
959+
/* Flags for OPAL_XIVE_GET_IRQ_INFO */
960+
enum {
961+
OPAL_XIVE_IRQ_TRIGGER_PAGE = 0x00000001,
962+
OPAL_XIVE_IRQ_STORE_EOI = 0x00000002,
963+
OPAL_XIVE_IRQ_LSI = 0x00000004,
964+
OPAL_XIVE_IRQ_SHIFT_BUG = 0x00000008,
965+
OPAL_XIVE_IRQ_MASK_VIA_FW = 0x00000010,
966+
OPAL_XIVE_IRQ_EOI_VIA_FW = 0x00000020,
967+
};
968+
969+
/* Flags for OPAL_XIVE_GET/SET_QUEUE_INFO */
970+
enum {
971+
OPAL_XIVE_EQ_ENABLED = 0x00000001,
972+
OPAL_XIVE_EQ_ALWAYS_NOTIFY = 0x00000002,
973+
OPAL_XIVE_EQ_ESCALATE = 0x00000004,
974+
};
975+
976+
/* Flags for OPAL_XIVE_GET/SET_VP_INFO */
977+
enum {
978+
OPAL_XIVE_VP_ENABLED = 0x00000001,
979+
};
980+
981+
/* "Any chip" replacement for chip ID for allocation functions */
982+
enum {
983+
OPAL_XIVE_ANY_CHIP = 0xffffffff,
984+
};
985+
986+
/* Xive sync options */
987+
enum {
988+
/* This bits are cumulative, arg is a girq */
989+
XIVE_SYNC_EAS = 0x00000001, /* Sync irq source */
990+
XIVE_SYNC_QUEUE = 0x00000002, /* Sync irq target */
991+
};
992+
993+
/* Dump options */
994+
enum {
995+
XIVE_DUMP_TM_HYP = 0,
996+
XIVE_DUMP_TM_POOL = 1,
997+
XIVE_DUMP_TM_OS = 2,
998+
XIVE_DUMP_TM_USER = 3,
999+
XIVE_DUMP_VP = 4,
1000+
XIVE_DUMP_EMU_STATE = 5,
1001+
};
1002+
9311003
#endif /* __ASSEMBLY__ */
9321004

9331005
#endif /* __OPAL_API_H */

arch/powerpc/include/asm/opal.h

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,42 @@ int64_t opal_pci_tce_kill(uint64_t phb_id, uint32_t kill_type,
226226
uint32_t pe_num, uint32_t tce_size,
227227
uint64_t dma_addr, uint32_t npages);
228228
int64_t opal_nmmu_set_ptcr(uint64_t chip_id, uint64_t ptcr);
229+
int64_t opal_xive_reset(uint64_t version);
230+
int64_t opal_xive_get_irq_info(uint32_t girq,
231+
__be64 *out_flags,
232+
__be64 *out_eoi_page,
233+
__be64 *out_trig_page,
234+
__be32 *out_esb_shift,
235+
__be32 *out_src_chip);
236+
int64_t opal_xive_get_irq_config(uint32_t girq, __be64 *out_vp,
237+
uint8_t *out_prio, __be32 *out_lirq);
238+
int64_t opal_xive_set_irq_config(uint32_t girq, uint64_t vp, uint8_t prio,
239+
uint32_t lirq);
240+
int64_t opal_xive_get_queue_info(uint64_t vp, uint32_t prio,
241+
__be64 *out_qpage,
242+
__be64 *out_qsize,
243+
__be64 *out_qeoi_page,
244+
__be32 *out_escalate_irq,
245+
__be64 *out_qflags);
246+
int64_t opal_xive_set_queue_info(uint64_t vp, uint32_t prio,
247+
uint64_t qpage,
248+
uint64_t qsize,
249+
uint64_t qflags);
250+
int64_t opal_xive_donate_page(uint32_t chip_id, uint64_t addr);
251+
int64_t opal_xive_alloc_vp_block(uint32_t alloc_order);
252+
int64_t opal_xive_free_vp_block(uint64_t vp);
253+
int64_t opal_xive_get_vp_info(uint64_t vp,
254+
__be64 *out_flags,
255+
__be64 *out_cam_value,
256+
__be64 *out_report_cl_pair,
257+
__be32 *out_chip_id);
258+
int64_t opal_xive_set_vp_info(uint64_t vp,
259+
uint64_t flags,
260+
uint64_t report_cl_pair);
261+
int64_t opal_xive_allocate_irq(uint32_t chip_id);
262+
int64_t opal_xive_free_irq(uint32_t girq);
263+
int64_t opal_xive_sync(uint32_t type, uint32_t id);
264+
int64_t opal_xive_dump(uint32_t type, uint32_t id);
229265

230266
/* Internal functions */
231267
extern int early_init_dt_scan_opal(unsigned long node, const char *uname,

arch/powerpc/platforms/powernv/opal-wrappers.S

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,3 +301,18 @@ OPAL_CALL(opal_int_eoi, OPAL_INT_EOI);
301301
OPAL_CALL(opal_int_set_mfrr, OPAL_INT_SET_MFRR);
302302
OPAL_CALL(opal_pci_tce_kill, OPAL_PCI_TCE_KILL);
303303
OPAL_CALL(opal_nmmu_set_ptcr, OPAL_NMMU_SET_PTCR);
304+
OPAL_CALL(opal_xive_reset, OPAL_XIVE_RESET);
305+
OPAL_CALL(opal_xive_get_irq_info, OPAL_XIVE_GET_IRQ_INFO);
306+
OPAL_CALL(opal_xive_get_irq_config, OPAL_XIVE_GET_IRQ_CONFIG);
307+
OPAL_CALL(opal_xive_set_irq_config, OPAL_XIVE_SET_IRQ_CONFIG);
308+
OPAL_CALL(opal_xive_get_queue_info, OPAL_XIVE_GET_QUEUE_INFO);
309+
OPAL_CALL(opal_xive_set_queue_info, OPAL_XIVE_SET_QUEUE_INFO);
310+
OPAL_CALL(opal_xive_donate_page, OPAL_XIVE_DONATE_PAGE);
311+
OPAL_CALL(opal_xive_alloc_vp_block, OPAL_XIVE_ALLOCATE_VP_BLOCK);
312+
OPAL_CALL(opal_xive_free_vp_block, OPAL_XIVE_FREE_VP_BLOCK);
313+
OPAL_CALL(opal_xive_allocate_irq, OPAL_XIVE_ALLOCATE_IRQ);
314+
OPAL_CALL(opal_xive_free_irq, OPAL_XIVE_FREE_IRQ);
315+
OPAL_CALL(opal_xive_get_vp_info, OPAL_XIVE_GET_VP_INFO);
316+
OPAL_CALL(opal_xive_set_vp_info, OPAL_XIVE_SET_VP_INFO);
317+
OPAL_CALL(opal_xive_sync, OPAL_XIVE_SYNC);
318+
OPAL_CALL(opal_xive_dump, OPAL_XIVE_DUMP);

0 commit comments

Comments
 (0)