]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
powerpc/xmon: Check for HV mode when dumping XIVE info from OPAL
authorCédric Le Goater <clg@kaod.org>
Wed, 14 Aug 2019 15:47:52 +0000 (17:47 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 7 Oct 2019 16:59:09 +0000 (18:59 +0200)
[ Upstream commit c3e0dbd7f780a58c4695f1cd8fc8afde80376737 ]

Currently, the xmon 'dx' command calls OPAL to dump the XIVE state in
the OPAL logs and also outputs some of the fields of the internal XIVE
structures in Linux. The OPAL calls can only be done on baremetal
(PowerNV) and they crash a pseries machine. Fix by checking the
hypervisor feature of the CPU.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20190814154754.23682-2-clg@kaod.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/powerpc/xmon/xmon.c

index 4a721fd6240698bc7383d782dd1d378644357a8b..e15ccf19c1533cb9c81f318f37f10e3f8f1ac788 100644 (file)
@@ -2532,13 +2532,16 @@ static void dump_pacas(void)
 static void dump_one_xive(int cpu)
 {
        unsigned int hwid = get_hard_smp_processor_id(cpu);
-
-       opal_xive_dump(XIVE_DUMP_TM_HYP, hwid);
-       opal_xive_dump(XIVE_DUMP_TM_POOL, hwid);
-       opal_xive_dump(XIVE_DUMP_TM_OS, hwid);
-       opal_xive_dump(XIVE_DUMP_TM_USER, hwid);
-       opal_xive_dump(XIVE_DUMP_VP, hwid);
-       opal_xive_dump(XIVE_DUMP_EMU_STATE, hwid);
+       bool hv = cpu_has_feature(CPU_FTR_HVMODE);
+
+       if (hv) {
+               opal_xive_dump(XIVE_DUMP_TM_HYP, hwid);
+               opal_xive_dump(XIVE_DUMP_TM_POOL, hwid);
+               opal_xive_dump(XIVE_DUMP_TM_OS, hwid);
+               opal_xive_dump(XIVE_DUMP_TM_USER, hwid);
+               opal_xive_dump(XIVE_DUMP_VP, hwid);
+               opal_xive_dump(XIVE_DUMP_EMU_STATE, hwid);
+       }
 
        if (setjmp(bus_error_jmp) != 0) {
                catch_memory_errors = 0;