From: Dave Jiang <dave.jiang@intel.com>
To: alejandro.lucero-palau@amd.com, linux-cxl@vger.kernel.org,
dan.j.williams@intel.com
Cc: Alejandro Lucero <alucerop@amd.com>
Subject: Re: [PATCH v1 3/3] cxl/region: Factor out interleave granularity setup
Date: Tue, 24 Feb 2026 09:13:31 -0700 [thread overview]
Message-ID: <11ecbc8d-3105-4c65-a444-6bc64530d536@intel.com> (raw)
In-Reply-To: <20260224152645.3441489-4-alejandro.lucero-palau@amd.com>
On 2/24/26 8:26 AM, alejandro.lucero-palau@amd.com wrote:
> From: Alejandro Lucero <alucerop@amd.com>
>
> Region creation based on Type3 devices is triggered from user space
same comment here as for 2/3.
> allowing memory combination through interleaving.
>
> In preparation for kernel driven region creation, that is Type2 drivers
> triggering region creation backed with its advertised CXL memory, factor
> out a common helper from the user-sysfs region setup forinterleave
> granularity.
>
> Signed-off-by: Alejandro Lucero <alucerop@amd.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> ---
> drivers/cxl/core/region.c | 36 ++++++++++++++++++++++++------------
> 1 file changed, 24 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
> index 3ef4ccf1c92b..aed3733490a1 100644
> --- a/drivers/cxl/core/region.c
> +++ b/drivers/cxl/core/region.c
> @@ -559,21 +559,14 @@ static ssize_t interleave_granularity_show(struct device *dev,
> return sysfs_emit(buf, "%d\n", p->interleave_granularity);
> }
>
> -static ssize_t interleave_granularity_store(struct device *dev,
> - struct device_attribute *attr,
> - const char *buf, size_t len)
> +static int set_interleave_granularity(struct cxl_region *cxlr, int val)
> {
> - struct cxl_region *cxlr = to_cxl_region(dev);
> struct cxl_root_decoder *cxlrd = cxlr->cxlrd;
> struct cxl_decoder *cxld = &cxlrd->cxlsd.cxld;
> struct cxl_region_params *p = &cxlr->params;
> - int rc, val;
> + int rc;
> u16 ig;
>
> - rc = kstrtoint(buf, 0, &val);
> - if (rc)
> - return rc;
> -
> rc = granularity_to_eig(val, &ig);
> if (rc)
> return rc;
> @@ -589,14 +582,33 @@ static ssize_t interleave_granularity_store(struct device *dev,
> if (cxld->interleave_ways > 1 && val != cxld->interleave_granularity)
> return -EINVAL;
>
> - ACQUIRE(rwsem_write_kill, rwsem)(&cxl_rwsem.region);
> - if ((rc = ACQUIRE_ERR(rwsem_write_kill, &rwsem)))
> - return rc;
> + lockdep_assert_held_write(&cxl_rwsem.region);
>
> if (p->state >= CXL_CONFIG_INTERLEAVE_ACTIVE)
> return -EBUSY;
>
> p->interleave_granularity = val;
> + return 0;
> +}
> +
> +static ssize_t interleave_granularity_store(struct device *dev,
> + struct device_attribute *attr,
> + const char *buf, size_t len)
> +{
> + struct cxl_region *cxlr = to_cxl_region(dev);
> + int rc, val;
> +
> + rc = kstrtoint(buf, 0, &val);
> + if (rc)
> + return rc;
> +
> + ACQUIRE(rwsem_write_kill, rwsem)(&cxl_rwsem.region);
> + if ((rc = ACQUIRE_ERR(rwsem_write_kill, &rwsem)))
> + return rc;
> +
> + rc = set_interleave_granularity(cxlr, val);
> + if (rc)
> + return rc;
>
> return len;
> }
next prev parent reply other threads:[~2026-02-24 16:13 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-24 15:26 [PATCH v1 0/3] cxl region changes for Type2 support alejandro.lucero-palau
2026-02-24 15:26 ` [PATCH v1 1/3] cxl: Make region type based on endpoint type alejandro.lucero-palau
2026-02-24 16:04 ` Gregory Price
2026-02-24 15:26 ` [PATCH v1 2/3] cxl/region: Factor out interleave ways setup alejandro.lucero-palau
2026-02-24 15:54 ` Dave Jiang
2026-02-24 16:21 ` Alejandro Lucero Palau
2026-02-24 16:05 ` Gregory Price
2026-02-24 15:26 ` [PATCH v1 3/3] cxl/region: Factor out interleave granularity setup alejandro.lucero-palau
2026-02-24 16:06 ` Gregory Price
2026-02-24 16:13 ` Dave Jiang [this message]
2026-02-24 15:39 ` [PATCH v1 0/3] cxl region changes for Type2 support Dave Jiang
2026-02-24 16:20 ` Alejandro Lucero Palau
2026-02-24 16:06 ` Gregory Price
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=11ecbc8d-3105-4c65-a444-6bc64530d536@intel.com \
--to=dave.jiang@intel.com \
--cc=alejandro.lucero-palau@amd.com \
--cc=alucerop@amd.com \
--cc=dan.j.williams@intel.com \
--cc=linux-cxl@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox