From: Jonathan Cameron <jonathan.cameron@huawei.com>
To: <alejandro.lucero-palau@amd.com>
Cc: <linux-cxl@vger.kernel.org>, <netdev@vger.kernel.org>,
<dan.j.williams@intel.com>, <edward.cree@amd.com>,
<davem@davemloft.net>, <kuba@kernel.org>, <pabeni@redhat.com>,
<edumazet@google.com>, <dave.jiang@intel.com>,
Alejandro Lucero <alucerop@amd.com>
Subject: Re: [PATCH v22 13/25] cxl: Export functions for unwinding cxl by accelerators
Date: Mon, 15 Dec 2025 13:53:03 +0000 [thread overview]
Message-ID: <20251215135303.00002f63@huawei.com> (raw)
In-Reply-To: <20251205115248.772945-14-alejandro.lucero-palau@amd.com>
On Fri, 5 Dec 2025 11:52:36 +0000
<alejandro.lucero-palau@amd.com> wrote:
> From: Alejandro Lucero <alucerop@amd.com>
>
> Add unregister_region() and cxl_decoder_detach() to the accelerator
> driver API for a clean exit.
>
> Signed-off-by: Alejandro Lucero <alucerop@amd.com>
In general seems fine but comment on type safety inline.
Jonathan
> ---
> drivers/cxl/core/core.h | 5 -----
> drivers/cxl/core/region.c | 4 +++-
> include/cxl/cxl.h | 9 +++++++++
> 3 files changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/cxl/core/core.h b/drivers/cxl/core/core.h
> index 1c1726856139..9a6775845afe 100644
> --- a/drivers/cxl/core/core.h
> +++ b/drivers/cxl/core/core.h
> @@ -15,11 +15,6 @@ extern const struct device_type cxl_pmu_type;
>
> extern struct attribute_group cxl_base_attribute_group;
>
> -enum cxl_detach_mode {
> - DETACH_ONLY,
> - DETACH_INVALIDATE,
> -};
> -
> #ifdef CONFIG_CXL_REGION
> extern struct device_attribute dev_attr_create_pmem_region;
> extern struct device_attribute dev_attr_create_ram_region;
> diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
> index 8166a402373e..104caa33b7bb 100644
> --- a/drivers/cxl/core/region.c
> +++ b/drivers/cxl/core/region.c
> @@ -2199,6 +2199,7 @@ int cxl_decoder_detach(struct cxl_region *cxlr,
> }
> return 0;
> }
> +EXPORT_SYMBOL_NS_GPL(cxl_decoder_detach, "CXL");
>
> static int __attach_target(struct cxl_region *cxlr,
> struct cxl_endpoint_decoder *cxled, int pos,
> @@ -2393,7 +2394,7 @@ static struct cxl_region *to_cxl_region(struct device *dev)
> return container_of(dev, struct cxl_region, dev);
> }
>
> -static void unregister_region(void *_cxlr)
> +void unregister_region(void *_cxlr)
> {
> struct cxl_region *cxlr = _cxlr;
> struct cxl_region_params *p = &cxlr->params;
> @@ -2412,6 +2413,7 @@ static void unregister_region(void *_cxlr)
> cxl_region_iomem_release(cxlr);
> put_device(&cxlr->dev);
> }
> +EXPORT_SYMBOL_NS_GPL(unregister_region, "CXL");
>
> static struct lock_class_key cxl_region_key;
>
> diff --git a/include/cxl/cxl.h b/include/cxl/cxl.h
> index f02dd817b40f..b8683c75dfde 100644
> --- a/include/cxl/cxl.h
> +++ b/include/cxl/cxl.h
> @@ -255,4 +255,13 @@ struct cxl_endpoint_decoder *cxl_get_committed_decoder(struct cxl_memdev *cxlmd,
> struct cxl_region **cxlr);
> struct range;
> int cxl_get_region_range(struct cxl_region *region, struct range *range);
> +enum cxl_detach_mode {
> + DETACH_ONLY,
> + DETACH_INVALIDATE,
> +};
> +
> +int cxl_decoder_detach(struct cxl_region *cxlr,
> + struct cxl_endpoint_decoder *cxled, int pos,
> + enum cxl_detach_mode mode);
> +void unregister_region(void *_cxlr);
I'd wrap this for an exposed interface that isn't going to be used
as a devm callback so we can make it type safe. Maybe making the
existing devm callback the one doing wrapping is cleanest route.
> #endif /* __CXL_CXL_H__ */
next prev parent reply other threads:[~2025-12-15 13:53 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-05 11:52 [PATCH v22 00/25] Type2 device basic support alejandro.lucero-palau
2025-12-05 11:52 ` [PATCH v22 01/25] cxl/mem: Arrange for always-synchronous memdev attach alejandro.lucero-palau
2025-12-05 11:52 ` [PATCH v22 02/25] cxl/port: Arrange for always synchronous endpoint attach alejandro.lucero-palau
2025-12-05 11:52 ` [PATCH v22 03/25] cxl/mem: Introduce a memdev creation ->probe() operation alejandro.lucero-palau
2025-12-05 11:52 ` [PATCH v22 04/25] cxl: Add type2 device basic support alejandro.lucero-palau
2025-12-05 11:52 ` [PATCH v22 05/25] sfc: add cxl support alejandro.lucero-palau
2025-12-05 11:52 ` [PATCH v22 06/25] cxl: Move pci generic code alejandro.lucero-palau
2025-12-05 11:52 ` [PATCH v22 07/25] cxl/sfc: Map cxl component regs alejandro.lucero-palau
2025-12-05 11:52 ` [PATCH v22 08/25] cxl/sfc: Initialize dpa without a mailbox alejandro.lucero-palau
2025-12-05 11:52 ` [PATCH v22 09/25] cxl: Prepare memdev creation for type2 alejandro.lucero-palau
2025-12-05 11:52 ` [PATCH v22 10/25] sfc: create type2 cxl memdev alejandro.lucero-palau
2025-12-05 11:52 ` [PATCH v22 11/25] cxl/hdm: Add support for getting region from committed decoder alejandro.lucero-palau
2025-12-15 13:50 ` Jonathan Cameron
2025-12-18 11:52 ` Alejandro Lucero Palau
2025-12-18 15:03 ` Jonathan Cameron
2025-12-18 15:27 ` Alejandro Lucero Palau
2025-12-19 11:02 ` Jonathan Cameron
2025-12-05 11:52 ` [PATCH v22 12/25] cxl: Add function for obtaining region range alejandro.lucero-palau
2025-12-05 11:52 ` [PATCH v22 13/25] cxl: Export functions for unwinding cxl by accelerators alejandro.lucero-palau
2025-12-15 13:53 ` Jonathan Cameron [this message]
2025-12-18 12:07 ` Alejandro Lucero Palau
2025-12-05 11:52 ` [PATCH v22 14/25] sfc: obtain decoder and region if committed by firmware alejandro.lucero-palau
2025-12-15 13:57 ` Jonathan Cameron
2025-12-18 12:14 ` Alejandro Lucero Palau
2025-12-05 11:52 ` [PATCH v22 15/25] cxl: Define a driver interface for HPA free space enumeration alejandro.lucero-palau
2025-12-05 11:52 ` [PATCH v22 16/25] sfc: get root decoder alejandro.lucero-palau
2025-12-05 11:52 ` [PATCH v22 17/25] cxl: Define a driver interface for DPA allocation alejandro.lucero-palau
2025-12-05 11:52 ` [PATCH v22 18/25] sfc: get endpoint decoder alejandro.lucero-palau
2025-12-05 11:52 ` [PATCH v22 19/25] cxl: Make region type based on endpoint type alejandro.lucero-palau
2025-12-05 11:52 ` [PATCH v22 20/25] cxl/region: Factor out interleave ways setup alejandro.lucero-palau
2025-12-05 11:52 ` [PATCH v22 21/25] cxl/region: Factor out interleave granularity setup alejandro.lucero-palau
2025-12-05 11:52 ` [PATCH v22 22/25] cxl: Allow region creation by type2 drivers alejandro.lucero-palau
2025-12-05 11:52 ` [PATCH v22 23/25] cxl: Avoid dax creation for accelerators alejandro.lucero-palau
2025-12-05 11:52 ` [PATCH v22 24/25] sfc: create cxl region alejandro.lucero-palau
2025-12-05 11:52 ` [PATCH v22 25/25] sfc: support pio mapping based on cxl alejandro.lucero-palau
2025-12-07 7:12 ` [PATCH v22 00/25] Type2 device basic support dan.j.williams
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=20251215135303.00002f63@huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=alejandro.lucero-palau@amd.com \
--cc=alucerop@amd.com \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=edward.cree@amd.com \
--cc=kuba@kernel.org \
--cc=linux-cxl@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/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