From patchwork Thu Nov 23 17:43:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shiju Jose X-Patchwork-Id: 13466480 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 E4599C624B4 for ; Thu, 23 Nov 2023 17:44:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E7FD66B0687; Thu, 23 Nov 2023 12:44:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E558A6B0688; Thu, 23 Nov 2023 12:44:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C5A666B0689; Thu, 23 Nov 2023 12:44:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id B13926B0687 for ; Thu, 23 Nov 2023 12:44:15 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 925081A1448 for ; Thu, 23 Nov 2023 17:44:15 +0000 (UTC) X-FDA: 81489942870.03.CF0CA5C Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by imf03.hostedemail.com (Postfix) with ESMTP id 8C0442000F for ; Thu, 23 Nov 2023 17:44:13 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf03.hostedemail.com: domain of shiju.jose@huawei.com designates 185.176.79.56 as permitted sender) smtp.mailfrom=shiju.jose@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700761453; 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; bh=qBl6X781g1URePy/zIT03Qx96CWSeuENJeyyONXt9xs=; b=8BLRi2rzQISNEyphqmFIB3J2UxtTKzIcNPZJwYci1eYIyhiLV8ffOMfowyLPNV3Ag+me80 mlxsKShk1k0lQXcOZLCabRVbIXIHdNhtVj1IuDYM4ywbg0ZHdvBSHFdA9s5aXYfOBnC4Lb skpf1xB5mfUeZI3PYsxKZZa0wicn88s= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf03.hostedemail.com: domain of shiju.jose@huawei.com designates 185.176.79.56 as permitted sender) smtp.mailfrom=shiju.jose@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700761453; a=rsa-sha256; cv=none; b=78MNxDAxtXGaMaLYOuKATOGkY8DppZ9gpHnP4NxhlukxFXY1MT6jETvDZ9ZRXaaiUVZXP9 RDkq3hpEO0ntNje3c6cmyDegz78ta0Gpf3+an1uqrQ/YAe2IVgand2jiALw/s7XX3xS9qA HTsKkPCXiE/cgC00SDuOunMaDGcdQVc= 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 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-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 8C0442000F X-Stat-Signature: 56kq5pdx7p96xd3rg5yu7d8khz3kb71z X-HE-Tag: 1700761453-676902 X-HE-Meta: U2FsdGVkX19+r50NqSVXwvlZvWV41nLSm/Zc+3kA+owE7XKf+ese1qHA5LyDw/0T9q3rDylJhQLkatXpX74qnzlI7BRojFTA1LlKRkjojwq9ZzU89DsbbB2cmXZEO/5ytKV4f8D1G56pvVpkom590dY27gZCnd4dGoHWyAm7YMiaox9cH+hU0Ca+65iggsVJnvaXvEn0km9YLq926Zp6GHdiMi+6Qpy+t0NIpqHpZkcM3E3AtCXFCwNAreU79gpt/t9HaOQxOX69q3Xpzq4WplFbI+VarxkP6D5y2aHmoKikMy0FnCpFUaRSYzUyb7VUqZsZutNeeK7Obb47U8fLbKX3m7eRF60QAdTpXPnNLt8V9WGjq8do4/gVjcNQfHsl/uUOrkeJG3g+z0ZZTt++DBLj2ySWa/0Sev+LrFrxp0z+gQ0m35cX6lX8IylTeiec4uxnjTf9haJynsOs4L9kA8dYqTWnuCvkQMUUeEmxL/j+N5pDjU25v/4usQ6ijY2GJUj1fYbkogkn5FcuM59I2fqnkBK2kPnqmPu/IG0nFevOzX6uLnyaSf3W3xdzfnf3a7iu0faIK7aTweZoXOfQ1TqJE8mNsdgwOxjMvcfzVh/uau6mTiQ7Nw1JvEfBDlb0s0pCOQBnLSTOJjwmROoNtiURknvRjcTEnFh9hjS++t6oQa6yYi0Ux7vOyPZa8FwmQsWyKj0t2YK1oOJxBrOBUI+K2y05ZOgjEi4C6sjoAq4xOavDkGmiTmblNiyBbiimUE5u06y3DvXZNwEKHYi+xt8PtbdtL8qMRUu7Buu4PF7Ffze4dLfcKG3m2zN+kJCvVoGT187JA/L4tas4qS6/K0Fr+k5jX8XEdCNiiuAxCNbR/9QnnoFcvkwxtvVkKvf2DXXykl8YlAAuECN30hn9LPxkHRCGKCPrxyxp6ME3U/8GTYnoTo8drTj765kFd3n06T+UDtIaaMJ6+roNQol poxCu9hE U4dgy9Q/Qz4HGiyoWq9FCluKpzXK3URB30sWOQedwLslw03oPIkuO/SIYWVLx4VGGemp7hWUMgy4OmJ/Actql/Y3TC9QaCw+qwS6Y/Onh7lM5xenwh5l/1x5d90A6+2GFDQ00u/3xK3IIXH4= 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: 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, };