Skip to content

Commit

Permalink
xive: Increase the interrupt "gap" on debug builds
Browse files Browse the repository at this point in the history
We normally allocate IPIs from 0x10. Make that 0x1000 on debug
builds to limit the chances of overlapping with Linux interrupt
numbers which makes debugging code that confuses them easier.

Also add a warning in emulation if we get an interrupt in the
queue whose number is below the gap.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
  • Loading branch information
ozbenh authored and stewartsmith committed Sep 13, 2017
1 parent e3c2498 commit 726753e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions hw/xive.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,14 @@
#define XIVE_DEBUG_INIT_CACHE_UPDATES
#define XIVE_EXTRA_CHECK_INIT_CACHE
#define XIVE_CHECK_LOCKS
#define XIVE_INT_SAFETY_GAP 0x1000
#else
#undef XIVE_DEBUG_DUPLICATES
#undef XIVE_PERCPU_LOG
#undef XIVE_DEBUG_INIT_CACHE_UPDATES
#undef XIVE_EXTRA_CHECK_INIT_CACHE
#undef XIVE_CHECK_LOCKS
#define XIVE_INT_SAFETY_GAP 0x10
#endif

/*
Expand Down Expand Up @@ -2756,8 +2758,8 @@ static struct xive *init_one_xive(struct dt_node *np)
/* Make sure we never hand out "2" as it's reserved for XICS emulation
* IPI returns. Generally start handing out at 0x10
*/
if (x->int_ipi_top < 0x10)
x->int_ipi_top = 0x10;
if (x->int_ipi_top < XIVE_INT_SAFETY_GAP)
x->int_ipi_top = XIVE_INT_SAFETY_GAP;

/* Allocate a few bitmaps */
x->eq_map = zalloc(BITMAP_BYTES(MAX_EQ_COUNT >> 3));
Expand Down Expand Up @@ -3540,6 +3542,9 @@ static int64_t opal_xive_get_xirr(uint32_t *out_xirr, bool just_poll)
/* XXX Use "p" to select queue */
val = xive_read_eq(xs, just_poll);

if (val && val < XIVE_INT_SAFETY_GAP)
xive_cpu_err(c, "Bogus interrupt 0x%x received !\n", val);

/* Convert to magic IPI if needed */
if (val == xs->ipi_irq)
val = 2;
Expand Down

0 comments on commit 726753e

Please sign in to comment.