From: Greg Kurz <groug@kaod.org>
To: "Cédric Le Goater" <clg@kaod.org>
Cc: linuxppc-dev@lists.ozlabs.org, kernel test robot <lkp@intel.com>,
Dan Carpenter <dan.carpenter@oracle.com>
Subject: Re: [PATCH v2 7/8] powerpc/xive: Fix xmon command "dxi"
Date: Tue, 9 Mar 2021 11:23:25 +0100 [thread overview]
Message-ID: <20210309112325.7b161cc7@bahia.lan> (raw)
In-Reply-To: <20210303174857.1760393-8-clg@kaod.org>
On Wed, 3 Mar 2021 18:48:56 +0100
Cédric Le Goater <clg@kaod.org> wrote:
> 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.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Fixes: 97ef27507793 ("powerpc/xive: Fix xmon support on the PowerNV platform")
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---
I've tested this in a KVM guest and it seems to do the job.
6:mon> dxi 1201
IRQ 0x00001201 : target=0xfffffc00 prio=ff lirq=0x0 flags= LH PQ=-Q
Bad HW irq numbers are filtered by the hypervisor:
6:mon> dxi bad
[ 696.390577] xive: H_INT_GET_SOURCE_CONFIG lisn=2989 failed -55
IRQ 0x00000bad : no config rc=-6
Note that this also allows to show IPIs:
6:mon> dxi 0
IRQ 0x00000000 : target=0x0 prio=06 lirq=0x10
This is a bit inconsistent with output of the 0-argument form of "dxi",
which filters them out for a reason that isn't obvious to me. No big
deal though, this should be addressed in another patch anyway.
Reviewed-and-tested-by: Greg Kurz <groug@kaod.org>
> 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 f6b7b15bbb3a..8eefd152b947 100644
> --- a/arch/powerpc/sysdev/xive/common.c
> +++ b/arch/powerpc/sysdev/xive/common.c
> @@ -255,17 +255,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);
> @@ -275,6 +278,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);
next prev parent reply other threads:[~2021-03-09 10:23 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-03 17:48 [PATCH v2 0/8] powerpc/xive: Map one IPI interrupt per node Cédric Le Goater
2021-03-03 17:48 ` [PATCH v2 1/8] powerpc/xive: Use cpu_to_node() instead of ibm, chip-id property Cédric Le Goater
2021-03-08 17:13 ` [PATCH v2 1/8] powerpc/xive: Use cpu_to_node() instead of ibm,chip-id property Greg Kurz
2021-03-09 15:33 ` Cédric Le Goater
2021-03-09 17:08 ` Daniel Henrique Barboza
2021-03-09 17:26 ` Cédric Le Goater
2021-03-12 1:55 ` David Gibson
2021-03-12 9:53 ` Cédric Le Goater
2021-03-12 12:18 ` Daniel Henrique Barboza
2021-03-12 13:03 ` Greg Kurz
2021-03-12 13:28 ` Cédric Le Goater
2021-03-03 17:48 ` [PATCH v2 2/8] powerpc/xive: Introduce an IPI interrupt domain Cédric Le Goater
2021-03-08 17:55 ` Greg Kurz
2021-03-03 17:48 ` [PATCH v2 3/8] powerpc/xive: Remove useless check on XIVE_IPI_HW_IRQ Cédric Le Goater
2021-03-08 17:56 ` Greg Kurz
2021-03-03 17:48 ` [PATCH v2 4/8] powerpc/xive: Simplify xive_core_debug_show() Cédric Le Goater
2021-03-08 18:07 ` Greg Kurz
2021-03-08 18:11 ` Cédric Le Goater
2021-03-09 9:13 ` Greg Kurz
2021-03-09 9:42 ` Greg Kurz
2021-03-09 15:39 ` Cédric Le Goater
2021-03-03 17:48 ` [PATCH v2 5/8] powerpc/xive: Drop check on irq_data in xive_core_debug_show() Cédric Le Goater
2021-03-09 9:18 ` Greg Kurz
2021-03-03 17:48 ` [PATCH v2 6/8] powerpc/xive: Simplify the dump of XIVE interrupts under xmon Cédric Le Goater
2021-03-09 9:22 ` Greg Kurz
2021-03-03 17:48 ` [PATCH v2 7/8] powerpc/xive: Fix xmon command "dxi" Cédric Le Goater
2021-03-09 10:23 ` Greg Kurz [this message]
2021-03-09 15:49 ` Cédric Le Goater
2021-03-03 17:48 ` [PATCH v2 8/8] powerpc/xive: Map one IPI interrupt per node Cédric Le Goater
2021-03-09 13:23 ` Greg Kurz
2021-03-09 15:52 ` Cédric Le Goater
2021-03-30 16:18 ` Cédric Le Goater
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210309112325.7b161cc7@bahia.lan \
--to=groug@kaod.org \
--cc=clg@kaod.org \
--cc=dan.carpenter@oracle.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=lkp@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).