public inbox for linux-cxl@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Jiang <dave.jiang@intel.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: patches@lists.linux.dev, linux-cxl@vger.kernel.org,
	alison.schofield@intel.com,
	Smita.KoralahalliChannabasappa@amd.com
Subject: Re: [PATCH 3/9] cxl/region: Limit visibility of cxl_region_contains_resource()
Date: Fri, 27 Mar 2026 09:39:22 -0700	[thread overview]
Message-ID: <37a5ee0d-c60d-4775-8fbb-1c94247e7bb8@intel.com> (raw)
In-Reply-To: <20260327052821.440749-4-dan.j.williams@intel.com>



On 3/26/26 10:28 PM, Dan Williams wrote:
> The dax_hmem dependency on cxl_region_contains_resource() is a one-off
> special case. It is not suitable for other use cases.
> 
> Move the definition to the other CONFIG_CXL_REGION guarded definitions in
> drivers/cxl/cxl.h and include that by a relative path include. This matches
> what drivers/dax/cxl.c does for its limited private usage of CXL core
> symbols.
> 
> Reduce the symbol export visibility from global to just dax_hmem, to
> further clarify its applicability.
> 
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>

Reviewed-by: Dave Jiang <dave.jiang@intel.com>

> ---
>  drivers/cxl/cxl.h         |  5 +++++
>  include/cxl/cxl.h         | 15 ---------------
>  drivers/cxl/core/region.c |  3 +--
>  drivers/dax/hmem/hmem.c   |  2 +-
>  4 files changed, 7 insertions(+), 18 deletions(-)
>  delete mode 100644 include/cxl/cxl.h
> 
> diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h
> index 30a31968f266..84ad04a02bde 100644
> --- a/drivers/cxl/cxl.h
> +++ b/drivers/cxl/cxl.h
> @@ -941,6 +941,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_resource(struct resource *res);
>  #else
>  static inline bool is_cxl_pmem_region(struct device *dev)
>  {
> @@ -963,6 +964,10 @@ static inline u64 cxl_port_get_spa_cache_alias(struct cxl_port *endpoint,
>  {
>  	return 0;
>  }
> +static inline bool cxl_region_contains_resource(struct resource *res)
> +{
> +	return false;
> +}
>  #endif
>  
>  void cxl_endpoint_parse_cdat(struct cxl_port *port);
> diff --git a/include/cxl/cxl.h b/include/cxl/cxl.h
> deleted file mode 100644
> index b12d3d0f6658..000000000000
> --- a/include/cxl/cxl.h
> +++ /dev/null
> @@ -1,15 +0,0 @@
> -/* SPDX-License-Identifier: GPL-2.0-only */
> -/* Copyright (c) 2026 Advanced Micro Devices, Inc. */
> -#ifndef _CXL_H_
> -#define _CXL_H_
> -
> -#ifdef CONFIG_CXL_REGION
> -bool cxl_region_contains_resource(struct resource *res);
> -#else
> -static inline bool cxl_region_contains_resource(struct resource *res)
> -{
> -	return false;
> -}
> -#endif
> -
> -#endif /* _CXL_H_ */
> diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
> index b72556c1458b..12a9572f34d5 100644
> --- a/drivers/cxl/core/region.c
> +++ b/drivers/cxl/core/region.c
> @@ -12,7 +12,6 @@
>  #include <linux/idr.h>
>  #include <linux/memory-tiers.h>
>  #include <linux/string_choices.h>
> -#include <cxl/cxl.h>
>  #include <cxlmem.h>
>  #include <cxl.h>
>  #include "core.h"
> @@ -4253,7 +4252,7 @@ bool cxl_region_contains_resource(struct resource *res)
>  	return bus_for_each_dev(&cxl_bus_type, NULL, res,
>  				region_contains_resource) != 0;
>  }
> -EXPORT_SYMBOL_GPL(cxl_region_contains_resource);
> +EXPORT_SYMBOL_FOR_MODULES(cxl_region_contains_resource, "dax_hmem");
>  
>  static int cxl_region_can_probe(struct cxl_region *cxlr)
>  {
> diff --git a/drivers/dax/hmem/hmem.c b/drivers/dax/hmem/hmem.c
> index 9ceda6b5cadf..0051e553c33f 100644
> --- a/drivers/dax/hmem/hmem.c
> +++ b/drivers/dax/hmem/hmem.c
> @@ -3,7 +3,7 @@
>  #include <linux/memregion.h>
>  #include <linux/module.h>
>  #include <linux/dax.h>
> -#include <cxl/cxl.h>
> +#include "../../cxl/cxl.h"
>  #include "../bus.h"
>  
>  static bool region_idle;


  reply	other threads:[~2026-03-27 16:39 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-27  5:28 [PATCH 0/9] dax/hmem: Add tests for the dax_hmem takeover capability Dan Williams
2026-03-27  5:28 ` [PATCH 1/9] cxl/region: Fix use-after-free from auto assembly failure Dan Williams
2026-03-27 16:28   ` Dave Jiang
2026-03-27 19:20   ` Alison Schofield
2026-03-27 21:54     ` Dan Williams
2026-03-27 22:37       ` Alison Schofield
2026-03-27 23:43   ` Alison Schofield
2026-03-30 20:24   ` Ira Weiny
2026-03-27  5:28 ` [PATCH 2/9] dax/cxl: Fix HMEM dependencies Dan Williams
2026-03-27 16:29   ` Dave Jiang
2026-03-27 23:44   ` Alison Schofield
2026-03-30 21:10   ` Ira Weiny
2026-03-27  5:28 ` [PATCH 3/9] cxl/region: Limit visibility of cxl_region_contains_resource() Dan Williams
2026-03-27 16:39   ` Dave Jiang [this message]
2026-03-27 23:45   ` Alison Schofield
2026-03-30 22:19   ` Ira Weiny
2026-03-27  5:28 ` [PATCH 4/9] cxl/region: Constify cxl_region_resource_contains() Dan Williams
2026-03-27 16:40   ` Dave Jiang
2026-03-27 23:45   ` Alison Schofield
2026-03-30 22:22   ` Ira Weiny
2026-03-27  5:28 ` [PATCH 5/9] dax/hmem: Reduce visibility of dax_cxl coordination symbols Dan Williams
2026-03-27 16:46   ` Dave Jiang
2026-03-27 23:46   ` Alison Schofield
2026-03-30 22:26   ` Ira Weiny
2026-03-27  5:28 ` [PATCH 6/9] dax/hmem: Fix singleton confusion between dax_hmem_work and hmem devices Dan Williams
2026-03-27 17:06   ` Dave Jiang
2026-03-27 23:46   ` Alison Schofield
2026-03-31 17:32   ` Ira Weiny
2026-03-27  5:28 ` [PATCH 7/9] dax/hmem: Parent dax_hmem devices Dan Williams
2026-03-27 17:07   ` Dave Jiang
2026-03-27 23:47   ` Alison Schofield
2026-03-31 17:42   ` Ira Weiny
2026-03-27  5:28 ` [PATCH 8/9] tools/testing/cxl: Simulate auto-assembly failure Dan Williams
2026-03-27 17:08   ` Dave Jiang
2026-03-27 23:48   ` Alison Schofield
2026-03-31 17:43   ` Ira Weiny
2026-03-27  5:28 ` [PATCH 9/9] tools/testing/cxl: Test dax_hmem takeover of CXL regions Dan Williams
2026-03-27 17:10   ` Dave Jiang
2026-03-27 23:58   ` Alison Schofield
2026-03-28  3:20     ` Dan Williams
2026-03-31 17:57   ` Ira Weiny
2026-03-31 18:13   ` Alison Schofield
2026-03-27 23:42 ` [PATCH 0/9] dax/hmem: Add tests for the dax_hmem takeover capability Alison Schofield
2026-03-30 21:12 ` Koralahalli Channabasappa, Smita
2026-03-30 21:17   ` Dave Jiang
2026-03-31 21:57 ` Dave Jiang

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=37a5ee0d-c60d-4775-8fbb-1c94247e7bb8@intel.com \
    --to=dave.jiang@intel.com \
    --cc=Smita.KoralahalliChannabasappa@amd.com \
    --cc=alison.schofield@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=patches@lists.linux.dev \
    /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