@@ -43,6 +43,27 @@ bool is_cxl_feature_exclusive(struct cxl_feat_entry *entry)
}
EXPORT_SYMBOL_NS_GPL(is_cxl_feature_exclusive, "CXL");
+struct cxl_feat_entry *cxl_get_feature_entry(struct cxl_memdev *cxlmd,
+ const uuid_t *feat_uuid)
+{
+ struct cxl_features_state *cxlfs = cxlmd->cxlfs;
+ 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;
+ for (count = 0; count < cxlfs->num_features; count++, feat_entry++) {
+ if (uuid_equal(&feat_entry->uuid, feat_uuid))
+ return feat_entry;
+ }
+
+ return ERR_PTR(-ENOENT);
+}
+EXPORT_SYMBOL_NS_GPL(cxl_get_feature_entry, "CXL");
+
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,
@@ -68,6 +68,8 @@ struct cxl_features_state {
};
struct cxl_mailbox;
+struct cxl_feat_entry *cxl_get_feature_entry(struct cxl_memdev *cxlmd,
+ 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,