tests/xics: Fix assumption that interrupts happen immediately

Currently the test writes to the XICS and then checks that the
expected interrupt has happened.  This turns into a stbcix
instruction followed immediately by a load from the variable that
indicates whether an interrupt has happened.  It is possible for
it to take a few cycles for the store to reach the XICS and the
interrupt request signal to come back to the core, particularly
with improvements to the load/store unit and dcache.

This therefore adds a delay between storing to the XICS and
checking for the occurrence of an interrupt, so as to give the
signals time to propagate.  The delay loop does an arbitrary 10
iterations, and each iteration does two loads and one store to
(cacheable) memory.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
jtag-port
Paul Mackerras 5 years ago
parent 5a00029519
commit 03f9d7a97e

Binary file not shown.

@ -9,6 +9,14 @@
#undef DEBUG #undef DEBUG
//#define DEBUG 1 //#define DEBUG 1


void delay(void)
{
static volatile int i;

for (i = 0; i < 10; ++i)
;
}

void print_number(unsigned int i) // only for i = 0-999 void print_number(unsigned int i) // only for i = 0-999
{ {
unsigned int j, k, m; unsigned int j, k, m;
@ -148,14 +156,17 @@ int xics_test_0(void)
xics_write8(XICS_MFRR, 0x05); // cause 0x500 interrupt xics_write8(XICS_MFRR, 0x05); // cause 0x500 interrupt


// still masked, so shouldn't happen yet // still masked, so shouldn't happen yet
delay();
assert(isrs_run == 0); assert(isrs_run == 0);


// unmask IPI only // unmask IPI only
xics_write8(XICS_XIRR, 0x40); xics_write8(XICS_XIRR, 0x40);
delay();
assert(isrs_run == ISR_IPI); assert(isrs_run == ISR_IPI);


// unmask UART // unmask UART
xics_write8(XICS_XIRR, 0xc0); xics_write8(XICS_XIRR, 0xc0);
delay();
assert(isrs_run == (ISR_IPI | ISR_UART)); assert(isrs_run == (ISR_IPI | ISR_UART));


// cleanup // cleanup
@ -174,12 +185,14 @@ int xics_test_1(void)
xics_write8(XICS_XIRR, 0xff); // allow all interrupts xics_write8(XICS_XIRR, 0xff); // allow all interrupts


// should be none pending // should be none pending
delay();
assert(isrs_run == 0); assert(isrs_run == 0);


// trigger both // trigger both
potato_uart_irq_en(); // cause 0x500 interrupt potato_uart_irq_en(); // cause 0x500 interrupt
xics_write8(XICS_MFRR, 0x05); // cause 0x500 interrupt xics_write8(XICS_MFRR, 0x05); // cause 0x500 interrupt


delay();
assert(isrs_run == (ISR_IPI | ISR_UART)); assert(isrs_run == (ISR_IPI | ISR_UART));


// cleanup // cleanup
@ -208,9 +221,11 @@ int xics_test_2(void)
// trigger an IPI // trigger an IPI
xics_write8(XICS_MFRR, 0x05); // cause 0x500 interrupt xics_write8(XICS_MFRR, 0x05); // cause 0x500 interrupt


delay();
assert(isrs_run == 0); assert(isrs_run == 0);


mtmsrd(0x9000000000008003); // EE on mtmsrd(0x9000000000008003); // EE on
delay();
assert(isrs_run == ISR_IPI); assert(isrs_run == ISR_IPI);


// cleanup // cleanup

Loading…
Cancel
Save