From patchwork Thu Feb 27 22:38:08 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shiju Jose X-Patchwork-Id: 13995264 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 46C7FC1B087 for ; Thu, 27 Feb 2025 22:39:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BE2E5280006; Thu, 27 Feb 2025 17:39:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BBAEB280001; Thu, 27 Feb 2025 17:39:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 922ED280006; Thu, 27 Feb 2025 17:39:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 6D8E6280005 for ; Thu, 27 Feb 2025 17:39:25 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 2F5A7523EF for ; Thu, 27 Feb 2025 22:39:25 +0000 (UTC) X-FDA: 83167192290.08.CC8DC4F Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by imf26.hostedemail.com (Postfix) with ESMTP id 24066140006 for ; Thu, 27 Feb 2025 22:39:22 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf26.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=1740695963; a=rsa-sha256; cv=none; b=nSRN4DBHt5IYFjavuBtlF2CjemjpCZFdf1cO0Y1uILi+JOwUX8xsxsT7L4kr/Oi4Tk2uou hbQvGugnsBnsTnAxqj7GcbNLgnsXHiyDGhtrp0ccuT5+lIbb4ZrZmnf80d0EpKpvw2o4u8 c2iODuS23bArzKGuVDcBTdI7jMXzb3I= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf26.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=1740695963; 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=XBw4EkbLTA5KlWUfmuOiueSNqzAYeTrCwsKt+6EsMUQ=; b=L0rWanbW2n97gXJkKBuajY8pGjeyP3QTM3A0m1ZsyfsmFltSftEHT39nFANc+CEoCWeD6C fSxHdRo55JWfZNpZ33X6q5pYS+43c3uWRvhNd70nW+SUvjRoWpNM3ka+AmgAYii2H5bDTi BoCET1NW26489MuJFSMCQaxxzB+T0bo= Received: from mail.maildlp.com (unknown [172.18.186.31]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Z3mPt6F5sz6L53w; Fri, 28 Feb 2025 06:35:30 +0800 (CST) Received: from frapeml500007.china.huawei.com (unknown [7.182.85.172]) by mail.maildlp.com (Postfix) with ESMTPS id BEB5C1400DA; Fri, 28 Feb 2025 06:39:19 +0800 (CST) Received: from P_UKIT01-A7bmah.china.huawei.com (10.48.149.240) by frapeml500007.china.huawei.com (7.182.85.172) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Thu, 27 Feb 2025 23:39:17 +0100 From: To: , , , , , , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH 1/8] cxl: Add helper function to retrieve a feature entry Date: Thu, 27 Feb 2025 22:38:08 +0000 Message-ID: <20250227223816.2036-2-shiju.jose@huawei.com> X-Mailer: git-send-email 2.43.0.windows.1 In-Reply-To: <20250227223816.2036-1-shiju.jose@huawei.com> References: <20250227223816.2036-1-shiju.jose@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.48.149.240] X-ClientProxiedBy: lhrpeml500011.china.huawei.com (7.191.174.215) To frapeml500007.china.huawei.com (7.182.85.172) X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 24066140006 X-Stat-Signature: 8ouug9yq8xiyb4n6fdbnpsgksc9eb1wx X-Rspam-User: X-HE-Tag: 1740695962-907141 X-HE-Meta: U2FsdGVkX1/b8Rk0aAP/6v2gJVwWW4tUJhUs+FXzT/xoj45VOHFEmV/Z4O7AYUH0HKqJsUd5ky9L97aznPtVyrZMmurcxr9Cf6gPbKDJKIixBjdgx+h8ypCrur0d1uiGgkAGRHepCJQPKl84zBDtMK1jygChtEcdoY/hBBbEOBDKF9BnEBB9EWPEry64DKgZnVPGUCEkyqHqW7W6RnQrLEJCVq8H49YrsF2o8CpLDcW4IjLZMH8PWncO06t9PS0QFsBPQscNDPB7W1q1iwyGRgTU0zzgnFm48ZYnWjJUBNNcd0ubwF0vIAz2kwOumql5EJQnWhelejHH3pzkPrJymVUREiGh/GZahKCNRVst0rbvB03IR/raKU60bYHPJuhUQy8RU7HreJUDbfyVeDjO4PcuFZLHVz0j4DyilZrfWl1z3BDiHsVfcjNl+e8TzKNuycRYfwXRdM4yXUZg2nW1j7q09FjsVJJwvXPkwSFzIZTjhqM3pdoqqGQd4amQeKlMxNXCU6LSyXn38I60L9lD2V3r05qqgo0kRsVrlb23+ngXKybA6gRWANDH7CXHJBbd29/OlW9ibkY2cM9v2a2hFFVp9Cy1/EG/5QsOn0QuKehPYthk/OziuLEVA3uVL5emIqaWe8lBiw+JdSVq7tV+DWJPkgfWRGHVyXXTJQ2i7ZJs9kAhJuyHBKEvWJndbqXFW4bGeV+iels7kwRfzqM/1GniP3YU9Yaod7iNJtDXzRzAJkRN/U6Xijo2qgJbC1SsH7i62tM93h7iWw2l511qWJfkhdjqqRmpWbNKOjrc6xYo4aP1zbSXJMgJXp0sPzoINlGNsv55wtQhiLK2pCU3OHimoUWEcN7AvcAaRmQNTZxnaPtaEE7opDDwlaM9Ibab3syeo73zNg3MwJH4z0wbolv16lRkByEnsTKdP1dC7jxNrjJJVjeo1KSltFFy8ZgfVeWsF43/xLzsBNcpRdl 2kJNnD1X lPjuaY/kwghLqIrbPF7Au3i959vzc8rEC368jkEf7LEBwRMA4Zb9y1makvuT7vfdjmrV1dRcfSjJnYYEFqaWKv8GbKqElqAWuLJIWxv5NL/QzmFAEPHjt06U1CUPari0DHzuYZafxWrHSNN2hwjZ8K6sr0JTOkgt9Q6B3w48Cn+WqkYds5d5T1b3HMcHp83SutOJyO7w1WNjyL6RawN/jDU02eA== 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 helper function to retrieve a feature entry from the supported features list, if supported. Signed-off-by: Shiju Jose Reviewed-by: Jonathan Cameron Reviewed-by: Fan Ni --- drivers/cxl/core/core.h | 2 ++ drivers/cxl/core/features.c | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/drivers/cxl/core/core.h b/drivers/cxl/core/core.h index 3d3b00835446..6c83f6f18122 100644 --- a/drivers/cxl/core/core.h +++ b/drivers/cxl/core/core.h @@ -120,6 +120,8 @@ int cxl_port_get_switch_dport_bandwidth(struct cxl_port *port, int cxl_gpf_port_setup(struct device *dport_dev, struct cxl_port *port); #ifdef CONFIG_CXL_FEATURES +struct cxl_feat_entry *cxl_get_feature_entry(struct cxl_dev_state *cxlds, + const uuid_t *feat_uuid); size_t cxl_get_feature(struct cxl_mailbox *cxl_mbox, const uuid_t *feat_uuid, enum cxl_get_feat_selection selection, void *feat_out, size_t feat_out_size, u16 offset, diff --git a/drivers/cxl/core/features.c b/drivers/cxl/core/features.c index 048ba4fc3538..c822fb4a8c33 100644 --- a/drivers/cxl/core/features.c +++ b/drivers/cxl/core/features.c @@ -203,6 +203,26 @@ int devm_cxl_setup_features(struct cxl_dev_state *cxlds) } EXPORT_SYMBOL_NS_GPL(devm_cxl_setup_features, "CXL"); +struct cxl_feat_entry *cxl_get_feature_entry(struct cxl_dev_state *cxlds, + const uuid_t *feat_uuid) +{ + struct cxl_features_state *cxlfs = to_cxlfs(cxlds); + struct cxl_feat_entry *feat_entry; + int count; + + /* + * Retrieve the feature entry from the supported features list, + * if the feature is supported. + */ + feat_entry = cxlfs->entries->ent; + for (count = 0; count < cxlfs->entries->num_features; count++, feat_entry++) { + if (uuid_equal(&feat_entry->uuid, feat_uuid)) + return feat_entry; + } + + return ERR_PTR(-ENOENT); +} + size_t cxl_get_feature(struct cxl_mailbox *cxl_mbox, const uuid_t *feat_uuid, enum cxl_get_feat_selection selection, void *feat_out, size_t feat_out_size, u16 offset,