Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp546899rdb; Thu, 30 Nov 2023 11:24:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IEVOwTwuXDomZ2O0koE0DkoFhqCifT6puoy01vPk5QNlAe2mB3OYBxH3N1X4fLGtkzwLjyi X-Received: by 2002:a05:6a20:42a4:b0:18a:d5a6:ef01 with SMTP id o36-20020a056a2042a400b0018ad5a6ef01mr36747153pzj.20.1701372240993; Thu, 30 Nov 2023 11:24:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701372240; cv=none; d=google.com; s=arc-20160816; b=Hd3NBw5ys2LTxlu/twAotKUgiOObL3WtiXlYWdYRhIVq2uy1anqc4KYBlKbAb3A/aV NqRxCN7rlHGW4RHmbmh2LYENsqxDNnqg+xSdjqhNdaByUKdRcLFTrzL8Jn1p4W17pjLl FR2LTeW8PmnROPJzGxy6SeG/gNfN3uhdjVbiYzmqISdRrPYU3uXhCaNd7Nmlj242Ju5p WZg7TPzH4PK26vhEJ6w4mmdLiOc8RvWowQJaTTJz0o73LvD4nQN29+5iaY/BT2MSlBTu vDGVVTLExHYfy2biQUY5gKs8L4qu85H7qB9YDIgn7hPdSO2sIVMprcQwT/gs6/igp2cT XIgw== 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=p6BO+2lbNuwdW7EwJ5qXSflgDtYzD/XwYj5mDBozaBAMTjplaPU5KWTOQC9eCWtBzf aB9WgOImUjHiKE2q0LZi9R3VpVOBX39c1gc1Vcnv8eokUI1riQC68NUOdmqPpGv8n7hV 7ERoeUBrAweuGUCGd0xR9gvVScwHKsg6eZ45va0uljPio9QDZm/I/b7BJHNvFKhu/eV4 pAIkZxvwznz0lvYjWUF6ZoyACKgG1L/kGl5hJs6+zwGPc+7bmLJOaG0cTzstNvMUj8KE O1sNkWg+DYC/4qJo70po3fWcpSPOvB8CJ99NtS7CV+BCmqutnJJiKErSFILspQYzivum QP2A== 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 y188-20020a6364c5000000b005ab6142f1besi1853890pgb.169.2023.11.30.11.24.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 11:24:00 -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 1C81A8024019; Thu, 30 Nov 2023 11:24:00 -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 S1376472AbjK3TXp (ORCPT + 99 others); Thu, 30 Nov 2023 14:23:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376387AbjK3TXa (ORCPT ); Thu, 30 Nov 2023 14:23:30 -0500 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BC6510E4; Thu, 30 Nov 2023 11:23:35 -0800 (PST) Received: from mail.maildlp.com (unknown [172.18.186.31]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Sh5fX6BRjz6DB9n; Fri, 1 Dec 2023 03:21:56 +0800 (CST) Received: from lhrpeml500006.china.huawei.com (unknown [7.191.161.198]) by mail.maildlp.com (Postfix) with ESMTPS id A59C01402CD; Fri, 1 Dec 2023 03:23:33 +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, 30 Nov 2023 19:23:32 +0000 From: To: , , , , , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v4 08/11] memory: scrub: Add scrub control attributes for the DDR5 ECS Date: Fri, 1 Dec 2023 03:23:10 +0800 Message-ID: <20231130192314.1220-9-shiju.jose@huawei.com> X-Mailer: git-send-email 2.35.1.windows.2 In-Reply-To: <20231130192314.1220-1-shiju.jose@huawei.com> References: <20231130192314.1220-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: lhrpeml500004.china.huawei.com (7.191.163.9) To lhrpeml500006.china.huawei.com (7.191.161.198) X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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, 30 Nov 2023 11:24:00 -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