Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp277215rdf; Tue, 21 Nov 2023 02:23:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IEf8POdEnsgB9QbwFWiVC02QwdUahMsWiZuUgRpVc4fcQcSKSi0H9aJR8AYYJOai65PcMEl X-Received: by 2002:a05:6830:e0d:b0:6d3:2960:c49 with SMTP id do13-20020a0568300e0d00b006d329600c49mr11042385otb.26.1700562235200; Tue, 21 Nov 2023 02:23:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700562235; cv=none; d=google.com; s=arc-20160816; b=o70ipcGqZIHTNx7EaHIVHKTrJyIjEAdb0rjGSB8d0PBlTD81jrusw57oa8TBbCLZO0 A/nNuVeeua8s7m99we7hM1o3vvE742BsWTCF9n3UMhJyZw2RNQcmuivhDIwpcgkuAN// ylM98qvkmDgEDu03ADZyYuaDNz/2TTMzaEGIPNx/ISv5kWV6zdEhoaUjaAHBWFxq+Fgg uh7Zz8fwjzivTNeHV9utM3b/wltc6TKN+EeKs3k9l7Xl+J+aBF0wD/LppIv8waYsNEUZ DniiNw7XDXkIVdPlZLBLHxJ+uBOoqn37KpSpNNeQBDRPo7vq7lGJwIqwLI1Zbx7yIigq zRTg== 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=8Q1z/uTervOKGSAcSffcyRMd7XcscXufuGcNKpZCdyI=; fh=qThSIRufdAcTXHIWmo+/3LGhqx2rE7BOIGxpM+Tyyp8=; b=UNBFMhupnWAjgmKiNUkL2VHPeCeQ5YBj0gVZlRTE7owr9bNszo4BD+eKIsP6imyK/s qcvM53GAayhNtXc3JjkCRDtedgxoMtHxtnrprrl1DdMoVmMQdG+64hBIfyotXlCPw4PH fG35+PvoAW5DMk725MMb3WTMpEu90YIhBRtuBT854PT88fUF/hKty/f39F3OKZnGRgei B8ZcP9sShxG4BA01uk2kK1DEW4ATPjbCBRB1RC8f9u9M2cBSwVVyaMgQLDcqeoPmwewm eBg6FRqkgahdDmIivEtaUXqgpugvM7bwcQ6Ghp6mCfDsexOKoLb7UvoyLcQ+GWCA6Dgf eC8w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id f28-20020a63511c000000b005a0018ec786si9595498pgb.854.2023.11.21.02.23.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 02:23:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 3E0AC80978A6; Tue, 21 Nov 2023 02:21:02 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233810AbjKUKUd (ORCPT + 99 others); Tue, 21 Nov 2023 05:20:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233680AbjKUKUA (ORCPT ); Tue, 21 Nov 2023 05:20:00 -0500 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F15581726; Tue, 21 Nov 2023 02:19:08 -0800 (PST) Received: from lhrpeml500006.china.huawei.com (unknown [172.18.147.207]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4SZL0m2ZqFz67H66; Tue, 21 Nov 2023 18:17:44 +0800 (CST) Received: from SecurePC30232.china.huawei.com (10.122.247.234) by lhrpeml500006.china.huawei.com (7.191.161.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 21 Nov 2023 10:19:06 +0000 From: To: , , , , , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v2 08/10] memory: scrub: Add scrub control attributes for the DDR5 ECS Date: Tue, 21 Nov 2023 18:18:41 +0800 Message-ID: <20231121101844.1161-9-shiju.jose@huawei.com> X-Mailer: git-send-email 2.35.1.windows.2 In-Reply-To: <20231121101844.1161-1-shiju.jose@huawei.com> References: <20231121101844.1161-1-shiju.jose@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.122.247.234] X-ClientProxiedBy: lhrpeml100005.china.huawei.com (7.191.160.25) To lhrpeml500006.china.huawei.com (7.191.161.198) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 21 Nov 2023 02:21:02 -0800 (PST) From: Shiju Jose Add scrub control attributes for the DDR5 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 ECS control feature allows the request to configure ECS input configurations during system boot or at run-time. The ECS control allows the requester to change the ECS threshold count provided that the request is within the definition specified in DDR5 mode registers, change mode between codeword mode and row count mode, and reset the ECS counter. Signed-off-by: Shiju Jose --- drivers/memory/scrub/memory-scrub.c | 13 ++++++++++++- include/memory/memory-scrub.h | 10 ++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/memory/scrub/memory-scrub.c b/drivers/memory/scrub/memory-scrub.c index e14e7207b1ad..d39fa765fa63 100755 --- a/drivers/memory/scrub/memory-scrub.c +++ b/drivers/memory/scrub/memory-scrub.c @@ -211,7 +211,8 @@ static bool is_hex_attr(u32 attr) static bool is_string_attr(u32 attr) { - return attr == scrub_speed_available; + return attr == scrub_speed_available || + attr == scrub_threshold_available; } static struct attribute *scrub_genattr(const void *drvdata, @@ -272,6 +273,16 @@ static const char * const scrub_common_attrs[] = { [scrub_enable] = "enable", [scrub_speed] = "speed", [scrub_speed_available] = "speed_available", + /* scrub attributes - DDR5 ECS/common */ + [scrub_ecs_log_entry_type] = "ecs_log_entry_type", + [scrub_ecs_log_entry_type_per_dram] = "ecs_log_entry_type_per_dram", + [scrub_ecs_log_entry_type_per_memory_media] = "ecs_log_entry_type_per_memory_media", + [scrub_mode] = "mode", + [scrub_mode_counts_rows] = "mode_counts_rows", + [scrub_mode_counts_codewords] = "mode_counts_codewords", + [scrub_reset_counter] = "reset_counter", + [scrub_threshold] = "threshold", + [scrub_threshold_available] = "threshold_available", }; static struct attribute ** diff --git a/include/memory/memory-scrub.h b/include/memory/memory-scrub.h index d7cbde4718d0..74ad5addd5b3 100755 --- a/include/memory/memory-scrub.h +++ b/include/memory/memory-scrub.h @@ -23,6 +23,16 @@ enum scrub_attributes { scrub_enable, scrub_speed, scrub_speed_available, + /* scrub attributes - DDR5 ECS/common */ + scrub_ecs_log_entry_type, + scrub_ecs_log_entry_type_per_dram, + scrub_ecs_log_entry_type_per_memory_media, + scrub_mode, + scrub_mode_counts_rows, + scrub_mode_counts_codewords, + scrub_reset_counter, + scrub_threshold, + scrub_threshold_available, max_attrs, }; -- 2.34.1