Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4688332pxj; Wed, 12 May 2021 10:55:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjo4TUZGwJrmO9O87t+zjdBTN7u1hDOOyG5VlS09zc4yTxah0uzfMFnrHmcjV1giizKxzF X-Received: by 2002:a05:6402:2788:: with SMTP id b8mr30470680ede.140.1620842149192; Wed, 12 May 2021 10:55:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620842149; cv=none; d=google.com; s=arc-20160816; b=y7V9julOPZzVQ7UzC+hJzgIyY7Baj8uwwvwRTzm9KjZSdOnG8CSHyjPzO/M3iJcmMa wHRfl7V/g+ulIB/FIR0+Uiv51H5TPROk4sKBzhAsL+3lAhXQL1du5dckF5U3QM1LACEW /zzOl6kvALiBIHRwqJP47GMaJi35JagCZ+EvT5Zn9AnF9gNbcY/6sbAwCAZsjAegQLef HycBg9fuZKN3vwl0G04PUYNbIGsgJBGIBydYMEFYZGT7Mmqgt0540IXqPhIil8S2cSY1 tXFLsE8NxfVdcK6UAUj+6KdZE2CJMxb4XAfU2z9WUFfa1iVnZBHFc1FUXAVgDeNOfws9 labQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+SKrukh5YoqRkXFBcQCFPuywNYga5tHssZJnf2aOd08=; b=Z4cQ07qvsQ5+DBtJgZumDvdfjoksSDP3Vdbm9cpp7L71mjWDfURyzGyZaCGEnToGBt LAc0NWMvPafq29OlgiV7WCg4OpSPzc8hnANePLbt24xJVsDwUTaUT/FENNegjiY0103N sfldvTnrX57XZEaTiZAIPXG7GlSXLEydHAagH7IW4vaZ71KgYRB+QLOM4AgOF1Nx80o1 +nCZtQedeyzMSA2fje7O48+PneQDcGRGxRnid6/m/MB3CGuUH0+leQi9psm1PKzBoV40 RxQbQaAj0RQeEsyWf+ShH8d6sqwW4pxho7TybUhO/FISqWfg3nCT+YqyXnSgngV7qURJ Ndiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=B4Tsyf9r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gx23si658936ejb.149.2021.05.12.10.55.25; Wed, 12 May 2021 10:55:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=B4Tsyf9r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243251AbhELRt7 (ORCPT + 99 others); Wed, 12 May 2021 13:49:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:60288 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234528AbhELQTI (ORCPT ); Wed, 12 May 2021 12:19:08 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9A7C261D8B; Wed, 12 May 2021 15:45:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620834345; bh=o50pUVnQNqR312fhWezKRUL/tysuHfGppY6YgH24jvM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B4Tsyf9rJOtAAoVmsCM0zMpZtwA3xDH28aI3yatJbS7xi87iDbmG6F25cW7wxAiQv VFcCs8HaZAVyXjTSSr0FY6AXa+Ow5bWcWPGocq3u9Gr205g7poa+XH/J+bsGbr1FK6 wwmEenasL8H4/k9WBcz8jVeBYBynUSt8Hk2tbpgk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Dan Carpenter , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Greg Kurz , Michael Ellerman , Sasha Levin Subject: [PATCH 5.11 507/601] powerpc/xive: Fix xmon command "dxi" Date: Wed, 12 May 2021 16:49:44 +0200 Message-Id: <20210512144844.534075141@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144827.811958675@linuxfoundation.org> References: <20210512144827.811958675@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Cédric Le Goater [ Upstream commit 33e4bc5946432a4ac173fd08e8e30a13ab94d06d ] When under xmon, the "dxi" command dumps the state of the XIVE interrupts. If an interrupt number is specified, only the state of the associated XIVE interrupt is dumped. This form of the command lacks an irq_data parameter which is nevertheless used by xmon_xive_get_irq_config(), leading to an xmon crash. Fix that by doing a lookup in the system IRQ mapping to query the IRQ descriptor data. Invalid interrupt numbers, or not belonging to the XIVE IRQ domain, OPAL event interrupt number for instance, should be caught by the previous query done at the firmware level. Fixes: 97ef27507793 ("powerpc/xive: Fix xmon support on the PowerNV platform") Reported-by: kernel test robot Reported-by: Dan Carpenter Signed-off-by: Cédric Le Goater Tested-by: Greg Kurz Reviewed-by: Greg Kurz Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20210331144514.892250-8-clg@kaod.org Signed-off-by: Sasha Levin --- arch/powerpc/sysdev/xive/common.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/sysdev/xive/common.c b/arch/powerpc/sysdev/xive/common.c index 6e43bba80707..5cacb632eb37 100644 --- a/arch/powerpc/sysdev/xive/common.c +++ b/arch/powerpc/sysdev/xive/common.c @@ -253,17 +253,20 @@ notrace void xmon_xive_do_dump(int cpu) xmon_printf("\n"); } +static struct irq_data *xive_get_irq_data(u32 hw_irq) +{ + unsigned int irq = irq_find_mapping(xive_irq_domain, hw_irq); + + return irq ? irq_get_irq_data(irq) : NULL; +} + int xmon_xive_get_irq_config(u32 hw_irq, struct irq_data *d) { - struct irq_chip *chip = irq_data_get_irq_chip(d); int rc; u32 target; u8 prio; u32 lirq; - if (!is_xive_irq(chip)) - return -EINVAL; - rc = xive_ops->get_irq_config(hw_irq, &target, &prio, &lirq); if (rc) { xmon_printf("IRQ 0x%08x : no config rc=%d\n", hw_irq, rc); @@ -273,6 +276,9 @@ int xmon_xive_get_irq_config(u32 hw_irq, struct irq_data *d) xmon_printf("IRQ 0x%08x : target=0x%x prio=%02x lirq=0x%x ", hw_irq, target, prio, lirq); + if (!d) + d = xive_get_irq_data(hw_irq); + if (d) { struct xive_irq_data *xd = irq_data_get_irq_handler_data(d); u64 val = xive_esb_read(xd, XIVE_ESB_GET); -- 2.30.2