Skip to content

Commit ffc2cab

Browse files
milesg-githubnpiggin
authored andcommitted
qtest/xive: Add test of pool interrupts
Added new test for pool interrupts. Removed all printfs from pnv-xive2-* qtests. Signed-off-by: Glenn Miles <milesg@linux.vnet.ibm.com> Signed-off-by: Michael Kowal <kowal@linux.ibm.com> Reviewed-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
1 parent c4b5038 commit ffc2cab

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

tests/qtest/pnv-xive2-test.c

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,79 @@ static void test_hw_irq(QTestState *qts)
267267
g_assert_cmphex(cppr, ==, 0xFF);
268268
}
269269

270+
static void test_pool_irq(QTestState *qts)
271+
{
272+
uint32_t irq = 2;
273+
uint32_t irq_data = 0x600d0d06;
274+
uint32_t end_index = 5;
275+
uint32_t target_pir = 1;
276+
uint32_t target_nvp = 0x100 + target_pir;
277+
uint8_t priority = 5;
278+
uint32_t reg32;
279+
uint16_t reg16;
280+
uint8_t pq, nsr, cppr, ipb;
281+
282+
g_test_message("=========================================================");
283+
g_test_message("Testing irq %d to pool thread %d", irq, target_pir);
284+
285+
/* irq config */
286+
set_eas(qts, irq, end_index, irq_data);
287+
set_end(qts, end_index, target_nvp, priority, false /* group */);
288+
289+
/* enable and trigger irq */
290+
get_esb(qts, irq, XIVE_EOI_PAGE, XIVE_ESB_SET_PQ_00);
291+
set_esb(qts, irq, XIVE_TRIGGER_PAGE, 0, 0);
292+
293+
/* check irq is raised on cpu */
294+
pq = get_esb(qts, irq, XIVE_EOI_PAGE, XIVE_ESB_GET);
295+
g_assert_cmpuint(pq, ==, XIVE_ESB_PENDING);
296+
297+
/* check TIMA values in the PHYS ring (shared by POOL ring) */
298+
reg32 = get_tima32(qts, target_pir, TM_QW3_HV_PHYS + TM_WORD0);
299+
nsr = reg32 >> 24;
300+
cppr = (reg32 >> 16) & 0xFF;
301+
g_assert_cmphex(nsr, ==, 0x40);
302+
g_assert_cmphex(cppr, ==, 0xFF);
303+
304+
/* check TIMA values in the POOL ring */
305+
reg32 = get_tima32(qts, target_pir, TM_QW2_HV_POOL + TM_WORD0);
306+
nsr = reg32 >> 24;
307+
cppr = (reg32 >> 16) & 0xFF;
308+
ipb = (reg32 >> 8) & 0xFF;
309+
g_assert_cmphex(nsr, ==, 0);
310+
g_assert_cmphex(cppr, ==, 0);
311+
g_assert_cmphex(ipb, ==, 0x80 >> priority);
312+
313+
/* ack the irq */
314+
reg16 = get_tima16(qts, target_pir, TM_SPC_ACK_HV_REG);
315+
nsr = reg16 >> 8;
316+
cppr = reg16 & 0xFF;
317+
g_assert_cmphex(nsr, ==, 0x40);
318+
g_assert_cmphex(cppr, ==, priority);
319+
320+
/* check irq data is what was configured */
321+
reg32 = qtest_readl(qts, xive_get_queue_addr(end_index));
322+
g_assert_cmphex((reg32 & 0x7fffffff), ==, (irq_data & 0x7fffffff));
323+
324+
/* check IPB is cleared in the POOL ring */
325+
reg32 = get_tima32(qts, target_pir, TM_QW2_HV_POOL + TM_WORD0);
326+
ipb = (reg32 >> 8) & 0xFF;
327+
g_assert_cmphex(ipb, ==, 0);
328+
329+
/* End Of Interrupt */
330+
set_esb(qts, irq, XIVE_EOI_PAGE, XIVE_ESB_STORE_EOI, 0);
331+
pq = get_esb(qts, irq, XIVE_EOI_PAGE, XIVE_ESB_GET);
332+
g_assert_cmpuint(pq, ==, XIVE_ESB_RESET);
333+
334+
/* reset CPPR */
335+
set_tima8(qts, target_pir, TM_QW3_HV_PHYS + TM_CPPR, 0xFF);
336+
reg32 = get_tima32(qts, target_pir, TM_QW3_HV_PHYS + TM_WORD0);
337+
nsr = reg32 >> 24;
338+
cppr = (reg32 >> 16) & 0xFF;
339+
g_assert_cmphex(nsr, ==, 0x00);
340+
g_assert_cmphex(cppr, ==, 0xFF);
341+
}
342+
270343
#define XIVE_ODD_CL 0x80
271344
static void test_pull_thread_ctx_to_odd_thread_cl(QTestState *qts)
272345
{
@@ -486,6 +559,9 @@ static void test_xive(void)
486559
/* omit reset_state here and use settings from test_hw_irq */
487560
test_pull_thread_ctx_to_odd_thread_cl(qts);
488561

562+
reset_state(qts);
563+
test_pool_irq(qts);
564+
489565
reset_state(qts);
490566
test_hw_group_irq(qts);
491567

0 commit comments

Comments
 (0)