2 * QEMU PowerPC XIVE2 interrupt controller model (POWER10)
4 * Copyright (c) 2019-2022, IBM Corporation.
6 * This code is licensed under the GPL version 2 or later. See the
7 * COPYING file in the top-level directory.
10 #include "qemu/osdep.h"
12 #include "qapi/error.h"
13 #include "target/ppc/cpu.h"
14 #include "sysemu/cpus.h"
15 #include "sysemu/dma.h"
16 #include "monitor/monitor.h"
17 #include "hw/ppc/fdt.h"
18 #include "hw/ppc/pnv.h"
19 #include "hw/ppc/pnv_chip.h"
20 #include "hw/ppc/pnv_core.h"
21 #include "hw/ppc/pnv_xscom.h"
22 #include "hw/ppc/xive2.h"
23 #include "hw/ppc/pnv_xive.h"
24 #include "hw/ppc/xive_regs.h"
25 #include "hw/ppc/xive2_regs.h"
26 #include "hw/ppc/ppc.h"
27 #include "hw/qdev-properties.h"
28 #include "sysemu/reset.h"
32 #include "pnv_xive2_regs.h"
37 * Virtual structures table (VST)
39 #define SBE_PER_BYTE 4
41 typedef struct XiveVstInfo
{
47 static const XiveVstInfo vst_infos
[] = {
49 [VST_EAS
] = { "EAT", sizeof(Xive2Eas
), 16 },
50 [VST_ESB
] = { "ESB", 1, 16 },
51 [VST_END
] = { "ENDT", sizeof(Xive2End
), 16 },
53 [VST_NVP
] = { "NVPT", sizeof(Xive2Nvp
), 16 },
54 [VST_NVG
] = { "NVGT", sizeof(Xive2Nvgc
), 16 },
55 [VST_NVC
] = { "NVCT", sizeof(Xive2Nvgc
), 16 },
57 [VST_IC
] = { "IC", 1 /* ? */ , 16 }, /* Topology # */
58 [VST_SYNC
] = { "SYNC", 1 /* ? */ , 16 }, /* Topology # */
61 * This table contains the backing store pages for the interrupt
62 * fifos of the VC sub-engine in case of overflow.
72 [VST_ERQ
] = { "ERQ", 1, VC_QUEUE_COUNT
},
75 #define xive2_error(xive, fmt, ...) \
76 qemu_log_mask(LOG_GUEST_ERROR, "XIVE[%x] - " fmt "\n", \
77 (xive)->chip->chip_id, ## __VA_ARGS__);
80 * TODO: Document block id override
82 static uint32_t pnv_xive2_block_id(PnvXive2
*xive
)
84 uint8_t blk
= xive
->chip
->chip_id
;
85 uint64_t cfg_val
= xive
->cq_regs
[CQ_XIVE_CFG
>> 3];
87 if (cfg_val
& CQ_XIVE_CFG_HYP_HARD_BLKID_OVERRIDE
) {
88 blk
= GETFIELD(CQ_XIVE_CFG_HYP_HARD_BLOCK_ID
, cfg_val
);
95 * Remote access to controllers. HW uses MMIOs. For now, a simple scan
96 * of the chips is good enough.
98 * TODO: Block scope support
100 static PnvXive2
*pnv_xive2_get_remote(uint8_t blk
)
102 PnvMachineState
*pnv
= PNV_MACHINE(qdev_get_machine());
105 for (i
= 0; i
< pnv
->num_chips
; i
++) {
106 Pnv10Chip
*chip10
= PNV10_CHIP(pnv
->chips
[i
]);
107 PnvXive2
*xive
= &chip10
->xive
;
109 if (pnv_xive2_block_id(xive
) == blk
) {
117 * VST accessors for ESB, EAT, ENDT, NVP
119 * Indirect VST tables are arrays of VSDs pointing to a page (of same
120 * size). Each page is a direct VST table.
123 #define XIVE_VSD_SIZE 8
125 /* Indirect page size can be 4K, 64K, 2M, 16M. */
126 static uint64_t pnv_xive2_vst_page_size_allowed(uint32_t page_shift
)
128 return page_shift
== 12 || page_shift
== 16 ||
129 page_shift
== 21 || page_shift
== 24;
132 static uint64_t pnv_xive2_vst_addr_direct(PnvXive2
*xive
, uint32_t type
,
133 uint64_t vsd
, uint32_t idx
)
135 const XiveVstInfo
*info
= &vst_infos
[type
];
136 uint64_t vst_addr
= vsd
& VSD_ADDRESS_MASK
;
137 uint64_t vst_tsize
= 1ull << (GETFIELD(VSD_TSIZE
, vsd
) + 12);
140 idx_max
= vst_tsize
/ info
->size
- 1;
143 xive2_error(xive
, "VST: %s entry %x out of range [ 0 .. %x ] !?",
144 info
->name
, idx
, idx_max
);
149 return vst_addr
+ idx
* info
->size
;
152 static uint64_t pnv_xive2_vst_addr_indirect(PnvXive2
*xive
, uint32_t type
,
153 uint64_t vsd
, uint32_t idx
)
155 const XiveVstInfo
*info
= &vst_infos
[type
];
159 uint32_t vst_per_page
;
161 /* Get the page size of the indirect table. */
162 vsd_addr
= vsd
& VSD_ADDRESS_MASK
;
163 ldq_be_dma(&address_space_memory
, vsd_addr
, &vsd
, MEMTXATTRS_UNSPECIFIED
);
165 if (!(vsd
& VSD_ADDRESS_MASK
)) {
166 xive2_error(xive
, "VST: invalid %s entry %x !?", info
->name
, idx
);
170 page_shift
= GETFIELD(VSD_TSIZE
, vsd
) + 12;
172 if (!pnv_xive2_vst_page_size_allowed(page_shift
)) {
173 xive2_error(xive
, "VST: invalid %s page shift %d", info
->name
,
178 vst_per_page
= (1ull << page_shift
) / info
->size
;
179 vsd_idx
= idx
/ vst_per_page
;
181 /* Load the VSD we are looking for, if not already done */
183 vsd_addr
= vsd_addr
+ vsd_idx
* XIVE_VSD_SIZE
;
184 ldq_be_dma(&address_space_memory
, vsd_addr
, &vsd
,
185 MEMTXATTRS_UNSPECIFIED
);
187 if (!(vsd
& VSD_ADDRESS_MASK
)) {
188 xive2_error(xive
, "VST: invalid %s entry %x !?", info
->name
, idx
);
193 * Check that the pages have a consistent size across the
196 if (page_shift
!= GETFIELD(VSD_TSIZE
, vsd
) + 12) {
197 xive2_error(xive
, "VST: %s entry %x indirect page size differ !?",
203 return pnv_xive2_vst_addr_direct(xive
, type
, vsd
, (idx
% vst_per_page
));
206 static uint64_t pnv_xive2_vst_addr(PnvXive2
*xive
, uint32_t type
, uint8_t blk
,
209 const XiveVstInfo
*info
= &vst_infos
[type
];
212 if (blk
>= info
->max_blocks
) {
213 xive2_error(xive
, "VST: invalid block id %d for VST %s %d !?",
214 blk
, info
->name
, idx
);
218 vsd
= xive
->vsds
[type
][blk
];
220 /* Remote VST access */
221 if (GETFIELD(VSD_MODE
, vsd
) == VSD_MODE_FORWARD
) {
222 xive
= pnv_xive2_get_remote(blk
);
224 return xive
? pnv_xive2_vst_addr(xive
, type
, blk
, idx
) : 0;
227 if (VSD_INDIRECT
& vsd
) {
228 return pnv_xive2_vst_addr_indirect(xive
, type
, vsd
, idx
);
231 return pnv_xive2_vst_addr_direct(xive
, type
, vsd
, idx
);
234 static int pnv_xive2_vst_read(PnvXive2
*xive
, uint32_t type
, uint8_t blk
,
235 uint32_t idx
, void *data
)
237 const XiveVstInfo
*info
= &vst_infos
[type
];
238 uint64_t addr
= pnv_xive2_vst_addr(xive
, type
, blk
, idx
);
244 cpu_physical_memory_read(addr
, data
, info
->size
);
248 #define XIVE_VST_WORD_ALL -1
250 static int pnv_xive2_vst_write(PnvXive2
*xive
, uint32_t type
, uint8_t blk
,
251 uint32_t idx
, void *data
, uint32_t word_number
)
253 const XiveVstInfo
*info
= &vst_infos
[type
];
254 uint64_t addr
= pnv_xive2_vst_addr(xive
, type
, blk
, idx
);
260 if (word_number
== XIVE_VST_WORD_ALL
) {
261 cpu_physical_memory_write(addr
, data
, info
->size
);
263 cpu_physical_memory_write(addr
+ word_number
* 4,
264 data
+ word_number
* 4, 4);
269 static int pnv_xive2_get_pq(Xive2Router
*xrtr
, uint8_t blk
, uint32_t idx
,
272 PnvXive2
*xive
= PNV_XIVE2(xrtr
);
274 if (pnv_xive2_block_id(xive
) != blk
) {
275 xive2_error(xive
, "VST: EAS %x is remote !?", XIVE_EAS(blk
, idx
));
279 *pq
= xive_source_esb_get(&xive
->ipi_source
, idx
);
283 static int pnv_xive2_set_pq(Xive2Router
*xrtr
, uint8_t blk
, uint32_t idx
,
286 PnvXive2
*xive
= PNV_XIVE2(xrtr
);
288 if (pnv_xive2_block_id(xive
) != blk
) {
289 xive2_error(xive
, "VST: EAS %x is remote !?", XIVE_EAS(blk
, idx
));
293 *pq
= xive_source_esb_set(&xive
->ipi_source
, idx
, *pq
);
297 static int pnv_xive2_get_end(Xive2Router
*xrtr
, uint8_t blk
, uint32_t idx
,
300 return pnv_xive2_vst_read(PNV_XIVE2(xrtr
), VST_END
, blk
, idx
, end
);
303 static int pnv_xive2_write_end(Xive2Router
*xrtr
, uint8_t blk
, uint32_t idx
,
304 Xive2End
*end
, uint8_t word_number
)
306 return pnv_xive2_vst_write(PNV_XIVE2(xrtr
), VST_END
, blk
, idx
, end
,
310 static int pnv_xive2_end_update(PnvXive2
*xive
)
312 uint8_t blk
= GETFIELD(VC_ENDC_WATCH_BLOCK_ID
,
313 xive
->vc_regs
[(VC_ENDC_WATCH0_SPEC
>> 3)]);
314 uint32_t idx
= GETFIELD(VC_ENDC_WATCH_INDEX
,
315 xive
->vc_regs
[(VC_ENDC_WATCH0_SPEC
>> 3)]);
317 uint64_t endc_watch
[4];
319 for (i
= 0; i
< ARRAY_SIZE(endc_watch
); i
++) {
321 cpu_to_be64(xive
->vc_regs
[(VC_ENDC_WATCH0_DATA0
>> 3) + i
]);
324 return pnv_xive2_vst_write(xive
, VST_END
, blk
, idx
, endc_watch
,
328 static void pnv_xive2_end_cache_load(PnvXive2
*xive
)
330 uint8_t blk
= GETFIELD(VC_ENDC_WATCH_BLOCK_ID
,
331 xive
->vc_regs
[(VC_ENDC_WATCH0_SPEC
>> 3)]);
332 uint32_t idx
= GETFIELD(VC_ENDC_WATCH_INDEX
,
333 xive
->vc_regs
[(VC_ENDC_WATCH0_SPEC
>> 3)]);
334 uint64_t endc_watch
[4] = { 0 };
337 if (pnv_xive2_vst_read(xive
, VST_END
, blk
, idx
, endc_watch
)) {
338 xive2_error(xive
, "VST: no END entry %x/%x !?", blk
, idx
);
341 for (i
= 0; i
< ARRAY_SIZE(endc_watch
); i
++) {
342 xive
->vc_regs
[(VC_ENDC_WATCH0_DATA0
>> 3) + i
] =
343 be64_to_cpu(endc_watch
[i
]);
347 static int pnv_xive2_get_nvp(Xive2Router
*xrtr
, uint8_t blk
, uint32_t idx
,
350 return pnv_xive2_vst_read(PNV_XIVE2(xrtr
), VST_NVP
, blk
, idx
, nvp
);
353 static int pnv_xive2_write_nvp(Xive2Router
*xrtr
, uint8_t blk
, uint32_t idx
,
354 Xive2Nvp
*nvp
, uint8_t word_number
)
356 return pnv_xive2_vst_write(PNV_XIVE2(xrtr
), VST_NVP
, blk
, idx
, nvp
,
360 static int pnv_xive2_nvp_update(PnvXive2
*xive
)
362 uint8_t blk
= GETFIELD(PC_NXC_WATCH_BLOCK_ID
,
363 xive
->pc_regs
[(PC_NXC_WATCH0_SPEC
>> 3)]);
364 uint32_t idx
= GETFIELD(PC_NXC_WATCH_INDEX
,
365 xive
->pc_regs
[(PC_NXC_WATCH0_SPEC
>> 3)]);
367 uint64_t nxc_watch
[4];
369 for (i
= 0; i
< ARRAY_SIZE(nxc_watch
); i
++) {
371 cpu_to_be64(xive
->pc_regs
[(PC_NXC_WATCH0_DATA0
>> 3) + i
]);
374 return pnv_xive2_vst_write(xive
, VST_NVP
, blk
, idx
, nxc_watch
,
378 static void pnv_xive2_nvp_cache_load(PnvXive2
*xive
)
380 uint8_t blk
= GETFIELD(PC_NXC_WATCH_BLOCK_ID
,
381 xive
->pc_regs
[(PC_NXC_WATCH0_SPEC
>> 3)]);
382 uint32_t idx
= GETFIELD(PC_NXC_WATCH_INDEX
,
383 xive
->pc_regs
[(PC_NXC_WATCH0_SPEC
>> 3)]);
384 uint64_t nxc_watch
[4] = { 0 };
387 if (pnv_xive2_vst_read(xive
, VST_NVP
, blk
, idx
, nxc_watch
)) {
388 xive2_error(xive
, "VST: no NVP entry %x/%x !?", blk
, idx
);
391 for (i
= 0; i
< ARRAY_SIZE(nxc_watch
); i
++) {
392 xive
->pc_regs
[(PC_NXC_WATCH0_DATA0
>> 3) + i
] =
393 be64_to_cpu(nxc_watch
[i
]);
397 static int pnv_xive2_get_eas(Xive2Router
*xrtr
, uint8_t blk
, uint32_t idx
,
400 PnvXive2
*xive
= PNV_XIVE2(xrtr
);
402 if (pnv_xive2_block_id(xive
) != blk
) {
403 xive2_error(xive
, "VST: EAS %x is remote !?", XIVE_EAS(blk
, idx
));
407 return pnv_xive2_vst_read(xive
, VST_EAS
, blk
, idx
, eas
);
410 static uint32_t pnv_xive2_get_config(Xive2Router
*xrtr
)
412 PnvXive2
*xive
= PNV_XIVE2(xrtr
);
415 if (xive
->cq_regs
[CQ_XIVE_CFG
>> 3] & CQ_XIVE_CFG_GEN1_TIMA_OS
) {
416 cfg
|= XIVE2_GEN1_TIMA_OS
;
419 if (xive
->cq_regs
[CQ_XIVE_CFG
>> 3] & CQ_XIVE_CFG_EN_VP_SAVE_RESTORE
) {
420 cfg
|= XIVE2_VP_SAVE_RESTORE
;
423 if (GETFIELD(CQ_XIVE_CFG_HYP_HARD_RANGE
,
424 xive
->cq_regs
[CQ_XIVE_CFG
>> 3]) == CQ_XIVE_CFG_THREADID_8BITS
) {
425 cfg
|= XIVE2_THREADID_8BITS
;
431 static bool pnv_xive2_is_cpu_enabled(PnvXive2
*xive
, PowerPCCPU
*cpu
)
433 int pir
= ppc_cpu_pir(cpu
);
434 uint32_t fc
= PNV10_PIR2FUSEDCORE(pir
);
435 uint64_t reg
= fc
< 8 ? TCTXT_EN0
: TCTXT_EN1
;
436 uint32_t bit
= pir
& 0x3f;
438 return xive
->tctxt_regs
[reg
>> 3] & PPC_BIT(bit
);
441 static int pnv_xive2_match_nvt(XivePresenter
*xptr
, uint8_t format
,
442 uint8_t nvt_blk
, uint32_t nvt_idx
,
443 bool cam_ignore
, uint8_t priority
,
444 uint32_t logic_serv
, XiveTCTXMatch
*match
)
446 PnvXive2
*xive
= PNV_XIVE2(xptr
);
447 PnvChip
*chip
= xive
->chip
;
451 xive
->cq_regs
[CQ_XIVE_CFG
>> 3] & CQ_XIVE_CFG_GEN1_TIMA_OS
;
453 for (i
= 0; i
< chip
->nr_cores
; i
++) {
454 PnvCore
*pc
= chip
->cores
[i
];
455 CPUCore
*cc
= CPU_CORE(pc
);
457 for (j
= 0; j
< cc
->nr_threads
; j
++) {
458 PowerPCCPU
*cpu
= pc
->threads
[j
];
462 if (!pnv_xive2_is_cpu_enabled(xive
, cpu
)) {
466 tctx
= XIVE_TCTX(pnv_cpu_state(cpu
)->intc
);
469 ring
= xive_presenter_tctx_match(xptr
, tctx
, format
, nvt_blk
,
473 ring
= xive2_presenter_tctx_match(xptr
, tctx
, format
, nvt_blk
,
479 * Save the context and follow on to catch duplicates,
480 * that we don't support yet.
484 qemu_log_mask(LOG_GUEST_ERROR
, "XIVE: already found a "
485 "thread context NVT %x/%x\n",
500 static uint8_t pnv_xive2_get_block_id(Xive2Router
*xrtr
)
502 return pnv_xive2_block_id(PNV_XIVE2(xrtr
));
506 * The TIMA MMIO space is shared among the chips and to identify the
507 * chip from which the access is being done, we extract the chip id
510 static PnvXive2
*pnv_xive2_tm_get_xive(PowerPCCPU
*cpu
)
512 int pir
= ppc_cpu_pir(cpu
);
513 XivePresenter
*xptr
= XIVE_TCTX(pnv_cpu_state(cpu
)->intc
)->xptr
;
514 PnvXive2
*xive
= PNV_XIVE2(xptr
);
516 if (!pnv_xive2_is_cpu_enabled(xive
, cpu
)) {
517 xive2_error(xive
, "IC: CPU %x is not enabled", pir
);
523 * The internal sources of the interrupt controller have no knowledge
524 * of the XIVE2 chip on which they reside. Encode the block id in the
525 * source interrupt number before forwarding the source event
526 * notification to the Router. This is required on a multichip system.
528 static void pnv_xive2_notify(XiveNotifier
*xn
, uint32_t srcno
, bool pq_checked
)
530 PnvXive2
*xive
= PNV_XIVE2(xn
);
531 uint8_t blk
= pnv_xive2_block_id(xive
);
533 xive2_router_notify(xn
, XIVE_EAS(blk
, srcno
), pq_checked
);
537 * Set Translation Tables
539 * TODO add support for multiple sets
541 static int pnv_xive2_stt_set_data(PnvXive2
*xive
, uint64_t val
)
543 uint8_t tsel
= GETFIELD(CQ_TAR_SELECT
, xive
->cq_regs
[CQ_TAR
>> 3]);
544 uint8_t entry
= GETFIELD(CQ_TAR_ENTRY_SELECT
,
545 xive
->cq_regs
[CQ_TAR
>> 3]);
551 xive
->tables
[tsel
][entry
] = val
;
554 xive2_error(xive
, "IC: unsupported table %d", tsel
);
558 if (xive
->cq_regs
[CQ_TAR
>> 3] & CQ_TAR_AUTOINC
) {
559 xive
->cq_regs
[CQ_TAR
>> 3] = SETFIELD(CQ_TAR_ENTRY_SELECT
,
560 xive
->cq_regs
[CQ_TAR
>> 3], ++entry
);
566 * Virtual Structure Tables (VST) configuration
568 static void pnv_xive2_vst_set_exclusive(PnvXive2
*xive
, uint8_t type
,
569 uint8_t blk
, uint64_t vsd
)
571 Xive2EndSource
*end_xsrc
= &xive
->end_source
;
572 XiveSource
*xsrc
= &xive
->ipi_source
;
573 const XiveVstInfo
*info
= &vst_infos
[type
];
574 uint32_t page_shift
= GETFIELD(VSD_TSIZE
, vsd
) + 12;
575 uint64_t vst_tsize
= 1ull << page_shift
;
576 uint64_t vst_addr
= vsd
& VSD_ADDRESS_MASK
;
580 if (VSD_INDIRECT
& vsd
) {
581 if (!pnv_xive2_vst_page_size_allowed(page_shift
)) {
582 xive2_error(xive
, "VST: invalid %s page shift %d", info
->name
,
588 if (!QEMU_IS_ALIGNED(vst_addr
, 1ull << page_shift
)) {
589 xive2_error(xive
, "VST: %s table address 0x%"PRIx64
590 " is not aligned with page shift %d",
591 info
->name
, vst_addr
, page_shift
);
595 /* Record the table configuration (in SRAM on HW) */
596 xive
->vsds
[type
][blk
] = vsd
;
598 /* Now tune the models with the configuration provided by the FW */
603 * Backing store pages for the source PQ bits. The model does
604 * not use these PQ bits backed in RAM because the XiveSource
607 * If the table is direct, we can compute the number of PQ
608 * entries provisioned by FW (such as skiboot) and resize the
609 * ESB window accordingly.
611 if (!(VSD_INDIRECT
& vsd
)) {
612 memory_region_set_size(&xsrc
->esb_mmio
, vst_tsize
* SBE_PER_BYTE
613 * (1ull << xsrc
->esb_shift
));
616 memory_region_add_subregion(&xive
->esb_mmio
, 0, &xsrc
->esb_mmio
);
619 case VST_EAS
: /* Nothing to be done */
624 * Backing store pages for the END.
626 if (!(VSD_INDIRECT
& vsd
)) {
627 memory_region_set_size(&end_xsrc
->esb_mmio
, (vst_tsize
/ info
->size
)
628 * (1ull << end_xsrc
->esb_shift
));
630 memory_region_add_subregion(&xive
->end_mmio
, 0, &end_xsrc
->esb_mmio
);
633 case VST_NVP
: /* Not modeled */
634 case VST_NVG
: /* Not modeled */
635 case VST_NVC
: /* Not modeled */
636 case VST_IC
: /* Not modeled */
637 case VST_SYNC
: /* Not modeled */
638 case VST_ERQ
: /* Not modeled */
642 g_assert_not_reached();
647 * Both PC and VC sub-engines are configured as each use the Virtual
650 static void pnv_xive2_vst_set_data(PnvXive2
*xive
, uint64_t vsd
)
652 uint8_t mode
= GETFIELD(VSD_MODE
, vsd
);
653 uint8_t type
= GETFIELD(VC_VSD_TABLE_SELECT
,
654 xive
->vc_regs
[VC_VSD_TABLE_ADDR
>> 3]);
655 uint8_t blk
= GETFIELD(VC_VSD_TABLE_ADDRESS
,
656 xive
->vc_regs
[VC_VSD_TABLE_ADDR
>> 3]);
657 uint64_t vst_addr
= vsd
& VSD_ADDRESS_MASK
;
659 if (type
> VST_ERQ
) {
660 xive2_error(xive
, "VST: invalid table type %d", type
);
664 if (blk
>= vst_infos
[type
].max_blocks
) {
665 xive2_error(xive
, "VST: invalid block id %d for"
666 " %s table", blk
, vst_infos
[type
].name
);
671 xive2_error(xive
, "VST: invalid %s table address",
672 vst_infos
[type
].name
);
677 case VSD_MODE_FORWARD
:
678 xive
->vsds
[type
][blk
] = vsd
;
681 case VSD_MODE_EXCLUSIVE
:
682 pnv_xive2_vst_set_exclusive(xive
, type
, blk
, vsd
);
686 xive2_error(xive
, "VST: unsupported table mode %d", mode
);
699 * Page 0: Internal CQ register accesses (reads & writes)
700 * Page 1: Internal PC register accesses (reads & writes)
701 * Page 2: Internal VC register accesses (reads & writes)
702 * Page 3: Internal TCTXT (TIMA) reg accesses (read & writes)
703 * Page 4: Notify Port page (writes only, w/data),
705 * Page 6: Sync Poll page (writes only, dataless)
706 * Page 7: Sync Inject page (writes only, dataless)
707 * Page 8: LSI Trigger page (writes only, dataless)
708 * Page 9: LSI SB Management page (reads & writes dataless)
709 * Pages 10-255: Reserved
710 * Pages 256-383: Direct mapped Thread Context Area (reads & writes)
711 * covering the 128 threads in P10.
712 * Pages 384-511: Reserved
714 typedef struct PnvXive2Region
{
718 const MemoryRegionOps
*ops
;
721 static const MemoryRegionOps pnv_xive2_ic_cq_ops
;
722 static const MemoryRegionOps pnv_xive2_ic_pc_ops
;
723 static const MemoryRegionOps pnv_xive2_ic_vc_ops
;
724 static const MemoryRegionOps pnv_xive2_ic_tctxt_ops
;
725 static const MemoryRegionOps pnv_xive2_ic_notify_ops
;
726 static const MemoryRegionOps pnv_xive2_ic_sync_ops
;
727 static const MemoryRegionOps pnv_xive2_ic_lsi_ops
;
728 static const MemoryRegionOps pnv_xive2_ic_tm_indirect_ops
;
730 /* 512 pages. 4K: 2M range, 64K: 32M range */
731 static const PnvXive2Region pnv_xive2_ic_regions
[] = {
732 { "xive-ic-cq", 0, 1, &pnv_xive2_ic_cq_ops
},
733 { "xive-ic-vc", 1, 1, &pnv_xive2_ic_vc_ops
},
734 { "xive-ic-pc", 2, 1, &pnv_xive2_ic_pc_ops
},
735 { "xive-ic-tctxt", 3, 1, &pnv_xive2_ic_tctxt_ops
},
736 { "xive-ic-notify", 4, 1, &pnv_xive2_ic_notify_ops
},
737 /* page 5 reserved */
738 { "xive-ic-sync", 6, 2, &pnv_xive2_ic_sync_ops
},
739 { "xive-ic-lsi", 8, 2, &pnv_xive2_ic_lsi_ops
},
740 /* pages 10-255 reserved */
741 { "xive-ic-tm-indirect", 256, 128, &pnv_xive2_ic_tm_indirect_ops
},
742 /* pages 384-511 reserved */
749 static uint64_t pnv_xive2_ic_cq_read(void *opaque
, hwaddr offset
,
752 PnvXive2
*xive
= PNV_XIVE2(opaque
);
753 uint32_t reg
= offset
>> 3;
757 case CQ_XIVE_CAP
: /* Set at reset */
759 val
= xive
->cq_regs
[reg
];
761 case CQ_MSGSND
: /* TODO check the #cores of the machine */
762 val
= 0xffffffff00000000;
765 val
= CQ_CFG_PB_GEN_PB_INIT
; /* TODO: fix CQ_CFG_PB_GEN default value */
768 xive2_error(xive
, "CQ: invalid read @%"HWADDR_PRIx
, offset
);
774 static uint64_t pnv_xive2_bar_size(uint64_t val
)
776 return 1ull << (GETFIELD(CQ_BAR_RANGE
, val
) + 24);
779 static void pnv_xive2_ic_cq_write(void *opaque
, hwaddr offset
,
780 uint64_t val
, unsigned size
)
782 PnvXive2
*xive
= PNV_XIVE2(opaque
);
783 MemoryRegion
*sysmem
= get_system_memory();
784 uint32_t reg
= offset
>> 3;
789 case CQ_RST_CTL
: /* TODO: reset all BARs */
793 xive
->ic_shift
= val
& CQ_IC_BAR_64K
? 16 : 12;
794 if (!(val
& CQ_IC_BAR_VALID
)) {
796 if (xive
->cq_regs
[reg
] & CQ_IC_BAR_VALID
) {
797 for (i
= 0; i
< ARRAY_SIZE(xive
->ic_mmios
); i
++) {
798 memory_region_del_subregion(&xive
->ic_mmio
,
801 memory_region_del_subregion(sysmem
, &xive
->ic_mmio
);
804 xive
->ic_base
= val
& ~(CQ_IC_BAR_VALID
| CQ_IC_BAR_64K
);
805 if (!(xive
->cq_regs
[reg
] & CQ_IC_BAR_VALID
)) {
806 for (i
= 0; i
< ARRAY_SIZE(xive
->ic_mmios
); i
++) {
807 memory_region_add_subregion(&xive
->ic_mmio
,
808 pnv_xive2_ic_regions
[i
].pgoff
<< xive
->ic_shift
,
811 memory_region_add_subregion(sysmem
, xive
->ic_base
,
818 xive
->tm_shift
= val
& CQ_TM_BAR_64K
? 16 : 12;
819 if (!(val
& CQ_TM_BAR_VALID
)) {
821 if (xive
->cq_regs
[reg
] & CQ_TM_BAR_VALID
) {
822 memory_region_del_subregion(sysmem
, &xive
->tm_mmio
);
825 xive
->tm_base
= val
& ~(CQ_TM_BAR_VALID
| CQ_TM_BAR_64K
);
826 if (!(xive
->cq_regs
[reg
] & CQ_TM_BAR_VALID
)) {
827 memory_region_add_subregion(sysmem
, xive
->tm_base
,
834 xive
->esb_shift
= val
& CQ_BAR_64K
? 16 : 12;
835 if (!(val
& CQ_BAR_VALID
)) {
837 if (xive
->cq_regs
[reg
] & CQ_BAR_VALID
) {
838 memory_region_del_subregion(sysmem
, &xive
->esb_mmio
);
841 xive
->esb_base
= val
& CQ_BAR_ADDR
;
842 if (!(xive
->cq_regs
[reg
] & CQ_BAR_VALID
)) {
843 memory_region_set_size(&xive
->esb_mmio
,
844 pnv_xive2_bar_size(val
));
845 memory_region_add_subregion(sysmem
, xive
->esb_base
,
852 xive
->end_shift
= val
& CQ_BAR_64K
? 16 : 12;
853 if (!(val
& CQ_BAR_VALID
)) {
855 if (xive
->cq_regs
[reg
] & CQ_BAR_VALID
) {
856 memory_region_del_subregion(sysmem
, &xive
->end_mmio
);
859 xive
->end_base
= val
& CQ_BAR_ADDR
;
860 if (!(xive
->cq_regs
[reg
] & CQ_BAR_VALID
)) {
861 memory_region_set_size(&xive
->end_mmio
,
862 pnv_xive2_bar_size(val
));
863 memory_region_add_subregion(sysmem
, xive
->end_base
,
870 xive
->nvc_shift
= val
& CQ_BAR_64K
? 16 : 12;
871 if (!(val
& CQ_BAR_VALID
)) {
873 if (xive
->cq_regs
[reg
] & CQ_BAR_VALID
) {
874 memory_region_del_subregion(sysmem
, &xive
->nvc_mmio
);
877 xive
->nvc_base
= val
& CQ_BAR_ADDR
;
878 if (!(xive
->cq_regs
[reg
] & CQ_BAR_VALID
)) {
879 memory_region_set_size(&xive
->nvc_mmio
,
880 pnv_xive2_bar_size(val
));
881 memory_region_add_subregion(sysmem
, xive
->nvc_base
,
888 xive
->nvpg_shift
= val
& CQ_BAR_64K
? 16 : 12;
889 if (!(val
& CQ_BAR_VALID
)) {
891 if (xive
->cq_regs
[reg
] & CQ_BAR_VALID
) {
892 memory_region_del_subregion(sysmem
, &xive
->nvpg_mmio
);
895 xive
->nvpg_base
= val
& CQ_BAR_ADDR
;
896 if (!(xive
->cq_regs
[reg
] & CQ_BAR_VALID
)) {
897 memory_region_set_size(&xive
->nvpg_mmio
,
898 pnv_xive2_bar_size(val
));
899 memory_region_add_subregion(sysmem
, xive
->nvpg_base
,
905 case CQ_TAR
: /* Set Translation Table Address */
907 case CQ_TDR
: /* Set Translation Table Data */
908 pnv_xive2_stt_set_data(xive
, val
);
910 case CQ_FIRMASK_OR
: /* FIR error reporting */
913 xive2_error(xive
, "CQ: invalid write 0x%"HWADDR_PRIx
, offset
);
917 xive
->cq_regs
[reg
] = val
;
920 static const MemoryRegionOps pnv_xive2_ic_cq_ops
= {
921 .read
= pnv_xive2_ic_cq_read
,
922 .write
= pnv_xive2_ic_cq_write
,
923 .endianness
= DEVICE_BIG_ENDIAN
,
925 .min_access_size
= 8,
926 .max_access_size
= 8,
929 .min_access_size
= 8,
930 .max_access_size
= 8,
934 static uint64_t pnv_xive2_ic_vc_read(void *opaque
, hwaddr offset
,
937 PnvXive2
*xive
= PNV_XIVE2(opaque
);
939 uint32_t reg
= offset
>> 3;
943 * VSD table settings.
945 case VC_VSD_TABLE_ADDR
:
946 case VC_VSD_TABLE_DATA
:
947 val
= xive
->vc_regs
[reg
];
951 * ESB cache updates (not modeled)
953 case VC_ESBC_FLUSH_CTRL
:
954 xive
->vc_regs
[reg
] &= ~VC_ESBC_FLUSH_CTRL_POLL_VALID
;
955 val
= xive
->vc_regs
[reg
];
959 * EAS cache updates (not modeled)
961 case VC_EASC_FLUSH_CTRL
:
962 xive
->vc_regs
[reg
] &= ~VC_EASC_FLUSH_CTRL_POLL_VALID
;
963 val
= xive
->vc_regs
[reg
];
969 case VC_ENDC_WATCH0_SPEC
:
970 xive
->vc_regs
[reg
] &= ~(VC_ENDC_WATCH_FULL
| VC_ENDC_WATCH_CONFLICT
);
971 val
= xive
->vc_regs
[reg
];
974 case VC_ENDC_WATCH0_DATA0
:
976 * Load DATA registers from cache with data requested by the
979 pnv_xive2_end_cache_load(xive
);
980 val
= xive
->vc_regs
[reg
];
983 case VC_ENDC_WATCH0_DATA1
... VC_ENDC_WATCH0_DATA3
:
984 val
= xive
->vc_regs
[reg
];
987 case VC_ENDC_FLUSH_CTRL
:
988 xive
->vc_regs
[reg
] &= ~VC_ENDC_FLUSH_CTRL_POLL_VALID
;
989 val
= xive
->vc_regs
[reg
];
993 * Indirect invalidation
995 case VC_AT_MACRO_KILL_MASK
:
996 val
= xive
->vc_regs
[reg
];
999 case VC_AT_MACRO_KILL
:
1000 xive
->vc_regs
[reg
] &= ~VC_AT_MACRO_KILL_VALID
;
1001 val
= xive
->vc_regs
[reg
];
1005 * Interrupt fifo overflow in memory backing store (Not modeled)
1007 case VC_QUEUES_CFG_REM0
... VC_QUEUES_CFG_REM6
:
1008 val
= xive
->vc_regs
[reg
];
1014 case VC_ENDC_SYNC_DONE
:
1015 val
= VC_ENDC_SYNC_POLL_DONE
;
1018 xive2_error(xive
, "VC: invalid read @%"HWADDR_PRIx
, offset
);
1024 static void pnv_xive2_ic_vc_write(void *opaque
, hwaddr offset
,
1025 uint64_t val
, unsigned size
)
1027 PnvXive2
*xive
= PNV_XIVE2(opaque
);
1028 uint32_t reg
= offset
>> 3;
1032 * VSD table settings.
1034 case VC_VSD_TABLE_ADDR
:
1036 case VC_VSD_TABLE_DATA
:
1037 pnv_xive2_vst_set_data(xive
, val
);
1041 * ESB cache updates (not modeled)
1043 /* case VC_ESBC_FLUSH_CTRL: */
1044 case VC_ESBC_FLUSH_POLL
:
1045 xive
->vc_regs
[VC_ESBC_FLUSH_CTRL
>> 3] |= VC_ESBC_FLUSH_CTRL_POLL_VALID
;
1050 * EAS cache updates (not modeled)
1052 /* case VC_EASC_FLUSH_CTRL: */
1053 case VC_EASC_FLUSH_POLL
:
1054 xive
->vc_regs
[VC_EASC_FLUSH_CTRL
>> 3] |= VC_EASC_FLUSH_CTRL_POLL_VALID
;
1061 case VC_ENDC_WATCH0_SPEC
:
1062 val
&= ~VC_ENDC_WATCH_CONFLICT
; /* HW will set this bit */
1065 case VC_ENDC_WATCH0_DATA1
... VC_ENDC_WATCH0_DATA3
:
1067 case VC_ENDC_WATCH0_DATA0
:
1068 /* writing to DATA0 triggers the cache write */
1069 xive
->vc_regs
[reg
] = val
;
1070 pnv_xive2_end_update(xive
);
1074 /* case VC_ENDC_FLUSH_CTRL: */
1075 case VC_ENDC_FLUSH_POLL
:
1076 xive
->vc_regs
[VC_ENDC_FLUSH_CTRL
>> 3] |= VC_ENDC_FLUSH_CTRL_POLL_VALID
;
1080 * Indirect invalidation
1082 case VC_AT_MACRO_KILL
:
1083 case VC_AT_MACRO_KILL_MASK
:
1087 * Interrupt fifo overflow in memory backing store (Not modeled)
1089 case VC_QUEUES_CFG_REM0
... VC_QUEUES_CFG_REM6
:
1095 case VC_ENDC_SYNC_DONE
:
1099 xive2_error(xive
, "VC: invalid write @%"HWADDR_PRIx
, offset
);
1103 xive
->vc_regs
[reg
] = val
;
1106 static const MemoryRegionOps pnv_xive2_ic_vc_ops
= {
1107 .read
= pnv_xive2_ic_vc_read
,
1108 .write
= pnv_xive2_ic_vc_write
,
1109 .endianness
= DEVICE_BIG_ENDIAN
,
1111 .min_access_size
= 8,
1112 .max_access_size
= 8,
1115 .min_access_size
= 8,
1116 .max_access_size
= 8,
1120 static uint64_t pnv_xive2_ic_pc_read(void *opaque
, hwaddr offset
,
1123 PnvXive2
*xive
= PNV_XIVE2(opaque
);
1125 uint32_t reg
= offset
>> 3;
1129 * VSD table settings.
1131 case PC_VSD_TABLE_ADDR
:
1132 case PC_VSD_TABLE_DATA
:
1133 val
= xive
->pc_regs
[reg
];
1139 case PC_NXC_WATCH0_SPEC
:
1140 xive
->pc_regs
[reg
] &= ~(PC_NXC_WATCH_FULL
| PC_NXC_WATCH_CONFLICT
);
1141 val
= xive
->pc_regs
[reg
];
1144 case PC_NXC_WATCH0_DATA0
:
1146 * Load DATA registers from cache with data requested by the
1149 pnv_xive2_nvp_cache_load(xive
);
1150 val
= xive
->pc_regs
[reg
];
1153 case PC_NXC_WATCH0_DATA1
... PC_NXC_WATCH0_DATA3
:
1154 val
= xive
->pc_regs
[reg
];
1157 case PC_NXC_FLUSH_CTRL
:
1158 xive
->pc_regs
[reg
] &= ~PC_NXC_FLUSH_CTRL_POLL_VALID
;
1159 val
= xive
->pc_regs
[reg
];
1163 * Indirect invalidation
1166 xive
->pc_regs
[reg
] &= ~PC_AT_KILL_VALID
;
1167 val
= xive
->pc_regs
[reg
];
1171 xive2_error(xive
, "PC: invalid read @%"HWADDR_PRIx
, offset
);
1177 static void pnv_xive2_ic_pc_write(void *opaque
, hwaddr offset
,
1178 uint64_t val
, unsigned size
)
1180 PnvXive2
*xive
= PNV_XIVE2(opaque
);
1181 uint32_t reg
= offset
>> 3;
1186 * VSD table settings. Only taken into account in the VC
1187 * sub-engine because the Xive2Router model combines both VC and PC
1190 case PC_VSD_TABLE_ADDR
:
1191 case PC_VSD_TABLE_DATA
:
1197 case PC_NXC_WATCH0_SPEC
:
1198 val
&= ~PC_NXC_WATCH_CONFLICT
; /* HW will set this bit */
1201 case PC_NXC_WATCH0_DATA1
... PC_NXC_WATCH0_DATA3
:
1203 case PC_NXC_WATCH0_DATA0
:
1204 /* writing to DATA0 triggers the cache write */
1205 xive
->pc_regs
[reg
] = val
;
1206 pnv_xive2_nvp_update(xive
);
1209 /* case PC_NXC_FLUSH_CTRL: */
1210 case PC_NXC_FLUSH_POLL
:
1211 xive
->pc_regs
[PC_NXC_FLUSH_CTRL
>> 3] |= PC_NXC_FLUSH_CTRL_POLL_VALID
;
1215 * Indirect invalidation
1218 case PC_AT_KILL_MASK
:
1222 xive2_error(xive
, "PC: invalid write @%"HWADDR_PRIx
, offset
);
1226 xive
->pc_regs
[reg
] = val
;
1229 static const MemoryRegionOps pnv_xive2_ic_pc_ops
= {
1230 .read
= pnv_xive2_ic_pc_read
,
1231 .write
= pnv_xive2_ic_pc_write
,
1232 .endianness
= DEVICE_BIG_ENDIAN
,
1234 .min_access_size
= 8,
1235 .max_access_size
= 8,
1238 .min_access_size
= 8,
1239 .max_access_size
= 8,
1244 static uint64_t pnv_xive2_ic_tctxt_read(void *opaque
, hwaddr offset
,
1247 PnvXive2
*xive
= PNV_XIVE2(opaque
);
1249 uint32_t reg
= offset
>> 3;
1253 * XIVE2 hardware thread enablement
1257 val
= xive
->tctxt_regs
[reg
];
1261 case TCTXT_EN0_RESET
:
1262 val
= xive
->tctxt_regs
[TCTXT_EN0
>> 3];
1265 case TCTXT_EN1_RESET
:
1266 val
= xive
->tctxt_regs
[TCTXT_EN1
>> 3];
1269 xive2_error(xive
, "TCTXT: invalid read @%"HWADDR_PRIx
, offset
);
1275 static void pnv_xive2_ic_tctxt_write(void *opaque
, hwaddr offset
,
1276 uint64_t val
, unsigned size
)
1278 PnvXive2
*xive
= PNV_XIVE2(opaque
);
1282 * XIVE2 hardware thread enablement
1284 case TCTXT_EN0
: /* Physical Thread Enable */
1285 case TCTXT_EN1
: /* Physical Thread Enable (fused core) */
1289 xive
->tctxt_regs
[TCTXT_EN0
>> 3] |= val
;
1292 xive
->tctxt_regs
[TCTXT_EN1
>> 3] |= val
;
1294 case TCTXT_EN0_RESET
:
1295 xive
->tctxt_regs
[TCTXT_EN0
>> 3] &= ~val
;
1297 case TCTXT_EN1_RESET
:
1298 xive
->tctxt_regs
[TCTXT_EN1
>> 3] &= ~val
;
1302 xive2_error(xive
, "TCTXT: invalid write @%"HWADDR_PRIx
, offset
);
1307 static const MemoryRegionOps pnv_xive2_ic_tctxt_ops
= {
1308 .read
= pnv_xive2_ic_tctxt_read
,
1309 .write
= pnv_xive2_ic_tctxt_write
,
1310 .endianness
= DEVICE_BIG_ENDIAN
,
1312 .min_access_size
= 8,
1313 .max_access_size
= 8,
1316 .min_access_size
= 8,
1317 .max_access_size
= 8,
1322 * Redirect XSCOM to MMIO handlers
1324 static uint64_t pnv_xive2_xscom_read(void *opaque
, hwaddr offset
,
1327 PnvXive2
*xive
= PNV_XIVE2(opaque
);
1329 uint32_t xscom_reg
= offset
>> 3;
1330 uint32_t mmio_offset
= (xscom_reg
& 0xFF) << 3;
1332 switch (xscom_reg
) {
1333 case 0x000 ... 0x0FF:
1334 val
= pnv_xive2_ic_cq_read(opaque
, mmio_offset
, size
);
1336 case 0x100 ... 0x1FF:
1337 val
= pnv_xive2_ic_vc_read(opaque
, mmio_offset
, size
);
1339 case 0x200 ... 0x2FF:
1340 val
= pnv_xive2_ic_pc_read(opaque
, mmio_offset
, size
);
1342 case 0x300 ... 0x3FF:
1343 val
= pnv_xive2_ic_tctxt_read(opaque
, mmio_offset
, size
);
1346 xive2_error(xive
, "XSCOM: invalid read @%"HWADDR_PRIx
, offset
);
1352 static void pnv_xive2_xscom_write(void *opaque
, hwaddr offset
,
1353 uint64_t val
, unsigned size
)
1355 PnvXive2
*xive
= PNV_XIVE2(opaque
);
1356 uint32_t xscom_reg
= offset
>> 3;
1357 uint32_t mmio_offset
= (xscom_reg
& 0xFF) << 3;
1359 switch (xscom_reg
) {
1360 case 0x000 ... 0x0FF:
1361 pnv_xive2_ic_cq_write(opaque
, mmio_offset
, val
, size
);
1363 case 0x100 ... 0x1FF:
1364 pnv_xive2_ic_vc_write(opaque
, mmio_offset
, val
, size
);
1366 case 0x200 ... 0x2FF:
1367 pnv_xive2_ic_pc_write(opaque
, mmio_offset
, val
, size
);
1369 case 0x300 ... 0x3FF:
1370 pnv_xive2_ic_tctxt_write(opaque
, mmio_offset
, val
, size
);
1373 xive2_error(xive
, "XSCOM: invalid write @%"HWADDR_PRIx
, offset
);
1377 static const MemoryRegionOps pnv_xive2_xscom_ops
= {
1378 .read
= pnv_xive2_xscom_read
,
1379 .write
= pnv_xive2_xscom_write
,
1380 .endianness
= DEVICE_BIG_ENDIAN
,
1382 .min_access_size
= 8,
1383 .max_access_size
= 8,
1386 .min_access_size
= 8,
1387 .max_access_size
= 8,
1392 * Notify port page. The layout is compatible between 4K and 64K pages :
1394 * Page 1 Notify page (writes only)
1395 * 0x000 - 0x7FF IPI interrupt (NPU)
1396 * 0x800 - 0xFFF HW interrupt triggers (PSI, PHB)
1399 static void pnv_xive2_ic_hw_trigger(PnvXive2
*xive
, hwaddr addr
,
1405 if (val
& XIVE_TRIGGER_END
) {
1406 xive2_error(xive
, "IC: END trigger at @0x%"HWADDR_PRIx
" data 0x%"PRIx64
,
1412 * Forward the source event notification directly to the Router.
1413 * The source interrupt number should already be correctly encoded
1414 * with the chip block id by the sending device (PHB, PSI).
1416 blk
= XIVE_EAS_BLOCK(val
);
1417 idx
= XIVE_EAS_INDEX(val
);
1419 xive2_router_notify(XIVE_NOTIFIER(xive
), XIVE_EAS(blk
, idx
),
1420 !!(val
& XIVE_TRIGGER_PQ
));
1423 static void pnv_xive2_ic_notify_write(void *opaque
, hwaddr offset
,
1424 uint64_t val
, unsigned size
)
1426 PnvXive2
*xive
= PNV_XIVE2(opaque
);
1428 /* VC: IPI triggers */
1430 case 0x000 ... 0x7FF:
1431 /* TODO: check IPI notify sub-page routing */
1432 pnv_xive2_ic_hw_trigger(opaque
, offset
, val
);
1435 /* VC: HW triggers */
1436 case 0x800 ... 0xFFF:
1437 pnv_xive2_ic_hw_trigger(opaque
, offset
, val
);
1441 xive2_error(xive
, "NOTIFY: invalid write @%"HWADDR_PRIx
, offset
);
1445 static uint64_t pnv_xive2_ic_notify_read(void *opaque
, hwaddr offset
,
1448 PnvXive2
*xive
= PNV_XIVE2(opaque
);
1450 /* loads are invalid */
1451 xive2_error(xive
, "NOTIFY: invalid read @%"HWADDR_PRIx
, offset
);
1455 static const MemoryRegionOps pnv_xive2_ic_notify_ops
= {
1456 .read
= pnv_xive2_ic_notify_read
,
1457 .write
= pnv_xive2_ic_notify_write
,
1458 .endianness
= DEVICE_BIG_ENDIAN
,
1460 .min_access_size
= 8,
1461 .max_access_size
= 8,
1464 .min_access_size
= 8,
1465 .max_access_size
= 8,
1469 static uint64_t pnv_xive2_ic_lsi_read(void *opaque
, hwaddr offset
,
1472 PnvXive2
*xive
= PNV_XIVE2(opaque
);
1474 xive2_error(xive
, "LSI: invalid read @%"HWADDR_PRIx
, offset
);
1478 static void pnv_xive2_ic_lsi_write(void *opaque
, hwaddr offset
,
1479 uint64_t val
, unsigned size
)
1481 PnvXive2
*xive
= PNV_XIVE2(opaque
);
1483 xive2_error(xive
, "LSI: invalid write @%"HWADDR_PRIx
, offset
);
1486 static const MemoryRegionOps pnv_xive2_ic_lsi_ops
= {
1487 .read
= pnv_xive2_ic_lsi_read
,
1488 .write
= pnv_xive2_ic_lsi_write
,
1489 .endianness
= DEVICE_BIG_ENDIAN
,
1491 .min_access_size
= 8,
1492 .max_access_size
= 8,
1495 .min_access_size
= 8,
1496 .max_access_size
= 8,
1501 * Sync MMIO page (write only)
1503 #define PNV_XIVE2_SYNC_IPI 0x000
1504 #define PNV_XIVE2_SYNC_HW 0x080
1505 #define PNV_XIVE2_SYNC_NxC 0x100
1506 #define PNV_XIVE2_SYNC_INT 0x180
1507 #define PNV_XIVE2_SYNC_OS_ESC 0x200
1508 #define PNV_XIVE2_SYNC_POOL_ESC 0x280
1509 #define PNV_XIVE2_SYNC_HARD_ESC 0x300
1511 static uint64_t pnv_xive2_ic_sync_read(void *opaque
, hwaddr offset
,
1514 PnvXive2
*xive
= PNV_XIVE2(opaque
);
1516 /* loads are invalid */
1517 xive2_error(xive
, "SYNC: invalid read @%"HWADDR_PRIx
, offset
);
1521 static void pnv_xive2_ic_sync_write(void *opaque
, hwaddr offset
,
1522 uint64_t val
, unsigned size
)
1524 PnvXive2
*xive
= PNV_XIVE2(opaque
);
1527 case PNV_XIVE2_SYNC_IPI
:
1528 case PNV_XIVE2_SYNC_HW
:
1529 case PNV_XIVE2_SYNC_NxC
:
1530 case PNV_XIVE2_SYNC_INT
:
1531 case PNV_XIVE2_SYNC_OS_ESC
:
1532 case PNV_XIVE2_SYNC_POOL_ESC
:
1533 case PNV_XIVE2_SYNC_HARD_ESC
:
1536 xive2_error(xive
, "SYNC: invalid write @%"HWADDR_PRIx
, offset
);
1540 static const MemoryRegionOps pnv_xive2_ic_sync_ops
= {
1541 .read
= pnv_xive2_ic_sync_read
,
1542 .write
= pnv_xive2_ic_sync_write
,
1543 .endianness
= DEVICE_BIG_ENDIAN
,
1545 .min_access_size
= 8,
1546 .max_access_size
= 8,
1549 .min_access_size
= 8,
1550 .max_access_size
= 8,
1555 * When the TM direct pages of the IC controller are accessed, the
1556 * target HW thread is deduced from the page offset.
1558 static uint32_t pnv_xive2_ic_tm_get_pir(PnvXive2
*xive
, hwaddr offset
)
1560 /* On P10, the node ID shift in the PIR register is 8 bits */
1561 return xive
->chip
->chip_id
<< 8 | offset
>> xive
->ic_shift
;
1564 static XiveTCTX
*pnv_xive2_get_indirect_tctx(PnvXive2
*xive
, uint32_t pir
)
1566 PnvChip
*chip
= xive
->chip
;
1567 PowerPCCPU
*cpu
= NULL
;
1569 cpu
= pnv_chip_find_cpu(chip
, pir
);
1571 xive2_error(xive
, "IC: invalid PIR %x for indirect access", pir
);
1575 if (!pnv_xive2_is_cpu_enabled(xive
, cpu
)) {
1576 xive2_error(xive
, "IC: CPU %x is not enabled", pir
);
1579 return XIVE_TCTX(pnv_cpu_state(cpu
)->intc
);
1582 static uint64_t pnv_xive2_ic_tm_indirect_read(void *opaque
, hwaddr offset
,
1585 PnvXive2
*xive
= PNV_XIVE2(opaque
);
1590 pir
= pnv_xive2_ic_tm_get_pir(xive
, offset
);
1591 tctx
= pnv_xive2_get_indirect_tctx(xive
, pir
);
1593 val
= xive_tctx_tm_read(NULL
, tctx
, offset
, size
);
1599 static void pnv_xive2_ic_tm_indirect_write(void *opaque
, hwaddr offset
,
1600 uint64_t val
, unsigned size
)
1602 PnvXive2
*xive
= PNV_XIVE2(opaque
);
1606 pir
= pnv_xive2_ic_tm_get_pir(xive
, offset
);
1607 tctx
= pnv_xive2_get_indirect_tctx(xive
, pir
);
1609 xive_tctx_tm_write(NULL
, tctx
, offset
, val
, size
);
1613 static const MemoryRegionOps pnv_xive2_ic_tm_indirect_ops
= {
1614 .read
= pnv_xive2_ic_tm_indirect_read
,
1615 .write
= pnv_xive2_ic_tm_indirect_write
,
1616 .endianness
= DEVICE_BIG_ENDIAN
,
1618 .min_access_size
= 8,
1619 .max_access_size
= 8,
1622 .min_access_size
= 8,
1623 .max_access_size
= 8,
1632 * Special TIMA offsets to handle accesses in a POWER10 way.
1634 * Only the CAM line updates done by the hypervisor should be handled
1637 #define HV_PAGE_OFFSET (XIVE_TM_HV_PAGE << TM_SHIFT)
1638 #define HV_PUSH_OS_CTX_OFFSET (HV_PAGE_OFFSET | (TM_QW1_OS + TM_WORD2))
1639 #define HV_PULL_OS_CTX_OFFSET (HV_PAGE_OFFSET | TM_SPC_PULL_OS_CTX)
1641 static void pnv_xive2_tm_write(void *opaque
, hwaddr offset
,
1642 uint64_t value
, unsigned size
)
1644 PowerPCCPU
*cpu
= POWERPC_CPU(current_cpu
);
1645 PnvXive2
*xive
= pnv_xive2_tm_get_xive(cpu
);
1646 XiveTCTX
*tctx
= XIVE_TCTX(pnv_cpu_state(cpu
)->intc
);
1647 XivePresenter
*xptr
= XIVE_PRESENTER(xive
);
1649 xive
->cq_regs
[CQ_XIVE_CFG
>> 3] & CQ_XIVE_CFG_GEN1_TIMA_OS
;
1651 /* TODO: should we switch the TM ops table instead ? */
1652 if (!gen1_tima_os
&& offset
== HV_PUSH_OS_CTX_OFFSET
) {
1653 xive2_tm_push_os_ctx(xptr
, tctx
, offset
, value
, size
);
1657 /* Other TM ops are the same as XIVE1 */
1658 xive_tctx_tm_write(xptr
, tctx
, offset
, value
, size
);
1661 static uint64_t pnv_xive2_tm_read(void *opaque
, hwaddr offset
, unsigned size
)
1663 PowerPCCPU
*cpu
= POWERPC_CPU(current_cpu
);
1664 PnvXive2
*xive
= pnv_xive2_tm_get_xive(cpu
);
1665 XiveTCTX
*tctx
= XIVE_TCTX(pnv_cpu_state(cpu
)->intc
);
1666 XivePresenter
*xptr
= XIVE_PRESENTER(xive
);
1668 xive
->cq_regs
[CQ_XIVE_CFG
>> 3] & CQ_XIVE_CFG_GEN1_TIMA_OS
;
1670 /* TODO: should we switch the TM ops table instead ? */
1671 if (!gen1_tima_os
&& offset
== HV_PULL_OS_CTX_OFFSET
) {
1672 return xive2_tm_pull_os_ctx(xptr
, tctx
, offset
, size
);
1675 /* Other TM ops are the same as XIVE1 */
1676 return xive_tctx_tm_read(xptr
, tctx
, offset
, size
);
1679 static const MemoryRegionOps pnv_xive2_tm_ops
= {
1680 .read
= pnv_xive2_tm_read
,
1681 .write
= pnv_xive2_tm_write
,
1682 .endianness
= DEVICE_BIG_ENDIAN
,
1684 .min_access_size
= 1,
1685 .max_access_size
= 8,
1688 .min_access_size
= 1,
1689 .max_access_size
= 8,
1693 static uint64_t pnv_xive2_nvc_read(void *opaque
, hwaddr offset
,
1696 PnvXive2
*xive
= PNV_XIVE2(opaque
);
1698 xive2_error(xive
, "NVC: invalid read @%"HWADDR_PRIx
, offset
);
1702 static void pnv_xive2_nvc_write(void *opaque
, hwaddr offset
,
1703 uint64_t val
, unsigned size
)
1705 PnvXive2
*xive
= PNV_XIVE2(opaque
);
1707 xive2_error(xive
, "NVC: invalid write @%"HWADDR_PRIx
, offset
);
1710 static const MemoryRegionOps pnv_xive2_nvc_ops
= {
1711 .read
= pnv_xive2_nvc_read
,
1712 .write
= pnv_xive2_nvc_write
,
1713 .endianness
= DEVICE_BIG_ENDIAN
,
1715 .min_access_size
= 8,
1716 .max_access_size
= 8,
1719 .min_access_size
= 8,
1720 .max_access_size
= 8,
1724 static uint64_t pnv_xive2_nvpg_read(void *opaque
, hwaddr offset
,
1727 PnvXive2
*xive
= PNV_XIVE2(opaque
);
1729 xive2_error(xive
, "NVPG: invalid read @%"HWADDR_PRIx
, offset
);
1733 static void pnv_xive2_nvpg_write(void *opaque
, hwaddr offset
,
1734 uint64_t val
, unsigned size
)
1736 PnvXive2
*xive
= PNV_XIVE2(opaque
);
1738 xive2_error(xive
, "NVPG: invalid write @%"HWADDR_PRIx
, offset
);
1741 static const MemoryRegionOps pnv_xive2_nvpg_ops
= {
1742 .read
= pnv_xive2_nvpg_read
,
1743 .write
= pnv_xive2_nvpg_write
,
1744 .endianness
= DEVICE_BIG_ENDIAN
,
1746 .min_access_size
= 8,
1747 .max_access_size
= 8,
1750 .min_access_size
= 8,
1751 .max_access_size
= 8,
1756 * POWER10 default capabilities: 0x2000120076f000FC
1758 #define PNV_XIVE2_CAPABILITIES 0x2000120076f000FC
1761 * POWER10 default configuration: 0x0030000033000000
1763 * 8bits thread id was dropped for P10
1765 #define PNV_XIVE2_CONFIGURATION 0x0030000033000000
1767 static void pnv_xive2_reset(void *dev
)
1769 PnvXive2
*xive
= PNV_XIVE2(dev
);
1770 XiveSource
*xsrc
= &xive
->ipi_source
;
1771 Xive2EndSource
*end_xsrc
= &xive
->end_source
;
1773 xive
->cq_regs
[CQ_XIVE_CAP
>> 3] = xive
->capabilities
;
1774 xive
->cq_regs
[CQ_XIVE_CFG
>> 3] = xive
->config
;
1776 /* HW hardwires the #Topology of the chip in the block field */
1777 xive
->cq_regs
[CQ_XIVE_CFG
>> 3] |=
1778 SETFIELD(CQ_XIVE_CFG_HYP_HARD_BLOCK_ID
, 0ull, xive
->chip
->chip_id
);
1780 /* Set default page size to 64k */
1781 xive
->ic_shift
= xive
->esb_shift
= xive
->end_shift
= 16;
1782 xive
->nvc_shift
= xive
->nvpg_shift
= xive
->tm_shift
= 16;
1784 /* Clear source MMIOs */
1785 if (memory_region_is_mapped(&xsrc
->esb_mmio
)) {
1786 memory_region_del_subregion(&xive
->esb_mmio
, &xsrc
->esb_mmio
);
1789 if (memory_region_is_mapped(&end_xsrc
->esb_mmio
)) {
1790 memory_region_del_subregion(&xive
->end_mmio
, &end_xsrc
->esb_mmio
);
1795 * Maximum number of IRQs and ENDs supported by HW. Will be tuned by
1798 #define PNV_XIVE2_NR_IRQS (PNV10_XIVE2_ESB_SIZE / (1ull << XIVE_ESB_64K_2PAGE))
1799 #define PNV_XIVE2_NR_ENDS (PNV10_XIVE2_END_SIZE / (1ull << XIVE_ESB_64K_2PAGE))
1801 static void pnv_xive2_realize(DeviceState
*dev
, Error
**errp
)
1803 PnvXive2
*xive
= PNV_XIVE2(dev
);
1804 PnvXive2Class
*pxc
= PNV_XIVE2_GET_CLASS(dev
);
1805 XiveSource
*xsrc
= &xive
->ipi_source
;
1806 Xive2EndSource
*end_xsrc
= &xive
->end_source
;
1807 Error
*local_err
= NULL
;
1810 pxc
->parent_realize(dev
, &local_err
);
1812 error_propagate(errp
, local_err
);
1819 * The XiveSource and Xive2EndSource objects are realized with the
1820 * maximum allowed HW configuration. The ESB MMIO regions will be
1821 * resized dynamically when the controller is configured by the FW
1822 * to limit accesses to resources not provisioned.
1824 object_property_set_int(OBJECT(xsrc
), "flags", XIVE_SRC_STORE_EOI
,
1826 object_property_set_int(OBJECT(xsrc
), "nr-irqs", PNV_XIVE2_NR_IRQS
,
1828 object_property_set_link(OBJECT(xsrc
), "xive", OBJECT(xive
),
1830 qdev_realize(DEVICE(xsrc
), NULL
, &local_err
);
1832 error_propagate(errp
, local_err
);
1836 object_property_set_int(OBJECT(end_xsrc
), "nr-ends", PNV_XIVE2_NR_ENDS
,
1838 object_property_set_link(OBJECT(end_xsrc
), "xive", OBJECT(xive
),
1840 qdev_realize(DEVICE(end_xsrc
), NULL
, &local_err
);
1842 error_propagate(errp
, local_err
);
1846 /* XSCOM region, used for initial configuration of the BARs */
1847 memory_region_init_io(&xive
->xscom_regs
, OBJECT(dev
),
1848 &pnv_xive2_xscom_ops
, xive
, "xscom-xive",
1849 PNV10_XSCOM_XIVE2_SIZE
<< 3);
1851 /* Interrupt controller MMIO regions */
1852 xive
->ic_shift
= 16;
1853 memory_region_init(&xive
->ic_mmio
, OBJECT(dev
), "xive-ic",
1854 PNV10_XIVE2_IC_SIZE
);
1856 for (i
= 0; i
< ARRAY_SIZE(xive
->ic_mmios
); i
++) {
1857 memory_region_init_io(&xive
->ic_mmios
[i
], OBJECT(dev
),
1858 pnv_xive2_ic_regions
[i
].ops
, xive
,
1859 pnv_xive2_ic_regions
[i
].name
,
1860 pnv_xive2_ic_regions
[i
].pgsize
<< xive
->ic_shift
);
1866 xive
->esb_shift
= 16;
1867 xive
->end_shift
= 16;
1868 memory_region_init(&xive
->esb_mmio
, OBJECT(xive
), "xive-esb",
1869 PNV10_XIVE2_ESB_SIZE
);
1870 memory_region_init(&xive
->end_mmio
, OBJECT(xive
), "xive-end",
1871 PNV10_XIVE2_END_SIZE
);
1873 /* Presenter Controller MMIO region (not modeled) */
1874 xive
->nvc_shift
= 16;
1875 xive
->nvpg_shift
= 16;
1876 memory_region_init_io(&xive
->nvc_mmio
, OBJECT(dev
),
1877 &pnv_xive2_nvc_ops
, xive
,
1878 "xive-nvc", PNV10_XIVE2_NVC_SIZE
);
1880 memory_region_init_io(&xive
->nvpg_mmio
, OBJECT(dev
),
1881 &pnv_xive2_nvpg_ops
, xive
,
1882 "xive-nvpg", PNV10_XIVE2_NVPG_SIZE
);
1884 /* Thread Interrupt Management Area (Direct) */
1885 xive
->tm_shift
= 16;
1886 memory_region_init_io(&xive
->tm_mmio
, OBJECT(dev
), &pnv_xive2_tm_ops
,
1887 xive
, "xive-tima", PNV10_XIVE2_TM_SIZE
);
1889 qemu_register_reset(pnv_xive2_reset
, dev
);
1892 static Property pnv_xive2_properties
[] = {
1893 DEFINE_PROP_UINT64("ic-bar", PnvXive2
, ic_base
, 0),
1894 DEFINE_PROP_UINT64("esb-bar", PnvXive2
, esb_base
, 0),
1895 DEFINE_PROP_UINT64("end-bar", PnvXive2
, end_base
, 0),
1896 DEFINE_PROP_UINT64("nvc-bar", PnvXive2
, nvc_base
, 0),
1897 DEFINE_PROP_UINT64("nvpg-bar", PnvXive2
, nvpg_base
, 0),
1898 DEFINE_PROP_UINT64("tm-bar", PnvXive2
, tm_base
, 0),
1899 DEFINE_PROP_UINT64("capabilities", PnvXive2
, capabilities
,
1900 PNV_XIVE2_CAPABILITIES
),
1901 DEFINE_PROP_UINT64("config", PnvXive2
, config
,
1902 PNV_XIVE2_CONFIGURATION
),
1903 DEFINE_PROP_LINK("chip", PnvXive2
, chip
, TYPE_PNV_CHIP
, PnvChip
*),
1904 DEFINE_PROP_END_OF_LIST(),
1907 static void pnv_xive2_instance_init(Object
*obj
)
1909 PnvXive2
*xive
= PNV_XIVE2(obj
);
1911 object_initialize_child(obj
, "ipi_source", &xive
->ipi_source
,
1913 object_initialize_child(obj
, "end_source", &xive
->end_source
,
1914 TYPE_XIVE2_END_SOURCE
);
1917 static int pnv_xive2_dt_xscom(PnvXScomInterface
*dev
, void *fdt
,
1920 const char compat_p10
[] = "ibm,power10-xive-x";
1924 cpu_to_be32(PNV10_XSCOM_XIVE2_BASE
),
1925 cpu_to_be32(PNV10_XSCOM_XIVE2_SIZE
)
1928 name
= g_strdup_printf("xive@%x", PNV10_XSCOM_XIVE2_BASE
);
1929 offset
= fdt_add_subnode(fdt
, xscom_offset
, name
);
1933 _FDT((fdt_setprop(fdt
, offset
, "reg", reg
, sizeof(reg
))));
1934 _FDT(fdt_setprop(fdt
, offset
, "compatible", compat_p10
,
1935 sizeof(compat_p10
)));
1939 static void pnv_xive2_class_init(ObjectClass
*klass
, void *data
)
1941 DeviceClass
*dc
= DEVICE_CLASS(klass
);
1942 PnvXScomInterfaceClass
*xdc
= PNV_XSCOM_INTERFACE_CLASS(klass
);
1943 Xive2RouterClass
*xrc
= XIVE2_ROUTER_CLASS(klass
);
1944 XiveNotifierClass
*xnc
= XIVE_NOTIFIER_CLASS(klass
);
1945 XivePresenterClass
*xpc
= XIVE_PRESENTER_CLASS(klass
);
1946 PnvXive2Class
*pxc
= PNV_XIVE2_CLASS(klass
);
1948 xdc
->dt_xscom
= pnv_xive2_dt_xscom
;
1950 dc
->desc
= "PowerNV XIVE2 Interrupt Controller (POWER10)";
1951 device_class_set_parent_realize(dc
, pnv_xive2_realize
,
1952 &pxc
->parent_realize
);
1953 device_class_set_props(dc
, pnv_xive2_properties
);
1955 xrc
->get_eas
= pnv_xive2_get_eas
;
1956 xrc
->get_pq
= pnv_xive2_get_pq
;
1957 xrc
->set_pq
= pnv_xive2_set_pq
;
1958 xrc
->get_end
= pnv_xive2_get_end
;
1959 xrc
->write_end
= pnv_xive2_write_end
;
1960 xrc
->get_nvp
= pnv_xive2_get_nvp
;
1961 xrc
->write_nvp
= pnv_xive2_write_nvp
;
1962 xrc
->get_config
= pnv_xive2_get_config
;
1963 xrc
->get_block_id
= pnv_xive2_get_block_id
;
1965 xnc
->notify
= pnv_xive2_notify
;
1967 xpc
->match_nvt
= pnv_xive2_match_nvt
;
1970 static const TypeInfo pnv_xive2_info
= {
1971 .name
= TYPE_PNV_XIVE2
,
1972 .parent
= TYPE_XIVE2_ROUTER
,
1973 .instance_init
= pnv_xive2_instance_init
,
1974 .instance_size
= sizeof(PnvXive2
),
1975 .class_init
= pnv_xive2_class_init
,
1976 .class_size
= sizeof(PnvXive2Class
),
1977 .interfaces
= (InterfaceInfo
[]) {
1978 { TYPE_PNV_XSCOM_INTERFACE
},
1983 static void pnv_xive2_register_types(void)
1985 type_register_static(&pnv_xive2_info
);
1988 type_init(pnv_xive2_register_types
)
1990 static void xive2_nvp_pic_print_info(Xive2Nvp
*nvp
, uint32_t nvp_idx
,
1993 uint8_t eq_blk
= xive_get_field32(NVP2_W5_VP_END_BLOCK
, nvp
->w5
);
1994 uint32_t eq_idx
= xive_get_field32(NVP2_W5_VP_END_INDEX
, nvp
->w5
);
1996 if (!xive2_nvp_is_valid(nvp
)) {
2000 monitor_printf(mon
, " %08x end:%02x/%04x IPB:%02x",
2001 nvp_idx
, eq_blk
, eq_idx
,
2002 xive_get_field32(NVP2_W2_IPB
, nvp
->w2
));
2004 * When the NVP is HW controlled, more fields are updated
2006 if (xive2_nvp_is_hw(nvp
)) {
2007 monitor_printf(mon
, " CPPR:%02x",
2008 xive_get_field32(NVP2_W2_CPPR
, nvp
->w2
));
2009 if (xive2_nvp_is_co(nvp
)) {
2010 monitor_printf(mon
, " CO:%04x",
2011 xive_get_field32(NVP2_W1_CO_THRID
, nvp
->w1
));
2014 monitor_printf(mon
, "\n");
2018 * If the table is direct, we can compute the number of PQ entries
2019 * provisioned by FW.
2021 static uint32_t pnv_xive2_nr_esbs(PnvXive2
*xive
)
2023 uint8_t blk
= pnv_xive2_block_id(xive
);
2024 uint64_t vsd
= xive
->vsds
[VST_ESB
][blk
];
2025 uint64_t vst_tsize
= 1ull << (GETFIELD(VSD_TSIZE
, vsd
) + 12);
2027 return VSD_INDIRECT
& vsd
? 0 : vst_tsize
* SBE_PER_BYTE
;
2031 * Compute the number of entries per indirect subpage.
2033 static uint64_t pnv_xive2_vst_per_subpage(PnvXive2
*xive
, uint32_t type
)
2035 uint8_t blk
= pnv_xive2_block_id(xive
);
2036 uint64_t vsd
= xive
->vsds
[type
][blk
];
2037 const XiveVstInfo
*info
= &vst_infos
[type
];
2039 uint32_t page_shift
;
2041 /* For direct tables, fake a valid value */
2042 if (!(VSD_INDIRECT
& vsd
)) {
2046 /* Get the page size of the indirect table. */
2047 vsd_addr
= vsd
& VSD_ADDRESS_MASK
;
2048 ldq_be_dma(&address_space_memory
, vsd_addr
, &vsd
, MEMTXATTRS_UNSPECIFIED
);
2050 if (!(vsd
& VSD_ADDRESS_MASK
)) {
2052 xive2_error(xive
, "VST: invalid %s entry!?", info
->name
);
2057 page_shift
= GETFIELD(VSD_TSIZE
, vsd
) + 12;
2059 if (!pnv_xive2_vst_page_size_allowed(page_shift
)) {
2060 xive2_error(xive
, "VST: invalid %s page shift %d", info
->name
,
2065 return (1ull << page_shift
) / info
->size
;
2068 void pnv_xive2_pic_print_info(PnvXive2
*xive
, Monitor
*mon
)
2070 Xive2Router
*xrtr
= XIVE2_ROUTER(xive
);
2071 uint8_t blk
= pnv_xive2_block_id(xive
);
2072 uint8_t chip_id
= xive
->chip
->chip_id
;
2073 uint32_t srcno0
= XIVE_EAS(blk
, 0);
2074 uint32_t nr_esbs
= pnv_xive2_nr_esbs(xive
);
2079 uint64_t xive_nvp_per_subpage
;
2081 monitor_printf(mon
, "XIVE[%x] Source %08x .. %08x\n", blk
, srcno0
,
2082 srcno0
+ nr_esbs
- 1);
2083 xive_source_pic_print_info(&xive
->ipi_source
, srcno0
, mon
);
2085 monitor_printf(mon
, "XIVE[%x] EAT %08x .. %08x\n", blk
, srcno0
,
2086 srcno0
+ nr_esbs
- 1);
2087 for (i
= 0; i
< nr_esbs
; i
++) {
2088 if (xive2_router_get_eas(xrtr
, blk
, i
, &eas
)) {
2091 if (!xive2_eas_is_masked(&eas
)) {
2092 xive2_eas_pic_print_info(&eas
, i
, mon
);
2096 monitor_printf(mon
, "XIVE[%x] #%d END Escalation EAT\n", chip_id
, blk
);
2098 while (!xive2_router_get_end(xrtr
, blk
, i
, &end
)) {
2099 xive2_end_eas_pic_print_info(&end
, i
++, mon
);
2102 monitor_printf(mon
, "XIVE[%x] #%d ENDT\n", chip_id
, blk
);
2104 while (!xive2_router_get_end(xrtr
, blk
, i
, &end
)) {
2105 xive2_end_pic_print_info(&end
, i
++, mon
);
2108 monitor_printf(mon
, "XIVE[%x] #%d NVPT %08x .. %08x\n", chip_id
, blk
,
2109 0, XIVE2_NVP_COUNT
- 1);
2110 xive_nvp_per_subpage
= pnv_xive2_vst_per_subpage(xive
, VST_NVP
);
2111 for (i
= 0; i
< XIVE2_NVP_COUNT
; i
+= xive_nvp_per_subpage
) {
2112 while (!xive2_router_get_nvp(xrtr
, blk
, i
, &nvp
)) {
2113 xive2_nvp_pic_print_info(&nvp
, i
++, mon
);