[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250603221949.53272-4-Smita.KoralahalliChannabasappa@amd.com>
Date: Tue, 3 Jun 2025 22:19:45 +0000
From: Smita Koralahalli <Smita.KoralahalliChannabasappa@....com>
To: <linux-cxl@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<nvdimm@...ts.linux.dev>, <linux-fsdevel@...r.kernel.org>,
<linux-pm@...r.kernel.org>
CC: Davidlohr Bueso <dave@...olabs.net>, Jonathan Cameron
<jonathan.cameron@...wei.com>, Dave Jiang <dave.jiang@...el.com>, "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>, 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 KH <gregkh@...uxfoundation.org>,
Nathan Fontenot <nathan.fontenot@....com>, Smita Koralahalli
<Smita.KoralahalliChannabasappa@....com>, Terry Bowman
<terry.bowman@....com>, Robert Richter <rrichter@....com>, Benjamin Cheatham
<benjamin.cheatham@....com>, PradeepVineshReddy Kodamati
<PradeepVineshReddy.Kodamati@....com>, Zhijian Li <lizhijian@...itsu.com>
Subject: [PATCH v4 3/7] cxl/pci: Add pci_loaded tracking to mark PCI driver readiness
Introduce a pci_loaded flag similar to mem_active, and define
mark_cxl_pci_loaded() to indicate when the PCI driver has initialized.
This will be used by other CXL components, such as cxl_acpi and the soft
reserved resource handling logic, to coordinate initialization and ensure
that dependent operations proceed only after both cxl_pci and cxl_mem
drivers are ready.
Co-developed-by: Nathan Fontenot <Nathan.Fontenot@....com>
Signed-off-by: Nathan Fontenot <Nathan.Fontenot@....com>
Co-developed-by: Terry Bowman <terry.bowman@....com>
Signed-off-by: Terry Bowman <terry.bowman@....com>
Signed-off-by: Smita Koralahalli <Smita.KoralahalliChannabasappa@....com>
---
drivers/cxl/core/suspend.c | 8 ++++++++
drivers/cxl/cxlpci.h | 1 +
drivers/cxl/pci.c | 2 ++
3 files changed, 11 insertions(+)
diff --git a/drivers/cxl/core/suspend.c b/drivers/cxl/core/suspend.c
index 5ba4b4de0e33..72818a2c8ec8 100644
--- a/drivers/cxl/core/suspend.c
+++ b/drivers/cxl/core/suspend.c
@@ -3,8 +3,10 @@
#include <linux/atomic.h>
#include <linux/export.h>
#include "cxlmem.h"
+#include "cxlpci.h"
static atomic_t mem_active;
+static atomic_t pci_loaded;
bool cxl_mem_active(void)
{
@@ -25,3 +27,9 @@ void cxl_mem_active_dec(void)
atomic_dec(&mem_active);
}
EXPORT_SYMBOL_NS_GPL(cxl_mem_active_dec, "CXL");
+
+void mark_cxl_pci_loaded(void)
+{
+ atomic_inc(&pci_loaded);
+}
+EXPORT_SYMBOL_NS_GPL(mark_cxl_pci_loaded, "CXL");
diff --git a/drivers/cxl/cxlpci.h b/drivers/cxl/cxlpci.h
index 54e219b0049e..5a811ac63fcf 100644
--- a/drivers/cxl/cxlpci.h
+++ b/drivers/cxl/cxlpci.h
@@ -135,4 +135,5 @@ void read_cdat_data(struct cxl_port *port);
void cxl_cor_error_detected(struct pci_dev *pdev);
pci_ers_result_t cxl_error_detected(struct pci_dev *pdev,
pci_channel_state_t state);
+void mark_cxl_pci_loaded(void);
#endif /* __CXL_PCI_H__ */
diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c
index 785aa2af5eaa..b019bd324dba 100644
--- a/drivers/cxl/pci.c
+++ b/drivers/cxl/pci.c
@@ -1189,6 +1189,8 @@ static int __init cxl_pci_driver_init(void)
if (rc)
pci_unregister_driver(&cxl_pci_driver);
+ mark_cxl_pci_loaded();
+
return rc;
}
--
2.17.1
Powered by blists - more mailing lists