From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76E79C3DA4B for ; Wed, 17 Jul 2024 13:08:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9EA6C6B008C; Wed, 17 Jul 2024 09:08:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 998F16B0093; Wed, 17 Jul 2024 09:08:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 860EA6B0096; Wed, 17 Jul 2024 09:08:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 687B86B008C for ; Wed, 17 Jul 2024 09:08:22 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 1A54B80CA4 for ; Wed, 17 Jul 2024 13:08:22 +0000 (UTC) X-FDA: 82349273244.20.0D478E3 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf03.hostedemail.com (Postfix) with ESMTP id 4863A20029 for ; Wed, 17 Jul 2024 13:08:20 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=iD3vorJU; spf=pass (imf03.hostedemail.com: domain of mchehab+huawei@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=mchehab+huawei@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721221669; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=E922G9Ek61ghVFwxuHivUvymBXNklaQxXUWUethbesY=; b=zBEUbHCzGhGgqAfpjZ6QrnbZfZxPvCQvkWeCAeOjZwcefihgbG8pYLhkf93dO2eGS/2I1G 5hwCn0G+hQyS2AyI0JhiDg+9sYCQvp619qVp6BfXUHTVGpe1UVg+FzafX8cwLx9MB0bGGV cB572kEXuoenEg98uFSVTINuhZ2Eyuw= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=iD3vorJU; spf=pass (imf03.hostedemail.com: domain of mchehab+huawei@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=mchehab+huawei@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721221669; a=rsa-sha256; cv=none; b=LKPB9UJrt2GF70SKzBzvE+QljvUPVF8zaN1impWzcuHPS7i6ST9aURd5Nyrtiid33uF0Mt h4RvRRTv/YuBATpg8nFPYcg05uFpNHvLqBBY7lTj8pAJ5uMMSA76ETHMvGwKEEZbD54W8s wNecUbU1vGMxlAEplS46PvZwxgX5ACk= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 246BB613F1; Wed, 17 Jul 2024 13:08:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 029B3C32782; Wed, 17 Jul 2024 13:08:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721221698; bh=k3720juOhnRd/ZG9JvQtXh8lx9+/XF03JrXIdTvq5gE=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=iD3vorJU1yTZZWpHNFxZipQJE8j3soAxob/gNdtQU9vADwYpFcnNlYaK3dR2Z5/qB KsGhoR9TfzR9ShmGS2ZwrsgjKXYcrrPedI81ofzAiP1unhGy8kqqVC/jwz0yhRZldo Y13TYwbh5H1YcVKL97atz6CBjv8OzzXa6c89+FabaAiICKM26Ws3jGwKCWa9z7hPRh VPLyzeBmBTZNnzMpqcukmaKhecaV4TAzZaNiE6zxlnC31hGvWlG/9aaL9hY1VuQn1M /ztyGw/lo/UY9BLFGlnuWnZHfeLYrpMtwDxMRl7ZqfC6L6jluZP/iuIBm4sw9vHeKW pYXXT3MVaLDHg== Date: Wed, 17 Jul 2024 15:08:07 +0200 From: Mauro Carvalho Chehab To: Cc: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: Re: [RFC PATCH v9 03/11] EDAC: Add EDAC ECS control driver Message-ID: <20240717150807.70c9ef90@foz.lan> In-Reply-To: <20240716150336.2042-4-shiju.jose@huawei.com> References: <20240716150336.2042-1-shiju.jose@huawei.com> <20240716150336.2042-4-shiju.jose@huawei.com> X-Mailer: Claws Mail 4.3.0 (GTK 3.24.42; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Stat-Signature: nza5yjymqtsdyfjqpp31i4tps6r7q1i5 X-Rspam-User: X-Rspamd-Queue-Id: 4863A20029 X-Rspamd-Server: rspam02 X-HE-Tag: 1721221700-164794 X-HE-Meta: U2FsdGVkX1/vdpy+76HZb+OIXpBrmkX7uzR/ie71u0VV3Qe/vSbBxY0Pe3bocmFEVh+Bzq6hkcAAHLxHNyeoOyKHMOV8YfVicTHHluaImvYQ8a2DxlFwTrZmvmkxKLfgyToi+uNeHeEvcNL46ASSxPAv7Vv+G72NDZjD40gyYXlMeTnlsL+XSIZIdI9p4xKdMJULAfa7zRKMsaqyLA6+gG7Qcw07LHo2XUiWjg79fJHnFa3PE7PIbtSCcXWYjtaFK/ySSpp9yWZeLdlR3+P7jz61retF86+fia3KhJwMoLkF3cF9aNYMuvEPDKgHaLbjaoMqqA6PW9Gu2y91RK1NCNGU1PnH1GKELVe/BysqfAW0W0I6k3BztxdCXezjuB04l0cTkE+W8mfjKDdrD/b4b2YVSWBIEigVh7d6vsWI7nUnXc3RdL8Tq4k+HXx8gDJMbVOs0LT2hbi+J9W/JdRESPJIwSJM7TuRxLD2IjfoxQlVBAnwoSqQ1GQPMGtQZvNQdf03hk7W8Yh6r0HbzXSrJc/tqp2gOko1hqfP2Z/1AJ321PnAD3/+cOct1vigBBDW4pdwg87OykmKCvwitZG+D7Gd2YNMwuDEiEz1RYH3hzlMwIN9t23qJ18q45qnccFPTv/cEQieDwaVV/BOCsvQvsPSLPsePGaBIwH6+cJJdcgEZ0dXgTnhunPI1WThkuDYeWK7F1D4W4rOX6mI5cJYulVsYfOdD0FpbA7t4DI1fwObuAdjvRIfq9pqMNIg4aGlD0ziXY8vjhvvjwvCYGUXo5AGbYd0j0HdZX7lMhipxNyFuNz/9c44cw5XdRsd/pFDgckDwNz9yRSthpXN+y8G+L7EClKTb8wxBi+A7wta+YmOZZvVSYDB20o7JEtRLNxZJN8wqbmKSdrTyCIBW/fVlSzsDB3wWiKqw83ix8mWls+ARgfdSrXzuNHTCLBAQbaOP3A/ab8nOC14naqvdzk Os4VTuZu 1d+VzGjfRRHDdMF3deFSrPOqFECp/LFjNX/q29MT2UZUcKsf0UnKUElhyK80OA+lQ3kUXXevMPRBZ2VKkekNOMDfRUGNnUQVOdXK5DJVrbdYyyqqiVB5PNISDlnzHrXBrkGwxwBRhgT+ZRzIsv3ckW4KfMHjik+EIqrn2kuw88N2OSVTaMo6OKQGK7H7bTwPTS1n46Wqqmejxcc0t1UYKEbiR64mDG8oA0jtOqfJGxLDGpFpTds6WoGHkszCHdgh3ugEnR9/XwvC5KIGtwsjEiJKPOTTWCtTQweRFk02bvTp9JIQgNi4jsDYW6q2Zn/o8jSHY X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Em Tue, 16 Jul 2024 16:03:27 +0100 escreveu: > From: Shiju Jose > > Add EDAC ECS (Error Check Scrub) control driver supports configuring > the memory device's ECS feature. > > The Error Check Scrub (ECS) is a feature defined in JEDEC DDR5 SDRAM > Specification (JESD79-5) and allows the DRAM to internally read, correct > single-bit errors, and write back corrected data bits to the DRAM array > while providing transparency to error counts. > > The DDR5 device contains number of memory media FRUs per device. The > DDR5 ECS feature and thus the ECS control driver supports configuring > the ECS parameters per FRU. > > The memory devices supports ECS feature register with the EDAC ECS driver typo: supports -> support > and thus with the generic EDAC RAS feature driver, which adds the sysfs > ECS control interface. The ECS control attributes are exposed to the > userspace in /sys/bus/edac/devices//ecs_fruX/. > > Generic EDAC ECS driver and the common sysfs ECS interface promotes > unambiguous control from the userspace irrespective of the underlying > devices, support ECS feature. > > The support for ECS feature is added separately because the DDR5 ECS > feature's control attributes are dissimilar from those of the scrub > feature. > > Note: Documentation can be added if necessary. Please document. > > Co-developed-by: Jonathan Cameron > Signed-off-by: Jonathan Cameron > Signed-off-by: Shiju Jose > --- > drivers/edac/Makefile | 2 +- > drivers/edac/edac_ecs.c | 396 +++++++++++++++++++++++++++++++ > drivers/edac/edac_ras_feature.c | 5 + > include/linux/edac_ras_feature.h | 36 +++ > 4 files changed, 438 insertions(+), 1 deletion(-) > create mode 100755 drivers/edac/edac_ecs.c > > diff --git a/drivers/edac/Makefile b/drivers/edac/Makefile > index de56cbd039eb..c1412c7d3efb 100644 > --- a/drivers/edac/Makefile > +++ b/drivers/edac/Makefile > @@ -10,7 +10,7 @@ obj-$(CONFIG_EDAC) := edac_core.o > > edac_core-y := edac_mc.o edac_device.o edac_mc_sysfs.o > edac_core-y += edac_module.o edac_device_sysfs.o wq.o > -edac_core-y += edac_ras_feature.o edac_scrub.o > +edac_core-y += edac_ras_feature.o edac_scrub.o edac_ecs.o > > edac_core-$(CONFIG_EDAC_DEBUG) += debugfs.o > > diff --git a/drivers/edac/edac_ecs.c b/drivers/edac/edac_ecs.c > new file mode 100755 > index 000000000000..37dabd053c36 > --- /dev/null > +++ b/drivers/edac/edac_ecs.c > @@ -0,0 +1,396 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * ECS driver supporting controlling on die error check scrub > + * (e.g. DDR5 ECS). The common sysfs ECS interface promotes > + * unambiguous access from the userspace. > + * > + * Copyright (c) 2024 HiSilicon Limited. > + */ > + > +#define pr_fmt(fmt) "EDAC ECS: " fmt > + > +#include > + > +#define EDAC_ECS_FRU_NAME "ecs_fru" > + > +enum edac_ecs_attributes { > + ecs_log_entry_type, > + ecs_log_entry_type_per_dram, > + ecs_log_entry_type_per_memory_media, > + ecs_mode, > + ecs_mode_counts_rows, > + ecs_mode_counts_codewords, > + ecs_reset, > + ecs_name, > + ecs_threshold, > + ecs_max_attrs > +}; Please use uppercase for enums. > + > +struct edac_ecs_dev_attr { > + struct device_attribute dev_attr; > + int fru_id; > +}; > + > +struct edac_ecs_fru_context { > + char name[EDAC_RAS_NAME_LEN]; > + struct edac_ecs_dev_attr ecs_dev_attr[ecs_max_attrs]; > + struct attribute *ecs_attrs[ecs_max_attrs + 1]; > + struct attribute_group group; > +}; > + > +struct edac_ecs_context { > + u16 num_media_frus; > + struct edac_ecs_fru_context *fru_ctxs; > +}; > + > +#define to_ecs_dev_attr(_dev_attr) \ > + container_of(_dev_attr, struct edac_ecs_dev_attr, dev_attr) > + > +static ssize_t log_entry_type_show(struct device *ras_feat_dev, > + struct device_attribute *attr, > + char *buf) > +{ > + struct edac_ecs_dev_attr *ecs_dev_attr = to_ecs_dev_attr(attr); > + struct edac_ras_feat_ctx *ctx = dev_get_drvdata(ras_feat_dev); > + const struct edac_ecs_ops *ops = ctx->ecs.ops; > + u64 val; > + int ret; > + > + ret = ops->get_log_entry_type(ras_feat_dev->parent, ctx->ecs.private, > + ecs_dev_attr->fru_id, &val); > + if (ret) > + return ret; Same notes as patch 2/11 with regards to sysfs documentation/store/show. Also, it is hard to review this patch without the ABI documentation. Regards, Mauro Thanks, Mauro