From patchwork Sun Sep 10 07:35:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Herrenschmidt X-Patchwork-Id: 812070 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xqjbk6Kslz9s8J for ; Sun, 10 Sep 2017 17:38:42 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3xqjbk5J6kzDsFB for ; Sun, 10 Sep 2017 17:38:42 +1000 (AEST) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=permerror (mailfrom) smtp.mailfrom=kernel.crashing.org (client-ip=63.228.1.57; helo=gate.crashing.org; envelope-from=benh@kernel.crashing.org; receiver=) Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3xqjXr37M5zDrn2 for ; Sun, 10 Sep 2017 17:36:12 +1000 (AEST) Received: from pasglop.au.ibm.com (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.13.8) with ESMTP id v8A7ZahO032562; Sun, 10 Sep 2017 02:35:53 -0500 From: Benjamin Herrenschmidt To: skiboot@lists.ozlabs.org Date: Sun, 10 Sep 2017 17:35:32 +1000 Message-Id: <20170910073535.27226-10-benh@kernel.crashing.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170910073535.27226-1-benh@kernel.crashing.org> References: <20170910073535.27226-1-benh@kernel.crashing.org> Subject: [Skiboot] [PATCH v3 10/13] xive: Increase the interrupt "gap" on debug builds X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" 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 --- hw/xive.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/xive.c b/hw/xive.c index c2360550..0d3b24fd 100644 --- a/hw/xive.c +++ b/hw/xive.c @@ -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 /* @@ -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)); @@ -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;