[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <65c9679c-6e9e-4a31-a4dc-ae3c416bfd13@amd.com>
Date: Sat, 24 Jan 2026 19:30:10 -0800
From: "Koralahalli Channabasappa, Smita" <skoralah@....com>
To: Dave Jiang <dave.jiang@...el.com>,
Smita Koralahalli <Smita.KoralahalliChannabasappa@....com>,
linux-cxl@...r.kernel.org, linux-kernel@...r.kernel.org,
nvdimm@...ts.linux.dev, linux-fsdevel@...r.kernel.org,
linux-pm@...r.kernel.org, Jonathan Cameron <jonathan.cameron@...wei.com>
Cc: Ard Biesheuvel <ardb@...nel.org>,
Alison Schofield <alison.schofield@...el.com>,
Vishal Verma <vishal.l.verma@...el.com>, Ira Weiny <ira.weiny@...el.com>,
Dan Williams <dan.j.williams@...el.com>,
Jonathan Cameron <jonathan.cameron@...wei.com>,
Yazen Ghannam <yazen.ghannam@....com>, Davidlohr Bueso <dave@...olabs.net>,
Matthew Wilcox <willy@...radead.org>, Jan Kara <jack@...e.cz>,
"Rafael J . Wysocki" <rafael@...nel.org>, Len Brown <len.brown@...el.com>,
Pavel Machek <pavel@...nel.org>, Li Ming <ming.li@...omail.com>,
Jeff Johnson <jeff.johnson@....qualcomm.com>,
Ying Huang <huang.ying.caritas@...il.com>,
Yao Xingtao <yaoxt.fnst@...itsu.com>, Peter Zijlstra <peterz@...radead.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Nathan Fontenot <nathan.fontenot@....com>,
Terry Bowman <terry.bowman@....com>, Robert Richter <rrichter@....com>,
Benjamin Cheatham <benjamin.cheatham@....com>,
Zhijian Li <lizhijian@...itsu.com>, Borislav Petkov <bp@...en8.de>,
Tomasz Wolski <tomasz.wolski@...itsu.com>
Subject: Re: [PATCH v5 4/7] cxl/region: Add helper to check Soft Reserved
containment by CXL regions
On 1/23/2026 2:19 PM, Dave Jiang wrote:
>
>
> On 1/21/26 9:55 PM, Smita Koralahalli wrote:
>> Add a helper to determine whether a given Soft Reserved memory range is
>> fully contained within the committed CXL region.
>>
>> This helper provides a primitive for policy decisions in subsequent
>> patches such as co-ordination with dax_hmem to determine whether CXL has
>> fully claimed ownership of Soft Reserved memory ranges.
>>
>> No functional changes are introduced by this patch.
>>
>> Signed-off-by: Smita Koralahalli <Smita.KoralahalliChannabasappa@....com>
>
> Reviewed-by: Dave Jiang <dave.jiang@...el.com>
>
> Just a nit below.
Thank you Jonathan and Dave for the review.
>
>> ---
>> drivers/cxl/core/region.c | 29 +++++++++++++++++++++++++++++
>> drivers/cxl/cxl.h | 5 +++++
>> 2 files changed, 34 insertions(+)
>>
>> diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
>> index 45ee598daf95..9827a6dd3187 100644
>> --- a/drivers/cxl/core/region.c
>> +++ b/drivers/cxl/core/region.c
>> @@ -3875,6 +3875,35 @@ static int cxl_region_debugfs_poison_clear(void *data, u64 offset)
>> DEFINE_DEBUGFS_ATTRIBUTE(cxl_poison_clear_fops, NULL,
>> cxl_region_debugfs_poison_clear, "%llx\n");
>>
>> +static int cxl_region_contains_sr_cb(struct device *dev, void *data)
>
> Since it's a local helper, maybe just call it region_contains_soft_reserve()?
Okay I will rename in next revision.
Thanks
Smita
>
> DJ
>
>> +{
>> + struct resource *res = data;
>> + struct cxl_region *cxlr;
>> + struct cxl_region_params *p;
>> +
>> + if (!is_cxl_region(dev))
>> + return 0;
>> +
>> + cxlr = to_cxl_region(dev);
>> + p = &cxlr->params;
>> +
>> + if (p->state != CXL_CONFIG_COMMIT)
>> + return 0;
>> +
>> + if (!p->res)
>> + return 0;
>> +
>> + return resource_contains(p->res, res) ? 1 : 0;
>> +}
>> +
>> +bool cxl_region_contains_soft_reserve(const struct resource *res)
>> +{
>> + guard(rwsem_read)(&cxl_rwsem.region);
>> + return bus_for_each_dev(&cxl_bus_type, NULL, (void *)res,
>> + cxl_region_contains_sr_cb) != 0;
>> +}
>> +EXPORT_SYMBOL_GPL(cxl_region_contains_soft_reserve);
>> +
>> static int cxl_region_can_probe(struct cxl_region *cxlr)
>> {
>> struct cxl_region_params *p = &cxlr->params;
>> diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h
>> index c796c3db36e0..b0ff6b65ea0b 100644
>> --- a/drivers/cxl/cxl.h
>> +++ b/drivers/cxl/cxl.h
>> @@ -906,6 +906,7 @@ struct cxl_pmem_region *to_cxl_pmem_region(struct device *dev);
>> int cxl_add_to_region(struct cxl_endpoint_decoder *cxled);
>> struct cxl_dax_region *to_cxl_dax_region(struct device *dev);
>> u64 cxl_port_get_spa_cache_alias(struct cxl_port *endpoint, u64 spa);
>> +bool cxl_region_contains_soft_reserve(const struct resource *res);
>> #else
>> static inline bool is_cxl_pmem_region(struct device *dev)
>> {
>> @@ -928,6 +929,10 @@ static inline u64 cxl_port_get_spa_cache_alias(struct cxl_port *endpoint,
>> {
>> return 0;
>> }
>> +static inline bool cxl_region_contains_soft_reserve(const struct resource *res)
>> +{
>> + return false;
>> +}
>> #endif
>>
>> void cxl_endpoint_parse_cdat(struct cxl_port *port);
>
Powered by blists - more mailing lists