From patchwork Tue Nov 21 10:18:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shiju Jose X-Patchwork-Id: 13462758 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 C774BC5ACB3 for ; Tue, 21 Nov 2023 10:19:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4A0026B03C3; Tue, 21 Nov 2023 05:19:06 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 35FE96B03DA; Tue, 21 Nov 2023 05:19:06 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 13C346B03D2; Tue, 21 Nov 2023 05:19:06 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id E76066B01A3 for ; Tue, 21 Nov 2023 05:19:05 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 9F1E380AD2 for ; Tue, 21 Nov 2023 10:19:05 +0000 (UTC) X-FDA: 81481563450.02.DE78B49 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by imf05.hostedemail.com (Postfix) with ESMTP id 80E14100002 for ; Tue, 21 Nov 2023 10:19:03 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=none; spf=pass (imf05.hostedemail.com: domain of shiju.jose@huawei.com designates 185.176.79.56 as permitted sender) smtp.mailfrom=shiju.jose@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700561944; 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: references; bh=5W54GVr2AekpXeLFRARYBKMLX59jkqrxgOAli66h3lQ=; b=AgRXRPi1R5j8/eVzCazaIj4pfrI+EVTF5grrBWqrSpGW50015crLYMpME4TBGzFRUNabsM tPiZDsmn5rjTcBsnNwAA7xcMlvjeoyoHI5NjugspMoJgzqUpYC3jUNgeL+XPEcNB0YFCI6 i1Y6DKQanzB4gDdXpadDuaQFXslbeXo= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700561944; a=rsa-sha256; cv=none; b=thM/WUbyDUKscAVnEEwiFuVxYLiRaFguRaZmXAzakUoTlOY+ABE2kZi3xe8aLAStbOd5/w B4AHuBSV5Naygk0hAagg7n2+iuLsGRX6Vjmkc9zPF3UBzTb4PBbe/rAvo96IMoE1VsDGoX DJWlrFCVkOj3vtxBtGphHTmQQxKmjI0= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=none; spf=pass (imf05.hostedemail.com: domain of shiju.jose@huawei.com designates 185.176.79.56 as permitted sender) smtp.mailfrom=shiju.jose@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com Received: from lhrpeml500006.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4SZKwV5KqBz689lt; Tue, 21 Nov 2023 18:14:02 +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:18:58 +0000 From: To: , , , , , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v2 00/10] cxl: Add support for CXL feature commands, CXL device patrol scrub control and DDR5 ECS control features Date: Tue, 21 Nov 2023 18:18:33 +0800 Message-ID: <20231121101844.1161-1-shiju.jose@huawei.com> X-Mailer: git-send-email 2.35.1.windows.2 MIME-Version: 1.0 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-Rspamd-Queue-Id: 80E14100002 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: hpwdzufqjaxny9xfpp8jn7tgc7x31sff X-HE-Tag: 1700561943-852059 X-HE-Meta: U2FsdGVkX1/uguPKpwNqilMUHl14VRUuCbjend9ALQhnnSMD0ebnLWHZFvGWdKbKK+Kp1E+OPRqbd6EO7VfeuywnI2wBd6fArdg3o6yj5RVHho5Ac4fuiyCFS1jkKvvqkPzs7WW2EpFNDX4CKR96WiJB6Nsi01Qh1I4MaWKB44iXbZ20nnebZepZLqYkaByrCK2x4d5/yeYfvNbS2Fx8AF5WRUydVa5vU+qQS/QCOXCYNIsQrwoGPwDeePuKNBgISDrn1GtfqK2BuZWYgmV1PIjvmzCOTq5uKheueATn4P6U3zlsXIzVNVUhicwpCYXDrragyUfymD8k61+RbMPo8Ow5uo6sqbQXFfXpjMOTC5ZZ5ofxBEpoBh6rQBszAfjbDSMqDLVsv6cG/nkRE/nSVdIfyNIMUa9t+AlyB7EDq9ItV0lZiFNG5PtOK7LKkfFDk6oku38yl3DND9E93buzF0jtF37hjy8Z1DbB5iJNc2JOqykD8E92bwPnSrRAJbtoYSIev4qLDUg5aXKKeJpkLABSPplbeTr13kLl2PlwkcMALgU6yPrXCL+rfjq1hgSFhzSLKy1iy0dChlbkUMFp/qxJW1dXnvZYtnWk0fm22B+p36Md0EoLUOPHUYHHcFbOnxqfmEZYmQ7UZWA6qCbfpZBi68PqAq8d5uPIsyrGASfcUeKNUJWTzVVs596XM5GWuEPq5D7BbGQpL8PeJwgIbaPDe/4roTaWLNjcW5a7k4acxo6VEJv9fGF8pTEg1llP5bsg4E3TFzGdPe+KUB3WXeXUJLkoikqB04zjBev95V4y+k1ytOXb9V4nGkmc1lnbq2OfllKx9vjqValGM71DYtPQZwUVnuscH5v8QiCL1qbxwone5Fp6QQBY0S2MlGpHujRls/+8cRYgYAQog01/6q5bWCnDrTlI0kGqBRcVWFWZRTpK6wBy+UWLL7KUIY89OF9t1HlmrLIRJGR2d+B kz7MKFD9 qB8T6Kamm+aGssmfgMJpYy9zr+su/wW+t7frnuz8oM3H8gGk8kHbtYt/aHJUgCezhMG8wlDpDOSHaCkwlw23c9de5O58fMcPrQpCvGduWC9a6skLhm6qyXNipY5fdjrGlvOQa8PMUhzAURo0BGb8yof8nYAihsg1sZEm7eTDb6cvwXhym/uDpjR0N+hlD33mC6FJnchWlHepqJZc= 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 1. Add support for CXL feature mailbox commands. 2. Add CXL device scrub driver supporting patrol scrub control and DDR5 ECS control features. 3. Add scrub driver supports configuring memory scrubs in the system. 4. Add scrub attributes for DDR5 ECS control to the memory scrub driver. 5. Register CXL device patrol scrub and ECS with scrub control driver. 6. Add documentation for CXL memory device scrub control attributes. The QEMU series to support these features is available here, https://lore.kernel.org/qemu-devel/20231114124711.1128-1-shiju.jose@huawei.com/T/#t Changes v1 -> v2: 1. Changes for comments from Dave Jiang, Thanks. - Split patches. - reversed xmas tree declarations. - declared flags as enums. - removed few unnecessary variable initializations. - replaced PTR_ERR_OR_ZERO() with IS_ERR() and PTR_ERR(). - add auto clean declarations. - replaced while loop with for loop. - Removed allocation from cxl_get_supported_features() and cxl_get_feature() and make change to take allocated memory pointer from the caller. - replaced if/else with switch case. - replaced sprintf() with sysfs_emit() in 2 places. - replaced goto label with return in few functions. 2. removed unused code for supported attributes from ecs. 3. Included following common dependency patch for scrub configure driver to this series. "memory: scrub: Add scrub driver supports configuring memory scrubbers in the system" Shiju Jose (10): cxl/mbox: Add GET_SUPPORTED_FEATURES mailbox command cxl/mbox: Add GET_FEATURE mailbox command cxl/mbox: Add SET_FEATURE mailbox command cxl/memscrub: Add CXL device patrol scrub control feature cxl/memscrub: Add CXL device DDR5 ECS control feature memory: scrub: Add scrub driver supports configuring memory scrubbers in the system cxl/memscrub: Register CXL device patrol scrub with scrub configure driver memory: scrub: Add scrub control attributes for the DDR5 ECS cxl/memscrub: Register CXL device DDR5 ECS with scrub configure driver cxl: scrub: sysfs: Add Documentation for CXL memory device scrub control attributes .../testing/sysfs-class-cxl-scrub-configure | 135 +++ drivers/cxl/Kconfig | 23 + drivers/cxl/core/Makefile | 1 + drivers/cxl/core/mbox.c | 62 ++ drivers/cxl/core/memscrub.c | 993 ++++++++++++++++++ drivers/cxl/cxlmem.h | 120 +++ drivers/cxl/pci.c | 8 + drivers/memory/Kconfig | 1 + drivers/memory/Makefile | 1 + drivers/memory/scrub/Kconfig | 11 + drivers/memory/scrub/Makefile | 6 + drivers/memory/scrub/memory-scrub.c | 484 +++++++++ include/memory/memory-scrub.h | 90 ++ include/uapi/linux/cxl_mem.h | 3 + 14 files changed, 1938 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-class-cxl-scrub-configure create mode 100644 drivers/cxl/core/memscrub.c create mode 100644 drivers/memory/scrub/Kconfig create mode 100644 drivers/memory/scrub/Makefile create mode 100755 drivers/memory/scrub/memory-scrub.c create mode 100755 include/memory/memory-scrub.h