From patchwork Thu Apr 20 22:59:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Herrenschmidt X-Patchwork-Id: 753035 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 3w8DqR1wkBz9s73 for ; Fri, 21 Apr 2017 09:00:35 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3w8DqR0qX2zDqMZ for ; Fri, 21 Apr 2017 09:00:35 +1000 (AEST) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org 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 3w8Dq429cFzDqKr for ; Fri, 21 Apr 2017 09:00:16 +1000 (AEST) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.13.8) with ESMTP id v3KMxpOV021521; Thu, 20 Apr 2017 17:59:53 -0500 Message-ID: <1492729190.25766.155.camel@kernel.crashing.org> From: Benjamin Herrenschmidt To: skiboot@lists.ozlabs.org Date: Fri, 21 Apr 2017 08:59:50 +1000 X-Mailer: Evolution 3.22.6 (3.22.6-1.fc25) Mime-Version: 1.0 Subject: [Skiboot] [PATCH] mbox: Sanitize interrupts registers 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: , Cc: Cyril Bur , Michael Neuling Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" If some status interrupts are left unmasked by a previous firmware run (either HostBoot or some other version of skiboot), we fail to clear them and end up with a runaway SerIRQ. Signed-off-by: Benjamin Herrenschmidt --- Let's merge that now. It will be obsoleted by the v2 protocol implementation but we want a fix out ASAP. hw/lpc-mbox.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/hw/lpc-mbox.c b/hw/lpc-mbox.c index fd107fb..21e6eee 100644 --- a/hw/lpc-mbox.c +++ b/hw/lpc-mbox.c @@ -200,11 +200,18 @@ static struct lpc_client mbox_lpc_client = { static bool mbox_init_hw(void) { - /* - * Turns out there isn't anything to do. - * It might be a good idea to santise the registers though. - * TODO + /* Disable all status interrupts except attentions */ + bmc_mbox_outb(0x00, MBOX_HOST_INT_EN_0); + bmc_mbox_outb(MBOX_STATUS_ATTN, MBOX_HOST_INT_EN_1); + + /* Cleanup host interrupt and status */ + bmc_mbox_outb(MBOX_CTRL_INT_STATUS, MBOX_HOST_CTRL); + + /* Disable host control interrupt for now (will be + * re-enabled when needed). Clear BMC interrupts */ + bmc_mbox_outb(MBOX_CTRL_INT_MASK, MBOX_BMC_CTRL); + return true; }