All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
To: Yuquan Wang <wangyuquan1236@phytium.com.cn>
Cc: <dave@stgolabs.net>, <dave.jiang@intel.com>,
	<alison.schofield@intel.com>, <vishal.l.verma@intel.com>,
	<ira.weiny@intel.com>, <dan.j.williams@intel.com>,
	<linux-cxl@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<chenbaozi@phytium.com.cn>
Subject: Re: [PATCH v2 0/1] cxl/pmem: debug invalid serial number data
Date: Fri, 14 Feb 2025 13:26:04 +0000	[thread overview]
Message-ID: <20250214132604.000078c0@huawei.com> (raw)
In-Reply-To: <20250214030952.4047438-1-wangyuquan1236@phytium.com.cn>

On Fri, 14 Feb 2025 11:09:51 +0800
Yuquan Wang <wangyuquan1236@phytium.com.cn> wrote:

> Background
> ==========
> In Qemu environment, the default serial number of cxl-type3 device
> is UI64_NULL.

Doesn't matter but technically it's just not presented by QEMU unless
specified.

The internal default is UI64_NULL but if we match that when creating
the config space stuff we just skip the serial number capability.

I'm glad to see some hardening around this as I ran into same thing
long ago (that's when I realized we were missing serial number support :(

Jonathan

> But we could still use it to create a nvdimm pmem region
> and set a non-zero cookie of nd_interleave_set, for example:
>   1. create a cxl pmem region interleaved with 2 devices (one with
>      serial number 0 and the other with serial number 1), and the cookie
>      would be non-zero/valid.
>   2. create the second cxl pmem region by 1 device with no serial number
>      and this region would have a non-zero cookie because the offset of
>      dpa is non-zero.
> 
> Problem
> =======
> In a nvdimm interleave-set each device with an invalid or zero
> serial number may cause pmem region initialization to fail, but in
> cxl case such device could still set cookies of nd_interleave_set
> and create a nvdimm pmem region.
> 
> CXL Pmem Validation
> ===================
> This patch adds the validation of serial number in cxl pmem region creation.
> The event of no serial number would cause to fail to set the cookie
> and pmem region.
> 
> cxl-test
> ========
> A mock serial number is set from the platform device id and 0 is a valid
> platform device id. For cxl-test to work properly, always +1 on mock
> device's serial number.
> 
> Yuquan Wang (1):
>   cxl/pmem: debug invalid serial number data
> 
>  drivers/cxl/pmem.c           | 7 +++++++
>  tools/testing/cxl/test/mem.c | 2 +-
>  2 files changed, 8 insertions(+), 1 deletion(-)
> 


      parent reply	other threads:[~2025-02-14 13:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-14  3:09 [PATCH v2 0/1] cxl/pmem: debug invalid serial number data Yuquan Wang
2025-02-14  3:09 ` [PATCH v2 1/1] " Yuquan Wang
2025-02-14 13:31   ` Jonathan Cameron
2025-02-14 13:26 ` Jonathan Cameron [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250214132604.000078c0@huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=alison.schofield@intel.com \
    --cc=chenbaozi@phytium.com.cn \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=dave@stgolabs.net \
    --cc=ira.weiny@intel.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vishal.l.verma@intel.com \
    --cc=wangyuquan1236@phytium.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.