Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp2832086pxv; Mon, 12 Jul 2021 03:03:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwlaY4yJVAvAEQsvy5yXRARVelDc0Ye54ARljgWwVRALn+S/Ug3QP4VK89Cqy+R3YmUtw/B X-Received: by 2002:a5e:9309:: with SMTP id k9mr24173748iom.207.1626084199207; Mon, 12 Jul 2021 03:03:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626084199; cv=none; d=google.com; s=arc-20160816; b=BYQ2TDUT/NC+N5P/bx8GkbzecSw7zISq4yHMtNS1O5xMHGJd/ZabSpOHkh5BbsKExr /wnDv3yB3UIUafo6cR/Y/I1LrSnvLzQcS/QxLPvUFoPjg9xVoUXW7Ng+CjWUjQTir/OX GRgG+LuvcT3HRBw+FoknljI1Is5v73UN6RJl3roGenH7AZZG2zMbPL+dDzdQwrUQaI22 1pCZgRaTkMHfl6n/OqeSD6ISl9HaePZjTSl+forAhHxggS8C0oH18JUGblyOelPtF6xB DmWhXiW2ignUfcFVAZYkwILWp789aUHxNrDB7PInDRm04bkeAXGXT14LImN1885wuSgQ 9eIw== 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=zxco0/QWLae2R54MxYp7SCYazz8jeT3YuDrzhfeNFQE=; b=zxbUugCRImbjScj1VotQmjPTXZflXYNuhnEpS424htrphLqmvSMBvF9Ph72VKqJJNP Tfm7+oHutpqC4usOtlk3s3EjvuOOhHujTKbnzzJKTKWnXxqpMOpwoZ7RqQG2NzSVdkJi k15n8yn+I8v9FH/mWv7zgybMiIEQg2ZdxA8eIOr4TJEhXX1vW7VutVVGpSHVMaV8S/7Q ObS9l9hFRtNpvrKHjNxd04KHP23kKiv4syIKAIEafQiVIeFDVc1pzXFgzta8fPiQTz0K HXTPKGUElaFlf95nCNiEmWRdsb1uTT6cqohj+lDnut2OLOlC8tAclHQnLOtDAM7iFVM+ Jvew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WD9Vw7wF; 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 t6si18952494iov.63.2021.07.12.03.03.07; Mon, 12 Jul 2021 03:03:19 -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=WD9Vw7wF; 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 S243358AbhGLHQE (ORCPT + 99 others); Mon, 12 Jul 2021 03:16:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:51706 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240784AbhGLGwS (ORCPT ); Mon, 12 Jul 2021 02:52:18 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 13EEF6052B; Mon, 12 Jul 2021 06:49:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626072569; bh=qISd2itnW+T43mWHy0PPBAJvHQVpaZ22zjwLMsS+v7c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WD9Vw7wFMPww7MFaSloKYbZxyXDEpJvCgsh8ISVyEvrufcO4Ad0RzNl1QG7zsCcZe ClSXV35MSOA/iyQSFw/5bwb1TZoWk7XEqE/YwWyRKWrcLzyshoiXXThD60uE56AjPG E6kT+d/g3XMLeb+WtRyquRSkPhT+NSpNEVOZyRtE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicholas Piggin , Michael Ellerman , Sasha Levin Subject: [PATCH 5.10 541/593] powerpc/powernv: Fix machine check reporting of async store errors Date: Mon, 12 Jul 2021 08:11:41 +0200 Message-Id: <20210712060953.467094121@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210712060843.180606720@linuxfoundation.org> References: <20210712060843.180606720@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: Nicholas Piggin [ Upstream commit 3729e0ec59a20825bd4c8c70996b2df63915e1dd ] POWER9 and POWER10 asynchronous machine checks due to stores have their cause reported in SRR1 but SRR1[42] is set, which in other cases indicates DSISR cause. Check for these cases and clear SRR1[42], so the cause matching uses the i-side (SRR1) table. Fixes: 7b9f71f974a1 ("powerpc/64s: POWER9 machine check handler") Fixes: 201220bb0e8c ("powerpc/powernv: Machine check handler for POWER10") Signed-off-by: Nicholas Piggin Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20210517140355.2325406-1-npiggin@gmail.com Signed-off-by: Sasha Levin --- arch/powerpc/kernel/mce_power.c | 48 +++++++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/kernel/mce_power.c b/arch/powerpc/kernel/mce_power.c index b7e173754a2e..ea8b002820ce 100644 --- a/arch/powerpc/kernel/mce_power.c +++ b/arch/powerpc/kernel/mce_power.c @@ -475,12 +475,11 @@ static int mce_find_instr_ea_and_phys(struct pt_regs *regs, uint64_t *addr, return -1; } -static int mce_handle_ierror(struct pt_regs *regs, +static int mce_handle_ierror(struct pt_regs *regs, unsigned long srr1, const struct mce_ierror_table table[], struct mce_error_info *mce_err, uint64_t *addr, uint64_t *phys_addr) { - uint64_t srr1 = regs->msr; int handled = 0; int i; @@ -683,19 +682,19 @@ static long mce_handle_ue_error(struct pt_regs *regs, } static long mce_handle_error(struct pt_regs *regs, + unsigned long srr1, const struct mce_derror_table dtable[], const struct mce_ierror_table itable[]) { struct mce_error_info mce_err = { 0 }; uint64_t addr, phys_addr = ULONG_MAX; - uint64_t srr1 = regs->msr; long handled; if (SRR1_MC_LOADSTORE(srr1)) handled = mce_handle_derror(regs, dtable, &mce_err, &addr, &phys_addr); else - handled = mce_handle_ierror(regs, itable, &mce_err, &addr, + handled = mce_handle_ierror(regs, srr1, itable, &mce_err, &addr, &phys_addr); if (!handled && mce_err.error_type == MCE_ERROR_TYPE_UE) @@ -711,16 +710,20 @@ long __machine_check_early_realmode_p7(struct pt_regs *regs) /* P7 DD1 leaves top bits of DSISR undefined */ regs->dsisr &= 0x0000ffff; - return mce_handle_error(regs, mce_p7_derror_table, mce_p7_ierror_table); + return mce_handle_error(regs, regs->msr, + mce_p7_derror_table, mce_p7_ierror_table); } long __machine_check_early_realmode_p8(struct pt_regs *regs) { - return mce_handle_error(regs, mce_p8_derror_table, mce_p8_ierror_table); + return mce_handle_error(regs, regs->msr, + mce_p8_derror_table, mce_p8_ierror_table); } long __machine_check_early_realmode_p9(struct pt_regs *regs) { + unsigned long srr1 = regs->msr; + /* * On POWER9 DD2.1 and below, it's possible to get a machine check * caused by a paste instruction where only DSISR bit 25 is set. This @@ -734,10 +737,39 @@ long __machine_check_early_realmode_p9(struct pt_regs *regs) if (SRR1_MC_LOADSTORE(regs->msr) && regs->dsisr == 0x02000000) return 1; - return mce_handle_error(regs, mce_p9_derror_table, mce_p9_ierror_table); + /* + * 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); } long __machine_check_early_realmode_p10(struct pt_regs *regs) { - return mce_handle_error(regs, mce_p10_derror_table, mce_p10_ierror_table); + 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); } -- 2.30.2