RE: [PATCH v19 07/15] cxl: Add helper function to retrieve a feature entry
From: Shiju Jose
Date: Tue Feb 11 2025 - 15:46:33 EST
>-----Original Message-----
>From: Dave Jiang <dave.jiang@xxxxxxxxx>
>Sent: 11 February 2025 02:40
>To: Shiju Jose <shiju.jose@xxxxxxxxxx>; linux-edac@xxxxxxxxxxxxxxx; linux-
>cxl@xxxxxxxxxxxxxxx; linux-acpi@xxxxxxxxxxxxxxx; linux-mm@xxxxxxxxx; linux-
>kernel@xxxxxxxxxxxxxxx
>Cc: linux-doc@xxxxxxxxxxxxxxx; bp@xxxxxxxxx; tony.luck@xxxxxxxxx;
>rafael@xxxxxxxxxx; lenb@xxxxxxxxxx; mchehab@xxxxxxxxxx;
>dan.j.williams@xxxxxxxxx; dave@xxxxxxxxxxxx; Jonathan Cameron
><jonathan.cameron@xxxxxxxxxx>; alison.schofield@xxxxxxxxx;
>vishal.l.verma@xxxxxxxxx; ira.weiny@xxxxxxxxx; david@xxxxxxxxxx;
>Vilas.Sridharan@xxxxxxx; leo.duran@xxxxxxx; Yazen.Ghannam@xxxxxxx;
>rientjes@xxxxxxxxxx; jiaqiyan@xxxxxxxxxx; Jon.Grimm@xxxxxxx;
>dave.hansen@xxxxxxxxxxxxxxx; naoya.horiguchi@xxxxxxx;
>james.morse@xxxxxxx; jthoughton@xxxxxxxxxx; somasundaram.a@xxxxxxx;
>erdemaktas@xxxxxxxxxx; pgonda@xxxxxxxxxx; duenwen@xxxxxxxxxx;
>gthelen@xxxxxxxxxx; wschwartz@xxxxxxxxxxxxxxxxxxx;
>dferguson@xxxxxxxxxxxxxxxxxxx; wbs@xxxxxxxxxxxxxxxxxxxxxx;
>nifan.cxl@xxxxxxxxx; tanxiaofei <tanxiaofei@xxxxxxxxxx>; Zengtao (B)
><prime.zeng@xxxxxxxxxxxxx>; Roberto Sassu <roberto.sassu@xxxxxxxxxx>;
>kangkang.shen@xxxxxxxxxxxxx; wanghuiqiang <wanghuiqiang@xxxxxxxxxx>;
>Linuxarm <linuxarm@xxxxxxxxxx>
>Subject: Re: [PATCH v19 07/15] cxl: Add helper function to retrieve a feature
>entry
>
>
>
>On 2/7/25 7:44 AM, shiju.jose@xxxxxxxxxx wrote:
>> From: Shiju Jose <shiju.jose@xxxxxxxxxx>
>>
>> Add helper function to retrieve a feature entry from the supported
>> features list, if supported.
>>
>> Signed-off-by: Shiju Jose <shiju.jose@xxxxxxxxxx>
>> ---
>> drivers/cxl/core/features.c | 21 +++++++++++++++++++++
>> include/cxl/features.h | 2 ++
>> 2 files changed, 23 insertions(+)
>>
>> diff --git a/drivers/cxl/core/features.c b/drivers/cxl/core/features.c
>> index 5f64185a5c7a..bf175e69cda1 100644
>> --- a/drivers/cxl/core/features.c
>> +++ b/drivers/cxl/core/features.c
>> @@ -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");
>
>You probably don't need this if the memfeature code are in CXL core.
Hi Dave,
You are right. At present, EXPORT_SYMBOL_NS_GPL(cxl_get_feature_entry) is not required.
>
>DJ
>
>> +
>> 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/include/cxl/features.h b/include/cxl/features.h index
>> e52d0573f504..563d966beee5 100644
>> --- a/include/cxl/features.h
>> +++ b/include/cxl/features.h
>> @@ -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,
>
>
Thanks,
Shiju