]> git.hungrycats.org Git - linux/commitdiff
powerpc/xmon: Check before calling xive functions
authorBreno Leitao <leitao@debian.org>
Tue, 17 Oct 2017 18:20:18 +0000 (16:20 -0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Dec 2017 09:10:34 +0000 (10:10 +0100)
[ Upstream commit 402e172a2ce76210f2fe921cf419d12103851344 ]

Currently xmon could call XIVE functions from OPAL even if the XIVE is
disabled or does not exist in the system, as in POWER8 machines. This
causes the following exception:

 1:mon> dx
 cpu 0x1: Vector: 700 (Program Check) at [c000000423c93450]
     pc: c00000000009cfa4: opal_xive_dump+0x50/0x68
     lr: c0000000000997b8: opal_return+0x0/0x50

This patch simply checks if XIVE is enabled before calling XIVE
functions.

Fixes: 243e25112d06 ("powerpc/xive: Native exploitation of the XIVE interrupt controller")
Suggested-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>
Signed-off-by: Breno Leitao <leitao@debian.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/xmon/xmon.c

index 33351c6704b1d0e0fe5138f24ccfed8f1af555e8..c008083fbc4f63f97f61590ef2566173d31e1887 100644 (file)
@@ -2475,6 +2475,11 @@ static void dump_xives(void)
        unsigned long num;
        int c;
 
+       if (!xive_enabled()) {
+               printf("Xive disabled on this system\n");
+               return;
+       }
+
        c = inchar();
        if (c == 'a') {
                dump_all_xives();