From mboxrd@z Thu Jan 1 00:00:00 1970 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 C67C8E7717D for ; Mon, 9 Dec 2024 14:28:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5E7A98D006B; Mon, 9 Dec 2024 09:28:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 597E18D0058; Mon, 9 Dec 2024 09:28:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 437FC8D006B; Mon, 9 Dec 2024 09:28:47 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 1C5E38D0058 for ; Mon, 9 Dec 2024 09:28:47 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 50192A0916 for ; Mon, 9 Dec 2024 14:28:23 +0000 (UTC) X-FDA: 82875650130.07.25FCE82 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by imf15.hostedemail.com (Postfix) with ESMTP id 6B442A0007 for ; Mon, 9 Dec 2024 14:27:59 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf15.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=1733754482; a=rsa-sha256; cv=none; b=LjeDp4VwiTYQUcoDFm3KwsRn+p8XeMC2iKXC8/AW2v8m+C0yAgkdSpIKXCq7OqTe57YyYN JpdCgxRHav1RW7yR3E4e9hq6sg8aWIlvRHQ4ChLLfZYYagnljNX4PH/GrEZIAyt/VdLzRu 0HmLde1RZQNSE3+wNERYwnxV/UAe8As= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf15.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=1733754482; 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=mGXOYUhw8t/4clE/REFwkh2FINKNN9T5o0Cv/QZdjco=; b=8GR8uO9QjoOzRs4L4/rZC2r/VPbEk5OcNxtmviUvjiD99MEavREUSdZY0qZVuHVwt8Oo1l URxTVj/KWo+3s160RARZbi8CMmOJ8RFitDBfSFO64X+qRkGNL5aSmZOBURbXk+Lm2HKKjT qsfcI68/OX44efMg86ZC3u+zqBddQzk= Received: from mail.maildlp.com (unknown [172.18.186.31]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Y6PHP3XSbz6GCM3; Mon, 9 Dec 2024 22:23:45 +0800 (CST) Received: from frapeml100008.china.huawei.com (unknown [7.182.85.131]) by mail.maildlp.com (Postfix) with ESMTPS id A8C831400DD; Mon, 9 Dec 2024 22:28:16 +0800 (CST) Received: from frapeml500007.china.huawei.com (7.182.85.172) by frapeml100008.china.huawei.com (7.182.85.131) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Mon, 9 Dec 2024 15:28:16 +0100 Received: from frapeml500007.china.huawei.com ([7.182.85.172]) by frapeml500007.china.huawei.com ([7.182.85.172]) with mapi id 15.01.2507.039; Mon, 9 Dec 2024 15:28:16 +0100 From: Shiju Jose To: Dan Williams , "linux-edac@vger.kernel.org" , "linux-cxl@vger.kernel.org" , "linux-acpi@vger.kernel.org" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" CC: "bp@alien8.de" , "tony.luck@intel.com" , "rafael@kernel.org" , "lenb@kernel.org" , "mchehab@kernel.org" , "dave@stgolabs.net" , "Jonathan Cameron" , "dave.jiang@intel.com" , "alison.schofield@intel.com" , "vishal.l.verma@intel.com" , "ira.weiny@intel.com" , "david@redhat.com" , "Vilas.Sridharan@amd.com" , "leo.duran@amd.com" , "Yazen.Ghannam@amd.com" , "rientjes@google.com" , "jiaqiyan@google.com" , "Jon.Grimm@amd.com" , "dave.hansen@linux.intel.com" , "naoya.horiguchi@nec.com" , "james.morse@arm.com" , "jthoughton@google.com" , "somasundaram.a@hpe.com" , "erdemaktas@google.com" , "pgonda@google.com" , "duenwen@google.com" , "gthelen@google.com" , "wschwartz@amperecomputing.com" , "dferguson@amperecomputing.com" , "wbs@os.amperecomputing.com" , "nifan.cxl@gmail.com" , tanxiaofei , "Zengtao (B)" , "Roberto Sassu" , "kangkang.shen@futurewei.com" , wanghuiqiang , Linuxarm Subject: RE: [PATCH v17 05/18] cxl: Add Get Supported Features command for kernel usage Thread-Topic: [PATCH v17 05/18] cxl: Add Get Supported Features command for kernel usage Thread-Index: AQHbPQkFb4DhmQwolUmt5xqDd6N+ZLLZxDuAgAQrVZA= Date: Mon, 9 Dec 2024 14:28:16 +0000 Message-ID: References: <20241122180416.1932-1-shiju.jose@huawei.com> <20241122180416.1932-6-shiju.jose@huawei.com> <67536f6987656_10a08329480@dwillia2-xfh.jf.intel.com.notmuch> In-Reply-To: <67536f6987656_10a08329480@dwillia2-xfh.jf.intel.com.notmuch> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.48.159.155] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Stat-Signature: t17eb4966j1czz46i1e5m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1Y0JB SIKLp8z/aJRWcAieP9sQYxOoszyiXxP0iyanHOkWsN8Thib3R+orNnWkg7CSRkIirTuWpyeJisqhchrdgcEqTZzkC7zhVtzpij8aLSxNXmf1TOeLVlLPgNQjjRmP/+E2ltCCAFa32B2IS+DF7XT61F23ypbzsn5fz9ef4fQwme+NnqgfAYpOh9e7Po+6XBaMV7gu1nha4zCqa3Te58EwbsLYcNYers6d61IbBEAlYO4mpXgwYLGZnOSKeswcMJHKUO4F7g8W7RqXR8RuSrvOr7UE8auuLtril1sPq7sonoUumKRGJH5kakjWZ9FKvw4cN+8NbqGiUpK7vTvQLnqBztUkgF5hLw2TeIHEcV6tOyAtC5QvzunEa0teQqe/UztB+qU0InCNoyD4KoX2j8Qluo5aPcbGLF/7A9AVl+qupSr5AscwG8SVPlBeslHGoATt6sgxcUsOeDqujZ5PWDLk4MWu9M+ghmprU9D5qj5AZ1ty01aerRL/iONQQqYEB+f9HUKdXq+D5CH/h6RqojdRW71xfG8jml4sTjjBvn9THB6VINT7S9TX98L5cGAfupSBYOSWciuWNjM90ieC4Ny1HzUFpP8ELAmVDTMXhoVjMOTkwNPSrtamA961IX16MqeNDQ0Hq/2uby8chOwM9XRCwJjHSf76qHYow3t41qvNvskZw1TXzu/3oGpSx+y+cXe139ieCbCeTcxIiq7n0pkKS74KbMh9T/iUsnHjwFWe4X6/aYo3hMlQm6Djiczt0XUddOXuekeVyr1fr3gQImV54BNehIVAMaF+4XGnU9B9faGeJ7XfNdsBDfO0ns9D1ZhWwcmJIxWUvL0MzGkODr6IbNrimKA== 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: >-----Original Message----- >From: Dan Williams >Sent: 06 December 2024 21:41 >To: Shiju Jose ; linux-edac@vger.kernel.org; linux- >cxl@vger.kernel.org; linux-acpi@vger.kernel.org; linux-mm@kvack.org; linux= - >kernel@vger.kernel.org >Cc: bp@alien8.de; tony.luck@intel.com; rafael@kernel.org; lenb@kernel.org; >mchehab@kernel.org; dan.j.williams@intel.com; dave@stgolabs.net; Jonathan >Cameron ; dave.jiang@intel.com; >alison.schofield@intel.com; vishal.l.verma@intel.com; ira.weiny@intel.com; >david@redhat.com; Vilas.Sridharan@amd.com; leo.duran@amd.com; >Yazen.Ghannam@amd.com; rientjes@google.com; jiaqiyan@google.com; >Jon.Grimm@amd.com; dave.hansen@linux.intel.com; >naoya.horiguchi@nec.com; james.morse@arm.com; jthoughton@google.com; >somasundaram.a@hpe.com; erdemaktas@google.com; pgonda@google.com; >duenwen@google.com; gthelen@google.com; >wschwartz@amperecomputing.com; dferguson@amperecomputing.com; >wbs@os.amperecomputing.com; nifan.cxl@gmail.com; tanxiaofei >; Zengtao (B) ; Roberto >Sassu ; kangkang.shen@futurewei.com; >wanghuiqiang ; Linuxarm >; Shiju Jose >Subject: Re: [PATCH v17 05/18] cxl: Add Get Supported Features command for >kernel usage > >shiju.jose@ wrote: >> From: Dave Jiang >> >> CXL spec r3.1 8.2.9.6.1 Get Supported Features (Opcode 0500h) The >> command retrieve the list of supported device-specific features >> (identified by UUID) and general information about each Feature. >> >> The driver will retrieve the feature entries in order to make checks >> and provide information for the Get Feature and Set Feature command. >> One of the main piece of information retrieved are the effects a Set >> Feature command would have for a particular feature. >> >> Reviewed-by: Jonathan Cameron >> Signed-off-by: Dave Jiang >> Co-developed-by: Shiju Jose >> Signed-off-by: Shiju Jose >> --- >> drivers/cxl/core/mbox.c | 179 +++++++++++++++++++++++++++++++++++ >> drivers/cxl/cxlmem.h | 44 +++++++++ >> drivers/cxl/pci.c | 4 + >> include/cxl/mailbox.h | 4 + >> include/uapi/linux/cxl_mem.h | 1 + >> 5 files changed, 232 insertions(+) > >Hi Shiju, > >So I commented yesterday on this patch that is also duplicated in Dave's s= eries >have a merge order ordering plan to propose. Hi Dan, Thanks for the suggestions. I tested your suggestions for CXL features commands in the fwctl series, in= the EDAC CXL features setup, as replied.=20 > >> diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c index >> 880ac1dba3cc..c5d4c7df2f99 100644 >> --- a/drivers/cxl/core/mbox.c >> +++ b/drivers/cxl/core/mbox.c >> @@ -67,6 +67,7 @@ static struct cxl_mem_command >cxl_mem_commands[CXL_MEM_COMMAND_ID_MAX] =3D { >> CXL_CMD(SET_SHUTDOWN_STATE, 0x1, 0, 0), >> CXL_CMD(GET_SCAN_MEDIA_CAPS, 0x10, 0x4, 0), >> CXL_CMD(GET_TIMESTAMP, 0, 0x8, 0), >> + CXL_CMD(GET_SUPPORTED_FEATURES, 0x8, CXL_VARIABLE_PAYLOAD, >0), > >As I mention on the CXL FWCTL alias of this path, for kernel-internal only= usage >by definition that means a CXL command id does not need to be defined. I tried removing these definitions for get_supported_features, get_featur= e and set_feature from cxl_mem_command[] and build and worked fine for the EDAC CXL features. For cxl_get_supported_features() to work , I removed following check. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D int cxl_get_supported_features(struct cxl_dev_state *cxlds) { int remain_feats, max_size, max_feats, start, rc; [...] /* Get supported features is optional, need to check */ cmd =3D cxl_mem_find_command(CXL_MBOX_OP_GET_SUPPORTED_FEATURES); if (!cmd) return -EOPNOTSUPP; if (!test_bit(cmd->info.id, cxl_mbox->enabled_cmds)) return -EOPNOTSUPP; [...] } =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=20 > >Setting that aside, the place where CXL EDAC and CXL FWCTL series can unif= y is >on the definition of the cxl_{get,set}_features() helpers proposed in this= series >for kernel-internal submission of CXL FEATURES commands. I think Dave's se= ries >should ingest cxl_{get,set}_features(), go in first since it does not have= cross- >subsystem entanglements, and then you can build reuse that infrastructure = to >finalize the CXL scrub implementation. Agree. I will reuse merged features infrastructure for the EDAC CXL feature= s. > >The missing piece in my mind to make cxl_{get,set}_features() usable with = the >CXL FWCTL path is likely to make it be able to support copying in / out of= __user >buffers. To me that looks like updating >cxl_internal_send_cmd() to use copy_{to,from}_sockptr() internally so that= it is >independent of the kernel vs user buffer concern from CXL EDAC vs CXL FWCT= L >callers. Ok. Thanks, Shiju