Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1666412rdb; Tue, 20 Feb 2024 03:28:05 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWxWJkKeRhtzf0EzEpEt1GbURq9ulnRolk3TJyl9Dw22gxDCi12RKbI0kMuOXZfo7QZ4yFihWEeLet4aqbInVIYXalhWXqBmB1/jZxVWg== X-Google-Smtp-Source: AGHT+IHzYjBGOM42YGlbrHYmuHpjN3lQt2jhBGBP6YFk5tvi1J4mQSmVGBwDt4eL8ZS8zEptlYCk X-Received: by 2002:a05:620a:40c3:b0:787:710d:3e92 with SMTP id g3-20020a05620a40c300b00787710d3e92mr5575787qko.15.1708428485134; Tue, 20 Feb 2024 03:28:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708428485; cv=pass; d=google.com; s=arc-20160816; b=rpQY0FN/t2BYV/OPeRCOsuERQasS789iJHu6sg/KMpckY0WXrSzh1yOZuPsYrSjRMx QYakbCO3zahmA46aeF+ejZhgQmB0K6R3F0ccMh6VZ2opJuKj4yVGvZJAXpEB3iUOYufr HnV1nN/8/bSYP55nv3DFFLfgD47BRRQFVTR7QmpP8SYAIdGcv+8CpazZjqGxhm90zdIq +GVDXl6aLOZ/E3lHeCYVv5XE41VNZ4ig2Ulh6HpPZgUcS0AZmvh3ZWX9un0YrAVbJr9r wGA1NN+zTL5bw7GWIIpcUiHbTPBzKa8rA90RqSGAuBB1aAIMbqKt0p4pOqHE8OGNTY/y IH9Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:organization:references :in-reply-to:message-id:subject:cc:to:from:date; bh=P+F1x799cH6nf62OG0MNHzcHmmpOqy2EUB4m94y9ri0=; fh=ehmdxMaNn1e64k03FAUDGH5ufF0BMazsqKtQWl0yC7M=; b=zUTrbYRttXo9aO4Fi4lPffd7zY/vxlJmwsdeLKmJH7VBhsSzyK1odpO1HuEowO34Jp UpNWFknXyxJ5XxTgWaYpmWSwa94CxPkZRF8EL+iNo8TrO5QY76ClvL7zUp7P3/bhT1aY c806A52Q+ktmGYaqhv12NampTNHYe4ZZbk7Od2vVUGBz+kdMG1yfajZ29zM/W/Ewb8xL zmRj+3QCBZchbSs11lwmmgRbEUvgSzSWZN+bLuZt6XWYeowYa+a/8YOsn09d+LrtiAc9 dPwGjfMQZShS6PKYYt/dgkL1CFDMaefjsgzQD4Pxfc7WFgCW9K74B+hf94Yd2hTRwymC I26Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-72908-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72908-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id c17-20020a37e111000000b00785d6c5e0bcsi8013544qkm.434.2024.02.20.03.28.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 03:28:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-72908-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-72908-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72908-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 6F6111C2095F for ; Tue, 20 Feb 2024 11:28:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A8AE9664CC; Tue, 20 Feb 2024 11:27:57 +0000 (UTC) Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 15901657DF; Tue, 20 Feb 2024 11:27:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708428477; cv=none; b=JQ6U8QWJEw9brwjohPYgRLhWqF9myLaZaNUNk7N0pdn6p1LfiWXKPgR0c4r622Bii+DBey+3z2OJpnMBz0rWojavP1ZoyGbvV2/Bg5ChxByUIEq5YPbOv9KBD3jhnpT/8lkz4XCoHxlXk5iVTaDvqOYk45iwXe0dCoN84i4POxE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708428477; c=relaxed/simple; bh=8VqIWgTI9rV7as7E7N/Ps62oG114E7yDwaMvhQ8NBUw=; h=Date:From:To:CC:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=tX/hKebNqCywQY/Sm8wRCk7cmsGSj+LtTz/VRms5AVvWsuRlK6aq9xlDblRH+pUfxOOHDfhv3xjEeNbPEMyvLEcntnMR4HJUMQO5lbBArA3v2Gge5qe6GoWOAj5v287uU9QPYDSeXffFZ7RafLgEY+mN3+j3NqQ6FwRGcBloBQU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=Huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=Huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.31]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4TfH8k4gnzz6D8wp; Tue, 20 Feb 2024 19:23:34 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id 6835A140F3F; Tue, 20 Feb 2024 19:27:51 +0800 (CST) Received: from localhost (10.202.227.76) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 20 Feb 2024 11:27:50 +0000 Date: Tue, 20 Feb 2024 11:27:49 +0000 From: Jonathan Cameron To: CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: Re: [RFC PATCH v6 03/12] cxl/mbox: Add SET_FEATURE mailbox command Message-ID: <20240220112749.00006578@Huawei.com> In-Reply-To: <20240215111455.1462-4-shiju.jose@huawei.com> References: <20240215111455.1462-1-shiju.jose@huawei.com> <20240215111455.1462-4-shiju.jose@huawei.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: lhrpeml500005.china.huawei.com (7.191.163.240) To lhrpeml500005.china.huawei.com (7.191.163.240) On Thu, 15 Feb 2024 19:14:45 +0800 wrote: > From: Shiju Jose > > Add support for SET_FEATURE mailbox command. > > CXL spec 3.1 section 8.2.9.6 describes optional device specific features. > CXL devices supports features with changeable attributes. > The settings of a feature can be optionally modified using Set Feature > command. Same thing as patch 2. We should be able to call this with a feature of any size and have it send multiple commands if necessary due to a small mailbox. We don't want higher layers to have to deal with complexity. We work around this for many other similar multipart transfers because they allow more direct control (e.g. get single item on poison list etc). Can't do that for features :( Get supported logs sublist will run into the same thing but the code isn't yet upstream (and the current implementation makes it a userspace problem). > > Signed-off-by: Shiju Jose > --- > drivers/cxl/core/mbox.c | 14 ++++++++++++++ > drivers/cxl/cxlmem.h | 27 +++++++++++++++++++++++++++ > 2 files changed, 41 insertions(+) > > diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c > index f43189b6859a..056576862b8a 100644 > --- a/drivers/cxl/core/mbox.c > +++ b/drivers/cxl/core/mbox.c > @@ -1335,6 +1335,20 @@ int cxl_get_feature(struct cxl_memdev_state *mds, > } > EXPORT_SYMBOL_NS_GPL(cxl_get_feature, CXL); > > +int cxl_set_feature(struct cxl_memdev_state *mds, void *feat_in, size_t size) Signature should be int cxl_set_feature(struct cxl_memdev_state *mds, uuid_t feat, void *feat_data, size_t feat_data_size); And the internal workings of this should deal with multipart transfers if needed (all current features are fairly small so the probably aren't). > +{ > + struct cxl_mbox_cmd mbox_cmd; > + > + mbox_cmd = (struct cxl_mbox_cmd) { > + .opcode = CXL_MBOX_OP_SET_FEATURE, > + .size_in = size, > + .payload_in = feat_in, > + }; > + > + return cxl_internal_send_cmd(mds, &mbox_cmd); > +} > +EXPORT_SYMBOL_NS_GPL(cxl_set_feature, CXL); > + > int cxl_mem_get_poison(struct cxl_memdev *cxlmd, u64 offset, u64 len, > struct cxl_region *cxlr) > { > diff --git a/drivers/cxl/cxlmem.h b/drivers/cxl/cxlmem.h > index eaecc3234cfd..2223ef3d3140 100644 > --- a/drivers/cxl/cxlmem.h > +++ b/drivers/cxl/cxlmem.h > @@ -531,6 +531,7 @@ enum cxl_opcode { > CXL_MBOX_OP_GET_LOG = 0x0401, > CXL_MBOX_OP_GET_SUPPORTED_FEATURES = 0x0500, > CXL_MBOX_OP_GET_FEATURE = 0x0501, > + CXL_MBOX_OP_SET_FEATURE = 0x0502, > CXL_MBOX_OP_IDENTIFY = 0x4000, > CXL_MBOX_OP_GET_PARTITION_INFO = 0x4100, > CXL_MBOX_OP_SET_PARTITION_INFO = 0x4101, > @@ -778,6 +779,31 @@ struct cxl_mbox_get_feat_in { > u8 selection; > } __packed; > > +/* Set Feature CXL 3.1 Spec 8.2.9.6.3 */ > +/* > + * Set Feature input payload > + * CXL rev 3.1 section 8.2.9.6.3 Table 8-101 > + */ > +/* Set Feature : Payload in flags */ > +#define CXL_SET_FEAT_FLAG_DATA_TRANSFER_MASK GENMASK(2, 0) > +enum cxl_set_feat_flag_data_transfer { > + CXL_SET_FEAT_FLAG_FULL_DATA_TRANSFER, > + CXL_SET_FEAT_FLAG_INITIATE_DATA_TRANSFER, > + CXL_SET_FEAT_FLAG_CONTINUE_DATA_TRANSFER, > + CXL_SET_FEAT_FLAG_FINISH_DATA_TRANSFER, > + CXL_SET_FEAT_FLAG_ABORT_DATA_TRANSFER, > + CXL_SET_FEAT_FLAG_DATA_TRANSFER_MAX > +}; > +#define CXL_SET_FEAT_FLAG_MOD_VALUE_SAVED_ACROSS_RESET BIT(3) > + > +struct cxl_mbox_set_feat_in { > + uuid_t uuid; > + __le32 flags; > + __le16 offset; > + u8 version; > + u8 rsvd[9]; > +} __packed; > + > /* Get Poison List CXL 3.0 Spec 8.2.9.8.4.1 */ > struct cxl_mbox_poison_in { > __le64 offset; > @@ -914,6 +940,7 @@ int cxl_get_supported_features(struct cxl_memdev_state *mds, > void *feats_out); > int cxl_get_feature(struct cxl_memdev_state *mds, > struct cxl_mbox_get_feat_in *pi, void *feat_out); > +int cxl_set_feature(struct cxl_memdev_state *mds, void *feat_in, size_t size); > int cxl_poison_state_init(struct cxl_memdev_state *mds); > int cxl_mem_get_poison(struct cxl_memdev *cxlmd, u64 offset, u64 len, > struct cxl_region *cxlr);