Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5460595pxb; Wed, 26 Jan 2022 12:30:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJx6AiiKLnpOdzHnzuyU+S7rGyaZmkNCI4Sd340N6M2VrA7W9Vn4HWYhIbjsD163s7lC+Ncc X-Received: by 2002:a05:6a00:1702:: with SMTP id h2mr17972pfc.39.1643229052100; Wed, 26 Jan 2022 12:30:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643229052; cv=none; d=google.com; s=arc-20160816; b=ynMNGU4LSNc7NMr1ZP5V3NUuM+2SWv/RTe4csf6OFa5JYwPVizXfBFdSVbYZ5lCmkV mVwPUucuTJvYi/ORIh3ZT2Fr5nAnPeCQvf2KfQLkpkuiy2vA8hLfRa8Nlm3VJg0exQCD hLl8eQycJs2BshbtkCL/RolfJPjhcT6emPnvxIbBT9cI2eiEGyVu7oi9Kn62bQpItvco DOMD/7on3YHkLI8yHkVvb5/2DkkWu57PAwWZkFlhIAOk0NQqkoPhzm1AJq0L92iJmy/P rQ/I+FWfxWEuGjOdX2CrMcnIR+j+ahPuLe93wzQL+PPfcB1uxjqFXRPwfxUI5DwGW0G5 ROOw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=9No56YGH+cCZayimhLsHHbA53/VkzlJwXtYBRcOVoZ8=; b=yy12U+hiz6onX1/xAIw+/sgZBicWGs8Wzd/pexCXwubzaeBgrs/0iryn2Thge75cI+ h4RznLQ4DL8DTU86B8k9muaiLqfsem0k24/EDl643lOGLiF9y0+FsRSyFuIYGlfKS7kd dL/a761uKxaqZxrr7kjY1euKuEjjUQggoIejado9Ib4xVK+hbGJo3R8SzRy7SKcFb2dE EIhTfq1egsLCbkS/SVmQwVIupTAOwgsPuSkNnO/vq3sBkq8uCSM8FcMuL6Spm3zPTKqC nV6OPsbwt/H99DYza0KGIwIaS1ejdkyBqdXgXkg9hdeeSNQ/1xtytfzzI9f1e9FuIfvH 9iHA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m7si188953pfd.342.2022.01.26.12.30.39; Wed, 26 Jan 2022 12:30:52 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238290AbiAZIRO (ORCPT + 99 others); Wed, 26 Jan 2022 03:17:14 -0500 Received: from out199-4.us.a.mail.aliyun.com ([47.90.199.4]:21795 "EHLO out199-4.us.a.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238271AbiAZIRL (ORCPT ); Wed, 26 Jan 2022 03:17:11 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R191e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04395;MF=xueshuai@linux.alibaba.com;NM=1;PH=DS;RN=12;SR=0;TI=SMTPD_---0V2uWA3k_1643185024; Received: from localhost.localdomain(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0V2uWA3k_1643185024) by smtp.aliyun-inc.com(127.0.0.1); Wed, 26 Jan 2022 16:17:06 +0800 From: Shuai Xue To: bp@alien8.de, rric@kernel.org Cc: mchehab@kernel.org, tony.luck@intel.com, james.morse@arm.com, ardb@kernel.org, linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org, xueshuai@linux.alibaba.com, zhangliguang@linux.alibaba.com, zhuo.song@linux.alibaba.com Subject: [PATCH v5 0/2] EDAC/ghes: refactor memory error reporting to avoid code duplication Date: Wed, 26 Jan 2022 16:17:00 +0800 Message-Id: <20220126081702.55167-1-xueshuai@linux.alibaba.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20211210134019.28536-1-xueshuai@linux.alibaba.com> References: <20211210134019.28536-1-xueshuai@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ghes_edac_report_mem_error() in ghes_edac.c is a Long Method and have Duplicated Code with cper_mem_err_location(), cper_dimm_err_location(), and cper_mem_err_type_str() in drivers/firmware/efi/cper.c. In addition, the cper_print_mem() in drivers/firmware/efi/cper.c only reports the error status and misses its description. This patch set is to refactor ghes_edac_report_mem_error with: - Patch 01 is to wrap up error status decoding logics and reuse it in cper_print_mem(). - Patch 02 is to introduces cper_*(), into ghes_edac_report_mem_error(), this can avoid bunch of duplicate code lines; Changes since v4: - Fix alignment and format problem - Link: https://lore.kernel.org/all/20220125024939.30635-1-xueshuai@linux.alibaba.com/ - Thanks Borislav Petkov for review comments. Changes since v3: - make cper_mem_err_status_str table a lot more compact - Fix alignment and format problem - Link: https://lore.kernel.org/all/20220124024759.19176-1-xueshuai@linux.alibaba.com/ - Thanks Borislav Petkov for review comments. Changes since v2: - delete the unified patch - adjusted the order of patches - Link: https://lore.kernel.org/all/20211210134019.28536-1-xueshuai@linux.alibaba.com/ - Thanks Borislav Petkov for review comments. Changes since v1: - add a new patch to unify ghes and cper before removing duplication. - document the changes in patch description - add EXPORT_SYMBOL_GPL()s for cper_*() - document and the dependency and add UEFI_CPER dependency explicitly - Link: https://lore.kernel.org/all/20211207031905.61906-2-xueshuai@linux.alibaba.com/ - Thanks Robert Richter for review comments. Shuai Xue (2): efi/cper: add cper_mem_err_status_str to decode error description EDAC/ghes: use cper functions to avoid code duplication drivers/edac/Kconfig | 1 + drivers/edac/ghes_edac.c | 196 +++++++----------------------------- drivers/firmware/efi/cper.c | 66 ++++++++---- include/linux/cper.h | 3 + 4 files changed, 86 insertions(+), 180 deletions(-) -- 2.20.1.12.g72788fdb