From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F051C2D0BF for ; Mon, 16 Dec 2019 18:23:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3E5A4206E0 for ; Mon, 16 Dec 2019 18:23:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576520610; bh=HaHzptjKu1T87dmbAWLzqhh+FUdykCnYHllHgqcCvPw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ptH9OOJGtvJqJFRjN92+IjhNRPYRtbst+doYbOWeIUDwcMyCJGWU5DQHvwFRhvpnf FaWrP1YrxBHypoNWYNjX1OPqNSv1jDYNY9yByr81cjqohIJeRgSHc5PUYCYTZnL7FV jquxGqE9LAWd4mPKAiEnHEi+jPPmHq8psAHUcJdg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731760AbfLPSUR (ORCPT ); Mon, 16 Dec 2019 13:20:17 -0500 Received: from mail.kernel.org ([198.145.29.99]:49768 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732048AbfLPSUN (ORCPT ); Mon, 16 Dec 2019 13:20:13 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2A0CD20409; Mon, 16 Dec 2019 18:20:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576520412; bh=HaHzptjKu1T87dmbAWLzqhh+FUdykCnYHllHgqcCvPw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gCn7v8/4TYEuFscDB3RNDSW4iK/+5VRlXKcrPGXEvA1SQjJzXg3ivGmnYOJiuWN3G u9bSZsCvRNvLdXraeoAw7uctVPqJ5qsG6oPGLgaxwVCPlpeg4Yarj/wdJk9QSZk6uM gOvAFPj2Jpe7WVqIsQhQmXgkeIQU0SRl+oX+qo8U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Greg Kurz , Michael Ellerman Subject: [PATCH 5.4 145/177] powerpc/xive: Prevent page fault issues in the machine crash handler Date: Mon, 16 Dec 2019 18:50:01 +0100 Message-Id: <20191216174847.239885182@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191216174811.158424118@linuxfoundation.org> References: <20191216174811.158424118@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Cédric Le Goater commit 1ca3dec2b2dff9d286ce6cd64108bda0e98f9710 upstream. When the machine crash handler is invoked, all interrupts are masked but interrupts which have not been started yet do not have an ESB page mapped in the Linux address space. This crashes the 'crash kexec' sequence on sPAPR guests. To fix, force the mapping of the ESB page when an interrupt is being mapped in the Linux IRQ number space. This is done by setting the initial state of the interrupt to OFF which is not necessarily the case on PowerNV. Fixes: 243e25112d06 ("powerpc/xive: Native exploitation of the XIVE interrupt controller") Cc: stable@vger.kernel.org # v4.12+ Signed-off-by: Cédric Le Goater Reviewed-by: Greg Kurz Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20191031063100.3864-1-clg@kaod.org Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/sysdev/xive/common.c | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/arch/powerpc/sysdev/xive/common.c +++ b/arch/powerpc/sysdev/xive/common.c @@ -1035,6 +1035,15 @@ static int xive_irq_alloc_data(unsigned xd->target = XIVE_INVALID_TARGET; irq_set_handler_data(virq, xd); + /* + * Turn OFF by default the interrupt being mapped. A side + * effect of this check is the mapping the ESB page of the + * interrupt in the Linux address space. This prevents page + * fault issues in the crash handler which masks all + * interrupts. + */ + xive_esb_read(xd, XIVE_ESB_SET_PQ_01); + return 0; }