Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp506662rdh; Thu, 23 Nov 2023 09:44:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IEn+vk4KLtgiAH6zMhX0JKWWkVRls1EbQd4DbgxnxY5TWmn5ZW1xGlEFMN8ixUsbdH6Fh3Y X-Received: by 2002:a05:6a00:1483:b0:6cb:6c9b:8892 with SMTP id v3-20020a056a00148300b006cb6c9b8892mr211152pfu.29.1700761490967; Thu, 23 Nov 2023 09:44:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700761490; cv=none; d=google.com; s=arc-20160816; b=sIx50rjeXexW2F+d/259dKXp+IAO1YyM0HusdFnDRYLgA0ZjUgRSKunFLN2O6FpYCS 3QNoSlKUFjSyrHGHBEVsgbVvxTtqtl3KNO00PUCnOwkJGtiYt2q4sATtFS136b4g1Id1 2ECI83n6qa8aoyUZl015u3gd0/ps7Kh/aY5uFJ5x30WjGHHRz4hQZomeoWJDCwGfEnML JKfAThIvzEn1BWMPdw3+PrkPIWEnUUf8ZRdcftL1N84gNTsaR+FdDgfswRz9uviZKz9p D9VfNOkh90Lr6vSipiKTav0Y2OqXKGDm4tfVt6cVmFo83TvoHUcwcXGkuKoSVXlGp0hV lRUw== 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=qBl6X781g1URePy/zIT03Qx96CWSeuENJeyyONXt9xs=; fh=qThSIRufdAcTXHIWmo+/3LGhqx2rE7BOIGxpM+Tyyp8=; b=I0d1s0tSG4cHnuR3HPsZQ7pRCTDYmblYPqoRd6l8Aj0cpDWa1OeTCaU10iC98DpkPy Rx2EjB2XSgxljHG9pHnoBs5ZiNwA1cksiYCLtAYBjhyLn5hSy8k3oQPeS2fmxs7mE4na jhilyrBnxECcNCMVSnf+8UF34een/ho+VQBmC9fh+/HVpXqZ6b9qhzUiCErU09lb4i0a NS6+0Dl5JZVOMrZtZ0HB/k1SRQk0iaxIYZeydCjCXoBzhf6815Xu4azKDz4bjCgZd3JD iQF3Hy68pxJ+ctuYw95cVl6byGRAJft1jwvRkXbaB+Tgyt27/5iF78uwwuqu+PvM84Wk jEsQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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. [23.128.96.37]) by mx.google.com with ESMTPS id k5-20020a6568c5000000b00577448019cbsi1762552pgt.841.2023.11.23.09.44.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 09:44:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 4711182D185F; Thu, 23 Nov 2023 09:44:49 -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 S1346012AbjKWRoc (ORCPT + 99 others); Thu, 23 Nov 2023 12:44:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345778AbjKWRoH (ORCPT ); Thu, 23 Nov 2023 12:44:07 -0500 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DDF610CA; Thu, 23 Nov 2023 09:44:13 -0800 (PST) Received: from lhrpeml500006.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4SblnK1kn3z6K8sc; Fri, 24 Nov 2023 01:42:45 +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; Thu, 23 Nov 2023 17:44:10 +0000 From: To: , , , , , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v3 08/11] memory: scrub: Add scrub control attributes for the DDR5 ECS Date: Fri, 24 Nov 2023 01:43:51 +0800 Message-ID: <20231123174355.1176-9-shiju.jose@huawei.com> X-Mailer: git-send-email 2.35.1.windows.2 In-Reply-To: <20231123174355.1176-1-shiju.jose@huawei.com> References: <20231123174355.1176-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: lhrpeml100003.china.huawei.com (7.191.160.210) 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]); Thu, 23 Nov 2023 09:44:49 -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 c2d794b2624b..43b7da43114f 100755 --- a/drivers/memory/scrub/memory-scrub.c +++ b/drivers/memory/scrub/memory-scrub.c @@ -208,7 +208,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, @@ -269,6 +270,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