From patchwork Wed Sep 19 01:59:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fan Wu X-Patchwork-Id: 10605133 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 908486CB for ; Wed, 19 Sep 2018 01:59:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 78A912BC7F for ; Wed, 19 Sep 2018 01:59:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6AF072BD0A; Wed, 19 Sep 2018 01:59:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E89A22BC7F for ; Wed, 19 Sep 2018 01:59:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=ygAmsfobSiWDCzlRPC3R1dR42OuKrcIHfdqkT2fmOIk=; b=Hsj HWTtBfrhQDDTR+LWC09gy5mso3aNI5/XrtloMIQy5HMAzpoFP2NAEcG6BkfTb2ypX/Tc8tb2CUJex 2KVhSX9SDX78I58gtH0N1m7Bqm377r3UZTHKwpI9s6DOV2xV9cbhwGxyv5KpIFhcEOratjFUjfZd/ CNsGqRzKQ0s+8StH4BuqPq+zy9FuTVNm7IwwfAOhF6+U4khRCEYGTVP8TrABzsy1IhjmfavunC4NY yb5dALbIdUObOrSAAQBRLU4KgyaBPCG0UlhbFpyacVrd+/XOBopwYEy2GnovTA1TnRraAyBx2rzFq kWDthUlXLwUWlM4EhVyLnNTCKbTnz2g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g2Rly-0005CX-9y; Wed, 19 Sep 2018 01:59:22 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g2Rlt-0005BP-KI for linux-arm-kernel@lists.infradead.org; Wed, 19 Sep 2018 01:59:19 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id C183460721; Wed, 19 Sep 2018 01:59:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1537322346; bh=8heZ/jqPLgE7HY6ugtZQRuHjt39wuhlumsV9TdOVoyI=; h=From:To:Cc:Subject:Date:From; b=P0jco0JdK3UzmmDtlmAINrtp60WZa1UmuQYi4LTTIag5zgxUWHDD12BYuy3EryxWI ubznTKgB5EdhBymcK5Af/TAlEbKWCUNfcRHT+cOCv82qneR3uSFurxKnbYFSAMkFQb idnY3U/ftTkDrzz4GTpeoN5p5/AFZmo+0Y3Mr/pU= Received: from controller.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: wufan@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 78C0D60721; Wed, 19 Sep 2018 01:59:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1537322345; bh=8heZ/jqPLgE7HY6ugtZQRuHjt39wuhlumsV9TdOVoyI=; h=From:To:Cc:Subject:Date:From; b=cEeR+FEmKXF1d52EgUcaiEsT87AzADN8rIpby+pt5/GTNQvtUSSIUHaUGw9HfrLDh IM9eRj527deVZghVbcuJxrvczbJhakSJGbZL3imaMB7cXQ8x3ajNrWMNQgJC9BbQv7 GXsQToz4rs2bZDK5F5TRR3O/tQ6eWjYfK3nk4nQo= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 78C0D60721 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=wufan@codeaurora.org From: Fan Wu To: mchehab@kernel.org Subject: [PATCH v5] EDAC, ghes: use CPER module handles to locate DIMMs Date: Wed, 19 Sep 2018 01:59:00 +0000 Message-Id: <1537322340-1860-1-git-send-email-wufan@codeaurora.org> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180918_185917_712675_021E6575 X-CRM114-Status: GOOD ( 15.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fan Wu , toshi.kani@hpe.com, baicar.tyler@gmail.com, john.garry@huawei.com, linux-kernel@vger.kernel.org, tanxiaofei@huawei.com, james.morse@arm.com, wanghuiqiang@huawei.com, bp@alien8.de, shiju.jose@huawei.com, linux-arm-kernel@lists.infradead.org, linux-edac@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP For platforms whose firmwares provide valid module handles (SMBIOS type 17) in error records, this patch uses the module handles to locate corresponding DIMMs and enables per-DIMM error counter update. Signed-off-by: Fan Wu Reviewed-by: Tyler Baicar Reviewed-by: James Morse Tested-by: Toshi Kani --- Changes from v4: Changes from v3: * Updated Reviewed-by list Changes from v2: * Fixed coding style glitch * Added Tested-by/Reviewed-by Changes from v1: * Changed the new function name to get_dimm_smbios_index * Removed unnecessary checks inside get_dimm_smbios_index * Reverted the change of the DMI handle print * Updated commit message --- drivers/edac/ghes_edac.c | 23 +++++++++++++++++++++++ include/linux/edac.h | 2 ++ 2 files changed, 25 insertions(+) diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c index 473aeec..ba46160 100644 --- a/drivers/edac/ghes_edac.c +++ b/drivers/edac/ghes_edac.c @@ -81,6 +81,18 @@ static void ghes_edac_count_dimms(const struct dmi_header *dh, void *arg) (*num_dimm)++; } +static int get_dimm_smbios_index(u16 handle) +{ + int i; + struct mem_ctl_info *mci = ghes_pvt->mci; + + for (i = 0; i < mci->tot_dimms; i++) { + if (mci->dimms[i]->smbios_handle == handle) + return i; + } + return -1; +} + static void ghes_edac_dmidecode(const struct dmi_header *dh, void *arg) { struct ghes_edac_dimm_fill *dimm_fill = arg; @@ -177,6 +189,8 @@ static void ghes_edac_dmidecode(const struct dmi_header *dh, void *arg) entry->total_width, entry->data_width); } + dimm->smbios_handle = entry->handle; + dimm_fill->count++; } } @@ -327,12 +341,21 @@ void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err) p += sprintf(p, "bit_pos:%d ", mem_err->bit_pos); if (mem_err->validation_bits & CPER_MEM_VALID_MODULE_HANDLE) { const char *bank = NULL, *device = NULL; + int index = -1; + dmi_memdev_name(mem_err->mem_dev_handle, &bank, &device); if (bank != NULL && device != NULL) p += sprintf(p, "DIMM location:%s %s ", bank, device); else p += sprintf(p, "DIMM DMI handle: 0x%.4x ", mem_err->mem_dev_handle); + + index = get_dimm_smbios_index(mem_err->mem_dev_handle); + if (index >= 0) { + e->top_layer = index; + e->enable_per_layer_report = true; + } + } if (p > e->location) *(p - 1) = '\0'; diff --git a/include/linux/edac.h b/include/linux/edac.h index bffb978..a45ce1f 100644 --- a/include/linux/edac.h +++ b/include/linux/edac.h @@ -451,6 +451,8 @@ struct dimm_info { u32 nr_pages; /* number of pages on this dimm */ unsigned csrow, cschannel; /* Points to the old API data */ + + u16 smbios_handle; /* Handle for SMBIOS type 17 */ }; /**