From: Ben Cheatham <Benjamin.Cheatham@amd.com>
To: <linux-cxl@vger.kernel.org>, <linux-pci@vger.kernel.org>,
<linux-acpi@vger.kernel.org>
Cc: Ben Cheatham <Benjamin.Cheatham@amd.com>
Subject: [PATCH 10/16] cxl/core: Enable CXL.mem timeout
Date: Wed, 30 Jul 2025 16:47:12 -0500 [thread overview]
Message-ID: <20250730214718.10679-11-Benjamin.Cheatham@amd.com> (raw)
In-Reply-To: <20250730214718.10679-1-Benjamin.Cheatham@amd.com>
Add functions to enable and disable CXL.mem transaction timeout. Enable
timeout as part of CXL isolation set up.
Signed-off-by: Ben Cheatham <Benjamin.Cheatham@amd.com>
---
drivers/cxl/core/pci.c | 22 ++++++++++++++++++++++
drivers/cxl/core/port.c | 14 +++++++++-----
drivers/cxl/cxl.h | 4 ++++
include/cxl/isolation.h | 5 +++++
4 files changed, 40 insertions(+), 5 deletions(-)
diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c
index 89fb6d3854e3..dd6c602d57d3 100644
--- a/drivers/cxl/core/pci.c
+++ b/drivers/cxl/core/pci.c
@@ -1237,3 +1237,25 @@ int cxl_disable_isolation(struct cxl_dport *dport)
dev_dbg(dport->dport_dev, "Disabled CXL.mem isolation\n");
return 0;
}
+
+void cxl_enable_timeout(struct cxl_dport *dport)
+{
+ u32 ctrl;
+
+ ctrl = readl(dport->regs.isolation + CXL_ISOLATION_CTRL_OFFSET);
+ ctrl |= CXL_ISOLATION_CTRL_MEM_TIME_ENABLE;
+ writel(ctrl, dport->regs.isolation + CXL_ISOLATION_CTRL_OFFSET);
+
+ dev_dbg(dport->dport_dev, "Enabled CXL.mem transaction timeout\n");
+}
+
+void cxl_disable_timeout(struct cxl_dport *dport)
+{
+ u32 ctrl;
+
+ ctrl = readl(dport->regs.isolation + CXL_ISOLATION_CTRL_OFFSET);
+ ctrl &= ~CXL_ISOLATION_CTRL_MEM_TIME_ENABLE;
+ writel(ctrl, dport->regs.isolation + CXL_ISOLATION_CTRL_OFFSET);
+
+ dev_dbg(dport->dport_dev, "Disabled CXL.mem transaction timeout\n");
+}
diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c
index c9e7bfc082d5..6591e83e719c 100644
--- a/drivers/cxl/core/port.c
+++ b/drivers/cxl/core/port.c
@@ -1312,15 +1312,15 @@ static int cxl_dport_setup_interrupts(struct device *host,
}
/**
- * cxl_dport_enable_isolation - Enable CXL Isolation for a CXL dport. This is
- * an optional capability only supported by PCIe Root Ports.
+ * cxl_dport_enable_timeout_isolation - Enable CXL Isolation for a CXL dport.
+ * This is an optional capability only supported by PCIe Root Ports.
* @host: Host device for @dport
* @dport: CXL-capable PCIe Root Port
*
* Returns 0 if capability unsupported, or when enabled.
*/
-static int cxl_dport_enable_isolation(struct device *host,
- struct cxl_dport *dport)
+static int cxl_dport_enable_timeout_isolation(struct device *host,
+ struct cxl_dport *dport)
{
u32 cap;
int rc;
@@ -1342,6 +1342,10 @@ static int cxl_dport_enable_isolation(struct device *host,
return rc == -ENXIO ? 0 : rc;
cxl_enable_isolation(dport);
+
+ if (!(cap & CXL_ISOLATION_CAP_MEM_TIME_SUPP))
+ cxl_enable_timeout(dport);
+
return 0;
}
@@ -1408,7 +1412,7 @@ __devm_cxl_add_dport(struct cxl_port *port, struct device *dport_dev,
&component_reg_phys);
if (IS_ENABLED(CONFIG_CXL_ISOLATION)) {
- rc = cxl_dport_enable_isolation(host, dport);
+ rc = cxl_dport_enable_timeout_isolation(host, dport);
if (rc)
return ERR_PTR(rc);
}
diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h
index 8da1e40ab4e7..7f9c6bd6e010 100644
--- a/drivers/cxl/cxl.h
+++ b/drivers/cxl/cxl.h
@@ -136,10 +136,14 @@ static inline int ways_to_eiw(unsigned int ways, u8 *eiw)
/* CXL 3.2 8.2.4.24 CXL Timeout and Isolation Capability Structure */
#define CXL_ISOLATION_CAPABILITY_OFFSET 0x0
+#define CXL_ISOLATION_CAP_MEM_TIME_MASK GENMASK(3, 0)
+#define CXL_ISOLATION_CAP_MEM_TIME_SUPP BIT(4)
#define CXL_ISOLATION_CAP_MEM_ISO_SUPP BIT(16)
#define CXL_ISOLATION_CAP_INTR_SUPP BIT(26)
#define CXL_ISOLATION_CAP_INTR_MASK GENMASK(31, 27)
#define CXL_ISOLATION_CTRL_OFFSET 0x8
+#define CXL_ISOLATION_CTRL_MEM_TIME_MASK GENMASK(3, 0)
+#define CXL_ISOLATION_CTRL_MEM_TIME_ENABLE BIT(4)
#define CXL_ISOLATION_CTRL_MEM_ISO_ENABLE BIT(16)
#define CXL_ISOLATION_CTRL_MEM_INTR_ENABLE BIT(26)
#define CXL_ISOLATION_STATUS_OFFSET 0xC
diff --git a/include/cxl/isolation.h b/include/cxl/isolation.h
index 3ad05ccc5e01..73282ac262a6 100644
--- a/include/cxl/isolation.h
+++ b/include/cxl/isolation.h
@@ -28,10 +28,15 @@ struct cxl_dport;
#if IS_ENABLED(CONFIG_CXL_BUS)
void cxl_enable_isolation(struct cxl_dport *dport);
int cxl_disable_isolation(struct cxl_dport *dport);
+void cxl_enable_timeout(struct cxl_dport *dport);
+void cxl_disable_timeout(struct cxl_dport *dport);
+
#else /* !CONFIG_CXL_BUS */
static inline void cxl_enable_isolation(struct cxl_dport *dport) {}
static inline int cxl_disable_isolation(struct cxl_dport *dport)
{ return -ENXIO; }
+static inline void cxl_enable_timeout(struct cxl_dport *dport) {}
+static inline void cxl_disable_timeout(struct cxl_dport *dport) {}
#endif /* !CONFIG_CXL_BUS */
#ifdef CONFIG_CXL_ISOLATION
--
2.34.1
next prev parent reply other threads:[~2025-07-30 21:49 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-30 21:47 [PATCH 00/16] CXL.mem error isolation support Ben Cheatham
2025-07-30 21:47 ` [PATCH 01/16] cxl/regs: Add cxl_unmap_component_regs() Ben Cheatham
2025-09-12 14:46 ` Jonathan Cameron
2025-09-17 17:26 ` Cheatham, Benjamin
2025-07-30 21:47 ` [PATCH 02/16] cxl/regs: Add CXL Isolation capability mapping Ben Cheatham
2025-09-12 14:47 ` Jonathan Cameron
2025-07-30 21:47 ` [PATCH 03/16] PCI: PCIe portdrv: Add CXL Isolation service driver Ben Cheatham
2025-09-12 15:14 ` Jonathan Cameron
2025-09-17 17:26 ` Cheatham, Benjamin
2025-07-30 21:47 ` [PATCH 04/16] PCI: PCIe portdrv: Allocate CXL isolation MSI/-X vector Ben Cheatham
2025-08-04 21:39 ` Bjorn Helgaas
2025-08-06 17:58 ` Cheatham, Benjamin
2025-07-30 21:47 ` [PATCH 05/16] PCI: PCIe portdrv: Add interface for getting CXL isolation IRQ Ben Cheatham
2025-07-31 5:59 ` Lukas Wunner
2025-07-31 13:13 ` Cheatham, Benjamin
2025-07-30 21:47 ` [PATCH 06/16] cxl/core: Enable CXL.mem isolation Ben Cheatham
2025-09-12 15:21 ` Jonathan Cameron
2025-09-17 17:26 ` Cheatham, Benjamin
2025-07-30 21:47 ` [PATCH 07/16] cxl/core: Set up isolation interrupts Ben Cheatham
2025-09-12 15:25 ` Jonathan Cameron
2025-09-17 17:27 ` Cheatham, Benjamin
2025-07-30 21:47 ` [PATCH 08/16] cxl/core: Enable CXL " Ben Cheatham
2025-07-30 21:47 ` [PATCH 09/16] cxl/core: Prevent onlining CXL memory behind isolated ports Ben Cheatham
2025-07-30 21:47 ` Ben Cheatham [this message]
2025-07-30 21:47 ` [PATCH 11/16] cxl/pci: Add isolation handler Ben Cheatham
2025-07-30 21:47 ` [PATCH 12/16] PCI: PCIe portdrv: Add cxl_isolation sysfs attributes Ben Cheatham
2025-09-12 15:33 ` Jonathan Cameron
2025-09-17 17:27 ` Cheatham, Benjamin
2025-07-30 21:47 ` [PATCH 13/16] cxl/core, PCI: PCIe portdrv: Add CXL timeout range programming Ben Cheatham
2025-08-04 21:39 ` Bjorn Helgaas
2025-08-06 17:58 ` Cheatham, Benjamin
2025-09-12 15:55 ` Jonathan Cameron
2025-09-17 17:27 ` Cheatham, Benjamin
2025-07-30 21:47 ` [PATCH 14/16] ACPI: Add CXL isolation _OSC fields Ben Cheatham
2025-08-22 19:19 ` Rafael J. Wysocki
2025-07-30 21:47 ` [PATCH 15/16] cxl/core, cxl/acpi: Enable CXL isolation based on _OSC handshake Ben Cheatham
2025-07-30 21:47 ` [PATCH 16/16] cxl/core, cxl/acpi: Add CXL isolation notify handler Ben Cheatham
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=20250730214718.10679-11-Benjamin.Cheatham@amd.com \
--to=benjamin.cheatham@amd.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).