[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1296674576.21750944182952.JavaMail.epsvc@epcpadp2new>
Date: Thu, 26 Jun 2025 15:30:06 +0530
From: Neeraj Kumar <s.neeraj@...sung.com>
To: Jonathan Cameron <Jonathan.Cameron@...wei.com>
Cc: dan.j.williams@...el.com, dave@...olabs.net, dave.jiang@...el.com,
alison.schofield@...el.com, vishal.l.verma@...el.com, ira.weiny@...el.com,
a.manzanares@...sung.com, nifan.cxl@...il.com, anisa.su@...sung.com,
vishak.g@...sung.com, krish.reddy@...sung.com, arun.george@...sung.com,
alok.rathore@...sung.com, neeraj.kernel@...il.com,
linux-kernel@...r.kernel.org, linux-cxl@...r.kernel.org,
nvdimm@...ts.linux.dev, gost.dev@...sung.com, cpgs@...sung.com
Subject: Re: [RFC PATCH 08/20] nvdimm/label: Include region label in slot
validation
On 23/06/25 10:13AM, Jonathan Cameron wrote:
>On Tue, 17 Jun 2025 18:09:32 +0530
>Neeraj Kumar <s.neeraj@...sung.com> wrote:
>
>> slot validation routine validates label slot by calculating label
>> checksum. It was only validating namespace label. This changeset also
>> validates region label if present.
>>
>> Also validate and calculate lsa v2.1 namespace label checksum
>>
>> Signed-off-by: Neeraj Kumar <s.neeraj@...sung.com>
>
>
>
>> diff --git a/drivers/nvdimm/nd.h b/drivers/nvdimm/nd.h
>> index 1e5a68013735..ca8256b31472 100644
>> --- a/drivers/nvdimm/nd.h
>> +++ b/drivers/nvdimm/nd.h
>> @@ -331,6 +331,22 @@ static inline bool nsl_region_uuid_equal(struct nd_namespace_label *ns_label,
>> return uuid_equal(&tmp, uuid);
>> }
>>
>> +static inline bool is_region_label(struct nvdimm_drvdata *ndd,
>> + struct nd_lsa_label *nd_label)
>> +{
>> + uuid_t ns_type, region_type;
>> +
>> + if (ndd->cxl) {
>> + uuid_parse(CXL_REGION_UUID, ®ion_type);
>> + import_uuid(&ns_type, nd_label->ns_label.cxl.type);
>> + if (uuid_equal(®ion_type, &ns_type))
>> + return true;
>> + else
>> + return false;
>
> return uuid_equal(®_type, &ns_type);
>
Sure, Will fix it in V1
>> + } else
>{}
>for all legs if one needs it.
>
>However, if you aren't going to add more code here later, just flip the condition
>and exit early.
>
> if (!ndd->cxl)
> return false;
>
> uuid_parse...
>
Thanks, Will fix it in V1
>> + return false;
>> +}
>> +
>> static inline bool rgl_uuid_equal(struct cxl_region_label *rg_label,
>> const uuid_t *uuid)
>> {
>> @@ -340,6 +356,11 @@ static inline bool rgl_uuid_equal(struct cxl_region_label *rg_label,
>> return uuid_equal(&tmp, uuid);
>> }
>>
>> +static inline u32 rgl_get_slot(struct cxl_region_label *rg_label)
>> +{
>> + return __le32_to_cpu(rg_label->slot);
>> +}
>> +
>> static inline u64 rgl_get_checksum(struct cxl_region_label *rg_label)
>> {
>> return __le64_to_cpu(rg_label->checksum);
>
Powered by blists - more mailing lists