2019-05-26 23:55:05 -07:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2013-10-30 07:35:11 -07:00
|
|
|
/*
|
|
|
|
* Machine check exception handling CPU-side for power7 and power8
|
|
|
|
*
|
|
|
|
* Copyright 2013 IBM Corporation
|
|
|
|
* Author: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#undef DEBUG
|
|
|
|
#define pr_fmt(fmt) "mce_power: " fmt
|
|
|
|
|
|
|
|
#include <linux/types.h>
|
|
|
|
#include <linux/ptrace.h>
|
2019-08-20 01:13:50 -07:00
|
|
|
#include <linux/extable.h>
|
2020-06-08 21:32:42 -07:00
|
|
|
#include <linux/pgtable.h>
|
2013-10-30 07:35:11 -07:00
|
|
|
#include <asm/mmu.h>
|
|
|
|
#include <asm/mce.h>
|
2013-12-15 22:16:24 -07:00
|
|
|
#include <asm/machdep.h>
|
2017-09-28 21:26:53 -07:00
|
|
|
#include <asm/pte-walk.h>
|
|
|
|
#include <asm/sstep.h>
|
|
|
|
#include <asm/exception-64s.h>
|
2019-08-20 01:13:50 -07:00
|
|
|
#include <asm/extable.h>
|
2020-05-05 20:40:31 -07:00
|
|
|
#include <asm/inst.h>
|
2017-09-28 21:26:53 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Convert an address related to an mm to a PFN. NOTE: we are in real
|
|
|
|
* mode, we could potentially race with page table updates.
|
|
|
|
*/
|
2019-04-15 03:05:44 -07:00
|
|
|
unsigned long addr_to_pfn(struct pt_regs *regs, unsigned long addr)
|
2017-09-28 21:26:53 -07:00
|
|
|
{
|
2020-05-05 00:17:13 -07:00
|
|
|
pte_t *ptep, pte;
|
2019-08-20 01:13:47 -07:00
|
|
|
unsigned int shift;
|
2019-09-18 07:53:28 -07:00
|
|
|
unsigned long pfn, flags;
|
2017-09-28 21:26:53 -07:00
|
|
|
struct mm_struct *mm;
|
|
|
|
|
|
|
|
if (user_mode(regs))
|
|
|
|
mm = current->mm;
|
|
|
|
else
|
|
|
|
mm = &init_mm;
|
|
|
|
|
|
|
|
local_irq_save(flags);
|
2019-08-20 01:13:47 -07:00
|
|
|
ptep = __find_linux_pte(mm->pgd, addr, NULL, &shift);
|
2020-05-05 00:17:13 -07:00
|
|
|
if (!ptep) {
|
|
|
|
pfn = ULONG_MAX;
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
pte = READ_ONCE(*ptep);
|
2019-08-20 01:13:47 -07:00
|
|
|
|
2020-05-05 00:17:13 -07:00
|
|
|
if (!pte_present(pte) || pte_special(pte)) {
|
2019-09-18 07:53:28 -07:00
|
|
|
pfn = ULONG_MAX;
|
|
|
|
goto out;
|
|
|
|
}
|
2019-08-20 01:13:47 -07:00
|
|
|
|
2019-09-18 07:53:28 -07:00
|
|
|
if (shift <= PAGE_SHIFT)
|
2020-05-05 00:17:13 -07:00
|
|
|
pfn = pte_pfn(pte);
|
2019-09-18 07:53:28 -07:00
|
|
|
else {
|
2019-08-20 01:13:47 -07:00
|
|
|
unsigned long rpnmask = (1ul << shift) - PAGE_SIZE;
|
2020-05-05 00:17:13 -07:00
|
|
|
pfn = pte_pfn(__pte(pte_val(pte) | (addr & rpnmask)));
|
2019-08-20 01:13:47 -07:00
|
|
|
}
|
2019-09-18 07:53:28 -07:00
|
|
|
out:
|
|
|
|
local_irq_restore(flags);
|
|
|
|
return pfn;
|
2017-09-28 21:26:53 -07:00
|
|
|
}
|
2013-10-30 07:35:11 -07:00
|
|
|
|
2020-11-28 00:07:22 -07:00
|
|
|
static bool mce_in_guest(void)
|
|
|
|
{
|
|
|
|
#ifdef CONFIG_KVM_BOOK3S_HANDLER
|
|
|
|
/*
|
|
|
|
* If machine check is hit when in guest context or low level KVM
|
|
|
|
* code, avoid looking up any translations or making any attempts
|
|
|
|
* to recover, just record the event and pass to KVM.
|
|
|
|
*/
|
|
|
|
if (get_paca()->kvm_hstate.in_guest)
|
|
|
|
return true;
|
|
|
|
#endif
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-10-30 07:35:11 -07:00
|
|
|
/* flush SLBs and reload */
|
2021-12-01 07:41:52 -07:00
|
|
|
#ifdef CONFIG_PPC_64S_HASH_MMU
|
2018-09-11 07:27:00 -07:00
|
|
|
void flush_and_reload_slb(void)
|
2013-10-30 07:35:11 -07:00
|
|
|
{
|
2018-08-09 23:42:48 -07:00
|
|
|
if (early_radix_enabled())
|
2013-10-30 07:35:11 -07:00
|
|
|
return;
|
|
|
|
|
2021-12-01 07:41:43 -07:00
|
|
|
/* Invalidate all SLBs */
|
|
|
|
slb_flush_all_realmode();
|
|
|
|
|
2018-08-09 23:42:48 -07:00
|
|
|
/*
|
|
|
|
* This probably shouldn't happen, but it may be possible it's
|
|
|
|
* called in early boot before SLB shadows are allocated.
|
|
|
|
*/
|
|
|
|
if (!get_slb_shadow())
|
|
|
|
return;
|
2013-10-30 07:35:11 -07:00
|
|
|
|
2018-08-09 23:42:48 -07:00
|
|
|
slb_restore_bolted_realmode();
|
2013-10-30 07:35:11 -07:00
|
|
|
}
|
2016-04-29 06:26:07 -07:00
|
|
|
#endif
|
2013-10-30 07:35:11 -07:00
|
|
|
|
2020-11-28 00:07:26 -07:00
|
|
|
void flush_erat(void)
|
2017-02-27 19:00:48 -07:00
|
|
|
{
|
2021-12-01 07:41:52 -07:00
|
|
|
#ifdef CONFIG_PPC_64S_HASH_MMU
|
2018-08-26 20:03:01 -07:00
|
|
|
if (!early_cpu_has_feature(CPU_FTR_ARCH_300)) {
|
|
|
|
flush_and_reload_slb();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif
|
2019-06-23 03:41:51 -07:00
|
|
|
asm volatile(PPC_ISA_3_0_INVALIDATE_ERAT : : :"memory");
|
2017-02-27 19:00:48 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
#define MCE_FLUSH_SLB 1
|
|
|
|
#define MCE_FLUSH_TLB 2
|
|
|
|
#define MCE_FLUSH_ERAT 3
|
|
|
|
|
|
|
|
static int mce_flush(int what)
|
|
|
|
{
|
2021-12-01 07:41:52 -07:00
|
|
|
#ifdef CONFIG_PPC_64S_HASH_MMU
|
2017-02-27 19:00:48 -07:00
|
|
|
if (what == MCE_FLUSH_SLB) {
|
|
|
|
flush_and_reload_slb();
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
if (what == MCE_FLUSH_ERAT) {
|
|
|
|
flush_erat();
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
if (what == MCE_FLUSH_TLB) {
|
powerpc/64s: Improve local TLB flush for boot and MCE on POWER9
There are several cases outside the normal address space management
where a CPU's entire local TLB is to be flushed:
1. Booting the kernel, in case something has left stale entries in
the TLB (e.g., kexec).
2. Machine check, to clean corrupted TLB entries.
One other place where the TLB is flushed, is waking from deep idle
states. The flush is a side-effect of calling ->cpu_restore with the
intention of re-setting various SPRs. The flush itself is unnecessary
because in the first case, the TLB should not acquire new corrupted
TLB entries as part of sleep/wake (though they may be lost).
This type of TLB flush is coded inflexibly, several times for each CPU
type, and they have a number of problems with ISA v3.0B:
- The current radix mode of the MMU is not taken into account, it is
always done as a hash flushn For IS=2 (LPID-matching flush from host)
and IS=3 with HV=0 (guest kernel flush), tlbie(l) is undefined if
the R field does not match the current radix mode.
- ISA v3.0B hash must flush the partition and process table caches as
well.
- ISA v3.0B radix must flush partition and process scoped translations,
partition and process table caches, and also the page walk cache.
So consolidate the flushing code and implement it in C and inline asm
under the mm/ directory with the rest of the flush code. Add ISA v3.0B
cases for radix and hash, and use the radix flush in radix environment.
Provide a way for IS=2 (LPID flush) to specify the radix mode of the
partition. Have KVM pass in the radix mode of the guest.
Take out the flushes from early cputable/dt_cpu_ftrs detection hooks,
and move it later in the boot process after, the MMU registers are set
up and before relocation is first turned on.
The TLB flush is no longer called when restoring from deep idle states.
This was not be done as a separate step because booting secondaries
uses the same cpu_restore as idle restore, which needs the TLB flush.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2017-12-23 08:15:50 -07:00
|
|
|
tlbiel_all();
|
|
|
|
return 1;
|
2017-02-27 19:00:48 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-03-14 05:36:47 -07:00
|
|
|
#define SRR1_MC_LOADSTORE(srr1) ((srr1) & PPC_BIT(42))
|
2017-03-14 05:36:45 -07:00
|
|
|
|
2017-03-14 05:36:46 -07:00
|
|
|
struct mce_ierror_table {
|
|
|
|
unsigned long srr1_mask;
|
|
|
|
unsigned long srr1_value;
|
|
|
|
bool nip_valid; /* nip is a valid indicator of faulting address */
|
|
|
|
unsigned int error_type;
|
|
|
|
unsigned int error_subtype;
|
2019-04-29 11:16:02 -07:00
|
|
|
unsigned int error_class;
|
2017-03-14 05:36:46 -07:00
|
|
|
unsigned int initiator;
|
|
|
|
unsigned int severity;
|
2019-04-29 11:15:55 -07:00
|
|
|
bool sync_error;
|
2017-03-14 05:36:46 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
static const struct mce_ierror_table mce_p7_ierror_table[] = {
|
|
|
|
{ 0x00000000001c0000, 0x0000000000040000, true,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ERROR_TYPE_UE, MCE_UE_ERROR_IFETCH, MCE_ECLASS_HARDWARE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
2017-03-14 05:36:46 -07:00
|
|
|
{ 0x00000000001c0000, 0x0000000000080000, true,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ERROR_TYPE_SLB, MCE_SLB_ERROR_PARITY, MCE_ECLASS_HARD_INDETERMINATE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
2017-03-14 05:36:46 -07:00
|
|
|
{ 0x00000000001c0000, 0x00000000000c0000, true,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ERROR_TYPE_SLB, MCE_SLB_ERROR_MULTIHIT, MCE_ECLASS_SOFT_INDETERMINATE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_WARNING, true },
|
2017-03-14 05:36:46 -07:00
|
|
|
{ 0x00000000001c0000, 0x0000000000100000, true,
|
|
|
|
MCE_ERROR_TYPE_SLB, MCE_SLB_ERROR_INDETERMINATE, /* BOTH */
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ECLASS_SOFT_INDETERMINATE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_WARNING, true },
|
2017-03-14 05:36:46 -07:00
|
|
|
{ 0x00000000001c0000, 0x0000000000140000, true,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ERROR_TYPE_TLB, MCE_TLB_ERROR_MULTIHIT, MCE_ECLASS_SOFT_INDETERMINATE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_WARNING, true },
|
2017-03-14 05:36:46 -07:00
|
|
|
{ 0x00000000001c0000, 0x0000000000180000, true,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ERROR_TYPE_UE, MCE_UE_ERROR_PAGE_TABLE_WALK_IFETCH, MCE_ECLASS_HARDWARE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
2017-03-14 05:36:46 -07:00
|
|
|
{ 0x00000000001c0000, 0x00000000001c0000, true,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ERROR_TYPE_UE, MCE_UE_ERROR_IFETCH, MCE_ECLASS_HARDWARE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
|
|
|
{ 0, 0, 0, 0, 0, 0, 0 } };
|
2017-03-14 05:36:46 -07:00
|
|
|
|
|
|
|
static const struct mce_ierror_table mce_p8_ierror_table[] = {
|
2017-03-14 05:36:48 -07:00
|
|
|
{ 0x00000000081c0000, 0x0000000000040000, true,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ERROR_TYPE_UE, MCE_UE_ERROR_IFETCH, MCE_ECLASS_HARDWARE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
2017-03-14 05:36:48 -07:00
|
|
|
{ 0x00000000081c0000, 0x0000000000080000, true,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ERROR_TYPE_SLB, MCE_SLB_ERROR_PARITY, MCE_ECLASS_HARD_INDETERMINATE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
2017-03-14 05:36:48 -07:00
|
|
|
{ 0x00000000081c0000, 0x00000000000c0000, true,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ERROR_TYPE_SLB, MCE_SLB_ERROR_MULTIHIT, MCE_ECLASS_SOFT_INDETERMINATE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_WARNING, true },
|
2017-03-14 05:36:48 -07:00
|
|
|
{ 0x00000000081c0000, 0x0000000000100000, true,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ERROR_TYPE_ERAT, MCE_ERAT_ERROR_MULTIHIT, MCE_ECLASS_SOFT_INDETERMINATE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_WARNING, true },
|
2017-03-14 05:36:48 -07:00
|
|
|
{ 0x00000000081c0000, 0x0000000000140000, true,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ERROR_TYPE_TLB, MCE_TLB_ERROR_MULTIHIT, MCE_ECLASS_SOFT_INDETERMINATE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_WARNING, true },
|
2017-03-14 05:36:48 -07:00
|
|
|
{ 0x00000000081c0000, 0x0000000000180000, true,
|
2017-03-14 05:36:46 -07:00
|
|
|
MCE_ERROR_TYPE_UE, MCE_UE_ERROR_PAGE_TABLE_WALK_IFETCH,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ECLASS_HARDWARE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
2017-03-14 05:36:48 -07:00
|
|
|
{ 0x00000000081c0000, 0x00000000001c0000, true,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ERROR_TYPE_UE, MCE_UE_ERROR_IFETCH, MCE_ECLASS_HARDWARE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
2017-03-14 05:36:48 -07:00
|
|
|
{ 0x00000000081c0000, 0x0000000008000000, true,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ERROR_TYPE_LINK, MCE_LINK_ERROR_IFETCH_TIMEOUT, MCE_ECLASS_HARDWARE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
2017-03-14 05:36:48 -07:00
|
|
|
{ 0x00000000081c0000, 0x0000000008040000, true,
|
|
|
|
MCE_ERROR_TYPE_LINK,MCE_LINK_ERROR_PAGE_TABLE_WALK_IFETCH_TIMEOUT,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ECLASS_HARDWARE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
|
|
|
{ 0, 0, 0, 0, 0, 0, 0 } };
|
2017-03-14 05:36:46 -07:00
|
|
|
|
|
|
|
static const struct mce_ierror_table mce_p9_ierror_table[] = {
|
|
|
|
{ 0x00000000081c0000, 0x0000000000040000, true,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ERROR_TYPE_UE, MCE_UE_ERROR_IFETCH, MCE_ECLASS_HARDWARE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
2017-03-14 05:36:46 -07:00
|
|
|
{ 0x00000000081c0000, 0x0000000000080000, true,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ERROR_TYPE_SLB, MCE_SLB_ERROR_PARITY, MCE_ECLASS_HARD_INDETERMINATE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
2017-03-14 05:36:46 -07:00
|
|
|
{ 0x00000000081c0000, 0x00000000000c0000, true,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ERROR_TYPE_SLB, MCE_SLB_ERROR_MULTIHIT, MCE_ECLASS_SOFT_INDETERMINATE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_WARNING, true },
|
2017-03-14 05:36:46 -07:00
|
|
|
{ 0x00000000081c0000, 0x0000000000100000, true,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ERROR_TYPE_ERAT, MCE_ERAT_ERROR_MULTIHIT, MCE_ECLASS_SOFT_INDETERMINATE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_WARNING, true },
|
2017-03-14 05:36:46 -07:00
|
|
|
{ 0x00000000081c0000, 0x0000000000140000, true,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ERROR_TYPE_TLB, MCE_TLB_ERROR_MULTIHIT, MCE_ECLASS_SOFT_INDETERMINATE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_WARNING, true },
|
2017-03-14 05:36:46 -07:00
|
|
|
{ 0x00000000081c0000, 0x0000000000180000, true,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ERROR_TYPE_UE, MCE_UE_ERROR_PAGE_TABLE_WALK_IFETCH, MCE_ECLASS_HARDWARE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
2017-05-28 23:26:44 -07:00
|
|
|
{ 0x00000000081c0000, 0x00000000001c0000, true,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ERROR_TYPE_RA, MCE_RA_ERROR_IFETCH_FOREIGN, MCE_ECLASS_SOFTWARE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
2017-03-14 05:36:46 -07:00
|
|
|
{ 0x00000000081c0000, 0x0000000008000000, true,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ERROR_TYPE_LINK, MCE_LINK_ERROR_IFETCH_TIMEOUT, MCE_ECLASS_HARDWARE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
2017-03-14 05:36:46 -07:00
|
|
|
{ 0x00000000081c0000, 0x0000000008040000, true,
|
|
|
|
MCE_ERROR_TYPE_LINK,MCE_LINK_ERROR_PAGE_TABLE_WALK_IFETCH_TIMEOUT,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ECLASS_HARDWARE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
2017-03-14 05:36:46 -07:00
|
|
|
{ 0x00000000081c0000, 0x00000000080c0000, true,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ERROR_TYPE_RA, MCE_RA_ERROR_IFETCH, MCE_ECLASS_SOFTWARE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
2017-03-14 05:36:46 -07:00
|
|
|
{ 0x00000000081c0000, 0x0000000008100000, true,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ERROR_TYPE_RA, MCE_RA_ERROR_PAGE_TABLE_WALK_IFETCH, MCE_ECLASS_SOFTWARE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
2017-03-14 05:36:46 -07:00
|
|
|
{ 0x00000000081c0000, 0x0000000008140000, false,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ERROR_TYPE_RA, MCE_RA_ERROR_STORE, MCE_ECLASS_HARDWARE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_FATAL, false }, /* ASYNC is fatal */
|
2017-03-14 05:36:46 -07:00
|
|
|
{ 0x00000000081c0000, 0x0000000008180000, false,
|
|
|
|
MCE_ERROR_TYPE_LINK,MCE_LINK_ERROR_STORE_TIMEOUT,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_FATAL, false }, /* ASYNC is fatal */
|
2019-04-29 11:16:02 -07:00
|
|
|
{ 0x00000000081c0000, 0x00000000081c0000, true, MCE_ECLASS_HARDWARE,
|
2017-03-14 05:36:46 -07:00
|
|
|
MCE_ERROR_TYPE_RA, MCE_RA_ERROR_PAGE_TABLE_WALK_IFETCH_FOREIGN,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
|
|
|
{ 0, 0, 0, 0, 0, 0, 0 } };
|
2017-03-14 05:36:46 -07:00
|
|
|
|
2020-07-02 16:33:43 -07:00
|
|
|
static const struct mce_ierror_table mce_p10_ierror_table[] = {
|
|
|
|
{ 0x00000000081c0000, 0x0000000000040000, true,
|
|
|
|
MCE_ERROR_TYPE_UE, MCE_UE_ERROR_IFETCH, MCE_ECLASS_HARDWARE,
|
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
|
|
|
{ 0x00000000081c0000, 0x0000000000080000, true,
|
|
|
|
MCE_ERROR_TYPE_SLB, MCE_SLB_ERROR_PARITY, MCE_ECLASS_HARD_INDETERMINATE,
|
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
|
|
|
{ 0x00000000081c0000, 0x00000000000c0000, true,
|
|
|
|
MCE_ERROR_TYPE_SLB, MCE_SLB_ERROR_MULTIHIT, MCE_ECLASS_SOFT_INDETERMINATE,
|
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_WARNING, true },
|
|
|
|
{ 0x00000000081c0000, 0x0000000000100000, true,
|
|
|
|
MCE_ERROR_TYPE_ERAT, MCE_ERAT_ERROR_MULTIHIT, MCE_ECLASS_SOFT_INDETERMINATE,
|
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_WARNING, true },
|
|
|
|
{ 0x00000000081c0000, 0x0000000000140000, true,
|
|
|
|
MCE_ERROR_TYPE_TLB, MCE_TLB_ERROR_MULTIHIT, MCE_ECLASS_SOFT_INDETERMINATE,
|
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_WARNING, true },
|
|
|
|
{ 0x00000000081c0000, 0x0000000000180000, true,
|
|
|
|
MCE_ERROR_TYPE_UE, MCE_UE_ERROR_PAGE_TABLE_WALK_IFETCH, MCE_ECLASS_HARDWARE,
|
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
|
|
|
{ 0x00000000081c0000, 0x00000000001c0000, true,
|
|
|
|
MCE_ERROR_TYPE_RA, MCE_RA_ERROR_IFETCH_FOREIGN, MCE_ECLASS_SOFTWARE,
|
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
|
|
|
{ 0x00000000081c0000, 0x0000000008080000, true,
|
|
|
|
MCE_ERROR_TYPE_USER,MCE_USER_ERROR_SCV, MCE_ECLASS_SOFTWARE,
|
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_WARNING, true },
|
|
|
|
{ 0x00000000081c0000, 0x00000000080c0000, true,
|
|
|
|
MCE_ERROR_TYPE_RA, MCE_RA_ERROR_IFETCH, MCE_ECLASS_SOFTWARE,
|
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
|
|
|
{ 0x00000000081c0000, 0x0000000008100000, true,
|
|
|
|
MCE_ERROR_TYPE_RA, MCE_RA_ERROR_PAGE_TABLE_WALK_IFETCH, MCE_ECLASS_SOFTWARE,
|
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
|
|
|
{ 0x00000000081c0000, 0x0000000008140000, false,
|
|
|
|
MCE_ERROR_TYPE_RA, MCE_RA_ERROR_STORE, MCE_ECLASS_HARDWARE,
|
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_FATAL, false }, /* ASYNC is fatal */
|
|
|
|
{ 0x00000000081c0000, 0x00000000081c0000, true, MCE_ECLASS_HARDWARE,
|
|
|
|
MCE_ERROR_TYPE_RA, MCE_RA_ERROR_PAGE_TABLE_WALK_IFETCH_FOREIGN,
|
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
|
|
|
{ 0, 0, 0, 0, 0, 0, 0 } };
|
|
|
|
|
2017-03-14 05:36:46 -07:00
|
|
|
struct mce_derror_table {
|
|
|
|
unsigned long dsisr_value;
|
|
|
|
bool dar_valid; /* dar is a valid indicator of faulting address */
|
|
|
|
unsigned int error_type;
|
|
|
|
unsigned int error_subtype;
|
2019-04-29 11:16:02 -07:00
|
|
|
unsigned int error_class;
|
2017-03-14 05:36:46 -07:00
|
|
|
unsigned int initiator;
|
|
|
|
unsigned int severity;
|
2019-04-29 11:15:55 -07:00
|
|
|
bool sync_error;
|
2017-03-14 05:36:46 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
static const struct mce_derror_table mce_p7_derror_table[] = {
|
|
|
|
{ 0x00008000, false,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ERROR_TYPE_UE, MCE_UE_ERROR_LOAD_STORE, MCE_ECLASS_HARDWARE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
2017-03-14 05:36:46 -07:00
|
|
|
{ 0x00004000, true,
|
|
|
|
MCE_ERROR_TYPE_UE, MCE_UE_ERROR_PAGE_TABLE_WALK_LOAD_STORE,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ECLASS_HARDWARE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
2017-03-14 05:36:46 -07:00
|
|
|
{ 0x00000800, true,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ERROR_TYPE_ERAT, MCE_ERAT_ERROR_MULTIHIT, MCE_ECLASS_SOFT_INDETERMINATE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_WARNING, true },
|
2017-03-14 05:36:46 -07:00
|
|
|
{ 0x00000400, true,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ERROR_TYPE_TLB, MCE_TLB_ERROR_MULTIHIT, MCE_ECLASS_SOFT_INDETERMINATE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_WARNING, true },
|
2018-06-13 06:24:14 -07:00
|
|
|
{ 0x00000080, true,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ERROR_TYPE_SLB, MCE_SLB_ERROR_MULTIHIT, MCE_ECLASS_SOFT_INDETERMINATE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_WARNING, true },
|
2017-03-14 05:36:46 -07:00
|
|
|
{ 0x00000100, true,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ERROR_TYPE_SLB, MCE_SLB_ERROR_PARITY, MCE_ECLASS_HARD_INDETERMINATE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
2017-03-14 05:36:46 -07:00
|
|
|
{ 0x00000040, true,
|
|
|
|
MCE_ERROR_TYPE_SLB, MCE_SLB_ERROR_INDETERMINATE, /* BOTH */
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ECLASS_HARD_INDETERMINATE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_WARNING, true },
|
|
|
|
{ 0, false, 0, 0, 0, 0, 0 } };
|
2017-03-14 05:36:46 -07:00
|
|
|
|
|
|
|
static const struct mce_derror_table mce_p8_derror_table[] = {
|
|
|
|
{ 0x00008000, false,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ERROR_TYPE_UE, MCE_UE_ERROR_LOAD_STORE, MCE_ECLASS_HARDWARE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
2017-03-14 05:36:46 -07:00
|
|
|
{ 0x00004000, true,
|
|
|
|
MCE_ERROR_TYPE_UE, MCE_UE_ERROR_PAGE_TABLE_WALK_LOAD_STORE,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ECLASS_HARDWARE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
2017-03-14 05:36:48 -07:00
|
|
|
{ 0x00002000, true,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ERROR_TYPE_LINK, MCE_LINK_ERROR_LOAD_TIMEOUT, MCE_ECLASS_HARDWARE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
2017-03-14 05:36:48 -07:00
|
|
|
{ 0x00001000, true,
|
|
|
|
MCE_ERROR_TYPE_LINK, MCE_LINK_ERROR_PAGE_TABLE_WALK_LOAD_STORE_TIMEOUT,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ECLASS_HARDWARE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
2017-03-14 05:36:46 -07:00
|
|
|
{ 0x00000800, true,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ERROR_TYPE_ERAT, MCE_ERAT_ERROR_MULTIHIT, MCE_ECLASS_SOFT_INDETERMINATE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_WARNING, true },
|
2017-03-14 05:36:46 -07:00
|
|
|
{ 0x00000400, true,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ERROR_TYPE_TLB, MCE_TLB_ERROR_MULTIHIT, MCE_ECLASS_SOFT_INDETERMINATE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_WARNING, true },
|
2017-03-14 05:36:46 -07:00
|
|
|
{ 0x00000200, true,
|
|
|
|
MCE_ERROR_TYPE_ERAT, MCE_ERAT_ERROR_MULTIHIT, /* SECONDARY ERAT */
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ECLASS_SOFT_INDETERMINATE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_WARNING, true },
|
2018-06-13 06:24:14 -07:00
|
|
|
{ 0x00000080, true,
|
|
|
|
MCE_ERROR_TYPE_SLB, MCE_SLB_ERROR_MULTIHIT, /* Before PARITY */
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ECLASS_SOFT_INDETERMINATE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_WARNING, true },
|
2017-03-14 05:36:46 -07:00
|
|
|
{ 0x00000100, true,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ERROR_TYPE_SLB, MCE_SLB_ERROR_PARITY, MCE_ECLASS_HARD_INDETERMINATE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
|
|
|
{ 0, false, 0, 0, 0, 0, 0 } };
|
2017-03-14 05:36:46 -07:00
|
|
|
|
|
|
|
static const struct mce_derror_table mce_p9_derror_table[] = {
|
|
|
|
{ 0x00008000, false,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ERROR_TYPE_UE, MCE_UE_ERROR_LOAD_STORE, MCE_ECLASS_HARDWARE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
2017-03-14 05:36:46 -07:00
|
|
|
{ 0x00004000, true,
|
|
|
|
MCE_ERROR_TYPE_UE, MCE_UE_ERROR_PAGE_TABLE_WALK_LOAD_STORE,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ECLASS_HARDWARE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
2017-03-14 05:36:46 -07:00
|
|
|
{ 0x00002000, true,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ERROR_TYPE_LINK, MCE_LINK_ERROR_LOAD_TIMEOUT, MCE_ECLASS_HARDWARE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
2017-03-14 05:36:46 -07:00
|
|
|
{ 0x00001000, true,
|
|
|
|
MCE_ERROR_TYPE_LINK, MCE_LINK_ERROR_PAGE_TABLE_WALK_LOAD_STORE_TIMEOUT,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ECLASS_HARDWARE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
2017-03-14 05:36:46 -07:00
|
|
|
{ 0x00000800, true,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ERROR_TYPE_ERAT, MCE_ERAT_ERROR_MULTIHIT, MCE_ECLASS_SOFT_INDETERMINATE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_WARNING, true },
|
2017-03-14 05:36:46 -07:00
|
|
|
{ 0x00000400, true,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ERROR_TYPE_TLB, MCE_TLB_ERROR_MULTIHIT, MCE_ECLASS_SOFT_INDETERMINATE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_WARNING, true },
|
2017-03-14 05:36:46 -07:00
|
|
|
{ 0x00000200, false,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ERROR_TYPE_USER, MCE_USER_ERROR_TLBIE, MCE_ECLASS_SOFTWARE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_WARNING, true },
|
2018-06-13 06:24:14 -07:00
|
|
|
{ 0x00000080, true,
|
|
|
|
MCE_ERROR_TYPE_SLB, MCE_SLB_ERROR_MULTIHIT, /* Before PARITY */
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ECLASS_SOFT_INDETERMINATE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_WARNING, true },
|
2017-03-14 05:36:46 -07:00
|
|
|
{ 0x00000100, true,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ERROR_TYPE_SLB, MCE_SLB_ERROR_PARITY, MCE_ECLASS_HARD_INDETERMINATE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
2017-03-14 05:36:46 -07:00
|
|
|
{ 0x00000040, true,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ERROR_TYPE_RA, MCE_RA_ERROR_LOAD, MCE_ECLASS_HARDWARE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
2017-03-14 05:36:46 -07:00
|
|
|
{ 0x00000020, false,
|
|
|
|
MCE_ERROR_TYPE_RA, MCE_RA_ERROR_PAGE_TABLE_WALK_LOAD_STORE,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ECLASS_HARDWARE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
2017-03-14 05:36:46 -07:00
|
|
|
{ 0x00000010, false,
|
|
|
|
MCE_ERROR_TYPE_RA, MCE_RA_ERROR_PAGE_TABLE_WALK_LOAD_STORE_FOREIGN,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ECLASS_HARDWARE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
2017-03-14 05:36:46 -07:00
|
|
|
{ 0x00000008, false,
|
2019-04-29 11:16:02 -07:00
|
|
|
MCE_ERROR_TYPE_RA, MCE_RA_ERROR_LOAD_STORE_FOREIGN, MCE_ECLASS_HARDWARE,
|
2019-04-29 11:15:55 -07:00
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
|
|
|
{ 0, false, 0, 0, 0, 0, 0 } };
|
2017-03-14 05:36:46 -07:00
|
|
|
|
2020-07-02 16:33:43 -07:00
|
|
|
static const struct mce_derror_table mce_p10_derror_table[] = {
|
|
|
|
{ 0x00008000, false,
|
|
|
|
MCE_ERROR_TYPE_UE, MCE_UE_ERROR_LOAD_STORE, MCE_ECLASS_HARDWARE,
|
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
|
|
|
{ 0x00004000, true,
|
|
|
|
MCE_ERROR_TYPE_UE, MCE_UE_ERROR_PAGE_TABLE_WALK_LOAD_STORE,
|
|
|
|
MCE_ECLASS_HARDWARE,
|
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
|
|
|
{ 0x00000800, true,
|
|
|
|
MCE_ERROR_TYPE_ERAT, MCE_ERAT_ERROR_MULTIHIT, MCE_ECLASS_SOFT_INDETERMINATE,
|
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_WARNING, true },
|
|
|
|
{ 0x00000400, true,
|
|
|
|
MCE_ERROR_TYPE_TLB, MCE_TLB_ERROR_MULTIHIT, MCE_ECLASS_SOFT_INDETERMINATE,
|
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_WARNING, true },
|
|
|
|
{ 0x00000200, false,
|
|
|
|
MCE_ERROR_TYPE_USER, MCE_USER_ERROR_TLBIE, MCE_ECLASS_SOFTWARE,
|
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_WARNING, true },
|
|
|
|
{ 0x00000080, true,
|
|
|
|
MCE_ERROR_TYPE_SLB, MCE_SLB_ERROR_MULTIHIT, /* Before PARITY */
|
|
|
|
MCE_ECLASS_SOFT_INDETERMINATE,
|
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_WARNING, true },
|
|
|
|
{ 0x00000100, true,
|
|
|
|
MCE_ERROR_TYPE_SLB, MCE_SLB_ERROR_PARITY, MCE_ECLASS_HARD_INDETERMINATE,
|
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
|
|
|
{ 0x00000040, true,
|
|
|
|
MCE_ERROR_TYPE_RA, MCE_RA_ERROR_LOAD, MCE_ECLASS_HARDWARE,
|
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
|
|
|
{ 0x00000020, false,
|
|
|
|
MCE_ERROR_TYPE_RA, MCE_RA_ERROR_PAGE_TABLE_WALK_LOAD_STORE,
|
|
|
|
MCE_ECLASS_HARDWARE,
|
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
|
|
|
{ 0x00000010, false,
|
|
|
|
MCE_ERROR_TYPE_RA, MCE_RA_ERROR_PAGE_TABLE_WALK_LOAD_STORE_FOREIGN,
|
|
|
|
MCE_ECLASS_HARDWARE,
|
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
|
|
|
{ 0x00000008, false,
|
|
|
|
MCE_ERROR_TYPE_RA, MCE_RA_ERROR_LOAD_STORE_FOREIGN, MCE_ECLASS_HARDWARE,
|
|
|
|
MCE_INITIATOR_CPU, MCE_SEV_SEVERE, true },
|
|
|
|
{ 0, false, 0, 0, 0, 0, 0 } };
|
|
|
|
|
2019-08-20 01:13:47 -07:00
|
|
|
static int mce_find_instr_ea_and_phys(struct pt_regs *regs, uint64_t *addr,
|
2017-09-28 21:26:53 -07:00
|
|
|
uint64_t *phys_addr)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Carefully look at the NIP to determine
|
|
|
|
* the instruction to analyse. Reading the NIP
|
|
|
|
* in real-mode is tricky and can lead to recursive
|
|
|
|
* faults
|
|
|
|
*/
|
2021-11-29 10:49:38 -07:00
|
|
|
ppc_inst_t instr;
|
2017-09-28 21:26:53 -07:00
|
|
|
unsigned long pfn, instr_addr;
|
|
|
|
struct instruction_op op;
|
|
|
|
struct pt_regs tmp = *regs;
|
|
|
|
|
|
|
|
pfn = addr_to_pfn(regs, regs->nip);
|
|
|
|
if (pfn != ULONG_MAX) {
|
|
|
|
instr_addr = (pfn << PAGE_SHIFT) + (regs->nip & ~PAGE_MASK);
|
2021-05-20 06:50:45 -07:00
|
|
|
instr = ppc_inst_read((u32 *)instr_addr);
|
2017-09-28 21:26:53 -07:00
|
|
|
if (!analyse_instr(&op, &tmp, instr)) {
|
|
|
|
pfn = addr_to_pfn(regs, op.ea);
|
|
|
|
*addr = op.ea;
|
|
|
|
*phys_addr = (pfn << PAGE_SHIFT);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* analyse_instr() might fail if the instruction
|
|
|
|
* is not a load/store, although this is unexpected
|
|
|
|
* for load/store errors or if we got the NIP
|
|
|
|
* wrong
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
*addr = 0;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2021-05-17 07:03:55 -07:00
|
|
|
static int mce_handle_ierror(struct pt_regs *regs, unsigned long srr1,
|
2017-03-14 05:36:46 -07:00
|
|
|
const struct mce_ierror_table table[],
|
2017-09-28 21:26:54 -07:00
|
|
|
struct mce_error_info *mce_err, uint64_t *addr,
|
|
|
|
uint64_t *phys_addr)
|
2013-10-30 07:35:11 -07:00
|
|
|
{
|
2017-03-14 05:36:47 -07:00
|
|
|
int handled = 0;
|
2017-03-14 05:36:46 -07:00
|
|
|
int i;
|
|
|
|
|
|
|
|
*addr = 0;
|
|
|
|
|
|
|
|
for (i = 0; table[i].srr1_mask; i++) {
|
|
|
|
if ((srr1 & table[i].srr1_mask) != table[i].srr1_value)
|
|
|
|
continue;
|
|
|
|
|
2020-11-28 00:07:22 -07:00
|
|
|
if (!mce_in_guest()) {
|
|
|
|
/* attempt to correct the error */
|
|
|
|
switch (table[i].error_type) {
|
|
|
|
case MCE_ERROR_TYPE_SLB:
|
2021-12-01 07:41:52 -07:00
|
|
|
#ifdef CONFIG_PPC_64S_HASH_MMU
|
2020-11-28 00:07:22 -07:00
|
|
|
if (local_paca->in_mce == 1)
|
|
|
|
slb_save_contents(local_paca->mce_faulty_slbs);
|
2021-12-01 07:41:52 -07:00
|
|
|
#endif
|
2020-11-28 00:07:22 -07:00
|
|
|
handled = mce_flush(MCE_FLUSH_SLB);
|
|
|
|
break;
|
|
|
|
case MCE_ERROR_TYPE_ERAT:
|
|
|
|
handled = mce_flush(MCE_FLUSH_ERAT);
|
|
|
|
break;
|
|
|
|
case MCE_ERROR_TYPE_TLB:
|
|
|
|
handled = mce_flush(MCE_FLUSH_TLB);
|
|
|
|
break;
|
|
|
|
}
|
2017-03-14 05:36:47 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* now fill in mce_error_info */
|
2017-03-14 05:36:46 -07:00
|
|
|
mce_err->error_type = table[i].error_type;
|
2019-04-29 11:16:02 -07:00
|
|
|
mce_err->error_class = table[i].error_class;
|
2017-03-14 05:36:46 -07:00
|
|
|
switch (table[i].error_type) {
|
|
|
|
case MCE_ERROR_TYPE_UE:
|
|
|
|
mce_err->u.ue_error_type = table[i].error_subtype;
|
|
|
|
break;
|
|
|
|
case MCE_ERROR_TYPE_SLB:
|
|
|
|
mce_err->u.slb_error_type = table[i].error_subtype;
|
|
|
|
break;
|
|
|
|
case MCE_ERROR_TYPE_ERAT:
|
|
|
|
mce_err->u.erat_error_type = table[i].error_subtype;
|
|
|
|
break;
|
|
|
|
case MCE_ERROR_TYPE_TLB:
|
|
|
|
mce_err->u.tlb_error_type = table[i].error_subtype;
|
|
|
|
break;
|
|
|
|
case MCE_ERROR_TYPE_USER:
|
|
|
|
mce_err->u.user_error_type = table[i].error_subtype;
|
|
|
|
break;
|
|
|
|
case MCE_ERROR_TYPE_RA:
|
|
|
|
mce_err->u.ra_error_type = table[i].error_subtype;
|
|
|
|
break;
|
|
|
|
case MCE_ERROR_TYPE_LINK:
|
|
|
|
mce_err->u.link_error_type = table[i].error_subtype;
|
|
|
|
break;
|
|
|
|
}
|
2019-04-29 11:15:55 -07:00
|
|
|
mce_err->sync_error = table[i].sync_error;
|
2017-03-14 05:36:46 -07:00
|
|
|
mce_err->severity = table[i].severity;
|
|
|
|
mce_err->initiator = table[i].initiator;
|
2020-11-28 00:07:22 -07:00
|
|
|
if (table[i].nip_valid && !mce_in_guest()) {
|
2017-03-14 05:36:46 -07:00
|
|
|
*addr = regs->nip;
|
2019-04-29 11:15:55 -07:00
|
|
|
if (mce_err->sync_error &&
|
2017-09-28 21:26:54 -07:00
|
|
|
table[i].error_type == MCE_ERROR_TYPE_UE) {
|
|
|
|
unsigned long pfn;
|
|
|
|
|
|
|
|
if (get_paca()->in_mce < MAX_MCE_DEPTH) {
|
|
|
|
pfn = addr_to_pfn(regs, regs->nip);
|
|
|
|
if (pfn != ULONG_MAX) {
|
|
|
|
*phys_addr =
|
|
|
|
(pfn << PAGE_SHIFT);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-03-14 05:36:47 -07:00
|
|
|
return handled;
|
2013-10-30 07:35:11 -07:00
|
|
|
}
|
|
|
|
|
2017-03-14 05:36:46 -07:00
|
|
|
mce_err->error_type = MCE_ERROR_TYPE_UNKNOWN;
|
2019-04-29 11:16:02 -07:00
|
|
|
mce_err->error_class = MCE_ECLASS_UNKNOWN;
|
2019-04-29 11:15:55 -07:00
|
|
|
mce_err->severity = MCE_SEV_SEVERE;
|
2017-03-14 05:36:46 -07:00
|
|
|
mce_err->initiator = MCE_INITIATOR_CPU;
|
2019-04-29 11:15:55 -07:00
|
|
|
mce_err->sync_error = true;
|
2017-03-14 05:36:47 -07:00
|
|
|
|
|
|
|
return 0;
|
2013-10-30 07:35:40 -07:00
|
|
|
}
|
|
|
|
|
2017-03-14 05:36:47 -07:00
|
|
|
static int mce_handle_derror(struct pt_regs *regs,
|
2017-03-14 05:36:46 -07:00
|
|
|
const struct mce_derror_table table[],
|
2017-09-28 21:26:53 -07:00
|
|
|
struct mce_error_info *mce_err, uint64_t *addr,
|
|
|
|
uint64_t *phys_addr)
|
2013-10-30 07:35:40 -07:00
|
|
|
{
|
2017-03-14 05:36:46 -07:00
|
|
|
uint64_t dsisr = regs->dsisr;
|
2017-03-14 05:36:47 -07:00
|
|
|
int handled = 0;
|
|
|
|
int found = 0;
|
2017-03-14 05:36:46 -07:00
|
|
|
int i;
|
|
|
|
|
|
|
|
*addr = 0;
|
|
|
|
|
|
|
|
for (i = 0; table[i].dsisr_value; i++) {
|
|
|
|
if (!(dsisr & table[i].dsisr_value))
|
|
|
|
continue;
|
|
|
|
|
2020-11-28 00:07:22 -07:00
|
|
|
if (!mce_in_guest()) {
|
|
|
|
/* attempt to correct the error */
|
|
|
|
switch (table[i].error_type) {
|
|
|
|
case MCE_ERROR_TYPE_SLB:
|
2021-12-01 07:41:52 -07:00
|
|
|
#ifdef CONFIG_PPC_64S_HASH_MMU
|
2020-11-28 00:07:22 -07:00
|
|
|
if (local_paca->in_mce == 1)
|
|
|
|
slb_save_contents(local_paca->mce_faulty_slbs);
|
2021-12-01 07:41:52 -07:00
|
|
|
#endif
|
2020-11-28 00:07:22 -07:00
|
|
|
if (mce_flush(MCE_FLUSH_SLB))
|
|
|
|
handled = 1;
|
|
|
|
break;
|
|
|
|
case MCE_ERROR_TYPE_ERAT:
|
|
|
|
if (mce_flush(MCE_FLUSH_ERAT))
|
|
|
|
handled = 1;
|
|
|
|
break;
|
|
|
|
case MCE_ERROR_TYPE_TLB:
|
|
|
|
if (mce_flush(MCE_FLUSH_TLB))
|
|
|
|
handled = 1;
|
|
|
|
break;
|
|
|
|
}
|
2017-03-14 05:36:47 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Attempt to handle multiple conditions, but only return
|
|
|
|
* one. Ensure uncorrectable errors are first in the table
|
|
|
|
* to match.
|
|
|
|
*/
|
|
|
|
if (found)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/* now fill in mce_error_info */
|
2017-03-14 05:36:46 -07:00
|
|
|
mce_err->error_type = table[i].error_type;
|
2019-04-29 11:16:02 -07:00
|
|
|
mce_err->error_class = table[i].error_class;
|
2017-03-14 05:36:46 -07:00
|
|
|
switch (table[i].error_type) {
|
|
|
|
case MCE_ERROR_TYPE_UE:
|
|
|
|
mce_err->u.ue_error_type = table[i].error_subtype;
|
|
|
|
break;
|
|
|
|
case MCE_ERROR_TYPE_SLB:
|
|
|
|
mce_err->u.slb_error_type = table[i].error_subtype;
|
|
|
|
break;
|
|
|
|
case MCE_ERROR_TYPE_ERAT:
|
|
|
|
mce_err->u.erat_error_type = table[i].error_subtype;
|
|
|
|
break;
|
|
|
|
case MCE_ERROR_TYPE_TLB:
|
|
|
|
mce_err->u.tlb_error_type = table[i].error_subtype;
|
|
|
|
break;
|
|
|
|
case MCE_ERROR_TYPE_USER:
|
|
|
|
mce_err->u.user_error_type = table[i].error_subtype;
|
|
|
|
break;
|
|
|
|
case MCE_ERROR_TYPE_RA:
|
|
|
|
mce_err->u.ra_error_type = table[i].error_subtype;
|
|
|
|
break;
|
|
|
|
case MCE_ERROR_TYPE_LINK:
|
|
|
|
mce_err->u.link_error_type = table[i].error_subtype;
|
|
|
|
break;
|
|
|
|
}
|
2019-04-29 11:15:55 -07:00
|
|
|
mce_err->sync_error = table[i].sync_error;
|
2017-03-14 05:36:46 -07:00
|
|
|
mce_err->severity = table[i].severity;
|
|
|
|
mce_err->initiator = table[i].initiator;
|
|
|
|
if (table[i].dar_valid)
|
|
|
|
*addr = regs->dar;
|
2020-11-28 00:07:22 -07:00
|
|
|
else if (mce_err->sync_error && !mce_in_guest() &&
|
2017-09-28 21:26:53 -07:00
|
|
|
table[i].error_type == MCE_ERROR_TYPE_UE) {
|
|
|
|
/*
|
|
|
|
* We do a maximum of 4 nested MCE calls, see
|
|
|
|
* kernel/exception-64s.h
|
|
|
|
*/
|
|
|
|
if (get_paca()->in_mce < MAX_MCE_DEPTH)
|
2019-08-20 01:13:47 -07:00
|
|
|
mce_find_instr_ea_and_phys(regs, addr,
|
|
|
|
phys_addr);
|
2017-09-28 21:26:53 -07:00
|
|
|
}
|
2017-03-14 05:36:47 -07:00
|
|
|
found = 1;
|
2013-10-30 07:35:40 -07:00
|
|
|
}
|
2017-03-14 05:36:46 -07:00
|
|
|
|
2017-03-14 05:36:47 -07:00
|
|
|
if (found)
|
|
|
|
return handled;
|
|
|
|
|
2017-03-14 05:36:46 -07:00
|
|
|
mce_err->error_type = MCE_ERROR_TYPE_UNKNOWN;
|
2019-04-29 11:16:02 -07:00
|
|
|
mce_err->error_class = MCE_ECLASS_UNKNOWN;
|
2019-04-29 11:15:55 -07:00
|
|
|
mce_err->severity = MCE_SEV_SEVERE;
|
2017-03-14 05:36:46 -07:00
|
|
|
mce_err->initiator = MCE_INITIATOR_CPU;
|
2019-04-29 11:15:55 -07:00
|
|
|
mce_err->sync_error = true;
|
2017-03-14 05:36:47 -07:00
|
|
|
|
|
|
|
return 0;
|
2013-10-30 07:35:40 -07:00
|
|
|
}
|
|
|
|
|
2019-08-20 01:13:50 -07:00
|
|
|
static long mce_handle_ue_error(struct pt_regs *regs,
|
|
|
|
struct mce_error_info *mce_err)
|
2013-12-15 22:16:24 -07:00
|
|
|
{
|
2020-11-28 00:07:22 -07:00
|
|
|
if (mce_in_guest())
|
|
|
|
return 0;
|
2019-08-20 01:13:50 -07:00
|
|
|
|
2020-03-26 11:49:16 -07:00
|
|
|
mce_common_process_ue(regs, mce_err);
|
|
|
|
if (mce_err->ignore_event)
|
2019-08-20 01:13:50 -07:00
|
|
|
return 1;
|
2013-12-15 22:16:24 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* On specific SCOM read via MMIO we may get a machine check
|
|
|
|
* exception with SRR0 pointing inside opal. If that is the
|
|
|
|
* case OPAL may have recovery address to re-read SCOM data in
|
|
|
|
* different way and hence we can recover from this MC.
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (ppc_md.mce_check_early_recovery) {
|
|
|
|
if (ppc_md.mce_check_early_recovery(regs))
|
2020-11-28 00:07:22 -07:00
|
|
|
return 1;
|
2013-12-15 22:16:24 -07:00
|
|
|
}
|
2020-11-28 00:07:22 -07:00
|
|
|
|
|
|
|
return 0;
|
2013-12-15 22:16:24 -07:00
|
|
|
}
|
|
|
|
|
2017-03-14 05:36:47 -07:00
|
|
|
static long mce_handle_error(struct pt_regs *regs,
|
2021-05-17 07:03:55 -07:00
|
|
|
unsigned long srr1,
|
2017-03-14 05:36:47 -07:00
|
|
|
const struct mce_derror_table dtable[],
|
|
|
|
const struct mce_ierror_table itable[])
|
2013-10-30 07:35:11 -07:00
|
|
|
{
|
2017-03-14 05:36:47 -07:00
|
|
|
struct mce_error_info mce_err = { 0 };
|
2018-04-22 21:59:27 -07:00
|
|
|
uint64_t addr, phys_addr = ULONG_MAX;
|
2017-03-14 05:36:47 -07:00
|
|
|
long handled;
|
2013-10-30 07:35:11 -07:00
|
|
|
|
2017-03-14 05:36:47 -07:00
|
|
|
if (SRR1_MC_LOADSTORE(srr1))
|
2017-09-28 21:26:53 -07:00
|
|
|
handled = mce_handle_derror(regs, dtable, &mce_err, &addr,
|
|
|
|
&phys_addr);
|
2017-03-14 05:36:47 -07:00
|
|
|
else
|
2021-05-17 07:03:55 -07:00
|
|
|
handled = mce_handle_ierror(regs, srr1, itable, &mce_err, &addr,
|
2017-09-28 21:26:54 -07:00
|
|
|
&phys_addr);
|
2017-03-14 05:36:46 -07:00
|
|
|
|
2017-03-14 05:36:47 -07:00
|
|
|
if (!handled && mce_err.error_type == MCE_ERROR_TYPE_UE)
|
2019-08-20 01:13:50 -07:00
|
|
|
handled = mce_handle_ue_error(regs, &mce_err);
|
2013-12-15 22:16:24 -07:00
|
|
|
|
2017-09-28 21:26:53 -07:00
|
|
|
save_mce_event(regs, handled, &mce_err, regs->nip, addr, phys_addr);
|
2013-12-15 22:16:24 -07:00
|
|
|
|
2013-10-30 07:35:26 -07:00
|
|
|
return handled;
|
|
|
|
}
|
2017-02-27 19:00:48 -07:00
|
|
|
|
2017-03-14 05:36:47 -07:00
|
|
|
long __machine_check_early_realmode_p7(struct pt_regs *regs)
|
2017-02-27 19:00:48 -07:00
|
|
|
{
|
2017-03-14 05:36:47 -07:00
|
|
|
/* P7 DD1 leaves top bits of DSISR undefined */
|
|
|
|
regs->dsisr &= 0x0000ffff;
|
2017-02-27 19:00:48 -07:00
|
|
|
|
2021-05-17 07:03:55 -07:00
|
|
|
return mce_handle_error(regs, regs->msr,
|
|
|
|
mce_p7_derror_table, mce_p7_ierror_table);
|
2017-02-27 19:00:48 -07:00
|
|
|
}
|
|
|
|
|
2017-03-14 05:36:47 -07:00
|
|
|
long __machine_check_early_realmode_p8(struct pt_regs *regs)
|
2017-02-27 19:00:48 -07:00
|
|
|
{
|
2021-05-17 07:03:55 -07:00
|
|
|
return mce_handle_error(regs, regs->msr,
|
|
|
|
mce_p8_derror_table, mce_p8_ierror_table);
|
2017-02-27 19:00:48 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
long __machine_check_early_realmode_p9(struct pt_regs *regs)
|
|
|
|
{
|
2021-05-17 07:03:55 -07:00
|
|
|
unsigned long srr1 = regs->msr;
|
|
|
|
|
2017-09-21 20:32:21 -07:00
|
|
|
/*
|
|
|
|
* On POWER9 DD2.1 and below, it's possible to get a machine check
|
2017-09-28 20:37:35 -07:00
|
|
|
* caused by a paste instruction where only DSISR bit 25 is set. This
|
2017-09-21 20:32:21 -07:00
|
|
|
* will result in the MCE handler seeing an unknown event and the kernel
|
|
|
|
* crashing. An MCE that occurs like this is spurious, so we don't need
|
|
|
|
* to do anything in terms of servicing it. If there is something that
|
|
|
|
* needs to be serviced, the CPU will raise the MCE again with the
|
|
|
|
* correct DSISR so that it can be serviced properly. So detect this
|
|
|
|
* case and mark it as handled.
|
|
|
|
*/
|
2017-09-28 20:37:35 -07:00
|
|
|
if (SRR1_MC_LOADSTORE(regs->msr) && regs->dsisr == 0x02000000)
|
2017-09-21 20:32:21 -07:00
|
|
|
return 1;
|
|
|
|
|
2021-05-17 07:03:55 -07:00
|
|
|
/*
|
|
|
|
* Async machine check due to bad real address from store or foreign
|
|
|
|
* link time out comes with the load/store bit (PPC bit 42) set in
|
|
|
|
* SRR1, but the cause comes in SRR1 not DSISR. Clear bit 42 so we're
|
|
|
|
* directed to the ierror table so it will find the cause (which
|
|
|
|
* describes it correctly as a store error).
|
|
|
|
*/
|
|
|
|
if (SRR1_MC_LOADSTORE(srr1) &&
|
|
|
|
((srr1 & 0x081c0000) == 0x08140000 ||
|
|
|
|
(srr1 & 0x081c0000) == 0x08180000)) {
|
|
|
|
srr1 &= ~PPC_BIT(42);
|
|
|
|
}
|
|
|
|
|
|
|
|
return mce_handle_error(regs, srr1,
|
|
|
|
mce_p9_derror_table, mce_p9_ierror_table);
|
2017-02-27 19:00:48 -07:00
|
|
|
}
|
2020-07-02 16:33:43 -07:00
|
|
|
|
|
|
|
long __machine_check_early_realmode_p10(struct pt_regs *regs)
|
|
|
|
{
|
2021-05-17 07:03:55 -07:00
|
|
|
unsigned long srr1 = regs->msr;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Async machine check due to bad real address from store comes with
|
|
|
|
* the load/store bit (PPC bit 42) set in SRR1, but the cause comes in
|
|
|
|
* SRR1 not DSISR. Clear bit 42 so we're directed to the ierror table
|
|
|
|
* so it will find the cause (which describes it correctly as a store
|
|
|
|
* error).
|
|
|
|
*/
|
|
|
|
if (SRR1_MC_LOADSTORE(srr1) &&
|
|
|
|
(srr1 & 0x081c0000) == 0x08140000) {
|
|
|
|
srr1 &= ~PPC_BIT(42);
|
|
|
|
}
|
|
|
|
|
|
|
|
return mce_handle_error(regs, srr1,
|
|
|
|
mce_p10_derror_table, mce_p10_ierror_table);
|
2020-07-02 16:33:43 -07:00
|
|
|
}
|