Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp383652rdb; Thu, 15 Feb 2024 03:15:47 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWohu6lzcmzXIITe/w6f7Te+RAvSteY54+WA5LbeZc9OtzMsNEXMR5H+qOBlcsmJc/H6H75hHI9jHhcF/Mc/Sdcc7qgfuY9pywpmlWwfA== X-Google-Smtp-Source: AGHT+IGxgH031ddKfwZ40mLqWDNmLT+f3mnNgdRo+ZPmieHG8AOd8wRqVENbPW/j8JgggClWFhqP X-Received: by 2002:a17:906:f28c:b0:a3d:ac47:614a with SMTP id gu12-20020a170906f28c00b00a3dac47614amr325384ejb.10.1707995747076; Thu, 15 Feb 2024 03:15:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707995747; cv=pass; d=google.com; s=arc-20160816; b=r7s2ci8Fqb/GLfg/0kxdxfOlJwIYulW06brJfNA4nm0AdSawGdaeLBso/it3aUBSE5 t6JVb22kjsqGioVgdr9dO9L+YQnuZeOfGG/+0pKQjIc/O0xT8gKbZGXqeD28jqD7iYaH 6ZOssj8L2qPJFW9lYIMqaYlJtc01cWgvoYW8H9JPE6JEwMVMcZA5OtQOzo9R6BJrcfd2 0hl/NMHBkYXXRnkbMHi63SxniudL5TEA4TIO6OYYpYmT7fYxlEZsy6BqSMOjfjGTKtgA trE4zRiTKqwGtYkR4gePW8+zLuegHCBWgSoWENMvWWm2kHSs24y3FNOftDUNiqIo9O+z sEmA== 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:references:in-reply-to:message-id :date:subject:cc:to:from; bh=OXp/r5asDadSLFNBBsXrAjoXHkXI/bBTNbonYYfXR/8=; fh=HSG1GuUk1qrw7ZagzQBYl1ym3Aq+DwkDC5iYsmK8j3I=; b=zKjsBr730kq1fdzM6EbwjI7CogB88ldjGBWoFNzhmQoWt/BTNDxSevUqXadQx+r1aF j6qF8+Pq9lWX0udXj1lG/TmV3ub6WGGvv+E386V1rI5TdDcV2OrDuwHf8OfPch9g0IGq aIU3pEDWk/olPr9FDEUBH435dBjEhryhbqxBWEbleY5fiYhN0yfUrLqUvrmbzsGtg7Em GeVUo9tbOyWrLNzyhFqTPsU6KpE6Mx5phGz1MIglkUuASdrwsy5r6I6Kn8ZfvIIvNuZf 01efgG5Flek0cho6ahFC5Tcwi9KIdh+jyqC1f5cIC7YmrbKT+bUtGhjHWM3U/dManP5A RN5g==; 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-66756-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66756-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id dc22-20020a170906c7d600b00a3d642aad6dsi543789ejb.372.2024.02.15.03.15.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 03:15:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-66756-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; 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-66756-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66756-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 am.mirrors.kernel.org (Postfix) with ESMTPS id D00151F216A4 for ; Thu, 15 Feb 2024 11:15:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9E81012BE91; Thu, 15 Feb 2024 11:15:12 +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 32217127B62; Thu, 15 Feb 2024 11:15:09 +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=1707995712; cv=none; b=ggElO6Imjfl+8vBfgmBOL8wEnDE1ciR0eJ8pSz+04rl36xFs6Eak0G7GqIGBr7wBY6lYFVZOBVxFL3ETyPsf1Bk7rNuNecw8aP+AqvmrD8lnJhTWlyITWiOwFD5oVxrU8KnGem3hlPlgBLOXew771mITULW0LDm/KPrWCmOprws= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707995712; c=relaxed/simple; bh=eNnY42J9aUqQwOcptqM3vzEXq5MytzSfG8IsDJyu2X8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=nU9JW0kwYx5F6XyAgScFyr9IAVgy2pxJ3ZBw8bl8LSG/QZyfQIwZnujQIK+1gg6nvKSlEG75zrkGyxeobSSRr6WQBoS9mfARNfepuVgex/saKCPtaP2KdHPNGS7Bof44WWSg2ipijWgGK167IT0+tiuJgzbbsoB45B9C/G+3NX8= 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.231]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4TbC6d1wZSz6J9xX; Thu, 15 Feb 2024 19:11:05 +0800 (CST) Received: from lhrpeml500006.china.huawei.com (unknown [7.191.161.198]) by mail.maildlp.com (Postfix) with ESMTPS id 6E39D140B55; Thu, 15 Feb 2024 19:15:07 +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, 15 Feb 2024 11:15:06 +0000 From: To: , , , , , , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [RFC PATCH v6 03/12] cxl/mbox: Add SET_FEATURE mailbox command Date: Thu, 15 Feb 2024 19:14:45 +0800 Message-ID: <20240215111455.1462-4-shiju.jose@huawei.com> X-Mailer: git-send-email 2.35.1.windows.2 In-Reply-To: <20240215111455.1462-1-shiju.jose@huawei.com> References: <20240215111455.1462-1-shiju.jose@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: lhrpeml100001.china.huawei.com (7.191.160.183) To lhrpeml500006.china.huawei.com (7.191.161.198) 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. 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) +{ + 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); -- 2.34.1