In preparation for soft-reserved resource handling, make the suspend infrastructure always available by removing the CONFIG_CXL_SUSPEND Kconfig option. This ensures cxl_mem_active_inc()/dec() and cxl_mem_active() are unconditionally available, enabling coordination between cxl_pci and cxl_mem drivers during region setup and hotplug operations. Co-developed-by: Nathan Fontenot <Nathan.Fontenot@xxxxxxx> Signed-off-by: Nathan Fontenot <Nathan.Fontenot@xxxxxxx> Co-developed-by: Terry Bowman <terry.bowman@xxxxxxx> Signed-off-by: Terry Bowman <terry.bowman@xxxxxxx> Signed-off-by: Smita Koralahalli <Smita.KoralahalliChannabasappa@xxxxxxx> --- drivers/cxl/Kconfig | 4 ---- drivers/cxl/core/Makefile | 2 +- drivers/cxl/core/suspend.c | 5 ++++- drivers/cxl/cxlmem.h | 9 --------- include/linux/pm.h | 7 ------- 5 files changed, 5 insertions(+), 22 deletions(-) diff --git a/drivers/cxl/Kconfig b/drivers/cxl/Kconfig index cf1ba673b8c2..d09144c2002e 100644 --- a/drivers/cxl/Kconfig +++ b/drivers/cxl/Kconfig @@ -118,10 +118,6 @@ config CXL_PORT default CXL_BUS tristate -config CXL_SUSPEND - def_bool y - depends on SUSPEND && CXL_MEM - config CXL_REGION bool "CXL: Region Support" default CXL_BUS diff --git a/drivers/cxl/core/Makefile b/drivers/cxl/core/Makefile index 086df97a0fcf..035864db8a32 100644 --- a/drivers/cxl/core/Makefile +++ b/drivers/cxl/core/Makefile @@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_CXL_BUS) += cxl_core.o -obj-$(CONFIG_CXL_SUSPEND) += suspend.o +obj-y += suspend.o ccflags-y += -I$(srctree)/drivers/cxl CFLAGS_trace.o = -DTRACE_INCLUDE_PATH=. -I$(src) diff --git a/drivers/cxl/core/suspend.c b/drivers/cxl/core/suspend.c index 29aa5cc5e565..5ba4b4de0e33 100644 --- a/drivers/cxl/core/suspend.c +++ b/drivers/cxl/core/suspend.c @@ -8,7 +8,10 @@ static atomic_t mem_active; bool cxl_mem_active(void) { - return atomic_read(&mem_active) != 0; + if (IS_ENABLED(CONFIG_CXL_MEM)) + return atomic_read(&mem_active) != 0; + + return false; } void cxl_mem_active_inc(void) diff --git a/drivers/cxl/cxlmem.h b/drivers/cxl/cxlmem.h index 3ec6b906371b..1bd1e88c4cc0 100644 --- a/drivers/cxl/cxlmem.h +++ b/drivers/cxl/cxlmem.h @@ -853,17 +853,8 @@ int cxl_trigger_poison_list(struct cxl_memdev *cxlmd); int cxl_inject_poison(struct cxl_memdev *cxlmd, u64 dpa); int cxl_clear_poison(struct cxl_memdev *cxlmd, u64 dpa); -#ifdef CONFIG_CXL_SUSPEND void cxl_mem_active_inc(void); void cxl_mem_active_dec(void); -#else -static inline void cxl_mem_active_inc(void) -{ -} -static inline void cxl_mem_active_dec(void) -{ -} -#endif int cxl_mem_sanitize(struct cxl_memdev *cxlmd, u16 cmd); diff --git a/include/linux/pm.h b/include/linux/pm.h index f0bd8fbae4f2..415928e0b6ca 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h @@ -35,14 +35,7 @@ static inline void pm_vt_switch_unregister(struct device *dev) } #endif /* CONFIG_VT_CONSOLE_SLEEP */ -#ifdef CONFIG_CXL_SUSPEND bool cxl_mem_active(void); -#else -static inline bool cxl_mem_active(void) -{ - return false; -} -#endif /* * Device power management -- 2.17.1